@ai-ecoverse/slicc-kernel 1.28.0 → 1.29.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.
- package/README.md +1 -1
- package/dist/kernel-worker.js +8 -2
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node.js +8 -2
- package/dist/node.js.map +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ A WASI preview1 or WASIX program (Zig, Rust, Go, wasi-libc or wasix-libc C) has
|
|
|
140
140
|
{ "slicc": { "abi": "wasi", "commands": { "rg": { "wasm": "bin/rg.wasm" }, "rustc": { "script": "bin/rustc" } } } }
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
Entries may also set `argv0`, `args` and `env`, and a package can set `slicc.env` for all of its commands. In `env`, `${package}` is the package directory, `${cwd}` the process's working directory, and `${NAME}` the caller's `NAME` when the program starts (a default naming an unset variable is left out); a relative path that exists in the package (`lib/python3.14`, `./`) becomes that absolute path. The caller's environment wins over these defaults; a `null` value removes the variable for the command, after the caller's environment is applied (a host-networked program can drop the kernel's proxy settings that way), and a command entry can set a variable its package's `slicc.env` removes. The first package to define a name wins. `sh` runs bash as `sh` unless a package provides its own. The installed commands appear as executables in a virtual `/usr/bin` and `/bin`, so `PATH` lookups, `command -v` and `ls /usr/bin` work without writing anything to OPFS. A process can also run a program by the path of its glue when the `.wasm` sits next to it, a wasm module by its own path (as a WASI program), and a script through its `#!` line (including `#!/usr/bin/env name`). Executing any other file fails with `ENOEXEC`, so bash runs it as a shell script, as POSIX shells do. Commands also come from pnpm's global directory. Every process gets `PNPM_HOME=/home/.local/share/pnpm`, unless the embedder sets its own, and has `$PNPM_HOME/bin` on `PATH`. The kernel scans each of pnpm's global install groups (`$PNPM_HOME/global/*/<group>/node_modules`) after `/node_modules`, which wins when both provide a command. The catalog is re-read whenever anything under either changes, so `pnpm add -g @ai-ecoverse/wasi-ripgrep` makes `rg` work in the same shell, and `pnpm remove -g` removes it again.
|
|
143
|
+
Entries may also set `argv0`, `args` and `env`, and a package can set `slicc.env` for all of its commands. An entry with `"argv0Path": true` gets the absolute path it was run by as `argv[0]` when that path is a link outside `/bin` and `/usr/bin` to the command, as a venv's `bin/python` is (the `#!` line of a script naming such a link included), so it can find what sits beside that link; other entries keep their `argv0`. In `env`, `${package}` is the package directory, `${cwd}` the process's working directory, and `${NAME}` the caller's `NAME` when the program starts (a default naming an unset variable is left out); a relative path that exists in the package (`lib/python3.14`, `./`) becomes that absolute path. The caller's environment wins over these defaults; a `null` value removes the variable for the command, after the caller's environment is applied (a host-networked program can drop the kernel's proxy settings that way), and a command entry can set a variable its package's `slicc.env` removes. The first package to define a name wins. `sh` runs bash as `sh` unless a package provides its own. The installed commands appear as executables in a virtual `/usr/bin` and `/bin`, so `PATH` lookups, `command -v` and `ls /usr/bin` work without writing anything to OPFS. A process can also run a program by the path of its glue when the `.wasm` sits next to it, a wasm module by its own path (as a WASI program), and a script through its `#!` line (including `#!/usr/bin/env name`). Executing any other file fails with `ENOEXEC`, so bash runs it as a shell script, as POSIX shells do. Commands also come from pnpm's global directory. Every process gets `PNPM_HOME=/home/.local/share/pnpm`, unless the embedder sets its own, and has `$PNPM_HOME/bin` on `PATH`. The kernel scans each of pnpm's global install groups (`$PNPM_HOME/global/*/<group>/node_modules`) after `/node_modules`, which wins when both provide a command. The catalog is re-read whenever anything under either changes, so `pnpm add -g @ai-ecoverse/wasi-ripgrep` makes `rg` work in the same shell, and `pnpm remove -g` removes it again.
|
|
144
144
|
|
|
145
145
|
### WASI programs
|
|
146
146
|
|
package/dist/kernel-worker.js
CHANGED
|
@@ -4527,6 +4527,7 @@ function commandOf(pkg, name2, raw, packageAbi, shared) {
|
|
|
4527
4527
|
glue,
|
|
4528
4528
|
wasm,
|
|
4529
4529
|
argv0,
|
|
4530
|
+
...raw.argv0Path === true ? { argv0Path: true } : {},
|
|
4530
4531
|
...args ? { args } : {},
|
|
4531
4532
|
...withEnv,
|
|
4532
4533
|
...imports ? { imports } : {}
|
|
@@ -9958,9 +9959,14 @@ var Launcher = class {
|
|
|
9958
9959
|
const command = (await this.commands()).get(name2);
|
|
9959
9960
|
return command && !command.script ? targetOf(command) : void 0;
|
|
9960
9961
|
}
|
|
9961
|
-
const
|
|
9962
|
+
const path = this.fs.resolvePath(cwd, file);
|
|
9963
|
+
const glue = await followLinks(this.base, path);
|
|
9962
9964
|
const linked = COMMAND2.exec(glue)?.[1];
|
|
9963
|
-
if (linked !== void 0)
|
|
9965
|
+
if (linked !== void 0) {
|
|
9966
|
+
const target = await this.resolve(`/bin/${linked}`, argv0, cwd);
|
|
9967
|
+
const byPath = !COMMAND2.test(path) && (await this.commands()).get(linked)?.argv0Path === true;
|
|
9968
|
+
return target && byPath ? { ...target, argv0: path } : target;
|
|
9969
|
+
}
|
|
9964
9970
|
const head = await this.head(glue);
|
|
9965
9971
|
if (!head) return void 0;
|
|
9966
9972
|
if (isWasm(head)) {
|