feat(think): add experimental Computer workspace - #2002
Draft
cjol wants to merge 3 commits into
Draft
Conversation
🦋 Changeset detectedLatest commit: 07ab121 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
agents
@cloudflare/ai-chat
@cloudflare/codemode
create-think
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Computer now applies its Think filesystem compatibility methods to local and remote clients when the owner enables useThink. Keeping the same translations in Think creates two implementations that can drift and hides the native Computer client behind an adapter object. Make ComputerWorkspace an intersection of WorkspaceClient and WorkspaceLike, and reduce adaptComputer() to a runtime assertion that narrows the owner's runtime configuration. The client remains unchanged, so its filesystem, shell, git, artifact, and asset surfaces stay directly available. Require @cloudflare/computer 0.1.0-alpha.2 as the optional peer. Use the Computer pull request preview as the development dependency until that alpha is published, so fresh installs test the new client contract without a local package link.
Contributor
Author
|
@aron-cf now that Computer #26 and workspace #24 have merged, could you publish "@cloudflare/computer 0.1.0-alpha.2" from main? Once that's on npm I can swap the PR preview dep, regenerate lockfile, and undraft this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an opt-in
@cloudflare/think/experimental/computerentrypoint for using Cloudflare Computer as a Think workspace. Existing Think agents continue to use@cloudflare/shellandjust-bashunless they opt in. It consumes the shared client compatibility added by cloudflare/computer#26.Why
just-bashfallback.@cloudflare/shelltables and Computervfs_*tables.useThinkcompatibility surface. Keeping a second filesystem adapter in Think would duplicate path, stat, and missing-file translations and allow the two implementations to drift.Public API Surface
All additions are under the new experimental export.
createComputerWorkspaceuseThink: trueadaptComputergetWorkspace()client without wrapping itComputerWorkspaceWorkspaceLikeLocalComputerWorkspaceWorkspaceLikeComputerWorkspaceclassgetWorkspacewithWorkspaceWorkspaceServiceProxyWorkerBackendComputerOptionscreateComputerWorkspaceWorkspaceClientWorkerBackendOptionsWorkerShellFetcherArchitectural Changes
Code Changes
adaptComputer()a runtime assertion because the owner-sideuseThinkoption cannot be inferred across RPC. It returns the original client rather than a compatibility wrapper.createWorkspaceTools()to use a workspace native shell when available while retaining the existingjust-bashfallback.WorkspaceServiceProxyobtain the stub for a Computer owned by the Think Durable Object.Compatibility
just-bashexecution remain unchanged.@cloudflare/computer@>=0.1.0-alpha.2 <0.2.0.0.1.0-alpha.2is published; it should be replaced with the released alpha before this PR merges.