Environment:2aronS Duel Agents Node 20 Plus
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, SDK |
| Last Updated | 2026-10-27 00:00 GMT |
Overview
Node.js >= 20 ESM runtime with native fetch and AbortSignal.timeout, used by all TypeScript packages (@duel-agents/core, @duel-agents/sdk, @duel-agents/install) in the Duel Agents monorepo.
Description
This environment provides the standard runtime for every TypeScript package in the Duel Agents monorepo. The root `package.json` declares `"engines": { "node": ">=20" }` and `"type": "module"`, so all packages run as pure ES modules. The code relies on three Node 20-era capabilities and never polyfills them: the global `fetch` Web API (no `node-fetch` dependency anywhere), `AbortSignal.timeout()` for request deadlines (used by both `checkConnectivity` and `DuelClient`), and `node:readline/promises` for interactive key prompts in the CLI. Path resolution uses `fileURLToPath(import.meta.url)`, an ESM-only idiom that breaks under CommonJS `require`.
Usage
Use this environment for any TypeScript package build, test, or publish in the monorepo (`packages/core`, `packages/sdk`, `packages/cli`), and whenever running the `duel-agents` / `duel-agents-install` CLI via `npx @duel-agents/install`. All 14 TypeScript Implementation pages require it.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, or Windows | `isPathInside` in core handles Windows cross-drive paths explicitly |
| Hardware | Any modern CPU | No GPU; CLI and SDK are network-bound only |
| Runtime | Node.js >= 20 | Enforced by `engines` field; CI matrix tests Node 20 and 22 |
| Disk | ~100 MB | npm workspace with json5 + TypeScript toolchain |
| Network | Outbound HTTPS to duelagents.com | Required for install doctor and SDK calls |
Dependencies
System Packages
- `node` >= 20
- `npm` (with workspace support, npm >= 7)
Package Dependencies
- `json5` ^2.2.3 (core: OpenClaw config parse/stringify)
- `@duel-agents/core` 0.1.0 (exact, pinned for sdk and cli)
Dev Dependencies
- `typescript` ^5.7.2
- `tsx` ^4.19.2 (runs `node --import tsx --test` test files directly)
- `@types/node` ^22.10.1
Credentials
The following environment variables are read at runtime:
- `DUEL_API_KEY`: Duel API key, format `duel_<8-char prefix>_<32-char base62 secret>` (primary credential)
- `DUEL_AGENTS_API_KEY`: fallback credential, checked by `resolveApiKeyFromEnv()` in the CLI
- `DUEL_PROXY_URL`: optional proxy override, must be an http(s) URL
- `NEXT_PUBLIC_PROXY_URL`: secondary proxy override, checked after `DUEL_PROXY_URL`
Never hardcode key values; all pages that write config store `${DUEL_API_KEY}` placeholders or write the key only into user-local `.env` files.
Quick Install
# From the monorepo root (npm workspaces)
npm ci
npm run build
npm test
npm run typecheck
# Or consume the published CLI directly
npx @duel-agents/install doctor
Code Evidence
Engine constraint from the root `package.json:15-17`:
"engines": {
"node": ">=20"
}
Node 20 API dependencies — native fetch and `AbortSignal.timeout` from `packages/core/src/config.ts:199-206`:
const res = await fetch(url, {
method: attempt.method,
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
signal: AbortSignal.timeout(15_000),
});
ESM-only path resolution from `packages/cli/src/install.ts:24-25`:
export function resolveIntegrationPath(...parts: string[]): string {
const here = dirname(fileURLToPath(import.meta.url));
CI verification matrix from `.github/workflows/ci.yml:21-22`:
strategy:
fail-fast: false
matrix:
node-version: [20, 22]
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `AbortSignal.timeout is not a function` | Node < 17.3 (or non-Node runtime without the API) | Upgrade to Node >= 20 per the `engines` field |
| `Cannot use import statement outside a module` | Running the compiled ESM dist under CommonJS `require` | Import with dynamic `import()` or run under Node ESM |
| `Integration assets not found (...)` | CLI run from a location where the `integrations/` directory is not shipped | Reinstall `@duel-agents/install` or run from the repo root (`resolveIntegrationPath` tries 3 layouts) |
| `Invalid or missing DUEL_API_KEY` | Env var unset or key fails the `duel_<prefix>_<secret>` regex | Create a key at the dashboard URL printed in the error |
| `Unsupported engine` npm warning | Node < 20 with engine-strict consumers | Upgrade Node |
Compatibility Notes
- Node 18: may work for pure SDK calls (fetch is global since 18) but is unsupported — `engines` and CI only cover 20 and 22.
- Browsers: the SDK's `DuelClient` accepts an injectable `fetch` (`opts.fetch`), so it can run in browsers/edge runtimes that provide `fetch` and `AbortSignal.timeout`, but the CLI packages cannot (they use `node:fs`, `node:os`, `node:readline`).
- Windows: supported; `isPathInside` explicitly guards against cross-drive `relative()` results (`rel.includes(":")`).
- npm workspaces: the monorepo requires npm >= 7 for `workspaces` and `-w` workspace flags used in build scripts.
Related Pages
- Implementation:2aronS_Duel_Agents_Key_Validation_and_Resolution
- Implementation:2aronS_Duel_Agents_getEnvForTarget
- Implementation:2aronS_Duel_Agents_mergeEnvFile
- Implementation:2aronS_Duel_Agents_installTargetEnv
- Implementation:2aronS_Duel_Agents_patchOpenClawConfig
- Implementation:2aronS_Duel_Agents_buildOpenClawPatch
- Implementation:2aronS_Duel_Agents_deepMerge
- Implementation:2aronS_Duel_Agents_checkConnectivity
- Implementation:2aronS_Duel_Agents_runDoctor
- Implementation:2aronS_Duel_Agents_runInstall
- Implementation:2aronS_Duel_Agents_Skill_Asset_Copying
- Implementation:2aronS_Duel_Agents_Config_Path_Resolution
- Implementation:2aronS_Duel_Agents_DuelClient
- Implementation:2aronS_Duel_Agents_Duel_Error_Hierarchy
- Implementation:2aronS_Duel_Agents_Package_Lock