Files
deepseek-harness/packages/subagent/subagent-claude-code/tests/loader-composition.e2e.ts
T
pku-xht 21b93a4568 Merge commit '61e35fb8ebb2fd8b68ed0c64f586602bb825bd06' into codex/installable-product-subagents
# Conflicts:
#	.agents/notes/implemented/architecture/2026-08-10-product-subagent-providers-in-shared-host.i18n.yaml
#	.agents/notes/implemented/architecture/2026-08-10-product-subagent-providers-in-shared-host.md
#	.agents/notes/implemented/architecture/2026-08-10-product-subagent-providers-in-shared-host.zh.md
#	.agents/notes/implemented/feature/2026-08-04-claude-code-and-codex-subagent-backends.i18n.yaml
#	.agents/notes/implemented/feature/2026-08-04-claude-code-and-codex-subagent-backends.md
#	.agents/notes/implemented/feature/2026-08-04-claude-code-and-codex-subagent-backends.zh.md
#	apps/cli/config/agent-presets/code/agent.cordis.yml
#	apps/cli/config/agent-presets/cordis/agent.cordis.yml
#	apps/cli/config/agent-presets/cordis/skills/editing-cordis-compositions/SKILL.md
#	apps/cli/config/agent-presets/standard/agent.cordis.yml
#	apps/cli/tests/web-agent-presets.e2e.ts
#	examples/acp-agent/tests/fixtures/subagent/subagent-claude-code/cordis.yml
#	examples/acp-agent/tests/fixtures/subagent/subagent-claude-code/driver.ts
#	packages/bundle/base/README.i18n.yaml
#	packages/bundle/base/README.md
#	packages/bundle/base/README.zh.md
#	packages/subagent/subagent-claude-code/README.i18n.yaml
#	packages/subagent/subagent-claude-code/README.md
#	packages/subagent/subagent-claude-code/README.zh.md
#	packages/subagent/subagent-claude-code/tests/loader-composition.e2e.ts
2026-08-14 16:18:47 +08:00

64 lines
2.2 KiB
TypeScript

import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
import {
LOADER_SMOKE_TEST_TIMEOUT_MS,
runLoaderSmoke,
} from '@deepseek-ai/dsh-loader-smoke'
const fixtureDir = fileURLToPath(new URL(
'../../../../examples/acp-agent/tests/fixtures/subagent/subagent-claude-code/',
import.meta.url,
))
const driver = join(fixtureDir, 'driver.ts')
const configPath = join(fixtureDir, 'cordis.yml')
const packageDir = fileURLToPath(new URL('..', import.meta.url))
const manifest = JSON.parse(readFileSync(join(packageDir, 'package.json'), 'utf8')) as {
dsh?: { bundle?: { patch?: string } }
}
const bundlePatch = manifest.dsh?.bundle?.patch
if (bundlePatch === undefined) throw new Error('Claude Code package must declare a Bundle patch')
const bundlePatchPath = join(packageDir, bundlePatch)
const repoTsconfig = fileURLToPath(new URL('../../../../tsconfig.json', import.meta.url))
describe('Claude Code provider public Loader composition', () => {
it('loads its Bundle patch, one-shot tool, and job controls without starting Claude Code', async () => {
const { stdout, stderr } = await runLoaderSmoke({
label: 'product-provider Loader composition',
tempDirPrefix: 'dsh-product-provider-loader-',
binScript: driver,
libBinScript: driver,
configPath,
binArgs: [configPath, bundlePatchPath],
tsconfigPath: repoTsconfig,
env: {
// Loading the optional package must not probe or start a Claude binary.
PATH: '',
},
})
expect(stderr).toBe('')
expect(JSON.parse(stdout)).toEqual({
providers: ['claude-code'],
provider: {
name: 'claude-code',
capabilities: {
outputSchema: false,
depthLimit: false,
toolFilter: false,
persona: false,
},
inheritsParentContext: false,
},
tool: {
name: 'subagent_claude_code',
parameterNames: ['description', 'prompt', 'run_in_background'],
required: ['description', 'prompt'],
},
jobTools: ['job_kill', 'job_list', 'job_output'],
starts: 0,
})
}, LOADER_SMOKE_TEST_TIMEOUT_MS)
})