@nimbus-sh/worker 0.1.1 → 0.1.3
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/LICENSE +21 -0
- package/NOTICE.md +6 -0
- package/README.md +38 -3
- package/dist/_shared/cache-stats.d.ts +1 -1
- package/dist/_shared/cache-stats.js +1 -1
- package/dist/_shared/exports-resolver.d.ts +0 -2
- package/dist/_shared/exports-resolver.d.ts.map +1 -1
- package/dist/_shared/exports-resolver.js +0 -2
- package/dist/_shared/session-id.d.ts +10 -8
- package/dist/_shared/session-id.d.ts.map +1 -1
- package/dist/_shared/session-id.js +13 -12
- package/dist/_shared/session-router.d.ts +0 -1
- package/dist/_shared/session-router.d.ts.map +1 -1
- package/dist/_shared/session-router.js +0 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/types.d.ts +2 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js +4 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -1
- package/dist/facets/cirrus-real.d.ts +1 -1
- package/dist/facets/cirrus-real.js +1 -1
- package/dist/facets/manager.d.ts +0 -1
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +3 -15
- package/dist/facets/process.d.ts +2 -2
- package/dist/facets/process.js +2 -2
- package/dist/facets/vite-dev-server.d.ts +3 -3
- package/dist/facets/vite-dev-server.d.ts.map +1 -1
- package/dist/facets/vite-dev-server.js +6 -8
- package/dist/facets/wasm-swap-registry.d.ts +15 -21
- package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
- package/dist/facets/wasm-swap-registry.js +41 -54
- package/dist/facets/ws-terminal.d.ts +4 -5
- package/dist/facets/ws-terminal.d.ts.map +1 -1
- package/dist/facets/ws-terminal.js +7 -8
- package/dist/git/commands.d.ts.map +1 -1
- package/dist/git/commands.js +0 -1
- package/dist/git/network-facet.d.ts.map +1 -1
- package/dist/git/network-facet.js +0 -2
- package/dist/git-bundle.generated.d.ts +0 -1
- package/dist/git-bundle.generated.d.ts.map +1 -1
- package/dist/git-bundle.generated.js +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-facet.d.ts +7 -52
- package/dist/loaders/child-process/spawn-facet.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-facet.js +7 -49
- package/dist/loaders/child-process/spawn-pool.d.ts +5 -44
- package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-pool.js +5 -44
- package/dist/loaders/fanout-pool.d.ts +18 -65
- package/dist/loaders/fanout-pool.d.ts.map +1 -1
- package/dist/loaders/fanout-pool.js +25 -87
- package/dist/loaders/generated-workers.d.ts +1 -2
- package/dist/loaders/generated-workers.d.ts.map +1 -1
- package/dist/loaders/generated-workers.js +3 -4
- package/dist/loaders/loader-pool.d.ts +1 -2
- package/dist/loaders/loader-pool.d.ts.map +1 -1
- package/dist/loaders/loader-pool.js +1 -1
- package/dist/loaders/npm-resolve-preamble.d.ts +4 -5
- package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
- package/dist/loaders/npm-resolve-preamble.js +14 -21
- package/dist/loaders/pre-bundle-preamble.d.ts.map +1 -1
- package/dist/loaders/pre-bundle-preamble.js +0 -1
- package/dist/npm/cache.js +1 -1
- package/dist/npm/install-batch-facet.d.ts.map +1 -1
- package/dist/npm/install-batch-facet.js +7 -12
- package/dist/npm/installer.d.ts +5 -7
- package/dist/npm/installer.d.ts.map +1 -1
- package/dist/npm/installer.js +20 -101
- package/dist/npm/r2-cache.d.ts +17 -29
- package/dist/npm/r2-cache.d.ts.map +1 -1
- package/dist/npm/r2-cache.js +16 -27
- package/dist/npm/resolve-facet.d.ts +11 -17
- package/dist/npm/resolve-facet.d.ts.map +1 -1
- package/dist/npm/resolve-facet.js +14 -28
- package/dist/npm/resolve-one-facet.d.ts +10 -13
- package/dist/npm/resolve-one-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.js +8 -10
- package/dist/npm/resolver.d.ts +0 -2
- package/dist/npm/resolver.d.ts.map +1 -1
- package/dist/npm/resolver.js +0 -12
- package/dist/observability/oom-discriminator.d.ts +0 -2
- package/dist/observability/oom-discriminator.d.ts.map +1 -1
- package/dist/observability/oom-discriminator.js +0 -2
- package/dist/replica/routing.js +1 -1
- package/dist/router/index.d.ts +6 -2
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +4 -0
- package/dist/router/remote-api.d.ts +44 -0
- package/dist/router/remote-api.d.ts.map +1 -0
- package/dist/router/remote-api.js +333 -0
- package/dist/runtime/barrel-synthesizer.js +1 -1
- package/dist/runtime/clang-runner.d.ts +5 -6
- package/dist/runtime/clang-runner.d.ts.map +1 -1
- package/dist/runtime/clang-runner.js +5 -6
- package/dist/runtime/esbuild-service.d.ts.map +1 -1
- package/dist/runtime/esbuild-service.js +0 -3
- package/dist/runtime/framework-detect.d.ts +0 -1
- package/dist/runtime/framework-detect.d.ts.map +1 -1
- package/dist/runtime/framework-detect.js +0 -1
- package/dist/runtime/node-runner.d.ts +1 -1
- package/dist/runtime/node-runner.js +1 -1
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +0 -22
- package/dist/runtime/package-manager.d.ts +2 -7
- package/dist/runtime/package-manager.d.ts.map +1 -1
- package/dist/runtime/package-manager.js +2 -7
- package/dist/runtime/process-logs-api.js +1 -1
- package/dist/runtime/process-logs.d.ts +0 -1
- package/dist/runtime/process-logs.d.ts.map +1 -1
- package/dist/runtime/process-table.d.ts +2 -2
- package/dist/runtime/process-table.d.ts.map +1 -1
- package/dist/runtime/process-table.js +1 -1
- package/dist/runtime/python-repl.d.ts +0 -1
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +0 -1
- package/dist/runtime/python-runner.d.ts +1 -2
- package/dist/runtime/python-runner.d.ts.map +1 -1
- package/dist/runtime/python-runner.js +1 -3
- package/dist/runtime/repl-session.d.ts +0 -1
- package/dist/runtime/repl-session.d.ts.map +1 -1
- package/dist/runtime/repl-session.js +1 -2
- package/dist/runtime/require-resolver.d.ts.map +1 -1
- package/dist/runtime/require-resolver.js +1 -4
- package/dist/runtime/ruby-runner.d.ts +0 -1
- package/dist/runtime/ruby-runner.d.ts.map +1 -1
- package/dist/runtime/ruby-runner.js +0 -1
- package/dist/runtime/runtime-catalog.d.ts +2 -4
- package/dist/runtime/runtime-catalog.d.ts.map +1 -1
- package/dist/runtime/runtime-catalog.js +2 -4
- package/dist/runtime/runtime-registry.d.ts +1 -1
- package/dist/runtime/runtime-registry.js +1 -1
- package/dist/runtime/streams.d.ts.map +1 -1
- package/dist/runtime/streams.js +0 -1
- package/dist/runtime/wasi-instance.d.ts +35 -45
- package/dist/runtime/wasi-instance.d.ts.map +1 -1
- package/dist/runtime/wasi-instance.js +87 -103
- package/dist/runtime/wasm-runner.d.ts +9 -15
- package/dist/runtime/wasm-runner.d.ts.map +1 -1
- package/dist/runtime/wasm-runner.js +23 -29
- package/dist/session/bindings.d.ts +2 -7
- package/dist/session/bindings.d.ts.map +1 -1
- package/dist/session/bindings.js +3 -8
- package/dist/session/helpers.d.ts +2 -9
- package/dist/session/helpers.d.ts.map +1 -1
- package/dist/session/helpers.js +2 -10
- package/dist/session/init.d.ts +3 -6
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +25 -30
- package/dist/session/nimbus-session.d.ts +1 -1
- package/dist/session/nimbus-session.js +5 -5
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +9 -16
- package/dist/session/rpc.d.ts +2 -2
- package/dist/session/rpc.js +6 -6
- package/dist/session/supervisor-rpc.d.ts +1 -2
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +1 -5
- package/dist/shell/features.d.ts +5 -5
- package/dist/shell/features.js +6 -6
- package/dist/shell/unix-commands.js +15 -15
- package/dist/vfs/dev-provider.d.ts +1 -1
- package/dist/vfs/dev-provider.js +1 -1
- package/dist/vfs/sqlite-vfs.d.ts +3 -3
- package/dist/vfs/sqlite-vfs.d.ts.map +1 -1
- package/dist/vfs/sqlite-vfs.js +10 -11
- package/package.json +13 -2
- package/public/s/index.html +44 -75
- package/scripts/bundle-facet-workers.mjs +1 -1
- package/scripts/bundle-git.mjs +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ashish Kumar Singh and Nimbus contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Notices
|
|
2
|
+
|
|
3
|
+
This package is part of Nimbus. It includes the Worker runtime, generated
|
|
4
|
+
browser assets, runtime packaging scripts, and integration code for third-party
|
|
5
|
+
runtime components. See the project notices at
|
|
6
|
+
https://github.com/AshishKumar4/Nimbus/blob/main/NOTICE.md.
|
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
CirrusHmrRPC,
|
|
33
33
|
createNimbusHandler,
|
|
34
34
|
} from '@nimbus-sh/sdk/worker';
|
|
35
|
+
import { defineNimbusConfig } from '@nimbus-sh/config';
|
|
35
36
|
|
|
36
37
|
// Re-export the DO + every RPC class so wrangler's `class_name` lookup +
|
|
37
38
|
// `enable_ctx_exports` find them in your Worker's main-module exports.
|
|
@@ -47,7 +48,22 @@ export {
|
|
|
47
48
|
CirrusHmrRPC,
|
|
48
49
|
};
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
const nimbusConfig = defineNimbusConfig({
|
|
52
|
+
sandboxes: {
|
|
53
|
+
default: {
|
|
54
|
+
root: '/home/user',
|
|
55
|
+
runtimes: { preinstall: ['python'], onDemand: true },
|
|
56
|
+
tools: { namespace: 'sandbox', kind: 'sandbox' },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export default createNimbusHandler({
|
|
62
|
+
sdk: {
|
|
63
|
+
remote: true,
|
|
64
|
+
config: nimbusConfig,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
51
67
|
```
|
|
52
68
|
|
|
53
69
|
`wrangler.jsonc` (use `@nimbus-sh/config` to generate, or adapt
|
|
@@ -63,7 +79,7 @@ export default createNimbusHandler();
|
|
|
63
79
|
"assets": {
|
|
64
80
|
"directory": "node_modules/@nimbus-sh/worker/public",
|
|
65
81
|
"binding": "ASSETS",
|
|
66
|
-
"run_worker_first": ["/s/*", "/new"]
|
|
82
|
+
"run_worker_first": ["/api/*", "/s/*", "/new"]
|
|
67
83
|
},
|
|
68
84
|
"alias": {
|
|
69
85
|
"@lifo-sh/ui": "./node_modules/@nimbus-sh/worker/dist/stubs/lifo-ui.js",
|
|
@@ -117,6 +133,10 @@ possession instead.
|
|
|
117
133
|
onSessionEnd?: (ctx) => void | Promise<void>; // reserved v0.2
|
|
118
134
|
};
|
|
119
135
|
routes?: (request, env, ctx) => Response | null | Promise<Response | null>;
|
|
136
|
+
sdk?: {
|
|
137
|
+
remote?: boolean | { enabled?: boolean; basePath?: string; allowLegacy?: boolean };
|
|
138
|
+
config?: NimbusConfig;
|
|
139
|
+
};
|
|
120
140
|
}
|
|
121
141
|
```
|
|
122
142
|
|
|
@@ -144,7 +164,7 @@ export default createNimbusHandler({
|
|
|
144
164
|
Programmatic sandbox route:
|
|
145
165
|
|
|
146
166
|
```ts
|
|
147
|
-
import { Nimbus } from '@nimbus-sh/sdk
|
|
167
|
+
import { Nimbus } from '@nimbus-sh/sdk';
|
|
148
168
|
|
|
149
169
|
export default createNimbusHandler({
|
|
150
170
|
routes: async (req, env) => {
|
|
@@ -171,6 +191,21 @@ export default createNimbusHandler({
|
|
|
171
191
|
});
|
|
172
192
|
```
|
|
173
193
|
|
|
194
|
+
Remote SDK API:
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
export default createNimbusHandler({
|
|
198
|
+
sdk: {
|
|
199
|
+
remote: true,
|
|
200
|
+
config: nimbusConfig,
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Remote calls use `POST /api/nimbus/v1/sandboxes/<id>/rpc` internally.
|
|
206
|
+
Applications normally call it through `Nimbus.connect({ endpoint, token,
|
|
207
|
+
config })`. The route requires a valid Nimbus JWT and `sandbox:use` scope.
|
|
208
|
+
|
|
174
209
|
For long-running app servers, start an explicit long-running process and
|
|
175
210
|
expose the virtual port:
|
|
176
211
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* L3 — R2 (cross-tenant global) ~30-100 ms regional
|
|
11
11
|
* L4 — registry.npmjs.org origin ~100-300 ms cross-region
|
|
12
12
|
*
|
|
13
|
-
* Pre-cache
|
|
13
|
+
* Pre-cache metrics support: hit/miss counters lived in
|
|
14
14
|
* src/observability/diag-counters.ts but only tracked the RPC-call
|
|
15
15
|
* boundary (`r2.tarballHit`, `r2.packumentMiss`), not per-tier. From
|
|
16
16
|
* prod we couldn't tell whether L2 hit-rate was 90% or 30%.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* L3 — R2 (cross-tenant global) ~30-100 ms regional
|
|
11
11
|
* L4 — registry.npmjs.org origin ~100-300 ms cross-region
|
|
12
12
|
*
|
|
13
|
-
* Pre-cache
|
|
13
|
+
* Pre-cache metrics support: hit/miss counters lived in
|
|
14
14
|
* src/observability/diag-counters.ts but only tracked the RPC-call
|
|
15
15
|
* boundary (`r2.tarballHit`, `r2.packumentMiss`), not per-tier. From
|
|
16
16
|
* prod we couldn't tell whether L2 hit-rate was 90% or 30%.
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
* the same JS source so `require()` from inside a user's `node` script
|
|
16
16
|
* sees the same exports map as the install pipeline.
|
|
17
17
|
*
|
|
18
|
-
* Audit reference: audit/sections/03-resolver-gaps.md §3.1, §3.2.
|
|
19
18
|
*
|
|
20
19
|
* Spec features supported:
|
|
21
20
|
* - String shorthand: "exports": "./dist/index.mjs"
|
|
@@ -70,7 +69,6 @@ export declare function resolvePackageEntry(pkg: {
|
|
|
70
69
|
*
|
|
71
70
|
* This source must be byte-equivalent to the TS impl above (modulo type
|
|
72
71
|
* annotations and `export` keywords). Keep them in sync — there is one
|
|
73
|
-
* verification probe in audit/probes that compares parity.
|
|
74
72
|
*/
|
|
75
73
|
export declare function getExportsResolverJS(): string;
|
|
76
74
|
//# sourceMappingURL=exports-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports-resolver.d.ts","sourceRoot":"","sources":["../../src/_shared/exports-resolver.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"exports-resolver.d.ts","sourceRoot":"","sources":["../../src/_shared/exports-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,UAA6C,CAAC;AAEjF,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,UAAiC,CAAC;AAErE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,YAAY,EAAE,GAAG,EACjB,OAAO,GAAE,MAAY,EACrB,UAAU,GAAE,MAAM,EAA2B,GAC5C,MAAM,GAAG,IAAI,CAkEf;AAwCD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE;IAAE,OAAO,CAAC,EAAE,GAAG,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EACtD,OAAO,GAAE,MAAY,EACrB,UAAU,GAAE,MAAM,EAA2B,GAC5C,MAAM,GAAG,IAAI,CAqBf;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAiG7C"}
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
* the same JS source so `require()` from inside a user's `node` script
|
|
16
16
|
* sees the same exports map as the install pipeline.
|
|
17
17
|
*
|
|
18
|
-
* Audit reference: audit/sections/03-resolver-gaps.md §3.1, §3.2.
|
|
19
18
|
*
|
|
20
19
|
* Spec features supported:
|
|
21
20
|
* - String shorthand: "exports": "./dist/index.mjs"
|
|
@@ -182,7 +181,6 @@ export function resolvePackageEntry(pkg, subpath = '.', conditions = DEFAULT_ESM
|
|
|
182
181
|
*
|
|
183
182
|
* This source must be byte-equivalent to the TS impl above (modulo type
|
|
184
183
|
* annotations and `export` keywords). Keep them in sync — there is one
|
|
185
|
-
* verification probe in audit/probes that compares parity.
|
|
186
184
|
*/
|
|
187
185
|
export function getExportsResolverJS() {
|
|
188
186
|
return `
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* session-id.ts — Friendly human-readable session identifiers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Generated format: `adjective-noun-NNNN` (e.g. `nimble-otter-4271`).
|
|
5
|
+
* Programmatic callers may also use explicit IDs like `job-123`.
|
|
5
6
|
*
|
|
6
7
|
* Why friendly IDs rather than opaque crypto strings?
|
|
7
8
|
* - Shareable over voice/chat without character-by-character dictation.
|
|
@@ -16,15 +17,16 @@
|
|
|
16
17
|
* sessions ≈ 0.12%. Acceptable for v1. If we ever push past that scale,
|
|
17
18
|
* widen the suffix to 6 digits (≈ 4 × 10¹⁰).
|
|
18
19
|
*
|
|
19
|
-
* Validation
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* Validation rejects empty, overly long, slash-bearing, or colon-bearing
|
|
21
|
+
* values before touching a DO. Colon remains reserved for tenant/sub/session
|
|
22
|
+
* DO-name composition.
|
|
22
23
|
*/
|
|
23
24
|
/**
|
|
24
|
-
* Validate a session ID before touching a DO.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* Validate a session ID before touching a DO.
|
|
26
|
+
*
|
|
27
|
+
* Browser-created sessions use the friendly generated shape. SDK-created
|
|
28
|
+
* sandboxes can choose stable job IDs, so this also accepts the same compact
|
|
29
|
+
* identifier class used by Nimbus JWT `sid`.
|
|
28
30
|
*/
|
|
29
31
|
export declare function isValidSessionId(id: string | null | undefined): boolean;
|
|
30
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-id.d.ts","sourceRoot":"","sources":["../../src/_shared/session-id.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"session-id.d.ts","sourceRoot":"","sources":["../../src/_shared/session-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAmFH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAGvE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAO1C"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* session-id.ts — Friendly human-readable session identifiers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Generated format: `adjective-noun-NNNN` (e.g. `nimble-otter-4271`).
|
|
5
|
+
* Programmatic callers may also use explicit IDs like `job-123`.
|
|
5
6
|
*
|
|
6
7
|
* Why friendly IDs rather than opaque crypto strings?
|
|
7
8
|
* - Shareable over voice/chat without character-by-character dictation.
|
|
@@ -16,10 +17,11 @@
|
|
|
16
17
|
* sessions ≈ 0.12%. Acceptable for v1. If we ever push past that scale,
|
|
17
18
|
* widen the suffix to 6 digits (≈ 4 × 10¹⁰).
|
|
18
19
|
*
|
|
19
|
-
* Validation
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* Validation rejects empty, overly long, slash-bearing, or colon-bearing
|
|
21
|
+
* values before touching a DO. Colon remains reserved for tenant/sub/session
|
|
22
|
+
* DO-name composition.
|
|
22
23
|
*/
|
|
24
|
+
import { isNimbusIdComponent } from '../auth/index.js';
|
|
23
25
|
// Curated single-word adjectives. Lowercase ASCII, no profanity, no numbers,
|
|
24
26
|
// no compounds. Sort order doesn't matter — we index randomly.
|
|
25
27
|
const ADJECTIVES = [
|
|
@@ -94,20 +96,19 @@ const NOUNS = [
|
|
|
94
96
|
'wheat', 'whippet', 'willow', 'wisp', 'wolf', 'wombat', 'woodland',
|
|
95
97
|
'woodpecker', 'yak', 'yew', 'zebra', 'zinnia',
|
|
96
98
|
];
|
|
97
|
-
/**
|
|
99
|
+
/** Friendly ID shape emitted by {@link generateSessionId}. */
|
|
98
100
|
const SESSION_ID_RE = /^[a-z]{3,14}-[a-z]{3,14}-\d{4}$/;
|
|
99
101
|
/**
|
|
100
|
-
* Validate a session ID before touching a DO.
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
102
|
+
* Validate a session ID before touching a DO.
|
|
103
|
+
*
|
|
104
|
+
* Browser-created sessions use the friendly generated shape. SDK-created
|
|
105
|
+
* sandboxes can choose stable job IDs, so this also accepts the same compact
|
|
106
|
+
* identifier class used by Nimbus JWT `sid`.
|
|
104
107
|
*/
|
|
105
108
|
export function isValidSessionId(id) {
|
|
106
109
|
if (typeof id !== 'string')
|
|
107
110
|
return false;
|
|
108
|
-
|
|
109
|
-
return false;
|
|
110
|
-
return SESSION_ID_RE.test(id);
|
|
111
|
+
return SESSION_ID_RE.test(id) || isNimbusIdComponent(id);
|
|
111
112
|
}
|
|
112
113
|
/**
|
|
113
114
|
* Generate a fresh session ID. Uses crypto.getRandomValues for uniform
|
|
@@ -89,7 +89,6 @@ export interface ForwardOptions {
|
|
|
89
89
|
* We trust `opts.tenantSegment` verbatim.
|
|
90
90
|
* - Original request's method, body, and headers are preserved.
|
|
91
91
|
* - `X-Nimbus-Base` is injected so the DO can thread it into ViteDevServer.
|
|
92
|
-
* - `X-Nimbus-Tenant` is injected for audit/observability (NOT authority).
|
|
93
92
|
* - WebSocket upgrades flow naturally: `stub.fetch()` returns a Response
|
|
94
93
|
* with a `webSocket` field and status 101, which workerd passes through.
|
|
95
94
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-router.d.ts","sourceRoot":"","sources":["../../src/_shared/session-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,oBAAoB,CAAC;AAS1D,MAAM,WAAW,k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AC,QAAQ,CAAC,CAoCnB;AAED,0EAA0E;AAC1E,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA6BpE"}
|
|
@@ -89,7 +89,6 @@ export function parseSessionRoute(pathname) {
|
|
|
89
89
|
* We trust `opts.tenantSegment` verbatim.
|
|
90
90
|
* - Original request's method, body, and headers are preserved.
|
|
91
91
|
* - `X-Nimbus-Base` is injected so the DO can thread it into ViteDevServer.
|
|
92
|
-
* - `X-Nimbus-Tenant` is injected for audit/observability (NOT authority).
|
|
93
92
|
* - WebSocket upgrades flow naturally: `stub.fetch()` returns a Response
|
|
94
93
|
* with a `webSocket` field and status 101, which workerd passes through.
|
|
95
94
|
*
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export { issueNimbusToken, verifyNimbusToken, type NimbusAuthEnv, } from './token.js';
|
|
14
14
|
export { extractBearerToken, verifyRequestToken, requireScopes, requireSessionPin, setNimbusTokenCookie, authErrorResponse, NIMBUS_TOKEN_COOKIE, NIMBUS_TOKEN_QUERY, } from './middleware.js';
|
|
15
|
-
export { NimbusAuthError, NimbusAuthConfigError, NimbusTokenMalformedError, NimbusTokenSignatureError, NimbusTokenClaimsError, NimbusTokenExpiredError, NimbusTokenTtlError, NimbusScopeError, NimbusSessionPinError, DEFAULT_TOKEN_TTL_MS, MAX_TOKEN_TTL_MS, ID_COMPONENT_RE, type NimbusTokenClaims, type VerifiedNimbusToken, type IssueTokenOptions, } from './types.js';
|
|
15
|
+
export { NimbusAuthError, NimbusAuthConfigError, NimbusTokenMalformedError, NimbusTokenSignatureError, NimbusTokenClaimsError, NimbusTokenExpiredError, NimbusTokenTtlError, NimbusScopeError, NimbusSessionPinError, DEFAULT_TOKEN_TTL_MS, MAX_TOKEN_TTL_MS, ID_COMPONENT_RE, isNimbusIdComponent, type NimbusTokenClaims, type VerifiedNimbusToken, type IssueTokenOptions, } from './types.js';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC"}
|
package/dist/auth/index.js
CHANGED
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export { issueNimbusToken, verifyNimbusToken, } from './token.js';
|
|
14
14
|
export { extractBearerToken, verifyRequestToken, requireScopes, requireSessionPin, setNimbusTokenCookie, authErrorResponse, NIMBUS_TOKEN_COOKIE, NIMBUS_TOKEN_QUERY, } from './middleware.js';
|
|
15
|
-
export { NimbusAuthError, NimbusAuthConfigError, NimbusTokenMalformedError, NimbusTokenSignatureError, NimbusTokenClaimsError, NimbusTokenExpiredError, NimbusTokenTtlError, NimbusScopeError, NimbusSessionPinError, DEFAULT_TOKEN_TTL_MS, MAX_TOKEN_TTL_MS, ID_COMPONENT_RE, } from './types.js';
|
|
15
|
+
export { NimbusAuthError, NimbusAuthConfigError, NimbusTokenMalformedError, NimbusTokenSignatureError, NimbusTokenClaimsError, NimbusTokenExpiredError, NimbusTokenTtlError, NimbusScopeError, NimbusSessionPinError, DEFAULT_TOKEN_TTL_MS, MAX_TOKEN_TTL_MS, ID_COMPONENT_RE, isNimbusIdComponent, } from './types.js';
|
package/dist/auth/types.d.ts
CHANGED
|
@@ -136,6 +136,7 @@ export declare class NimbusSessionPinError extends NimbusAuthError {
|
|
|
136
136
|
readonly attempted: string;
|
|
137
137
|
constructor(pinnedTo: string, attempted: string);
|
|
138
138
|
}
|
|
139
|
-
/**
|
|
139
|
+
/** Compact identifier rule for tenants, subjects, session pins, and SDK sandbox IDs. */
|
|
140
140
|
export declare const ID_COMPONENT_RE: RegExp;
|
|
141
|
+
export declare function isNimbusIdComponent(value: unknown): value is string;
|
|
141
142
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/auth/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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a,EAAE,MAAM,CAAC;gBACnB,aAAa,EAAE,MAAM;CAKlC;AAED,2EAA2E;AAC3E,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBACf,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAUhD;AAED,wFAAwF;AACxF,eAAO,MAAM,eAAe,QAA4B,CAAC;AAEzD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEnE"}
|
package/dist/auth/types.js
CHANGED
|
@@ -110,5 +110,8 @@ export class NimbusSessionPinError extends NimbusAuthError {
|
|
|
110
110
|
this.attempted = attempted;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
/**
|
|
113
|
+
/** Compact identifier rule for tenants, subjects, session pins, and SDK sandbox IDs. */
|
|
114
114
|
export const ID_COMPONENT_RE = /^[A-Za-z0-9._-]{1,128}$/;
|
|
115
|
+
export function isNimbusIdComponent(value) {
|
|
116
|
+
return typeof value === 'string' && ID_COMPONENT_RE.test(value);
|
|
117
|
+
}
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,cAAc,UAAU,CAAC;AA+BtC,eAAO,MAAM,YAAY,aAAa,CAAC;AACvC,eAAO,MAAM,aAAa;;;;CAAyD,CAAC;AACpF,eAAO,MAAM,eAAe,WAAW,CAAC;AAGxC,eAAO,MAAM,UAAU,QAAS,CAAC;AACjC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,YAAY,QAA0B,CAAC;AAGpD,eAAO,MAAM,gBAAgB,QAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,cAAc,UAAU,CAAC;AA+BtC,eAAO,MAAM,YAAY,aAAa,CAAC;AACvC,eAAO,MAAM,aAAa;;;;CAAyD,CAAC;AACpF,eAAO,MAAM,eAAe,WAAW,CAAC;AAGxC,eAAO,MAAM,UAAU,QAAS,CAAC;AACjC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,YAAY,QAA0B,CAAC;AAGpD,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAyBvC,eAAO,MAAM,oBAAoB,OAAO,CAAC;AACzC,eAAO,MAAM,oBAAoB,QAAmB,CAAC;AACrD,eAAO,MAAM,wBAAwB,QAAmB,CAAC;AAGzD,eAAO,MAAM,YAAY,+BAA+B,CAAC;AACzD,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAG7C,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAGxC,eAAO,MAAM,cAAc,eAAe,CAAC;AA2B3C,eAAO,MAAM,6BAA6B,QAAmB,CAAC;AAG9D,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,YAAY,eAAe,CAAC;AACzC,eAAO,MAAM,YAAY,SAAS,CAAC;AACnC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,oBAAoB,UAAqD,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -50,7 +50,6 @@ export const FACET_TIMEOUT_MS = 30_000; // 30s execution timeout
|
|
|
50
50
|
// `const __MODULE_VFS_BUNDLE = ${JSON.stringify(bundle)}`, so workerd's
|
|
51
51
|
// per-module text-size limit applies to the JSON-escaped form (each
|
|
52
52
|
// `\n` / `\"` / `\u` adds bytes, plus the per-key string-quote overhead).
|
|
53
|
-
// Empirical W2.5b sweep (audit/sections/W2.6-plan.md §2.2) showed 6 MiB
|
|
54
53
|
// raw → boots, 8 MiB raw → fails. Encoded as JSON that's roughly 18-25 MiB
|
|
55
54
|
// of module text. We target 22 MiB encoded as the hard ceiling, leaving
|
|
56
55
|
// ~2-3 MiB of headroom for the rest of the worker module (shims, runner
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* or `nimbusDevServer: 'real'` in vite.config.ts.
|
|
7
7
|
*
|
|
8
8
|
* Phase status (PHASE2-REAL-VITE-PLAN.md):
|
|
9
|
-
* 0 (import + createServer + listen) —
|
|
9
|
+
* 0 (import + createServer + listen) — passing, shipped
|
|
10
10
|
* 1 (VFS-backed fs shim) — implemented here
|
|
11
11
|
* 2 (HMR over our /ws) — implemented here
|
|
12
12
|
* 3 (real @vitejs/plugin-react) — depends on plugin preload
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* or `nimbusDevServer: 'real'` in vite.config.ts.
|
|
7
7
|
*
|
|
8
8
|
* Phase status (PHASE2-REAL-VITE-PLAN.md):
|
|
9
|
-
* 0 (import + createServer + listen) —
|
|
9
|
+
* 0 (import + createServer + listen) — passing, shipped
|
|
10
10
|
* 1 (VFS-backed fs shim) — implemented here
|
|
11
11
|
* 2 (HMR over our /ws) — implemented here
|
|
12
12
|
* 3 (real @vitejs/plugin-react) — depends on plugin preload
|
package/dist/facets/manager.d.ts
CHANGED
|
@@ -241,7 +241,6 @@ export declare class FacetManager {
|
|
|
241
241
|
/**
|
|
242
242
|
* W5 Lever 5: push a DiagFailure into the OOM ring for every facet
|
|
243
243
|
* termination with a non-zero exit code. This is the supervisor side
|
|
244
|
-
* of the zero-silent-OOM contract — the audit/probes/w5/e2e/
|
|
245
244
|
* oom-stress probe asserts that every termination has a matching
|
|
246
245
|
* ring entry.
|
|
247
246
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/facets/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAG9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKhE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAO/D,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC1E;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/facets/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAG9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKhE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAO/D,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,MA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AAyB;YACX,gBAAgB;IAoC9B;;;;OAIG;IACH;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAmB,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,GAAG,CAAA;KAAE;IAKvF;;;OAGG;IACG,SAAS,CACb,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;QACJ,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACV,GACL,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,GAAG,CAAA;KAAE,CAAC;IA8D3C;;;;;;;;;OASG;IACH,KAAK,CACH,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO,GAC3B;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,GAAG,CAAA;KAAE;IAiClC,qCAAqC;IACrC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAa1B,IAAI,KAAK;;;;;;MAAsC;CAChD"}
|
package/dist/facets/manager.js
CHANGED
|
@@ -253,8 +253,6 @@ const USER_CODE = ${safeCode};
|
|
|
253
253
|
// only emits \`const\` in the requires block, but the broader regex
|
|
254
254
|
// guards against drift.
|
|
255
255
|
//
|
|
256
|
-
// See VERIFY-23417C5 §4 #1, audit/sections/X5S-plan.md §3,
|
|
257
|
-
// .seal-internal/2026-05-11-nuxt-process-redeclare/plan.md §6.
|
|
258
256
|
function __mkCompiledFn(code, extraParams) {
|
|
259
257
|
function renameIfDeclared(name) {
|
|
260
258
|
const re = new RegExp("(?:^|\\\\n|;)\\\\s*(?:const|let|var|function|class)\\\\s+" + name + "\\\\b", "m");
|
|
@@ -372,7 +370,6 @@ ${SHIMS}
|
|
|
372
370
|
//
|
|
373
371
|
// workerd's globalThis.console descriptor is writable+configurable
|
|
374
372
|
// (verified empirically — see smoketest-globalthis-write.mjs in
|
|
375
|
-
// /workspace/.seal-internal/2026-05-12-console-facet/), so a plain
|
|
376
373
|
// assignment is sufficient. Do NOT touch globalThis.process /
|
|
377
374
|
// globalThis.Buffer here — Pyodide / Ruby bootstrap paths detect a
|
|
378
375
|
// Node-shaped env via globalThis.process and would take the wrong
|
|
@@ -400,7 +397,6 @@ ${SHIMS}
|
|
|
400
397
|
// append stderr). Mirrors real Node's default
|
|
401
398
|
// unhandled-rejection-is-fatal behaviour.
|
|
402
399
|
//
|
|
403
|
-
// See .seal-internal/2026-05-11-unhandled-rejection/audit.md.
|
|
404
400
|
let __unhandledFired = false;
|
|
405
401
|
const __reportUnhandled = (label, reason) => {
|
|
406
402
|
// framework-fixes-F3 (2026-05-12): suppress reports whose reason
|
|
@@ -1101,7 +1097,6 @@ function buildManifest(vfs, cwd, scriptPath) {
|
|
|
1101
1097
|
* per package — sub-agent §Q3 quantified the worst-case cumulative
|
|
1102
1098
|
* budget impact (~322 KiB for fastify, ~1.7 MiB for ts-jest).
|
|
1103
1099
|
*/
|
|
1104
|
-
// X.5-C: exported so audit/probes/x5c/functional/f2-hash-chunk-greedy.mjs
|
|
1105
1100
|
// can verify the hash-chunk + shared/ oversample directly. Pre-X.5-C this
|
|
1106
1101
|
// was a file-local helper. Adding the named export is a pure surface
|
|
1107
1102
|
// addition — no callers other than buildPrefetchBundle (same file) and
|
|
@@ -1665,7 +1660,6 @@ function addBinTargetSiblings(vfs, scriptPath, bundle, budgetState) {
|
|
|
1665
1660
|
// VFS_BUNDLE_MAX_BYTES = 24 MiB content cap, both of which retain the
|
|
1666
1661
|
// defense against pathological 4000+ file barrel packages.
|
|
1667
1662
|
//
|
|
1668
|
-
// See /workspace/.seal-internal/2026-05-12-npm-create-gap/findings.md
|
|
1669
1663
|
// for the prior wave's empirical investigation (243 manifest entries,
|
|
1670
1664
|
// only 140/243 readable pre-bump on prod 11df6ca).
|
|
1671
1665
|
const MAX_PKG_FILES = 1000;
|
|
@@ -1725,7 +1719,7 @@ function addBinTargetSiblings(vfs, scriptPath, bundle, budgetState) {
|
|
|
1725
1719
|
return { added };
|
|
1726
1720
|
}
|
|
1727
1721
|
/**
|
|
1728
|
-
*
|
|
1722
|
+
* shell compatibility (2026-05-11): scan entry code (and any already-bundled
|
|
1729
1723
|
* .js/.mjs/.cjs sources) for ABSOLUTE-PATH string literals that look
|
|
1730
1724
|
* like file reads. For every candidate that exists on the SqliteVFS,
|
|
1731
1725
|
* pull it into the bundle so the facet's __vfsBundle can serve it.
|
|
@@ -1837,7 +1831,6 @@ function addEntryAbsPathReads(vfs, entryCode, bundle, budgetState) {
|
|
|
1837
1831
|
* plain new Function anyway (loader: 'js' rejects JSX).
|
|
1838
1832
|
* - Files inside a "type":"module" package that don't use import/export
|
|
1839
1833
|
* keywords (rare; nominally CJS-shaped). Accepted limitation, called
|
|
1840
|
-
* out in audit/sections/W3.5-plan.md §6.
|
|
1841
1834
|
*/
|
|
1842
1835
|
function looksLikeEsm(src) {
|
|
1843
1836
|
// Cheap comment strip. Not a full parser — enough to avoid the
|
|
@@ -1848,7 +1841,6 @@ function looksLikeEsm(src) {
|
|
|
1848
1841
|
// Trailing `[\s{]` catches the no-whitespace minified form `import{...}from"..."`
|
|
1849
1842
|
// shipped by @tailwindcss/vite/dist/index.mjs and other minified ESM bundles.
|
|
1850
1843
|
// Skips dynamic `import(...)` (which is fine in CJS) because `(` ∉ `[\s{]`.
|
|
1851
|
-
// See audit/sections/X5Z5-plan.md §3 (both relaxations needed: leading
|
|
1852
1844
|
// anchor [\n;}] AND trailing [\s{]).
|
|
1853
1845
|
const importStmt = /(^|[\n;}])\s*import[\s{]/;
|
|
1854
1846
|
// export STATEMENT: same dual relaxation. Trailing `[\s{*]` covers
|
|
@@ -2031,7 +2023,6 @@ async function transformEsmInBundle(bundle, esbuild) {
|
|
|
2031
2023
|
* If `esbuild` is not provided, the pass is skipped (preserves prior
|
|
2032
2024
|
* behaviour for code paths that don't have esbuild handy).
|
|
2033
2025
|
*
|
|
2034
|
-
* See audit/sections/W2.6-plan.md §3 (B1+ verdict + sub-agent review).
|
|
2035
2026
|
*/
|
|
2036
2027
|
async function buildPrefetchBundle(vfs, scriptPath, cwd, entryCode, esbuild) {
|
|
2037
2028
|
// 1. Static reachable-set walk from entry.
|
|
@@ -2060,7 +2051,6 @@ async function buildPrefetchBundle(vfs, scriptPath, cwd, entryCode, esbuild) {
|
|
|
2060
2051
|
// `default-stylesheet.css` (and similar runtime asset reads in
|
|
2061
2052
|
// tldts, parse5, lookup-table packages, mime-db, etc.) ENOENT
|
|
2062
2053
|
// at facet runtime even though the file is on VFS-disk + in
|
|
2063
|
-
// the manifest. See audit/sections/X5Z3-plan.md §3.
|
|
2064
2054
|
const assetAdd = addStaticReadFileAssets(vfs, cwd, bundle, budgetState);
|
|
2065
2055
|
void assetAdd;
|
|
2066
2056
|
totalBytes = budgetState.totalBytes;
|
|
@@ -2072,7 +2062,6 @@ async function buildPrefetchBundle(vfs, scriptPath, cwd, entryCode, esbuild) {
|
|
|
2072
2062
|
// pattern AND filenames outside the Z3 ASSET_EXT whitelist
|
|
2073
2063
|
// (dotfiles, no-extension sentinels, "digest/hash/version/sha/md5"
|
|
2074
2064
|
// shapes). Motivating case: ts-jest's `.ts-jest-digest`. See
|
|
2075
|
-
// audit/sections/X5U-plan.md §4.
|
|
2076
2065
|
const dotAdd = addStaticReadFileDotfilesAndCompiled(vfs, cwd, bundle, budgetState);
|
|
2077
2066
|
void dotAdd;
|
|
2078
2067
|
totalBytes = budgetState.totalBytes;
|
|
@@ -2089,7 +2078,7 @@ async function buildPrefetchBundle(vfs, scriptPath, cwd, entryCode, esbuild) {
|
|
|
2089
2078
|
void binSiblingAdd;
|
|
2090
2079
|
totalBytes = budgetState.totalBytes;
|
|
2091
2080
|
fileCount = budgetState.fileCount;
|
|
2092
|
-
// 2.35
|
|
2081
|
+
// 2.35 shell compatibility: absolute-path readFileSync scanner.
|
|
2093
2082
|
//
|
|
2094
2083
|
// Pre-fix `node -e 'fs.readFileSync("/home/user/er.txt")'` returned
|
|
2095
2084
|
// ENOENT even when the file existed on the SqliteVFS (verified via
|
|
@@ -2354,7 +2343,6 @@ export class FacetManager {
|
|
|
2354
2343
|
/**
|
|
2355
2344
|
* W5 Lever 5: push a DiagFailure into the OOM ring for every facet
|
|
2356
2345
|
* termination with a non-zero exit code. This is the supervisor side
|
|
2357
|
-
* of the zero-silent-OOM contract — the audit/probes/w5/e2e/
|
|
2358
2346
|
* oom-stress probe asserts that every termination has a matching
|
|
2359
2347
|
* ring entry.
|
|
2360
2348
|
*
|
|
@@ -2625,7 +2613,7 @@ export class FacetManager {
|
|
|
2625
2613
|
spawn(workerCode, command, cwd, opts = {}) {
|
|
2626
2614
|
this.processTable.reap();
|
|
2627
2615
|
const entry = this.processTable.spawn(command, [], cwd);
|
|
2628
|
-
//
|
|
2616
|
+
// child-process isolation gap #2: stamp the explicit longRunning flag on the
|
|
2629
2617
|
// process_table entry so /api/processes returns longRunning=true
|
|
2630
2618
|
// independent of the LONG_RUNNING_CMD_RE heuristic. Vite, wrangler,
|
|
2631
2619
|
// node servers, --watch, etc. all flow through this primitive.
|
package/dist/facets/process.d.ts
CHANGED
|
@@ -196,7 +196,7 @@ export interface FacetProcessManagerDeps {
|
|
|
196
196
|
};
|
|
197
197
|
};
|
|
198
198
|
/**
|
|
199
|
-
*
|
|
199
|
+
* child-process isolation gap #1: optional ChildProcessSpawnPool. When supplied,
|
|
200
200
|
* `_dispatch` routes each spawn through the pool (one-task
|
|
201
201
|
* NimbusFanoutPool.submitMany call per spawn), giving each spawn a
|
|
202
202
|
* fresh Worker Loader isolate. When omitted, falls back to the
|
|
@@ -229,7 +229,7 @@ export declare class FacetProcessManager {
|
|
|
229
229
|
/** Dispatch by kind. */
|
|
230
230
|
private _dispatch;
|
|
231
231
|
/**
|
|
232
|
-
*
|
|
232
|
+
* child-process isolation gap #1: inline dispatch — runs the existing
|
|
233
233
|
* pure-builtin / facet-direct logic with string-collecting hooks
|
|
234
234
|
* and returns the final {exitCode, stdout, stderr} envelope.
|
|
235
235
|
*
|
package/dist/facets/process.js
CHANGED
|
@@ -132,7 +132,7 @@ export class FacetProcessManager {
|
|
|
132
132
|
onStdout: (d) => this._appendOutput(child, 1, d),
|
|
133
133
|
onStderr: (d) => this._appendOutput(child, 2, d),
|
|
134
134
|
};
|
|
135
|
-
//
|
|
135
|
+
// child-process isolation gap #1: if a spawnPool is configured (production
|
|
136
136
|
// wiring), route the dispatch through a fresh Worker Loader
|
|
137
137
|
// isolate via NimbusFanoutPool. The pool's task body emits a
|
|
138
138
|
// per-isolate marker token + delegates the actual command back
|
|
@@ -209,7 +209,7 @@ export class FacetProcessManager {
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
212
|
+
* child-process isolation gap #1: inline dispatch — runs the existing
|
|
213
213
|
* pure-builtin / facet-direct logic with string-collecting hooks
|
|
214
214
|
* and returns the final {exitCode, stdout, stderr} envelope.
|
|
215
215
|
*
|
|
@@ -59,7 +59,7 @@ export interface ViteDevServerOptions {
|
|
|
59
59
|
/** Durable Object state — needed alongside `env` for the facet pool. */
|
|
60
60
|
ctx?: DurableObjectState;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* process diagnostics support: when set, every diagnostic the dev server
|
|
63
63
|
* would otherwise drop into Worker logs (console.warn / console.error)
|
|
64
64
|
* is ALSO appended to the supervisor's per-PID ProcessLogStore at
|
|
65
65
|
* this PID, on the 'stderr' stream. The Process tab in the frontend
|
|
@@ -137,7 +137,7 @@ export declare class ViteDevServer {
|
|
|
137
137
|
*/
|
|
138
138
|
private onDemandQueue;
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
140
|
+
* process diagnostics support: the supervisor's per-PID log store. When set
|
|
141
141
|
* (alongside `pid`), every diagnostic emitted by the dev server is
|
|
142
142
|
* appended here on the 'stderr' stream so the Process tab UI shows
|
|
143
143
|
* a real, scrolling, trace of bundler activity. When unset, falls
|
|
@@ -168,7 +168,7 @@ export declare class ViteDevServer {
|
|
|
168
168
|
stop(): void;
|
|
169
169
|
get isRunning(): boolean;
|
|
170
170
|
/**
|
|
171
|
-
*
|
|
171
|
+
* process diagnostics support: single chokepoint for dev-server diagnostics.
|
|
172
172
|
* Always writes to the workerd console (so wrangler tail / Worker
|
|
173
173
|
* logs see it for ops triage) AND appends to the supervisor's
|
|
174
174
|
* per-PID ProcessLogStore when one is wired (so the Process tab in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-dev-server.d.ts","sourceRoot":"","sources":["../../src/facets/vite-dev-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAoBpE,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,SAAS,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;IACxB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,uFAAuF;IAC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