Merge branch 'codex/fix-compact-agents-reinjection' into codex/fix-resume-baseline-dedup
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'
|
||||
29
examples/acp-agent/tests/fixtures/subagent/subagent-codex/cordis.yml
vendored
Normal file
29
examples/acp-agent/tests/fixtures/subagent/subagent-codex/cordis.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# Test-only composition of the public opt-in provider and foreground tool.
|
||||
# The owning e2e boots this tree but never invokes the model or Codex.
|
||||
- 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: tool-subagent-codex
|
||||
name: '@deepseek-ai/dsh-tool-subagent'
|
||||
config:
|
||||
provider: codex
|
||||
toolName: subagent_codex
|
||||
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
|
||||
51
examples/acp-agent/tests/fixtures/subagent/subagent-codex/driver.ts
vendored
Normal file
51
examples/acp-agent/tests/fixtures/subagent/subagent-codex/driver.ts
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env node
|
||||
/** Inspect the public Codex provider composition without invoking the product. */
|
||||
|
||||
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('subagent-codex Loader composition driver requires a config path')
|
||||
}
|
||||
|
||||
let starts = 0
|
||||
const ctx = await boot(
|
||||
'subagent-codex-loader-composition',
|
||||
resolveConfigPath(configPath, undefined),
|
||||
undefined,
|
||||
(hostCtx) => {
|
||||
hostCtx.on('subagent/start', () => {
|
||||
starts += 1
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
try {
|
||||
const provider = ctx.subagents.getProvider('codex')
|
||||
if (provider === undefined) throw new Error('Codex provider was not registered')
|
||||
const tool = ctx.tools.schemas().find(schema => schema.name === 'subagent_codex')
|
||||
if (tool === undefined) throw new Error('subagent_codex tool was not registered')
|
||||
const properties = tool.parameters.properties
|
||||
if (typeof properties !== 'object' || properties === null || Array.isArray(properties)) {
|
||||
throw new Error('subagent_codex tool has invalid parameter properties')
|
||||
}
|
||||
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
providers: ctx.subagents.list(),
|
||||
provider: {
|
||||
name: provider.name,
|
||||
capabilities: provider.capabilities,
|
||||
inheritsParentContext: provider.inheritsParentContext,
|
||||
},
|
||||
tool: {
|
||||
name: tool.name,
|
||||
parameterNames: Object.keys(properties).sort(),
|
||||
required: tool.parameters.required,
|
||||
},
|
||||
starts,
|
||||
})}\n`)
|
||||
} finally {
|
||||
await ctx.fiber.dispose()
|
||||
}
|
||||
22
examples/acp-agent/tests/fixtures/subagent/subagent-codex/fixture.ts
vendored
Normal file
22
examples/acp-agent/tests/fixtures/subagent/subagent-codex/fixture.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/** Parent adapter that fails if the composition-only Loader test starts a turn. */
|
||||
|
||||
import type { Context } from 'cordis'
|
||||
import type { GenerateOptions, StreamChunk } from '@deepseek-ai/dsh-llm'
|
||||
import { LlmAdapter } from '@deepseek-ai/dsh-llm'
|
||||
|
||||
class CompositionOnlyAdapter extends LlmAdapter {
|
||||
async * stream(_options: GenerateOptions): AsyncIterable<StreamChunk> {
|
||||
throw new Error('subagent-codex Loader composition must not invoke a model')
|
||||
}
|
||||
}
|
||||
|
||||
export const name = 'codex-loader-composition-fixture'
|
||||
export const inject = ['llm']
|
||||
|
||||
/**
|
||||
* Register a parent adapter solely so the host composition is complete.
|
||||
* @param ctx - Loader context supplying the LLM seam.
|
||||
*/
|
||||
export function apply(ctx: Context): void {
|
||||
ctx.llm.registerAdapter(['mock'], new CompositionOnlyAdapter())
|
||||
}
|
||||
Reference in New Issue
Block a user