Add Think runtime comparison example - #3
Merged
Conversation
Direct package builds depend on generated output from upstream workspace packages. Build dofs before workspace-rpc, and build workspace-rpc before workspace, so fresh checkouts can run package builds without relying on stale dist directories.
Add a Think-vs-Think example that compares Workspace and Sandbox against the same docs task. The Workspace side uses durable file operations, a worker-shell backend for lightweight commands, and a container backend for real Linux tooling. The Sandbox side uses the Sandbox SDK session for files and exec. The example streams run events over PartyServer and renders a compact runtime dashboard so the difference between direct file work, shell commands, and container work is visible during a run.
Centralize run event interpretation so telemetry, routing, and evidence use the same parsed model. This keeps JSON detail parsing and runtime matching out of the React components and removes the older lane split. Split the comparison shell into focused render modules and record explicit execution targets for Workspace and Sandbox commands. The UI can show routing behavior without leaking optional backend fields through generic command results.
Rework the comparison example around a compact substrate timeline and an agent activity stream that groups reasoning, file work, and command output by intent. The run control can now discard an active run and ask the backing Think agents to cancel their in-flight chats. Record container assignment lifecycle events so the timeline can show when a run holds a container separately from command execution. Route Workspace container fetches through the owning Durable Object so local and deployed runs use the same container boundary.
Tell the comparison agents that the fixture files already exist before a run starts. The prompt now treats tool results as the source of truth and asks agents to report visibility mismatches instead of creating replacement project scaffolding.
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.
Adds
examples/think-compare-runtimes, a side-by-side demo that runs the same Think agent against@cloudflare/workspaceand@cloudflare/sandboxfrom a single seeded fixture. The goal is to make the runtime difference visible: Workspace gives the agent durable files immediately and only escalates to a container when a command needs a real runtime; Sandbox runs every file and exec call inside a container session. The app is a Worker plus a React client, with aCompareRundurable object coordinating both agents and streaming events to the browser over PartyServer.Two cross-package changes ride along because the example needs them. The build script for
@cloudflare/workspace-rpcnow builds@cloudflare/dofsfirst, and@cloudflare/workspacebuilds@cloudflare/workspace-rpcfirst, so a clean checkout can build the example without pre-existingdistdirectories. The container backend grows afetchPorthelper onIWorkspaceContainerAPIso cross-durable-object container fetches go through the durable object that ownsctx.containerinstead of relying on a Fetcher stub that does not survive the durable object boundary.To verify locally, install dependencies, then run
npm run dev --workspace @cloudflare/example-think-compare-runtimesand open the dev URL printed by Vite. ClickSTART RUNand watch both runtimes execute the same docs task. The example has its own test suite —npm test --workspace @cloudflare/example-think-compare-runtimescovers the worker, agent harness, fixture, dashboard model, and UI panels.