Skip to content

computer: Rename the host module prefix from ws: to codemode: - #283

Open
aron-cf wants to merge 2 commits into
mainfrom
codemode-module-prefix
Open

aron-cf wants to merge 2 commits into
mainfrom
codemode-module-prefix

Conversation

@aron-cf

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

Copy link
Copy Markdown
Collaborator

Host modules for WorkerJavaScriptBackend used a ws: prefix. It reads like a WebSocket URL, and it doesn't tell the person writing isolate code where these modules come from. This change renames the prefix to codemode:. Source modules that a host provides under the same names move to codemode:* too.

new WorkerJavaScriptBackend({
  loader: env.LOADER,
  modules: {
    "codemode:git": createGitModule(),
    "codemode:weather": { forecast: ([city]) => lookUpForecast(String(city)) },
  },
});
import { status } from "codemode:git";
import { forecast } from "codemode:weather";

This breaks existing setups, and there's no alias. A host module configured under ws: now throws when the backend is constructed, so a missed rename fails at startup, not partway through a run. The changeset tells users to rename both their modules keys and their imports. Existing changelog entries still say ws:, because they describe past releases.

The built-in modules, the AI SDK and pi tool bindings, and the examples/rlm example (codemode:model) use the new prefix. The docs moved over too, including the docs/17_isolate_javascript.md anchors such as #codemodetools.

Existing tests now use the new prefix, including the construction test that rejects host modules outside codemode:*. One script-runner test caps stderr at 64 bytes, and the longer prefix cut its link error short of does not provide an export. It now checks for does not provide. To verify locally:

npm run build
npm test --workspace @cloudflare/computer
npm test --workspace @cloudflare/example-rlm

@changeset-bot

changeset-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3aa626e

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

@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

Host modules for `WorkerJavaScriptBackend`, and the source modules a
host provides beside them, now use `codemode:*` specifiers, so
isolate code writes `import { status } from "codemode:git"` instead
of `"ws:git"`. The built-in modules, the AI SDK and pi tool bindings,
the docs, and the rlm example move to the new prefix. A host module
configured under `ws:` now throws when the backend is constructed.

One script-runner test matched a longer slice of a link error than
the 64-byte stderr limit keeps once the specifier grows, so it now
matches the start of the message.
@aron-cf
aron-cf force-pushed the codemode-module-prefix branch from 2635480 to 76fc6a7 Compare October 27, 2026 21:11
@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@283

commit: 3aa626e

@scuffi scuffi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good 🚀

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.

2 participants