Skip to content

Instantly share code, notes, and snippets.

@progrium
Last active April 27, 2025 00:44
Show Gist options
  • Save progrium/2e292769aa81e4a26788c617796cd15b to your computer and use it in GitHub Desktop.
Save progrium/2e292769aa81e4a26788c617796cd15b to your computer and use it in GitHub Desktop.
original "paper prototype" demo script / spec for wanix 0.3 imagining how basic primitives would be used to bootstrap a terminal+vm using only filesystem operations
const w = new Wanix()
Object.getPrototypeOf(w)
// {readFile: ƒ, writeFile: ƒ, readDir: ƒ, exists: ƒ}
await w.readDir(".")
// ['dom/', 'fsys/', 'proc/', 'term/', 'vm/']
await w.readDir("fsys")
// ['ctl', 'new/']
await w.readDir("fsys/new")
// ['opfs', 'memfs', 'pickerfs', '9pfs']
const fid = await w.readFile("fsys/new/pickerfs")
// "1"
await w.readDir("fsys")
// ['1/', 'ctl', 'new/']
await w.readDir("fsys/${fid}")
// ['ctl', 'name', 'type']
await w.readFile("fsys/${fid}/name")
// "progrium.xyz"
await w.writeFile("fsys/${fid}/ctl", "bind /data")
await w.readDir("data")
// ['blog', '_includes', '_assets']
const tid = await w.readFile("term/new")
// "1"
await w.writeFile("term/${tid}/ctl", "attach /dom/body")
await w.readDir("term/${tid}")
// ['ctl', 'data', 'in', 'out']
await w.writeFile("term/${tid}/out", "Hello world")
await w.writeFile("term/${tid}/ctl", "reset")
const vid = await w.readFile("vm/new/alpine")
// "1"
await w.readDir("vm/${vid}")
// ['ctl', 'fs', 'image']
await w.writeFile("fsys/ctl", "bind /vm/${vid}/tty0 /term/${tid}/data")
await w.readDir("vm/${vid}")
// ['ctl', 'fs', 'image', 'tty0']
await w.writeFile("vm/${vid}/ctl", "start")
// switch to terminal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment