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 测试夹具
This commit is contained in:
yudshj committed 2026-11-04 18:17:57 +08:00
1 parent 50b159af26
commit 498d436db5
51 files changed
+934 -547

No files matched your search

+2 -8
View File
@@ -13,19 +13,13 @@ it.each([false, true])('settles startup after parent IPC disconnect (boot failur
const modules = join(root, 'node_modules', '@deepseek-ai')
const hostDirectory = fileURLToPath(new URL('../../desktop-host/', import.meta.url))
const manifest = JSON.parse(readFileSync(join(hostDirectory, 'package.json'), 'utf8')) as { dependencies: Record<string, string> }
const stubbed = new Set(['@deepseek-ai/dsh-app-boot', '@deepseek-ai/dsh', '@deepseek-ai/dsh-home-paths'])
const stubbed = new Set(['@deepseek-ai/dsh-app-boot', '@deepseek-ai/dsh'])
for (const name of Object.keys(manifest.dependencies)) {
const destination = join(root, 'node_modules', name)
mkdirSync(dirname(destination), { recursive: true })
if (stubbed.has(name)) mkdirSync(destination)
else symlinkSync(realpathSync(join(hostDirectory, 'node_modules', name)), destination, 'junction')
}
for (const [name, source] of [
['dsh-home-paths', `export const resolveDshHome = () => ${JSON.stringify(root)}`],
] as const) {
writeFileSync(join(modules, name, 'package.json'), '{"type":"module","exports":"./index.js"}')
writeFileSync(join(modules, name, 'index.js'), source)
}
writeFileSync(join(root, 'package.json'), '{"type":"module"}')
writeFileSync(join(modules, 'dsh-app-boot', 'package.json'), '{"type":"module","exports":"./index.js"}')
writeFileSync(join(modules, 'dsh-app-boot', 'index.js'), `
@@ -51,7 +45,7 @@ it.each([false, true])('settles startup after parent IPC disconnect (boot failur
copyFileSync(join(hostDirectory, 'lib', 'index.js'), entry)
const pnpm = join(root, 'bundled-pnpm.mjs')
const nodeBin = join(root, 'bin')
const child = fork(entry, [root, root, root, pnpm, nodeBin], { execArgv: [], stdio: ['ignore', 'ignore', 'pipe', 'ipc'] })
const child = fork(entry, [root, root, pnpm, nodeBin], { execArgv: [], stdio: ['ignore', 'ignore', 'pipe', 'ipc'] })
let stderr = ''
child.stderr!.setEncoding('utf8').on('data', (chunk: string) => { stderr += chunk })
const exited = new Promise<number | null>(resolve => child.once('exit', resolve))
@@ -636,7 +636,6 @@ it.each(['unset', 'empty', 'bundled', 'full', 'python-only', 'python-only-no-cli
]))
}
if (mode === 'python-only') expect(stderr).not.toContain('ENOENT')
if (mode === 'missing-assets') expect(stderr).toContain('SKILL.md')
await send(3, 'shutdown')
const exit = await child
expect(exit.timedOut).toBe(false)
+2 -9
View File
@@ -12,33 +12,26 @@
],
"dependencies": {
"koffi": "3.1.1",
"@deepseek-ai/libreoffice-kit": "^0.1.5",
"@deepseek-ai/libreoffice-kit": "0.2.3-rc.4",
"@deepseek-ai/cordis": "workspace:~",
"@deepseek-ai/dsh": "workspace:*",
"@deepseek-ai/dsh-agent": "workspace:*",
"@deepseek-ai/dsh-app-boot": "workspace:*",
"@deepseek-ai/dsh-client-connection": "workspace:*",
"@deepseek-ai/dsh-host-webserver": "workspace:*",
"@deepseek-ai/dsh-home-paths": "workspace:*",
"@deepseek-ai/dsh-jobs": "workspace:*",
"@deepseek-ai/dsh-schedule": "workspace:*",
"@deepseek-ai/dsh-tool-workspace-dependencies": "workspace:*",
"@deepseek-ai/dsh-skill-office": "workspace:*",
"@deepseek-ai/dsh-deepseek-account": "workspace:*",
"@deepseek-ai/dsh-workspace": "workspace:*",
"@deepseek-ai/dsh-plugin-manager": "workspace:*"
},
"devDependencies": {
"@deepseek-ai/cordis-plugin-loader": "workspace:~",
"@deepseek-ai/cordis-plugin-include": "workspace:~",
"@deepseek-ai/dsh-skill": "workspace:*",
"@deepseek-ai/dsh-fs": "workspace:*",
"@deepseek-ai/dsh-fs-local": "workspace:*",
"@deepseek-ai/dsh-session": "workspace:*",
"@deepseek-ai/dsh-session-persistence": "workspace:*",
"@deepseek-ai/dsh-sandbox-policy": "workspace:*",
"@deepseek-ai/dsh-util-workspace-path": "workspace:*",
"@deepseek-ai/dsh-brand": "workspace:*",
"@deepseek-ai/dsh-tool-executor-native": "workspace:*"
"@deepseek-ai/dsh-brand": "workspace:*"
}
}
+13 -6
View File
@@ -1,17 +1,24 @@
/** Public dsh commands using the immutable runtime carried by the Desktop installation. */
import { delimiter, dirname, join, resolve } from 'node:path'
import { basename, delimiter, dirname, join, resolve } from 'node:path'
import { runCli } from '@deepseek-ai/dsh/lib/bin.js'
import { installOfficeEngineResolution, runtimeArchivePath } from './office-engine.ts'
/**
* 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 runtimeDir - Prepared or ASAR-contained production DSH package tree.
* @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(runtimeDir: string, supportDir: string): Promise<void> {
installOfficeEngineResolution(runtimeDir)
export async function runDesktopCli(supportDir: string): Promise<void> {
await runCli({
manageDesktopProfile: true,
packageManager: {
@@ -32,5 +39,5 @@ if (import.meta.main) {
await installWindowsCliSignals()
}
const runtimeDir = resolve(import.meta.dirname, '../../../..')
await runDesktopCli(runtimeDir, join(dirname(runtimeArchivePath(runtimeDir) ?? runtimeDir), 'runtime'))
await runDesktopCli(join(dirname(runtimeArchivePath(runtimeDir) ?? runtimeDir), 'runtime'))
}
+3 -12
View File
@@ -9,14 +9,11 @@ import { runProfile } from '@deepseek-ai/dsh/profile-boot'
import type {} from '@deepseek-ai/dsh-client-connection'
import type {} from '@deepseek-ai/dsh-host-webserver'
import type {} from '@deepseek-ai/dsh-deepseek-account'
import { resolveDshHome } from '@deepseek-ai/dsh-home-paths'
import * as desktopOffice from './office.ts'
import { localDragResource } from './file-drag.ts'
import { installDesktopUpdateTaskControl } from './update-tasks.ts'
import { installDesktopQuitInspection } from './quit-inspection.ts'
import { installPlatformSessionPublisher } from './platform-session.ts'
import { installOfficeEngineResolution } from './office-engine.ts'
import { installOperationDiagnostics } from './operation-diagnostics.ts'
async function main(): Promise<void> {
@@ -24,7 +21,6 @@ async function main(): Promise<void> {
if (process.connected) process.send?.({ type: 'starting', runId }, (error) => { if (error !== null) console.error(error) })
const runtimeDir = process.argv[2] as string
const projectDir = process.argv[3] as string
installOfficeEngineResolution(runtimeDir)
const installAnchor = join(runtimeDir, 'node_modules', '@deepseek-ai', 'dsh', 'package.json')
const profile = loadProfileDirectory('dsh', projectDir, installAnchor)
reportSkippedBundles('dsh', profile)
@@ -34,14 +30,14 @@ async function main(): Promise<void> {
resolvedProfile: { profile, installAnchor },
patchFiles: [],
args: ['--no-open', '--host', '127.0.0.1', '--port', '0'],
...(process.argv[5] === undefined ? {} : {
...(process.argv[4] === undefined ? {} : {
packageManager: {
command: process.execPath,
args: ['--expose-internals', process.argv[5]],
args: ['--expose-internals', process.argv[4]],
env: {
ELECTRON_RUN_AS_NODE: '1',
DSH_DESKTOP_NODE_EXECUTABLE: process.execPath,
PATH: `${process.argv[6] ?? ''}${delimiter}${process.env.PATH ?? ''}`,
PATH: `${process.argv[5] ?? ''}${delimiter}${process.env.PATH ?? ''}`,
},
},
}),
@@ -131,11 +127,6 @@ async function main(): Promise<void> {
installOperationDiagnostics(ctx, record => send({ type: 'plugin-operation', record }), 32, runId)
control.updateTasks = installDesktopUpdateTaskControl(ctx)
control.quitInspection = installDesktopQuitInspection(ctx)
await ctx.plugin(desktopOffice, {
runtimeDir,
source: process.argv[4] ?? join(runtimeDir, '..', 'runtime', 'primary-runtime'),
root: join(resolveDshHome(), 'dsh-runtimes', 'dsh-primary-runtime'),
})
installPlatformSessionPublisher(ctx, (session) => {
if (process.connected) process.send?.({ type: 'platform-session', session })
})
-48
View File
@@ -1,48 +0,0 @@
/** Resolve packaged Office engine manifests from their complete, unpacked resource directories. */
import { registerHooks, type ModuleHooks } from 'node:module'
import { realpathSync } from 'node:fs'
import { basename, dirname, join, relative } from 'node:path'
import { fileURLToPath, pathToFileURL } from 'node:url'
/**
* 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
}
/**
* Keep engine executable and resource paths usable by native child processes outside Electron.
* Hooks apply only to this thread; worker threads must install their own resolver.
* @param runtimeDir - Prepared or ASAR-contained dsh runtime directory.
* @returns Installed resolver for the Host lifetime, or undefined for a non-ASAR runtime.
*/
export function installOfficeEngineResolution(runtimeDir: string): ModuleHooks | undefined {
if (runtimeArchivePath(runtimeDir) === undefined) return undefined
const root = realpathSync(runtimeDir)
const archive = dirname(root)
const source = pathToFileURL(join(root, 'node_modules', '@deepseek-ai', 'libreoffice-kit-')).href
const destination = pathToFileURL(join(`${archive}.unpacked`, relative(archive, root), 'node_modules', '@deepseek-ai', 'libreoffice-kit-')).href
return registerHooks({
resolve(specifier, context, nextResolve) {
const resolved = nextResolve(specifier, context)
if (!resolved.url.startsWith('file:')) return resolved
const engineRequest = /^@deepseek-ai\/libreoffice-kit-(?:darwin|win32|linux)-/u.test(specifier)
const engineTarget = /\/node_modules\/@deepseek-ai\/libreoffice-kit-(?:darwin|win32|linux)-[^/]+\//u
.test(new URL(resolved.url).pathname)
if (!engineRequest && !engineTarget) return resolved
const canonical = pathToFileURL(realpathSync(fileURLToPath(resolved.url))).href
if (!canonical.startsWith(source)) {
if (canonical.startsWith(pathToFileURL(archive + '/').href)) {
throw new Error(`desktop Office engine resolved outside the runtime package directory: ${resolved.url}`)
}
return resolved
}
const physical = realpathSync(fileURLToPath(destination + canonical.slice(source.length)))
return { ...resolved, url: pathToFileURL(physical).href }
},
})
}
-38
View File
@@ -1,38 +0,0 @@
/** Desktop Office skills and bundled authoring dependencies. */
import { realpathSync } from 'node:fs'
import { dirname, join, relative } from 'node:path'
import { fileURLToPath } from 'node:url'
import { runtimeArchivePath } from './office-engine.ts'
import type { Context } from '@deepseek-ai/cordis'
import * as officeSkills from '@deepseek-ai/dsh-skill-office'
import * as workspaceDependencies from '@deepseek-ai/dsh-tool-workspace-dependencies'
/** Loader identity for the application-owned Office composition. */
export const name = 'desktop-office'
/** Application-selected bundled payload and installation directories. */
export interface Config {
/** Bundled payload directory. Missing sibling `office-skills` resources fail Host startup. */
readonly source: string
/** Harness-home directory where workspace dependencies are installed. */
readonly root: string
/** Prepared or ASAR-contained application dependency directory. */
readonly runtimeDir: string
}
/**
* Enable offline Office authoring and LibreOffice Kit operations in the Desktop profile.
* @param ctx - Profile scope; child plugins declare their own service requirements.
* @param config - Bundled payload source and Harness-home installation root.
*/
export async function apply(ctx: Context, config: Config): Promise<void> {
await ctx.plugin(workspaceDependencies, config)
const archive = runtimeArchivePath(config.runtimeDir) === undefined ? undefined : dirname(realpathSync(config.runtimeDir))
const manifest = fileURLToPath(import.meta.resolve('@deepseek-ai/libreoffice-kit/package.json'))
const packageRoot = dirname(archive === undefined ? manifest : join(`${archive}.unpacked`, relative(archive, manifest)))
await ctx.plugin(officeSkills, {
assetRoot: join(dirname(config.source), 'office-skills'),
node: join(config.source, 'dependencies', 'node', 'bin', process.platform === 'win32' ? 'node.exe' : 'node'),
cli: join(packageRoot, 'lib', 'cli.js'),
})
}
@@ -1,139 +0,0 @@
import { mkdirSync, mkdtempSync, realpathSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'
import { createRequire, type ModuleHooks } from 'node:module'
import { tmpdir } from 'node:os'
import { dirname, join, sep } from 'node:path'
import { afterEach, expect, it } from 'vitest'
import { installOfficeEngineResolution } from '../src/office-engine.ts'
import { PackageManifests } from '../../../packages/boot/hmr/src/package-manifest.ts'
const roots: string[] = []
const hooks: ModuleHooks[] = []
const disposers: Array<() => void> = []
afterEach(() => {
for (const dispose of disposers.splice(0).reverse()) dispose()
for (const hook of hooks.splice(0)) hook.deregister()
const cache = createRequire(import.meta.url).cache
for (const path of Object.keys(cache)) {
if (roots.some(root => path.startsWith(root + sep))) Reflect.deleteProperty(cache, path)
}
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true })
})
function fixture(runtimeName = 'dsh') {
const root = realpathSync(mkdtempSync(join(tmpdir(), 'desktop-office-resolution-')))
roots.push(root)
const runtime = join(root, 'app.asar', runtimeName)
const manifest = 'node_modules/@deepseek-ai/libreoffice-kit-darwin-arm64/package.json'
for (const base of [runtime, join(root, 'app.asar.unpacked', runtimeName)]) {
const path = join(base, manifest)
mkdirSync(dirname(path), { recursive: true })
writeFileSync(path, JSON.stringify({ name: '@deepseek-ai/libreoffice-kit-darwin-arm64', path: realpathSync(dirname(path)) }))
}
const api = join(runtime, 'node_modules/@deepseek-ai/libreoffice-kit/package.json')
mkdirSync(dirname(api), { recursive: true })
writeFileSync(api, '{"name":"@deepseek-ai/libreoffice-kit"}')
const require: (specifier: string) => unknown = createRequire(join(runtime, 'package.json'))
const hook = installOfficeEngineResolution(runtime)!
hooks.push(hook)
return { root, runtime, manifest, require }
}
it('resolves engine manifests to physical directories and leaves unrelated modules alone', () => {
const f = fixture()
// Node 24.13 require.resolve bypasses hooks; Electron's require.resolve is covered by packaged Office smoke.
expect(f.require('@deepseek-ai/libreoffice-kit-darwin-arm64/package.json'))
.toMatchObject({ path: realpathSync(dirname(join(f.root, 'app.asar.unpacked', 'dsh', f.manifest))) })
expect((f.require('node:fs') as typeof import('node:fs')).realpathSync).toBe(realpathSync)
expect(f.require('@deepseek-ai/libreoffice-kit/package.json')).toEqual({ name: '@deepseek-ai/libreoffice-kit' })
})
it('resolves an absolute engine manifest to its unpacked copy', () => {
const f = fixture()
expect(f.require(join(f.runtime, f.manifest)))
.toMatchObject({ path: realpathSync(dirname(join(f.root, 'app.asar.unpacked', 'dsh', f.manifest))) })
})
it.each(['exports', 'main'] as const)('refreshes a cached plugin %s while Office resolution stays active', (field) => {
const f = fixture()
const packageRoot = join(f.root, 'plugin')
mkdirSync(packageRoot)
const manifest = join(packageRoot, 'package.json')
const a = join(packageRoot, 'a.cjs')
const b = join(packageRoot, 'b.cjs')
writeFileSync(manifest, JSON.stringify({ name: 'plugin', [field]: './a.cjs' }))
writeFileSync(a, 'module.exports = { marker: "a" }')
writeFileSync(b, 'module.exports = { marker: "b" }')
symlinkSync(packageRoot, join(f.runtime, 'node_modules', 'plugin'), process.platform === 'win32' ? 'junction' : 'dir')
const require = createRequire(join(f.runtime, 'package.json'))
const original: unknown = require('plugin')
const next: unknown = require(b)
const originalModule = require.cache[a]
const nextModule = require.cache[b]
const engine = f.require('@deepseek-ai/libreoffice-kit-darwin-arm64/package.json')
expect(original).toEqual({ marker: 'a' })
expect(next).toEqual({ marker: 'b' })
expect(require('plugin')).toBe(original)
const manifests = new PackageManifests()
disposers.push(() => { manifests.dispose() })
writeFileSync(manifest, JSON.stringify({ name: 'plugin', [field]: './b.cjs' }))
manifests.invalidate(manifest)
expect(require('plugin')).toBe(next)
expect(require.resolve('plugin')).toBe(b)
expect(require.cache[a]).toBe(originalModule)
expect(require.cache[b]).toBe(nextModule)
expect(require(a)).toBe(original)
expect(f.require('@deepseek-ai/libreoffice-kit-darwin-arm64/package.json')).toBe(engine)
expect(f.require(join(f.runtime, f.manifest))).toBe(engine)
})
it('rejects an engine missing from the unpacked tree instead of using its archived copy', () => {
const f = fixture()
rmSync(join(f.root, 'app.asar.unpacked'), { recursive: true })
expect(() => { f.require('@deepseek-ai/libreoffice-kit-darwin-arm64/package.json') }).toThrow()
})
it('leaves a prepared runtime without an archive unchanged', () => {
const root = mkdtempSync(join(tmpdir(), 'desktop-office-prepared-'))
roots.push(root)
expect(installOfficeEngineResolution(join(root, 'dsh'))).toBeUndefined()
})
it('preserves a renamed runtime directory when locating the unpacked engine', () => {
const f = fixture('alternate-runtime')
expect(f.require('@deepseek-ai/libreoffice-kit-darwin-arm64/package.json'))
.toMatchObject({ path: realpathSync(dirname(join(f.root, 'app.asar.unpacked', 'alternate-runtime', f.manifest))) })
})
it('resolves an engine through a directory alias', () => {
const f = fixture()
const alias = join(f.root, 'alias')
symlinkSync(join(f.root, 'app.asar'), alias, 'junction')
const require: (specifier: string) => unknown = createRequire(join(alias, 'dsh', 'package.json'))
expect(require('@deepseek-ai/libreoffice-kit-darwin-arm64/package.json'))
.toMatchObject({ path: realpathSync(dirname(join(f.root, 'app.asar.unpacked', 'dsh', f.manifest))) })
})
it('rejects an engine resolved elsewhere inside the archive', () => {
const f = fixture()
const other = join(f.root, 'app.asar', 'other', f.manifest)
mkdirSync(dirname(other), { recursive: true })
writeFileSync(other, '{}')
const require = createRequire(join(f.root, 'app.asar', 'other', 'package.json'))
expect(() => { require('@deepseek-ai/libreoffice-kit-darwin-arm64/package.json') })
.toThrow('outside the runtime package directory')
})
it('leaves external engines and the archived WASM engine at their own locations', () => {
const f = fixture()
const external = join(f.root, 'external', f.manifest)
const wasm = join(f.runtime, 'node_modules/@deepseek-ai/libreoffice-kit-wasm/package.json')
for (const path of [external, wasm]) {
mkdirSync(dirname(path), { recursive: true })
writeFileSync(path, JSON.stringify({ path: realpathSync(dirname(path)) }))
}
const require: (specifier: string) => unknown = createRequire(join(f.root, 'external', 'package.json'))
expect(require('@deepseek-ai/libreoffice-kit-darwin-arm64/package.json'))
.toMatchObject({ path: realpathSync(dirname(external)) })
expect(f.require('@deepseek-ai/libreoffice-kit-wasm/package.json'))
.toMatchObject({ path: realpathSync(dirname(wasm)) })
})
-70
View File
@@ -1,70 +0,0 @@
import * as NativeToolExecutor from '@deepseek-ai/dsh-tool-executor-native'
import { cp, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join, sep } from 'node:path'
import { pathToFileURL } from 'node:url'
import { Context } from '@deepseek-ai/cordis'
import Loader from '@deepseek-ai/cordis-plugin-loader'
import Include from '@deepseek-ai/cordis-plugin-include'
import AgentRegistry from '@deepseek-ai/dsh-agent'
import SystemPrompt from '@deepseek-ai/dsh-system-prompt'
import SkillRegistry from '@deepseek-ai/dsh-skill'
import ToolRuntime from '@deepseek-ai/dsh-tools'
import { expect, it, vi } from 'vitest'
import * as desktopOffice from '../src/office.ts'
it('loads Desktop Office CLI paths and removes them on disposal', async () => {
const root = await mkdtemp(join(tmpdir(), 'desktop-office-'))
vi.stubEnv('DSH_HOME', root)
const ctx = new Context()
try {
const assets = join(root, 'runtime', 'office-skills')
await cp(new URL('../../../packages/skill/skill-office/assets/', import.meta.url), assets, { recursive: true })
const nodeDirectory = join(root, 'runtime', 'primary-runtime', 'dependencies', 'node', 'bin')
await mkdir(nodeDirectory, { recursive: true })
await cp(process.execPath, join(nodeDirectory, process.platform === 'win32' ? 'node.exe' : 'node'))
ctx.baseUrl = pathToFileURL(root).href + '/'
await ctx.plugin(Loader)
ctx.loader.builtins.include = Include
expect('default' in desktopOffice).toBe(false)
expect(ctx.loader.unwrapExports(desktopOffice)).toBe(desktopOffice)
const modules = new Map<string, unknown>([
['agents', AgentRegistry], ['systemPrompt', SystemPrompt], ['tools', ToolRuntime], ['toolExecutor', NativeToolExecutor],
['skills', SkillRegistry], ['office', desktopOffice],
])
ctx.loader.internal = {
version: 'v2',
async import(specifier: string) {
if (!modules.has(specifier)) throw new Error(`unexpected plugin ${specifier}`)
return modules.get(specifier)
},
} as unknown as NonNullable<typeof ctx.loader.internal>
const config = join(root, 'cordis.yml')
await writeFile(config, [
'- name: agents', '- name: systemPrompt', '- name: tools', '- name: skills', '- name: office',
' config:', ` source: ${JSON.stringify(join(root, 'runtime', 'primary-runtime'))}`,
` root: ${JSON.stringify(join(root, 'installed'))}`,
` runtimeDir: ${JSON.stringify(join(root, 'dsh'))}`, '',
].join('\n'))
await ctx.loader.create({ name: 'cordis:include', config: { path: pathToFileURL(config).href } })
await ctx.loader.await()
for (const entry of ctx.loader.entries()) await entry.fiber?.await()
expect((await ctx.skills.list()).map(skill => skill.name)).toEqual(['office', 'office-docx', 'office-export-pdf', 'office-pptx', 'office-recalculate', 'office-render', 'office-xlsx'])
expect((await ctx.skills.get('office-pptx'))?.resourceBase).toEqual({ kind: 'directory', path: join(assets, 'office-pptx').split(sep).join('/') })
expect((await ctx.skills.get('office-pptx'))?.content).toContain('office-render')
expect((await ctx.skills.get('office-pptx'))?.content).not.toContain(nodeDirectory)
expect(ctx.tools.schemas().map(tool => tool.name)).toEqual(['load_workspace_dependencies'])
const entry = [...ctx.loader.entries()].find(entry => entry.options.name === 'office')
expect(entry).toBeDefined()
await entry?.fiber?.dispose()
expect(await ctx.skills.list()).toEqual([])
expect(ctx.tools.schemas()).toEqual([])
} finally {
try { await ctx.fiber.dispose() }
finally {
vi.unstubAllEnvs()
await rm(root, { recursive: true, force: true })
}
}
})
-3
View File
@@ -13,9 +13,6 @@
{ "path": "../../packages/jobs/jobs" },
{ "path": "../../packages/schedule/schedule" },
{ "path": "../../packages/workspace/workspace" },
{ "path": "../../packages/skill/skill-office" },
{ "path": "../../packages/util/home-paths" },
{ "path": "../../packages/skill/tool-workspace-dependencies" },
{
"path": "../cli"
},
+2 -2
View File
@@ -27,8 +27,8 @@
en: 3724c53da4f7647b
zh: 76ae549d43c99bb4
/deepseek-harness-desktop/key-technical-decisions/bundled-workspace-dependencies:
en: 3368ff9b955ada69
zh: e9209ef6ad4fd305
en: 20dd884240f67420
zh: b2333a952af45463
/deepseek-harness-desktop/bundled-command-runtime:
en: 372297005b57a08b
zh: 074a635ac17e4362
+1 -1
View File
@@ -103,7 +103,7 @@ Signed Windows packaging scans the primary runtime and application production de
Desktop carries independent Python, Node.js and pnpm distributions. Python includes numpy, pandas, python-docx, python-pptx, openpyxl, Pillow, lxml and XlsxWriter with their complete dependencies. The `load_workspace_dependencies` tool installs this payload offline on first use under `$DSH_HOME/dsh-runtimes/dsh-primary-runtime` (normally `~/.dsh/dsh-runtimes/dsh-primary-runtime`) and returns absolute interpreter, pnpm script and library paths plus `pythonDistributions`, the bundled distribution names and versions. The version report excludes user-installed additions. Office tasks prefer these libraries unless user or workspace instructions select another environment. Execute the pnpm script with the returned Node executable. The returned Node library directory is reserved for bundled libraries, not pnpm's global installation directory.
Desktop exposes the compact `office` router and named authoring/operation subskills. Authoring uses bundled Python libraries; operation skills invoke the configured Node and CLI paths. Skills live in `runtime/office-skills` outside ASAR. See the [Office skill package](../../packages/skill/skill-office/README.md) for progressive loading and limitations.
Desktop exposes the compact `office` router and named authoring/operation subskills. Authoring uses bundled Python libraries; operation skills invoke the configured Node and CLI paths. Skills live in `runtime/office-skills` outside ASAR. A missing or invalid skill file removes only that skill from the catalog, and Office profile rows that cannot load leave Office skills or `load_workspace_dependencies` unavailable; neither failure stops Host startup. See the [Office skill package](../../packages/skill/skill-office/README.md) for progressive loading and limitations.
The payload follows the Desktop release. `runtime.json` records the Desktop version, target, top-level interpreter/package-manager versions and the Python distribution map, and a digest of the selected target’s locked payload inputs and assembly format. Distribution names use PEP 503 normalization; duplicate normalized names reject the manifest. Legacy `components` manifests remain readable through normalization, with their existing library-version consistency checks. Matching installations are reused; a dependency or archive change replaces the directory after a complete staged copy even when the Desktop version stays unchanged. Older manifests without a digest are replaced on their next installation. User-added Python packages remain only while the payload identity matches. A failed directory replacement retains the previous installation; Windows may refuse replacement while an interpreter is still running.
+1 -1
View File
@@ -103,7 +103,7 @@ Windows 签名打包按 PE 文件内容扫描第一方运行时和应用生产
Desktop 携带独立的 Python、Node.js 和 pnpm 分发包。Python 包含 numpy、pandas、python-docx、python-pptx、openpyxl、Pillow、lxml、XlsxWriter 及其完整依赖。`load_workspace_dependencies` 工具首次使用时,将该产物离线安装到 `$DSH_HOME/dsh-runtimes/dsh-primary-runtime`(通常为 `~/.dsh/dsh-runtimes/dsh-primary-runtime`),并返回解释器、pnpm 脚本和库目录的绝对路径,以及记录内置分发包名称与版本的 `pythonDistributions`。版本报告不包含用户自行安装的包。Office 任务默认使用这些库,用户或工作区指令指定其他环境时遵循其要求。pnpm 脚本通过返回的 Node 可执行文件运行。返回的 Node 库目录为随包交付的库预留,不是 pnpm 的全局安装目录。
Desktop 展示精简的 `office` 路由及可具名调用的创作/操作子技能。创作使用内置 Python 库;操作技能调用配置的 Node 和 CLI 路径。技能位于 ASAR 外的 `runtime/office-skills`。渐进加载与限制见 [Office 技能包](../../packages/skill/skill-office/README.zh.md)。
Desktop 展示精简的 `office` 路由及可具名调用的创作/操作子技能。创作使用内置 Python 库;操作技能调用配置的 Node 和 CLI 路径。技能位于 ASAR 外的 `runtime/office-skills`。缺失或无效的技能文件只会把该技能移出目录;Office 配置行无法加载时,Office 技能或 `load_workspace_dependencies` 不可用。这两种失败都不会阻止 Host 启动。渐进加载与限制见 [Office 技能包](../../packages/skill/skill-office/README.zh.md)。
该产物随 Desktop 版本发布。`runtime.json` 记录 Desktop 版本、目标平台、顶层解释器和包管理器版本及 Python 分发包版本表,以及所选目标的锁定产物输入与组装格式的摘要。分发包名称按 PEP 503 归一化;名称归一化后重复时,清单会被拒绝。旧 `components` 清单通过归一化继续可读,并保留其原有库版本一致性校验。匹配的安装会被复用;依赖或压缩包变化后,即使 Desktop 版本不变,也会在完整暂存副本完成后替换目录。不含摘要的旧清单会在下次安装时被替换。用户自行添加的 Python 包仅在产物身份一致时保留。目录替换失败时保留之前的安装;解释器仍在运行时,Windows 可能拒绝替换。
@@ -4,7 +4,7 @@ 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/office-engine.ts'
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'
+4 -2
View File
@@ -9,6 +9,7 @@ import { promisify } from 'node:util'
import { fileURLToPath } from 'node:url'
import { readPrimaryRuntime, workspaceDependencyPaths } from '../../../packages/skill/tool-workspace-dependencies/src/index.ts'
import { DesktopHostProcess } from '../src/host-process.ts'
import { desktopOfficeEnvironment } from '../src/office-cli.ts'
import { createPluginProfile } from '../src/project-manager.ts'
import type { DesktopRuntimeDescriptor } from '../src/runtime-tree.ts'
@@ -34,8 +35,9 @@ export async function smokeDesktopRuntime(
npm_config_userconfig: join(home, 'npmrc'), npm_config_globalconfig: join(home, 'npmrc'),
npm_config_store_dir: join(home, 'store'), npm_config_enable_global_virtual_store: 'false',
}
const host = new DesktopHostProcess(node, root, profile, undefined, hostEnvironment,
undefined, join(resourcesRuntime, 'primary-runtime'),
const host = new DesktopHostProcess(node, root, profile, undefined,
{ ...hostEnvironment, ...desktopOfficeEnvironment(root, join(resourcesRuntime, 'primary-runtime')) },
undefined,
{ pnpm: join(resourcesRuntime, 'primary-runtime', 'dependencies', 'pnpm', 'bin', 'pnpm.mjs'), nodeBin: join(resourcesRuntime, 'bin') })
let timer: ReturnType<typeof setTimeout> | undefined
try {
-4
View File
@@ -182,8 +182,6 @@ export class DesktopHostProcess {
* @param inspectPort - Optional loopback inspector port for workspace development.
* @param environment - Environment inherited by the Host and its plugin subprocesses.
* @param onFailure - Receives the first unexpected child failure, including after readiness.
* @param primaryRuntime - Optional bundled dependency payload; when supplied, missing sibling
* `office-skills` resources fail Host startup.
* @param packageManager - Bundled pnpm entry and Node launcher directory, scoped to package operations.
* @param onPlatformSession - Private credential updates for embedded Platform views.
* @param onPluginOperation - Optional diagnostic sink; malformed records are ignored without failing the Host.
@@ -195,7 +193,6 @@ export class DesktopHostProcess {
private readonly inspectPort?: number,
private readonly environment: NodeJS.ProcessEnv = process.env,
private readonly onFailure?: (error: Error) => void,
private readonly primaryRuntime?: string,
private readonly packageManager?: { readonly pnpm: string; readonly nodeBin: string },
private readonly onPlatformSession?: (session: PlatformSession | null) => void,
@@ -215,7 +212,6 @@ export class DesktopHostProcess {
entry,
this.runtimeDir,
this.projectDir,
this.primaryRuntime ?? join(this.runtimeDir, '..', 'runtime', 'primary-runtime'),
...this.packageManager === undefined ? [] : [this.packageManager.pnpm, this.packageManager.nodeBin],
], {
cwd: this.projectDir,
+1 -1
View File
@@ -1,4 +1,4 @@
/** Release metadata for the Desktop Host lifecycle protocol. */
/** Lifecycle protocol generation recorded in Desktop release metadata. */
export const DESKTOP_HOST_PROTOCOL_VERSION = 4 as const
export const DESKTOP_HOST_PROTOCOL_VERSION = 5 as const
+6 -2
View File
@@ -29,6 +29,7 @@ import {
import { resolveDesktopPaths } from './paths.ts'
import { DesktopProjectManager } from './project-manager.ts'
import { DesktopHostFatalError, DesktopHostProcess, DesktopHostUncleanExitError } from './host-process.ts'
import { desktopOfficeEnvironment } from './office-cli.ts'
import { DesktopPlatformView, PLATFORM_IPC, platformBounds } from './platform-view.ts'
import { installDesktopFileDrag } from './file-drag.ts'
import { installDesktopDirectoryPicker } from './directory-picker.ts'
@@ -525,8 +526,11 @@ async function main(): Promise<void> {
const backend = new DesktopBackendController((onFailure) => {
const hostInspectPort = developmentHostInspectPort(development)
const host = new DesktopHostProcess(resources.node, resources.dsh, activeProject,
hostInspectPort, { ...hostEnvironment, DSH_CLIENT_VERSION: desktopClientVersion() }, onFailure,
primaryRuntime,
hostInspectPort, {
...hostEnvironment,
...desktopOfficeEnvironment(resources.dsh, primaryRuntime),
DSH_CLIENT_VERSION: desktopClientVersion(),
}, onFailure,
resources, (next) => { platformView.setSession(next) }, (record) => {
operationJournal ??= new OperationJournal(join(app.getPath('userData'), 'plugin-operations'), {
segmentBytes: 256 * 1024, recordBytes: 4096, queuedBytes: 64 * 1024,
+41
View File
@@ -0,0 +1,41 @@
/** Bundled Office locations that the Desktop profile's Office rows read from the Host environment. */
import { realpathSync } from 'node:fs'
import { createRequire } from 'node:module'
import { basename, dirname, isAbsolute, join, relative, sep } from 'node:path'
/**
* Locate the LibreOffice Kit CLI entry that a standalone Node child process can execute.
* @param runtimeDir - Prepared or ASAR-contained dsh runtime directory that carries the Desktop Host package.
* @returns Absolute CLI entry; ASAR runtimes resolve only from their physical unpacked runtime.
* @throws When the unpacked runtime or required Kit package is missing; callers must stop Office startup.
*/
export function officeCliPath(runtimeDir: string): string {
const packed = basename(dirname(runtimeDir)) === 'app.asar'
// Plain Node cannot traverse ASAR entries; canonicalize only the archive and physical unpacked directory.
const directory = packed
? realpathSync(join(`${realpathSync(dirname(runtimeDir))}.unpacked`, basename(runtimeDir)))
: runtimeDir
// createRequire needs an anchor path, not an existing file: DesktopHost itself can remain in the archive.
const anchor = join(directory, 'node_modules', '@deepseek-ai', 'dsh-desktop-host', 'package.json')
const manifest = createRequire(anchor).resolve('@deepseek-ai/libreoffice-kit/package.json')
if (packed) {
const path = relative(directory, realpathSync(manifest))
if (isAbsolute(path) || path === '..' || path.startsWith(`..${sep}`)) {
throw Object.assign(new Error(`LibreOffice Kit is missing from the unpacked runtime: ${directory}. Reinstall Desktop.`),
{ code: 'MODULE_NOT_FOUND' })
}
}
return join(dirname(manifest), 'lib', 'cli.js')
}
/**
* Environment entries that point the Desktop profile's Office rows at bundled resources.
* @param runtimeDir - dsh runtime directory passed to the Desktop Host.
* @param primaryRuntime - Bundled Python, Node.js, and pnpm payload whose sibling `office-skills` holds the skills.
* @returns `DSH_BUNDLED_PRIMARY_RUNTIME` and `DSH_BUNDLED_OFFICE_CLI`.
* @throws When the runtime does not carry LibreOffice Kit.
*/
export function desktopOfficeEnvironment(runtimeDir: string, primaryRuntime: string): NodeJS.ProcessEnv {
return { DSH_BUNDLED_PRIMARY_RUNTIME: primaryRuntime, DSH_BUNDLED_OFFICE_CLI: officeCliPath(runtimeDir) }
}
+9 -6
View File
@@ -3,11 +3,9 @@
import { delimiter, join } from 'node:path'
import { afterEach, expect, it, vi } from 'vitest'
import { runCli } from '@deepseek-ai/dsh/lib/bin.js'
import { runDesktopCli } from '../../desktop-host/src/cli.ts'
import { installOfficeEngineResolution } from '../../desktop-host/src/office-engine.ts'
import { runDesktopCli, runtimeArchivePath } from '../../desktop-host/src/cli.ts'
vi.mock('@deepseek-ai/dsh/lib/bin.js', () => ({ runCli: vi.fn() }))
vi.mock('../../desktop-host/src/office-engine.ts', () => ({ installOfficeEngineResolution: vi.fn() }))
afterEach(() => {
vi.unstubAllEnvs()
@@ -16,12 +14,10 @@ afterEach(() => {
it.each(['system-bin', undefined])('dispatches with bundled pnpm when PATH is %s', async (path) => {
vi.stubEnv('PATH', path)
const runtime = join('Application 中文 with spaces', 'resources', 'app.asar', 'dsh')
const support = join('Application 中文 with spaces', 'resources', 'runtime')
await runDesktopCli(runtime, support)
await runDesktopCli(support)
expect(installOfficeEngineResolution).toHaveBeenCalledExactlyOnceWith(runtime)
expect(runCli).toHaveBeenCalledExactlyOnceWith({
manageDesktopProfile: true,
packageManager: {
@@ -35,3 +31,10 @@ it.each(['system-bin', undefined])('dispatches with bundled pnpm when PATH is %s
},
})
})
it('locates the archive of an ASAR-contained runtime and leaves a prepared runtime without one', () => {
const resources = join('Application 中文', 'resources')
expect(runtimeArchivePath(join(resources, 'app.asar', 'dsh'))).toBe(join(resources, 'app.asar'))
expect(runtimeArchivePath(join(resources, 'app.asar.unpacked', 'dsh'))).toBeUndefined()
expect(runtimeArchivePath(join(resources, 'dsh'))).toBeUndefined()
})
+54
View File
@@ -0,0 +1,54 @@
/** Synthetic Desktop project for built-Host e2e tests; callers own `root` and restore stubbed variables. */
import { mkdirSync, readFileSync } from 'node:fs'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { vi } from 'vitest'
import { DesktopProjectManager } from '../src/project-manager.ts'
import { resolveDesktopPaths, type DesktopPaths } from '../src/paths.ts'
import { DESKTOP_HOST_PROTOCOL_VERSION } from '../src/host-protocol.ts'
import { prepareDevelopmentProject } from '../scripts/development-project.ts'
/** Repository root of this checkout. */
export const repository = fileURLToPath(new URL('../../../', import.meta.url))
/** Built Host entry that these tests require. */
export const builtHost = join(repository, 'apps/desktop-host/lib/index.js')
function version(path: string): string {
return (JSON.parse(readFileSync(path, 'utf8')) as { version: string }).version
}
/**
* Stub a credential-free Desktop launch environment and apply a synthetic release under `root`.
* @param root - Scratch directory owned by the caller.
* @returns Harness home, synthetic project directory, and Desktop paths under that home.
*/
export async function prepareDesktopHome(root: string): Promise<{ home: string; project: string; paths: DesktopPaths }> {
for (const name of Object.keys(process.env)) {
if (/KEY|TOKEN|SECRET|PASSWORD/u.test(name)) vi.stubEnv(name, undefined)
}
// The production shell supplies the client version that Desktop-only profile rows require.
vi.stubEnv('DSH_CLIENT_VERSION', '1.2.3')
const home = join(root, 'home')
mkdirSync(home)
vi.stubEnv('DSH_HOME', home)
vi.stubEnv('DSH_TELEMETRY_MODE', 'DISABLED')
const project = prepareDevelopmentProject({
projectDir: join(root, 'project'),
cliDir: join(repository, 'apps/cli'),
hostDir: join(repository, 'apps/desktop-host'),
dependencyDir: join(repository, 'node_modules/.pnpm/node_modules'),
release: {
schemaVersion: 1,
version: version(join(repository, 'apps/desktop/package.json')),
pnpmVersion: version(join(repository, 'apps/desktop/node_modules/pnpm/package.json')),
nodeVersion: process.versions.node,
hostProtocolVersion: DESKTOP_HOST_PROTOCOL_VERSION,
},
// The synthetic project is not packaged, so nothing compares its descriptor target with this host.
target: 'mac-x64',
})
const paths = resolveDesktopPaths(home)
await new DesktopProjectManager(paths, { dsh: project }).applyRelease()
return { home, project, paths }
}
+8 -9
View File
@@ -147,7 +147,7 @@ ${HTTP_HOST}`)
onTestFinished(async () => { await journal.close() })
const sink = vi.fn(value => journal.enqueue(JSON.stringify(value)))
const first = new DesktopHostProcess(process.execPath, runtime, runtime, undefined, process.env,
undefined, undefined, undefined, undefined, sink)
undefined, undefined, undefined, sink)
hosts.push(first)
await first.start()
await first.stop()
@@ -160,7 +160,7 @@ ${HTTP_HOST}`)
try {
const failure = vi.fn()
const second = new DesktopHostProcess(process.execPath, runtime, runtime, undefined, process.env,
failure, undefined, undefined, undefined, () => { throw new Error('sink unavailable') })
failure, undefined, undefined, () => { throw new Error('sink unavailable') })
hosts.push(second)
await second.start()
expect(await second.updateTasks('inspect')).toBe(false)
@@ -252,15 +252,14 @@ ${HTTP_HOST}`)
expect(failure).not.toHaveBeenCalled()
})
it('passes external dependencies and package-manager paths to the Host', async () => {
it('passes only package-manager paths after the runtime and project arguments', async () => {
const runtime = projectWithHost(HTTP_HOST.replace('runtime: process.argv[2]',
'pnpm: process.argv[5], nodeBin: process.argv[6], primaryRuntime: process.argv[4], runtime: process.argv[2]'))
const primaryRuntime = join(runtime, 'external-primary-runtime')
'pnpm: process.argv[4], nodeBin: process.argv[5], argc: process.argv.length, runtime: process.argv[2]'))
const host = new DesktopHostProcess(process.execPath, runtime, runtime, undefined, process.env,
undefined, primaryRuntime, { pnpm: join(runtime, 'pnpm.mjs'), nodeBin: join(runtime, 'bin') })
undefined, { pnpm: join(runtime, 'pnpm.mjs'), nodeBin: join(runtime, 'bin') })
hosts.push(host)
const { url } = await host.start()
expect(await (await fetch(url)).json()).toMatchObject({ primaryRuntime, pnpm: join(runtime, 'pnpm.mjs'), nodeBin: join(runtime, 'bin') })
expect(await (await fetch(url)).json()).toMatchObject({ pnpm: join(runtime, 'pnpm.mjs'), nodeBin: join(runtime, 'bin'), argc: 6 })
})
it('reports a fatal event after readiness once', async () => {
@@ -342,7 +341,7 @@ ${HTTP_HOST}`)
it.each([null, 'stable-account'])('carries Platform identity %s over private IPC and clears credentials on shutdown', async (userId) => {
const runtime = projectWithHost(HTTP_HOST.replace("process.send({ type: 'ready'", "process.send({ type: 'platform-session', session: { origin: 'https://platform.deepseek.com', userId: " + JSON.stringify(userId) + ", token: 'fixture-secret', embeddedPageDist: 'feat/test' } }); process.send({ type: 'ready'"))
const changed = vi.fn()
const host = new DesktopHostProcess(process.execPath, runtime, runtime, undefined, process.env, undefined, undefined, undefined, changed)
const host = new DesktopHostProcess(process.execPath, runtime, runtime, undefined, process.env, undefined, undefined, changed)
hosts.push(host)
await host.start()
expect(changed).toHaveBeenCalledWith({ origin: 'https://platform.deepseek.com', userId, token: 'fixture-secret', embeddedPageDist: 'feat/test' })
@@ -355,7 +354,7 @@ it.each([undefined, '', 7])('rejects malformed Platform account identity %s on p
const runtime = projectWithHost(HTTP_HOST.replace("process.send({ type: 'ready'",
`process.send({ type: 'platform-session', session: ${JSON.stringify(session)} }); process.send({ type: 'ready'`))
const changed = vi.fn()
const host = new DesktopHostProcess(process.execPath, runtime, runtime, undefined, process.env, undefined, undefined, undefined, changed)
const host = new DesktopHostProcess(process.execPath, runtime, runtime, undefined, process.env, undefined, undefined, changed)
hosts.push(host)
await expect(host.start()).rejects.toThrow('invalid IPC event')
expect(changed.mock.calls).toEqual([[null]])
+13 -7
View File
@@ -169,10 +169,9 @@ const harness = await vi.hoisted(async () => {
constructor(
readonly node: string, readonly runtime: string, readonly profile: string,
readonly inspectPort?: number, readonly environment?: NodeJS.ProcessEnv, readonly onFailure?: (error: Error) => void,
readonly primaryRuntime?: string,
readonly packageManager?: { pnpm: string; nodeBin: string },
readonly onPlatformSession?: ConstructorParameters<typeof DesktopHostProcess>[8],
readonly onPluginOperation?: ConstructorParameters<typeof DesktopHostProcess>[9],
readonly onPlatformSession?: ConstructorParameters<typeof DesktopHostProcess>[7],
readonly onPluginOperation?: ConstructorParameters<typeof DesktopHostProcess>[8],
) { hosts.push(this) }
}
const app = Object.assign(new EventEmitter(), {
@@ -348,6 +347,11 @@ vi.mock('../src/login-shell-environment.ts', async importOriginal => ({
readDesktopLoginShellEnvironment: harness.loginShell,
}))
vi.mock('../src/runtime-tree.ts', () => ({ readDesktopRuntime: () => ({ release: { version: '1.0.0' } }) }))
vi.mock('../src/office-cli.ts', () => ({
desktopOfficeEnvironment: (runtime: string, primaryRuntime: string) => ({
DSH_BUNDLED_PRIMARY_RUNTIME: primaryRuntime, DSH_BUNDLED_OFFICE_CLI: join(runtime, 'office-cli.js'),
}),
}))
vi.mock('../src/paths.ts', () => ({ resolveDesktopPaths: () => ({ profile: 'desktop-test-profile' }) }))
vi.mock('../src/project-manager.ts', () => ({
DesktopProjectManager: class {
@@ -502,8 +506,10 @@ describe('desktop main startup', () => {
await readyForUpdate()
const host = harness.hosts[0]!
expect(host.node).toBe(process.execPath)
expect(host.primaryRuntime).toBe(packaged
? join('desktop-test-resources', 'runtime', 'primary-runtime') : 'test-primary-runtime')
expect(host.environment).toMatchObject({
DSH_BUNDLED_PRIMARY_RUNTIME: packaged ? join('desktop-test-resources', 'runtime', 'primary-runtime') : 'test-primary-runtime',
DSH_BUNDLED_OFFICE_CLI: join(host.runtime, 'office-cli.js'),
})
expect(host.packageManager).toMatchObject({
pnpm: packaged
? join('desktop-test-resources', 'runtime', 'primary-runtime', 'dependencies', 'pnpm', 'bin', 'pnpm.mjs')
@@ -2844,7 +2850,7 @@ describe('desktop main startup', () => {
expect(harness.hosts[0]).toMatchObject({
node: process.execPath,
runtime: join(harness.app.getAppPath(), 'dsh'),
primaryRuntime: join('desktop-test-resources', 'runtime', 'primary-runtime'),
environment: { DSH_BUNDLED_PRIMARY_RUNTIME: join('desktop-test-resources', 'runtime', 'primary-runtime') },
profile: 'desktop-test-profile',
})
expect(harness.hosts[0]!.environment).not.toBe(process.env)
@@ -2866,7 +2872,7 @@ describe('desktop main startup', () => {
await harness.hostStarted.promise
const project = join(harness.app.getAppPath(), '.desktop-build', 'development', 'project')
expect(harness.hosts[0]).toMatchObject({ node: process.execPath, runtime: project,
primaryRuntime: 'test-primary-runtime', profile: 'desktop-test-profile' })
environment: { DSH_BUNDLED_PRIMARY_RUNTIME: 'test-primary-runtime' }, profile: 'desktop-test-profile' })
expect(harness.applyRelease).toHaveBeenCalledOnce()
harness.hosts[0]!.ready.resolve()
await harness.navigated.promise
+143
View File
@@ -0,0 +1,143 @@
import { mkdirSync, mkdtempSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from 'node:fs'
import { createRequire } from 'node:module'
import { tmpdir } from 'node:os'
import { dirname, join } from 'node:path'
import { afterEach, expect, it } from 'vitest'
import { desktopOfficeEnvironment, officeCliPath } from '../src/office-cli.ts'
const roots: string[] = []
afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }) })
function temporaryRoot(): string {
const root = realpathSync(mkdtempSync(join(tmpdir(), 'desktop-office-cli-')))
roots.push(root)
return root
}
function installPackage(directory: string, name: string): string {
const pkg = join(directory, 'node_modules', '@deepseek-ai', name)
mkdirSync(join(pkg, 'lib'), { recursive: true })
writeFileSync(join(pkg, 'package.json'), JSON.stringify({ name: `@deepseek-ai/${name}` }))
writeFileSync(join(pkg, 'lib', 'cli.js'), 'export {}\n')
return pkg
}
function runtime(directory: string): string {
installPackage(directory, 'dsh-desktop-host')
return join(installPackage(directory, 'libreoffice-kit'), 'lib', 'cli.js')
}
function archiveRuntime(runtimeName = 'dsh') {
const root = temporaryRoot()
const resources = join(root, '应用 Resources')
mkdirSync(resources)
const archive = join(resources, 'app.asar')
// Plain Node cannot traverse an archive file; this helper must only read its unpacked sibling.
writeFileSync(archive, 'archive fixture')
return { root, resources, archive, directory: join(archive, runtimeName), unpacked: join(`${archive}.unpacked`, runtimeName) }
}
it('returns the CLI entry inside a prepared runtime', () => {
const directory = join(temporaryRoot(), '准备 runtime')
const cli = runtime(directory)
expect(officeCliPath(directory)).toBe(cli)
})
it('preserves default DesktopHost dependency resolution outside ASAR', () => {
const directory = join(temporaryRoot(), 'dsh')
runtime(directory)
const host = join(directory, 'node_modules', '@deepseek-ai', 'dsh-desktop-host')
const kit = installPackage(host, 'libreoffice-kit')
expect(officeCliPath(directory)).toBe(join(kit, 'lib', 'cli.js'))
})
it('accepts a prepared runtime directory alias', () => {
const root = temporaryRoot()
const directory = join(root, '准备 runtime')
const cli = runtime(directory)
const alias = join(root, 'runtime alias')
symlinkSync(directory, alias, process.platform === 'win32' ? 'junction' : 'dir')
expect(officeCliPath(alias)).toBe(cli)
})
it('resolves an unpacked CLI beside an ASAR file under plain Node', () => {
const f = archiveRuntime()
const cli = runtime(f.unpacked)
// An ancestor package must not substitute for the shipped unpacked copy.
installPackage(f.root, 'libreoffice-kit')
expect(statSync(f.archive).isFile()).toBe(true)
expect(desktopOfficeEnvironment(f.directory, '/resources/runtime/primary-runtime')).toEqual({
DSH_BUNDLED_PRIMARY_RUNTIME: '/resources/runtime/primary-runtime',
DSH_BUNDLED_OFFICE_CLI: cli,
})
expect(statSync(cli).isFile()).toBe(true)
})
it('preserves the ASAR runtime basename with spaces and non-ASCII characters', () => {
const f = archiveRuntime('运行 runtime')
const cli = runtime(f.unpacked)
expect(officeCliPath(f.directory)).toBe(cli)
})
it('accepts an ASAR resource directory alias', () => {
const f = archiveRuntime()
const cli = runtime(f.unpacked)
const alias = join(f.root, '资源 alias')
symlinkSync(f.resources, alias, process.platform === 'win32' ? 'junction' : 'dir')
expect(officeCliPath(join(alias, 'app.asar', 'dsh'))).toBe(cli)
})
it('accepts an unpacked runtime directory alias', () => {
const f = archiveRuntime()
const physical = join(f.root, '实体 runtime')
const cli = runtime(physical)
mkdirSync(dirname(f.unpacked))
symlinkSync(physical, f.unpacked, process.platform === 'win32' ? 'junction' : 'dir')
expect(officeCliPath(f.directory)).toBe(cli)
})
it('resolves kit from the physical DesktopHost package through a directory alias', () => {
const f = archiveRuntime()
const host = installPackage(join(f.unpacked, 'packages'), 'dsh-desktop-host')
const kit = installPackage(host, 'libreoffice-kit')
const alias = join(f.unpacked, 'node_modules', '@deepseek-ai', 'dsh-desktop-host')
mkdirSync(dirname(alias), { recursive: true })
symlinkSync(host, alias, process.platform === 'win32' ? 'junction' : 'dir')
expect(officeCliPath(f.directory)).toBe(join(kit, 'lib', 'cli.js'))
})
it('fails when the unpacked runtime is missing', () => {
const f = archiveRuntime()
installPackage(f.root, 'libreoffice-kit')
expect(() => officeCliPath(f.directory)).toThrow(expect.objectContaining({ code: 'ENOENT' }))
})
it('resolves the unpacked kit when DesktopHost itself remains in the archive', () => {
const f = archiveRuntime()
const kit = installPackage(f.unpacked, 'libreoffice-kit')
expect(officeCliPath(f.directory)).toBe(join(kit, 'lib', 'cli.js'))
})
it('fails when the unpacked kit package is missing', () => {
const f = archiveRuntime()
installPackage(f.unpacked, 'dsh-desktop-host')
expect(() => officeCliPath(f.directory)).toThrow(expect.objectContaining({ code: 'MODULE_NOT_FOUND' }))
})
it('rejects an ancestor kit package when the unpacked kit is missing', () => {
const f = archiveRuntime()
const host = installPackage(f.unpacked, 'dsh-desktop-host')
const external = installPackage(f.root, 'libreoffice-kit')
expect(createRequire(join(host, 'package.json')).resolve('@deepseek-ai/libreoffice-kit/package.json'))
.toBe(join(external, 'package.json'))
expect(() => officeCliPath(f.directory)).toThrow(expect.objectContaining({ code: 'MODULE_NOT_FOUND' }))
})
it('rejects a kit directory alias outside the unpacked runtime', () => {
const f = archiveRuntime()
installPackage(f.unpacked, 'dsh-desktop-host')
const external = installPackage(`${f.unpacked}-external`, 'libreoffice-kit')
const alias = join(f.unpacked, 'node_modules', '@deepseek-ai', 'libreoffice-kit')
symlinkSync(external, alias, process.platform === 'win32' ? 'junction' : 'dir')
expect(() => officeCliPath(f.directory)).toThrow(expect.objectContaining({ code: 'MODULE_NOT_FOUND' }))
})
@@ -0,0 +1,45 @@
/** Built Desktop Host startup with incomplete or unusable Office resources; run after the repository build. */
import { cpSync, existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { DesktopHostProcess } from '../src/host-process.ts'
import { desktopOfficeEnvironment } from '../src/office-cli.ts'
import { builtHost, prepareDesktopHome, repository } from './harness.ts'
afterEach(() => { vi.unstubAllEnvs() })
describe.skipIf(!existsSync(builtHost))('built Desktop Host Office resources', () => {
it.each([
['one missing Office skill file', 'missing-skill'],
['an empty runtime directory', 'empty-runtime'],
['an unusable primary runtime path', 'relative-source'],
] as const)('starts the Host with %s', async (_label, mode) => {
const root = mkdtempSync(join(tmpdir(), 'dsh-desktop-office-'))
let host: DesktopHostProcess | undefined
const failures: Error[] = []
try {
const { project, paths } = await prepareDesktopHome(root)
const runtime = join(root, 'runtime')
mkdirSync(runtime)
if (mode !== 'empty-runtime') {
cpSync(join(repository, 'packages/skill/skill-office/assets'), join(runtime, 'office-skills'), { recursive: true })
if (mode === 'missing-skill') rmSync(join(runtime, 'office-skills', 'office-docx', 'SKILL.md'))
}
writeFileSync(join(paths.profile, 'cordis.patch.yml'), '- id: webserver\n config:\n host: 127.0.0.1\n port: 0\n')
const primaryRuntime = mode === 'relative-source' ? 'runtime/primary-runtime' : join(runtime, 'primary-runtime')
host = new DesktopHostProcess(process.execPath, project, paths.profile, undefined,
{ ...process.env, ...desktopOfficeEnvironment(project, primaryRuntime) }, (error) => { failures.push(error) })
const { url } = await host.start()
// The authenticated URL exchanges its token for a session cookie by redirecting.
const response = await fetch(url, { redirect: 'manual' })
await response.body?.cancel()
expect(response.status).toBe(303)
expect(failures).toEqual([])
} finally {
await host?.stop()
rmSync(root, { recursive: true, force: true })
}
})
})
+5 -41
View File
@@ -5,25 +5,16 @@ import { createServer } from 'node:http'
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { DesktopHostProcess } from '../src/host-process.ts'
import { DesktopProjectManager } from '../src/project-manager.ts'
import { resolveDesktopPaths } from '../src/paths.ts'
import { desktopClientMetadata } from '../src/client-metadata.ts'
import { connectDesktopWelcome, type DesktopWelcomeBackend } from '../src/welcome-backend.ts'
import { authenticateWebHost } from '../src/web-document.ts'
import { DESKTOP_HOST_PROTOCOL_VERSION } from '../src/host-protocol.ts'
import { prepareDevelopmentProject } from '../scripts/development-project.ts'
import { desktopOfficeEnvironment } from '../src/office-cli.ts'
import { builtHost, prepareDesktopHome, repository } from './harness.ts'
const repository = fileURLToPath(new URL('../../../', import.meta.url))
const builtHost = join(repository, 'apps/desktop-host/lib/index.js')
afterEach(() => { vi.unstubAllEnvs() })
function version(path: string): string {
return (JSON.parse(readFileSync(path, 'utf8')) as { version: string }).version
}
async function mockPlatform() {
let origin = ''
let init: Record<string, string> = {}
@@ -85,49 +76,22 @@ async function mockPlatform() {
describe.skipIf(!existsSync(builtHost))('built Desktop welcome flow', () => {
it('persists explicit API keys and browser account login independently across Host restarts', async () => {
vi.stubEnv('DSH_CLIENT_VERSION', '1.2.3')
const root = mkdtempSync(join(tmpdir(), 'dsh-desktop-welcome-'))
let host: DesktopHostProcess | undefined
const platform = await mockPlatform()
try {
for (const name of Object.keys(process.env)) {
if (/KEY|TOKEN|SECRET|PASSWORD/u.test(name)) vi.stubEnv(name, undefined)
}
const home = join(root, 'home')
mkdirSync(home)
vi.stubEnv('DSH_HOME', home)
vi.stubEnv('DSH_TELEMETRY_MODE', 'DISABLED')
const project = prepareDevelopmentProject({
projectDir: join(root, 'project'),
cliDir: join(repository, 'apps/cli'),
hostDir: join(repository, 'apps/desktop-host'),
dependencyDir: join(repository, 'node_modules/.pnpm/node_modules'),
release: {
schemaVersion: 1,
version: version(join(repository, 'apps/desktop/package.json')),
pnpmVersion: version(join(repository, 'apps/desktop/node_modules/pnpm/package.json')),
nodeVersion: process.versions.node,
hostProtocolVersion: DESKTOP_HOST_PROTOCOL_VERSION,
},
// This suite assembles a synthetic project on hosts that prepare no Desktop target, and
// nothing it exercises compares the descriptor's platform/arch outside packaging.
target: 'mac-x64',
})
const { home, project, paths } = await prepareDesktopHome(root)
cpSync(join(repository, 'packages/skill/skill-office/assets'), join(root, 'runtime/office-skills'), { recursive: true })
const nodeBin = join(root, 'runtime/primary-runtime/dependencies/node/bin')
mkdirSync(nodeBin, { recursive: true })
cpSync(process.execPath, join(nodeBin, process.platform === 'win32' ? 'node.exe' : 'node'))
const paths = resolveDesktopPaths(home)
const manager = new DesktopProjectManager(paths, {
dsh: project,
})
await manager.applyRelease()
writeFileSync(join(paths.profile, 'cordis.patch.yml'), `- id: webserver\n config:\n host: 127.0.0.1\n port: 0\n- id: deepseek-account\n config:\n${process.platform === 'linux' ? ' desktopPlatform: darwin\n' : ''} platformOrigin: ${platform.origin}\n allowLoopbackHttp: true\n requestHeaders:\n Cookie: test_gate=synthetic\n`)
let backend: DesktopWelcomeBackend
let hostOrigin = ''
const restart = async (): Promise<void> => {
await host?.stop()
host = new DesktopHostProcess(process.execPath, project, paths.profile)
host = new DesktopHostProcess(process.execPath, project, paths.profile, undefined,
{ ...process.env, ...desktopOfficeEnvironment(project, join(root, 'runtime', 'primary-runtime')) })
const { url } = await host.start()
hostOrigin = new URL(url).origin
backend = connectDesktopWelcome(url, await authenticateWebHost(url))
+1 -1
View File
@@ -2535,7 +2535,7 @@ export interface Config {
## `@deepseek-ai/dsh-office-to-pdf`
- `source`: [`packages/document/office-to-pdf/src/index.ts:31`](../packages/document/office-to-pdf/src/index.ts)
- `source`: [`packages/document/office-to-pdf/src/index.ts:32`](../packages/document/office-to-pdf/src/index.ts)
```ts config-catalog
/** Provider concurrency and kit rendering/font configuration. */
+1 -1
View File
@@ -2537,7 +2537,7 @@ export interface Config {
## `@deepseek-ai/dsh-office-to-pdf`
- `source`: [`packages/document/office-to-pdf/src/index.ts:31`](../packages/document/office-to-pdf/src/index.ts)
- `source`: [`packages/document/office-to-pdf/src/index.ts:32`](../packages/document/office-to-pdf/src/index.ts)
```ts config-catalog
/** Provider concurrency and kit rendering/font configuration. */
@@ -18,8 +18,8 @@
en: e68bfcde70f845b4
zh: 73e5c4fb067c4fa1
/package-surface-rules/internal-dependency-syntax-follows-the-package-family:
en: d6bb855545b7b05b
zh: 6c489ed5a2ed0ae5
en: c39d3e2db0aee3c9
zh: 9c728bcb3a76bb61
/package-surface-rules/a-new-resolve-hook-is-refused-outright:
en: b420ae3e228432d5
zh: 0c49c4a9c3a5262c
+2 -2
View File
@@ -151,7 +151,7 @@ Restating a required-devDependency package list or the field rules on this page
Internal dependency syntax follows the package family: `@deepseek-ai/dsh` and `@deepseek-ai/dsh-*` use `workspace:*`, every other internal package uses `workspace:~`, and `workspace:^` has retired. The same dependency name is written the same way in every workspace, and a mismatch is a hard scan failure rather than a warning a reviewer can waive. The uniform syntax keeps one resolution path and prevents duplicate instances of a dependency and the resolution differences that follow them.
- Judged by `workspaceRange()` in [verify-package-dependencies.ts](../../scripts/verify-package-dependencies.ts): the `@deepseek-ai/dsh` and `@deepseek-ai/dsh-*` families get `workspace:*`, every other internal package gets `workspace:~`; the scan walks the managed manifests and compares every declaration of the same dependency name.
- Boundary: a same-namespace package that is not a workspace member declares an ordinary third-party range and is outside the family rule — `@deepseek-ai/libreoffice-kit` is declared `^0.1.5` in `apps/desktop-host/package.json` (dependencies), `packages/bundle/web-app/package.json` (devDependencies), `packages/document/office-to-pdf/package.json` (dependencies), and `packages/skill/skill-office/package.json` (dependencies).
- Boundary: a same-namespace package that is not a workspace member declares an ordinary third-party range and is outside the family rule — `@deepseek-ai/libreoffice-kit` is declared `0.2.3-rc.4` in `apps/desktop-host/package.json` (dependencies), `packages/bundle/web-app/package.json` (devDependencies), `packages/document/office-to-pdf/package.json` (dependencies), and `packages/skill/skill-office/package.json` (dependencies).
- Distribution is not restated here; the recompute command below prints the current counts of `workspace:*`, `workspace:~`, `workspace:^`, and any exact-range declaration outside the family rule.
- Exception: the scan decides mechanically; a genuine exception means changing the scan and the policy file with the domain owner's confirmation and the reason on the change.
- Recompute:
@@ -167,7 +167,7 @@ Each family in its form, with the non-member exception left as an ordinary versi
"dependencies": {
"@deepseek-ai/dsh-base": "workspace:*",
"@deepseek-ai/cordis": "workspace:~",
"@deepseek-ai/libreoffice-kit": "^0.1.5"
"@deepseek-ai/libreoffice-kit": "0.2.3-rc.4"
},
"devDependencies": {
"@deepseek-ai/dsh-typert-registry": "workspace:*"
@@ -151,7 +151,7 @@ Restating a required-devDependency package list or the field rules on this page
内部依赖写法按包族决定:`@deepseek-ai/dsh` 与 `@deepseek-ai/dsh-*` 用 `workspace:*`,其余内部包用 `workspace:~`,`workspace:^` 已退出。同一个依赖名在所有 workspace 内写法一致,不一致是扫描硬失败,不是评审可以放行的警告。写法统一才能保持一条解析路径,避免同一个依赖出现重复实例以及随之而来的解析差异。
- 判定在 [verify-package-dependencies.ts](../../scripts/verify-package-dependencies.ts) 的 `workspaceRange()`:`@deepseek-ai/dsh` 与 `@deepseek-ai/dsh-*` 包族取 `workspace:*`,其余内部包取 `workspace:~`;扫描遍历受管清单,比对同一依赖名的每一处声明。
- 边界:同命名空间但不是 workspace 成员的包按普通第三方版本范围声明,不受包族规则约束——`@deepseek-ai/libreoffice-kit` 在 `apps/desktop-host/package.json`(dependencies)、`packages/bundle/web-app/package.json`(devDependencies)、`packages/document/office-to-pdf/package.json`(dependencies)、`packages/skill/skill-office/package.json`(dependencies)中声明为 `^0.1.5`。
- 边界:同命名空间但不是 workspace 成员的包按普通第三方版本范围声明,不受包族规则约束——`@deepseek-ai/libreoffice-kit` 在 `apps/desktop-host/package.json`(dependencies)、`packages/bundle/web-app/package.json`(devDependencies)、`packages/document/office-to-pdf/package.json`(dependencies)、`packages/skill/skill-office/package.json`(dependencies)中声明为 `0.2.3-rc.4`。
- 分布不在此复述;下面的复算命令会打印 `workspace:*`、`workspace:~`、`workspace:^` 的当前数量,以及族规则之外的精确版本声明。
- 例外:门禁机械判定;确需例外意味着修改扫描与策略文件,并须经对应领域专家确认、在改动上说明理由。
- 复算:
@@ -167,7 +167,7 @@ python3 -c "import json,glob,collections; c=collections.Counter(); [c.update([r]
"dependencies": {
"@deepseek-ai/dsh-base": "workspace:*",
"@deepseek-ai/cordis": "workspace:~",
"@deepseek-ai/libreoffice-kit": "^0.1.5"
"@deepseek-ai/libreoffice-kit": "0.2.3-rc.4"
},
"devDependencies": {
"@deepseek-ai/dsh-typert-registry": "workspace:*"
+18
View File
@@ -291,6 +291,24 @@
- id: office-to-pdf
name: '@deepseek-ai/dsh-office-to-pdf'
# Desktop Office skills and bundled authoring dependencies. The Desktop
# Host sets both carrier paths before boot; a row that fails to load leaves
# the rest of the Host running.
- id: workspace-dependencies
name: '@deepseek-ai/dsh-tool-workspace-dependencies'
disabled: !!js "ctx.get('profileContext')?.name !== 'desktop'"
config:
source: !!js process.env.DSH_BUNDLED_PRIMARY_RUNTIME
root: !!js dshHomePath('dsh-runtimes', 'dsh-primary-runtime')
- id: skill-office
name: '@deepseek-ai/dsh-skill-office'
disabled: !!js "ctx.get('profileContext')?.name !== 'desktop'"
config:
assetRoot: !!js "process.getBuiltinModule('node:path').join(process.env.DSH_BUNDLED_PRIMARY_RUNTIME, '..', 'office-skills')"
node: !!js "process.getBuiltinModule('node:path').join(process.env.DSH_BUNDLED_PRIMARY_RUNTIME, 'dependencies', 'node', 'bin', process.platform === 'win32' ? 'node.exe' : 'node')"
cli: !!js process.env.DSH_BUNDLED_OFFICE_CLI
# The right Sidebar's document tab: bounded file reads with selectable
# Markdown, code, HTML, PDF, Office, and plain-text renderers.
- id: ui-sidebar-documentpreview
+8 -2
View File
@@ -158,6 +158,8 @@
"@deepseek-ai/dsh-plugin-manager": "workspace:*",
"@deepseek-ai/dsh-plugin-market": "workspace:*",
"@deepseek-ai/dsh-schedule": "workspace:*",
"@deepseek-ai/dsh-skill-office": "workspace:*",
"@deepseek-ai/dsh-tool-workspace-dependencies": "workspace:*",
"@deepseek-ai/dsh-session-log-export": "workspace:*",
"@deepseek-ai/dsh-session-reference": "workspace:*",
"@deepseek-ai/dsh-session-stats": "workspace:*",
@@ -222,7 +224,11 @@
"@deepseek-ai/dsh-session-projection": "workspace:*",
"@deepseek-ai/dsh-shell-env": "workspace:*",
"@deepseek-ai/dsh-typert-registry": "workspace:*",
"@deepseek-ai/libreoffice-kit": "^0.1.5",
"@deepseek-ai/dsh-otel": "workspace:*"
"@deepseek-ai/libreoffice-kit": "0.2.3-rc.4",
"@deepseek-ai/dsh-otel": "workspace:*",
"@deepseek-ai/dsh-home-paths": "workspace:*",
"@deepseek-ai/dsh-skill": "workspace:*",
"@deepseek-ai/dsh-system-prompt": "workspace:*",
"@deepseek-ai/dsh-tools": "workspace:*"
}
}
@@ -0,0 +1,81 @@
/** Desktop Office rows over a real Loader tree: carrier paths, profile gating, and per-row failure containment. */
import { cp, mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { Context } from '@deepseek-ai/cordis'
import Loader from '@deepseek-ai/cordis-plugin-loader'
import { loadOverlayPatches } from '@deepseek-ai/dsh-app-boot'
import { dshHomePath } from '@deepseek-ai/dsh-home-paths'
import SkillRegistry from '@deepseek-ai/dsh-skill'
import * as SkillOffice from '@deepseek-ai/dsh-skill-office'
import SystemPrompt from '@deepseek-ai/dsh-system-prompt'
import ToolRuntime from '@deepseek-ai/dsh-tools'
import * as WorkspaceDependencies from '@deepseek-ai/dsh-tool-workspace-dependencies'
import { afterEach, expect, it, onTestFinished, vi } from 'vitest'
const assets = fileURLToPath(new URL('../../../skill/skill-office/assets/', import.meta.url))
const names = ['office', 'office-docx', 'office-export-pdf', 'office-pptx', 'office-recalculate', 'office-render', 'office-xlsx']
afterEach(() => { vi.unstubAllEnvs() })
async function boot(profile: string, primaryRuntime: (root: string) => string | undefined) {
const root = await mkdtemp(join(tmpdir(), 'dsh-desktop-office-rows-'))
onTestFinished(() => rm(root, { recursive: true, force: true }))
vi.stubEnv('DSH_HOME', join(root, 'home'))
vi.stubEnv('DSH_BUNDLED_PRIMARY_RUNTIME', primaryRuntime(root))
vi.stubEnv('DSH_BUNDLED_OFFICE_CLI', join(root, 'office-cli.js'))
await cp(assets, join(root, 'office-skills'), { recursive: true })
const ctx = new Context()
onTestFinished(() => ctx.fiber.dispose())
ctx.provide('profileContext', {
name: profile, dir: '/profile', patchPath: '/profile/cordis.patch.yml', installAnchor: '/profile/package.json',
cwd: '/workspace', home: '/home', startedBundles: [], overlays: [], telemetryDisabledEnv: undefined,
})
ctx.provide('dshHomePath', dshHomePath)
await ctx.plugin(SystemPrompt)
await ctx.plugin(ToolRuntime)
await ctx.plugin(SkillRegistry)
ctx.baseUrl = 'file:///'
await ctx.plugin(Loader).await()
ctx.loader.builtins.dependencies = WorkspaceDependencies
ctx.loader.builtins.office = SkillOffice
const rows = loadOverlayPatches('desktop-office', fileURLToPath(new URL('../cordis.patch.yml', import.meta.url)))
.flatMap(patch => patch.insert ?? []).filter(row => row.id === 'workspace-dependencies' || row.id === 'skill-office')
expect(rows.map(row => row.id)).toEqual(['workspace-dependencies', 'skill-office'])
await ctx.loader.root.update(rows.map(row => ({ ...row, name: row.id === 'skill-office' ? 'cordis:office' : 'cordis:dependencies' })))
await ctx.loader.await()
return { ctx, root }
}
it('mounts Office skills and workspace dependencies from the Desktop carrier paths', async () => {
const { ctx, root } = await boot('desktop', root => join(root, 'primary-runtime'))
expect(ctx.loader.resolve('skill-office').fiber?.config).toEqual({
assetRoot: join(root, 'office-skills'),
node: join(root, 'primary-runtime', 'dependencies', 'node', 'bin', process.platform === 'win32' ? 'node.exe' : 'node'),
cli: join(root, 'office-cli.js'),
})
expect(ctx.loader.resolve('workspace-dependencies').fiber?.config).toEqual({
source: join(root, 'primary-runtime'), root: join(root, 'home', 'dsh-runtimes', 'dsh-primary-runtime'),
})
expect((await ctx.skills.list()).map(skill => skill.name)).toEqual(names)
expect(ctx.tools.schemas().map(tool => tool.name)).toEqual(['load_workspace_dependencies'])
})
it('keeps both rows disabled outside the Desktop profile', async () => {
const { ctx } = await boot('web', () => undefined)
expect(ctx.loader.resolve('skill-office').disabled).toBe(true)
expect(ctx.loader.resolve('workspace-dependencies').disabled).toBe(true)
expect(await ctx.skills.list()).toEqual([])
expect(ctx.tools.schemas()).toEqual([])
})
it('fails only the Office rows when the carrier supplies an unusable primary runtime path', async () => {
const { ctx } = await boot('desktop', () => 'primary-runtime')
for (const id of ['skill-office', 'workspace-dependencies']) {
await expect(ctx.loader.resolve(id).fiber!.await()).rejects.toThrow('absolute')
}
expect(await ctx.skills.list()).toEqual([])
expect(ctx.tools.schemas()).toEqual([])
})
@@ -15,11 +15,11 @@
en: d152484eb41ac6b4
zh: a134331a31395608
/deepseek-ai-dsh-office-to-pdf/use-this-package:
en: b92c13cb8f11a03c
zh: 091a22d07620394e
en: c3f323de206bd0f5
zh: c5008ff6adf54412
/deepseek-ai-dsh-office-to-pdf/understand-the-implementation:
en: 7365ecf20a1ce0d9
zh: 98a66de0eb89451e
en: f4b51c65697245d1
zh: 5fb1c293b308a7c7
/deepseek-ai-dsh-office-to-pdf/further-exploration:
en: 4d5e635227d14056
zh: 6c72a032786acd55
+3 -1
View File
@@ -29,7 +29,7 @@ The [Web bundle](../../bundle/web-app/README.md) mounts this provider as `office
Callers submit authorized source identity, version, optional byte size, a deferred bounded read, Office extension, and scheduling priority through `ctx.officeToPdf.convert()`. A changed source version rejects conversion. Results contain caller-owned PDF bytes, missing fonts, a cache key, and a conversion generation that changes on configuration replacement. Cancellation rejects with its reason; conversion failures use `OfficeToPdfError`.
The provider depends on the independently published [`@deepseek-ai/libreoffice-kit`](https://github.com/deepseek-ai/dsh-libreoffice-kit) npm API at kit version `^0.1.5`. Application packaging selects the matching native package declared in the kit’s `optionalDependencies`, or WASM when no native package is declared for that target. A missing declared native engine rejects packaging without selecting WASM. The [release ownership decision](../../../.agents/notes/implemented/architecture/2026-09-14-independent-libreoffice-kit.md) defines the independent kit and Harness responsibilities.
The provider depends on the independently published [`@deepseek-ai/libreoffice-kit`](https://github.com/deepseek-ai/dsh-libreoffice-kit) npm API at kit version `0.2.3-rc.4`. Application packaging selects the matching native package declared in the kit’s `optionalDependencies`, or WASM when no native package is declared for that target. A missing declared native engine rejects packaging without selecting WASM. The [release ownership decision](../../../.agents/notes/implemented/architecture/2026-09-14-independent-libreoffice-kit.md) defines the independent kit and Harness responsibilities.
Browsers request PDFs through the `officeToPdf.render` Remote method with a Session identity, Office path, and priority. This entry uses `workspaceFiles` for authorization and source versions, then reads raw bytes through `fs.readBytes` within the conversion reservation. In-process `convert()` does not require those services. Responses retain the source path and version and carry native PDF bytes through the binary Remote multipart transport, plus missing fonts and conversion generation. The `officeToPdf.generation` Remote method returns the current provider generation; `api/remotes` mounts the generated Client descriptor.
@@ -60,6 +60,8 @@ The defaults retain 8 PDFs/128 MiB and 64 source aliases, admit 32 readers and 8
<details>
<summary>Implementation internals — click to expand</summary>
The provider supplies a kit engine-package resolver anchored at the kit's own installation. Native package paths inside an ASAR archive map to the adjacent `.asar.unpacked` copy so child processes can access the engine. WASM retains Node's logical path for Electron's archive-aware filesystem. [Desktop packaging](../../../apps/desktop/packaging/README.md#runtime-file-selection) owns which packages are unpacked.
Invalid engine metadata, missing required assets, and conversion errors reject the request instead of switching engines. The shared WASM engine uses LibreOffice's CPU image filter. Native conversion uses its separate platform engine.
Each concurrent slot lazily creates and reuses one kit converter. The provider writes authorized input into a private temporary directory, reads a bounded regular PDF, and removes the directory before settling. Canceling an admitted reader does not block later queued work. Reader cancellation releases only that reader; the final reader and provider disposal cancel shared work. Disposal reports `unavailable` to outstanding readers and joins conversions and converter teardown.
+3 -1
View File
@@ -29,7 +29,7 @@ kind: "package-reference"
调用方通过 `ctx.officeToPdf.convert()` 提交已授权源的标识、版本、可选字节数、延迟的有界读取、Office 扩展名和调度优先级。源版本变化会拒绝转换。结果包含调用方拥有的 PDF 字节、缺失字体、缓存键和转换 generation;配置替换后 generation 随之改变。取消以原因为拒绝值,转换失败使用 `OfficeToPdfError`。
此 provider 依赖独立发布的 [`@deepseek-ai/libreoffice-kit`](https://github.com/deepseek-ai/dsh-libreoffice-kit) npm API,kit 版本为 `^0.1.5`。应用打包选择 kit 的 `optionalDependencies` 中声明的匹配原生包;目标没有声明原生包时选择 WASM。已声明的原生引擎缺失时拒绝打包,不会选择 WASM。[发布归属决策](../../../.agents/notes/implemented/architecture/2026-09-14-independent-libreoffice-kit.zh.md)定义独立 kit 与 Harness 各自的职责。
此 provider 依赖独立发布的 [`@deepseek-ai/libreoffice-kit`](https://github.com/deepseek-ai/dsh-libreoffice-kit) npm API,kit 版本为 `0.2.3-rc.4`。应用打包选择 kit 的 `optionalDependencies` 中声明的匹配原生包;目标没有声明原生包时选择 WASM。已声明的原生引擎缺失时拒绝打包,不会选择 WASM。[发布归属决策](../../../.agents/notes/implemented/architecture/2026-09-14-independent-libreoffice-kit.zh.md)定义独立 kit 与 Harness 各自的职责。
浏览器通过 `officeToPdf.render` Remote 方法请求 PDF,参数为 Session 标识、Office 路径和优先级。此入口使用 `workspaceFiles` 完成授权和源版本检查,再通过 `fs.readBytes` 在转换预留容量内读取原始字节。进程内 `convert()` 不要求这些服务。响应保留源文件路径与版本,通过二进制 Remote 的 multipart 传输携带原生 PDF 字节,并携带缺失字体和转换 generation。`officeToPdf.generation` Remote 方法返回当前提供方 generation;`api/remotes` 负责挂载生成的 Client 描述符。
@@ -60,6 +60,8 @@ kind: "package-reference"
<details>
<summary>实现内部细节 — 点击展开</summary>
提供方为 kit 传入以 kit 自身安装位置为起点的引擎包解析器。ASAR 归档内的原生包路径映射到相邻的 `.asar.unpacked` 副本,使子进程能够访问引擎。WASM 保留 Node 逻辑路径,由 Electron 支持归档的文件系统读取。[Desktop 打包](../../../apps/desktop/packaging/README.zh.md#runtime-file-selection)负责决定解包哪些包。
引擎元数据无效、必需资源缺失和转换错误会拒绝请求,不会切换引擎。共享的 WASM 引擎使用 LibreOffice 的 CPU 图像过滤器。原生转换使用独立的平台引擎。
每个并发槽按需创建并复用一个 kit 转换器。提供方将已授权输入写入私有临时目录,读取有大小上限的普通 PDF 文件,并在完成前删除目录。取消已准入的读取方不会阻塞后续排队工作。读取方取消只会释放该读取方;最后一个读取方和提供方卸载会取消共享工作。卸载向未完成读取方报告 `unavailable`,并等待转换及转换器清理结束。
+1 -1
View File
@@ -57,7 +57,7 @@
"@deepseek-ai/dsh-session": "workspace:*"
},
"dependencies": {
"@deepseek-ai/libreoffice-kit": "^0.1.5",
"@deepseek-ai/libreoffice-kit": "0.2.3-rc.4",
"@deepseek-ai/schemastery": "workspace:~",
"@deepseek-ai/dsh-brand": "workspace:*",
"@deepseek-ai/dsh-typert-protocol": "workspace:*",
@@ -0,0 +1,42 @@
/** Locate LibreOffice Kit engine packages where their native helpers can execute. */
import { lstatSync } from 'node:fs'
import { createRequire } from 'node:module'
import { join } from 'node:path'
const WASM_ENGINE = '@deepseek-ai/libreoffice-kit-wasm'
/**
* Resolve from the kit's installation, mapping native engines to physical `.asar.unpacked` paths.
* WASM keeps Node's logical path for Electron's archive-aware filesystem, whether or not its assets are unpacked.
* Paths outside an archive pass through unchanged. The kit rejects a missing unpacked copy without switching engines.
* @param name - Engine package name requested by the kit.
* @returns Absolute path of the package's `package.json`.
* @throws The original Node error when resolution fails for an absent package or another reason.
* An installed package with an unresolvable manifest throws an Error with the Node error as its cause,
* preventing engine fallback. Filesystem inspection errors propagate unchanged.
*/
export function resolveEnginePackage(name: string): string {
const fromKit = createRequire(createRequire(import.meta.url).resolve('@deepseek-ai/libreoffice-kit'))
let manifest: string
try {
manifest = fromKit.resolve(`${name}/package.json`)
} catch (error) {
if (error instanceof Error && 'code' in error && error.code === 'MODULE_NOT_FOUND') {
const installed = (fromKit.resolve.paths(name) ?? []).some(directory =>
lstatSync(join(directory, name), { throwIfNoEntry: false }) !== undefined,
)
if (installed) throw new Error(`Installed LibreOfficeKit package is incomplete: ${name}. Reinstall the package.`, { cause: error })
}
throw error
}
return name === WASM_ENGINE ? manifest : unpackedPath(manifest)
}
/**
* Map a path inside an ASAR archive to the archive's unpacked resource directory.
* @param path - Absolute resolved path.
* @returns The same path with its first `.asar` archive segment replaced by `.asar.unpacked`.
*/
export function unpackedPath(path: string): string {
return path.replace(/\.asar(?=[\\/])/, '.asar.unpacked')
}
+3 -2
View File
@@ -14,6 +14,7 @@ import { OfficeToPdfError } from './errors.ts'
import { OfficeToPdfGeneration, type OfficeSourceKey } from './identity.ts'
import type { OfficeExtension, OfficeToPdfRequest, OfficeToPdfResult, OfficeToPdfPriority, RenderedDocumentBytes } from './types.ts'
import { readPdf } from './output.ts'
import { resolveEnginePackage } from './engine-package.ts'
import { ConversionQueue } from './queue.ts'
export * from './errors.ts'
@@ -118,8 +119,8 @@ export class OfficeToPdf extends TypertRemoteService {
if (config.maxSourceBytes < config.maxInputBytes) throw new Error('maxSourceBytes must be at least maxInputBytes.')
const { fontDirectories, fontFallbacks, timeoutMs, maxInputBytes, maxOutputBytes, maxImageResolution,
maxArchiveEntries, maxUncompressedBytes, maxFontFiles, maxFontFileBytes, maxLoadedFontBytes } = config
this.options = { timeoutMs, maxInputBytes, maxOutputBytes, maxImageResolution, maxArchiveEntries, maxUncompressedBytes,
maxFontFiles, maxFontFileBytes, maxLoadedFontBytes,
this.options = { resolveEnginePackage, timeoutMs, maxInputBytes, maxOutputBytes, maxImageResolution,
maxArchiveEntries, maxUncompressedBytes, maxFontFiles, maxFontFileBytes, maxLoadedFontBytes,
...(fontDirectories === undefined ? {} : { fontDirectories }),
...(fontFallbacks === undefined ? {} : { fontFallbacks }),
}
@@ -0,0 +1,153 @@
/** Engine resolution distinguishes missing installations from incomplete ones and preserves ASAR asset paths. */
import { lstatSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'
import { createRequire } from 'node:module'
import { tmpdir } from 'node:os'
import { basename, dirname, join } from 'node:path'
import { afterEach, expect, it, onTestFinished, vi } from 'vitest'
import { resolveEnginePackage, unpackedPath } from '../src/engine-package.ts'
vi.mock('node:module', async (original) => {
const actual = await original<typeof import('node:module')>()
return { createRequire: vi.fn(actual.createRequire) }
})
vi.mock('node:fs', async (original) => {
const actual = await original<typeof import('node:fs')>()
return { ...actual, lstatSync: vi.fn(actual.lstatSync) }
})
const { createRequire: nodeCreateRequire } = await vi.importActual<typeof import('node:module')>('node:module')
const resolverUrl = new URL('../src/engine-package.ts', import.meta.url).href
afterEach(() => { vi.resetAllMocks() })
function engineTree() {
const root = mkdtempSync(join(tmpdir(), 'dsh-engine-package-'))
onTestFinished(() => { rmSync(root, { recursive: true, force: true, maxRetries: 3, retryDelay: 10 }) })
const kitRoot = join(root, 'node_modules', '@deepseek-ai', 'libreoffice-kit')
const kitSource = join(kitRoot, 'lib', 'index.js')
mkdirSync(dirname(kitSource), { recursive: true })
writeFileSync(join(kitRoot, 'package.json'), JSON.stringify({ main: 'lib/index.js' }))
writeFileSync(kitSource, '')
const host = nodeCreateRequire(join(root, 'caller.cjs'))
const kitEntry = host.resolve('@deepseek-ai/libreoffice-kit')
const kit = nodeCreateRequire(kitEntry)
const resolve = vi.fn(kit.resolve)
kit.resolve = Object.assign(resolve, { paths: kit.resolve.paths.bind(kit.resolve) })
vi.mocked(createRequire).mockImplementation((from) => {
if (from === resolverUrl) return host
if (from === kitEntry) return kit
return nodeCreateRequire(from)
})
// A private name prevents globally installed packages from satisfying an absent fixture.
const name = `@deepseek-ai/libreoffice-kit-${basename(root)}`
const directory = join(kitRoot, 'node_modules', name)
return { root, name, directory, resolve, kit }
}
function thrownBy(action: () => void): unknown {
try { action() } catch (error) { return error }
throw new Error('Expected the operation to throw')
}
it.each([
['/App.app/Contents/Resources/app.asar/dsh/node_modules/@deepseek-ai/libreoffice-kit-darwin-arm64/package.json',
'/App.app/Contents/Resources/app.asar.unpacked/dsh/node_modules/@deepseek-ai/libreoffice-kit-darwin-arm64/package.json'],
['C:\\DSH\\resources\\app.asar\\dsh\\node_modules\\@deepseek-ai\\libreoffice-kit-win32-x64\\package.json',
'C:\\DSH\\resources\\app.asar.unpacked\\dsh\\node_modules\\@deepseek-ai\\libreoffice-kit-win32-x64\\package.json'],
['/App/resources/app.asar.unpacked/dsh/node_modules/x/package.json', '/App/resources/app.asar.unpacked/dsh/node_modules/x/package.json'],
['/workspace/node_modules/x/package.json', '/workspace/node_modules/x/package.json'],
['/workspace/notes.asar.txt/package.json', '/workspace/notes.asar.txt/package.json'],
])('maps %s', (path, expected) => {
expect(unpackedPath(path)).toBe(expected)
})
it('resolves outside an archive exactly as the kit installation does', () => {
const kit = createRequire(createRequire(import.meta.url).resolve('@deepseek-ai/libreoffice-kit'))
const outcome = (resolve: (name: string) => string, name: string): string => {
try { return resolve(name) } catch (error) {
if (error instanceof Error && 'code' in error) return String(error.code)
throw error
}
}
for (const name of ['@deepseek-ai/libreoffice-kit-wasm', `@deepseek-ai/libreoffice-kit-${process.platform}-${process.arch}`]) {
const expected = outcome(name => kit.resolve(`${name}/package.json`), name)
expect(outcome(resolveEnginePackage, name)).toBe(expected)
expect(outcome(resolveEnginePackage, name)).toBe(expected)
}
})
it('reports an absent engine package with Node resolution MODULE_NOT_FOUND', () => {
expect(() => resolveEnginePackage('@deepseek-ai/libreoffice-kit-absent')).toThrow(expect.objectContaining({ code: 'MODULE_NOT_FOUND' }))
})
it('uses physical native paths and preserves the WASM logical path in an archive', () => {
const root = '/App/resources/app.asar/dsh/node_modules'
const kitEntry = `${root}/@deepseek-ai/libreoffice-kit/lib/index.js`
const host = nodeCreateRequire(import.meta.url)
const kit = nodeCreateRequire(import.meta.url)
host.resolve = Object.assign(() => kitEntry, { paths: host.resolve.paths.bind(host.resolve) })
kit.resolve = Object.assign((id: string) => `${root}/${id}`, { paths: kit.resolve.paths.bind(kit.resolve) })
vi.mocked(createRequire).mockImplementation((from) => {
if (from === resolverUrl) return host
if (from === kitEntry) return kit
return nodeCreateRequire(from)
})
expect(resolveEnginePackage('@deepseek-ai/libreoffice-kit-darwin-arm64'))
.toBe('/App/resources/app.asar.unpacked/dsh/node_modules/@deepseek-ai/libreoffice-kit-darwin-arm64/package.json')
expect(resolveEnginePackage('@deepseek-ai/libreoffice-kit-wasm'))
.toBe('/App/resources/app.asar/dsh/node_modules/@deepseek-ai/libreoffice-kit-wasm/package.json')
})
it.each(['missing manifest', 'dangling symlink', 'absent'] as const)(
'distinguishes an engine package with %s on the kit resolution path', (state) => {
const fixture = engineTree()
if (state === 'missing manifest') mkdirSync(fixture.directory, { recursive: true })
if (state === 'dangling symlink') {
mkdirSync(dirname(fixture.directory), { recursive: true })
symlinkSync(join(fixture.root, 'missing-target'), fixture.directory, 'junction')
}
const error = thrownBy(() => resolveEnginePackage(fixture.name))
const nodeError: unknown = fixture.resolve.mock.results[0]?.value
expect(nodeError).toMatchObject({ code: 'MODULE_NOT_FOUND' })
if (state === 'absent') {
expect(error).toBe(nodeError)
} else {
expect(error).toBeInstanceOf(Error)
expect(error).not.toHaveProperty('code', 'MODULE_NOT_FOUND')
expect(error).toHaveProperty('cause')
if (!(error instanceof Error)) throw error
expect(error.cause).toBe(nodeError)
expect(error.message).toContain(fixture.name)
}
},
)
it('keeps a Node resolution error other than MODULE_NOT_FOUND unchanged', () => {
const fixture = engineTree()
mkdirSync(fixture.directory, { recursive: true })
writeFileSync(join(fixture.directory, 'package.json'), '{invalid')
const error = thrownBy(() => resolveEnginePackage(fixture.name))
expect(error).toMatchObject({ code: 'ERR_INVALID_PACKAGE_CONFIG' })
expect(error).toBe(fixture.resolve.mock.results[0]?.value)
expect(lstatSync).not.toHaveBeenCalled()
})
it('preserves Node missing errors when the name has no package search paths', () => {
const fixture = engineTree()
const error = thrownBy(() => resolveEnginePackage('node:fs'))
expect(error).toMatchObject({ code: 'MODULE_NOT_FOUND' })
expect(error).toBe(fixture.resolve.mock.results[0]?.value)
expect(lstatSync).not.toHaveBeenCalled()
})
it('propagates permission errors while checking the kit installation', () => {
const fixture = engineTree()
const denied = Object.assign(new Error('Cannot inspect engine installation'), { code: 'EACCES' })
const paths = fixture.kit.resolve.paths(fixture.name)
if (!paths?.[0]) throw new Error('Fixture package must have Node resolution paths')
const firstDirectory = join(paths[0], fixture.name)
vi.mocked(lstatSync).mockImplementationOnce((path) => {
expect(path).toBe(firstDirectory)
throw denied
})
expect(thrownBy(() => resolveEnginePackage(fixture.name))).toBe(denied)
})
@@ -5,6 +5,7 @@ import { Context } from '@deepseek-ai/cordis'
import type { Converter, ConverterOptions } from '@deepseek-ai/libreoffice-kit'
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
import OfficeToPdf, { Config, OfficeSourceKey, type OfficeToPdfRequest } from '../src/index.ts'
import { resolveEnginePackage } from '../src/engine-package.ts'
const kit = vi.hoisted(() => ({ create: vi.fn<(options?: ConverterOptions) => Promise<Converter>>() }))
vi.mock('@deepseek-ai/libreoffice-kit', () => ({ createConverter: kit.create }))
@@ -90,7 +91,7 @@ it('passes configured limits to the kit, reuses the converter, and removes all s
const { maxConcurrentConversions: _count, maxQueuedJobs: _queued, maxReaders: _readers, maxSourceBytes: _source,
maxBackgroundConversions: _background, maxCachedEntries: _entries, maxCachedBytes: _cached,
maxSourceEntries: _aliases, ...options } = config
expect(kit.create).toHaveBeenCalledExactlyOnceWith(options)
expect(kit.create).toHaveBeenCalledExactlyOnceWith({ ...options, resolveEnginePackage })
await ctx.fiber.dispose()
expect(dispose).toHaveBeenCalledOnce()
expect(result.pdf).toEqual(Uint8Array.from(pdf))
+10 -10
View File
@@ -15,14 +15,14 @@
en: c361195a73cf5755
zh: 745b04e7be0be369
/deepseek-ai-dsh-skill-office/use-this-package:
en: bc0460f837676d8a
zh: be1692483d7f5daf
en: 3b08c0d1518f79cf
zh: 7417461618d3dd1e
/deepseek-ai-dsh-skill-office/use-this-package/progressive-loading:
en: 86278b4393aa8d81
zh: 55cfd145a7734ebd
en: 2fa3fcaeaceeff4d
zh: 90691943f6c84cea
/deepseek-ai-dsh-skill-office/understand-the-implementation:
en: 6946e30f3663c72f
zh: 81dd5de9c7e61562
en: 27591fbb5929d332
zh: e49f6d74cd170e00
/deepseek-ai-dsh-skill-office/further-exploration:
en: 23830c100287ffb8
zh: 7a4100e87057bc20
@@ -30,11 +30,11 @@
en: bbd979fd20e7b308
zh: 7e6b6e04f2aedb02
/deepseek-ai-dsh-skill-office/model-experience/kv-cache-effect:
en: dc9e9205d989f1d0
zh: 01bdbbfba743813a
en: cf4f9afcac142752
zh: a7e27c4586069183
/deepseek-ai-dsh-skill-office/known-limitations-and-deferred-work:
en: 1f718fc3bb4352d9
zh: c1aa108ad2b05fdd
en: 5089b0bcf56a6c4a
zh: 2ac561b5e43fff5f
/deepseek-ai-dsh-skill-office/known-limitations-and-deferred-work/dev-note:
en: e67f633dc6fe7773
zh: 8ec3e73528ddb1a6
+7 -5
View File
@@ -39,12 +39,12 @@ Mount the skill provider beside the skill registry and `dsh-tool-skill`. The pro
| `node` | Host Node.js | Standalone Node executable for operation skills; packaged carriers supply it explicitly. |
| `cli` | Installed Kit CLI | Absolute CLI entry; `false` disables operation execution. |
Invalid skill assets reject registration. Authoring instructions do not resolve renderer paths; loading operation instructions validates existing interpreter and CLI files without preparing engines. Bash or PowerShell owns approvals, sandboxing, cancellation, and output management. Resources and execution tools must refer to the same host.
A relative `assetRoot` rejects registration. Catalog discovery reads each `SKILL.md`. A missing or invalid skill is omitted from the catalog with a warning, and a skill whose file disappears after discovery fails to load and leaves the catalog. Other read errors, such as a locked file, leave discovery incomplete so the registry retries it. Authoring instructions do not resolve renderer paths; loading operation instructions validates existing interpreter and CLI files without preparing engines. Bash or PowerShell owns approvals, sandboxing, cancellation, and output management. Resources and execution tools must refer to the same host.
<a id="progressive-loading"></a>
### Progressive loading
The model chooses skills from the task; the host does not inject complete instructions based on file extensions. All seven skills are listed and loadable by name through `skill` or explicit user invocation. Requested appearance changes, including spreadsheet cell fills and text alignment, require rendering even without an explicit visual-check request; an explicit request to skip rendering takes precedence. Pure operations can enter the corresponding skill directly.
The model chooses skills from the task; the host does not inject complete instructions based on file extensions. With complete resources, all seven skills are listed and loadable by name through `skill` or explicit user invocation. Requested appearance changes, including spreadsheet cell fills and text alignment, require rendering even without an explicit visual-check request; an explicit request to skip rendering takes precedence. Pure operations can enter the corresponding skill directly.
```mermaid
flowchart TD
@@ -87,13 +87,13 @@ Ordinary Word text edits inspect the target runs and formatting, then reopen the
<details>
<summary>Implementation internals — click to expand</summary>
The provider reads descriptions at registration and bodies on demand. Registry precedence, scope, and invocation permissions apply to every skill. Each loaded skill includes its resource directory for relative references. Disposal unregisters all candidates.
The provider reads descriptions during catalog discovery and bodies on demand. Registry precedence, scope, and invocation permissions apply to every skill. Each loaded skill includes its resource directory for relative references. Disposal unregisters all candidates.
The provider registers no tools or activation projection. Loaded skill results remain logged through the generic skill loader. In PTC programs, print or return the full `tools.skill(...)` result so its instructions reach the model. Resume and fork use existing session history and tool declaration reconciliation. Interpreter and CLI paths are resolved only when an operation skill is loaded.
| File | Responsibility |
|---|---|
| [`src/index.ts`](src/index.ts) | Resource registration and unchanged skill bodies. |
| [`src/index.ts`](src/index.ts) | Provider registration, per-skill resource reads, and unchanged skill bodies. |
| [`assets/`](assets/) | Router and six subskills. |
@@ -117,7 +117,7 @@ Indirectly, through `dsh-tool-skill`, which renders the initial Office summary a
#### KV Cache effect
Skill results append to history without changing tool declarations, and loaded text or images remain after an operation finishes. Character estimates use `ceil(characters / 4)`: the summary is at most 50 tokens and the router body at most 200; authoring bodies are at least 35% smaller than the combined authoring and operation guides. Skill wrappers, the generic catalog, shell declarations, and `load_workspace_dependencies` are separate costs, and these estimates are not server usage.
Skill results append to history without changing tool declarations, and loaded text or images remain after an operation finishes. A skill omitted or removed for unreadable resources changes the catalog, which a later step publishes as a catalog update. Character estimates use `ceil(characters / 4)`: the summary is at most 50 tokens and the router body at most 200; authoring bodies are at least 35% smaller than the combined authoring and operation guides. Skill wrappers, the generic catalog, shell declarations, and `load_workspace_dependencies` are separate costs, and these estimates are not server usage.
## Known Limitations and Deferred Work
@@ -126,6 +126,8 @@ Skill results append to history without changing tool declarations, and loaded t
- The provider does not install authoring libraries.
- LibreOffice output can differ from native Office applications.
- Legacy, encrypted, and macro-enabled files need an appropriate separate workflow.
- An omitted skill is reported only through `ctx.logger`; no product UI tells the user that installed resources are missing.
- The `office` router body names every subskill, so it still points to a subskill omitted for missing resources; the `skill` tool reports that subskill as unavailable.
<a id="dev-note"></a>
### Dev Note
+7 -5
View File
@@ -39,12 +39,12 @@ kind: "package-reference"
| `node` | 宿主 Node.js | 操作技能使用的独立 Node 可执行程序;打包载体显式提供。 |
| `cli` | 已安装 Kit CLI | CLI 入口的绝对路径;`false` 禁用操作执行。 |
无效技能资源会阻止注册。创作说明不解析渲染器路径;操作说明加载时校验现有解释器和 CLI 文件,不准备引擎。Bash 或 PowerShell 负责审批、沙箱、取消和输出管理。资源与执行工具必须位于同一主机。
相对路径的 `assetRoot` 会阻止注册。目录发现时读取每个 `SKILL.md`。缺失或无效的技能会从目录中省略并记录警告;发现之后文件消失的技能加载失败,并从目录中移除。其他读取错误(例如文件被锁)会使本次发现不完整,由注册表重试。创作说明不解析渲染器路径;操作说明加载时校验现有解释器和 CLI 文件,不准备引擎。Bash 或 PowerShell 负责审批、沙箱、取消和输出管理。资源与执行工具必须位于同一主机。
<a id="progressive-loading"></a>
### 渐进加载
模型依据任务选择技能;宿主不会根据文件扩展名注入完整说明。七个技能均列入目录,可通过 `skill` 按名称加载或由用户显式调用。用户要求的外观修改,包括电子表格单元格填充和文本对齐,即使没有明确要求视觉检查,也需要渲染;用户明确要求跳过渲染时以该要求为准。纯操作任务可以直接进入对应技能。
模型依据任务选择技能;宿主不会根据文件扩展名注入完整说明。资源完整时,七个技能均列入目录,可通过 `skill` 按名称加载或由用户显式调用。用户要求的外观修改,包括电子表格单元格填充和文本对齐,即使没有明确要求视觉检查,也需要渲染;用户明确要求跳过渲染时以该要求为准。纯操作任务可以直接进入对应技能。
```mermaid
flowchart TD
@@ -87,13 +87,13 @@ flowchart TD
<details>
<summary>实现细节 — 点击展开</summary>
提供者在注册时读取摘要,按需读取正文。注册表优先级、作用域和调用权限适用于全部技能。加载结果包含用于解析相对引用的资源目录。卸载提供者会移除全部候选技能。
提供者在目录发现时读取摘要,按需读取正文。注册表优先级、作用域和调用权限适用于全部技能。加载结果包含用于解析相对引用的资源目录。卸载提供者会移除全部候选技能。
提供者不注册工具或激活投影。通用技能加载器记录已加载技能的结果。PTC 程序需输出或返回完整的 `tools.skill(...)` 结果,使说明进入模型上下文。恢复和 fork 使用现有会话历史及工具声明更新机制。解释器和 CLI 路径仅在加载操作技能时解析。
| 文件 | 职责 |
|---|---|
| [`src/index.ts`](src/index.ts) | 注册资源并返回原始技能正文。 |
| [`src/index.ts`](src/index.ts) | 注册提供者、逐个读取技能资源并返回原始技能正文。 |
| [`assets/`](assets/) | 路由与六个子技能。 |
@@ -117,7 +117,7 @@ flowchart TD
#### KV Cache 影响
技能结果追加到历史中且不改变工具声明,操作完成后已加载文本或图片仍保留在历史中。字符估算采用 `ceil(字符数 / 4)`:摘要最多 50 token,路由正文最多 200 token;创作正文比合并后的创作与操作指南至少减少 35%。技能包装、通用目录、shell 声明和 `load_workspace_dependencies` 单独计费;这些估算不等同于服务端 usage。
技能结果追加到历史中且不改变工具声明,操作完成后已加载文本或图片仍保留在历史中。因资源不可读而省略或移除的技能会改变目录,后续步骤会将其作为目录更新发布。字符估算采用 `ceil(字符数 / 4)`:摘要最多 50 token,路由正文最多 200 token;创作正文比合并后的创作与操作指南至少减少 35%。技能包装、通用目录、shell 声明和 `load_workspace_dependencies` 单独计费;这些估算不等同于服务端 usage。
## 已知限制与后续工作
@@ -126,6 +126,8 @@ flowchart TD
- 提供者不安装创作库。
- LibreOffice 输出可能不同于原生 Office 应用。
- 旧格式、加密和启用宏的文件需要适用的独立工作流。
- 被省略的技能只通过 `ctx.logger` 报告;产品界面不会提示用户已安装资源缺失。
- `office` 路由正文列出全部子技能,因此仍会指向因资源缺失而被省略的子技能;`skill` 工具会报告该子技能不可用。
<a id="dev-note"></a>
### 开发备注
+1 -1
View File
@@ -41,7 +41,7 @@
"@deepseek-ai/cordis-plugin-include": "workspace:~"
},
"dependencies": {
"@deepseek-ai/libreoffice-kit": "^0.1.5",
"@deepseek-ai/libreoffice-kit": "0.2.3-rc.4",
"@deepseek-ai/schemastery": "workspace:~",
"yaml": "^2.4.2"
}
+69 -19
View File
@@ -1,13 +1,13 @@
/** Bundled Office workflows and filesystem resources for document authoring and operations. */
import { readFileSync, statSync } from 'node:fs'
import { statSync } from 'node:fs'
import { readFile } from 'node:fs/promises'
import { dirname, isAbsolute, join, sep } from 'node:path'
import { isSea } from 'node:sea'
import { fileURLToPath } from 'node:url'
import type { Context } from '@deepseek-ai/cordis'
import z from '@deepseek-ai/schemastery'
import { BUNDLED_SKILL_RANK, type SkillCandidate, type SkillProvider } from '@deepseek-ai/dsh-skill'
import { BUNDLED_SKILL_RANK, type SkillCandidate } from '@deepseek-ai/dsh-skill'
import { parse as parseYaml } from 'yaml'
const SKILL_NAMES = ['office', 'office-docx', 'office-pptx', 'office-xlsx', 'office-render', 'office-recalculate', 'office-export-pdf'] as const
@@ -61,35 +61,85 @@ function officeRuntime(config: Config): string {
return `\n\n## Installed LibreOffice Kit\n\nUse these absolute paths for every LibreOffice Kit command. Pass the CLI entry as the first argument to Node.\n\n${JSON.stringify({ libreofficeKit: { node, cli } }, undefined, 2)}`
}
/** Outcome of reading one skill file: parsed metadata, or a failure that may clear on a later read. */
type SkillRead =
| { readonly kind: 'loaded'; readonly description: string; readonly content: string }
| { readonly kind: 'failed'; readonly error: unknown; readonly persistent: boolean }
/** Missing paths persist until the file appears; other read errors, such as locks, may clear. */
function persistentReadFailure(error: unknown): boolean {
const code = error instanceof Error && 'code' in error ? error.code : undefined
return code === 'ENOENT' || code === 'ENOTDIR'
}
/**
* Register Office skills with resources readable by the script interpreter.
* Skill files are read during catalog discovery and loading, and each distinct failure is reported once. A missing
* or invalid skill is omitted from a complete catalog, and its failed load returns `undefined` and invalidates the
* catalog. Any other read error leaves discovery incomplete, so the registry retries it, and rejects a load.
* @param ctx - Context carrying the skill registry.
* @param config - Optional external assets directory for packaged applications.
* @throws When `assetRoot` is not absolute.
*/
export function apply(ctx: Context, config: Config = {}): void {
const assetRoot = config.assetRoot ?? fileURLToPath(new URL('../assets/', import.meta.url))
if (!isAbsolute(assetRoot)) throw new Error('skill-office: assetRoot must be an absolute directory')
const candidates: SkillCandidate[] = SKILL_NAMES.map((skillName) => {
const directory = join(assetRoot, skillName)
const path = join(directory, 'SKILL.md')
const { description } = parseSkill(readFileSync(path, 'utf8'), path)
return {
name: skillName, description,
invocation: { modelInvocable: true, userInvocable: true },
provider: 'dsh-office', source: 'bundled', rank: BUNDLED_SKILL_RANK,
resourceBase: { kind: 'directory', path: directory.split(sep).join('/') }, locator: path,
const reportedFailures = new Map<string, string>()
async function readSkill(skillName: string, signal: AbortSignal | undefined): Promise<SkillRead> {
const path = join(assetRoot, skillName, 'SKILL.md')
let raw: string
try {
raw = await readFile(path, { encoding: 'utf8', signal })
} catch (error) {
if (signal?.aborted === true) throw error
return failed(skillName, error, persistentReadFailure(error))
}
})
const provider: SkillProvider = {
let skill: { description: string; content: string }
try {
skill = parseSkill(raw, path)
} catch (error) {
// Invalid metadata, including YAML errors that carry their own codes, persists until the file changes.
return failed(skillName, error, true)
}
reportedFailures.delete(skillName)
return { kind: 'loaded', ...skill }
}
function failed(skillName: string, error: unknown, persistent: boolean): SkillRead {
const failure = String(error)
if (reportedFailures.get(skillName) !== failure) {
reportedFailures.set(skillName, failure)
ctx.logger.warn(`skill-office: skill "${skillName}" is unavailable: ${failure}`)
}
return { kind: 'failed', error, persistent }
}
ctx.skills.registerProvider(control => ({
name: 'dsh-office',
list: () => Promise.resolve(candidates),
async list(options) {
const reads = await Promise.all(SKILL_NAMES.map(async skillName => ({ skillName, read: await readSkill(skillName, options.signal) })))
const candidates: SkillCandidate[] = []
for (const { skillName, read } of reads) {
if (read.kind === 'failed') continue
const directory = join(assetRoot, skillName)
candidates.push({
name: skillName, description: read.description,
invocation: { modelInvocable: true, userInvocable: true },
provider: 'dsh-office', source: 'bundled', rank: BUNDLED_SKILL_RANK,
resourceBase: { kind: 'directory', path: directory.split(sep).join('/') }, locator: join(directory, 'SKILL.md'),
})
}
return { candidates, complete: reads.every(({ read }) => read.kind === 'loaded' || read.persistent) }
},
async get(candidate, options) {
const { rank: _rank, locator, ...summary } = candidate
const raw = await readFile(locator as string, { encoding: 'utf8', signal: options.signal })
const content = parseSkill(raw, locator as string).content
const { rank: _rank, locator: _locator, ...summary } = candidate
const read = await readSkill(candidate.name, options.signal)
if (read.kind === 'failed') {
if (!read.persistent) throw read.error
control.invalidate()
return undefined
}
const content = read.content
+ (['office-render', 'office-recalculate', 'office-export-pdf'].includes(candidate.name) ? officeRuntime(config) : '')
return { ...summary, content }
},
}
ctx.skills.registerProvider(() => provider)
}))
}
@@ -1,4 +1,4 @@
import { cp, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
import { cp, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join, sep } from 'node:path'
import { fileURLToPath, pathToFileURL } from 'node:url'
@@ -129,22 +129,113 @@ describe('bundled Office skills', () => {
}
})
it('rejects relative resource paths and incomplete asset trees before registration', async () => {
const root = await mkdtemp(join(tmpdir(), 'dsh-office-invalid-'))
it('rejects relative resource paths before registration', async () => {
const ctx = new Context()
try {
await ctx.plugin(SkillRegistry)
expect(() => { SkillOffice.apply(ctx, { assetRoot: 'assets' }) }).toThrow('absolute directory')
await cp(assets, root, { recursive: true })
await rm(join(root, 'office-docx', 'SKILL.md'))
expect(() => { SkillOffice.apply(ctx, { assetRoot: root }) }).toThrow('SKILL.md')
await writeFile(join(root, 'office-docx', 'SKILL.md'), '# Missing frontmatter\ndescription: body text\n')
expect(() => { SkillOffice.apply(ctx, { assetRoot: root }) }).toThrow('has no YAML frontmatter')
for (const header of ['', 'null', 'scalar', 'name: office-docx', 'description: 3', 'description: ""']) {
await writeFile(join(root, 'office-docx', 'SKILL.md'), `---\n${header}\n---\n# Instructions\n`)
expect(() => { SkillOffice.apply(ctx, { assetRoot: root }) }).toThrow('has no description')
}
expect(await ctx.skills.list()).toEqual([])
} finally {
await ctx.fiber.dispose()
}
})
it('omits unreadable or invalid skills from a complete catalog and reports each failure once', async () => {
const root = await mkdtemp(join(tmpdir(), 'dsh-office-invalid-'))
const ctx = new Context()
const warnings: string[] = []
try {
ctx.logger.exporter({ levels: { default: 2 }, export: ({ type, args }) => { if (type === 'warn') warnings.push(String(args[0])) } })
await ctx.plugin(SkillRegistry)
await cp(assets, root, { recursive: true })
const docx = join(root, 'office-docx', 'SKILL.md')
const original = await readFile(docx, 'utf8')
const remaining = names.filter(name => name !== 'office-docx')
const catalog = async () => {
const snapshot = await ctx.skills.snapshot()
return { complete: snapshot.complete, names: snapshot.skills.map(skill => skill.name) }
}
await rm(docx)
let fiber = await ctx.plugin(SkillOffice, { assetRoot: root })
expect(await catalog()).toEqual({ complete: true, names: remaining })
expect((await ctx.skills.get('office-xlsx'))?.content).toContain('openpyxl')
expect(warnings).toEqual([expect.stringMatching(/^skill-office: skill "office-docx" is unavailable: Error: ENOENT.*SKILL\.md/u)])
await fiber.dispose()
const invalid: [content: string, failure: string][] = [
['# Missing frontmatter\ndescription: body text\n', 'has no YAML frontmatter'],
...['', 'null', 'scalar', 'name: office-docx', 'description: 3', 'description: ""']
.map((header): [string, string] => [`---\n${header}\n---\n# Instructions\n`, 'has no description']),
// YAML parse errors carry their own codes; they persist like other invalid metadata.
['---\ndescription: [unclosed\n---\n# Instructions\n', 'YAMLParseError'],
]
for (const [content, failure] of invalid) {
await writeFile(docx, content)
fiber = await ctx.plugin(SkillOffice, { assetRoot: root })
expect(await catalog()).toEqual({ complete: true, names: remaining })
expect(warnings.at(-1)).toContain(failure)
await fiber.dispose()
}
await writeFile(docx, original)
const registerProvider = vi.spyOn(ctx.skills, 'registerProvider')
await ctx.plugin(SkillOffice, { assetRoot: root })
expect(await catalog()).toEqual({ complete: true, names })
const reported = warnings.length
await rm(docx)
expect(await ctx.skills.get('office-docx')).toBeUndefined()
expect(warnings).toHaveLength(reported + 1)
expect(await catalog()).toEqual({ complete: true, names: remaining })
expect(warnings).toHaveLength(reported + 1)
const provider = registerProvider.mock.calls[0]![0]({ signal: new AbortController().signal, invalidate: () => {} })
await expect(provider.list({ signal: AbortSignal.abort() })).rejects.toMatchObject({ name: 'AbortError' })
expect(warnings).toHaveLength(reported + 1)
} finally {
await ctx.fiber.dispose()
await rm(root, { recursive: true, force: true })
}
})
it('omits a skill whose frontmatter becomes malformed YAML after discovery', async () => {
const root = await mkdtemp(join(tmpdir(), 'dsh-office-malformed-'))
const ctx = new Context()
try {
await ctx.plugin(SkillRegistry)
await cp(assets, root, { recursive: true })
await ctx.plugin(SkillOffice, { assetRoot: root })
expect((await ctx.skills.snapshot()).complete).toBe(true)
await writeFile(join(root, 'office-docx', 'SKILL.md'), '---\ndescription: [unclosed\n---\n# Instructions\n')
expect(await ctx.skills.get('office-docx')).toBeUndefined()
const snapshot = await ctx.skills.snapshot()
expect({ complete: snapshot.complete, names: snapshot.skills.map(skill => skill.name) })
.toEqual({ complete: true, names: names.filter(name => name !== 'office-docx') })
} finally {
await ctx.fiber.dispose()
await rm(root, { recursive: true, force: true })
}
})
it('retries read errors other than a missing path instead of omitting the skill', async () => {
const root = await mkdtemp(join(tmpdir(), 'dsh-office-retry-'))
const ctx = new Context()
try {
await ctx.plugin(SkillRegistry)
await cp(assets, root, { recursive: true })
const docx = join(root, 'office-docx', 'SKILL.md')
const original = await readFile(docx, 'utf8')
const catalog = async () => {
const snapshot = await ctx.skills.snapshot()
return { complete: snapshot.complete, names: snapshot.skills.map(skill => skill.name) }
}
await rm(docx)
// Reading a directory fails with EISDIR, standing in for a lock or permission error.
await mkdir(docx)
await ctx.plugin(SkillOffice, { assetRoot: root })
expect(await catalog()).toEqual({ complete: false, names: names.filter(name => name !== 'office-docx') })
await rm(docx, { recursive: true })
await writeFile(docx, original)
expect(await catalog()).toEqual({ complete: true, names })
await rm(docx)
await mkdir(docx)
await expect(ctx.skills.get('office-docx')).rejects.toMatchObject({ code: 'EISDIR' })
} finally {
await ctx.fiber.dispose()
await rm(root, { recursive: true, force: true })
@@ -168,7 +259,7 @@ it('executes capabilities using only paths returned by the loaded skill from a s
expect(result.timedOut, result.stderr).toBe(false)
expect(result.signal, result.stderr).toBeUndefined()
expect(result.exitCode, result.stderr).toBe(0)
expect(JSON.parse(result.stdout)).toMatchObject({ runtime: { version: '0.1.5', cliPath: libreofficeKit.cli } })
expect(JSON.parse(result.stdout)).toMatchObject({ runtime: { version: '0.2.3-rc.4', cliPath: libreofficeKit.cli } })
} finally {
await ctx.fiber.dispose()
await rm(root, { recursive: true, force: true })
+50 -54
View File
@@ -860,9 +860,6 @@ importers:
'@deepseek-ai/dsh-deepseek-account':
specifier: workspace:*
version: link:../../packages/credentials/deepseek-account
'@deepseek-ai/dsh-home-paths':
specifier: workspace:*
version: link:../../packages/util/home-paths
'@deepseek-ai/dsh-host-webserver':
specifier: workspace:*
version: link:../../packages/host/webserver
@@ -875,28 +872,16 @@ importers:
'@deepseek-ai/dsh-schedule':
specifier: workspace:*
version: link:../../packages/schedule/schedule
'@deepseek-ai/dsh-skill-office':
specifier: workspace:*
version: link:../../packages/skill/skill-office
'@deepseek-ai/dsh-tool-workspace-dependencies':
specifier: workspace:*
version: link:../../packages/skill/tool-workspace-dependencies
'@deepseek-ai/dsh-workspace':
specifier: workspace:*
version: link:../../packages/workspace/workspace
'@deepseek-ai/libreoffice-kit':
specifier: ^0.1.5
version: 0.1.5
specifier: 0.2.3-rc.4
version: 0.2.3-rc.4
koffi:
specifier: 3.1.1
version: 3.1.1
devDependencies:
'@deepseek-ai/cordis-plugin-include':
specifier: workspace:~
version: link:../../vendor/include
'@deepseek-ai/cordis-plugin-loader':
specifier: workspace:~
version: link:../../vendor/loader
'@deepseek-ai/dsh-brand':
specifier: workspace:*
version: link:../../packages/util/brand
@@ -915,12 +900,6 @@ importers:
'@deepseek-ai/dsh-session-persistence':
specifier: workspace:*
version: link:../../packages/session/session-persistence
'@deepseek-ai/dsh-skill':
specifier: workspace:*
version: link:../../packages/skill/skill
'@deepseek-ai/dsh-tool-executor-native':
specifier: workspace:*
version: link:../../packages/core/tool-executor-native
'@deepseek-ai/dsh-util-workspace-path':
specifier: workspace:*
version: link:../../packages/util/workspace-path
@@ -3278,6 +3257,9 @@ importers:
'@deepseek-ai/dsh-skill-filesystem':
specifier: workspace:*
version: link:../../skill/skill-filesystem
'@deepseek-ai/dsh-skill-office':
specifier: workspace:*
version: link:../../skill/skill-office
'@deepseek-ai/dsh-subprocess':
specifier: workspace:*
version: link:../../subprocess/subprocess
@@ -3347,6 +3329,9 @@ importers:
'@deepseek-ai/dsh-tool-workflow':
specifier: workspace:*
version: link:../../workflow/tool-workflow
'@deepseek-ai/dsh-tool-workspace-dependencies':
specifier: workspace:*
version: link:../../skill/tool-workspace-dependencies
'@deepseek-ai/dsh-web-frontend':
specifier: workspace:*
version: link:../../../apps/web
@@ -3384,6 +3369,9 @@ importers:
'@deepseek-ai/dsh-fs-local':
specifier: workspace:*
version: link:../../fs/fs-local
'@deepseek-ai/dsh-home-paths':
specifier: workspace:*
version: link:../../util/home-paths
'@deepseek-ai/dsh-otel':
specifier: workspace:*
version: link:../../telemetry/otel
@@ -3399,12 +3387,21 @@ importers:
'@deepseek-ai/dsh-shell-env':
specifier: workspace:*
version: link:../../shell/shell-env
'@deepseek-ai/dsh-skill':
specifier: workspace:*
version: link:../../skill/skill
'@deepseek-ai/dsh-system-prompt':
specifier: workspace:*
version: link:../../core/system-prompt
'@deepseek-ai/dsh-tools':
specifier: workspace:*
version: link:../../core/tools
'@deepseek-ai/dsh-typert-registry':
specifier: workspace:*
version: link:../../typert/registry
'@deepseek-ai/libreoffice-kit':
specifier: ^0.1.5
version: 0.1.5
specifier: 0.2.3-rc.4
version: 0.2.3-rc.4
packages/client/connection:
dependencies:
@@ -8335,8 +8332,8 @@ importers:
specifier: workspace:*
version: link:../../typert/protocol
'@deepseek-ai/libreoffice-kit':
specifier: ^0.1.5
version: 0.1.5
specifier: 0.2.3-rc.4
version: 0.2.3-rc.4
'@deepseek-ai/schemastery':
specifier: link:../../../vendor/schemastery
version: link:../../../vendor/schemastery
@@ -15671,8 +15668,8 @@ importers:
packages/skill/skill-office:
dependencies:
'@deepseek-ai/libreoffice-kit':
specifier: ^0.1.5
version: 0.1.5
specifier: 0.2.3-rc.4
version: 0.2.3-rc.4
'@deepseek-ai/schemastery':
specifier: link:../../../vendor/schemastery
version: link:../../../vendor/schemastery
@@ -19143,37 +19140,36 @@ packages:
resolution: {integrity: sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA==}
engines: {node: '>=20.19.0'}
'@deepseek-ai/libreoffice-kit-darwin-arm64@0.1.5':
resolution: {integrity: sha512-SjeXmyaTevEq2TxK7reb1rhCrQZ4QOXmXt/qEwfQD5Fx3odU0ILx2uiXN+nphSCQ95LFCzrElHGgv2c7a824yg==}
'@deepseek-ai/libreoffice-kit-darwin-arm64@0.2.3-rc.4':
resolution: {integrity: sha512-niYZDbLW/6HsZppDJjLQ9R0/DXK6fHQ7e1nkxtnRiGAb1g/lkn5Qmg0uRnUT7d2onM6W2+WRCtIinV1R2nIpJA==}
engines: {node: '>=22.19.0'}
cpu: [arm64]
os: [darwin]
'@deepseek-ai/libreoffice-kit-darwin-x64@0.1.5':
resolution: {integrity: sha512-vuz2tTpH1Edk75+DISwg/TXdQ3BNSNSHoVnWVqxqbGMgrrK9trLOw2+0X7mjT1naGO00Zc1qkyQ4if3kx5XjqQ==}
'@deepseek-ai/libreoffice-kit-darwin-x64@0.2.3-rc.4':
resolution: {integrity: sha512-LFWOBm11uDK19+QEctA+9AmeJNHFKYv9NEYrOL/CNs1YYxbkeStmyapUPo1b43WM52B07ahZu41GsENqY82VkQ==}
engines: {node: '>=22.19.0'}
cpu: [x64]
os: [darwin]
'@deepseek-ai/libreoffice-kit-wasm@0.1.5':
resolution: {integrity: sha512-V+pu5xJsKhVD4AU1xbFlMWY91svK9ZIC2JsNOph9kWp/arF/KQcuytt76bcbozJqPbE8o0n04lyh0m3QW5RYSA==}
'@deepseek-ai/libreoffice-kit-wasm@0.2.3-rc.4':
resolution: {integrity: sha512-0riXzJG75dIzYoht7RIQhQ21cKSUC5pPbLttkSGqLzcUYqKJtSXo2r3R9pAB6AsJI2OVcgqYeRPtuOCsB47W8g==}
engines: {node: '>=22.19.0'}
os: [linux]
'@deepseek-ai/libreoffice-kit-win32-arm64@0.1.5':
resolution: {integrity: sha512-Av3aFfNLaVxfffu0JXP5mqfmsCU3gQtlUH9UD+zdXl8ON06ukVAmu7LqNyuKAz/68WoOMTQ+YBlVQukgDRKd/A==}
'@deepseek-ai/libreoffice-kit-win32-arm64@0.2.3-rc.4':
resolution: {integrity: sha512-3aS8ZVSUWXaG1LLjj4NmVEw8hZ2YVXRm0APmef5GNlXAVxLVD++UJAKOK6L+5F/lV4XcyTFkhF0YIHE5wms5Qg==}
engines: {node: '>=22.19.0'}
cpu: [arm64]
os: [win32]
'@deepseek-ai/libreoffice-kit-win32-x64@0.1.5':
resolution: {integrity: sha512-uKuDGZdofxuW4iRmUh8b3+XWU28JeOCYMTAONzo7tEHIq00DV2cARcgUYiTP7gUH49tH4A/RyPMOVEBzK7qjjw==}
'@deepseek-ai/libreoffice-kit-win32-x64@0.2.3-rc.4':
resolution: {integrity: sha512-q7ZUURXzAsndoEle5Cw1CoQKjspdbgDxjIyWBVqvg8OCCibCau76J+5PsBrI2GFDYphCKDef0VFYUxzazwcbow==}
engines: {node: '>=22.19.0'}
cpu: [x64]
os: [win32]
'@deepseek-ai/libreoffice-kit@0.1.5':
resolution: {integrity: sha512-H12xtUsAyl70zFeQ5pk5GGRc3N1+6zn+DVAcqwlguI6EvqopBGP3xkUmePU7g5f6ydYlDZLWedHT9lTSL7zLxA==}
'@deepseek-ai/libreoffice-kit@0.2.3-rc.4':
resolution: {integrity: sha512-WyiEKAVW1Odli/tUPU/ok/XlIsRcLlp1xO1sU1zcrAV8mkAAge0LAA0fFDivTc9o0AdUyATZV3RBalwqBqj+Dg==}
engines: {node: '>=22.19.0'}
hasBin: true
@@ -27029,33 +27025,33 @@ snapshots:
'@csstools/[email protected]': {}
'@deepseek-ai/libreoffice-kit-darwin-arm64@0.1.5':
'@deepseek-ai/libreoffice-kit-darwin-arm64@0.2.3-rc.4':
optional: true
'@deepseek-ai/libreoffice-kit-darwin-x64@0.1.5':
'@deepseek-ai/libreoffice-kit-darwin-x64@0.2.3-rc.4':
optional: true
'@deepseek-ai/libreoffice-kit-wasm@0.1.5':
'@deepseek-ai/libreoffice-kit-wasm@0.2.3-rc.4':
optional: true
'@deepseek-ai/libreoffice-kit-win32-arm64@0.1.5':
'@deepseek-ai/libreoffice-kit-win32-arm64@0.2.3-rc.4':
optional: true
'@deepseek-ai/libreoffice-kit-win32-x64@0.1.5':
'@deepseek-ai/libreoffice-kit-win32-x64@0.2.3-rc.4':
optional: true
'@deepseek-ai/libreoffice-kit@0.1.5':
'@deepseek-ai/libreoffice-kit@0.2.3-rc.4':
dependencies:
fflate: 0.8.2
fontkit: 2.0.4
koffi: 3.1.1
saxes: 6.0.0
optionalDependencies:
'@deepseek-ai/libreoffice-kit-darwin-arm64': 0.1.5
'@deepseek-ai/libreoffice-kit-darwin-x64': 0.1.5
'@deepseek-ai/libreoffice-kit-wasm': 0.1.5
'@deepseek-ai/libreoffice-kit-win32-arm64': 0.1.5
'@deepseek-ai/libreoffice-kit-win32-x64': 0.1.5
'@deepseek-ai/libreoffice-kit-darwin-arm64': 0.2.3-rc.4
'@deepseek-ai/libreoffice-kit-darwin-x64': 0.2.3-rc.4
'@deepseek-ai/libreoffice-kit-wasm': 0.2.3-rc.4
'@deepseek-ai/libreoffice-kit-win32-arm64': 0.2.3-rc.4
'@deepseek-ai/libreoffice-kit-win32-x64': 0.2.3-rc.4
koffi: 3.1.1
'@docsearch/[email protected]': {}
+6 -6
View File
@@ -58,12 +58,12 @@ minimumReleaseAgeExclude:
# Native Codex and Claude tests qualify this exact release with its local patches.
- '@botiverse/[email protected]'
# Office engines and their API are qualified and released together by the kit repository.
- '@deepseek-ai/libreoffice-kit@0.1.5'
- '@deepseek-ai/libreoffice-kit-darwin-arm64@0.1.5'
- '@deepseek-ai/libreoffice-kit-darwin-x64@0.1.5'
- '@deepseek-ai/libreoffice-kit-win32-arm64@0.1.5'
- '@deepseek-ai/libreoffice-kit-win32-x64@0.1.5'
- '@deepseek-ai/libreoffice-kit-wasm@0.1.5'
- '@deepseek-ai/libreoffice-kit@0.2.3-rc.4'
- '@deepseek-ai/libreoffice-kit-darwin-arm64@0.2.3-rc.4'
- '@deepseek-ai/libreoffice-kit-darwin-x64@0.2.3-rc.4'
- '@deepseek-ai/libreoffice-kit-win32-arm64@0.2.3-rc.4'
- '@deepseek-ai/libreoffice-kit-win32-x64@0.2.3-rc.4'
- '@deepseek-ai/libreoffice-kit-wasm@0.2.3-rc.4'
# Fresh pi-ai releases carry the model catalog updates that are the whole
# point of bumping it; waiting out the release age would defeat that.
- '@earendil-works/[email protected]'
-3
View File
@@ -20,9 +20,6 @@
"apps/cli/tests/web-auth.e2e.ts": {
"a2b9a35fdf6552ba148d15436c9b3f98ed5763a2b91a95f579b951fd6613e75c": 1
},
"apps/desktop-host/tests/office.spec.ts": {
"3f8653cd87f99ebd70765379dae51ab308ed9c280e831d39e1abd469bfcdc6e3": 1
},
"apps/desktop/scripts/installed-update-qualification.ts": {
"5a8270cf9b1e554ae0cff6eaf7086e44c22f61a08e5f91dc7e1397eccaa726a5": 2
},