Skip to content

feat(workspace): configure pull ignore paths - #15

Closed
mattzcarey wants to merge 2 commits into
mainfrom
feat/workspace-sync-ignore
Closed

feat(workspace): configure pull ignore paths#15
mattzcarey wants to merge 2 commits into
mainfrom
feat/workspace-sync-ignore

Conversation

@mattzcarey

Copy link
Copy Markdown
Contributor

The sync server already accepts an ignore list, but Workspace could not supply one. Commands such as npm install could therefore pull generated trees like dist and .cache into durable storage even though those files only need to exist on the execution backend.

This adds WorkspaceOptions.ignore and passes it through pullOnce() on every backend pull. Patterns match whole path segments. Omitting the option preserves the server default of ["node_modules"]; a supplied list replaces that default, and [] disables filtering. Push behavior does not change.

const workspace = new Workspace({
  storage: ctx.storage,
  backends: [containerBackend],
  ignore: ["node_modules", "dist", "build", ".cache"],
});

The capnweb wire test verifies that a custom list crosses the real transport and filters the pull. Workspace tests cover replacement of the default and the empty-list case. npm test passes, along with typechecks for the RPC, Workspace, and Think example packages. The package README, sync documentation, and Think example describe the behavior.

After a release includes this option, cloudflare/agents can use one Workspace for durable files and command execution without pulling generated dependency and build trees into its Durable Object.

@pkg-pr-new

pkg-pr-new Bot commented Jul 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/workspace/@cloudflare/workspace@15

commit: 8a7bd31

// Omit to use the remote default (`node_modules`). A supplied list
// replaces that default; pass [] to pull every path. Pushes are
// unaffected.
ignore?: string[];

@aron-cf aron-cf Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think probably for clarity it should be:

Suggested change
ignore?: string[];
sync?: { ignore?: string[] };

@mattzcarey

Copy link
Copy Markdown
Contributor Author

Closing because agent-think will use full Workspace synchronization, including node_modules, rather than configuring generated-path exclusions. We will revisit the smaller default-sync behavior separately if needed.

@mattzcarey mattzcarey closed this Jul 8, 2026
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