@nimbus-sh/worker 0.6.0 → 0.7.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 +2 -2
- package/dist/cirrus-npm-cjs.generated.d.ts +1 -1
- package/dist/cirrus-npm-cjs.generated.js +1 -1
- package/dist/facets/cirrus-real.d.ts.map +1 -1
- package/dist/facets/cirrus-real.js +6 -5
- package/dist/facets/compose.d.ts +148 -0
- package/dist/facets/compose.d.ts.map +1 -0
- package/dist/facets/compose.js +146 -0
- package/dist/facets/durable-images.d.ts +9 -5
- package/dist/facets/durable-images.d.ts.map +1 -1
- package/dist/facets/durable-images.js +17 -7
- package/dist/facets/esbuild-bundle-pool.d.ts +49 -0
- package/dist/facets/esbuild-bundle-pool.d.ts.map +1 -0
- package/dist/facets/esbuild-bundle-pool.js +122 -0
- package/dist/facets/exec-telemetry.d.ts +8 -0
- package/dist/facets/exec-telemetry.d.ts.map +1 -1
- package/dist/facets/manager.d.ts +240 -109
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +661 -337
- package/dist/facets/process.d.ts +20 -16
- package/dist/facets/process.d.ts.map +1 -1
- package/dist/facets/process.js +59 -28
- package/dist/facets/real-vite-fs-shim.js +2 -2
- package/dist/facets/vite-dev-server.d.ts +25 -47
- package/dist/facets/vite-dev-server.d.ts.map +1 -1
- package/dist/facets/vite-dev-server.js +185 -219
- package/dist/facets/wasm-image-digest.d.ts +25 -0
- package/dist/facets/wasm-image-digest.d.ts.map +1 -0
- package/dist/facets/wasm-image-digest.js +25 -0
- package/dist/facets/wasm-swap-registry.d.ts +51 -92
- package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
- package/dist/facets/wasm-swap-registry.js +68 -227
- package/dist/git/network-facet.d.ts.map +1 -1
- package/dist/git/network-facet.js +6 -5
- package/dist/loaders/child-process/spawn-pool.d.ts +3 -2
- package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-pool.js +3 -2
- package/dist/loaders/generated-workers.d.ts +2 -2
- package/dist/loaders/generated-workers.d.ts.map +1 -1
- package/dist/loaders/generated-workers.js +3 -3
- package/dist/loaders/npm-resolve-preamble.d.ts +3 -6
- package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
- package/dist/loaders/npm-resolve-preamble.js +34 -108
- package/dist/node-shims-artifact.generated.js +3 -3
- package/dist/npm/install-batch-facet.d.ts +3 -2
- package/dist/npm/install-batch-facet.d.ts.map +1 -1
- package/dist/npm/install-batch-facet.js +45 -15
- package/dist/npm/installer.d.ts +22 -17
- package/dist/npm/installer.d.ts.map +1 -1
- package/dist/npm/installer.js +209 -193
- package/dist/npm/pre-bundle-facet.d.ts +1 -1
- package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
- package/dist/npm/pre-bundle-facet.js +1 -1
- package/dist/npm/resolve-facet.d.ts +6 -0
- package/dist/npm/resolve-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.d.ts +21 -20
- package/dist/npm/resolve-one-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.js +85 -84
- package/dist/npm/semver.d.ts +59 -0
- package/dist/npm/semver.d.ts.map +1 -0
- package/dist/npm/semver.js +226 -0
- package/dist/router/remote-api.js +31 -1
- package/dist/runtime/html-entrypoint.d.ts +7 -0
- package/dist/runtime/html-entrypoint.d.ts.map +1 -1
- package/dist/runtime/html-entrypoint.js +18 -2
- package/dist/runtime/node-runner.d.ts +3 -0
- package/dist/runtime/node-runner.d.ts.map +1 -1
- package/dist/runtime/node-runner.js +7 -0
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +305 -29
- package/dist/runtime/opencode-facet-runner.js +2 -2
- package/dist/session/helpers.d.ts +38 -0
- package/dist/session/helpers.d.ts.map +1 -1
- package/dist/session/helpers.js +76 -0
- package/dist/session/init-phases.d.ts +1 -1
- package/dist/session/init-phases.d.ts.map +1 -1
- package/dist/session/init-phases.js +2 -12
- package/dist/session/init.d.ts +15 -1
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +82 -603
- package/dist/session/nimbus-session.d.ts +56 -22
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +130 -101
- package/dist/session/npm-install-port.d.ts +16 -0
- package/dist/session/npm-install-port.d.ts.map +1 -0
- package/dist/session/npm-install-port.js +37 -0
- package/dist/session/port-capability.d.ts +44 -0
- package/dist/session/port-capability.d.ts.map +1 -1
- package/dist/session/port-capability.js +110 -0
- package/dist/session/programmatic.d.ts +31 -5
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +94 -68
- package/dist/session/routes.d.ts +30 -17
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +42 -131
- package/dist/session/rpc.d.ts +15 -15
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +97 -47
- package/dist/session/serving-port.d.ts +27 -0
- package/dist/session/serving-port.d.ts.map +1 -0
- package/dist/session/serving-port.js +27 -0
- package/dist/session/start-real-vite.d.ts +12 -0
- package/dist/session/start-real-vite.d.ts.map +1 -1
- package/dist/session/start-real-vite.js +4 -4
- package/dist/session/supervisor-op.d.ts +2 -2
- package/dist/session/supervisor-op.d.ts.map +1 -1
- package/dist/session/supervisor-op.js +13 -7
- package/dist/session/supervisor-rpc.d.ts +7 -7
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +4 -0
- package/dist/session/vite-command.d.ts +18 -0
- package/dist/session/vite-command.d.ts.map +1 -0
- package/dist/session/vite-command.js +609 -0
- package/dist/session/ws.d.ts +61 -0
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +122 -12
- package/dist/shell/npm-bin-entrypoints.d.ts +0 -35
- package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
- package/dist/shell/npm-bin-entrypoints.js +12 -85
- package/package.json +24 -4
- package/public/_assets/runtime/{node-shims-9e1380d9ee430fcc.js → node-shims-8f8c64edd2a1f0f5.js} +305 -29
- package/public/index.html +1 -1
- package/scripts/bundle-facet-workers.mjs +1 -1
- package/scripts/bundle-npm-cjs.mjs +2 -2
- package/dist/facets/on-demand-bundle-gate.d.ts +0 -65
- package/dist/facets/on-demand-bundle-gate.d.ts.map +0 -1
- package/dist/facets/on-demand-bundle-gate.js +0 -125
- package/dist/npm/install-args.d.ts +0 -21
- package/dist/npm/install-args.d.ts.map +0 -1
- package/dist/npm/install-args.js +0 -70
- package/dist/npm/npm-log.d.ts +0 -31
- package/dist/npm/npm-log.d.ts.map +0 -1
- package/dist/npm/npm-log.js +0 -51
package/dist/session/rpc.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* these ~3 sites would each need ctx threaded through; cast at boundary
|
|
22
22
|
* is acceptable per plan §IX recommendation 1.
|
|
23
23
|
*/
|
|
24
|
-
import { enc } from '@nimbus-sh/core/_shared/bytes.js';
|
|
24
|
+
import { enc, StreamTextDecoders } from '@nimbus-sh/core/_shared/bytes.js';
|
|
25
25
|
import { normalizeTerminalNewlines } from '@nimbus-sh/core/_shared/terminal.js';
|
|
26
26
|
import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
|
|
27
27
|
import { getInnerDoClass } from '@nimbus-sh/fabric/inner-do-registry.js';
|
|
@@ -38,11 +38,11 @@ import { recordFailure, getLastRpcFrame, getLastFacetId, } from '@nimbus-sh/plat
|
|
|
38
38
|
import { classifyError } from '@nimbus-sh/platform/oom-classify.js';
|
|
39
39
|
import { acquireSupervisorReadAllocation, } from '@nimbus-sh/platform/heavy-alloc-coord.js';
|
|
40
40
|
import { rpcPayloadEnd, rpcPayloadStart, } from '@nimbus-sh/platform/diag-counters.js';
|
|
41
|
-
import { CRED_KERNEL, CRED_SESSION_USER, } from '@nimbus-sh/core/runtime/os-contracts.js';
|
|
41
|
+
import { CRED_KERNEL, CRED_SESSION_USER, requireVfsCred, } from '@nimbus-sh/core/runtime/os-contracts.js';
|
|
42
42
|
import { MAX_RPC_SAFE_PAYLOAD_BYTES } from '@nimbus-sh/platform/limits.js';
|
|
43
43
|
import { FS_LIST_PAGE_LIMIT, FS_READ_BATCH_PATH_LIMIT, FS_READ_BATCH_REQUEST_BYTES, } from '@nimbus-sh/core/constants.js';
|
|
44
44
|
import { routeSessionLoopback } from './loopback.js';
|
|
45
|
-
import {
|
|
45
|
+
import { registerServingPort } from './serving-port.js';
|
|
46
46
|
import { normalizeVfsPath, parentVfsPath } from '@nimbus-sh/core/vfs/path.js';
|
|
47
47
|
import { z } from 'zod/v4';
|
|
48
48
|
const WriteBatchInodeSchema = z.object({
|
|
@@ -81,9 +81,22 @@ function processPid(pid) {
|
|
|
81
81
|
* binding, the remote `/rpc` dispatcher, the static asset server — and those
|
|
82
82
|
* act as the unprivileged session user, the same identity `exec` runs as.
|
|
83
83
|
* A supplied-but-invalid pid still throws: only an absent pid is a host call.
|
|
84
|
+
*
|
|
85
|
+
* A host call may name the credential it acts as (`cred`) — the same
|
|
86
|
+
* `SqliteVFS.as(cred)` view an in-process caller has, reached over the RPC
|
|
87
|
+
* surface. That is the embedder's trusted surface: the SDK over the DO
|
|
88
|
+
* binding hands it through `files.as(cred)`; the remote `/rpc` dispatcher
|
|
89
|
+
* refuses it, exactly as it refuses `cred` on exec, because a token
|
|
90
|
+
* authenticates a session and not a user inside it. Absent, every file op
|
|
91
|
+
* keeps the identity it has always had. A pid and a cred together are
|
|
92
|
+
* refused, so a process can never widen its own identity.
|
|
84
93
|
*/
|
|
85
|
-
function callerCred(self, pid) {
|
|
86
|
-
|
|
94
|
+
function callerCred(self, pid, cred) {
|
|
95
|
+
if (pid === undefined)
|
|
96
|
+
return cred === undefined ? CRED_SESSION_USER : requireVfsCred(cred, 'filesystem RPC');
|
|
97
|
+
if (cred !== undefined)
|
|
98
|
+
throw new Error('filesystem RPC: a process acts as its own credential; cred cannot ride a pid');
|
|
99
|
+
return self.processes.cred(processPid(pid));
|
|
87
100
|
}
|
|
88
101
|
export function checkedReadPayloadBytes(bytes) {
|
|
89
102
|
if (!Number.isSafeInteger(bytes) || bytes < 0) {
|
|
@@ -128,16 +141,16 @@ export async function withReadAllocation(bytes, read) {
|
|
|
128
141
|
* The body lives in `buildSessionSupervisorOps`'s `readFile` override so
|
|
129
142
|
* direct `_rpc*` calls and the supervisor envelope share it.
|
|
130
143
|
*/
|
|
131
|
-
export async function _rpcReadFile(self, path, pid) {
|
|
132
|
-
return self.supervisorOp({ op: 'readFile', args: [path], pid });
|
|
144
|
+
export async function _rpcReadFile(self, path, pid, cred) {
|
|
145
|
+
return self.supervisorOp({ op: 'readFile', args: [path], pid, cred });
|
|
133
146
|
}
|
|
134
147
|
/**
|
|
135
148
|
* Read a file as raw bytes (Uint8Array). Used by git network facet for
|
|
136
149
|
* binary .git/objects/** and packfile reads, where TextDecoder/TextEncoder
|
|
137
150
|
* round-tripping through readFile (string) would corrupt bytes.
|
|
138
151
|
*/
|
|
139
|
-
export async function _rpcReadFileBytes(self, path, pid) {
|
|
140
|
-
return self.supervisorOp({ op: 'readFileBytes', args: [path], pid });
|
|
152
|
+
export async function _rpcReadFileBytes(self, path, pid, cred) {
|
|
153
|
+
return self.supervisorOp({ op: 'readFileBytes', args: [path], pid, cred });
|
|
141
154
|
}
|
|
142
155
|
/**
|
|
143
156
|
* Phase-3 inner-DO fetch dispatcher. Called by NimbusDOStub.fetch()
|
|
@@ -202,11 +215,11 @@ export async function _rpcInnerDoFetch(self, req) {
|
|
|
202
215
|
};
|
|
203
216
|
}
|
|
204
217
|
}
|
|
205
|
-
export async function _rpcWriteFile(self, path, content, pid) {
|
|
218
|
+
export async function _rpcWriteFile(self, path, content, pid, cred) {
|
|
206
219
|
// binary-fs wave: the bridge's writeFile already accepts
|
|
207
220
|
// string | Uint8Array — the shape arrives unchanged across structured
|
|
208
221
|
// clone.
|
|
209
|
-
return self.supervisorOp({ op: 'writeFile', args: [path, content], pid });
|
|
222
|
+
return self.supervisorOp({ op: 'writeFile', args: [path, content], pid, cred });
|
|
210
223
|
}
|
|
211
224
|
/**
|
|
212
225
|
* Write one host-governed file at a session root and let ordinary Unix
|
|
@@ -239,11 +252,11 @@ export async function _rpcWriteProtectedRootFile(self, rootPath, path, content)
|
|
|
239
252
|
fs.chown(protectedPath, CRED_KERNEL.uid, CRED_KERNEL.gid);
|
|
240
253
|
fs.chmod(protectedPath, 0o444);
|
|
241
254
|
}
|
|
242
|
-
export async function _rpcStat(self, path, pid) {
|
|
243
|
-
return self.supervisorOp({ op: 'stat', args: [path], pid });
|
|
255
|
+
export async function _rpcStat(self, path, pid, cred) {
|
|
256
|
+
return self.supervisorOp({ op: 'stat', args: [path], pid, cred });
|
|
244
257
|
}
|
|
245
|
-
export async function _rpcLstat(self, path, pid) {
|
|
246
|
-
return self.supervisorOp({ op: 'lstat', args: [path], pid });
|
|
258
|
+
export async function _rpcLstat(self, path, pid, cred) {
|
|
259
|
+
return self.supervisorOp({ op: 'lstat', args: [path], pid, cred });
|
|
247
260
|
}
|
|
248
261
|
export async function _rpcHasLegacySymlinkUnder(self, path, pid) {
|
|
249
262
|
return self.supervisorOp({ op: 'hasLegacySymlinkUnder', args: [path], pid });
|
|
@@ -251,8 +264,8 @@ export async function _rpcHasLegacySymlinkUnder(self, path, pid) {
|
|
|
251
264
|
export async function _rpcUtimes(self, path, atimeMs, mtimeMs, pid) {
|
|
252
265
|
await self.supervisorOp({ op: 'utimes', args: [path, atimeMs, mtimeMs], pid });
|
|
253
266
|
}
|
|
254
|
-
export async function _rpcChmod(self, path, mode, pid) {
|
|
255
|
-
await self.supervisorOp({ op: 'chmod', args: [path, mode], pid });
|
|
267
|
+
export async function _rpcChmod(self, path, mode, pid, cred) {
|
|
268
|
+
await self.supervisorOp({ op: 'chmod', args: [path, mode], pid, cred });
|
|
256
269
|
}
|
|
257
270
|
export async function _rpcAccess(self, path, mode, pid) {
|
|
258
271
|
await self.supervisorBridge(pid).access(path, mode);
|
|
@@ -263,20 +276,20 @@ export async function _rpcChown(self, path, uid, gid, pid, options) {
|
|
|
263
276
|
export async function _rpcSetUmask(self, mask, pid) {
|
|
264
277
|
return self.processes.setUmask(processPid(pid), mask);
|
|
265
278
|
}
|
|
266
|
-
export async function _rpcReaddir(self, path, pid) {
|
|
267
|
-
return self.supervisorOp({ op: 'readdir', args: [path], pid });
|
|
279
|
+
export async function _rpcReaddir(self, path, pid, cred) {
|
|
280
|
+
return self.supervisorOp({ op: 'readdir', args: [path], pid, cred });
|
|
268
281
|
}
|
|
269
|
-
export async function _rpcExists(self, path, pid) {
|
|
270
|
-
return self.supervisorOp({ op: 'exists', args: [path], pid });
|
|
282
|
+
export async function _rpcExists(self, path, pid, cred) {
|
|
283
|
+
return self.supervisorOp({ op: 'exists', args: [path], pid, cred });
|
|
271
284
|
}
|
|
272
|
-
export async function _rpcMkdir(self, path, pid) {
|
|
273
|
-
await self.supervisorOp({ op: 'mkdir', args: [path], pid });
|
|
285
|
+
export async function _rpcMkdir(self, path, pid, cred) {
|
|
286
|
+
await self.supervisorOp({ op: 'mkdir', args: [path], pid, cred });
|
|
274
287
|
}
|
|
275
288
|
export async function _rpcRmdir(self, path, pid) {
|
|
276
289
|
await self.supervisorOp({ op: 'rmdir', args: [path], pid });
|
|
277
290
|
}
|
|
278
|
-
export async function _rpcRename(self, from, to, pid) {
|
|
279
|
-
await self.supervisorOp({ op: 'rename', args: [from, to], pid });
|
|
291
|
+
export async function _rpcRename(self, from, to, pid, cred) {
|
|
292
|
+
await self.supervisorOp({ op: 'rename', args: [from, to], pid, cred });
|
|
280
293
|
}
|
|
281
294
|
export async function _rpcReadlink(self, path, pid) {
|
|
282
295
|
return self.supervisorOp({ op: 'readlink', args: [path], pid });
|
|
@@ -393,8 +406,8 @@ export async function _rpcFsList(self, after, limit, pid) {
|
|
|
393
406
|
const args = FsListArgsSchema.parse({ after: after ?? null, limit: limit ?? null });
|
|
394
407
|
return self.supervisorBridge(pid).list(args.after, args.limit ?? undefined);
|
|
395
408
|
}
|
|
396
|
-
export async function _rpcFsReadRange(self, path, offset, length, pid) {
|
|
397
|
-
return self.supervisorOp({ op: 'fsReadRange', args: [path, offset, length], pid });
|
|
409
|
+
export async function _rpcFsReadRange(self, path, offset, length, pid, cred) {
|
|
410
|
+
return self.supervisorOp({ op: 'fsReadRange', args: [path, offset, length], pid, cred });
|
|
398
411
|
}
|
|
399
412
|
/**
|
|
400
413
|
* The same read, through the same process credential and the same bridge, with
|
|
@@ -652,6 +665,17 @@ function isPriorGenerationPid(self, pid) {
|
|
|
652
665
|
return pid > 0 && pid <= self.processes.pidBase;
|
|
653
666
|
}
|
|
654
667
|
export const PRIOR_GENERATION_EXIT_REASON = 'process lost: instance reset';
|
|
668
|
+
/**
|
|
669
|
+
* A process's output arrives as bytes: the relay from the facet carries
|
|
670
|
+
* Uint8Array so a binary protocol or an image survives it. The two text
|
|
671
|
+
* consumers here decode at their own edge — the log ring inside
|
|
672
|
+
* `appendOutputBytes`, and the terminal tee through these per-(pid, stream)
|
|
673
|
+
* streaming decoders, dropped when the process reports its exit.
|
|
674
|
+
*/
|
|
675
|
+
const _terminalTeeDecoders = new StreamTextDecoders();
|
|
676
|
+
function decodeForTerminal(pid, stream, data) {
|
|
677
|
+
return _terminalTeeDecoders.decode(`${pid}:${stream}`, data);
|
|
678
|
+
}
|
|
655
679
|
export async function _rpcStdout(self, pid, data) {
|
|
656
680
|
// Prior-generation straggler (facet outlived a DO instance reset): drop —
|
|
657
681
|
// its output must not merge into this generation's logs or shell.
|
|
@@ -664,9 +688,11 @@ export async function _rpcStdout(self, pid, data) {
|
|
|
664
688
|
// un-traceable facets.
|
|
665
689
|
try {
|
|
666
690
|
if (pid > 0)
|
|
667
|
-
self.processes.
|
|
691
|
+
self.processes.appendOutputBytes(pid, 'stdout', data);
|
|
668
692
|
if (self.terminal && shouldMirrorProcessOutputToShell(self, pid)) {
|
|
669
|
-
|
|
693
|
+
const text = decodeForTerminal(pid, 'stdout', data);
|
|
694
|
+
if (text.length > 0)
|
|
695
|
+
self.terminal.write(normalizeTerminalNewlines(text));
|
|
670
696
|
}
|
|
671
697
|
}
|
|
672
698
|
catch (e) {
|
|
@@ -687,11 +713,13 @@ export async function _rpcStderr(self, pid, data) {
|
|
|
687
713
|
return;
|
|
688
714
|
try {
|
|
689
715
|
if (pid > 0)
|
|
690
|
-
self.processes.
|
|
716
|
+
self.processes.appendOutputBytes(pid, 'stderr', data);
|
|
691
717
|
// Terminal gets red wrapping; the ring buffer keeps it raw so the
|
|
692
718
|
// stream tag can drive color decisions at replay time.
|
|
693
719
|
if (self.terminal && shouldMirrorProcessOutputToShell(self, pid)) {
|
|
694
|
-
|
|
720
|
+
const text = decodeForTerminal(pid, 'stderr', data);
|
|
721
|
+
if (text.length > 0)
|
|
722
|
+
self.terminal.write(`\x1b[31m${normalizeTerminalNewlines(text)}\x1b[0m`);
|
|
695
723
|
}
|
|
696
724
|
}
|
|
697
725
|
catch (e) {
|
|
@@ -739,6 +767,12 @@ export async function _rpcReportExit(self, pid, code, tail) {
|
|
|
739
767
|
self.processes.closeInput(pid);
|
|
740
768
|
}
|
|
741
769
|
catch { }
|
|
770
|
+
for (const stream of ['stdout', 'stderr']) {
|
|
771
|
+
const rest = _terminalTeeDecoders.drop(`${pid}:${stream}`);
|
|
772
|
+
if (rest.length > 0 && self.terminal && shouldMirrorProcessOutputToShell(self, pid)) {
|
|
773
|
+
self.terminal.write(normalizeTerminalNewlines(rest));
|
|
774
|
+
}
|
|
775
|
+
}
|
|
742
776
|
// A relayed socket is held open by the supervisor on the process's behalf,
|
|
743
777
|
// so it does not die when the facet does. Nothing else would ever close
|
|
744
778
|
// it, and a live one keeps buffering into the supervisor's heap.
|
|
@@ -962,23 +996,21 @@ export async function _rpcPrefetch(self, cwd, entryCode) {
|
|
|
962
996
|
// want to refresh the bundle mid-execution; today only the
|
|
963
997
|
// SupervisorRPC.prefetch surface exposes it externally.
|
|
964
998
|
self.ensureSqliteFs();
|
|
965
|
-
|
|
966
|
-
|
|
999
|
+
// Dynamic import stays: keeps the resolver out of this module's eager
|
|
1000
|
+
// graph (the original reason for the lazy load above).
|
|
1001
|
+
const { prefetchForRequire, ClosureBoundExceededError } = await import('@nimbus-sh/core/runtime/require-resolver.js');
|
|
1002
|
+
const outcome = prefetchForRequire(self.sqliteFs, entryCode, cwd);
|
|
1003
|
+
if ('kind' in outcome)
|
|
1004
|
+
throw new ClosureBoundExceededError(outcome);
|
|
1005
|
+
return outcome.bundle;
|
|
967
1006
|
}
|
|
968
1007
|
export async function _rpcRegisterPort(self, pid, port) {
|
|
969
1008
|
// Port registration stores the facet association — the actual facet stub
|
|
970
|
-
// is stored by FacetManager separately.
|
|
971
|
-
//
|
|
972
|
-
//
|
|
973
|
-
//
|
|
974
|
-
|
|
975
|
-
await self.facetManager.registerPort(pid, port);
|
|
976
|
-
return;
|
|
977
|
-
}
|
|
978
|
-
// No facet manager yet means nothing resident is running — a bare
|
|
979
|
-
// registration retires the previous occupant's preview capability.
|
|
980
|
-
await clearPortCapability(self, port);
|
|
981
|
-
self.portRegistry.register(port, pid);
|
|
1009
|
+
// is stored by FacetManager separately. The same registration every
|
|
1010
|
+
// serving process uses: through the manager, so the pid's identity —
|
|
1011
|
+
// its journal row, or the process table — decides whether a reservation's
|
|
1012
|
+
// capability is re-adopted or retired.
|
|
1013
|
+
await registerServingPort(self, pid, port);
|
|
982
1014
|
}
|
|
983
1015
|
export async function _rpcUnregisterPort(self, port) {
|
|
984
1016
|
self.portRegistry.unregister(port);
|
|
@@ -1019,14 +1051,29 @@ export async function _rpcCpSpawn(self, req) {
|
|
|
1019
1051
|
const fpm = self._ensureFacetProcessManager();
|
|
1020
1052
|
return fpm.spawn(req);
|
|
1021
1053
|
}
|
|
1054
|
+
/**
|
|
1055
|
+
* A child's stdin is bytes: esbuild's service protocol is binary packets,
|
|
1056
|
+
* and so is any pipe carrying an image or an archive. The facet queue and
|
|
1057
|
+
* this contract carry Uint8Array; the interactive input store is a text
|
|
1058
|
+
* channel fed by a terminal, so it decodes at its own edge with a streaming
|
|
1059
|
+
* decoder held per child, which keeps a multibyte character split across two
|
|
1060
|
+
* writes correct.
|
|
1061
|
+
*/
|
|
1062
|
+
const _cpStdinDecoders = new Map();
|
|
1022
1063
|
export async function _rpcCpStdinWrite(self, childPid, data) {
|
|
1023
1064
|
if (self.processes.hasInput(childPid)) {
|
|
1024
|
-
|
|
1065
|
+
let decoder = _cpStdinDecoders.get(childPid);
|
|
1066
|
+
if (!decoder) {
|
|
1067
|
+
decoder = new TextDecoder('utf-8');
|
|
1068
|
+
_cpStdinDecoders.set(childPid, decoder);
|
|
1069
|
+
}
|
|
1070
|
+
return self.processes.writeInput(childPid, decoder.decode(data, { stream: true }));
|
|
1025
1071
|
}
|
|
1026
1072
|
const fpm = self._ensureFacetProcessManager();
|
|
1027
1073
|
return fpm.stdinWrite(childPid, data);
|
|
1028
1074
|
}
|
|
1029
1075
|
export async function _rpcCpStdinEnd(self, childPid) {
|
|
1076
|
+
_cpStdinDecoders.delete(childPid);
|
|
1030
1077
|
if (self.processes.hasInput(childPid)) {
|
|
1031
1078
|
self.processes.endInput(childPid);
|
|
1032
1079
|
return;
|
|
@@ -1043,7 +1090,10 @@ export async function _rpcCpReadStdin(self, childPid, waitMs) {
|
|
|
1043
1090
|
return { signal: 'SIGKILL', ended: true };
|
|
1044
1091
|
}
|
|
1045
1092
|
if (self.processes.hasInput(childPid)) {
|
|
1046
|
-
|
|
1093
|
+
// The interactive input store holds text packets; the child's stdin
|
|
1094
|
+
// pump takes bytes, so this text producer encodes at its edge.
|
|
1095
|
+
const packet = await self.processes.readInput(childPid, waitMs);
|
|
1096
|
+
return { ...packet, data: enc.encode(packet.data) };
|
|
1047
1097
|
}
|
|
1048
1098
|
const fpm = self._ensureFacetProcessManager();
|
|
1049
1099
|
return fpm.cpReadStdin(childPid, waitMs);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session/serving-port.ts — how a process that serves a port is registered.
|
|
3
|
+
*
|
|
4
|
+
* One path for every serving pid, whether the facet manager launched it (a
|
|
5
|
+
* node/runtime resident with a journal row) or the session runs it in
|
|
6
|
+
* process (the Cirrus Vite shim, real-vite, `vite preview`, a builtin that
|
|
7
|
+
* adopted a shell wrapper pid). The manager's registration stamps the
|
|
8
|
+
* journal row when there is one, reads the process table's identity when
|
|
9
|
+
* there is not, and re-adopts a reservation the identity owns instead of
|
|
10
|
+
* retiring its capability — which is what lets a dev server exposed under a
|
|
11
|
+
* name come back on the same shared link after a restart or a hibernation.
|
|
12
|
+
*
|
|
13
|
+
* The bare registration below is only for a session that has no manager at
|
|
14
|
+
* all; every DO route that serves a port stands one up first.
|
|
15
|
+
*/
|
|
16
|
+
import type { PortRegistry } from '@nimbus-sh/core/runtime/port-registry.js';
|
|
17
|
+
import { type PortCapabilityHost } from './port-capability.js';
|
|
18
|
+
export interface ServingPortHost {
|
|
19
|
+
ctx: PortCapabilityHost['ctx'];
|
|
20
|
+
portRegistry: PortRegistry;
|
|
21
|
+
facetManager: {
|
|
22
|
+
registerPort(pid: number, port: number): Promise<void>;
|
|
23
|
+
} | null;
|
|
24
|
+
ensureFacetManager?(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare function registerServingPort(self: ServingPortHost, pid: number, port: number): Promise<void>;
|
|
27
|
+
//# sourceMappingURL=serving-port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serving-port.d.ts","sourceRoot":"","sources":["../../src/session/serving-port.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAuB,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEpF,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE;QAAE,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;IAChF,kBAAkB,CAAC,IAAI,IAAI,CAAC;CAC7B;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session/serving-port.ts — how a process that serves a port is registered.
|
|
3
|
+
*
|
|
4
|
+
* One path for every serving pid, whether the facet manager launched it (a
|
|
5
|
+
* node/runtime resident with a journal row) or the session runs it in
|
|
6
|
+
* process (the Cirrus Vite shim, real-vite, `vite preview`, a builtin that
|
|
7
|
+
* adopted a shell wrapper pid). The manager's registration stamps the
|
|
8
|
+
* journal row when there is one, reads the process table's identity when
|
|
9
|
+
* there is not, and re-adopts a reservation the identity owns instead of
|
|
10
|
+
* retiring its capability — which is what lets a dev server exposed under a
|
|
11
|
+
* name come back on the same shared link after a restart or a hibernation.
|
|
12
|
+
*
|
|
13
|
+
* The bare registration below is only for a session that has no manager at
|
|
14
|
+
* all; every DO route that serves a port stands one up first.
|
|
15
|
+
*/
|
|
16
|
+
import { clearPortCapability } from './port-capability.js';
|
|
17
|
+
export async function registerServingPort(self, pid, port) {
|
|
18
|
+
self.ensureFacetManager?.();
|
|
19
|
+
if (self.facetManager) {
|
|
20
|
+
await self.facetManager.registerPort(pid, port);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// No manager means nothing resident is running — a bare registration
|
|
24
|
+
// retires the previous occupant's preview capability.
|
|
25
|
+
await clearPortCapability(self, port);
|
|
26
|
+
self.portRegistry.register(port, pid);
|
|
27
|
+
}
|
|
@@ -26,6 +26,18 @@ export interface StartRealViteOptions {
|
|
|
26
26
|
/** Directory the user's vite.config.{ts,js,mjs} is searched in (the shell
|
|
27
27
|
* cwd at start). Persisted so restore can re-bundle it. */
|
|
28
28
|
configDir: string;
|
|
29
|
+
/**
|
|
30
|
+
* The process-table cwd+argv the dev server's pid is given — what the app
|
|
31
|
+
* verbs derive its identity from. The `vite` builtin passes the wrapper
|
|
32
|
+
* pid's own (or the argv it was invoked with); restore passes what was
|
|
33
|
+
* persisted, so the restored server is the same application. Absent for
|
|
34
|
+
* configs written before identity was persisted: those keep the bare
|
|
35
|
+
* `[]` at the root, the same across every restore.
|
|
36
|
+
*/
|
|
37
|
+
identity?: {
|
|
38
|
+
cwd: string;
|
|
39
|
+
argv: string[];
|
|
40
|
+
};
|
|
29
41
|
/** Optional abort signal threaded into the heavy-alloc gate. */
|
|
30
42
|
signal?: AbortSignal;
|
|
31
43
|
/** Called with a human message if vite.config pre-bundling fails (so the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-real-vite.d.ts","sourceRoot":"","sources":["../../src/session/start-real-vite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAMtD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB;gEAC4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;4EACwE;IACxE,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,+EAA+E;IAC/E,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,8CAA8C;IAC9C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA8GvG"}
|
|
1
|
+
{"version":3,"file":"start-real-vite.d.ts","sourceRoot":"","sources":["../../src/session/start-real-vite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAMtD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB;gEAC4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC3C,gEAAgE;IAChE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;4EACwE;IACxE,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,+EAA+E;IAC/E,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,8CAA8C;IAC9C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA8GvG"}
|
|
@@ -22,7 +22,7 @@ import { CirrusReal } from '../facets/cirrus-real.js';
|
|
|
22
22
|
import { makeLongRunningPortStub } from '@nimbus-sh/core/runtime/long-running-handle.js';
|
|
23
23
|
import { acquireHeavyAlloc } from '@nimbus-sh/platform/heavy-alloc-coord.js';
|
|
24
24
|
import { VITE_CONFIG_KEY } from './keys.js';
|
|
25
|
-
import {
|
|
25
|
+
import { registerServingPort } from './serving-port.js';
|
|
26
26
|
/**
|
|
27
27
|
* Boot a cirrus-real dev server on `self`, register its port, and persist the
|
|
28
28
|
* config restore needs. `self` is the session host (RoutesHost/InitHost = any).
|
|
@@ -103,7 +103,7 @@ export async function startRealVite(self, opts) {
|
|
|
103
103
|
});
|
|
104
104
|
self.cirrusReal = cirrusReal;
|
|
105
105
|
// Reserve a PID so `ps`/logs show it like any other facet.
|
|
106
|
-
const entry = self.processes.spawn('vite (real, ' + opts.root + ')', [], opts.root, { longRunning: true });
|
|
106
|
+
const entry = self.processes.spawn('vite (real, ' + opts.root + ')', opts.identity?.argv ?? [], opts.identity?.cwd ?? opts.root, { longRunning: true });
|
|
107
107
|
// start() is async — it ASSETS-fetches the Vite/plugin-react bundles on
|
|
108
108
|
// first invocation (cached per-isolate after).
|
|
109
109
|
await cirrusReal.start(self.ctx, entry.pid);
|
|
@@ -111,8 +111,7 @@ export async function startRealVite(self, opts) {
|
|
|
111
111
|
// only difference is which handler.handleRequest the stub forwards into.
|
|
112
112
|
const cirrusStub = makeLongRunningPortStub(cirrusReal);
|
|
113
113
|
self.portRegistry.bindFacetStub(entry.pid, cirrusStub);
|
|
114
|
-
await
|
|
115
|
-
self.portRegistry.register(opts.port, entry.pid);
|
|
114
|
+
await registerServingPort(self, entry.pid, opts.port);
|
|
116
115
|
self._viteShimPid = entry.pid;
|
|
117
116
|
self._viteShimPort = opts.port;
|
|
118
117
|
// Persist so the session recovers after hibernation — same key the shim
|
|
@@ -125,6 +124,7 @@ export async function startRealVite(self, opts) {
|
|
|
125
124
|
port: opts.port,
|
|
126
125
|
basePath: opts.basePath,
|
|
127
126
|
configDir: opts.configDir,
|
|
127
|
+
identity: { cwd: entry.cwd, argv: entry.argv },
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
catch { /* persistence is best-effort; the server still serves now */ }
|
|
@@ -29,8 +29,8 @@ export interface SessionSupervisorHost {
|
|
|
29
29
|
ensureSqliteFs(): void;
|
|
30
30
|
readonly sqliteFs: SqliteVFS | null;
|
|
31
31
|
readonly processes: SessionProcessSupervisor;
|
|
32
|
-
_rpcStdout(pid: number, data:
|
|
33
|
-
_rpcStderr(pid: number, data:
|
|
32
|
+
_rpcStdout(pid: number, data: Uint8Array): Promise<void>;
|
|
33
|
+
_rpcStderr(pid: number, data: Uint8Array): Promise<void>;
|
|
34
34
|
}
|
|
35
35
|
export interface SessionSupervisorOps {
|
|
36
36
|
readonly dispatch: (envelope: SupervisorOpEnvelope) => Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor-op.d.ts","sourceRoot":"","sources":["../../src/session/supervisor-op.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAI1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AAQtG;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,cAAc,IAAI,IAAI,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC;IAC7C,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"supervisor-op.d.ts","sourceRoot":"","sources":["../../src/session/supervisor-op.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAI1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AAQtG;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,cAAc,IAAI,IAAI,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC;IAC7C,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1D;AACD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxE,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,qBAAqB,CAAC;IACzD,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAQD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,qBAAqB,EAC3B,KAAK,CAAC,EAAE,uBAAuB,GAC9B,oBAAoB,CA8EtB"}
|
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
import { createSupervisorOpHandler, createSupervisorBridgeStore, } from '@nimbus-sh/core/workspace/supervisor-op.js';
|
|
19
19
|
import { FsReadRangeArgsSchema, rangeReadBytes, withReadAllocation, } from './rpc.js';
|
|
20
20
|
import { dec } from '@nimbus-sh/core/_shared/bytes.js';
|
|
21
|
+
/** The stdout/stderr ops carry bytes; anything else is a caller bug, named. */
|
|
22
|
+
function outputBytesArg(value) {
|
|
23
|
+
if (value instanceof Uint8Array)
|
|
24
|
+
return value;
|
|
25
|
+
throw new Error(`supervisor op stdout/stderr: expected bytes, got ${typeof value}`);
|
|
26
|
+
}
|
|
21
27
|
export function buildSessionSupervisorOps(host, store) {
|
|
22
28
|
host.ensureSqliteFs();
|
|
23
29
|
store ??= createSupervisorBridgeStore({ vfs: host.sqliteFs, processes: host.processes });
|
|
@@ -26,7 +32,7 @@ export function buildSessionSupervisorOps(host, store) {
|
|
|
26
32
|
// alone doesn't know: a read lease sized to what the file can return.
|
|
27
33
|
readFile: async (envelope, tools) => {
|
|
28
34
|
const path = envelope.args?.[0];
|
|
29
|
-
const fs = tools.bridge(envelope.pid);
|
|
35
|
+
const fs = tools.bridge(envelope.pid, envelope.cred);
|
|
30
36
|
const stat = await fs.stat(path);
|
|
31
37
|
if (!stat)
|
|
32
38
|
return null;
|
|
@@ -37,7 +43,7 @@ export function buildSessionSupervisorOps(host, store) {
|
|
|
37
43
|
},
|
|
38
44
|
readFileBytes: async (envelope, tools) => {
|
|
39
45
|
const path = envelope.args?.[0];
|
|
40
|
-
const fs = tools.bridge(envelope.pid);
|
|
46
|
+
const fs = tools.bridge(envelope.pid, envelope.cred);
|
|
41
47
|
const stat = await fs.stat(path);
|
|
42
48
|
if (!stat)
|
|
43
49
|
return null;
|
|
@@ -49,7 +55,7 @@ export function buildSessionSupervisorOps(host, store) {
|
|
|
49
55
|
offset: envelope.args?.[1],
|
|
50
56
|
length: envelope.args?.[2],
|
|
51
57
|
});
|
|
52
|
-
const fs = tools.bridge(envelope.pid);
|
|
58
|
+
const fs = tools.bridge(envelope.pid, envelope.cred);
|
|
53
59
|
return withReadAllocation(await rangeReadBytes(fs, args.path, args.offset, args.length), () => fs.readRange(args.path, args.offset, args.length));
|
|
54
60
|
},
|
|
55
61
|
fsReadRangeUncached: async (envelope, tools) => {
|
|
@@ -58,7 +64,7 @@ export function buildSessionSupervisorOps(host, store) {
|
|
|
58
64
|
offset: envelope.args?.[1],
|
|
59
65
|
length: envelope.args?.[2],
|
|
60
66
|
});
|
|
61
|
-
const fs = tools.bridge(envelope.pid);
|
|
67
|
+
const fs = tools.bridge(envelope.pid, envelope.cred);
|
|
62
68
|
return withReadAllocation(await rangeReadBytes(fs, args.path, args.offset, args.length), () => fs.readRange(args.path, args.offset, args.length, { cached: false }));
|
|
63
69
|
},
|
|
64
70
|
// The write stream's decode-drain timestamp starts when the envelope
|
|
@@ -73,15 +79,15 @@ export function buildSessionSupervisorOps(host, store) {
|
|
|
73
79
|
if (pid !== undefined && (!Number.isInteger(pid) || pid <= 0)) {
|
|
74
80
|
throw new Error('filesystem RPC requires a valid process pid');
|
|
75
81
|
}
|
|
76
|
-
return tools.vfs.as(tools.cred(pid)).writeStream(envelope.stream, {
|
|
82
|
+
return tools.vfs.as(tools.cred(pid, envelope.cred)).writeStream(envelope.stream, {
|
|
77
83
|
decodeDrainStartedAt: performance.now(),
|
|
78
84
|
mutationOwner: envelope.mutationOwner,
|
|
79
85
|
});
|
|
80
86
|
},
|
|
81
87
|
// stdout/stderr are session methods, not bridge ops: mirroring,
|
|
82
88
|
// log-append and prior-generation filtering all live in _rpcStdout.
|
|
83
|
-
stdout: (envelope) => host._rpcStdout(envelope.pid ?? 0, envelope.args?.[0]),
|
|
84
|
-
stderr: (envelope) => host._rpcStderr(envelope.pid ?? 0, envelope.args?.[0]),
|
|
89
|
+
stdout: (envelope) => host._rpcStdout(envelope.pid ?? 0, outputBytesArg(envelope.args?.[0])),
|
|
90
|
+
stderr: (envelope) => host._rpcStderr(envelope.pid ?? 0, outputBytesArg(envelope.args?.[0])),
|
|
85
91
|
};
|
|
86
92
|
const dispatch = createSupervisorOpHandler({
|
|
87
93
|
vfs: host.sqliteFs,
|
|
@@ -274,8 +274,8 @@ export declare class SupervisorRPC extends WorkerEntrypoint {
|
|
|
274
274
|
}): Promise<PackumentReadThrough & {
|
|
275
275
|
events: SupervisorCacheStatEvent[];
|
|
276
276
|
}>;
|
|
277
|
-
stdout(data:
|
|
278
|
-
stderr(data:
|
|
277
|
+
stdout(data: Uint8Array): Promise<void>;
|
|
278
|
+
stderr(data: Uint8Array): Promise<void>;
|
|
279
279
|
/**
|
|
280
280
|
* Report process exit to the supervisor. Called from the facet's own
|
|
281
281
|
* `finally` block after I/O has drained. The supervisor uses this to
|
|
@@ -309,12 +309,12 @@ export declare class SupervisorRPC extends WorkerEntrypoint {
|
|
|
309
309
|
cpSpawn(req: any): Promise<{
|
|
310
310
|
childPid: number;
|
|
311
311
|
}>;
|
|
312
|
-
cpStdinWrite(childPid: number, data:
|
|
312
|
+
cpStdinWrite(childPid: number, data: Uint8Array): Promise<{
|
|
313
313
|
ok: boolean;
|
|
314
314
|
}>;
|
|
315
315
|
cpStdinEnd(childPid: number): Promise<void>;
|
|
316
316
|
cpReadStdin(childPid: number, waitMs: number): Promise<{
|
|
317
|
-
data:
|
|
317
|
+
data: Uint8Array;
|
|
318
318
|
ended: boolean;
|
|
319
319
|
resize?: {
|
|
320
320
|
columns: number;
|
|
@@ -325,14 +325,14 @@ export declare class SupervisorRPC extends WorkerEntrypoint {
|
|
|
325
325
|
cpReadOutput(childPid: number, fd: 1 | 2, sinceSeq: number, waitMs: number): Promise<{
|
|
326
326
|
chunks: {
|
|
327
327
|
seq: number;
|
|
328
|
-
data:
|
|
328
|
+
data: Uint8Array;
|
|
329
329
|
}[];
|
|
330
330
|
closed: boolean;
|
|
331
331
|
maxSeq: number;
|
|
332
332
|
}>;
|
|
333
333
|
cpDrainOutput(childPid: number): Promise<{
|
|
334
|
-
stdout:
|
|
335
|
-
stderr:
|
|
334
|
+
stdout: Uint8Array;
|
|
335
|
+
stderr: Uint8Array;
|
|
336
336
|
stdoutClosed: boolean;
|
|
337
337
|
stderrClosed: boolean;
|
|
338
338
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor-rpc.d.ts","sourceRoot":"","sources":["../../src/session/supervisor-rpc.ts"],"names":[],"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,OAAO,CAAC;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,UAAU,CAAC;QAAC,YAAY,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAE,CAAC;IAIlI,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI1D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAI1H;;;;;;;OAOG;IACG,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QACtD,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;KAClD,CAAC;CAGH"}
|
|
@@ -497,6 +497,10 @@ export class SupervisorRPC extends WorkerEntrypoint {
|
|
|
497
497
|
return { ...result, events: _drainCacheEvents(r2) };
|
|
498
498
|
}
|
|
499
499
|
// ── Process I/O ───────────────────────────────────────────────────────
|
|
500
|
+
//
|
|
501
|
+
// A process's stdio is bytes end to end: stdout/stderr up, cpStdinWrite
|
|
502
|
+
// down, cpReadStdin/cpReadOutput/cpDrainOutput in a child's direction. A
|
|
503
|
+
// text producer encodes at its own edge; a text consumer decodes at its.
|
|
500
504
|
async stdout(data) {
|
|
501
505
|
return this._call(this._op('stdout', [data], { pid: this._reportingPid() }));
|
|
502
506
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session/vite-command.ts — the `vite` builtin command.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from init.ts so the handler can be driven through the
|
|
5
|
+
* command registry in unit tests — the module's only session coupling
|
|
6
|
+
* is `self`, the same InitHost view initSession passes to every other
|
|
7
|
+
* registration.
|
|
8
|
+
*
|
|
9
|
+
* Subcommands: `vite` (dev server), `vite build`, `vite preview`,
|
|
10
|
+
* `vite stop`. Build honours build.outDir with Vite parity: output
|
|
11
|
+
* writes to the resolved path, only an outDir strictly inside the
|
|
12
|
+
* project root is emptied first, and the bundle is validated before
|
|
13
|
+
* old output is cleared.
|
|
14
|
+
*/
|
|
15
|
+
type ViteHost = any;
|
|
16
|
+
export declare function createViteCommand(self: ViteHost): (ctx: any) => Promise<number>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=vite-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-command.d.ts","sourceRoot":"","sources":["../../src/session/vite-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAyBH,KAAK,QAAQ,GAAG,GAAG,CAAC;AAEpB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,IAChC,KAAK,GAAG,KAAG,OAAO,CAAC,MAAM,CAAC,CAmlBzC"}
|