@daugasauron/dolly 0.0.0-stage → 0.1.4-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +89 -2
  3. package/dist/dolly-build-id.mjs +1 -0
  4. package/dist/dolly-dso-0.wasm +0 -0
  5. package/dist/dolly-image-build-id.mjs +1 -0
  6. package/dist/dolly-kernel-plugin-abi.mjs +2 -0
  7. package/dist/dolly-process-0.wasm +0 -0
  8. package/dist/dolly-process-abi.mjs +1 -0
  9. package/dist/dolly-process-dso.mjs +1575 -0
  10. package/dist/dolly-process-gate-0.wasm +0 -0
  11. package/dist/dolly-process-stack.mjs +50 -0
  12. package/dist/dolly-process-worker.mjs +275 -0
  13. package/dist/dolly-threads-0.wasm +0 -0
  14. package/dist/dolly.wasm +0 -0
  15. package/host/abi.mjs +5 -0
  16. package/host/dso/abi.mjs +13 -0
  17. package/host/dso/dso.mjs +26 -0
  18. package/host/dso/module.json +15 -0
  19. package/host/http/abi.mjs +28 -0
  20. package/host/http/broker.mjs +325 -0
  21. package/host/http/http.mjs +74 -0
  22. package/host/http/local-services.mjs +37 -0
  23. package/host/http/module.json +15 -0
  24. package/host/http/policy.mjs +293 -0
  25. package/host/modules.mjs +373 -0
  26. package/host/nena/abi.mjs +19 -0
  27. package/host/nena/module.json +15 -0
  28. package/host/nena/nena.mjs +131 -0
  29. package/host/packages/module.json +13 -0
  30. package/host/packages/packages.mjs +15 -0
  31. package/host/packages/service.mjs +59 -0
  32. package/host/requirements.mjs +62 -0
  33. package/host/runtime/abi.mjs +8 -0
  34. package/host/runtime/boot-files.mjs +45 -0
  35. package/host/runtime/grower.mjs +14 -0
  36. package/host/runtime/lease-bridge.mjs +65 -0
  37. package/host/runtime/module.json +16 -0
  38. package/host/runtime/runtime.mjs +209 -0
  39. package/host/snapshot/abi.mjs +16 -0
  40. package/host/snapshot/module.json +15 -0
  41. package/host/snapshot/snapshot.mjs +138 -0
  42. package/host/snapshot/transport.mjs +132 -0
  43. package/host/snapshot/ui.mjs +207 -0
  44. package/host/stack/abi.mjs +5 -0
  45. package/host/stack/module.json +17 -0
  46. package/host/stack/stack.mjs +19 -0
  47. package/host/threads/abi.mjs +8 -0
  48. package/host/threads/module.json +13 -0
  49. package/host/threads/threads.mjs +36 -0
  50. package/package.json +12 -4
  51. package/src/alphabetical.mjs +4 -0
  52. package/src/browser.mjs +237 -0
  53. package/src/build-log.mjs +30 -0
  54. package/src/image-entry.mjs +29 -0
  55. package/src/image-inputs.mjs +20 -0
  56. package/src/image-names.mjs +11 -0
  57. package/src/images.mjs +10 -0
  58. package/src/kernel-plugin.mjs +77 -0
  59. package/src/packaged-snapshot.mjs +175 -0
  60. package/src/page-chords.mjs +43 -0
  61. package/src/page-indicators.mjs +27 -0
  62. package/src/process-abi.mjs +69 -0
  63. package/src/process-constants.mjs +242 -0
  64. package/src/process-supervisor.mjs +1002 -0
  65. package/src/runtime-worker.mjs +55 -0
  66. package/src/session-store.mjs +198 -0
  67. package/src/snapshot-records.mjs +109 -0
  68. package/src/static-asset.mjs +97 -0
  69. package/src/terminal-text.mjs +72 -0
  70. package/src/version.mjs +3 -0
  71. package/src/wasm-interface.mjs +440 -0
  72. package/src/worker-image.mjs +137 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dolly contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,90 @@
1
- # Temporary Holding Version
1
+ # Embedding Dolly
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Dolly is a POSIX-like userspace for wasm64 that runs in a browser tab: a Wasm
4
+ kernel, programs in private Wasm memories, and host modules that bridge it to
5
+ the browser. These npm packages put it in a page of your own. Their first use is
6
+ an agent in place of a web frontend (`docs/agent-frontend.md` in the repository).
7
+
8
+ | Package | What it holds |
9
+ | --- | --- |
10
+ | `@daugasauron/dolly` | The runtime: `boot()`, the kernel, the process runtime, and the host modules that are its own machinery (`runtime`, `http`, `threads`, `dso`, `stack`, `nena`, `snapshot`, `packages`). Building images stays with Dolly's site |
11
+ | `@daugasauron/dolly-host-NAME` | One device host module each: `display` (Ghostty's terminal and programs' frames), `input`, `gpu`, `audio`, `microphone`, `touch`, `download`, `upload`, `sockets`, `pty` |
12
+ | `@daugasauron/dolly-image-default` | The `default` image alone: a shell, its text tools, the terminal, curl, `amy`, `nena`, `ps`. `amy` lists what is installed and has nothing more to install |
13
+
14
+ ```sh
15
+ npm install @daugasauron/dolly @daugasauron/dolly-image-default \
16
+ @daugasauron/dolly-host-display @daugasauron/dolly-host-input @daugasauron/dolly-host-audio \
17
+ @daugasauron/dolly-host-touch @daugasauron/dolly-host-download @daugasauron/dolly-host-upload \
18
+ @daugasauron/dolly-host-sockets
19
+ ```
20
+
21
+ Each host module and image depends on the runtime alone, at its own version. An
22
+ image does not depend on the host modules it declares: install them with it (its
23
+ README names them), so that all lie side by side under `node_modules/@daugasauron/`.
24
+ npm, pnpm and Yarn 1 install them so. Yarn 2 and later need `nodeLinker: node-modules`
25
+ in `.yarnrc.yml`: Plug'n'Play leaves no files to serve.
26
+
27
+ ## A page
28
+
29
+ ```html
30
+ <!doctype html>
31
+ <meta charset="utf-8">
32
+ <main id="dolly" style="position:fixed;inset:0"></main>
33
+ <script type="module">
34
+ import { boot } from "./node_modules/@daugasauron/dolly/src/browser.mjs";
35
+ import { images, image, modules } from "./node_modules/@daugasauron/dolly-image-default/index.mjs";
36
+ const dolly = await boot(document.querySelector("#dolly"), { images, image, modules });
37
+ </script>
38
+ ```
39
+
40
+ `boot(element, options)` runs an image in `element`, which the page sizes. It
41
+ resolves once the image's program starts, to the page's handle on the session
42
+ (`hostModules`, `visibleTerminalText()`, `waitForInteractiveTerminal(pattern)`,
43
+ then `submit(command)` at the shell's prompt, and what each module adds), and
44
+ shows its own failure in the element.
45
+
46
+ | Option | Meaning |
47
+ | --- | --- |
48
+ | `images` | URL of an image directory: `dist/dolly-images.mjs`, the images' metadata and packs, their recipes. `@daugasauron/dolly-image-default`'s `index.mjs` exports its own. A page has one image directory |
49
+ | `image` | The image to run, by name |
50
+ | `modules` | URLs of the `module.json` of each host module the page has. The registry loads these and no other; an image's `REQUIRES HOST` must be among them |
51
+ | `site` | Optional: the URL of a site that serves Dolly's own pages (`session/`, `sessions/`, `docs/`), as Dolly's site does. Given, a saved session names itself in the tab's URL and modules link to those pages |
52
+ | `http` | Optional `{ policy, relays }` for the HTTP broker, the page's one network edge (docs/http.md). Without a policy a program may fetch any HTTPS URL |
53
+
54
+ The page, not the image, chooses the modules and the policy, before anything of
55
+ the image runs. A program reaches nothing of the browser but through them.
56
+
57
+ ## More host modules
58
+
59
+ `default` declares `nena@0`, so a session can enable a module the page has and
60
+ the image does not declare. Install its package and add its `module.json`:
61
+
62
+ ```sh
63
+ npm install @daugasauron/dolly-host-gpu @daugasauron/dolly-host-microphone @daugasauron/dolly-host-pty
64
+ ```
65
+
66
+ ```js
67
+ const gpu = new URL("./node_modules/@daugasauron/dolly-host-gpu/module.json", location.href).href;
68
+ const dolly = await boot(element, { images, image, modules: [...modules, gpu] });
69
+ ```
70
+
71
+ `nena enable gpu` then gives a program the GPU, or, where the browser has no
72
+ WebGPU adapter, a device that fails to open with `ENODEV`.
73
+
74
+ ## Serving
75
+
76
+ - Serve the installed packages as they lie: the runtime finds its own files
77
+ beside itself, and `dolly-image-default`'s `index.mjs` finds the modules in the
78
+ packages installed beside it under `node_modules/@daugasauron/`.
79
+ - Send `Cross-Origin-Opener-Policy: same-origin` and
80
+ `Cross-Origin-Embedder-Policy: require-corp` with the page: Dolly needs shared
81
+ memory, which a browser gives only to a cross-origin isolated page.
82
+ - Serve `.wasm` as `application/wasm` and `.mjs` as `text/javascript`.
83
+ - No bundler is needed: these are ES modules, Workers and Wasm files.
84
+
85
+ ## Host modules
86
+
87
+ A host module is a directory with a `module.json`; its provider receives what it
88
+ needs from the runtime through the registry, and a device module imports
89
+ nothing outside its directory. `host/README.md` in the repository describes the
90
+ interface.
@@ -0,0 +1 @@
1
+ export const DOLLY_BUILD_ID = "sha256:3642f6397575530c5410de65927a733ad526c2d55d239715800baac568572ec1";
Binary file
@@ -0,0 +1 @@
1
+ export const DOLLY_IMAGE_BUILD_ID = "sha256:45d43ca59eeecb6128c23b546cd9c0d41be3cd7f67ce0c5ff78dfba4b94ef721";
@@ -0,0 +1,2 @@
1
+ export const DOLLY_KERNEL_PLUGIN_ABI_DIGEST = "fdd2fac4029dad9bfdbdc053a1d5d0d72308f66ca1ce31404b3b4d354b2ee8ec";
2
+ export const DOLLY_KERNEL_PLUGIN_IMPORTS = Object.freeze(["fopen","fseek","fclose","ftell","malloc","fread","free","dolly_assert_fail","realloc","strcmp","strncmp","strlen","memcmp","bcmp","write","__errno_location","lseek","preadv","close","fstat","unlinkat","openat","realpath","readv","dolly_input_decoder_install"]);
Binary file
@@ -0,0 +1 @@
1
+ export const DOLLY_PROCESS_ABI_DIGEST = "8002d2ac9e15e7d366e3eae77fdb1c61ac7650239792dc0c1ca64b7a1c3f4730";