Skip to content

computer: Group the tool sets' exec options under exec - #300

Open
ben-reitz wants to merge 1 commit into
browser/exec-tool-metadatafrom
browser/exec-options
Open

ben-reitz wants to merge 1 commit into
browser/exec-tool-metadatafrom
browser/exec-options

Conversation

@ben-reitz

@ben-reitz ben-reitz commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

The tool sets spread the exec tool's options across three top-level keys: exec for the backend map, execOutput for output limits, and execMetadata for run metadata, which #292 added. Review on #292 suggested grouping them under exec.

exec now takes { backends, output, metadata }, typed as ExecToolSetOptions and exported from @cloudflare/computer/tools. execOutput and execMetadata are gone.

createAITools({
  workspace,
  exec: {
    backends: { "worker-javascript": {}, container: { description: "Use for builds." } }, // omit for every backend
    output: { maxLines: 500 },
    metadata: ({ toolCallId }) => ({ conversation: this.name, toolCall: toolCallId }),
  },
});

This is a breaking change. To upgrade:

exec: { "worker-javascript": {} } →  exec: { backends: { "worker-javascript": {} } }
execOutput: { maxLines: 500 }     →  exec: { output: { maxLines: 500 } }
exec: {}  // no exec tool         →  exec: { backends: {} }

Read as the new form, an old backend map or exec: {} would quietly offer every backend, so both throw a TypeError that says what to pass instead. The deprecated shell option still works, and any exec still wins over it.

The tests cover the new form, exec without backends offering every backend, exec: { backends: {} } turning the tool off, and the two old shapes throwing. docs/09_tool_interface.md, docs/17_isolate_javascript.md, the package README, and the celld and mcp examples use the new form.


Devin Review

@ben-reitz ben-reitz added the allow-pr Allow a PR to remain open. label Nov 3, 2026
@changeset-bot

changeset-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7d81927

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@cloudflare/computer Minor
@cloudflare/dofs Minor
@cloudflare/computer-rpc Minor
@cloudflare/computerd Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ben-reitz
ben-reitz added this pull request to stack #294 November 3, 2026 15:42

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@cloudflare/computer@300

commit: 7d81927

@ben-reitz
ben-reitz force-pushed the browser/exec-options branch from bd64b22 to 94bb5a3 Compare November 3, 2026 16:07
@ben-reitz
ben-reitz removed this pull request from stack #294 November 4, 2026 10:44
@ben-reitz
ben-reitz changed the base branch from browser/browser-module to browser/exec-tool-metadata November 4, 2026 10:44
@ben-reitz
ben-reitz added this pull request to stack #304 November 4, 2026 10:50
The tool sets spread the exec tool's options across three top-level
keys: `exec` for the backend map, `execOutput` for output limits, and
`execMetadata` for run metadata. `exec` now takes them all as
`ExecToolSetOptions`, `{ backends, output, metadata }`, exported from
`@cloudflare/computer/tools`, and `execOutput` and `execMetadata` are
gone.

This breaks callers of the old form. A backend map moves under
`backends`, and `execOutput` becomes `exec.output`. A caller that
passed `exec: {}` to turn the tool off passes `exec: { backends: {} }`
instead. Read as the new form, both old shapes would quietly offer
every backend, so resolving the options throws a `TypeError` for an
`exec` with a key other than `backends`, `output`, and `metadata`,
and for `exec: {}`. The deprecated `shell` option still works, and
any `exec` still wins over it.

The docs, the package README, and the celld and mcp examples use the
new form.
@ben-reitz
ben-reitz force-pushed the browser/exec-options branch from b960f05 to 7d81927 Compare November 4, 2026 10:55
@ben-reitz
ben-reitz removed this pull request from stack #304 November 4, 2026 13:38
@ben-reitz
ben-reitz added this pull request to stack #306 November 4, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

allow-pr Allow a PR to remain open.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant