2026-07-09 12:16:37 +08:00
|
|
|
/**
|
2026-07-13 16:24:32 +08:00
|
|
|
* Boot the REPL or ACP Code Mode overlay, defaulting to REPL. Both require a
|
|
|
|
|
* DeepSeek API key; unsupported arguments fail with usage.
|
2026-07-09 12:16:37 +08:00
|
|
|
*/
|
|
|
|
|
import { spawn } from 'node:child_process'
|
|
|
|
|
|
refactor: unify the Code Mode demos on base-plus-overlay
Both demo:code-mode UIs now share one mechanism: the base example plus a
same-shaped code-mode.cordis.yml include overlay (insert the worker
runtime, flip tools.mode). Previously the REPL side was a hand-forked
example (examples/code-agent) that had also silently diverged — it
dropped compaction and the subagent stack — so the demo's UI argument
switched agents, not just surfaces. The fork is retired: coding-agent
gains the overlay, a Code Mode README section absorbing code-agent's,
and both of its tests (the keyless boot guard, retargeted at the
overlay; the with-key RFC proof, which hand-mounts its own harness and
moves untouched). The RFC's composed-surface and e2e-tier lines, the
examples index, the AGENTS.md smoke table, and the dsh-tools README
link now describe the overlay shape.
Verified live: overlay keyless smoke, with-key code-mode e2e from its
new home, demo:code-mode banner + EOF exit, and the acp handshake.
2026-07-09 13:02:19 +08:00
|
|
|
// Each UI's node invocation, verbatim what its base demo script runs plus
|
|
|
|
|
// the overlay config (the stdio bin keeps --expose-internals for the cordis
|
|
|
|
|
// Loader's HMR path).
|
2026-07-09 12:16:37 +08:00
|
|
|
const UIS = new Map([
|
refactor: unify the Code Mode demos on base-plus-overlay
Both demo:code-mode UIs now share one mechanism: the base example plus a
same-shaped code-mode.cordis.yml include overlay (insert the worker
runtime, flip tools.mode). Previously the REPL side was a hand-forked
example (examples/code-agent) that had also silently diverged — it
dropped compaction and the subagent stack — so the demo's UI argument
switched agents, not just surfaces. The fork is retired: coding-agent
gains the overlay, a Code Mode README section absorbing code-agent's,
and both of its tests (the keyless boot guard, retargeted at the
overlay; the with-key RFC proof, which hand-mounts its own harness and
moves untouched). The RFC's composed-surface and e2e-tier lines, the
examples index, the AGENTS.md smoke table, and the dsh-tools README
link now describe the overlay shape.
Verified live: overlay keyless smoke, with-key code-mode e2e from its
new home, demo:code-mode banner + EOF exit, and the acp handshake.
2026-07-09 13:02:19 +08:00
|
|
|
['repl', ['--expose-internals', '--import', 'tsx', 'packages/ui/stdio-agent/src/bin.ts', 'examples/coding-agent/code-mode.cordis.yml']],
|
2026-07-09 12:16:37 +08:00
|
|
|
['acp', ['--import', 'tsx', 'packages/ui/acp-agent/src/bin.ts', 'examples/acp-agent/code-mode.cordis.yml']],
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
const ui = process.argv[2] ?? 'repl'
|
|
|
|
|
const args = UIS.get(ui)
|
|
|
|
|
if (!args || process.argv.length > 3) {
|
|
|
|
|
console.error('usage: pnpm run demo:code-mode [repl|acp]')
|
|
|
|
|
process.exit(2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const child = spawn(process.execPath, args, { stdio: 'inherit' })
|
|
|
|
|
child.on('exit', (code, signal) => { process.exit(signal !== null ? 1 : code ?? 1) })
|