Skip to content

feat(agent): add shell emulation to exec API#77

Merged
anistark merged 1 commit into
mainfrom
feat/agent-shell-emulation
May 27, 2026
Merged

feat(agent): add shell emulation to exec API#77
anistark merged 1 commit into
mainfrom
feat/agent-shell-emulation

Conversation

@anistark
Copy link
Copy Markdown
Owner

The exec endpoint now accepts a command field with a shell-style command line that runs against the session filesystem via in-process built-ins. There is no subprocess execution and no access to the host shell.

curl -X POST .../exec -H "Content-Type: application/json" -d '{
  "command": "mkdir -p logs && echo started > logs/run.log && ls logs"
}'

Supports built-ins echo, cat, ls, pwd, cd, mkdir (-p), rm (-r/-rf), cp, mv, env, export; pipes (|); redirection (>, >>, <); sequencing (&& short-circuit, ;); and single/double quoted strings.

CWD is scoped to a single shell invocation so chains like cd sub && pwd work, while export KEY=value writes through to the session's WasiEnv so exported variables persist across command/source/files/wasm_path calls in the same session.

The command field takes precedence when present; dispatch order in handle_exec is now command -> files -> source -> wasm_path.

This also backfills CHANGELOG and docs for the two previously undocumented additions since v0.19.0 - JavaScript source execution (source + language) and multi-file JS project execution (files + entry) - and cuts the existing [Unreleased] block into a dated [0.19.0] section matching the published GitHub release.

The exec endpoint now accepts a `command` field with a shell-style
command line that runs against the session filesystem via in-process
built-ins. There is no subprocess execution and no access to the host
shell.

    curl -X POST .../exec -H "Content-Type: application/json" -d '{
      "command": "mkdir -p logs && echo started > logs/run.log && ls logs"
    }'

Supports built-ins `echo`, `cat`, `ls`, `pwd`, `cd`, `mkdir` (`-p`),
`rm` (`-r`/`-rf`), `cp`, `mv`, `env`, `export`; pipes (`|`);
redirection (`>`, `>>`, `<`); sequencing (`&&` short-circuit, `;`);
and single/double quoted strings.

CWD is scoped to a single shell invocation so chains like
`cd sub && pwd` work, while `export KEY=value` writes through to the
session's `WasiEnv` so exported variables persist across
`command`/`source`/`files`/`wasm_path` calls in the same session.

The `command` field takes precedence when present; dispatch order in
`handle_exec` is now `command` -> `files` -> `source` -> `wasm_path`.

This also backfills CHANGELOG and docs for the two previously
undocumented additions since v0.19.0 - JavaScript source execution
(`source` + `language`) and multi-file JS project execution (`files` +
`entry`) - and cuts the existing `[Unreleased]` block into a dated
`[0.19.0]` section matching the published GitHub release.
@anistark anistark merged commit 52d6bf5 into main May 27, 2026
2 of 3 checks passed
@anistark anistark deleted the feat/agent-shell-emulation branch May 27, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant