Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/smaller-tools-and-git.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/computer": patch
---

The Git entrypoint hashes with `node:crypto` instead of bundling `sha.js` and its Buffer polyfills, which trims about 120 KB from a Worker that uses it, and the worker-shell modules are minified, shrinking them by 28%. `@cloudflare/computer/tools` and its `ai-sdk`, `pi-ai` and `tanstack-ai` variants also no longer reference the bundled isomorphic-git, which unbundled loaders such as Node and Vite's dev server used to fetch for them.
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ packages first. Several suites need build output that is absent in
a clean checkout: `packages/computerd` imports the sibling `@cloudflare/dofs`
and `@cloudflare/computer-rpc` packages from their `dist/`
directories, `packages/computerd`'s `src/cli/computerd.test.ts` spawns the bundled
CLI at `dist/cli/computerd.cjs`, and `examples/think-compare-runtimes`
CLI at `dist/cli/computerd.js`, and `examples/think-compare-runtimes`
imports `@cloudflare/computer/backends/container-legacy`, which exists only
after the `computer` package is built. Run `npm run build` across the
npm workspace before `npm test` on a clean checkout.
Expand Down
10 changes: 5 additions & 5 deletions docs/10_project_layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ packages/computer/
│ └── test-harness/ # Integration test wiring
├── tests/ # Workerd integration suites
├── test-harness/ # Container and load harness
├── rolldown.config.ts # ESM and declaration build
├── tsdown.config.ts # ESM and declaration build
├── tsconfig.json
├── tsconfig.build.json
└── package.json
```

The package builds ESM and declarations with Rolldown. Public entrypoints include the root export, tools, Git, assets, artifacts, the Container, Worker shell, and Worker JavaScript backends, and Cloudflare observability. The injected service is the separate `computerd` package, and shared wire types live in `@cloudflare/computer-rpc`.
The package builds ESM and declarations with tsdown. Public entrypoints include the root export, tools, Git, assets, artifacts, the Container, Worker shell, and Worker JavaScript backends, and Cloudflare observability. The injected service is the separate `computerd` package, and shared wire types live in `@cloudflare/computer-rpc`.

## `packages/dofs/` — `@cloudflare/dofs`

Expand Down Expand Up @@ -158,19 +158,19 @@ packages/computerd/
│ ├── log.ts
│ └── index.ts
├── scripts/
│ ├── build.mjs # → dist/cli/computerd.cjs
│ ├── build-bin.mjs # SEA driver
│ └── sea/
│ └── bundle.mjs # esbuild → SEA bundle
├── artifacts/
│ └── computerd/
│ ├── computerd-linux-x64
│ └── computerd-macos-x64
├── tsdown.config.ts # → dist/cli/computerd.js
├── tsconfig.json
└── package.json
```

Build pipeline: `scripts/build.mjs` emits `dist/cli/computerd.cjs`;
Build pipeline: tsdown bundles `src/cli/computerd.ts` into `dist/cli/computerd.js`;
`scripts/build-bin.mjs` together with `scripts/sea/bundle.mjs`
produces the Node SEA single-file binary at
`artifacts/computerd/computerd-{linux,macos}-x64`.
Expand Down Expand Up @@ -245,7 +245,7 @@ so each example can declare its own dependencies and scripts.
- **oxfmt.** Formats JS, TypeScript and JSON, configured in
`.oxfmtrc.json` at the repo root. Markdown, YAML, HTML and CSS are
left alone. No ESLint, no Prettier.
- **Rolldown.** Builds the Workspace package's ESM entrypoints and declarations.
- **tsdown.** Builds every package: the Workspace package's ESM entrypoints and declarations, `@cloudflare/dofs` and `@cloudflare/computer-rpc`, and the `computerd` CLI. Sources use extensionless relative imports under `moduleResolution: "bundler"`.
- **esbuild.** Used by `packages/computerd/scripts/sea/bundle.mjs` to produce the single-file `computerd` SEA bundle.
- **vitest.** Drives unit tests in every package. `computerd` additionally
uses `node --experimental-strip-types --test` for some scripts
Expand Down
2 changes: 1 addition & 1 deletion examples/egress/src/egress.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";

import { mimeType, parseShellFetchResult, targetUrl, workspaceEgressPolicy } from "./egress.js";
import { mimeType, parseShellFetchResult, targetUrl, workspaceEgressPolicy } from "./egress";

describe("workspaceEgressPolicy", () => {
it("blocks egress in none mode", () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/egress/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
parseShellFetchResult,
targetUrl,
workspaceEgressPolicy,
} from "./egress.js";
} from "./egress";

export { WorkspaceProxy, WorkspaceServiceProxy };

Expand Down
2 changes: 1 addition & 1 deletion examples/mcp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { WorkerShellBackend } from "@cloudflare/computer/backends/worker-shell";
import { createGitClient } from "@cloudflare/computer/git";
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";

import { createComputerMCPServer } from "./server.js";
import { createComputerMCPServer } from "./server";

interface Env {
LOADER: WorkerLoader;
Expand Down
4 changes: 2 additions & 2 deletions examples/mcp/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"target": "ES2022",
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"lib": ["ES2022", "ESNext.Disposable"],
"lib": ["ESNext"],
"types": [
"./worker-configuration.d.ts",
"@cloudflare/vitest-pool-workers/types",
Expand Down
2 changes: 1 addition & 1 deletion examples/pi-ai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { WorkerShellBackend } from "@cloudflare/computer/backends/worker-shell";
import { createPiTools } from "@cloudflare/computer/tools/pi-ai";
import { createModels, type Message } from "@earendil-works/pi-ai";

import { WORKERS_AI_PROVIDER, workersAI } from "./workers-ai.js";
import { WORKERS_AI_PROVIDER, workersAI } from "./workers-ai";

// The worker-shell backend reaches back into this durable object by
// binding name and id, so the shell shares the agent's filesystem.
Expand Down
4 changes: 2 additions & 2 deletions examples/rlm/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022",
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"allowImportingTsExtensions": true,
"module": "ESNext",
"types": ["vite/client"],
Expand Down
4 changes: 2 additions & 2 deletions examples/rlm/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"target": "ESNext",
"lib": ["ESNext"],
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["node"],
Expand Down
4 changes: 2 additions & 2 deletions examples/rlm/tsconfig.worker.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
"target": "ES2022",
"lib": ["ES2022"],
"target": "ESNext",
"lib": ["ESNext"],
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["./worker-configuration.d.ts"],
Expand Down
4 changes: 2 additions & 2 deletions examples/think-compare-runtimes/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022",
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"allowImportingTsExtensions": true,
"module": "ESNext",
"types": ["vite/client"],
Expand Down
4 changes: 2 additions & 2 deletions examples/think-compare-runtimes/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"target": "ESNext",
"lib": ["ESNext"],
"module": "ESNext",
"types": ["node"],
"skipLibCheck": true,
Expand Down
4 changes: 2 additions & 2 deletions examples/think-compare-runtimes/tsconfig.worker.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
"target": "ES2022",
"lib": ["ES2022"],
"target": "ESNext",
"lib": ["ESNext"],
"allowImportingTsExtensions": true,
"module": "ESNext",
"types": ["./worker-configuration.d.ts"],
Expand Down
2 changes: 1 addition & 1 deletion examples/think/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { routeAgentRequest } from "agents";
import { Assistant, WorkspaceProxy, WorkspaceServiceProxy } from "./agent.js";
import { Assistant, WorkspaceProxy, WorkspaceServiceProxy } from "./agent";

export { Assistant, WorkspaceProxy, WorkspaceServiceProxy };

Expand Down
Loading
Loading