2026-07-16 18:13:34 +08:00
<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
2026-07-09 16:07:58 +08:00
2026-07-16 18:13:34 +08:00
# ctx.bash
2026-07-09 16:07:58 +08:00
2026-07-16 18:13:34 +08:00
`BashExecutor` (abstract seam) — provided by `@deepseek-ai/dsh-bash` .
2026-07-09 16:07:58 +08:00
2026-07-16 18:13:34 +08:00
Abstract bash execution service. Subclass, implement the abstract methods, and load the subclass as a plugin — it registers as `ctx.bash` (one implementation per context; loading a second throws, which is cordis' standard duplicate-service behavior).
2026-07-16 21:36:43 +08:00
Implementations must honor these semantics:
- run rejects only for infrastructure failures. Nonzero exits, timeout kills, and abort kills resolve with a BashRunResult.
- start returns immediately; no timeout applies to background processes. `done` settles at process close and never rejects; spawn failures settle as `killed` with the error on stderr.
- BashProcess.readOutput is incremental: consecutive reads never repeat output. Lossy reads report truncation and available spill files.
- Disposal kills all running background processes and awaits their exit.
2026-07-09 16:07:58 +08:00
2026-07-17 21:19:33 +08:00
[Source ](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/bash/bash/src/index.ts#L49 )
2026-07-16 21:36:43 +08:00
### ctx.bash.sandboxMode
```ts website-api
get sandboxMode(): SandboxMode | undefined
` ``
The sandbox mode this executor applies by default, or ` undefined` when it does not sandbox commands.
2026-07-17 21:19:33 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/bash/bash/src/index.ts#L59)
2026-07-09 16:07:58 +08:00
2026-07-16 18:13:34 +08:00
### ctx.bash.resolve(request)
2026-07-09 16:07:58 +08:00
2026-07-16 18:13:34 +08:00
` ``ts website-api
abstract resolve(request: BashExecRequest): BashExecSpec
` ``
2026-07-16 21:36:43 +08:00
Apply implementation-owned defaults and caps to a request before execution.
2026-07-16 18:13:34 +08:00
- ` request` — the caller's request; omitted fields get this implementation's defaults, capped fields are clamped.
2026-07-16 21:15:44 +08:00
**Returns** the fully-specified spec to hand to ` run`/` start`.
2026-07-16 18:13:34 +08:00
2026-07-17 21:19:33 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/bash/bash/src/index.ts#L69)
2026-07-16 18:13:34 +08:00
### ctx.bash.run(spec)
` ``ts website-api
abstract run(spec: BashExecSpec): Promise<BashRunResult>
` ``
Run a command in the foreground; resolves when it finishes.
2026-07-16 21:15:44 +08:00
- ` spec` — a resolved spec from ` resolve`, never a raw request.
2026-07-16 18:13:34 +08:00
**Returns** the outcome; nonzero exits, timeout kills, and abort kills resolve with a descriptive result rather than reject.
2026-07-17 21:19:33 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/bash/bash/src/index.ts#L77)
2026-07-16 18:13:34 +08:00
### ctx.bash.start(spec)
` ``ts website-api
2026-07-16 21:36:43 +08:00
abstract start(spec: BashExecSpec): BashProcess
2026-07-16 18:13:34 +08:00
` ``
2026-07-16 21:36:43 +08:00
Start a background process and return its handle immediately.
2026-07-16 18:13:34 +08:00
2026-07-16 21:15:44 +08:00
- ` spec` — a resolved spec from ` resolve`, never a raw request.
2026-07-16 18:13:34 +08:00
2026-07-16 21:36:43 +08:00
**Returns ** the live process handle (reads, kill, quiescence promise).
2026-07-09 16:07:58 +08:00
2026-07-17 21:19:33 +08:00
[Source ](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/bash/bash/src/index.ts#L84 )