From 2b3a761620b7b5f1ceebb46bbfd8255a20dea35a Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Fri, 30 Oct 2026 11:26:27 -0700 Subject: [PATCH] Note close() handling and update D2's description of the old behavior --- docs/VISION.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/VISION.md b/docs/VISION.md index ea452af..a67012d 100644 --- a/docs/VISION.md +++ b/docs/VISION.md @@ -48,7 +48,7 @@ Each tier depends only on the one below it. Internal tools can stop at tier 1 or ### D2. ESM and web globals are the default; Node is opt-in -Today every process is a Node process. `installGlobals` (`packages/kernel/src/runtime/globals.ts`) installs `process`, `Buffer` and `global` in every worker, and `spawn` only runs `node` or files with a node shebang. +Before this change every process was a Node process: `installGlobals` (`packages/kernel/src/runtime/globals.ts`) installed `process`, `Buffer` and `global` in every worker, and `spawn` only runs `node` or files with a node shebang. Change: add a `runtime` field to the spawn spec. (Not "personality": agents will have personalities.) A `web` process gets web globals and `nib:*`. A `node` process also gets Node globals. `node:` builtins stay importable from either runtime and load only when imported. The ESM path already uses the browser's own module loader over the Service Worker's virtual origin, so this is a change of defaults, not a rewrite. @@ -246,7 +246,7 @@ Consequences: 1. Accept or amend these decisions. 2. Probe gitoxide on WASI, since jj in the browser depends on it. (The CSP, knot CORS, and jj-lib probes ran on 2026-10-30; see D3 and the open questions.) 3. Done 2026-10-30 (see D3): the sandbox-origin probe passed in all three engines. Real Safari 27.0 also passed on its default feature flags. Follow-ups are Service Worker restarts. The `server.ts` header options are done. -4. Done 2026-10-30: `exec(entry, { runtime: "web" | "node" })`, default `node` (commits 73c2a4b, de60485). Follow-up done the same day: the kernel read the runtime worker's own channel as well as its private port, so guest `postMessage` could forge runtime messages; it now reads only the port. Still open: a guest `self.close()` ends the worker without the kernel noticing. Node globals for npm packages inside a `web` process, and flipping the default, come later. +4. Done 2026-10-30: `exec(entry, { runtime: "web" | "node" })`, default `node` (commits 73c2a4b, de60485). Follow-up done the same day: the kernel read the runtime worker's own channel as well as its private port, so guest `postMessage` could forge runtime messages; it now reads only the port. A guest `close()` in a `web` process now exits it with code 0 after the current task, as `close()` ends a worker. Node globals for npm packages inside a `web` process, and flipping the default, come later. 5. Add the `nib:` scheme with a scoped `nib:fs` and `nib:context`, and generate their types. 6. Design the store and namespace format (D5), then build OPFS on it. 7. Build Drive on that format. -- knotmirror 0.0.1