Remove the stdio agent
This commit is contained in:
@@ -1,43 +1,37 @@
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { LOADER_SMOKE_TEST_TIMEOUT_MS, runLoaderSmoke } from '@deepseek-ai/dsh-loader-smoke'
|
||||
import type { SessionEvent } from '@deepseek-ai/dsh-session'
|
||||
|
||||
/**
|
||||
* Keyless-by-nature Loader-path coverage for examples/echo-agent. The real
|
||||
* tree uses its deterministic mock model, so this suite is both the boot smoke
|
||||
* and the complete behavior proof for the example.
|
||||
*/
|
||||
|
||||
const binScript = fileURLToPath(new URL('../../../packages/examples/stdio-demo/src/bin.ts', import.meta.url))
|
||||
const binScript = fileURLToPath(new URL('../../../packages/examples/cli-demo/src/bin.ts', import.meta.url))
|
||||
const configPath = fileURLToPath(new URL('../cordis.yml', import.meta.url))
|
||||
const tsconfigPath = fileURLToPath(new URL('../../../tsconfig.json', import.meta.url))
|
||||
|
||||
async function runEcho(stdinLines: readonly string[]): Promise<string> {
|
||||
async function runEcho(task: string, outputFormat: 'text' | 'stream-json' = 'text'): Promise<string> {
|
||||
const { stdout } = await runLoaderSmoke({
|
||||
label: 'echo-agent',
|
||||
tempDirPrefix: 'echo-smoke-',
|
||||
binScript,
|
||||
configPath,
|
||||
binArgs: ['--config', configPath, '--output-format', outputFormat, task],
|
||||
tsconfigPath,
|
||||
stdinLines,
|
||||
})
|
||||
return stdout
|
||||
}
|
||||
|
||||
describe('echo-agent keyless smoke (real cordis.yml via the Loader)', () => {
|
||||
it('boots, prints its welcome banner, and exits cleanly on stdin EOF', async () => {
|
||||
expect(await runEcho([])).toContain('echo-agent ready.')
|
||||
describe('echo-agent keyless smoke (Headless through the real Loader tree)', () => {
|
||||
it('runs the echo tool round-trip and exposes both events in stream-json', async () => {
|
||||
const lines = (await runEcho('echo hello world', 'stream-json'))
|
||||
.trimEnd().split('\n').map(line => JSON.parse(line) as Record<string, unknown>)
|
||||
const events = lines.slice(0, -1).map(line => line['event'] as SessionEvent)
|
||||
expect(events.some(event => event.type === 'tool/call' && event.data.name === 'echo')).toBe(true)
|
||||
expect(JSON.stringify(events.find(event => event.type === 'tool/result'))).toContain('ECHO: HELLO WORLD')
|
||||
expect(lines.at(-1)).toMatchObject({ type: 'result', success: true })
|
||||
}, LOADER_SMOKE_TEST_TIMEOUT_MS)
|
||||
|
||||
it('runs the echo tool round-trip for an "echo …" line', async () => {
|
||||
const stdout = await runEcho(['echo hello world'])
|
||||
expect(stdout).toContain('[tool call] echo')
|
||||
expect(stdout).toContain('[tool result] ECHO: HELLO WORLD')
|
||||
}, LOADER_SMOKE_TEST_TIMEOUT_MS)
|
||||
|
||||
it('streams a direct canned reply for a non-echo line', async () => {
|
||||
const stdout = await runEcho(['just chatting'])
|
||||
expect(stdout).toContain('just chatting')
|
||||
expect(stdout).not.toContain('[tool call]')
|
||||
it('prints the final canned reply for a direct one-shot task', async () => {
|
||||
const stdout = await runEcho('just chatting')
|
||||
expect(stdout).toContain('You said: "just chatting"')
|
||||
expect(stdout).not.toContain('tool/call')
|
||||
}, LOADER_SMOKE_TEST_TIMEOUT_MS)
|
||||
})
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
- id: time-context
|
||||
name: '@deepseek-ai/dsh-time-context'
|
||||
|
||||
- id: stdio-agent
|
||||
name: '@deepseek-ai/dsh-stdio-demo'
|
||||
- id: cli-agent
|
||||
name: '@deepseek-ai/dsh-cli-demo'
|
||||
config:
|
||||
provider: mock
|
||||
model: mock-echo
|
||||
persona: 'Test the time-context plugin.'
|
||||
welcome: 'time-context e2e ready.'
|
||||
persistenceRoot: './.sessions'
|
||||
workspaceContext: false
|
||||
|
||||
16
examples/echo-agent/tests/fixtures/context/time-context/driver.ts
vendored
Normal file
16
examples/echo-agent/tests/fixtures/context/time-context/driver.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
/** Test driver that sends two turns through one headless Loader composition. */
|
||||
|
||||
import { boot, resolveConfigPath } from '@deepseek-ai/dsh-app-boot'
|
||||
import { runOneShot } from '@deepseek-ai/dsh-cli-demo/src/cli.ts'
|
||||
|
||||
const configPath = process.argv[2]
|
||||
if (configPath === undefined) throw new Error('time-context driver requires a config path')
|
||||
|
||||
const ctx = await boot('time-context-e2e', resolveConfigPath(configPath, undefined))
|
||||
try {
|
||||
await runOneShot(ctx, { task: 'first' })
|
||||
await runOneShot(ctx, { task: 'second' })
|
||||
} finally {
|
||||
await ctx.fiber.dispose()
|
||||
}
|
||||
Reference in New Issue
Block a user