Skip to content

feat(agent): add multi-file JavaScript project execution to exec API#75

Merged
anistark merged 1 commit into
mainfrom
feat/multi-file-js-execution
May 26, 2026
Merged

feat(agent): add multi-file JavaScript project execution to exec API#75
anistark merged 1 commit into
mainfrom
feat/multi-file-js-execution

Conversation

@anistark
Copy link
Copy Markdown
Owner

Agents can now upload an entire JS project in a single /exec request and run it through the wasmhub nodejs runtime:

POST /api/v1/sessions/:id/exec
{
  "files": {
    "main.js": "console.log('hi');",
    "lib/util.js": "exports.greet = n => 'hi ' + n;"
  },
  "entry": "main.js",
  "language": "javascript"
}

All files are written to the session work_dir (with intermediate directories created as needed) before execution; the runtime is invoked with the entry filename as its script argument. Sibling files land in the session's preopened WASI directory, so once the nodejs runtime gains CommonJS support, relative require() between project files will resolve transparently.

Filenames are validated up front: empty names, absolute paths, and parent-directory traversal are rejected with HTTP 400. Language and entry-membership checks also run synchronously before the exec thread is spawned, so invalid requests fail fast without paying the runtime fetch cost.

The execute_code tool schema gains files and entry fields so LLM agents discover the new shape via /api/v1/tools.

Agents can now upload an entire JS project in a single /exec request
and run it through the wasmhub nodejs runtime:

    POST /api/v1/sessions/:id/exec
    {
      "files": {
        "main.js": "console.log('hi');",
        "lib/util.js": "exports.greet = n => 'hi ' + n;"
      },
      "entry": "main.js",
      "language": "javascript"
    }

All files are written to the session work_dir (with intermediate
directories created as needed) before execution; the runtime is
invoked with the entry filename as its script argument. Sibling
files land in the session's preopened WASI directory, so once the
nodejs runtime gains CommonJS support, relative `require()` between
project files will resolve transparently.

Filenames are validated up front: empty names, absolute paths, and
parent-directory traversal are rejected with HTTP 400. Language and
entry-membership checks also run synchronously before the exec
thread is spawned, so invalid requests fail fast without paying the
runtime fetch cost.

The `execute_code` tool schema gains `files` and `entry` fields so
LLM agents discover the new shape via /api/v1/tools.
@anistark anistark merged commit 239e85c into main May 26, 2026
2 of 3 checks passed
@anistark anistark deleted the feat/multi-file-js-execution branch May 26, 2026 04:42
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