Refactor runtime callbacks: pass UpdatedFile via onOutput instead of calling writeFile internally#174
Merged
na-trium-144 merged 2 commits intomainfrom Feb 28, 2026
Conversation
Co-authored-by: na-trium-144 <100704180+na-trium-144@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
my-code | ee5ab63 | Commit Preview URL Branch Preview URL |
Feb 28 2026, 09:26 AM |
Copilot
AI
changed the title
[WIP] Update runCommand and runFiles types in RuntimeContext
Refactor runtime callbacks: pass UpdatedFile via onOutput instead of calling writeFile internally
Feb 28, 2026
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.
Runtime implementations were directly calling
EmbedContext.writeFile()to persist file changes, tightly coupling runtimes to the embed context and making it impossible to observe file updates from call sites.Changes
New
UpdatedFiletype (runtime.tsx)RuntimeContextsignature updatesrunCommand:onOutput: (output: ReplOutput | UpdatedFile) => voidrunFiles:onOutput: (output: ReplOutput | UpdatedFile) => voidWorker API (
worker/runtime.tsx,*.worker.ts)WorkerAPI.runCode/runFilereturnPromise<void>instead ofPromise<{ updatedFiles: Record<string, string> }>pyodide,ruby,jsEval) now callonOutput({ type: "file", filename, content })per updated file rather than returning a batch recordWorkerProviderremoveswriteFiledependency entirelyTypeScript runtime (
typescript/runtime.tsx)useEmbedContext/writeFiledependencyonOutputand merged locally before forwarding tojsEval.runFilesCall sites (
exec.tsx,repl.tsx)output.type === "file"in the callback and callwriteFile()themselves, keeping file persistence in the UI layer where it belongsTests (
tests.ts)defineTestsdrops thefilesRefparameterUpdatedFileitems collected from the callback, removing thesetTimeoutpolling hackWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
workers.cloudflare.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node node node_modules/.bin/next lint(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.