|
|
@@ -1,3 +1,6 @@
|
|
|
+import { mkdtemp, rm } from 'node:fs/promises'
|
|
|
+import { tmpdir } from 'node:os'
|
|
|
+import { join } from 'node:path'
|
|
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
|
import type { Context } from 'cordis'
|
|
|
import { AgentId } from '@deepseek-ai/dsh-agent'
|
|
|
@@ -9,6 +12,7 @@ import { codingHarness, finalText, SYSTEM_PROMPT, waitForIdle } from './harness.
|
|
|
*/
|
|
|
|
|
|
let ctx: Context | undefined
|
|
|
+let workdir: string | undefined
|
|
|
|
|
|
afterEach(async () => {
|
|
|
// Always dispose the harness, even on failure/retry/timeout: agent-loop
|
|
|
@@ -16,11 +20,14 @@ afterEach(async () => {
|
|
|
// process the model left behind.
|
|
|
await ctx?.fiber.dispose()
|
|
|
ctx = undefined
|
|
|
+ if (workdir !== undefined) await rm(workdir, { recursive: true, force: true })
|
|
|
+ workdir = undefined
|
|
|
})
|
|
|
|
|
|
describe.skipIf(!process.env.DEEPSEEK_API_KEY)('full loop: real model + real bash tool', () => {
|
|
|
it('runs a bash command on request and reports its output', async () => {
|
|
|
- ctx = await codingHarness(process.cwd(), { persona: SYSTEM_PROMPT })
|
|
|
+ workdir = await mkdtemp(join(tmpdir(), 'dsh-full-loop-e2e-'))
|
|
|
+ ctx = await codingHarness(workdir, { persona: SYSTEM_PROMPT })
|
|
|
const agent = ctx.agentLoop.create(AgentId('e2e-loop'), { model: 'deepseek-v4-flash' })
|
|
|
|
|
|
agent.send([{ type: 'text', text: 'Run `echo e2e-ok` with the bash tool and tell me its exact output.' }])
|