@nimbus-sh/worker 0.6.0 → 0.8.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 +677 -342
- 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/real-vite-hmr.d.ts +3 -1
- package/dist/facets/real-vite-hmr.d.ts.map +1 -1
- package/dist/facets/real-vite-hmr.js +18 -8
- 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/facets/ws-terminal.d.ts +9 -31
- package/dist/facets/ws-terminal.d.ts.map +1 -1
- package/dist/facets/ws-terminal.js +58 -51
- package/dist/git/network-facet.d.ts.map +1 -1
- package/dist/git/network-facet.js +6 -5
- package/dist/hosted/commands.d.ts +12 -0
- package/dist/hosted/commands.d.ts.map +1 -0
- package/dist/hosted/commands.js +1658 -0
- package/dist/hosted/runtime.d.ts +114 -0
- package/dist/hosted/runtime.d.ts.map +1 -0
- package/dist/hosted/runtime.js +288 -0
- package/dist/hosted/services.d.ts +40 -0
- package/dist/hosted/services.d.ts.map +1 -0
- package/dist/hosted/services.js +512 -0
- 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/bash-repl.d.ts +1 -1
- package/dist/runtime/bash-repl.d.ts.map +1 -1
- package/dist/runtime/bash-repl.js +38 -4
- package/dist/runtime/bun-runner.js +1 -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 +4 -1
- package/dist/runtime/node-runner.d.ts.map +1 -1
- package/dist/runtime/node-runner.js +9 -2
- 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 +16 -16
- package/dist/runtime/package-manager.d.ts +35 -122
- package/dist/runtime/package-manager.d.ts.map +1 -1
- package/dist/runtime/package-manager.js +61 -596
- package/dist/runtime/process-logs-api.d.ts +1 -1
- package/dist/runtime/process-logs-api.d.ts.map +1 -1
- package/dist/runtime/process-logs-api.js +1 -1
- package/dist/runtime/python-repl.d.ts +2 -1
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +82 -59
- package/dist/runtime/repl-session.d.ts +9 -47
- package/dist/runtime/repl-session.d.ts.map +1 -1
- package/dist/runtime/repl-session.js +105 -105
- package/dist/runtime/runtime-catalog.d.ts +13 -0
- package/dist/runtime/runtime-catalog.d.ts.map +1 -1
- package/dist/runtime/runtime-catalog.js +88 -0
- package/dist/session/agent.d.ts +1 -21
- package/dist/session/agent.d.ts.map +1 -1
- package/dist/session/ai.d.ts +5 -1
- package/dist/session/ai.d.ts.map +1 -1
- package/dist/session/ai.js +7 -0
- 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/hibernation.d.ts +2 -1
- package/dist/session/hibernation.d.ts.map +1 -1
- package/dist/session/hibernation.js +7 -4
- 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 -36
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +50 -2327
- package/dist/session/loopback.d.ts +2 -29
- package/dist/session/loopback.d.ts.map +1 -1
- package/dist/session/loopback.js +3 -27
- package/dist/session/nimbus-session.d.ts +77 -34
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +126 -514
- package/dist/session/npm-install-port.d.ts +18 -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 +36 -43
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +109 -115
- 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 +98 -49
- 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 +4 -4
- package/dist/session/supervisor-op.d.ts.map +1 -1
- package/dist/session/supervisor-op.js +24 -10
- 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/dist/workspace-host.d.ts +6 -0
- package/dist/workspace-host.d.ts.map +1 -0
- package/dist/workspace-host.js +5 -0
- package/dist/workspace.d.ts +2 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +1 -0
- package/package.json +34 -9
- 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,10 @@ 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
|
-
import {
|
|
45
|
-
import { clearPortCapability } from './port-capability.js';
|
|
44
|
+
import { registerServingPort } from './serving-port.js';
|
|
46
45
|
import { normalizeVfsPath, parentVfsPath } from '@nimbus-sh/core/vfs/path.js';
|
|
47
46
|
import { z } from 'zod/v4';
|
|
48
47
|
const WriteBatchInodeSchema = z.object({
|
|
@@ -81,9 +80,22 @@ function processPid(pid) {
|
|
|
81
80
|
* binding, the remote `/rpc` dispatcher, the static asset server — and those
|
|
82
81
|
* act as the unprivileged session user, the same identity `exec` runs as.
|
|
83
82
|
* A supplied-but-invalid pid still throws: only an absent pid is a host call.
|
|
83
|
+
*
|
|
84
|
+
* A host call may name the credential it acts as (`cred`) — the same
|
|
85
|
+
* `SqliteVFS.as(cred)` view an in-process caller has, reached over the RPC
|
|
86
|
+
* surface. That is the embedder's trusted surface: the SDK over the DO
|
|
87
|
+
* binding hands it through `files.as(cred)`; the remote `/rpc` dispatcher
|
|
88
|
+
* refuses it, exactly as it refuses `cred` on exec, because a token
|
|
89
|
+
* authenticates a session and not a user inside it. Absent, every file op
|
|
90
|
+
* keeps the identity it has always had. A pid and a cred together are
|
|
91
|
+
* refused, so a process can never widen its own identity.
|
|
84
92
|
*/
|
|
85
|
-
function callerCred(self, pid) {
|
|
86
|
-
|
|
93
|
+
function callerCred(self, pid, cred) {
|
|
94
|
+
if (pid === undefined)
|
|
95
|
+
return cred === undefined ? CRED_SESSION_USER : requireVfsCred(cred, 'filesystem RPC');
|
|
96
|
+
if (cred !== undefined)
|
|
97
|
+
throw new Error('filesystem RPC: a process acts as its own credential; cred cannot ride a pid');
|
|
98
|
+
return self.processes.cred(processPid(pid));
|
|
87
99
|
}
|
|
88
100
|
export function checkedReadPayloadBytes(bytes) {
|
|
89
101
|
if (!Number.isSafeInteger(bytes) || bytes < 0) {
|
|
@@ -128,16 +140,16 @@ export async function withReadAllocation(bytes, read) {
|
|
|
128
140
|
* The body lives in `buildSessionSupervisorOps`'s `readFile` override so
|
|
129
141
|
* direct `_rpc*` calls and the supervisor envelope share it.
|
|
130
142
|
*/
|
|
131
|
-
export async function _rpcReadFile(self, path, pid) {
|
|
132
|
-
return self.supervisorOp({ op: 'readFile', args: [path], pid });
|
|
143
|
+
export async function _rpcReadFile(self, path, pid, cred) {
|
|
144
|
+
return self.supervisorOp({ op: 'readFile', args: [path], pid, cred });
|
|
133
145
|
}
|
|
134
146
|
/**
|
|
135
147
|
* Read a file as raw bytes (Uint8Array). Used by git network facet for
|
|
136
148
|
* binary .git/objects/** and packfile reads, where TextDecoder/TextEncoder
|
|
137
149
|
* round-tripping through readFile (string) would corrupt bytes.
|
|
138
150
|
*/
|
|
139
|
-
export async function _rpcReadFileBytes(self, path, pid) {
|
|
140
|
-
return self.supervisorOp({ op: 'readFileBytes', args: [path], pid });
|
|
151
|
+
export async function _rpcReadFileBytes(self, path, pid, cred) {
|
|
152
|
+
return self.supervisorOp({ op: 'readFileBytes', args: [path], pid, cred });
|
|
141
153
|
}
|
|
142
154
|
/**
|
|
143
155
|
* Phase-3 inner-DO fetch dispatcher. Called by NimbusDOStub.fetch()
|
|
@@ -202,11 +214,11 @@ export async function _rpcInnerDoFetch(self, req) {
|
|
|
202
214
|
};
|
|
203
215
|
}
|
|
204
216
|
}
|
|
205
|
-
export async function _rpcWriteFile(self, path, content, pid) {
|
|
217
|
+
export async function _rpcWriteFile(self, path, content, pid, cred) {
|
|
206
218
|
// binary-fs wave: the bridge's writeFile already accepts
|
|
207
219
|
// string | Uint8Array — the shape arrives unchanged across structured
|
|
208
220
|
// clone.
|
|
209
|
-
return self.supervisorOp({ op: 'writeFile', args: [path, content], pid });
|
|
221
|
+
return self.supervisorOp({ op: 'writeFile', args: [path, content], pid, cred });
|
|
210
222
|
}
|
|
211
223
|
/**
|
|
212
224
|
* Write one host-governed file at a session root and let ordinary Unix
|
|
@@ -239,11 +251,11 @@ export async function _rpcWriteProtectedRootFile(self, rootPath, path, content)
|
|
|
239
251
|
fs.chown(protectedPath, CRED_KERNEL.uid, CRED_KERNEL.gid);
|
|
240
252
|
fs.chmod(protectedPath, 0o444);
|
|
241
253
|
}
|
|
242
|
-
export async function _rpcStat(self, path, pid) {
|
|
243
|
-
return self.supervisorOp({ op: 'stat', args: [path], pid });
|
|
254
|
+
export async function _rpcStat(self, path, pid, cred) {
|
|
255
|
+
return self.supervisorOp({ op: 'stat', args: [path], pid, cred });
|
|
244
256
|
}
|
|
245
|
-
export async function _rpcLstat(self, path, pid) {
|
|
246
|
-
return self.supervisorOp({ op: 'lstat', args: [path], pid });
|
|
257
|
+
export async function _rpcLstat(self, path, pid, cred) {
|
|
258
|
+
return self.supervisorOp({ op: 'lstat', args: [path], pid, cred });
|
|
247
259
|
}
|
|
248
260
|
export async function _rpcHasLegacySymlinkUnder(self, path, pid) {
|
|
249
261
|
return self.supervisorOp({ op: 'hasLegacySymlinkUnder', args: [path], pid });
|
|
@@ -251,8 +263,8 @@ export async function _rpcHasLegacySymlinkUnder(self, path, pid) {
|
|
|
251
263
|
export async function _rpcUtimes(self, path, atimeMs, mtimeMs, pid) {
|
|
252
264
|
await self.supervisorOp({ op: 'utimes', args: [path, atimeMs, mtimeMs], pid });
|
|
253
265
|
}
|
|
254
|
-
export async function _rpcChmod(self, path, mode, pid) {
|
|
255
|
-
await self.supervisorOp({ op: 'chmod', args: [path, mode], pid });
|
|
266
|
+
export async function _rpcChmod(self, path, mode, pid, cred) {
|
|
267
|
+
await self.supervisorOp({ op: 'chmod', args: [path, mode], pid, cred });
|
|
256
268
|
}
|
|
257
269
|
export async function _rpcAccess(self, path, mode, pid) {
|
|
258
270
|
await self.supervisorBridge(pid).access(path, mode);
|
|
@@ -263,20 +275,20 @@ export async function _rpcChown(self, path, uid, gid, pid, options) {
|
|
|
263
275
|
export async function _rpcSetUmask(self, mask, pid) {
|
|
264
276
|
return self.processes.setUmask(processPid(pid), mask);
|
|
265
277
|
}
|
|
266
|
-
export async function _rpcReaddir(self, path, pid) {
|
|
267
|
-
return self.supervisorOp({ op: 'readdir', args: [path], pid });
|
|
278
|
+
export async function _rpcReaddir(self, path, pid, cred) {
|
|
279
|
+
return self.supervisorOp({ op: 'readdir', args: [path], pid, cred });
|
|
268
280
|
}
|
|
269
|
-
export async function _rpcExists(self, path, pid) {
|
|
270
|
-
return self.supervisorOp({ op: 'exists', args: [path], pid });
|
|
281
|
+
export async function _rpcExists(self, path, pid, cred) {
|
|
282
|
+
return self.supervisorOp({ op: 'exists', args: [path], pid, cred });
|
|
271
283
|
}
|
|
272
|
-
export async function _rpcMkdir(self, path, pid) {
|
|
273
|
-
await self.supervisorOp({ op: 'mkdir', args: [path], pid });
|
|
284
|
+
export async function _rpcMkdir(self, path, pid, cred) {
|
|
285
|
+
await self.supervisorOp({ op: 'mkdir', args: [path], pid, cred });
|
|
274
286
|
}
|
|
275
287
|
export async function _rpcRmdir(self, path, pid) {
|
|
276
288
|
await self.supervisorOp({ op: 'rmdir', args: [path], pid });
|
|
277
289
|
}
|
|
278
|
-
export async function _rpcRename(self, from, to, pid) {
|
|
279
|
-
await self.supervisorOp({ op: 'rename', args: [from, to], pid });
|
|
290
|
+
export async function _rpcRename(self, from, to, pid, cred) {
|
|
291
|
+
await self.supervisorOp({ op: 'rename', args: [from, to], pid, cred });
|
|
280
292
|
}
|
|
281
293
|
export async function _rpcReadlink(self, path, pid) {
|
|
282
294
|
return self.supervisorOp({ op: 'readlink', args: [path], pid });
|
|
@@ -393,8 +405,8 @@ export async function _rpcFsList(self, after, limit, pid) {
|
|
|
393
405
|
const args = FsListArgsSchema.parse({ after: after ?? null, limit: limit ?? null });
|
|
394
406
|
return self.supervisorBridge(pid).list(args.after, args.limit ?? undefined);
|
|
395
407
|
}
|
|
396
|
-
export async function _rpcFsReadRange(self, path, offset, length, pid) {
|
|
397
|
-
return self.supervisorOp({ op: 'fsReadRange', args: [path, offset, length], pid });
|
|
408
|
+
export async function _rpcFsReadRange(self, path, offset, length, pid, cred) {
|
|
409
|
+
return self.supervisorOp({ op: 'fsReadRange', args: [path, offset, length], pid, cred });
|
|
398
410
|
}
|
|
399
411
|
/**
|
|
400
412
|
* The same read, through the same process credential and the same bridge, with
|
|
@@ -652,6 +664,17 @@ function isPriorGenerationPid(self, pid) {
|
|
|
652
664
|
return pid > 0 && pid <= self.processes.pidBase;
|
|
653
665
|
}
|
|
654
666
|
export const PRIOR_GENERATION_EXIT_REASON = 'process lost: instance reset';
|
|
667
|
+
/**
|
|
668
|
+
* A process's output arrives as bytes: the relay from the facet carries
|
|
669
|
+
* Uint8Array so a binary protocol or an image survives it. The two text
|
|
670
|
+
* consumers here decode at their own edge — the log ring inside
|
|
671
|
+
* `appendOutputBytes`, and the terminal tee through these per-(pid, stream)
|
|
672
|
+
* streaming decoders, dropped when the process reports its exit.
|
|
673
|
+
*/
|
|
674
|
+
const _terminalTeeDecoders = new StreamTextDecoders();
|
|
675
|
+
function decodeForTerminal(pid, stream, data) {
|
|
676
|
+
return _terminalTeeDecoders.decode(`${pid}:${stream}`, data);
|
|
677
|
+
}
|
|
655
678
|
export async function _rpcStdout(self, pid, data) {
|
|
656
679
|
// Prior-generation straggler (facet outlived a DO instance reset): drop —
|
|
657
680
|
// its output must not merge into this generation's logs or shell.
|
|
@@ -664,9 +687,11 @@ export async function _rpcStdout(self, pid, data) {
|
|
|
664
687
|
// un-traceable facets.
|
|
665
688
|
try {
|
|
666
689
|
if (pid > 0)
|
|
667
|
-
self.processes.
|
|
690
|
+
self.processes.appendOutputBytes(pid, 'stdout', data);
|
|
668
691
|
if (self.terminal && shouldMirrorProcessOutputToShell(self, pid)) {
|
|
669
|
-
|
|
692
|
+
const text = decodeForTerminal(pid, 'stdout', data);
|
|
693
|
+
if (text.length > 0)
|
|
694
|
+
self.terminal.write(normalizeTerminalNewlines(text));
|
|
670
695
|
}
|
|
671
696
|
}
|
|
672
697
|
catch (e) {
|
|
@@ -687,11 +712,13 @@ export async function _rpcStderr(self, pid, data) {
|
|
|
687
712
|
return;
|
|
688
713
|
try {
|
|
689
714
|
if (pid > 0)
|
|
690
|
-
self.processes.
|
|
715
|
+
self.processes.appendOutputBytes(pid, 'stderr', data);
|
|
691
716
|
// Terminal gets red wrapping; the ring buffer keeps it raw so the
|
|
692
717
|
// stream tag can drive color decisions at replay time.
|
|
693
718
|
if (self.terminal && shouldMirrorProcessOutputToShell(self, pid)) {
|
|
694
|
-
|
|
719
|
+
const text = decodeForTerminal(pid, 'stderr', data);
|
|
720
|
+
if (text.length > 0)
|
|
721
|
+
self.terminal.write(`\x1b[31m${normalizeTerminalNewlines(text)}\x1b[0m`);
|
|
695
722
|
}
|
|
696
723
|
}
|
|
697
724
|
catch (e) {
|
|
@@ -739,6 +766,12 @@ export async function _rpcReportExit(self, pid, code, tail) {
|
|
|
739
766
|
self.processes.closeInput(pid);
|
|
740
767
|
}
|
|
741
768
|
catch { }
|
|
769
|
+
for (const stream of ['stdout', 'stderr']) {
|
|
770
|
+
const rest = _terminalTeeDecoders.drop(`${pid}:${stream}`);
|
|
771
|
+
if (rest.length > 0 && self.terminal && shouldMirrorProcessOutputToShell(self, pid)) {
|
|
772
|
+
self.terminal.write(normalizeTerminalNewlines(rest));
|
|
773
|
+
}
|
|
774
|
+
}
|
|
742
775
|
// A relayed socket is held open by the supervisor on the process's behalf,
|
|
743
776
|
// so it does not die when the facet does. Nothing else would ever close
|
|
744
777
|
// it, and a live one keeps buffering into the supervisor's heap.
|
|
@@ -962,23 +995,21 @@ export async function _rpcPrefetch(self, cwd, entryCode) {
|
|
|
962
995
|
// want to refresh the bundle mid-execution; today only the
|
|
963
996
|
// SupervisorRPC.prefetch surface exposes it externally.
|
|
964
997
|
self.ensureSqliteFs();
|
|
965
|
-
|
|
966
|
-
|
|
998
|
+
// Dynamic import stays: keeps the resolver out of this module's eager
|
|
999
|
+
// graph (the original reason for the lazy load above).
|
|
1000
|
+
const { prefetchForRequire, ClosureBoundExceededError } = await import('@nimbus-sh/core/runtime/require-resolver.js');
|
|
1001
|
+
const outcome = prefetchForRequire(self.sqliteFs, entryCode, cwd);
|
|
1002
|
+
if ('kind' in outcome)
|
|
1003
|
+
throw new ClosureBoundExceededError(outcome);
|
|
1004
|
+
return outcome.bundle;
|
|
967
1005
|
}
|
|
968
1006
|
export async function _rpcRegisterPort(self, pid, port) {
|
|
969
1007
|
// 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);
|
|
1008
|
+
// is stored by FacetManager separately. The same registration every
|
|
1009
|
+
// serving process uses: through the manager, so the pid's identity —
|
|
1010
|
+
// its journal row, or the process table — decides whether a reservation's
|
|
1011
|
+
// capability is re-adopted or retired.
|
|
1012
|
+
await registerServingPort(self, pid, port);
|
|
982
1013
|
}
|
|
983
1014
|
export async function _rpcUnregisterPort(self, port) {
|
|
984
1015
|
self.portRegistry.unregister(port);
|
|
@@ -986,7 +1017,7 @@ export async function _rpcUnregisterPort(self, port) {
|
|
|
986
1017
|
export async function _rpcRouteLoopback(self, port, request) {
|
|
987
1018
|
// In-session loopback routing for a facet's outbound fetch — the same policy
|
|
988
1019
|
// as kernel.routeLoopback (session/init.ts) used by the shell curl/node path.
|
|
989
|
-
const res = await
|
|
1020
|
+
const res = await self.routeLoopback(port, request);
|
|
990
1021
|
return res ?? new Response(JSON.stringify({ error: 'connection refused (no server listening)', port }), { status: 502, headers: { 'Content-Type': 'application/json' } });
|
|
991
1022
|
}
|
|
992
1023
|
export async function _rpcTransform(self, code, loader) {
|
|
@@ -1019,14 +1050,29 @@ export async function _rpcCpSpawn(self, req) {
|
|
|
1019
1050
|
const fpm = self._ensureFacetProcessManager();
|
|
1020
1051
|
return fpm.spawn(req);
|
|
1021
1052
|
}
|
|
1053
|
+
/**
|
|
1054
|
+
* A child's stdin is bytes: esbuild's service protocol is binary packets,
|
|
1055
|
+
* and so is any pipe carrying an image or an archive. The facet queue and
|
|
1056
|
+
* this contract carry Uint8Array; the interactive input store is a text
|
|
1057
|
+
* channel fed by a terminal, so it decodes at its own edge with a streaming
|
|
1058
|
+
* decoder held per child, which keeps a multibyte character split across two
|
|
1059
|
+
* writes correct.
|
|
1060
|
+
*/
|
|
1061
|
+
const _cpStdinDecoders = new Map();
|
|
1022
1062
|
export async function _rpcCpStdinWrite(self, childPid, data) {
|
|
1023
1063
|
if (self.processes.hasInput(childPid)) {
|
|
1024
|
-
|
|
1064
|
+
let decoder = _cpStdinDecoders.get(childPid);
|
|
1065
|
+
if (!decoder) {
|
|
1066
|
+
decoder = new TextDecoder('utf-8');
|
|
1067
|
+
_cpStdinDecoders.set(childPid, decoder);
|
|
1068
|
+
}
|
|
1069
|
+
return self.processes.writeInput(childPid, decoder.decode(data, { stream: true }));
|
|
1025
1070
|
}
|
|
1026
1071
|
const fpm = self._ensureFacetProcessManager();
|
|
1027
1072
|
return fpm.stdinWrite(childPid, data);
|
|
1028
1073
|
}
|
|
1029
1074
|
export async function _rpcCpStdinEnd(self, childPid) {
|
|
1075
|
+
_cpStdinDecoders.delete(childPid);
|
|
1030
1076
|
if (self.processes.hasInput(childPid)) {
|
|
1031
1077
|
self.processes.endInput(childPid);
|
|
1032
1078
|
return;
|
|
@@ -1043,7 +1089,10 @@ export async function _rpcCpReadStdin(self, childPid, waitMs) {
|
|
|
1043
1089
|
return { signal: 'SIGKILL', ended: true };
|
|
1044
1090
|
}
|
|
1045
1091
|
if (self.processes.hasInput(childPid)) {
|
|
1046
|
-
|
|
1092
|
+
// The interactive input store holds text packets; the child's stdin
|
|
1093
|
+
// pump takes bytes, so this text producer encodes at its edge.
|
|
1094
|
+
const packet = await self.processes.readInput(childPid, waitMs);
|
|
1095
|
+
return { ...packet, data: enc.encode(packet.data) };
|
|
1047
1096
|
}
|
|
1048
1097
|
const fpm = self._ensureFacetProcessManager();
|
|
1049
1098
|
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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C,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 */ }
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* session's `_rpc*` methods — `host` IS the session — exactly as the
|
|
16
16
|
* canonical route table maps them.
|
|
17
17
|
*/
|
|
18
|
-
import { type SupervisorOpBridgeStore, type SupervisorOpEnvelope } from '@nimbus-sh/core/workspace/supervisor-op.js';
|
|
18
|
+
import { type SupervisorOpBridgeStore, type SupervisorOpEnvelope, type SupervisorOpHost } from '@nimbus-sh/core/workspace/supervisor-op.js';
|
|
19
19
|
import type { SqliteRuntimeFsBridge } from '@nimbus-sh/core/runtime/sqlite-runtime-fs-bridge.js';
|
|
20
20
|
import type { SqliteVFS } from '@nimbus-sh/core/vfs/sqlite-vfs.js';
|
|
21
21
|
import type { SessionProcessSupervisor } from '@nimbus-sh/core/runtime/session-process-supervisor.js';
|
|
@@ -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>;
|
|
@@ -38,5 +38,5 @@ export interface SessionSupervisorOps {
|
|
|
38
38
|
/** Drop a pid's bridge — a process exit ends its credential's validity. */
|
|
39
39
|
readonly forget: (pid: number) => void;
|
|
40
40
|
}
|
|
41
|
-
export declare function buildSessionSupervisorOps(host: SessionSupervisorHost, store?: SupervisorOpBridgeStore): SessionSupervisorOps;
|
|
41
|
+
export declare function buildSessionSupervisorOps(host: SessionSupervisorHost, store?: SupervisorOpBridgeStore, methods?: SupervisorOpHost): SessionSupervisorOps;
|
|
42
42
|
//# sourceMappingURL=supervisor-op.d.ts.map
|
|
@@ -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,
|
|
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,EAEzB,KAAK,gBAAgB,EAGtB,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,EAC/B,OAAO,CAAC,EAAE,gBAAgB,GACzB,oBAAoB,CAqFtB"}
|
|
@@ -15,10 +15,16 @@
|
|
|
15
15
|
* session's `_rpc*` methods — `host` IS the session — exactly as the
|
|
16
16
|
* canonical route table maps them.
|
|
17
17
|
*/
|
|
18
|
-
import { createSupervisorOpHandler, createSupervisorBridgeStore, } from '@nimbus-sh/core/workspace/supervisor-op.js';
|
|
18
|
+
import { createSupervisorOpHandler, createSupervisorBridgeStore, SUPERVISOR_OP_ROUTES, } 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
|
-
|
|
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
|
+
}
|
|
27
|
+
export function buildSessionSupervisorOps(host, store, methods) {
|
|
22
28
|
host.ensureSqliteFs();
|
|
23
29
|
store ??= createSupervisorBridgeStore({ vfs: host.sqliteFs, processes: host.processes });
|
|
24
30
|
const extend = {
|
|
@@ -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,22 +79,30 @@ 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,
|
|
88
94
|
processes: host.processes,
|
|
89
95
|
// The session IS the host — its _rpc* methods are the route table's
|
|
90
96
|
// targets. The index signature exists on the declared surface only.
|
|
91
|
-
host:
|
|
97
|
+
host: methods ?? Object.fromEntries(Object.values(SUPERVISOR_OP_ROUTES).map(({ method }) => [
|
|
98
|
+
method,
|
|
99
|
+
(...args) => {
|
|
100
|
+
const handler = Reflect.get(host, method);
|
|
101
|
+
if (typeof handler !== 'function')
|
|
102
|
+
throw new Error(`supervisor op: missing host method ${method}`);
|
|
103
|
+
return Reflect.apply(handler, host, args);
|
|
104
|
+
},
|
|
105
|
+
])),
|
|
92
106
|
bridge: store,
|
|
93
107
|
extend,
|
|
94
108
|
});
|
|
@@ -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":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAStD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAUrE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAEnF;;;;;;;GAOG;AACH,MAAM,MAAM,wBAAwB,GAChC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC;A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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
|
}
|