@nimbus-sh/worker 0.1.4 → 0.1.6
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 +37 -0
- package/dist/_shared/crypto.d.ts +15 -0
- package/dist/_shared/crypto.d.ts.map +1 -0
- package/dist/_shared/crypto.js +122 -0
- package/dist/facets/manager.d.ts +24 -0
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +279 -70
- package/dist/facets/process.d.ts +11 -2
- package/dist/facets/process.d.ts.map +1 -1
- package/dist/facets/process.js +187 -21
- package/dist/facets/vite-dev-server.d.ts +2 -0
- package/dist/facets/vite-dev-server.d.ts.map +1 -1
- package/dist/facets/vite-dev-server.js +39 -12
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/loaders/child-process/spawn-facet.d.ts +1 -3
- package/dist/loaders/child-process/spawn-facet.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-facet.js +1 -12
- package/dist/loaders/child-process/spawn-pool.d.ts +1 -1
- package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-pool.js +1 -6
- package/dist/loaders/loader-pool.d.ts +7 -0
- package/dist/loaders/loader-pool.d.ts.map +1 -1
- package/dist/loaders/loader-pool.js +3 -1
- package/dist/npm/installer.d.ts.map +1 -1
- package/dist/npm/installer.js +47 -27
- package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
- package/dist/npm/pre-bundle-facet.js +2 -1
- package/dist/npm/resolve-one-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.js +41 -13
- package/dist/npm/resolver.d.ts.map +1 -1
- package/dist/npm/resolver.js +70 -35
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +45 -21
- package/dist/router/remote-api.d.ts.map +1 -1
- package/dist/router/remote-api.js +29 -8
- package/dist/runtime/barrel-synthesizer.d.ts +7 -0
- package/dist/runtime/barrel-synthesizer.d.ts.map +1 -1
- package/dist/runtime/barrel-synthesizer.js +11 -0
- package/dist/runtime/clang-runner.d.ts +2 -2
- package/dist/runtime/clang-runner.d.ts.map +1 -1
- package/dist/runtime/clang-runner.js +64 -47
- package/dist/runtime/esbuild-service.d.ts +12 -5
- package/dist/runtime/esbuild-service.d.ts.map +1 -1
- package/dist/runtime/esbuild-service.js +28 -14
- package/dist/runtime/node-runner.d.ts +2 -0
- package/dist/runtime/node-runner.d.ts.map +1 -1
- package/dist/runtime/node-shims.d.ts +4 -2
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +404 -55
- package/dist/runtime/os-contracts.d.ts +128 -0
- package/dist/runtime/os-contracts.d.ts.map +1 -0
- package/dist/runtime/os-contracts.js +1 -0
- package/dist/runtime/package-manager.d.ts +31 -0
- package/dist/runtime/package-manager.d.ts.map +1 -1
- package/dist/runtime/package-manager.js +162 -15
- package/dist/runtime/port-registry.d.ts +5 -0
- package/dist/runtime/port-registry.d.ts.map +1 -1
- package/dist/runtime/port-registry.js +22 -1
- package/dist/runtime/pyodide-runtime-assets.d.ts +19 -0
- package/dist/runtime/pyodide-runtime-assets.d.ts.map +1 -0
- package/dist/runtime/pyodide-runtime-assets.js +44 -0
- package/dist/runtime/python-repl.d.ts +3 -0
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +18 -32
- package/dist/runtime/python-runner.d.ts +8 -9
- package/dist/runtime/python-runner.d.ts.map +1 -1
- package/dist/runtime/python-runner.js +958 -118
- package/dist/runtime/python-socket-shim.d.ts +11 -0
- package/dist/runtime/python-socket-shim.d.ts.map +1 -0
- package/dist/runtime/python-socket-shim.js +526 -0
- package/dist/runtime/require-resolver.d.ts.map +1 -1
- package/dist/runtime/require-resolver.js +2 -11
- package/dist/runtime/ruby-gems.d.ts +25 -0
- package/dist/runtime/ruby-gems.d.ts.map +1 -0
- package/dist/runtime/ruby-gems.js +582 -0
- package/dist/runtime/ruby-runner.d.ts +2 -4
- package/dist/runtime/ruby-runner.d.ts.map +1 -1
- package/dist/runtime/ruby-runner.js +335 -34
- package/dist/runtime/runtime-catalog.d.ts +16 -4
- package/dist/runtime/runtime-catalog.d.ts.map +1 -1
- package/dist/runtime/runtime-catalog.js +21 -10
- package/dist/runtime/runtime-registry.d.ts +3 -0
- package/dist/runtime/runtime-registry.d.ts.map +1 -1
- package/dist/runtime/runtime-registry.js +4 -0
- package/dist/runtime/sqlite-runtime-fs-bridge.d.ts +43 -0
- package/dist/runtime/sqlite-runtime-fs-bridge.d.ts.map +1 -0
- package/dist/runtime/sqlite-runtime-fs-bridge.js +224 -0
- package/dist/runtime/static-server.d.ts +3 -0
- package/dist/runtime/static-server.d.ts.map +1 -0
- package/dist/runtime/static-server.js +121 -0
- package/dist/runtime/vfs-snapshot.d.ts +57 -0
- package/dist/runtime/vfs-snapshot.d.ts.map +1 -0
- package/dist/runtime/vfs-snapshot.js +141 -0
- package/dist/runtime/virtual-socket-kernel.d.ts +16 -0
- package/dist/runtime/virtual-socket-kernel.d.ts.map +1 -0
- package/dist/runtime/virtual-socket-kernel.js +360 -0
- package/dist/runtime/wasi-instance.d.ts +6 -3
- package/dist/runtime/wasi-instance.d.ts.map +1 -1
- package/dist/runtime/wasm-runner.d.ts +1 -25
- package/dist/runtime/wasm-runner.d.ts.map +1 -1
- package/dist/runtime/wasm-runner.js +1 -160
- package/dist/session/agent.d.ts +43 -0
- package/dist/session/agent.d.ts.map +1 -0
- package/dist/session/agent.js +1252 -0
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +64 -19
- package/dist/session/nimbus-session.d.ts +14 -2
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +104 -30
- package/dist/session/programmatic.d.ts +10 -0
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +121 -0
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +19 -1
- package/dist/session/rpc.d.ts +11 -0
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +56 -43
- package/dist/session/supervisor-rpc.d.ts +15 -0
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +32 -0
- package/dist/session/ws.d.ts +4 -3
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +11 -1
- package/dist/shell/unix-commands.d.ts.map +1 -1
- package/dist/shell/unix-commands.js +52 -51
- package/dist/vfs/path.d.ts +8 -4
- package/dist/vfs/path.d.ts.map +1 -1
- package/dist/vfs/path.js +16 -4
- package/dist/vfs/sqlite-vfs.d.ts +2 -0
- package/dist/vfs/sqlite-vfs.d.ts.map +1 -1
- package/dist/vfs/sqlite-vfs.js +11 -0
- package/dist/vfs/symlink-registry.d.ts +7 -1
- package/dist/vfs/symlink-registry.d.ts.map +1 -1
- package/dist/vfs/symlink-registry.js +16 -11
- package/package.json +4 -1
- package/public/index.html +240 -0
- package/public/s/index.html +1316 -128
- package/runtime-contracts/pyodide-workerd-adapter.json +18 -0
- package/scripts/bundle-runtime.mjs +99 -24
|
@@ -10,19 +10,10 @@
|
|
|
10
10
|
* du, man/help, basename, dirname, printf, true, false, seq, sleep,
|
|
11
11
|
* touch, stat, file, xxd, base64, sha256sum, id, hostname, realpath
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import { getSymlinkRegistry } from '../vfs/symlink-registry.js';
|
|
14
14
|
import { enc } from '../_shared/bytes.js';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* Cached on the VFS instance via a side property so `ln -s` + `readlink`
|
|
18
|
-
* + `ls -la` share the same registry within a session.
|
|
19
|
-
*/
|
|
20
|
-
function getSymlinkRegistry(vfs) {
|
|
21
|
-
const v = vfs;
|
|
22
|
-
if (!v.__nimbus_symlink_registry) {
|
|
23
|
-
v.__nimbus_symlink_registry = new SymlinkRegistry(vfs);
|
|
24
|
-
}
|
|
25
|
-
return v.__nimbus_symlink_registry;
|
|
15
|
+
function isRuntimeInstallHintHandler(handler) {
|
|
16
|
+
return !!handler && !!handler.__nimbusRuntimeInstallHint;
|
|
26
17
|
}
|
|
27
18
|
// ── Helpers ─────────────────────────────────────────────────────────────
|
|
28
19
|
function resolvePath(cwd, p) {
|
|
@@ -115,8 +106,13 @@ const _CANONICAL_BIN_PATHS = {
|
|
|
115
106
|
git: '/usr/bin/git',
|
|
116
107
|
python: '/usr/bin/python3',
|
|
117
108
|
python3: '/usr/bin/python3',
|
|
109
|
+
pip: '/usr/bin/pip',
|
|
110
|
+
pip3: '/usr/bin/pip3',
|
|
118
111
|
ruby: '/usr/bin/ruby',
|
|
119
112
|
ruby3: '/usr/bin/ruby',
|
|
113
|
+
gem: '/usr/bin/gem',
|
|
114
|
+
bundle: '/usr/bin/bundle',
|
|
115
|
+
bundler: '/usr/bin/bundler',
|
|
120
116
|
sh: '/usr/bin/sh',
|
|
121
117
|
bash: '/usr/bin/bash',
|
|
122
118
|
// Framework CLIs
|
|
@@ -134,12 +130,7 @@ const _CANONICAL_BIN_PATHS = {
|
|
|
134
130
|
// Self
|
|
135
131
|
nimbus: '/usr/local/bin/nimbus',
|
|
136
132
|
};
|
|
137
|
-
|
|
138
|
-
* fallback. Returns null if not findable. Skip-canonical when the
|
|
139
|
-
* caller knows the command is a shell builtin (no fallback). */
|
|
140
|
-
function _whichLookup(vfs, name, envPath) {
|
|
141
|
-
// 1. Real on-disk binary in $PATH (npm-installed node_modules/.bin,
|
|
142
|
-
// user-placed scripts, etc.).
|
|
133
|
+
function _pathLookup(vfs, name, envPath) {
|
|
143
134
|
const paths = (envPath || '/usr/local/bin:/usr/bin:/bin').split(':');
|
|
144
135
|
for (const dir of paths) {
|
|
145
136
|
if (!dir)
|
|
@@ -150,12 +141,36 @@ function _whichLookup(vfs, name, envPath) {
|
|
|
150
141
|
return '/' + fp;
|
|
151
142
|
}
|
|
152
143
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
async function _registryResolved(registry, name, options = {}) {
|
|
147
|
+
try {
|
|
148
|
+
const resolved = typeof registry.resolve === 'function'
|
|
149
|
+
? await registry.resolve(name)
|
|
150
|
+
: null;
|
|
151
|
+
if (resolved && (options.includeInstallHints || !isRuntimeInstallHintHandler(resolved))) {
|
|
152
|
+
return resolved;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// Registry misses are normal for unknown commands.
|
|
156
157
|
}
|
|
157
158
|
return null;
|
|
158
159
|
}
|
|
160
|
+
/** Resolve a command name to a path via PATH-walk + canonical-bin
|
|
161
|
+
* fallback. Returns null if not findable. Skip-canonical when the
|
|
162
|
+
* caller knows the command is a shell builtin (no fallback). */
|
|
163
|
+
async function _whichLookup(vfs, registry, name, envPath) {
|
|
164
|
+
const diskPath = _pathLookup(vfs, name, envPath);
|
|
165
|
+
if (diskPath)
|
|
166
|
+
return diskPath;
|
|
167
|
+
const canonicalPath = _CANONICAL_BIN_PATHS[name];
|
|
168
|
+
if (!canonicalPath)
|
|
169
|
+
return null;
|
|
170
|
+
return await _registryResolved(registry, name, { includeInstallHints: true })
|
|
171
|
+
? canonicalPath
|
|
172
|
+
: null;
|
|
173
|
+
}
|
|
159
174
|
function mkWhich(vfs, registry) {
|
|
160
175
|
return async (ctx) => {
|
|
161
176
|
// Parse flags. Supports -a (show all matches), -s (silent — no
|
|
@@ -191,16 +206,10 @@ function mkWhich(vfs, registry) {
|
|
|
191
206
|
let anyMissing = false;
|
|
192
207
|
for (const name of names) {
|
|
193
208
|
// Classify: is it a registry-resolvable command (shell builtin)?
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const resolved = typeof registry.resolve === 'function'
|
|
197
|
-
? await registry.resolve(name)
|
|
198
|
-
: null;
|
|
199
|
-
isBuiltin = !!resolved;
|
|
200
|
-
}
|
|
201
|
-
catch { /* registry unavailable; treat as not-builtin */ }
|
|
209
|
+
const resolved = await _registryResolved(registry, name);
|
|
210
|
+
const isBuiltin = !!resolved;
|
|
202
211
|
// 1. PATH-walk + canonical-bin lookup.
|
|
203
|
-
const path = _whichLookup(vfs, name, ctx.env.PATH || '');
|
|
212
|
+
const path = await _whichLookup(vfs, registry, name, ctx.env.PATH || '');
|
|
204
213
|
let found = false;
|
|
205
214
|
if (path) {
|
|
206
215
|
if (!silent)
|
|
@@ -235,15 +244,15 @@ function mkWhich(vfs, registry) {
|
|
|
235
244
|
* binaries on the virtual VFS; print just the binary path. With no
|
|
236
245
|
* match, print just the name (matches `whereis` behavior on missing).
|
|
237
246
|
*/
|
|
238
|
-
function mkWhereis(vfs) {
|
|
239
|
-
return (ctx) => {
|
|
247
|
+
function mkWhereis(vfs, registry) {
|
|
248
|
+
return async (ctx) => {
|
|
240
249
|
const names = ctx.args.filter(a => !a.startsWith('-'));
|
|
241
250
|
if (names.length === 0) {
|
|
242
251
|
ctx.stderr.write('Usage: whereis name [name ...]\n');
|
|
243
252
|
return 1;
|
|
244
253
|
}
|
|
245
254
|
for (const name of names) {
|
|
246
|
-
const path = _whichLookup(vfs, name, ctx.env.PATH || '');
|
|
255
|
+
const path = await _whichLookup(vfs, registry, name, ctx.env.PATH || '');
|
|
247
256
|
if (path) {
|
|
248
257
|
ctx.stdout.write(`${name}: ${path}\n`);
|
|
249
258
|
}
|
|
@@ -290,36 +299,28 @@ function mkCommand(vfs, registry) {
|
|
|
290
299
|
if (mode === '-v') {
|
|
291
300
|
// Print path or builtin marker; exit 0 if found.
|
|
292
301
|
const name = args[0];
|
|
293
|
-
const path = _whichLookup(vfs, name, ctx.env.PATH || '');
|
|
302
|
+
const path = await _whichLookup(vfs, registry, name, ctx.env.PATH || '');
|
|
294
303
|
if (path) {
|
|
295
304
|
ctx.stdout.write(path + '\n');
|
|
296
305
|
return 0;
|
|
297
306
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
ctx.stdout.write(name + '\n');
|
|
302
|
-
return 0;
|
|
303
|
-
}
|
|
307
|
+
if (await _registryResolved(registry, name)) {
|
|
308
|
+
ctx.stdout.write(name + '\n');
|
|
309
|
+
return 0;
|
|
304
310
|
}
|
|
305
|
-
catch { /* registry miss */ }
|
|
306
311
|
return 1;
|
|
307
312
|
}
|
|
308
313
|
if (mode === '-V') {
|
|
309
314
|
const name = args[0];
|
|
310
|
-
const path = _whichLookup(vfs, name, ctx.env.PATH || '');
|
|
315
|
+
const path = await _whichLookup(vfs, registry, name, ctx.env.PATH || '');
|
|
311
316
|
if (path) {
|
|
312
317
|
ctx.stdout.write(`${name} is ${path}\n`);
|
|
313
318
|
return 0;
|
|
314
319
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
ctx.stdout.write(`${name} is a shell builtin\n`);
|
|
319
|
-
return 0;
|
|
320
|
-
}
|
|
320
|
+
if (await _registryResolved(registry, name)) {
|
|
321
|
+
ctx.stdout.write(`${name} is a shell builtin\n`);
|
|
322
|
+
return 0;
|
|
321
323
|
}
|
|
322
|
-
catch { /* miss */ }
|
|
323
324
|
ctx.stderr.write(`command: ${name}: not found\n`);
|
|
324
325
|
return 1;
|
|
325
326
|
}
|
|
@@ -368,7 +369,7 @@ function mkType(_vfs, registry) {
|
|
|
368
369
|
for (const name of ctx.args) {
|
|
369
370
|
try {
|
|
370
371
|
const resolved = typeof registry.resolve === 'function' ? await registry.resolve(name) : null;
|
|
371
|
-
if (resolved) {
|
|
372
|
+
if (resolved && !isRuntimeInstallHintHandler(resolved)) {
|
|
372
373
|
ctx.stdout.write(`${name} is a shell builtin\n`);
|
|
373
374
|
}
|
|
374
375
|
else {
|
|
@@ -3517,7 +3518,7 @@ function wrap(fn) {
|
|
|
3517
3518
|
}
|
|
3518
3519
|
export function registerUnixCommands(registry, vfs) {
|
|
3519
3520
|
registry.register('which', wrap(mkWhich(vfs, registry)));
|
|
3520
|
-
registry.register('whereis', wrap(mkWhereis(vfs)));
|
|
3521
|
+
registry.register('whereis', wrap(mkWhereis(vfs, registry)));
|
|
3521
3522
|
registry.register('command', wrap(mkCommand(vfs, registry)));
|
|
3522
3523
|
registry.register('type', wrap(mkType(vfs, registry)));
|
|
3523
3524
|
registry.register('env', wrap(mkEnv()));
|
package/dist/vfs/path.d.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* before pop) that the others lacked — that safer behavior is the one
|
|
8
8
|
* preserved here.
|
|
9
9
|
*
|
|
10
|
-
* Facet-isolate code-string copies (
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* Facet-isolate code-string copies (for example git-network-facet,
|
|
11
|
+
* pre-bundle-facet, and node-shims generated/runtime strings) cannot import
|
|
12
|
+
* this module and must keep their inline implementations; those copies are
|
|
13
|
+
* documented as justified.
|
|
14
14
|
*
|
|
15
15
|
* Semantics:
|
|
16
16
|
* - Strip empty segments (collapses `//` runs)
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
* normalizeVfsPath('../escape') -> 'escape' (bounded; doesn't go negative)
|
|
26
26
|
*/
|
|
27
27
|
export declare function normalizeVfsPath(p: string): string;
|
|
28
|
+
/** Resolve a user path against a VFS cwd and return a canonical VFS key. */
|
|
29
|
+
export declare function resolveVfsPath(path: string, cwd: string): string;
|
|
30
|
+
/** Return the canonical VFS parent key, or an empty string for root-level paths. */
|
|
31
|
+
export declare function parentVfsPath(path: string): string;
|
|
28
32
|
/** Strip leading slashes only — does not touch internal segments. */
|
|
29
33
|
export declare function stripLeadingSlashes(p: string): string;
|
|
30
34
|
//# sourceMappingURL=path.d.ts.map
|
package/dist/vfs/path.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/vfs/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/vfs/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhE;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIlD;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
package/dist/vfs/path.js
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* before pop) that the others lacked — that safer behavior is the one
|
|
8
8
|
* preserved here.
|
|
9
9
|
*
|
|
10
|
-
* Facet-isolate code-string copies (
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* Facet-isolate code-string copies (for example git-network-facet,
|
|
11
|
+
* pre-bundle-facet, and node-shims generated/runtime strings) cannot import
|
|
12
|
+
* this module and must keep their inline implementations; those copies are
|
|
13
|
+
* documented as justified.
|
|
14
14
|
*
|
|
15
15
|
* Semantics:
|
|
16
16
|
* - Strip empty segments (collapses `//` runs)
|
|
@@ -35,6 +35,18 @@ export function normalizeVfsPath(p) {
|
|
|
35
35
|
}
|
|
36
36
|
return out.join('/');
|
|
37
37
|
}
|
|
38
|
+
/** Resolve a user path against a VFS cwd and return a canonical VFS key. */
|
|
39
|
+
export function resolveVfsPath(path, cwd) {
|
|
40
|
+
return path.startsWith('/')
|
|
41
|
+
? normalizeVfsPath(path)
|
|
42
|
+
: normalizeVfsPath(`${cwd}/${path}`);
|
|
43
|
+
}
|
|
44
|
+
/** Return the canonical VFS parent key, or an empty string for root-level paths. */
|
|
45
|
+
export function parentVfsPath(path) {
|
|
46
|
+
const clean = normalizeVfsPath(path);
|
|
47
|
+
const idx = clean.lastIndexOf('/');
|
|
48
|
+
return idx > 0 ? clean.slice(0, idx) : '';
|
|
49
|
+
}
|
|
38
50
|
/** Strip leading slashes only — does not touch internal segments. */
|
|
39
51
|
export function stripLeadingSlashes(p) {
|
|
40
52
|
return p.replace(/^\/+/, '');
|
package/dist/vfs/sqlite-vfs.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ export declare class SqliteVFS {
|
|
|
82
82
|
private _totalFiles;
|
|
83
83
|
private _totalDirs;
|
|
84
84
|
private _usedBytes;
|
|
85
|
+
private _revision;
|
|
85
86
|
private pendingWrites;
|
|
86
87
|
/**
|
|
87
88
|
* Sum of `data.length` across pendingWrites entries. Maintained
|
|
@@ -238,6 +239,7 @@ export declare class SqliteVFS {
|
|
|
238
239
|
exists(path: string): boolean;
|
|
239
240
|
isDirectory(path: string): boolean;
|
|
240
241
|
isFile(path: string): boolean;
|
|
242
|
+
revision(): number;
|
|
241
243
|
mkdir(path: string, options?: {
|
|
242
244
|
recursive?: boolean;
|
|
243
245
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-vfs.d.ts","sourceRoot":"","sources":["../../src/vfs/sqlite-vfs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EAAE,eAAe,EAAqB,MAAM,aAAa,CAAC;AAyBjE,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,sDAAsD;A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,EAAE,MAAM,GAAG,UAAU;IACjC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAEnC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAO1D,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAC5B,IAAI,CAAC,GAAG,EAAE,MAAM;cAxvBY,MAAM;cAAQ,MAAM;eAAS,MAAM;eAAS,MAAM;cAAQ,MAAM;;IAyvB5F,OAAO,CAAC,GAAG,EAAE,MAAM;cA7uBY,MAAM;cAAQ,MAAM;;IA8uBnD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAEzB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAIxD,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IACxB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAClC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;CACrC"}
|
package/dist/vfs/sqlite-vfs.js
CHANGED
|
@@ -88,6 +88,7 @@ export class SqliteVFS {
|
|
|
88
88
|
_totalFiles = 0;
|
|
89
89
|
_totalDirs = 0;
|
|
90
90
|
_usedBytes = 0;
|
|
91
|
+
_revision = 0;
|
|
91
92
|
// ── Deferred write queue (do86 pattern) ───────────────────────────────
|
|
92
93
|
pendingWrites = new Map();
|
|
93
94
|
/**
|
|
@@ -783,6 +784,9 @@ export class SqliteVFS {
|
|
|
783
784
|
const inode = this.inodes.get(path);
|
|
784
785
|
return inode !== undefined && !inode.isDir;
|
|
785
786
|
}
|
|
787
|
+
revision() {
|
|
788
|
+
return this._revision;
|
|
789
|
+
}
|
|
786
790
|
mkdir(path, options) {
|
|
787
791
|
if (this.exists(path))
|
|
788
792
|
return;
|
|
@@ -808,6 +812,7 @@ export class SqliteVFS {
|
|
|
808
812
|
this.inodes.set(path, inode);
|
|
809
813
|
this._addToChildrenIndex(pp, path);
|
|
810
814
|
this._totalDirs++; // B3
|
|
815
|
+
this._revision++;
|
|
811
816
|
this.events.emit('addDir', path);
|
|
812
817
|
}
|
|
813
818
|
writeFile(path, content) {
|
|
@@ -890,6 +895,7 @@ export class SqliteVFS {
|
|
|
890
895
|
this.deferWrite(path, i, chunk);
|
|
891
896
|
}
|
|
892
897
|
}
|
|
898
|
+
this._revision++;
|
|
893
899
|
this.events.emit(isNew ? 'add' : 'change', path);
|
|
894
900
|
}
|
|
895
901
|
readFile(path) {
|
|
@@ -1013,6 +1019,7 @@ export class SqliteVFS {
|
|
|
1013
1019
|
}
|
|
1014
1020
|
}
|
|
1015
1021
|
this.inodes.delete(path);
|
|
1022
|
+
this._revision++;
|
|
1016
1023
|
this.events.emit('unlink', path);
|
|
1017
1024
|
}
|
|
1018
1025
|
rmdir(path) {
|
|
@@ -1037,6 +1044,7 @@ export class SqliteVFS {
|
|
|
1037
1044
|
}
|
|
1038
1045
|
this.inodes.delete(np);
|
|
1039
1046
|
this.children.delete(np); // Remove empty children set
|
|
1047
|
+
this._revision++;
|
|
1040
1048
|
this.events.emit('unlinkDir', np);
|
|
1041
1049
|
}
|
|
1042
1050
|
rename(oldPath, newPath) {
|
|
@@ -1117,6 +1125,7 @@ export class SqliteVFS {
|
|
|
1117
1125
|
this._addToChildrenIndex(ncpp, ncp);
|
|
1118
1126
|
}
|
|
1119
1127
|
}
|
|
1128
|
+
this._revision++;
|
|
1120
1129
|
this.events.emit('rename', newPath, oldPath);
|
|
1121
1130
|
}
|
|
1122
1131
|
copyFile(src, dest) {
|
|
@@ -1509,6 +1518,8 @@ export class SqliteVFS {
|
|
|
1509
1518
|
this._sqlWrites += inodeCount + chunkCount;
|
|
1510
1519
|
this._batchWrites++;
|
|
1511
1520
|
this._batchWriteRows += inodeCount + chunkCount;
|
|
1521
|
+
if (inodeCount > 0 || chunkCount > 0 || payload.deletePaths?.length)
|
|
1522
|
+
this._revision++;
|
|
1512
1523
|
return { inodes: inodeCount, chunks: chunkCount };
|
|
1513
1524
|
}
|
|
1514
1525
|
/**
|
|
@@ -33,7 +33,7 @@ export declare class SymlinkRegistry {
|
|
|
33
33
|
private load;
|
|
34
34
|
/** Write the cache back to the registry file. */
|
|
35
35
|
private flush;
|
|
36
|
-
/** Normalize a path
|
|
36
|
+
/** Normalize a path to the VFS internal key convention. */
|
|
37
37
|
private norm;
|
|
38
38
|
/** Create or replace a symlink. Target is stored verbatim (can be
|
|
39
39
|
* absolute or relative — interpretation happens at resolve time). */
|
|
@@ -61,4 +61,10 @@ export declare class SymlinkRegistry {
|
|
|
61
61
|
target: string;
|
|
62
62
|
}[];
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Return the session-wide registry for a VFS instance. The registry has an
|
|
66
|
+
* in-memory cache, so all runtime surfaces that share one SqliteVFS must also
|
|
67
|
+
* share the registry instance to avoid stale symlink reads.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getSymlinkRegistry(vfs: SqliteVFS): SymlinkRegistry;
|
|
64
70
|
//# sourceMappingURL=symlink-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symlink-registry.d.ts","sourceRoot":"","sources":["../../src/vfs/symlink-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"symlink-registry.d.ts","sourceRoot":"","sources":["../../src/vfs/symlink-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKjD,qBAAa,eAAe;IAC1B,OAAO,CAAC,GAAG,CAAY;IACvB,OAAO,CAAC,KAAK,CAAoC;gBAErC,GAAG,EAAE,SAAS;IAI1B,wCAAwC;IACxC,OAAO,CAAC,IAAI;IAgBZ,iDAAiD;IACjD,OAAO,CAAC,KAAK;IASb,2DAA2D;IAC3D,OAAO,CAAC,IAAI;IAIZ;0EACsE;IACtE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAM3C,oDAAoD;IACpD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAOjC,wEAAwE;IACxE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIhC,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKrC;;;;;;;;;OASG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAiB9C,2EAA2E;IAC3E,IAAI,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE;CAO3C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS,GAAG,eAAe,CAMlE"}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* Loop guard: `resolveSymlinkChain` follows at most 40 hops (matches
|
|
25
25
|
* POSIX SYMLOOP_MAX).
|
|
26
26
|
*/
|
|
27
|
+
import { normalizeVfsPath } from './path.js';
|
|
27
28
|
const REGISTRY_PATH = '.nimbus-symlinks.json';
|
|
28
29
|
export class SymlinkRegistry {
|
|
29
30
|
vfs;
|
|
@@ -62,9 +63,9 @@ export class SymlinkRegistry {
|
|
|
62
63
|
}
|
|
63
64
|
catch { /* fail-soft */ }
|
|
64
65
|
}
|
|
65
|
-
/** Normalize a path
|
|
66
|
+
/** Normalize a path to the VFS internal key convention. */
|
|
66
67
|
norm(p) {
|
|
67
|
-
return p
|
|
68
|
+
return normalizeVfsPath(p);
|
|
68
69
|
}
|
|
69
70
|
/** Create or replace a symlink. Target is stored verbatim (can be
|
|
70
71
|
* absolute or relative — interpretation happens at resolve time). */
|
|
@@ -112,15 +113,7 @@ export class SymlinkRegistry {
|
|
|
112
113
|
else {
|
|
113
114
|
// Relative target: resolve from symlink's parent dir.
|
|
114
115
|
const parent = cur.includes('/') ? cur.substring(0, cur.lastIndexOf('/')) : '';
|
|
115
|
-
|
|
116
|
-
const out = [];
|
|
117
|
-
for (const s of parts) {
|
|
118
|
-
if (s === '..')
|
|
119
|
-
out.pop();
|
|
120
|
-
else if (s !== '.' && s !== '')
|
|
121
|
-
out.push(s);
|
|
122
|
-
}
|
|
123
|
-
cur = out.join('/');
|
|
116
|
+
cur = normalizeVfsPath(`${parent}/${target}`);
|
|
124
117
|
}
|
|
125
118
|
}
|
|
126
119
|
// ELOOP
|
|
@@ -135,3 +128,15 @@ export class SymlinkRegistry {
|
|
|
135
128
|
return out;
|
|
136
129
|
}
|
|
137
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Return the session-wide registry for a VFS instance. The registry has an
|
|
133
|
+
* in-memory cache, so all runtime surfaces that share one SqliteVFS must also
|
|
134
|
+
* share the registry instance to avoid stale symlink reads.
|
|
135
|
+
*/
|
|
136
|
+
export function getSymlinkRegistry(vfs) {
|
|
137
|
+
const owner = vfs;
|
|
138
|
+
if (!owner.__nimbus_symlink_registry) {
|
|
139
|
+
owner.__nimbus_symlink_registry = new SymlinkRegistry(vfs);
|
|
140
|
+
}
|
|
141
|
+
return owner.__nimbus_symlink_registry;
|
|
142
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimbus-sh/worker",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Nimbus runtime package for Cloudflare Workers, re-exported publicly through @nimbus-sh/sdk/worker.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"dist",
|
|
47
47
|
"public",
|
|
48
48
|
"scripts",
|
|
49
|
+
"runtime-contracts",
|
|
49
50
|
"README.md",
|
|
50
51
|
"LICENSE",
|
|
51
52
|
"NOTICE.md"
|
|
@@ -61,7 +62,9 @@
|
|
|
61
62
|
"typecheck": "tsc --noEmit"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
65
|
+
"@ai-sdk/openai-compatible": "^2.0.41",
|
|
64
66
|
"@lifo-sh/core": "^0.5.5",
|
|
67
|
+
"ai": "^6.0.182",
|
|
65
68
|
"clean-git-ref": "^2.0.1",
|
|
66
69
|
"crc-32": "^1.2.2",
|
|
67
70
|
"diff": "^9.0.0",
|