@ai-ecoverse/slicc-jsh 0.3.7 → 0.3.9
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 +8 -1
- package/dist/host/main.mjs +24 -8
- package/dist/jsh.mjs +957 -305
- package/dist/meta-main.json +1 -1
- package/dist/node.mjs +957 -305
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,7 +22,14 @@ Design and milestones: [slicc-kernel#68](https://github.com/ai-ecoverse/slicc-ke
|
|
|
22
22
|
|
|
23
23
|
**npm ecosystem gaps:** packages that import `node:tty` (e.g. chalk's Node build) or need `crypto` (e.g. nanoid's main entry) fail with `ERR_NOT_SUPPORTED` until those modules ship. Prefer the browser/`default` export condition, or a fixture that pins it, when dogfooding. The `tls` module itself is unsupported (`ERR_NOT_SUPPORTED`) — so **http-proxy-agent** / **https-proxy-agent** (which import `tls` for CONNECT tunnels) cannot run yet even though `http.Agent` subclasses via agent-base work for plain `http`.
|
|
24
24
|
|
|
25
|
-
**`child_process` (0.3.0):** `spawn`, `execFile`, and `exec` (via `sh -c`) sit on `ctx.spawn` — argv/env/cwd, stdio `inherit`/`pipe`/`ignore`, streams on `.stdin`/`.stdout`/`.stderr`, events `spawn`/`exit`/`close`/`error` (ENOENT), `.kill(signal)`, `.pid`. Sync forms (`spawnSync`, `execSync`, `execFileSync`) and `fork` stay `ERR_NOT_SUPPORTED`. Also `fs.realpathSync`
|
|
25
|
+
**`child_process` (0.3.0):** `spawn`, `execFile`, and `exec` (via `sh -c`) sit on `ctx.spawn` — argv/env/cwd, stdio `inherit`/`pipe`/`ignore`, streams on `.stdin`/`.stdout`/`.stderr`, events `spawn`/`exit`/`close`/`error` (ENOENT), `.kill(signal)`, `.pid`. Sync forms (`spawnSync`, `execSync`, `execFileSync`) and `fork` stay `ERR_NOT_SUPPORTED`. Also `fs.realpathSync` and `process.getuid`/`getgid`/`kill(self)` so pnpm's global cmd shims can resolve their target and re-raise signals. As of 0.3.3, pipe stdio loads `readable-stream` from sources embedded in the bundle (not a sync read of `/node_modules/@ai-ecoverse/slicc-jsh/dist/vendor/…`), so `pnpm add -g` installs under `$PNPM_HOME/global/v11/<hash>/` work on seven.
|
|
26
|
+
|
|
27
|
+
**`fs` and symlinks:** `cp`, `cpSync` and `promises.cp` follow Node 22.22's own code, quirks included. They're tested byte for byte against Node (golden fixtures `fs-cp-sync`, `fs-cp-async`, `fs-readdir-links`):
|
|
28
|
+
- A symlink in a copied tree stays a symlink, with its target made absolute unless `verbatimSymlinks`. A linked directory is never descended into.
|
|
29
|
+
- `cpSync(src, dest, { recursive: true, dereference: true })` still copies a tree's symlinks as symlinks. That's Node 22.22's native `CpSyncCopyDir`. Only `fs.cp`/`promises.cp` (Node's `cp.js`) really dereference.
|
|
30
|
+
- `readdirSync({ recursive })` and `promises.readdir({ recursive })` with names descend into linked directories. `promises.readdir` with `withFileTypes` and `opendir({ recursive })` don't.
|
|
31
|
+
- `realpathSync` resolves every link.
|
|
32
|
+
- `linkSync` is the kernel's: it works on `tmpfs`, and fails with `EPERM` on the root file system and `fsa`, and with `EXDEV` across mounts.
|
|
26
33
|
|
|
27
34
|
**Still later:** `crypto` / `zlib` / `readline` / `tty` / `tls` / `worker_threads` / TLS `https.createServer` throw `ERR_NOT_SUPPORTED` until their milestone.
|
|
28
35
|
|
package/dist/host/main.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/host/main.mjs
|
|
2
2
|
import { spawn as spawnChild } from "node:child_process";
|
|
3
|
-
import { accessSync, constants as fsConstants, readFileSync, writeSync } from "node:fs";
|
|
3
|
+
import { accessSync, constants as fsConstants, readFileSync, realpathSync, writeSync } from "node:fs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { constants as osConstants } from "node:os";
|
|
6
6
|
import { delimiter, join, resolve } from "node:path";
|
|
@@ -10,7 +10,7 @@ import vm from "node:vm";
|
|
|
10
10
|
// package.json
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "@ai-ecoverse/slicc-jsh",
|
|
13
|
-
version: "0.3.
|
|
13
|
+
version: "0.3.9",
|
|
14
14
|
description: "Node.js-compatible runtime for slicc-kernel: the node and jsh commands (abi: js)",
|
|
15
15
|
type: "module",
|
|
16
16
|
license: "Apache-2.0",
|
|
@@ -80,7 +80,7 @@ var package_default = {
|
|
|
80
80
|
"trust:dry": "npx fledgling sync --dry-run -y --skip-publish"
|
|
81
81
|
},
|
|
82
82
|
devDependencies: {
|
|
83
|
-
"@ai-ecoverse/slicc-kernel": "1.
|
|
83
|
+
"@ai-ecoverse/slicc-kernel": "1.64.0",
|
|
84
84
|
"@ai-ecoverse/wasi-pnpm": "12.9.1-8",
|
|
85
85
|
"abort-controller": "3.0.0",
|
|
86
86
|
acorn: "8.19.0",
|
|
@@ -222,10 +222,21 @@ function joinChild(dir, name) {
|
|
|
222
222
|
if (dir === "/") return `/${name}`;
|
|
223
223
|
return `${dir}/${name}`;
|
|
224
224
|
}
|
|
225
|
+
function skillRootOf(dir) {
|
|
226
|
+
if (!dir) return dir;
|
|
227
|
+
const absolute = dir.startsWith("/");
|
|
228
|
+
const parts = dir.split("/").filter(Boolean);
|
|
229
|
+
const at = parts.lastIndexOf("scripts");
|
|
230
|
+
if (at < 0) return dir;
|
|
231
|
+
const rootParts = parts.slice(0, at);
|
|
232
|
+
if (rootParts.length === 0) return absolute ? "/" : "";
|
|
233
|
+
return (absolute ? "/" : "") + rootParts.join("/");
|
|
234
|
+
}
|
|
225
235
|
function createSkill({ argv, fs, exec }) {
|
|
226
236
|
const dir = dirnameOf(argv[1] ?? "");
|
|
227
|
-
const
|
|
228
|
-
const
|
|
237
|
+
const root = skillRootOf(dir);
|
|
238
|
+
const refs = joinChild(root, "references");
|
|
239
|
+
const assets = joinChild(root, "assets");
|
|
229
240
|
const configPath = joinChild(dir, ".config");
|
|
230
241
|
async function readConfig() {
|
|
231
242
|
let text;
|
|
@@ -267,7 +278,7 @@ function createSkill({ argv, fs, exec }) {
|
|
|
267
278
|
}
|
|
268
279
|
return stdout.replace(/\r?\n+$/, "");
|
|
269
280
|
}
|
|
270
|
-
return Object.freeze({ dir, refs, assets, config, token });
|
|
281
|
+
return Object.freeze({ dir, root, refs, assets, config, token });
|
|
271
282
|
}
|
|
272
283
|
|
|
273
284
|
// src/jsh/sliccy/http.mjs
|
|
@@ -879,9 +890,14 @@ async function main() {
|
|
|
879
890
|
${JSH_USAGE}`);
|
|
880
891
|
process.exit(parsed.status);
|
|
881
892
|
}
|
|
882
|
-
const
|
|
883
|
-
process.argv = [process.execPath,
|
|
893
|
+
const given = resolve(parsed.script);
|
|
894
|
+
process.argv = [process.execPath, given, ...parsed.args];
|
|
884
895
|
silenceLoaderWarning();
|
|
896
|
+
let filename = given;
|
|
897
|
+
try {
|
|
898
|
+
filename = realpathSync(given);
|
|
899
|
+
} catch {
|
|
900
|
+
}
|
|
885
901
|
await runJsh({ filename, engine, process, console });
|
|
886
902
|
}
|
|
887
903
|
main().catch((err) => {
|