Files
deepseek-harness/website/zh-CN/api/harness/bash.md
lintianle 2cde2a9032 Merge origin/master into feat/website-docs
Conflict resolution notes:
- package.json/run-gates: both sides' new doc-sync gates kept (master's
  scoped-events/readme gates + this branch's website-api/website-yaml);
  js-yaml devDeps deduped (master added them independently).
- pnpm-workspace/knip: website AND python/sdk-runtime entries kept.
- doc-typecheck/verify-type-equiv: master's condensed headers kept, website
  glob retained in both scan scopes.
- vendor/cordis/src/fiber.ts: master's lifecycle-hardening code taken; this
  branch's richer FiberState JSDoc reapplied on top. vendor/README.md logs
  both local modifications (hardening = 6, JSDoc enrichment = 7).
- pnpm-lock: regenerated from master's side (pnpm install).

Post-merge sync the gates forced (the system working as designed):
- verify-website-yaml caught 4 stale plugin names from master's package
  reorg (dsh-stdio-agent -> dsh-stdio-demo, dsh-acp-agent -> dsh-acp-demo);
  8 references fixed across guide/ and develop/.
- gen-website-api picked up master's 6 new services automatically
  (ctx.approval/permission/sandbox/sessionQuery/skills/tasks -> 6 new pages
  + sidebar); api/index.md hub updated to list them.
- AGENTS.md budget ceiling 1370 -> 1400: the website rows (layout line + two
  command lines) and master's own growth collided with the old ceiling; all
  three website rows are load-bearing (new top-level dir, new CI command).
2026-07-16 21:36:43 +08:00

2.7 KiB

ctx.bash

BashExecutor (abstract seam) — provided by @deepseek-ai/dsh-bash.

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). 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.

Source

ctx.bash.sandboxMode

get sandboxMode(): SandboxMode | undefined

The sandbox mode this executor applies by default, or undefined when it does not sandbox commands.

Source

ctx.bash.resolve(request)

abstract resolve(request: BashExecRequest): BashExecSpec

Apply implementation-owned defaults and caps to a request before execution.

  • request — the caller's request; omitted fields get this implementation's defaults, capped fields are clamped.

Returns the fully-specified spec to hand to run/start.

Source

ctx.bash.run(spec)

abstract run(spec: BashExecSpec): Promise<BashRunResult>

Run a command in the foreground; resolves when it finishes.

  • spec — a resolved spec from resolve, never a raw request.

Returns the outcome; nonzero exits, timeout kills, and abort kills resolve with a descriptive result rather than reject.

Source

ctx.bash.start(spec)

abstract start(spec: BashExecSpec): BashProcess

Start a background process and return its handle immediately.

  • spec — a resolved spec from resolve, never a raw request.

Returns the live process handle (reads, kill, quiescence promise).

Source