@rivet-dev/agentos-runtime-core 0.0.0-glibc.928bc3a → 0.0.0-main.29b0797
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 +1 -1
- package/commands/[ +0 -0
- package/commands/_stubs +0 -0
- package/commands/acl_tools +0 -0
- package/commands/arch +0 -0
- package/commands/attr +0 -0
- package/commands/awk +0 -0
- package/commands/b2sum +0 -0
- package/commands/base32 +0 -0
- package/commands/base64 +0 -0
- package/commands/basename +0 -0
- package/commands/basenc +0 -0
- package/commands/bash +0 -0
- package/commands/bc +0 -0
- package/commands/cat +0 -0
- package/commands/chacl +0 -0
- package/commands/chcon +0 -0
- package/commands/chgrp +0 -0
- package/commands/chmod +0 -0
- package/commands/chown +0 -0
- package/commands/chroot +0 -0
- package/commands/cksum +0 -0
- package/commands/cmp +0 -0
- package/commands/column +0 -0
- package/commands/comm +0 -0
- package/commands/cp +0 -0
- package/commands/curl +0 -0
- package/commands/cut +0 -0
- package/commands/date +0 -0
- package/commands/dd +0 -0
- package/commands/df +0 -0
- package/commands/diff +0 -0
- package/commands/dir +0 -0
- package/commands/dircolors +0 -0
- package/commands/dirname +0 -0
- package/commands/du +0 -0
- package/commands/echo +0 -0
- package/commands/egrep +0 -0
- package/commands/env +0 -0
- package/commands/envsubst +0 -0
- package/commands/expand +0 -0
- package/commands/expr +0 -0
- package/commands/factor +0 -0
- package/commands/false +0 -0
- package/commands/fd +0 -0
- package/commands/fgrep +0 -0
- package/commands/file +0 -0
- package/commands/find +0 -0
- package/commands/findmnt +0 -0
- package/commands/fmt +0 -0
- package/commands/fold +0 -0
- package/commands/getent +0 -0
- package/commands/getfacl +0 -0
- package/commands/getfattr +0 -0
- package/commands/git +0 -0
- package/commands/git-receive-pack +0 -0
- package/commands/git-remote-http +0 -0
- package/commands/git-remote-https +0 -0
- package/commands/git-upload-archive +0 -0
- package/commands/git-upload-pack +0 -0
- package/commands/grep +0 -0
- package/commands/groups +0 -0
- package/commands/gunzip +0 -0
- package/commands/gzip +0 -0
- package/commands/head +0 -0
- package/commands/hostid +0 -0
- package/commands/hostname +0 -0
- package/commands/http-test +0 -0
- package/commands/id +0 -0
- package/commands/install +0 -0
- package/commands/join +0 -0
- package/commands/jq +0 -0
- package/commands/kill +0 -0
- package/commands/link +0 -0
- package/commands/ln +0 -0
- package/commands/logname +0 -0
- package/commands/ls +0 -0
- package/commands/md5sum +0 -0
- package/commands/mkdir +0 -0
- package/commands/mkfifo +0 -0
- package/commands/mknod +0 -0
- package/commands/mktemp +0 -0
- package/commands/more +0 -0
- package/commands/mount +0 -0
- package/commands/mv +0 -0
- package/commands/nice +0 -0
- package/commands/nl +0 -0
- package/commands/nohup +0 -0
- package/commands/nproc +0 -0
- package/commands/numfmt +0 -0
- package/commands/od +0 -0
- package/commands/paste +0 -0
- package/commands/pathchk +0 -0
- package/commands/pinky +0 -0
- package/commands/printenv +0 -0
- package/commands/printf +0 -0
- package/commands/ptx +0 -0
- package/commands/pwd +0 -0
- package/commands/readlink +0 -0
- package/commands/realpath +0 -0
- package/commands/rev +0 -0
- package/commands/rg +0 -0
- package/commands/rm +0 -0
- package/commands/rmdir +0 -0
- package/commands/runas +0 -0
- package/commands/runcon +0 -0
- package/commands/sed +0 -0
- package/commands/seq +0 -0
- package/commands/setfacl +0 -0
- package/commands/setfattr +0 -0
- package/commands/sh +0 -0
- package/commands/sha1sum +0 -0
- package/commands/sha224sum +0 -0
- package/commands/sha256sum +0 -0
- package/commands/sha384sum +0 -0
- package/commands/sha512sum +0 -0
- package/commands/shred +0 -0
- package/commands/shuf +0 -0
- package/commands/sleep +0 -0
- package/commands/sort +0 -0
- package/commands/spawn-test-host +0 -0
- package/commands/split +0 -0
- package/commands/sqlite3 +0 -0
- package/commands/ssh +0 -0
- package/commands/ssh-keysign +0 -0
- package/commands/ssh-sk-helper +0 -0
- package/commands/stat +0 -0
- package/commands/stdbuf +0 -0
- package/commands/strings +0 -0
- package/commands/stty +0 -0
- package/commands/su +0 -0
- package/commands/sum +0 -0
- package/commands/sync +0 -0
- package/commands/tac +0 -0
- package/commands/tail +0 -0
- package/commands/tar +0 -0
- package/commands/tee +0 -0
- package/commands/test +0 -0
- package/commands/timeout +0 -0
- package/commands/touch +0 -0
- package/commands/tr +0 -0
- package/commands/tree +0 -0
- package/commands/true +0 -0
- package/commands/truncate +0 -0
- package/commands/tsort +0 -0
- package/commands/tty +0 -0
- package/commands/uname +0 -0
- package/commands/unexpand +0 -0
- package/commands/uniq +0 -0
- package/commands/unlink +0 -0
- package/commands/unzip +0 -0
- package/commands/uptime +0 -0
- package/commands/users +0 -0
- package/commands/vdir +0 -0
- package/commands/wc +0 -0
- package/commands/wget +0 -0
- package/commands/which +0 -0
- package/commands/who +0 -0
- package/commands/whoami +0 -0
- package/commands/xargs +0 -0
- package/commands/xattr_tools +0 -0
- package/commands/xfs_io +0 -0
- package/commands/xu +0 -0
- package/commands/yes +0 -0
- package/commands/yq +0 -0
- package/commands/zcat +0 -0
- package/commands/zip +0 -0
- package/dist/binary.js +4 -3
- package/dist/correlation.d.ts +1 -4
- package/dist/correlation.js +7 -10
- package/dist/descriptors.d.ts +2 -12
- package/dist/descriptors.js +10 -6
- package/dist/frame-rpc.d.ts +9 -4
- package/dist/frame-rpc.js +19 -2
- package/dist/frame-stream.d.ts +33 -0
- package/dist/frame-stream.js +113 -0
- package/dist/generated/AcpLimitsConfig.d.ts +16 -0
- package/dist/generated/BindingLimitsConfig.d.ts +10 -0
- package/dist/generated/CreateVmConfig.d.ts +4 -0
- package/dist/generated/Http2LimitsConfig.d.ts +12 -0
- package/dist/generated/Http2LimitsConfig.js +2 -0
- package/dist/generated/JsRuntimeLimitsConfig.d.ts +1 -0
- package/dist/generated/MountPluginDescriptor.d.ts +1 -1
- package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
- package/dist/generated/ProcessLimitsConfig.js +2 -0
- package/dist/generated/ReactorLimitsConfig.d.ts +23 -0
- package/dist/generated/ReactorLimitsConfig.js +2 -0
- package/dist/generated/SqliteLimitsConfig.d.ts +3 -0
- package/dist/generated/SqliteLimitsConfig.js +2 -0
- package/dist/generated/TlsLimitsConfig.d.ts +3 -0
- package/dist/generated/TlsLimitsConfig.js +2 -0
- package/dist/generated/UdpLimitsConfig.d.ts +4 -0
- package/dist/generated/UdpLimitsConfig.js +2 -0
- package/dist/generated/VmGroupConfig.d.ts +5 -0
- package/dist/generated/VmGroupConfig.js +2 -0
- package/dist/generated/VmLimitsConfig.d.ts +14 -2
- package/dist/generated/VmSqliteDescriptor.d.ts +11 -0
- package/dist/generated/VmSqliteDescriptor.js +2 -0
- package/dist/generated/VmUserAccountConfig.d.ts +9 -0
- package/dist/generated/VmUserAccountConfig.js +2 -0
- package/dist/generated/VmUserConfig.d.ts +19 -0
- package/dist/generated/VmUserConfig.js +1 -0
- package/dist/generated/WasmLimitsConfig.d.ts +1 -0
- package/dist/generated-protocol.d.ts +60 -2
- package/dist/generated-protocol.js +166 -31
- package/dist/kernel-proxy.d.ts +5 -1
- package/dist/kernel-proxy.js +82 -40
- package/dist/native-client.d.ts +9 -5
- package/dist/native-client.js +41 -9
- package/dist/node-runtime-options-schema.d.ts +1 -1
- package/dist/node-runtime-options-schema.js +43 -1
- package/dist/node-runtime.d.ts +12 -3
- package/dist/node-runtime.js +8 -7
- package/dist/process.d.ts +3 -1
- package/dist/process.js +27 -8
- package/dist/protocol-client.d.ts +26 -4
- package/dist/protocol-client.js +164 -12
- package/dist/protocol-frames.d.ts +14 -3
- package/dist/protocol-frames.js +26 -1
- package/dist/protocol-schema.d.ts +1 -1
- package/dist/protocol-schema.js +1 -1
- package/dist/request-payloads.d.ts +4 -1
- package/dist/request-payloads.js +7 -2
- package/dist/response-payloads.d.ts +23 -2
- package/dist/response-payloads.js +34 -2
- package/dist/sidecar-errors.d.ts +37 -0
- package/dist/sidecar-errors.js +27 -0
- package/dist/sidecar-process.d.ts +20 -6
- package/dist/sidecar-process.js +79 -15
- package/dist/state.d.ts +6 -6
- package/dist/state.js +10 -11
- package/dist/test-runtime.d.ts +21 -6
- package/dist/test-runtime.js +130 -65
- package/dist/vm-config.d.ts +5 -1
- package/package.json +9 -6
- package/commands/codex +0 -0
- package/commands/codex-exec +0 -0
- package/commands/http_get +0 -0
- package/dist/generated/ToolLimitsConfig.d.ts +0 -10
- /package/dist/generated/{ToolLimitsConfig.js → BindingLimitsConfig.js} +0 -0
|
@@ -9,10 +9,9 @@ import type { LiveFilesystemOperation, LiveGuestRuntimeKind, LiveWasmPermissionT
|
|
|
9
9
|
import { type LiveEventFrame, type LiveSidecarRequestHandler, type LiveSidecarRequestFrame, type LiveSidecarResponseFrame, type ProtocolFramePayloadCodec } from "./protocol-frames.js";
|
|
10
10
|
import type { LiveGuestDirEntry } from "./response-payloads.js";
|
|
11
11
|
import { type LiveGuestFilesystemStat } from "./state.js";
|
|
12
|
-
export { SidecarProcessError, SidecarProcessExited, } from "./sidecar-errors.js";
|
|
12
|
+
export { SidecarProcessError, SidecarProcessExited, SidecarSilenceTimeout, } from "./sidecar-errors.js";
|
|
13
13
|
export { SidecarEventBufferOverflow } from "./event-buffer.js";
|
|
14
14
|
export { SidecarProcess as Sidecar };
|
|
15
|
-
export declare const NATIVE_SIDECAR_FRAME_TIMEOUT_MS = 120000;
|
|
16
15
|
type GuestRuntimeKind = Extract<LiveGuestRuntimeKind, "java_script" | "python" | "web_assembly">;
|
|
17
16
|
type WasmPermissionTier = LiveWasmPermissionTier;
|
|
18
17
|
export interface RootFilesystemEntry extends LiveRootFilesystemEntry {
|
|
@@ -105,20 +104,27 @@ export interface SidecarSpawnOptions {
|
|
|
105
104
|
cwd?: string;
|
|
106
105
|
command?: string;
|
|
107
106
|
args?: string[];
|
|
108
|
-
frameTimeoutMs?: number;
|
|
109
107
|
eventBufferCapacity?: number;
|
|
108
|
+
gracefulExitMs?: number;
|
|
109
|
+
forceExitMs?: number;
|
|
110
110
|
payloadCodec?: NativeTransportPayloadCodec;
|
|
111
|
+
/**
|
|
112
|
+
* Override the sidecar silence watchdog window (default 30s). Tests only —
|
|
113
|
+
* it is a fixed protocol constant paired with the sidecar's 10s heartbeat
|
|
114
|
+
* cadence, not an operator tunable.
|
|
115
|
+
*/
|
|
116
|
+
silenceTimeoutMs?: number;
|
|
111
117
|
}
|
|
112
118
|
export interface ResolvedSidecarSpawnOptions {
|
|
113
119
|
cwd?: string;
|
|
114
120
|
command?: string;
|
|
115
121
|
args: string[];
|
|
116
|
-
frameTimeoutMs: number;
|
|
117
122
|
eventBufferCapacity: number;
|
|
118
123
|
gracefulExitMs: number;
|
|
119
124
|
forceExitMs: number;
|
|
120
125
|
disposedErrorMessage: string;
|
|
121
126
|
payloadCodec: NativeTransportPayloadCodec;
|
|
127
|
+
silenceTimeoutMs?: number;
|
|
122
128
|
}
|
|
123
129
|
type SidecarProcessSpawnFactory = (options: ResolvedSidecarSpawnOptions) => SidecarProcessTransport;
|
|
124
130
|
export declare function registerSidecarProcessSpawnFactory(factory: SidecarProcessSpawnFactory): void;
|
|
@@ -146,6 +152,8 @@ export interface SidecarMountPluginDescriptor {
|
|
|
146
152
|
}
|
|
147
153
|
export interface SidecarMountDescriptor {
|
|
148
154
|
guestPath: string;
|
|
155
|
+
guestSource?: string;
|
|
156
|
+
guestFstype?: string;
|
|
149
157
|
readOnly: boolean;
|
|
150
158
|
plugin: SidecarMountPluginDescriptor;
|
|
151
159
|
}
|
|
@@ -238,7 +246,7 @@ export declare class SidecarProcess {
|
|
|
238
246
|
packages?: SidecarPackageDescriptor[];
|
|
239
247
|
packagesMountAt?: string;
|
|
240
248
|
bootstrapCommands?: string[];
|
|
241
|
-
|
|
249
|
+
bindingShimCommands?: string[];
|
|
242
250
|
}): Promise<SidecarVmConfiguredResponse>;
|
|
243
251
|
/**
|
|
244
252
|
* Runtime dynamic `linkSoftware`: project one package into the live
|
|
@@ -266,10 +274,16 @@ export declare class SidecarProcess {
|
|
|
266
274
|
lowerLayerIds: string[];
|
|
267
275
|
}): Promise<string>;
|
|
268
276
|
bootstrapRootFilesystem(session: AuthenticatedSession, vm: CreatedVm, entries: RootFilesystemEntry[]): Promise<void>;
|
|
269
|
-
snapshotRootFilesystem(session: AuthenticatedSession, vm: CreatedVm): Promise<RootFilesystemEntry[]>;
|
|
277
|
+
snapshotRootFilesystem(session: AuthenticatedSession, vm: CreatedVm, maxBytes: number): Promise<RootFilesystemEntry[]>;
|
|
278
|
+
listMounts(session: AuthenticatedSession, vm: CreatedVm): Promise<Array<{
|
|
279
|
+
path: string;
|
|
280
|
+
kind: string;
|
|
281
|
+
readOnly: boolean;
|
|
282
|
+
}>>;
|
|
270
283
|
readFile(session: AuthenticatedSession, vm: CreatedVm, path: string): Promise<Uint8Array>;
|
|
271
284
|
pread(session: AuthenticatedSession, vm: CreatedVm, path: string, offset: number, length: number): Promise<Uint8Array>;
|
|
272
285
|
writeFile(session: AuthenticatedSession, vm: CreatedVm, path: string, content: string | Uint8Array): Promise<void>;
|
|
286
|
+
pwrite(session: AuthenticatedSession, vm: CreatedVm, path: string, offset: number, content: Uint8Array): Promise<void>;
|
|
273
287
|
mkdir(session: AuthenticatedSession, vm: CreatedVm, path: string, options?: {
|
|
274
288
|
recursive?: boolean;
|
|
275
289
|
}): Promise<void>;
|
package/dist/sidecar-process.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { decodeGuestFilesystemContent, encodeGuestFilesystemContent, } from "./filesystem.js";
|
|
2
2
|
import { SIDECAR_PROTOCOL_SCHEMA } from "./protocol-schema.js";
|
|
3
|
-
export { SidecarProcessError, SidecarProcessExited, } from "./sidecar-errors.js";
|
|
3
|
+
export { SidecarProcessError, SidecarProcessExited, SidecarSilenceTimeout, } from "./sidecar-errors.js";
|
|
4
4
|
export { SidecarEventBufferOverflow } from "./event-buffer.js";
|
|
5
5
|
// `Sidecar` is the public name for the native sidecar process client. The class
|
|
6
6
|
// is `SidecarProcess` internally; consumers import it as `Sidecar` via the
|
|
7
7
|
// `@rivet-dev/agentos-runtime-core/sidecar-client` subpath and the package root.
|
|
8
8
|
export { SidecarProcess as Sidecar };
|
|
9
9
|
const BRIDGE_CONTRACT_VERSION = 1;
|
|
10
|
-
export const NATIVE_SIDECAR_FRAME_TIMEOUT_MS = 120_000;
|
|
11
10
|
const DEFAULT_SIDECAR_EVENT_BUFFER_CAPACITY = 4_096;
|
|
12
11
|
const DEFAULT_SIDECAR_GRACEFUL_EXIT_MS = 5_000;
|
|
13
12
|
const DEFAULT_SIDECAR_FORCE_EXIT_MS = 2_000;
|
|
@@ -31,10 +30,10 @@ export class SidecarProcess {
|
|
|
31
30
|
command: options.command,
|
|
32
31
|
args: options.args ?? [],
|
|
33
32
|
cwd: options.cwd,
|
|
34
|
-
|
|
33
|
+
silenceTimeoutMs: options.silenceTimeoutMs,
|
|
35
34
|
eventBufferCapacity: options.eventBufferCapacity ?? DEFAULT_SIDECAR_EVENT_BUFFER_CAPACITY,
|
|
36
|
-
gracefulExitMs: DEFAULT_SIDECAR_GRACEFUL_EXIT_MS,
|
|
37
|
-
forceExitMs: DEFAULT_SIDECAR_FORCE_EXIT_MS,
|
|
35
|
+
gracefulExitMs: options.gracefulExitMs ?? DEFAULT_SIDECAR_GRACEFUL_EXIT_MS,
|
|
36
|
+
forceExitMs: options.forceExitMs ?? DEFAULT_SIDECAR_FORCE_EXIT_MS,
|
|
38
37
|
disposedErrorMessage: "native sidecar disposed",
|
|
39
38
|
payloadCodec: options.payloadCodec ?? "bare",
|
|
40
39
|
});
|
|
@@ -148,7 +147,7 @@ export class SidecarProcess {
|
|
|
148
147
|
? { packages_mount_at: options.packagesMountAt }
|
|
149
148
|
: {}),
|
|
150
149
|
bootstrap_commands: options.bootstrapCommands ?? [],
|
|
151
|
-
|
|
150
|
+
binding_shim_commands: options.bindingShimCommands ?? [],
|
|
152
151
|
},
|
|
153
152
|
});
|
|
154
153
|
if (response.payload.type !== "vm_configured") {
|
|
@@ -362,7 +361,7 @@ export class SidecarProcess {
|
|
|
362
361
|
throw new Error(`unexpected bootstrap_root_filesystem response: ${response.payload.type}`);
|
|
363
362
|
}
|
|
364
363
|
}
|
|
365
|
-
async snapshotRootFilesystem(session, vm) {
|
|
364
|
+
async snapshotRootFilesystem(session, vm, maxBytes) {
|
|
366
365
|
const response = await this.sendRequest({
|
|
367
366
|
ownership: {
|
|
368
367
|
scope: "vm",
|
|
@@ -372,6 +371,7 @@ export class SidecarProcess {
|
|
|
372
371
|
},
|
|
373
372
|
payload: {
|
|
374
373
|
type: "snapshot_root_filesystem",
|
|
374
|
+
max_bytes: maxBytes,
|
|
375
375
|
},
|
|
376
376
|
});
|
|
377
377
|
if (response.payload.type !== "root_filesystem_snapshot") {
|
|
@@ -379,6 +379,25 @@ export class SidecarProcess {
|
|
|
379
379
|
}
|
|
380
380
|
return response.payload.entries;
|
|
381
381
|
}
|
|
382
|
+
async listMounts(session, vm) {
|
|
383
|
+
const response = await this.sendRequest({
|
|
384
|
+
ownership: {
|
|
385
|
+
scope: "vm",
|
|
386
|
+
connection_id: session.connectionId,
|
|
387
|
+
session_id: session.sessionId,
|
|
388
|
+
vm_id: vm.vmId,
|
|
389
|
+
},
|
|
390
|
+
payload: { type: "list_mounts" },
|
|
391
|
+
});
|
|
392
|
+
if (response.payload.type !== "mounts_listed") {
|
|
393
|
+
throw new Error(`unexpected list_mounts response: ${response.payload.type}`);
|
|
394
|
+
}
|
|
395
|
+
return response.payload.mounts.map((mount) => ({
|
|
396
|
+
path: mount.path,
|
|
397
|
+
kind: mount.kind,
|
|
398
|
+
readOnly: mount.read_only,
|
|
399
|
+
}));
|
|
400
|
+
}
|
|
382
401
|
async readFile(session, vm, path) {
|
|
383
402
|
const response = await this.guestFilesystemCall(session, vm, {
|
|
384
403
|
operation: "read_file",
|
|
@@ -404,6 +423,16 @@ export class SidecarProcess {
|
|
|
404
423
|
encoding: encoded.encoding,
|
|
405
424
|
});
|
|
406
425
|
}
|
|
426
|
+
async pwrite(session, vm, path, offset, content) {
|
|
427
|
+
const encoded = encodeGuestFilesystemContent(content);
|
|
428
|
+
await this.guestFilesystemCall(session, vm, {
|
|
429
|
+
operation: "pwrite",
|
|
430
|
+
path,
|
|
431
|
+
offset,
|
|
432
|
+
content: encoded.content,
|
|
433
|
+
encoding: encoded.encoding,
|
|
434
|
+
});
|
|
435
|
+
}
|
|
407
436
|
async mkdir(session, vm, path, options) {
|
|
408
437
|
await this.guestFilesystemCall(session, vm, {
|
|
409
438
|
operation: options?.recursive ? "mkdir" : "create_dir",
|
|
@@ -841,33 +870,66 @@ export class SidecarProcess {
|
|
|
841
870
|
}
|
|
842
871
|
async hostFilesystemCall(session, vm, request) {
|
|
843
872
|
const response = await this.sendRequest({
|
|
844
|
-
ownership: {
|
|
845
|
-
|
|
873
|
+
ownership: {
|
|
874
|
+
scope: "vm",
|
|
875
|
+
connection_id: session.connectionId,
|
|
876
|
+
session_id: session.sessionId,
|
|
877
|
+
vm_id: vm.vmId,
|
|
878
|
+
},
|
|
879
|
+
payload: {
|
|
880
|
+
type: "host_filesystem_call",
|
|
881
|
+
operation: request.operation,
|
|
882
|
+
path: request.path,
|
|
883
|
+
payload_size_bytes: request.payloadSizeBytes,
|
|
884
|
+
},
|
|
846
885
|
});
|
|
847
886
|
if (response.payload.type !== "filesystem_result") {
|
|
848
887
|
throw new Error(`unexpected host_filesystem_call response: ${response.payload.type}`);
|
|
849
888
|
}
|
|
850
|
-
return {
|
|
889
|
+
return {
|
|
890
|
+
operation: response.payload.operation,
|
|
891
|
+
status: response.payload.status,
|
|
892
|
+
payloadSizeBytes: response.payload.payload_size_bytes,
|
|
893
|
+
};
|
|
851
894
|
}
|
|
852
895
|
async persistenceLoad(session, key) {
|
|
853
896
|
const response = await this.sendRequest({
|
|
854
|
-
ownership: {
|
|
897
|
+
ownership: {
|
|
898
|
+
scope: "session",
|
|
899
|
+
connection_id: session.connectionId,
|
|
900
|
+
session_id: session.sessionId,
|
|
901
|
+
},
|
|
855
902
|
payload: { type: "persistence_load", key },
|
|
856
903
|
});
|
|
857
904
|
if (response.payload.type !== "persistence_state") {
|
|
858
905
|
throw new Error(`unexpected persistence_load response: ${response.payload.type}`);
|
|
859
906
|
}
|
|
860
|
-
return {
|
|
907
|
+
return {
|
|
908
|
+
key: response.payload.key,
|
|
909
|
+
found: response.payload.found,
|
|
910
|
+
payloadSizeBytes: response.payload.payload_size_bytes,
|
|
911
|
+
};
|
|
861
912
|
}
|
|
862
913
|
async persistenceFlush(session, request) {
|
|
863
914
|
const response = await this.sendRequest({
|
|
864
|
-
ownership: {
|
|
865
|
-
|
|
915
|
+
ownership: {
|
|
916
|
+
scope: "session",
|
|
917
|
+
connection_id: session.connectionId,
|
|
918
|
+
session_id: session.sessionId,
|
|
919
|
+
},
|
|
920
|
+
payload: {
|
|
921
|
+
type: "persistence_flush",
|
|
922
|
+
key: request.key,
|
|
923
|
+
payload_size_bytes: request.payloadSizeBytes,
|
|
924
|
+
},
|
|
866
925
|
});
|
|
867
926
|
if (response.payload.type !== "persistence_flushed") {
|
|
868
927
|
throw new Error(`unexpected persistence_flush response: ${response.payload.type}`);
|
|
869
928
|
}
|
|
870
|
-
return {
|
|
929
|
+
return {
|
|
930
|
+
key: response.payload.key,
|
|
931
|
+
committedBytes: response.payload.committed_bytes,
|
|
932
|
+
};
|
|
871
933
|
}
|
|
872
934
|
async waitForEvent(matcher, timeoutMs, options) {
|
|
873
935
|
return await this.protocolClient.waitForEvent(matcher, timeoutMs, options);
|
|
@@ -962,6 +1024,8 @@ function toWireRootFilesystemEntry(entry) {
|
|
|
962
1024
|
function toWireMountDescriptor(descriptor) {
|
|
963
1025
|
return {
|
|
964
1026
|
guest_path: descriptor.guestPath,
|
|
1027
|
+
guest_source: descriptor.guestSource ?? descriptor.plugin.id,
|
|
1028
|
+
guest_fstype: descriptor.guestFstype ?? descriptor.plugin.id,
|
|
965
1029
|
read_only: descriptor.readOnly,
|
|
966
1030
|
plugin: {
|
|
967
1031
|
id: descriptor.plugin.id,
|
package/dist/state.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as protocol from "./generated-protocol.js";
|
|
2
2
|
export interface LiveGuestFilesystemStat {
|
|
3
3
|
mode: number;
|
|
4
|
-
size:
|
|
5
|
-
blocks:
|
|
6
|
-
dev:
|
|
7
|
-
rdev:
|
|
4
|
+
size: bigint;
|
|
5
|
+
blocks: bigint;
|
|
6
|
+
dev: bigint;
|
|
7
|
+
rdev: bigint;
|
|
8
8
|
is_directory: boolean;
|
|
9
9
|
is_symbolic_link: boolean;
|
|
10
10
|
atime_ms: number;
|
|
11
11
|
mtime_ms: number;
|
|
12
12
|
ctime_ms: number;
|
|
13
13
|
birthtime_ms: number;
|
|
14
|
-
ino:
|
|
15
|
-
nlink:
|
|
14
|
+
ino: bigint;
|
|
15
|
+
nlink: bigint;
|
|
16
16
|
uid: number;
|
|
17
17
|
gid: number;
|
|
18
18
|
}
|
package/dist/state.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { bigIntToSafeNumber } from "./numbers.js";
|
|
2
1
|
import { fromGeneratedProcessSnapshotStatus } from "./protocol-maps.js";
|
|
3
2
|
export function fromGeneratedGuestFilesystemStat(stat) {
|
|
4
3
|
return {
|
|
5
4
|
mode: stat.mode,
|
|
6
|
-
size:
|
|
7
|
-
blocks:
|
|
8
|
-
dev:
|
|
9
|
-
rdev:
|
|
5
|
+
size: stat.size,
|
|
6
|
+
blocks: stat.blocks,
|
|
7
|
+
dev: stat.dev,
|
|
8
|
+
rdev: stat.rdev,
|
|
10
9
|
is_directory: stat.isDirectory,
|
|
11
10
|
is_symbolic_link: stat.isSymbolicLink,
|
|
12
|
-
atime_ms:
|
|
13
|
-
mtime_ms:
|
|
14
|
-
ctime_ms:
|
|
15
|
-
birthtime_ms:
|
|
16
|
-
ino:
|
|
17
|
-
nlink:
|
|
11
|
+
atime_ms: Number(stat.atimeMs),
|
|
12
|
+
mtime_ms: Number(stat.mtimeMs),
|
|
13
|
+
ctime_ms: Number(stat.ctimeMs),
|
|
14
|
+
birthtime_ms: Number(stat.birthtimeMs),
|
|
15
|
+
ino: stat.ino,
|
|
16
|
+
nlink: stat.nlink,
|
|
18
17
|
uid: stat.uid,
|
|
19
18
|
gid: stat.gid,
|
|
20
19
|
};
|
package/dist/test-runtime.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./native-client.js";
|
|
2
2
|
import { SidecarProcess } from "./kernel-proxy.js";
|
|
3
3
|
import type { JsRuntimeConfig } from "./generated/JsRuntimeConfig.js";
|
|
4
|
+
import type { VmUserConfig } from "./generated/VmUserConfig.js";
|
|
4
5
|
export declare const AF_INET = 2;
|
|
5
6
|
export declare const AF_UNIX = 1;
|
|
6
7
|
export declare const SOCK_STREAM = 1;
|
|
@@ -23,6 +24,7 @@ export interface VirtualDirEntry {
|
|
|
23
24
|
export interface VirtualStat {
|
|
24
25
|
mode: number;
|
|
25
26
|
size: number;
|
|
27
|
+
sizeExact?: bigint;
|
|
26
28
|
blocks: number;
|
|
27
29
|
dev: number;
|
|
28
30
|
rdev: number;
|
|
@@ -33,7 +35,9 @@ export interface VirtualStat {
|
|
|
33
35
|
ctimeMs: number;
|
|
34
36
|
birthtimeMs: number;
|
|
35
37
|
ino: number;
|
|
38
|
+
inoExact?: bigint;
|
|
36
39
|
nlink: number;
|
|
40
|
+
nlinkExact?: bigint;
|
|
37
41
|
uid: number;
|
|
38
42
|
gid: number;
|
|
39
43
|
}
|
|
@@ -58,7 +62,9 @@ export interface VirtualFileSystem {
|
|
|
58
62
|
lstat(path: string): Promise<VirtualStat>;
|
|
59
63
|
link(oldPath: string, newPath: string): Promise<void>;
|
|
60
64
|
chmod(path: string, mode: number): Promise<void>;
|
|
61
|
-
chown(path: string, uid: number, gid: number
|
|
65
|
+
chown(path: string, uid: number, gid: number, options?: {
|
|
66
|
+
followSymlinks?: boolean;
|
|
67
|
+
}): Promise<void>;
|
|
62
68
|
utimes(path: string, atime: number, mtime: number): Promise<void>;
|
|
63
69
|
truncate(path: string, length: number): Promise<void>;
|
|
64
70
|
pread(path: string, offset: number, length: number): Promise<Uint8Array>;
|
|
@@ -115,6 +121,7 @@ export interface ManagedProcess {
|
|
|
115
121
|
export interface ShellHandle {
|
|
116
122
|
pid: number;
|
|
117
123
|
write(data: Uint8Array | string): void;
|
|
124
|
+
/** Ordered PTY output containing stdout and stderr exactly once. */
|
|
118
125
|
onData: ((data: Uint8Array) => void) | null;
|
|
119
126
|
resize(cols: number, rows: number): void;
|
|
120
127
|
kill(signal?: number): void;
|
|
@@ -127,6 +134,7 @@ export interface OpenShellOptions {
|
|
|
127
134
|
cwd?: string;
|
|
128
135
|
cols?: number;
|
|
129
136
|
rows?: number;
|
|
137
|
+
/** Optional stderr-only diagnostic tap; do not render it alongside `onData`. */
|
|
130
138
|
onStderr?: (data: Uint8Array) => void;
|
|
131
139
|
}
|
|
132
140
|
export interface ConnectTerminalOptions extends OpenShellOptions {
|
|
@@ -179,7 +187,7 @@ export interface Permissions {
|
|
|
179
187
|
binding?: BindingPermissions;
|
|
180
188
|
}
|
|
181
189
|
/** A worked example shown alongside a registered binding. */
|
|
182
|
-
export interface
|
|
190
|
+
export interface BindingExample {
|
|
183
191
|
/** What this example demonstrates. */
|
|
184
192
|
description: string;
|
|
185
193
|
/** Example input matching the binding's input schema. */
|
|
@@ -201,7 +209,7 @@ export interface BindingDefinition {
|
|
|
201
209
|
/** Abort the invocation after this many milliseconds. */
|
|
202
210
|
timeoutMs?: number;
|
|
203
211
|
/** Worked examples shown alongside the binding. */
|
|
204
|
-
examples?:
|
|
212
|
+
examples?: BindingExample[];
|
|
205
213
|
/**
|
|
206
214
|
* Extra command names the guest can use to invoke this binding, in addition
|
|
207
215
|
* to the key it is registered under.
|
|
@@ -326,6 +334,7 @@ export interface Kernel extends KernelInterface {
|
|
|
326
334
|
removeFile(path: string): Promise<void>;
|
|
327
335
|
removeDir(path: string): Promise<void>;
|
|
328
336
|
rename(oldPath: string, newPath: string): Promise<void>;
|
|
337
|
+
pwrite(path: string, offset: number, data: Uint8Array): Promise<void>;
|
|
329
338
|
vmFetch(request: {
|
|
330
339
|
port: number;
|
|
331
340
|
method: string;
|
|
@@ -333,7 +342,7 @@ export interface Kernel extends KernelInterface {
|
|
|
333
342
|
headersJson: string;
|
|
334
343
|
body?: string;
|
|
335
344
|
}): Promise<string>;
|
|
336
|
-
|
|
345
|
+
registerBindings(bindings: Record<string, BindingDefinition>): Promise<void>;
|
|
337
346
|
getResourceSnapshot(): Promise<{
|
|
338
347
|
runningProcesses: number;
|
|
339
348
|
exitedProcesses: number;
|
|
@@ -450,7 +459,9 @@ export declare class InMemoryFileSystem implements VirtualFileSystem {
|
|
|
450
459
|
lstat(targetPath: string): Promise<VirtualStat>;
|
|
451
460
|
link(oldPath: string, newPath: string): Promise<void>;
|
|
452
461
|
chmod(targetPath: string, mode: number): Promise<void>;
|
|
453
|
-
chown(targetPath: string, uid: number, gid: number
|
|
462
|
+
chown(targetPath: string, uid: number, gid: number, options?: {
|
|
463
|
+
followSymlinks?: boolean;
|
|
464
|
+
}): Promise<void>;
|
|
454
465
|
utimes(targetPath: string, atime: number, mtime: number): Promise<void>;
|
|
455
466
|
truncate(targetPath: string, length: number): Promise<void>;
|
|
456
467
|
pread(targetPath: string, offset: number, length: number): Promise<Uint8Array>;
|
|
@@ -488,7 +499,9 @@ export declare class NodeFileSystem implements VirtualFileSystem {
|
|
|
488
499
|
lstat(targetPath: string): Promise<VirtualStat>;
|
|
489
500
|
link(oldPath: string, newPath: string): Promise<void>;
|
|
490
501
|
chmod(targetPath: string, mode: number): Promise<void>;
|
|
491
|
-
chown(targetPath: string, uid: number, gid: number
|
|
502
|
+
chown(targetPath: string, uid: number, gid: number, options?: {
|
|
503
|
+
followSymlinks?: boolean;
|
|
504
|
+
}): Promise<void>;
|
|
492
505
|
utimes(targetPath: string, atime: number, mtime: number): Promise<void>;
|
|
493
506
|
truncate(targetPath: string, length: number): Promise<void>;
|
|
494
507
|
pread(targetPath: string, offset: number, length: number): Promise<Uint8Array>;
|
|
@@ -547,6 +560,7 @@ export declare function createKernel(options: {
|
|
|
547
560
|
permissions?: Permissions;
|
|
548
561
|
env?: Record<string, string>;
|
|
549
562
|
cwd?: string;
|
|
563
|
+
user?: VmUserConfig;
|
|
550
564
|
sidecar?: SidecarProcess;
|
|
551
565
|
onBootTiming?: (timing: KernelBootTiming) => void;
|
|
552
566
|
maxProcesses?: number;
|
|
@@ -560,4 +574,5 @@ export declare function createKernel(options: {
|
|
|
560
574
|
readOnly?: boolean;
|
|
561
575
|
}>;
|
|
562
576
|
syncFilesystemOnDispose?: boolean;
|
|
577
|
+
maxFilesystemBytes?: number;
|
|
563
578
|
}): Kernel;
|