crouter
SDK

Bash

Execute bounded shell commands through the daemon.

client.bash.run executes one bounded bash -c command through the daemon.

const result = await client.bash.run({
  command: 'printf "%s\\n" "$MESSAGE"',
  cwd: '/absolute/path/to/project',
  env: { MESSAGE: 'hello' },
  timeout_s: 30,
  profile: 'my-app',
});

if (result.exit_code !== 0) console.error(result.stderr);

run(params, options?) returns Promise<BashRunDTO>. Its final options object is the normal request-options object: headers, signal, timeout, and maxRetries.

Result fieldTypeMeaning
exit_codenumber | nullProcess exit code, or null after a timeout. A non-zero code is returned, not thrown.
signalstring | nullSignal that ended the process, when one did.
stdout / stderrstringCaptured output prefix.
stdout_truncated / stderr_truncatedbooleanWhether that output stream exceeded its 256 KiB capture limit.
timed_outbooleantrue after the daemon terminates the process group for a timeout.
duration_msnumberCommand duration in milliseconds.

cwd is required, absolute, and must name an existing directory. The daemon never uses its own working directory as a fallback. timeout_s defaults to 60, must be greater than 0, and cannot exceed 600. The SDK keeps the HTTP request open for the command timeout plus 15 seconds, unless its configured request timeout is already longer.

Pass dynamic values through env and reference them from the command as "$NAME", rather than interpolating them into shell source. The command receives the daemon's default-deny operational environment, selected profile environment, then your env values.

Authority

The token is the owner credential. Anyone holding it can already create an agent with a bash tool, so this command runs with the daemon user's authority and does not provide a restricted command area.

On this page