feat(subagent): add Claude Code provider
This commit is contained in:
40
examples/acp-agent/tests/fixtures/subagent/subagent-claude-code/cordis.yml
vendored
Normal file
40
examples/acp-agent/tests/fixtures/subagent/subagent-claude-code/cordis.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# Test-only composition of both public opt-in providers and foreground tools.
|
||||
# The owning e2e boots this tree but never invokes a model or product process.
|
||||
- id: fixture
|
||||
name: './fixture.ts'
|
||||
|
||||
- id: subagent
|
||||
name: '@deepseek-ai/dsh-subagent'
|
||||
|
||||
- id: subprocess
|
||||
name: '@deepseek-ai/dsh-subprocess-local'
|
||||
|
||||
- id: subagent-codex
|
||||
name: '@deepseek-ai/dsh-subagent-codex'
|
||||
|
||||
- id: subagent-claude-code
|
||||
name: '@deepseek-ai/dsh-subagent-claude-code'
|
||||
|
||||
- id: tool-subagent-codex
|
||||
name: '@deepseek-ai/dsh-tool-subagent'
|
||||
config:
|
||||
provider: codex
|
||||
toolName: subagent_codex
|
||||
enableRunInBackground: false
|
||||
maxDepth: 'provider-managed'
|
||||
|
||||
- id: tool-subagent-claude-code
|
||||
name: '@deepseek-ai/dsh-tool-subagent'
|
||||
config:
|
||||
provider: claude-code
|
||||
toolName: subagent_claude_code
|
||||
enableRunInBackground: false
|
||||
maxDepth: 'provider-managed'
|
||||
|
||||
- id: cli-agent
|
||||
name: '@deepseek-ai/dsh-cli-demo'
|
||||
config:
|
||||
provider: mock
|
||||
model: mock-delegate
|
||||
persona: 'This composition test must not start a model turn.'
|
||||
workspaceContext: false
|
||||
65
examples/acp-agent/tests/fixtures/subagent/subagent-claude-code/driver.ts
vendored
Normal file
65
examples/acp-agent/tests/fixtures/subagent/subagent-claude-code/driver.ts
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env node
|
||||
/** Inspect both public product-provider compositions without invoking them. */
|
||||
|
||||
import { boot, resolveConfigPath } from '@deepseek-ai/dsh-app-boot'
|
||||
import type {} from '@deepseek-ai/dsh-subagent'
|
||||
import type {} from '@deepseek-ai/dsh-tools'
|
||||
|
||||
const configPath = process.argv[2]
|
||||
if (configPath === undefined) {
|
||||
throw new Error('product-provider Loader composition driver requires a config path')
|
||||
}
|
||||
|
||||
let starts = 0
|
||||
const ctx = await boot(
|
||||
'product-provider-loader-composition',
|
||||
resolveConfigPath(configPath, undefined),
|
||||
undefined,
|
||||
(hostCtx) => {
|
||||
hostCtx.on('subagent/start', () => {
|
||||
starts += 1
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
try {
|
||||
const providerNames = ['codex', 'claude-code'] as const
|
||||
const toolNames = ['subagent_codex', 'subagent_claude_code'] as const
|
||||
const providers = providerNames.map((providerName) => {
|
||||
const provider = ctx.subagents.getProvider(providerName)
|
||||
if (provider === undefined) {
|
||||
throw new Error(`${providerName} provider was not registered`)
|
||||
}
|
||||
return {
|
||||
name: provider.name,
|
||||
capabilities: provider.capabilities,
|
||||
inheritsParentContext: provider.inheritsParentContext,
|
||||
}
|
||||
})
|
||||
const tools = toolNames.map((toolName) => {
|
||||
const tool = ctx.tools.schemas().find(schema => schema.name === toolName)
|
||||
if (tool === undefined) throw new Error(`${toolName} tool was not registered`)
|
||||
const properties = tool.parameters.properties
|
||||
if (
|
||||
typeof properties !== 'object'
|
||||
|| properties === null
|
||||
|| Array.isArray(properties)
|
||||
) {
|
||||
throw new Error(`${toolName} has invalid parameter properties`)
|
||||
}
|
||||
return {
|
||||
name: tool.name,
|
||||
parameterNames: Object.keys(properties).sort(),
|
||||
required: tool.parameters.required,
|
||||
}
|
||||
})
|
||||
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
registeredProviders: ctx.subagents.list(),
|
||||
providers,
|
||||
tools,
|
||||
starts,
|
||||
})}\n`)
|
||||
} finally {
|
||||
await ctx.fiber.dispose()
|
||||
}
|
||||
7
examples/acp-agent/tests/fixtures/subagent/subagent-claude-code/fixture.ts
vendored
Normal file
7
examples/acp-agent/tests/fixtures/subagent/subagent-claude-code/fixture.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/** Reuse the composition-only parent adapter shared by the product providers. */
|
||||
|
||||
export {
|
||||
apply,
|
||||
inject,
|
||||
name,
|
||||
} from '../subagent-codex/fixture.ts'
|
||||
@@ -63,6 +63,7 @@
|
||||
"@deepseek-ai/dsh-spill-policy": "workspace:*",
|
||||
"@deepseek-ai/dsh-subagent": "workspace:*",
|
||||
"@deepseek-ai/dsh-subagent-acp": "workspace:*",
|
||||
"@deepseek-ai/dsh-subagent-claude-code": "workspace:*",
|
||||
"@deepseek-ai/dsh-subagent-codex": "workspace:*",
|
||||
"@deepseek-ai/dsh-subagent-dsh-sdk": "workspace:*",
|
||||
"@deepseek-ai/dsh-subagent-fork": "workspace:*",
|
||||
|
||||
Reference in New Issue
Block a user