@ecmaos/kernel 0.2.6 → 0.2.8
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.
- package/README.md +185 -102
- package/dist/.vite/manifest.json +14 -14
- package/dist/{browser-C0q0NWWv.js → browser-D_CtuxSB.js} +2 -2
- package/dist/{browser-C0q0NWWv.js.map → browser-D_CtuxSB.js.map} +1 -1
- package/dist/{empty-BMkCc_7L.js → empty--zdtkf0T.js} +2099 -156
- package/dist/empty--zdtkf0T.js.map +1 -0
- package/dist/install-Ds1oWgTf.js +119 -0
- package/dist/install-Ds1oWgTf.js.map +1 -0
- package/dist/kernel.d.ts +18 -3
- package/dist/kernel.js +1 -1
- package/dist/swapi.js +1 -1
- package/dist/{topbar.min-xBbuiIjv.js → topbar.min-CDkSVOxV.js} +2 -2
- package/dist/{topbar.min-xBbuiIjv.js.map → topbar.min-CDkSVOxV.js.map} +1 -1
- package/dist/ui.js +1 -1
- package/package.json +7 -7
- package/dist/empty-BMkCc_7L.js.map +0 -1
- package/dist/install-C64fBUI2.js +0 -1997
- package/dist/install-C64fBUI2.js.map +0 -1
package/README.md
CHANGED
|
@@ -59,103 +59,140 @@ The goal is to create a kernel and supporting apps that tie together modern web
|
|
|
59
59
|
- `Metal`: An API server for allowing connections to physical systems from ecmaOS using [Hono](https://hono.dev)
|
|
60
60
|
- `SWAPI`: An API server running completely inside a service worker using [Hono](https://hono.dev)
|
|
61
61
|
|
|
62
|
-
## Basic
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- `
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
- `
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
62
|
+
## Basic Concepts
|
|
63
|
+
|
|
64
|
+
### Apps
|
|
65
|
+
|
|
66
|
+
> [/apps](/apps)
|
|
67
|
+
|
|
68
|
+
- These are full applications that are developed specifically to work with ecmaOS
|
|
69
|
+
- Refer to the full list of [official published apps on npm](https://www.npmjs.com/org/ecmaos-apps)
|
|
70
|
+
- See the [APPS.md](/APPS.md) file for a list of community apps; submit a PR to add your app!
|
|
71
|
+
- An app is an npm package, in which the bin file has a shebang line of `#!ecmaos:bin:app:myappname`
|
|
72
|
+
- Its default export (or exported `main` function) will be called with the `ProcessEntryParams` object
|
|
73
|
+
- They can be installed from the terminal using the `install` command, e.g. `# install @ecmaos-apps/code`
|
|
74
|
+
- Run the installed app (bins are linked to `/usr/bin`): `# code /root/hello.js`
|
|
75
|
+
- During development, it can be useful to run a [Verdaccio](https://github.com/verdaccio/verdaccio) server to test local packages
|
|
76
|
+
- To publish to Verdaccio, run `# npm publish --registry http://localhost:4873` in your app's development environment
|
|
77
|
+
- Then to install from your local registry, run `# install @myscope/mypackage --registry http://localhost:4873`
|
|
78
|
+
|
|
79
|
+
### BIOS
|
|
80
|
+
|
|
81
|
+
> [/core/bios](/core/bios)
|
|
82
|
+
|
|
83
|
+
- The BIOS is a C++ module compiled to WebAssembly with [Emscripten](https://emscripten.org) providing performance-critical functionality
|
|
84
|
+
- The BIOS has its own filesystem, located at `/bios` — this allows data to be copied in and out of the BIOS for custom code and utilities
|
|
85
|
+
- The main idea is that data and custom code can be loaded into it from the OS for WASM-native performance, as well as providing various utilities
|
|
86
|
+
- Confusingly, the Kernel loads the BIOS — not the other way around
|
|
87
|
+
|
|
88
|
+
### Commands
|
|
89
|
+
|
|
90
|
+
> [/core/kernel/src/tree/lib/commands](/core/kernel/src/tree/lib/commands)
|
|
91
|
+
|
|
92
|
+
- Commands are small utilities that aren't quite full Apps, provided by the shell
|
|
93
|
+
- Some builtin commands that exist now will be moved into separate apps over time
|
|
94
|
+
|
|
95
|
+
### Devices
|
|
96
|
+
|
|
97
|
+
> [/devices](/devices)
|
|
98
|
+
|
|
99
|
+
- Refer to the full list of [official devices on npm](https://www.npmjs.com/org/ecmaos-devices)
|
|
100
|
+
- See the [DEVICES.md](/DEVICES.md) file for a list of community devices; submit a PR to add your device!
|
|
101
|
+
- Devices get loaded on boot, e.g. `/dev/bluetooth`, `/dev/random`, `/dev/battery`, etc.
|
|
102
|
+
- A device can support being "run" by a user, e.g. `# /dev/battery status`
|
|
103
|
+
- Devices may also be directly read/written using `fs` methods, and will behave accordingly (or have no effect if not supported)
|
|
104
|
+
- An individual device module can provide multiple device drivers, e.g. `/dev/usb` provides `/dev/usb-mydevice-0001-0002`
|
|
105
|
+
|
|
106
|
+
### Generators
|
|
107
|
+
|
|
108
|
+
> [/turbo/generators](/turbo/generators)
|
|
109
|
+
|
|
110
|
+
- Generators are used to scaffold new apps, devices, modules, etc.
|
|
111
|
+
- They are located in the `turbo/generators` directory of the repository
|
|
112
|
+
- They are used by the `turbo gen` command, e.g. `turbo gen app`, `turbo gen device`, `turbo gen module`, etc.
|
|
113
|
+
|
|
114
|
+
### Jaffa
|
|
115
|
+
|
|
116
|
+
> [/core/jaffa](/core/jaffa)
|
|
117
|
+
|
|
118
|
+
- Jaffa is a [Tauri](https://tauri.app) wrapper for the ecmaOS kernel
|
|
119
|
+
- It's used to tie the kernel into a desktop or mobile environment, allowing for native functionality
|
|
120
|
+
|
|
121
|
+
### Kernel
|
|
122
|
+
|
|
123
|
+
> [/core/kernel](/core/kernel)
|
|
124
|
+
|
|
125
|
+
- The kernel ties together the various components of the system into a cohesive whole
|
|
126
|
+
- Authentication (WebAuthn)
|
|
127
|
+
- Components (Web Components/Custom Elements)
|
|
128
|
+
- Devices
|
|
129
|
+
- DOM
|
|
130
|
+
- Events (CustomEvents)
|
|
131
|
+
- Filesystem (ZenFS)
|
|
132
|
+
- Internationalization (i18next)
|
|
133
|
+
- Interval Manager (setInterval)
|
|
134
|
+
- Log Manager (tslog)
|
|
135
|
+
- Memory Manager (Abstractions)
|
|
136
|
+
- Process Manager
|
|
137
|
+
- Protocol Handlers (web+ecmaos://...)
|
|
138
|
+
- Service Worker Manager
|
|
139
|
+
- Shell
|
|
140
|
+
- Storage (IndexedDB, localStorage, sessionStorage, etc.)
|
|
141
|
+
- Terminal (xterm.js)
|
|
142
|
+
- User Manager
|
|
143
|
+
- WASM Loader
|
|
144
|
+
- [WebContainer](https://github.com/stackblitz/webcontainer-core) for running Node.js apps
|
|
145
|
+
- Window Manager (WinBox)
|
|
146
|
+
- Workers (Web Workers)
|
|
147
|
+
|
|
148
|
+
### Metal
|
|
149
|
+
|
|
150
|
+
> [/core/metal](/core/metal)
|
|
151
|
+
|
|
152
|
+
- Metal is an API server for allowing connections to physical systems from ecmaOS using [Hono](https://hono.dev)
|
|
153
|
+
- Authenticated and encrypted connections with JWK/JWE/JOSE
|
|
154
|
+
|
|
155
|
+
### Modules
|
|
156
|
+
|
|
157
|
+
> [/modules](/modules)
|
|
158
|
+
|
|
159
|
+
- Refer to the full list of [official modules on npm](https://www.npmjs.com/org/ecmaos-modules)
|
|
160
|
+
- See the [MODULES.md](/MODULES.md) file for a list of community modules; submit a PR to add your module!
|
|
161
|
+
- Modules are dynamically loaded into the kernel at boot and can be enabled or disabled
|
|
162
|
+
- They are specified during build via the `VITE_KERNEL_MODULES` environment variable
|
|
163
|
+
- e.g. `VITE_KERNEL_MODULES=@ecmaos-modules/boilerplate@0.1.0,@your/package@1.2.3`
|
|
164
|
+
- Versions must be pinned and are mandatory - you cannot use NPM version specifiers
|
|
165
|
+
- They can provide additional functionality, devices, commands, etc.
|
|
166
|
+
- They offer a [common interface](./core/types/modules.ts) for interacting with the kernel
|
|
167
|
+
- Generally they should be written in [AssemblyScript](https://www.assemblyscript.org), but this isn't required
|
|
168
|
+
|
|
169
|
+
### Packages
|
|
170
|
+
|
|
171
|
+
- Packages are [NPM packages](https://www.npmjs.com) that are installed into the ecmaOS environment
|
|
172
|
+
- They can be installed from the terminal using the `install` command, e.g. `# install jquery`
|
|
173
|
+
- Client-side packages should work well
|
|
174
|
+
- Some basic Node emulation is in place, but don't expect anything to work at this point
|
|
175
|
+
- NPM version specifiers are supported, e.g.:
|
|
176
|
+
- `# install jquery@3.7.1`
|
|
177
|
+
- `# install jquery@^3.7.1`
|
|
178
|
+
- `# install jquery@latest`
|
|
179
|
+
- [JSR](https://jsr.io) may be used with the [NPM compatibility layer](https://jsr.io/docs/npm-compatibility):
|
|
180
|
+
- `# install @jsr/defaude__hello-jsr --registry https://npm.jsr.io`
|
|
181
|
+
|
|
182
|
+
### SWAPI
|
|
183
|
+
|
|
184
|
+
> [/core/swapi](/core/swapi)
|
|
185
|
+
|
|
186
|
+
- The SWAPI is an API server running completely inside a service worker using [Hono](https://hono.dev)
|
|
187
|
+
- It allows for various operations including the `fs` route to fetch files via URL
|
|
188
|
+
- e.g., `# fetch /swapi/fs/home/user/hello.txt`
|
|
189
|
+
- e.g., `# fetch /swapi/fake/person/fullName`
|
|
190
|
+
|
|
191
|
+
### Utils
|
|
192
|
+
|
|
193
|
+
> [/utils](/utils)
|
|
194
|
+
|
|
195
|
+
- Utilities and configuration used during development
|
|
159
196
|
|
|
160
197
|
## Important Files and Directories
|
|
161
198
|
|
|
@@ -165,7 +202,7 @@ The goal is to create a kernel and supporting apps that tie together modern web
|
|
|
165
202
|
- `/dev/`: All devices are here
|
|
166
203
|
- `/etc/packages`: A list of installed packages to load on boot
|
|
167
204
|
- `/home/`: Contains user home directories
|
|
168
|
-
- `/proc/`:
|
|
205
|
+
- `/proc/`: Contains various dynamic system information
|
|
169
206
|
- `/root/`: The home directory for the root user
|
|
170
207
|
- `/usr/bin/`: Executable packages get linked here
|
|
171
208
|
- `/usr/lib/`: All installed packages are here
|
|
@@ -244,21 +281,57 @@ echo "window.alert('Hello, world!')" > /root/hello.js
|
|
|
244
281
|
load /root/hello.js
|
|
245
282
|
```
|
|
246
283
|
|
|
284
|
+
## Scripting
|
|
285
|
+
|
|
286
|
+
```txt
|
|
287
|
+
#!ecmaos:bin:script
|
|
288
|
+
echo "Hello, world!"
|
|
289
|
+
install jquery
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Startup
|
|
293
|
+
|
|
294
|
+
- `/boot/init` is a script that runs on boot inside the init process (PID 0)
|
|
295
|
+
- `/etc/packages` is a list of already installed packages to load on boot; one per line
|
|
296
|
+
- The env var `VITE_KERNEL_MODULES` is a list of modules to load on boot; CSV with pinned versions
|
|
297
|
+
- The env var `VITE_RECOMMENDED_APPS` is a list of apps to suggest to new users
|
|
298
|
+
|
|
247
299
|
## App Development
|
|
248
300
|
|
|
249
|
-
The
|
|
301
|
+
The [apps](/apps) directory in the repository contains some examples of how to develop apps, but there are many approaches you could take.
|
|
250
302
|
|
|
251
|
-
- `@ecmaos-apps/boilerplate`: A minimal boilerplate app for
|
|
303
|
+
- `@ecmaos-apps/boilerplate`: A minimal boilerplate app for reference
|
|
252
304
|
- `@ecmaos-apps/code`: A simple code editor app using [Monaco](https://microsoft.github.io/monaco-editor/); serves as a good reference for more complex apps
|
|
253
305
|
|
|
254
306
|
Basically, your app's [bin](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin) file has a `main` (or default) function export that is passed the kernel reference and can use it to interact with the system as needed. A shebang line of `#!ecmaos:bin:app:myappname` is required at the top of the bin file to identify it as an app.
|
|
255
307
|
|
|
308
|
+
## App/Kernel Interface Example
|
|
309
|
+
|
|
310
|
+
> See the [docs](https://docs.ecmaos.sh) for more information
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
#!ecmaos:bin:app:example
|
|
314
|
+
// shebang format: ecmaos:exectype:execnamespace:execname
|
|
315
|
+
export default async function main(params: ProcessEntryParams) {
|
|
316
|
+
const { args, kernel, terminal } = params
|
|
317
|
+
kernel.log.info('Hello, world!')
|
|
318
|
+
kernel.log.debug(args)
|
|
319
|
+
terminal.writeln('Hello, world!')
|
|
320
|
+
await kernel.filesystem.fs.writeFile('/tmp/hello.txt', 'Hello, world!')
|
|
321
|
+
const win = kernel.windows.create({ title: 'Example', width: 800, height: 600 })
|
|
322
|
+
const container = document.createElement('div')
|
|
323
|
+
container.innerHTML = '<h1>Hello, world!</h1>'
|
|
324
|
+
win.mount(container)
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
256
328
|
## Early Days
|
|
257
329
|
|
|
258
|
-
|
|
330
|
+
ecmaOS is currently in active development. It is not considered stable and the structure and API are very likely to change in unexpected and possibly unannounced ways until version 1.0.0. Use cautiously and at your own risk.
|
|
259
331
|
|
|
260
332
|
Things to keep in mind:
|
|
261
333
|
|
|
334
|
+
- If things go wrong or break, clear your browser cache and site data for ecmaOS
|
|
262
335
|
- Things have changed a lot since the tests were written, so they need to be updated and fixed
|
|
263
336
|
- The kernel is designed to be run in an environment with a DOM (i.e. a browser)
|
|
264
337
|
- Many features are only available on Chromium-based browsers, and many more behind feature flags
|
|
@@ -270,6 +343,14 @@ Things to keep in mind:
|
|
|
270
343
|
|
|
271
344
|
[Turborepo](https://turbo.build/repo) is used to manage the monorepo, and [pnpm](https://pnpm.io) is used for package management.
|
|
272
345
|
|
|
346
|
+
PNPM Workspaces:
|
|
347
|
+
|
|
348
|
+
- [apps](/apps)
|
|
349
|
+
- [core](/core)
|
|
350
|
+
- [devices](/devices)
|
|
351
|
+
- [modules](/modules)
|
|
352
|
+
- [utils](/utils)
|
|
353
|
+
|
|
273
354
|
A good place to start is viewing the `scripts` property of [package.json](./package.json) in the root of the repository.
|
|
274
355
|
|
|
275
356
|
```bash
|
|
@@ -301,8 +382,10 @@ turbo gen device # generate a new device template
|
|
|
301
382
|
turbo gen module # generate a new module template
|
|
302
383
|
```
|
|
303
384
|
|
|
304
|
-
Also see [turbo.json](./turbo.json) and [CONTRIBUTING.md](
|
|
385
|
+
Also see [turbo.json](./turbo.json) and [CONTRIBUTING.md](/CONTRIBUTING.md) for more information.
|
|
305
386
|
|
|
306
387
|
## Security Vulnerabilities
|
|
307
388
|
|
|
389
|
+
See [SECURITY.md](/SECURITY.md) for more information.
|
|
390
|
+
|
|
308
391
|
If you find a serious security vulnerability, please submit a new [Draft Security Advisory](https://github.com/ecmaos/ecmaos/security) or contact the project maintainer directly at [code@mathis.network](mailto:code@mathis.network).
|
package/dist/.vite/manifest.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_browser-
|
|
3
|
-
"file": "browser-
|
|
2
|
+
"_browser-D_CtuxSB.js": {
|
|
3
|
+
"file": "browser-D_CtuxSB.js",
|
|
4
4
|
"name": "browser",
|
|
5
5
|
"isDynamicEntry": true,
|
|
6
6
|
"imports": [
|
|
7
|
-
"_empty
|
|
7
|
+
"_empty--zdtkf0T.js"
|
|
8
8
|
]
|
|
9
9
|
},
|
|
10
|
-
"_empty
|
|
11
|
-
"file": "empty
|
|
10
|
+
"_empty--zdtkf0T.js": {
|
|
11
|
+
"file": "empty--zdtkf0T.js",
|
|
12
12
|
"name": "empty",
|
|
13
13
|
"dynamicImports": [
|
|
14
|
-
"_topbar.min-
|
|
15
|
-
"_browser-
|
|
14
|
+
"_topbar.min-CDkSVOxV.js",
|
|
15
|
+
"_browser-D_CtuxSB.js",
|
|
16
16
|
"src/tree/lib/commands/install.ts",
|
|
17
17
|
"node_modules/.pnpm/figlet@1.8.0/node_modules/figlet/importable-fonts/Poison.js"
|
|
18
18
|
]
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"file": "kernel.css",
|
|
22
22
|
"src": "_kernel.css"
|
|
23
23
|
},
|
|
24
|
-
"_topbar.min-
|
|
25
|
-
"file": "topbar.min-
|
|
24
|
+
"_topbar.min-CDkSVOxV.js": {
|
|
25
|
+
"file": "topbar.min-CDkSVOxV.js",
|
|
26
26
|
"name": "topbar.min",
|
|
27
27
|
"isDynamicEntry": true,
|
|
28
28
|
"imports": [
|
|
29
|
-
"_empty
|
|
29
|
+
"_empty--zdtkf0T.js"
|
|
30
30
|
]
|
|
31
31
|
},
|
|
32
32
|
"node_modules/.pnpm/figlet@1.8.0/node_modules/figlet/importable-fonts/Poison.js": {
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
"src": "src/tree/kernel.ts",
|
|
42
42
|
"isEntry": true,
|
|
43
43
|
"imports": [
|
|
44
|
-
"_empty
|
|
44
|
+
"_empty--zdtkf0T.js"
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"src/tree/lib/commands/install.ts": {
|
|
48
|
-
"file": "install-
|
|
48
|
+
"file": "install-Ds1oWgTf.js",
|
|
49
49
|
"name": "install",
|
|
50
50
|
"src": "src/tree/lib/commands/install.ts",
|
|
51
51
|
"isDynamicEntry": true,
|
|
52
52
|
"imports": [
|
|
53
|
-
"_empty
|
|
53
|
+
"_empty--zdtkf0T.js"
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
56
|
"src/ui.ts": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"src": "src/ui.ts",
|
|
60
60
|
"isEntry": true,
|
|
61
61
|
"imports": [
|
|
62
|
-
"_empty
|
|
62
|
+
"_empty--zdtkf0T.js"
|
|
63
63
|
]
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getDefaultExportFromCjs } from "./empty
|
|
1
|
+
import { g as getDefaultExportFromCjs } from "./empty--zdtkf0T.js";
|
|
2
2
|
var browser$2;
|
|
3
3
|
var hasRequiredBrowser;
|
|
4
4
|
function requireBrowser() {
|
|
@@ -20,4 +20,4 @@ const browser$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
20
20
|
export {
|
|
21
21
|
browser$1 as b
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=browser-
|
|
23
|
+
//# sourceMappingURL=browser-D_CtuxSB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-
|
|
1
|
+
{"version":3,"file":"browser-D_CtuxSB.js","sources":["../node_modules/.pnpm/ws@8.18.0/node_modules/ws/browser.js"],"sourcesContent":["'use strict';\n\nmodule.exports = function () {\n throw new Error(\n 'ws does not work in the browser. Browser clients must use the native ' +\n 'WebSocket object'\n );\n};\n"],"names":["browser"],"mappings":";;;;;;AAEAA,cAAiB,WAAY;AAC3B,UAAM,IAAI;AAAA,MACR;AAAA,IAED;AAAA,EACF;;;;;;;;;","x_google_ignoreList":[0]}
|