mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-08-29 04:26:38 +00:00
Add node24-win-x64 as the only supported Windows runtime target and publish it as a py3-none-win_amd64 wheel containing the conventional dsh and ripgrep .exe payload names. Keep Windows ARM64 rejected explicitly so Python cannot claim a carrier that CI and release automation do not build. Teach the pkg builder to require a native x64 Windows host, validate both node-pty ConPTY addons, copy @vscode's win32 ripgrep executable, and recognize pkg's .exe output. Extend runtime resolution, wheel staging, payload validation, and the preset closure check so the Windows-specific PowerShell plugins and sidecars fail loud when omitted. The sidecar resolver now maps a packaged main.exe to main-rg.exe; focused TypeScript and Python tests cover that name, the win_amd64 manifest, x64-only host selection, complete wheel payload, ConPTY inventory, and platform-conditioned plugin closure.
171 lines
6.1 KiB
TypeScript
171 lines
6.1 KiB
TypeScript
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
import { tmpdir } from 'node:os'
|
|
import { dirname, join } from 'node:path'
|
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
import { verifyRuntimeClosure } from './verify-runtime-closure.ts'
|
|
|
|
const roots: string[] = []
|
|
|
|
function fixture(files: Record<string, string | Record<string, unknown>>): string {
|
|
const root = mkdtempSync(join(tmpdir(), 'dsh-runtime-closure-'))
|
|
roots.push(root)
|
|
for (const [relative, value] of Object.entries(files)) {
|
|
const path = join(root, relative)
|
|
mkdirSync(dirname(path), { recursive: true })
|
|
writeFileSync(path, typeof value === 'string' ? value : `${JSON.stringify(value, null, 2)}\n`)
|
|
}
|
|
return root
|
|
}
|
|
|
|
const platforms = {
|
|
'linux-x64': { tag: 'manylinux_2_28_x86_64', executable: 'runtime-linux-x64' },
|
|
'linux-arm64': { tag: 'manylinux_2_28_aarch64', executable: 'runtime-linux-arm64' },
|
|
'macos-arm64': { tag: 'macosx_14_0_arm64', executable: 'runtime-macos-arm64' },
|
|
'win-x64': { tag: 'win_amd64', executable: 'runtime-win-x64.exe' },
|
|
}
|
|
|
|
function workspace(root: string, name: string, manifest: Record<string, unknown>): void {
|
|
const packageName = name.replace('@scope/', '')
|
|
const path = join(root, 'packages/core', packageName, 'package.json')
|
|
mkdirSync(dirname(path), { recursive: true })
|
|
writeFileSync(path, `${JSON.stringify({ name, ...manifest }, null, 2)}\n`)
|
|
}
|
|
|
|
afterEach(() => {
|
|
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true })
|
|
})
|
|
|
|
describe('verifyRuntimeClosure', () => {
|
|
it('requires only plugins active for each published target', async () => {
|
|
const root = fixture({
|
|
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: { '@scope/shared': 'workspace:^' } },
|
|
'python/sdk-runtime/platforms.json': platforms,
|
|
'packages/preset/agent-presets/presets/standard/agent.cordis.yml': `
|
|
- id: tools
|
|
name: cordis:group
|
|
group: true
|
|
config:
|
|
- id: shared
|
|
name: '@scope/shared'
|
|
- id: linux
|
|
name: '@scope/linux'
|
|
disabled: !!js process.platform !== 'linux'
|
|
- id: macos
|
|
name: '@scope/macos'
|
|
disabled: !!js process.platform !== 'darwin'
|
|
- id: windows
|
|
name: '@scope/windows'
|
|
disabled: !!js process.platform !== 'win32'
|
|
`,
|
|
})
|
|
|
|
const result = await verifyRuntimeClosure(root)
|
|
|
|
expect(result.presetCount).toBe(1)
|
|
expect(result.failures).toEqual([
|
|
'standard preset -> @scope/linux (linux-arm64, linux-x64)',
|
|
'standard preset -> @scope/macos (macos-arm64)',
|
|
'standard preset -> @scope/windows (win-x64)',
|
|
])
|
|
})
|
|
|
|
it('treats an unsupported disabled expression as active on every target', async () => {
|
|
const root = fixture({
|
|
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: {} },
|
|
'python/sdk-runtime/platforms.json': platforms,
|
|
'packages/preset/agent-presets/presets/standard/agent.cordis.yml': `
|
|
- id: conditional
|
|
name: '@scope/conditional'
|
|
disabled: !!js process.env.DSH_DISABLE_CONDITIONAL === '1'
|
|
`,
|
|
})
|
|
|
|
const result = await verifyRuntimeClosure(root)
|
|
|
|
expect(result.failures).toEqual([
|
|
'standard preset -> @scope/conditional (linux-arm64, linux-x64, macos-arm64, win-x64)',
|
|
])
|
|
})
|
|
|
|
it('does not interpret an ordinary plugin array config as nested Loader entries', async () => {
|
|
const root = fixture({
|
|
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: { '@scope/plugin': 'workspace:^' } },
|
|
'python/sdk-runtime/platforms.json': platforms,
|
|
'packages/preset/agent-presets/presets/standard/agent.cordis.yml': `
|
|
- id: plugin
|
|
name: '@scope/plugin'
|
|
config:
|
|
- name: '@scope/config-value'
|
|
`,
|
|
})
|
|
|
|
const result = await verifyRuntimeClosure(root)
|
|
|
|
expect(result.failures).toEqual([])
|
|
})
|
|
|
|
it('requires preset plugins to be linked from the workspace', async () => {
|
|
const root = fixture({
|
|
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: { '@scope/plugin': '1.2.3' } },
|
|
'python/sdk-runtime/platforms.json': platforms,
|
|
'packages/preset/agent-presets/presets/standard/agent.cordis.yml': `
|
|
- id: plugin
|
|
name: '@scope/plugin'
|
|
`,
|
|
})
|
|
|
|
const result = await verifyRuntimeClosure(root)
|
|
|
|
expect(result.failures).toEqual([
|
|
'standard preset -> @scope/plugin [runtime dependency is "1.2.3"; expected workspace:] (linux-arm64, linux-x64, macos-arm64, win-x64)',
|
|
])
|
|
})
|
|
|
|
it('fails when no shipped preset is discovered', async () => {
|
|
const root = fixture({
|
|
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: {} },
|
|
'python/sdk-runtime/platforms.json': platforms,
|
|
})
|
|
|
|
const result = await verifyRuntimeClosure(root)
|
|
|
|
expect(result.presetCount).toBe(0)
|
|
expect(result.failures).toEqual([
|
|
'no agent presets matched packages/preset/agent-presets/presets/*/agent.cordis.yml',
|
|
])
|
|
})
|
|
|
|
it('fails when the runtime platform manifest has no targets', async () => {
|
|
const root = fixture({
|
|
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: {} },
|
|
'python/sdk-runtime/platforms.json': {},
|
|
'packages/preset/agent-presets/presets/standard/agent.cordis.yml': '[]\n',
|
|
})
|
|
|
|
const result = await verifyRuntimeClosure(root)
|
|
|
|
expect(result.failures).toEqual([
|
|
'python/sdk-runtime/platforms.json defines no runtime targets',
|
|
])
|
|
})
|
|
|
|
it('retains the required workspace-peer closure check', async () => {
|
|
const root = fixture({
|
|
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: { '@scope/root': 'workspace:^' } },
|
|
'python/sdk-runtime/platforms.json': platforms,
|
|
'packages/preset/agent-presets/presets/minimal/agent.cordis.yml': '[]\n',
|
|
})
|
|
workspace(root, '@scope/root', {
|
|
peerDependencies: { '@scope/required': 'workspace:^', '@scope/optional': 'workspace:^' },
|
|
peerDependenciesMeta: { '@scope/optional': { optional: true } },
|
|
})
|
|
workspace(root, '@scope/required', {})
|
|
workspace(root, '@scope/optional', {})
|
|
|
|
const result = await verifyRuntimeClosure(root)
|
|
|
|
expect(result.workspacePackageCount).toBe(1)
|
|
expect(result.failures).toEqual(['runtime -> @scope/root -> @scope/required'])
|
|
})
|
|
})
|