description: "Run TypeScript programs in fresh Node processes with the session filesystem sandbox, managed cleanup, and configurable execution and output limits."
English | 中文
Execute model-written TypeScript under the same platform sandbox policy as Bash, with host-provided functions available as async bindings. Each call starts a fresh Node process and returns captured logs, an exact JSON value, or a structured failure. Direct Node APIs remain available within the selected restrictions. Elapsed deadlines, output bounds and a V8 heap limit constrain execution; cancellation and completion terminate the managed process range. A requested restricted mode fails when its sandbox backend is unavailable.
Mount this provider in a composition that supplies fs, subprocess, sandbox and sandboxPolicy. PTC mode in dsh-tools supplies the calling Session's directory and standing policy; direct runtime consumers resolve those options before execution.
Configure the provider row after its required services are available:
- name: '@deepseek-ai/dsh-code-runtime-node'
config:
timeoutMs: 120000
maxTimeoutMs: 600000
maxOutputBytes: 67108864
maxOldGenerationSizeMb: 512
maxMessageBytes: 134217728
maxPendingCalls: 128
graceMs: 3000
| Field | Default | Meaning |
|---|---|---|
timeoutMs |
120,000 |
Default elapsed execution deadline, including nested tool and approval waits |
maxTimeoutMs |
600,000 |
Elapsed deadline ceiling applied by the resolver |
maxOutputBytes |
67,108,864 |
Combined serialized logs and completion or diagnostic budget |
maxOldGenerationSizeMb |
512 |
V8 old-generation heap limit in MiB |
maxMessageBytes |
134,217,728 |
Limit for a control frame, outstanding argument bytes and queued control writes |
maxPendingCalls |
128 |
Maximum simultaneous host binding calls |
graceMs |
3,000 |
Managed termination and output-drain grace |
nodeExecutable |
Current Node executable | Executable resolved in the subprocess execution world |
bootstrapPath |
Package bootstrap | Optional absolute path to a preinstalled built bootstrap in that world |
The configuration catalog defines accepted config fields. resolve(request) supplies cwd, the capped timeout and the execution policy; run(spec) accepts those resolved inputs and does not fill missing values.
Programs are async function bodies: top-level await and return work, and only erasable TypeScript is accepted. A successful call returns its lossless-JSON value as result.value and captured text as result.logs. result.sandbox reports the selected mode, observed denial and the backend's full or partial enforcement independently of the program outcome.
Direct filesystem, network and subprocess operations remain Node operations, subject to the selected OS sandbox. Nested host bindings cross the control channel; PTC tool calls retain the registry's visibility, ordering, logging and approval rules. Running a program does not change the Session's standing policy or automatically replay it after a denial.
The PTC consumer exposes per-call timeout and approved sandbox choices as described in dsh-tools. The runtime's readonly timeout descriptor reports its effective default and maximum to that consumer. Its executionInstructions describes fresh Node state, direct Node APIs, the empty program environment and file policy in the model-visible schema.
The elapsed deadline covers runtime setup and execution, including time awaiting nested tools or approval. It is not a CPU meter. Timeout or cancellation stops a synchronous loop through the host's managed process owner; successful completion also cleans that managed range. The timer stops when an outcome is selected, before cleanup, so the returned call can take longer than its execution deadline while cleanup settles.
Program parse errors and thrown exceptions are exception; deadline expiry is timeout; cancellation is abort; malformed or excessive control traffic is protocol; unavailable confinement is sandbox-unavailable; early process exit or failed managed cleanup is worker-exit. The substrate-independent failure name remains worker-exit for process providers. Lossy completions are invalid-output, and an oversized outer result is output-limit, retaining the fitting log prefix. Invalid or unsupported options and calls after disposal reject as caller misuse.
Read the service contract before using the provider directly; the decisions explain policy and consumer ownership.
Indirectly, through PTC mode in dsh-tools, which returns captured logs and the completion value or a failure with sandbox facts. Intermediate binding traffic stays outside model history; the outer result follows the ordinary tool spill policy.
No direct invalidation; the named consumer owns any request-prefix changes.
These limits qualify the execution guarantees and retained output.
log, info, warn, error and debug.