Files
deepseek-harness/apps/cli/tests/profile-hmr.spec.ts
T
Tianyi Cui 8dc3b0380e feat(bundle): ship the standalone sdk-minimal profile
Add a startup-only sdk-minimal template whose sole bundle inserts the complete JSON-RPC agent tree over the empty profile root. The roster is an explicit composition allowlist: it contains one DeepSeek adapter, the minimal agent spine, persistent Bash, the string-replace editor, local execution, and JSONL persistence, while dsh-base and Web remain absent.

Reuse the SDK app startup provider so the new profile retains help, stdin EOF, and bounded launcher shutdown semantics. Make that provider render its configured profile name, which keeps both sdk and sdk-minimal help truthful without duplicating process lifecycle code.

Register the package in the CLI closure, TypeScript graph, lockfile, Knip policy, and bilingual bundle references. Exact manifest, row-roster, profile-template, config-dump, and HMR tests make later additions visible instead of relying on a blacklist.
2026-08-24 17:28:28 +08:00

47 lines
1.8 KiB
TypeScript

/** Module-HMR ownership across the real shipped profile bundle layers. */
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
import { composeEntries, loadOverlayPatches } from '@deepseek-ai/dsh-app-boot'
import type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'
const REPOSITORY_ROOT = fileURLToPath(new URL('../../../', import.meta.url))
/** Load one shipped bundle patch through the same parser as profile boot. */
function bundle(name: 'acp-app' | 'base' | 'headless' | 'sdk-app' | 'sdk-minimal' | 'web-app'): PatchOptions[] {
return loadOverlayPatches('profile-hmr test', join(REPOSITORY_ROOT, 'packages', 'bundle', name, 'cordis.patch.yml'))
}
/** Resolve the effective HMR row after the supplied layers. */
function hmr(layers: PatchOptions[][]) {
const row = composeEntries(layers).find(entry => entry.id === 'hmr')
if (row === undefined) throw new Error('the base bundle must insert the hmr row')
return row
}
describe('profile module-HMR policy', () => {
it.each(['web-app', 'headless', 'sdk-app', 'acp-app'] as const)(
'%s inherits the disabled base row without a mode override',
(mode) => {
const modePatches = bundle(mode)
expect(modePatches.some(patch => patch.id === 'hmr')).toBe(false)
expect(hmr([bundle('base'), modePatches])).toMatchObject({
disabled: true,
config: { root: ['.'] },
})
},
)
it('requires an explicit later layer to enable source-module reload', () => {
expect(hmr([bundle('base'), [{ id: 'hmr', disabled: false }]])).toMatchObject({
disabled: false,
config: { root: ['.'] },
})
})
it('keeps the standalone sdk-minimal tree free of module HMR', () => {
expect(composeEntries([bundle('sdk-minimal')]).find(entry => entry.id === 'hmr')).toBeUndefined()
})
})