Skip to content

computer: Allow source modules under simple ws:* names - #281

Merged
aron-cf merged 3 commits into
mainfrom
ws-source-modules
Oct 27, 2026
Merged

aron-cf merged 3 commits into
mainfrom
ws-source-modules

Conversation

@aron-cf

@aron-cf aron-cf commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

A host can now ship a source module in its own namespace, alongside its host modules. Host modules export plain functions only, so a host that wants to offer objects (an MCP server whose tools are methods, say) needs a source facade that imports them; until now that facade had to live outside ws:*, which reads as a library the user bundled rather than one the host provides.

Source modules under ws:* follow the host modules' naming rule and are described to the model as libraries the host provides.


Devin Review

A host can now ship a source module in its own namespace, alongside
its host modules. Host modules export plain functions only, so a host
that wants to offer objects (an MCP server whose tools are methods,
say) needs a source facade that imports them; until now that facade
had to live outside ws:*, which reads as a library the user bundled
rather than one the host provides.

Source modules under ws:* follow the host modules' naming rule and are
described to the model as libraries the host provides.
@changeset-bot

changeset-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f58fad7

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 Patch
@cloudflare/dofs Patch
@cloudflare/computer-rpc Patch
@cloudflare/computerd Patch

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

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: cd6593d

A source module's ws:* imports were checked against host modules
alone, so a ws:* source importing another failed before loading,
with "imports \"ws:b\", which is not configured". They are now checked
against both, and rewritten to the module directory the same way.

The isolated JavaScript guide, the modules option and WorkspaceModule
still said ws:* was for host modules only; they now describe source
under ws:* as a library the host provides, with an example. Adds the
changeset.
@aron-cf
aron-cf merged commit b681446 into main Oct 27, 2026
18 of 19 checks passed
@aron-cf
aron-cf deleted the ws-source-modules branch October 27, 2026 21:08

@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 found 1 new potential issue.

Devin Review

"@cloudflare/computer": patch
---

`WorkerJavaScriptBackend` custom modules now support exporting objects as well as functions.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Release note obscures source module naming

Source modules could already export objects. The new support is for simple ws:* names; host modules still accept only functions. The changelog entry can mislead users into passing objects as host module exports.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@github-actions github-actions Bot mentioned this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant