Merge branch 'split/turn-enclosure' into split/session-persistence

# Conflicts:
#	docs/adr/README.md
#	packages/agent-loop/package.json
#	yarn.lock
This commit is contained in:
Tianyi Cui
2026-06-16 17:01:36 +08:00
53 changed files with 4779 additions and 5100 deletions

View File

@@ -12,7 +12,7 @@ A mock model + echo tool + stdio UI + JSONL persistence demo. Demonstrates:
- Persisting session events to JSONL via the `session/event` + `session/flush` pattern
- A minimal stdio UI consuming `agent/stream-chunk` and session events
Run with: `yarn demo:echo`
Run with: `pnpm run demo:echo`
When prompted, type "echo <something>" to trigger a tool call round-trip.
@@ -20,4 +20,4 @@ When prompted, type "echo <something>" to trigger a tool call round-trip.
The real thing: DeepSeek V4 + the bash tool suite + stdio chat + JSONL persistence, wired from `cordis.yml`. Where echo-agent proves the skeleton with mocks, this is a usable coding assistant.
Run with: `yarn demo:coding` (needs `DEEPSEEK_API_KEY` in the environment or a gitignored repo-root `.env`). See [coding-agent/README.md](coding-agent/README.md) for details.
Run with: `pnpm run demo:coding` (needs `DEEPSEEK_API_KEY` in the environment or a gitignored repo-root `.env`). See [coding-agent/README.md](coding-agent/README.md) for details.

View File

@@ -9,7 +9,7 @@ The first REAL agent wiring: DeepSeek V4 + the bash tool suite + stdio chat
# repo root .env (gitignored) or exported env:
# DEEPSEEK_API_KEY=sk-…
# DEEPSEEK_BASE_URL=https://… # optional; defaults to the public API
yarn demo:coding
pnpm run demo:coding
```
Type a coding task. The agent's only tools are `bash` (+ `bash_output` / `bash_kill` for background tasks): file reads, writes, searches, and test runs all happen through shell commands, each in a fresh `bash -c` (the system prompt tells the model to pass `workdir` instead of `cd`). Reasoning streams dimmed; tool calls/results render inline.
@@ -32,7 +32,7 @@ Type a coding task. The agent's only tools are `bash` (+ `bash_output` / `bash_k
| `session-persistence` (`dsh-session-persistence-jsonl`) | durable JSONL persistence (`root: ./.sessions`): append-only event log per session, crash-safe atomic writes — the shared backend, no per-example file |
| `src/stdio-chat.ts` | UI as a plugin; copied from echo-agent with reasoning-dimming and an exit-on-idle close handler for piped stdin. Example-local on purpose — extract a shared UI package when a third example needs it |
## End-to-end tests (`yarn test:e2e`, key-gated)
## End-to-end tests (`pnpm run test:e2e`, key-gated)
- `tests/full-loop.e2e.ts` — the canary: real model runs `echo e2e-ok` through the real bash tool; asserts `tool/call`/`tool/result` session events and the final answer.
- `tests/coding-task.e2e.ts` — the swebench-style smoke: a temp dir holds `add.js` (with `a - b` where `a + b` belongs) and a failing `add.test.js`; the agent must fix the bug and verify. The test re-runs `node add.test.js` ITSELF and inspects the files — agent claims are not trusted.

View File

@@ -24,7 +24,7 @@ Persistence is the shared `@deepseek-ai/dsh-session-persistence-jsonl` plugin (n
## Run
```sh
yarn demo:echo
pnpm run demo:echo
# or:
node --expose-internals --import tsx examples/echo-agent/start.ts
```