test(subagent): scope preset round trips to their snapshot scenario

This commit is contained in:
Dudu-0223 committed 2026-10-25 12:24:04 +08:00
1 parent f78984a497
commit 0a618f13d5
3 files changed
+9 -4

No files matched your search

@@ -1,4 +1,4 @@
/** Compose a blank headless Session through repeated preset selections. */
/** Compose a blank headless Session through the scenario's preset selections. */
import type { Context } from '@deepseek-ai/cordis'
import type {} from '@deepseek-ai/dsh-agent'
@@ -8,13 +8,14 @@ export const name = 'parent-agent-preset'
export const inject = ['agentPresets']
/**
* Register the root Session's initial preset selection.
* Select the root Session's presets before publication checks.
* @param ctx - Snapshot composition context with the preset roster.
* @param config - Ordered preset selections; omission selects the parent preset once.
*/
export function apply(ctx: Context): void {
export function apply(ctx: Context, config: { presets?: string[] } = {}): void {
ctx.on('agent/created', async ({ agent }) => {
if (agent.session.header.parentSession !== undefined) return
for (const preset of ['parent', 'reviewer', 'parent', 'reviewer', 'parent']) {
for (const preset of config.presets ?? ['parent']) {
await ctx.agentPresets.select(agent, preset)
}
}, { prepend: true })
@@ -74,6 +74,8 @@
allowedAgentPresets: [reviewer]
- id: parent-agent-preset
name: '../../../packages/test-support/session-snapshot/tests/fixtures/parent-agent-preset.ts'
config:
presets: [parent, reviewer, parent, reviewer, parent]
- id: tool-subagent
name: '@deepseek-ai/dsh-tool-subagent'
@@ -33,6 +33,8 @@
allowedAgentPresets: [reviewer]
- id: parent-agent-preset
name: '../../../packages/test-support/session-snapshot/tests/fixtures/parent-agent-preset.ts'
config:
presets: [parent, reviewer, parent, reviewer, parent]
- id: tool-subagent
name: '@deepseek-ai/dsh-tool-subagent'