@rivet-dev/agentos-runtime-core 0.0.0-agent-acp-codex-session-benchmark.62b1f46
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 +7 -0
- package/commands/[ +0 -0
- package/commands/_stubs +0 -0
- package/commands/arch +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/cat +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/codex +0 -0
- package/commands/codex-exec +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/fmt +0 -0
- package/commands/fold +0 -0
- package/commands/git +0 -0
- package/commands/git-remote-http +0 -0
- package/commands/git-remote-https +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/http_get +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/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/runcon +0 -0
- package/commands/sed +0 -0
- package/commands/seq +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/stat +0 -0
- package/commands/stdbuf +0 -0
- package/commands/strings +0 -0
- package/commands/stty +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/which +0 -0
- package/commands/who +0 -0
- package/commands/whoami +0 -0
- package/commands/xargs +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.d.ts +4 -0
- package/dist/binary.js +25 -0
- package/dist/bytes.d.ts +2 -0
- package/dist/bytes.js +6 -0
- package/dist/callbacks.d.ts +41 -0
- package/dist/callbacks.js +94 -0
- package/dist/correlation.d.ts +7 -0
- package/dist/correlation.js +52 -0
- package/dist/descriptors.d.ts +81 -0
- package/dist/descriptors.js +57 -0
- package/dist/event-buffer.d.ts +98 -0
- package/dist/event-buffer.js +333 -0
- package/dist/ext.d.ts +7 -0
- package/dist/ext.js +13 -0
- package/dist/filesystem.d.ts +33 -0
- package/dist/filesystem.js +52 -0
- package/dist/frame-payload-codec.d.ts +8 -0
- package/dist/frame-payload-codec.js +14 -0
- package/dist/frame-rpc.d.ts +45 -0
- package/dist/frame-rpc.js +98 -0
- package/dist/frame-stream.d.ts +34 -0
- package/dist/frame-stream.js +109 -0
- package/dist/framing.d.ts +8 -0
- package/dist/framing.js +23 -0
- package/dist/generated/AcpLimitsConfig.d.ts +4 -0
- package/dist/generated/AcpLimitsConfig.js +2 -0
- package/dist/generated/CreateVmConfig.d.ts +26 -0
- package/dist/generated/CreateVmConfig.js +1 -0
- package/dist/generated/FsPermissionRule.d.ts +6 -0
- package/dist/generated/FsPermissionRule.js +1 -0
- package/dist/generated/FsPermissionRuleSet.d.ts +6 -0
- package/dist/generated/FsPermissionRuleSet.js +1 -0
- package/dist/generated/FsPermissionScope.d.ts +3 -0
- package/dist/generated/FsPermissionScope.js +1 -0
- package/dist/generated/HttpLimitsConfig.d.ts +3 -0
- package/dist/generated/HttpLimitsConfig.js +2 -0
- package/dist/generated/JsModuleResolution.d.ts +1 -0
- package/dist/generated/JsModuleResolution.js +2 -0
- package/dist/generated/JsRuntimeConfig.d.ts +31 -0
- package/dist/generated/JsRuntimeConfig.js +1 -0
- package/dist/generated/JsRuntimeLimitsConfig.d.ts +8 -0
- package/dist/generated/JsRuntimeLimitsConfig.js +2 -0
- package/dist/generated/JsRuntimePlatform.d.ts +1 -0
- package/dist/generated/JsRuntimePlatform.js +2 -0
- package/dist/generated/MountPluginDescriptor.d.ts +4 -0
- package/dist/generated/MountPluginDescriptor.js +2 -0
- package/dist/generated/NativeRootFilesystemConfig.d.ts +5 -0
- package/dist/generated/NativeRootFilesystemConfig.js +1 -0
- package/dist/generated/PatternPermissionRule.d.ts +6 -0
- package/dist/generated/PatternPermissionRule.js +1 -0
- package/dist/generated/PatternPermissionRuleSet.d.ts +6 -0
- package/dist/generated/PatternPermissionRuleSet.js +1 -0
- package/dist/generated/PatternPermissionScope.d.ts +3 -0
- package/dist/generated/PatternPermissionScope.js +1 -0
- package/dist/generated/PermissionMode.d.ts +1 -0
- package/dist/generated/PermissionMode.js +2 -0
- package/dist/generated/PermissionsPolicy.d.ts +10 -0
- package/dist/generated/PermissionsPolicy.js +1 -0
- package/dist/generated/PluginLimitsConfig.d.ts +4 -0
- package/dist/generated/PluginLimitsConfig.js +2 -0
- package/dist/generated/PythonLimitsConfig.d.ts +6 -0
- package/dist/generated/PythonLimitsConfig.js +2 -0
- package/dist/generated/ResourceLimitsConfig.d.ts +24 -0
- package/dist/generated/ResourceLimitsConfig.js +2 -0
- package/dist/generated/RootFilesystemConfig.d.ts +9 -0
- package/dist/generated/RootFilesystemConfig.js +1 -0
- package/dist/generated/RootFilesystemEntry.d.ts +13 -0
- package/dist/generated/RootFilesystemEntry.js +1 -0
- package/dist/generated/RootFilesystemEntryEncoding.d.ts +1 -0
- package/dist/generated/RootFilesystemEntryEncoding.js +2 -0
- package/dist/generated/RootFilesystemEntryKind.d.ts +1 -0
- package/dist/generated/RootFilesystemEntryKind.js +2 -0
- package/dist/generated/RootFilesystemLowerDescriptor.d.ts +7 -0
- package/dist/generated/RootFilesystemLowerDescriptor.js +1 -0
- package/dist/generated/RootFilesystemMode.d.ts +1 -0
- package/dist/generated/RootFilesystemMode.js +2 -0
- package/dist/generated/ToolLimitsConfig.d.ts +10 -0
- package/dist/generated/ToolLimitsConfig.js +2 -0
- package/dist/generated/VmDnsConfig.d.ts +6 -0
- package/dist/generated/VmDnsConfig.js +2 -0
- package/dist/generated/VmLimitsConfig.d.ts +18 -0
- package/dist/generated/VmLimitsConfig.js +1 -0
- package/dist/generated/VmListenPolicyConfig.d.ts +5 -0
- package/dist/generated/VmListenPolicyConfig.js +2 -0
- package/dist/generated/WasmLimitsConfig.d.ts +7 -0
- package/dist/generated/WasmLimitsConfig.js +2 -0
- package/dist/generated-protocol.d.ts +1452 -0
- package/dist/generated-protocol.js +3936 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +26 -0
- package/dist/json.d.ts +2 -0
- package/dist/json.js +20 -0
- package/dist/native-client.d.ts +47 -0
- package/dist/native-client.js +136 -0
- package/dist/numbers.d.ts +1 -0
- package/dist/numbers.js +8 -0
- package/dist/ownership.d.ts +18 -0
- package/dist/ownership.js +77 -0
- package/dist/permissions.d.ts +29 -0
- package/dist/permissions.js +68 -0
- package/dist/process.d.ts +22 -0
- package/dist/process.js +97 -0
- package/dist/protocol-client.d.ts +67 -0
- package/dist/protocol-client.js +270 -0
- package/dist/protocol-frames.d.ts +68 -0
- package/dist/protocol-frames.js +139 -0
- package/dist/protocol-maps.d.ts +31 -0
- package/dist/protocol-maps.js +273 -0
- package/dist/protocol-schema.d.ts +10 -0
- package/dist/protocol-schema.js +11 -0
- package/dist/request-payloads.d.ts +207 -0
- package/dist/request-payloads.js +357 -0
- package/dist/response-payloads.d.ts +268 -0
- package/dist/response-payloads.js +402 -0
- package/dist/sidecar-client.d.ts +19 -0
- package/dist/sidecar-client.js +1 -0
- package/dist/sidecar-errors.d.ts +44 -0
- package/dist/sidecar-errors.js +62 -0
- package/dist/sidecar-process.d.ts +434 -0
- package/dist/sidecar-process.js +1252 -0
- package/dist/state.d.ts +42 -0
- package/dist/state.js +45 -0
- package/dist/vm-config.d.ts +31 -0
- package/dist/vm-config.js +1 -0
- package/package.json +189 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { toExactArrayBuffer } from "./bytes.js";
|
|
2
|
+
import { toGeneratedMountDescriptor, toGeneratedPackageDescriptor, toGeneratedSidecarPlacement, } from "./descriptors.js";
|
|
3
|
+
import { toGeneratedExtEnvelope } from "./ext.js";
|
|
4
|
+
import { toGeneratedRootFilesystemEntry, } from "./filesystem.js";
|
|
5
|
+
import * as protocol from "./generated-protocol.js";
|
|
6
|
+
import { stringifyJsonUtf8 } from "./json.js";
|
|
7
|
+
import { toGeneratedPermissionsPolicy, } from "./permissions.js";
|
|
8
|
+
import { toGeneratedDisposeReason, toGeneratedFilesystemOperation, toGeneratedGuestFilesystemOperation, toGeneratedGuestRuntimeKind, toGeneratedRootFilesystemEntryEncoding, toGeneratedRootFilesystemMode, toGeneratedWasmPermissionTier, } from "./protocol-maps.js";
|
|
9
|
+
export function toGeneratedRequestPayload(payload) {
|
|
10
|
+
switch (payload.type) {
|
|
11
|
+
case "authenticate":
|
|
12
|
+
return {
|
|
13
|
+
tag: "AuthenticateRequest",
|
|
14
|
+
val: {
|
|
15
|
+
clientName: payload.client_name,
|
|
16
|
+
authToken: payload.auth_token,
|
|
17
|
+
protocolVersion: payload.protocol_version,
|
|
18
|
+
bridgeVersion: payload.bridge_version,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
case "open_session":
|
|
22
|
+
return {
|
|
23
|
+
tag: "OpenSessionRequest",
|
|
24
|
+
val: {
|
|
25
|
+
placement: toGeneratedSidecarPlacement(payload.placement),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
case "close_session":
|
|
29
|
+
return {
|
|
30
|
+
tag: "CloseSessionRequest",
|
|
31
|
+
val: { sessionId: payload.session_id },
|
|
32
|
+
};
|
|
33
|
+
case "create_vm":
|
|
34
|
+
return {
|
|
35
|
+
tag: "CreateVmRequest",
|
|
36
|
+
val: {
|
|
37
|
+
runtime: toGeneratedGuestRuntimeKind(payload.runtime),
|
|
38
|
+
config: stringifyJsonUtf8(payload.config, "create VM config"),
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
case "initialize_vm":
|
|
42
|
+
return {
|
|
43
|
+
tag: "InitializeVmRequest",
|
|
44
|
+
val: {
|
|
45
|
+
runtime: toGeneratedGuestRuntimeKind(payload.runtime),
|
|
46
|
+
config: stringifyJsonUtf8(payload.config, "initialize VM config"),
|
|
47
|
+
mounts: payload.mounts === undefined
|
|
48
|
+
? null
|
|
49
|
+
: payload.mounts.map(toGeneratedMountDescriptor),
|
|
50
|
+
packages: payload.packages === undefined
|
|
51
|
+
? null
|
|
52
|
+
: payload.packages.map(toGeneratedPackageDescriptor),
|
|
53
|
+
packagesMountAt: payload.packages_mount_at ?? null,
|
|
54
|
+
hostCallbacks: payload.host_callbacks === undefined
|
|
55
|
+
? null
|
|
56
|
+
: payload.host_callbacks.map(toGeneratedHostCallbackRegistration),
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
case "dispose_vm":
|
|
60
|
+
return {
|
|
61
|
+
tag: "DisposeVmRequest",
|
|
62
|
+
val: { reason: toGeneratedDisposeReason(payload.reason) },
|
|
63
|
+
};
|
|
64
|
+
case "bootstrap_root_filesystem":
|
|
65
|
+
return {
|
|
66
|
+
tag: "BootstrapRootFilesystemRequest",
|
|
67
|
+
val: { entries: payload.entries.map(toGeneratedRootFilesystemEntry) },
|
|
68
|
+
};
|
|
69
|
+
case "configure_vm":
|
|
70
|
+
return {
|
|
71
|
+
tag: "ConfigureVmRequest",
|
|
72
|
+
val: {
|
|
73
|
+
mounts: payload.mounts === undefined
|
|
74
|
+
? null
|
|
75
|
+
: payload.mounts.map(toGeneratedMountDescriptor),
|
|
76
|
+
permissions: toGeneratedPermissionsPolicy(payload.permissions),
|
|
77
|
+
commandPermissions: payload.command_permissions === undefined
|
|
78
|
+
? null
|
|
79
|
+
: new Map(Object.entries(payload.command_permissions).map(([name, tier]) => [
|
|
80
|
+
name,
|
|
81
|
+
toGeneratedWasmPermissionTier(tier),
|
|
82
|
+
])),
|
|
83
|
+
loopbackExemptPorts: payload.loopback_exempt_ports === undefined
|
|
84
|
+
? null
|
|
85
|
+
: new Uint16Array(payload.loopback_exempt_ports),
|
|
86
|
+
packages: payload.packages === undefined
|
|
87
|
+
? null
|
|
88
|
+
: payload.packages.map(toGeneratedPackageDescriptor),
|
|
89
|
+
packagesMountAt: payload.packages_mount_at ?? null,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
case "link_package":
|
|
93
|
+
return {
|
|
94
|
+
tag: "LinkPackageRequest",
|
|
95
|
+
val: {
|
|
96
|
+
package: toGeneratedPackageDescriptor(payload.package),
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
case "provided_commands":
|
|
100
|
+
return {
|
|
101
|
+
tag: "ProvidedCommandsRequest",
|
|
102
|
+
val: null,
|
|
103
|
+
};
|
|
104
|
+
case "schedule_cron":
|
|
105
|
+
return {
|
|
106
|
+
tag: "ScheduleCronRequest",
|
|
107
|
+
val: {
|
|
108
|
+
id: payload.id ?? null,
|
|
109
|
+
schedule: payload.schedule,
|
|
110
|
+
action: stringifyJsonUtf8(payload.action, "schedule_cron.action"),
|
|
111
|
+
overlap: payload.overlap === undefined
|
|
112
|
+
? null
|
|
113
|
+
: toGeneratedCronOverlap(payload.overlap),
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
case "list_cron_jobs":
|
|
117
|
+
return { tag: "ListCronJobsRequest", val: null };
|
|
118
|
+
case "cancel_cron_job":
|
|
119
|
+
return { tag: "CancelCronJobRequest", val: { id: payload.id } };
|
|
120
|
+
case "wake_cron":
|
|
121
|
+
return {
|
|
122
|
+
tag: "WakeCronRequest",
|
|
123
|
+
val: { generation: BigInt(payload.generation) },
|
|
124
|
+
};
|
|
125
|
+
case "complete_cron_run":
|
|
126
|
+
return {
|
|
127
|
+
tag: "CompleteCronRunRequest",
|
|
128
|
+
val: { runId: payload.run_id, error: payload.error ?? null },
|
|
129
|
+
};
|
|
130
|
+
case "export_cron_state":
|
|
131
|
+
return { tag: "ExportCronStateRequest", val: null };
|
|
132
|
+
case "import_cron_state":
|
|
133
|
+
return {
|
|
134
|
+
tag: "ImportCronStateRequest",
|
|
135
|
+
val: { state: payload.state },
|
|
136
|
+
};
|
|
137
|
+
case "register_host_callbacks":
|
|
138
|
+
return {
|
|
139
|
+
tag: "RegisterHostCallbacksRequest",
|
|
140
|
+
val: toGeneratedHostCallbackRegistration(payload),
|
|
141
|
+
};
|
|
142
|
+
case "create_layer":
|
|
143
|
+
return { tag: "CreateLayerRequest", val: null };
|
|
144
|
+
case "seal_layer":
|
|
145
|
+
return { tag: "SealLayerRequest", val: { layerId: payload.layer_id } };
|
|
146
|
+
case "import_snapshot":
|
|
147
|
+
return {
|
|
148
|
+
tag: "ImportSnapshotRequest",
|
|
149
|
+
val: { entries: payload.entries.map(toGeneratedRootFilesystemEntry) },
|
|
150
|
+
};
|
|
151
|
+
case "export_snapshot":
|
|
152
|
+
return {
|
|
153
|
+
tag: "ExportSnapshotRequest",
|
|
154
|
+
val: { layerId: payload.layer_id },
|
|
155
|
+
};
|
|
156
|
+
case "create_overlay":
|
|
157
|
+
return {
|
|
158
|
+
tag: "CreateOverlayRequest",
|
|
159
|
+
val: {
|
|
160
|
+
mode: payload.mode === undefined
|
|
161
|
+
? null
|
|
162
|
+
: toGeneratedRootFilesystemMode(payload.mode),
|
|
163
|
+
upperLayerId: payload.upper_layer_id ?? null,
|
|
164
|
+
lowerLayerIds: payload.lower_layer_ids,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
case "guest_filesystem_call":
|
|
168
|
+
return {
|
|
169
|
+
tag: "GuestFilesystemCallRequest",
|
|
170
|
+
val: {
|
|
171
|
+
operation: toGeneratedGuestFilesystemOperation(payload.operation),
|
|
172
|
+
path: payload.path,
|
|
173
|
+
destinationPath: payload.destination_path ?? null,
|
|
174
|
+
target: payload.target ?? null,
|
|
175
|
+
content: payload.content ?? null,
|
|
176
|
+
encoding: payload.encoding === undefined
|
|
177
|
+
? null
|
|
178
|
+
: toGeneratedRootFilesystemEntryEncoding(payload.encoding),
|
|
179
|
+
recursive: payload.recursive ?? null,
|
|
180
|
+
maxDepth: payload.max_depth ?? null,
|
|
181
|
+
mode: payload.mode ?? null,
|
|
182
|
+
uid: payload.uid ?? null,
|
|
183
|
+
gid: payload.gid ?? null,
|
|
184
|
+
atimeMs: toGeneratedOptionalU64(payload.atime_ms),
|
|
185
|
+
mtimeMs: toGeneratedOptionalU64(payload.mtime_ms),
|
|
186
|
+
len: toGeneratedOptionalU64(payload.len),
|
|
187
|
+
offset: toGeneratedOptionalU64(payload.offset),
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
case "guest_kernel_call":
|
|
191
|
+
return {
|
|
192
|
+
tag: "GuestKernelCallRequest",
|
|
193
|
+
val: {
|
|
194
|
+
executionId: payload.execution_id,
|
|
195
|
+
operation: payload.operation,
|
|
196
|
+
payload: payload.payload,
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
case "snapshot_root_filesystem":
|
|
200
|
+
return { tag: "SnapshotRootFilesystemRequest", val: null };
|
|
201
|
+
case "execute":
|
|
202
|
+
return {
|
|
203
|
+
tag: "ExecuteRequest",
|
|
204
|
+
val: {
|
|
205
|
+
processId: payload.process_id ?? null,
|
|
206
|
+
command: payload.command ?? null,
|
|
207
|
+
shellCommand: payload.shell_command ?? null,
|
|
208
|
+
runtime: payload.runtime === undefined
|
|
209
|
+
? null
|
|
210
|
+
: toGeneratedGuestRuntimeKind(payload.runtime),
|
|
211
|
+
entrypoint: payload.entrypoint ?? null,
|
|
212
|
+
args: payload.args ?? [],
|
|
213
|
+
env: payload.env === undefined
|
|
214
|
+
? null
|
|
215
|
+
: new Map(Object.entries(payload.env)),
|
|
216
|
+
cwd: payload.cwd ?? null,
|
|
217
|
+
wasmPermissionTier: payload.wasm_permission_tier === undefined
|
|
218
|
+
? null
|
|
219
|
+
: toGeneratedWasmPermissionTier(payload.wasm_permission_tier),
|
|
220
|
+
pty: payload.pty === undefined
|
|
221
|
+
? null
|
|
222
|
+
: {
|
|
223
|
+
cols: payload.pty.cols ?? null,
|
|
224
|
+
rows: payload.pty.rows ?? null,
|
|
225
|
+
},
|
|
226
|
+
keepStdinOpen: payload.keep_stdin_open ?? null,
|
|
227
|
+
timeoutMs: payload.timeout_ms === undefined
|
|
228
|
+
? null
|
|
229
|
+
: BigInt(payload.timeout_ms),
|
|
230
|
+
captureOutput: payload.capture_output ?? null,
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
case "write_stdin":
|
|
234
|
+
return {
|
|
235
|
+
tag: "WriteStdinRequest",
|
|
236
|
+
val: {
|
|
237
|
+
processId: payload.process_id,
|
|
238
|
+
chunk: toExactArrayBuffer(payload.chunk),
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
case "resize_pty":
|
|
242
|
+
return {
|
|
243
|
+
tag: "ResizePtyRequest",
|
|
244
|
+
val: {
|
|
245
|
+
processId: payload.process_id,
|
|
246
|
+
cols: payload.cols,
|
|
247
|
+
rows: payload.rows,
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
case "close_stdin":
|
|
251
|
+
return {
|
|
252
|
+
tag: "CloseStdinRequest",
|
|
253
|
+
val: { processId: payload.process_id },
|
|
254
|
+
};
|
|
255
|
+
case "kill_process":
|
|
256
|
+
return {
|
|
257
|
+
tag: "KillProcessRequest",
|
|
258
|
+
val: { processId: payload.process_id, signal: payload.signal },
|
|
259
|
+
};
|
|
260
|
+
case "get_process_snapshot":
|
|
261
|
+
return { tag: "GetProcessSnapshotRequest", val: null };
|
|
262
|
+
case "get_resource_snapshot":
|
|
263
|
+
return { tag: "GetResourceSnapshotRequest", val: null };
|
|
264
|
+
case "find_listener":
|
|
265
|
+
return {
|
|
266
|
+
tag: "FindListenerRequest",
|
|
267
|
+
val: {
|
|
268
|
+
host: payload.host ?? null,
|
|
269
|
+
port: payload.port ?? null,
|
|
270
|
+
path: payload.path ?? null,
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
case "find_bound_udp":
|
|
274
|
+
return {
|
|
275
|
+
tag: "FindBoundUdpRequest",
|
|
276
|
+
val: { host: payload.host ?? null, port: payload.port ?? null },
|
|
277
|
+
};
|
|
278
|
+
case "vm_fetch":
|
|
279
|
+
return {
|
|
280
|
+
tag: "VmFetchRequest",
|
|
281
|
+
val: {
|
|
282
|
+
port: payload.port,
|
|
283
|
+
method: payload.method,
|
|
284
|
+
path: payload.path,
|
|
285
|
+
headersJson: payload.headers_json,
|
|
286
|
+
body: payload.body ?? null,
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
case "get_signal_state":
|
|
290
|
+
return {
|
|
291
|
+
tag: "GetSignalStateRequest",
|
|
292
|
+
val: { processId: payload.process_id },
|
|
293
|
+
};
|
|
294
|
+
case "get_zombie_timer_count":
|
|
295
|
+
return { tag: "GetZombieTimerCountRequest", val: null };
|
|
296
|
+
case "host_filesystem_call":
|
|
297
|
+
return {
|
|
298
|
+
tag: "HostFilesystemCallRequest",
|
|
299
|
+
val: {
|
|
300
|
+
operation: toGeneratedFilesystemOperation(payload.operation),
|
|
301
|
+
path: payload.path,
|
|
302
|
+
payloadSizeBytes: BigInt(payload.payload_size_bytes),
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
case "persistence_load":
|
|
306
|
+
return {
|
|
307
|
+
tag: "PersistenceLoadRequest",
|
|
308
|
+
val: { key: payload.key },
|
|
309
|
+
};
|
|
310
|
+
case "persistence_flush":
|
|
311
|
+
return {
|
|
312
|
+
tag: "PersistenceFlushRequest",
|
|
313
|
+
val: {
|
|
314
|
+
key: payload.key,
|
|
315
|
+
payloadSizeBytes: BigInt(payload.payload_size_bytes),
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
case "ext":
|
|
319
|
+
return {
|
|
320
|
+
tag: "ExtEnvelope",
|
|
321
|
+
val: toGeneratedExtEnvelope(payload.envelope),
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function toGeneratedHostCallbackRegistration(registration) {
|
|
326
|
+
return {
|
|
327
|
+
name: registration.name,
|
|
328
|
+
description: registration.description,
|
|
329
|
+
callbacks: new Map(Object.entries(registration.callbacks).map(([name, callback]) => [
|
|
330
|
+
name,
|
|
331
|
+
{
|
|
332
|
+
description: callback.description,
|
|
333
|
+
inputSchema: stringifyJsonUtf8(callback.input_schema, "host callback input schema"),
|
|
334
|
+
timeoutMs: callback.timeout_ms === undefined
|
|
335
|
+
? null
|
|
336
|
+
: BigInt(callback.timeout_ms),
|
|
337
|
+
examples: (callback.examples ?? []).map((example) => ({
|
|
338
|
+
description: example.description,
|
|
339
|
+
input: stringifyJsonUtf8(example.input, "host callback example"),
|
|
340
|
+
})),
|
|
341
|
+
},
|
|
342
|
+
])),
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function toGeneratedCronOverlap(value) {
|
|
346
|
+
switch (value) {
|
|
347
|
+
case "allow":
|
|
348
|
+
return protocol.CronOverlap.Allow;
|
|
349
|
+
case "skip":
|
|
350
|
+
return protocol.CronOverlap.Skip;
|
|
351
|
+
case "queue":
|
|
352
|
+
return protocol.CronOverlap.Queue;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function toGeneratedOptionalU64(value) {
|
|
356
|
+
return value === undefined ? null : BigInt(value);
|
|
357
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { type LiveRootFilesystemEntry, type LiveRootFilesystemEntryEncoding } from "./filesystem.js";
|
|
2
|
+
import { type LiveExtEnvelope } from "./ext.js";
|
|
3
|
+
import * as protocol from "./generated-protocol.js";
|
|
4
|
+
import type { LiveCronOverlap } from "./request-payloads.js";
|
|
5
|
+
import { type LiveFilesystemOperation, type LiveGuestFilesystemOperation, type LiveSignalDispositionAction } from "./protocol-maps.js";
|
|
6
|
+
import { type LiveGuestFilesystemStat, type LiveProcessSnapshotEntry, type LiveSocketStateEntry } from "./state.js";
|
|
7
|
+
/** A directory child with its file type, from `read_dir` (no extra lstat). */
|
|
8
|
+
export interface LiveGuestDirEntry {
|
|
9
|
+
name: string;
|
|
10
|
+
path: string;
|
|
11
|
+
isDirectory: boolean;
|
|
12
|
+
isSymbolicLink: boolean;
|
|
13
|
+
size: bigint;
|
|
14
|
+
}
|
|
15
|
+
export interface LiveSignalHandlerRegistration {
|
|
16
|
+
action: LiveSignalDispositionAction;
|
|
17
|
+
mask: number[];
|
|
18
|
+
flags: number;
|
|
19
|
+
}
|
|
20
|
+
export interface LiveQueueSnapshotEntry {
|
|
21
|
+
name: string;
|
|
22
|
+
category: string;
|
|
23
|
+
depth: number;
|
|
24
|
+
high_water: number;
|
|
25
|
+
capacity: number;
|
|
26
|
+
fill_percent: number;
|
|
27
|
+
}
|
|
28
|
+
export interface LiveResourceSnapshot {
|
|
29
|
+
running_processes: number;
|
|
30
|
+
exited_processes: number;
|
|
31
|
+
fd_tables: number;
|
|
32
|
+
open_fds: number;
|
|
33
|
+
pipes: number;
|
|
34
|
+
pipe_buffered_bytes: number;
|
|
35
|
+
ptys: number;
|
|
36
|
+
pty_buffered_input_bytes: number;
|
|
37
|
+
pty_buffered_output_bytes: number;
|
|
38
|
+
sockets: number;
|
|
39
|
+
socket_listeners: number;
|
|
40
|
+
socket_connections: number;
|
|
41
|
+
socket_buffered_bytes: number;
|
|
42
|
+
socket_datagram_queue_len: number;
|
|
43
|
+
queue_snapshots: LiveQueueSnapshotEntry[];
|
|
44
|
+
}
|
|
45
|
+
export interface LiveProjectedCommand {
|
|
46
|
+
name: string;
|
|
47
|
+
guest_path: string;
|
|
48
|
+
}
|
|
49
|
+
export interface LivePackageCommands {
|
|
50
|
+
package_name: string;
|
|
51
|
+
commands: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface LiveAgentosProjectedAgent {
|
|
54
|
+
id: string;
|
|
55
|
+
acp_entrypoint: string;
|
|
56
|
+
adapter_entrypoint: string;
|
|
57
|
+
}
|
|
58
|
+
export interface LiveCronAlarm {
|
|
59
|
+
generation: number;
|
|
60
|
+
next_alarm_ms?: number;
|
|
61
|
+
}
|
|
62
|
+
export interface LiveCronJobEntry {
|
|
63
|
+
id: string;
|
|
64
|
+
schedule: string;
|
|
65
|
+
action: unknown;
|
|
66
|
+
overlap: LiveCronOverlap;
|
|
67
|
+
last_run_ms?: number;
|
|
68
|
+
next_run_ms?: number;
|
|
69
|
+
run_count: number;
|
|
70
|
+
running: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface LiveCronRun {
|
|
73
|
+
run_id: string;
|
|
74
|
+
job_id: string;
|
|
75
|
+
action: unknown;
|
|
76
|
+
}
|
|
77
|
+
export interface LiveCronEventRecord {
|
|
78
|
+
kind: "fire" | "complete" | "error";
|
|
79
|
+
job_id: string;
|
|
80
|
+
time_ms: number;
|
|
81
|
+
duration_ms?: number;
|
|
82
|
+
error?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface LiveCronDispatch {
|
|
85
|
+
alarm: LiveCronAlarm;
|
|
86
|
+
runs: LiveCronRun[];
|
|
87
|
+
events: LiveCronEventRecord[];
|
|
88
|
+
}
|
|
89
|
+
export type LiveResponsePayload = {
|
|
90
|
+
type: "authenticated";
|
|
91
|
+
sidecar_id: string;
|
|
92
|
+
connection_id: string;
|
|
93
|
+
max_frame_bytes: number;
|
|
94
|
+
} | {
|
|
95
|
+
type: "session_opened";
|
|
96
|
+
session_id: string;
|
|
97
|
+
owner_connection_id: string;
|
|
98
|
+
} | {
|
|
99
|
+
type: "session_closed";
|
|
100
|
+
session_id: string;
|
|
101
|
+
} | {
|
|
102
|
+
type: "vm_created";
|
|
103
|
+
vm_id: string;
|
|
104
|
+
guest_cwd: string;
|
|
105
|
+
guest_env: Record<string, string>;
|
|
106
|
+
process_route_retention: number;
|
|
107
|
+
} | {
|
|
108
|
+
type: "vm_initialized";
|
|
109
|
+
vm_id: string;
|
|
110
|
+
guest_cwd: string;
|
|
111
|
+
guest_env: Record<string, string>;
|
|
112
|
+
process_route_retention: number;
|
|
113
|
+
applied_mounts: number;
|
|
114
|
+
projected_commands: LiveProjectedCommand[];
|
|
115
|
+
agents: LiveAgentosProjectedAgent[];
|
|
116
|
+
host_callbacks: Array<{
|
|
117
|
+
registration: string;
|
|
118
|
+
command_count: number;
|
|
119
|
+
}>;
|
|
120
|
+
} | {
|
|
121
|
+
type: "vm_configured";
|
|
122
|
+
applied_mounts: number;
|
|
123
|
+
projected_commands: LiveProjectedCommand[];
|
|
124
|
+
agents: LiveAgentosProjectedAgent[];
|
|
125
|
+
} | {
|
|
126
|
+
type: "package_linked";
|
|
127
|
+
projected_commands: LiveProjectedCommand[];
|
|
128
|
+
agents: LiveAgentosProjectedAgent[];
|
|
129
|
+
} | {
|
|
130
|
+
type: "provided_commands_response";
|
|
131
|
+
packages: LivePackageCommands[];
|
|
132
|
+
} | {
|
|
133
|
+
type: "cron_scheduled";
|
|
134
|
+
id: string;
|
|
135
|
+
alarm: LiveCronAlarm;
|
|
136
|
+
} | {
|
|
137
|
+
type: "cron_jobs";
|
|
138
|
+
jobs: LiveCronJobEntry[];
|
|
139
|
+
alarm: LiveCronAlarm;
|
|
140
|
+
} | {
|
|
141
|
+
type: "cron_cancelled";
|
|
142
|
+
id: string;
|
|
143
|
+
cancelled: boolean;
|
|
144
|
+
alarm: LiveCronAlarm;
|
|
145
|
+
} | {
|
|
146
|
+
type: "cron_wake";
|
|
147
|
+
alarm: LiveCronAlarm;
|
|
148
|
+
runs: LiveCronRun[];
|
|
149
|
+
events: LiveCronEventRecord[];
|
|
150
|
+
} | {
|
|
151
|
+
type: "cron_run_completed";
|
|
152
|
+
alarm: LiveCronAlarm;
|
|
153
|
+
runs: LiveCronRun[];
|
|
154
|
+
events: LiveCronEventRecord[];
|
|
155
|
+
} | {
|
|
156
|
+
type: "cron_state_exported";
|
|
157
|
+
state: string;
|
|
158
|
+
} | {
|
|
159
|
+
type: "cron_state_imported";
|
|
160
|
+
alarm: LiveCronAlarm;
|
|
161
|
+
runs: LiveCronRun[];
|
|
162
|
+
events: LiveCronEventRecord[];
|
|
163
|
+
} | {
|
|
164
|
+
type: "host_callbacks_registered";
|
|
165
|
+
registration: string;
|
|
166
|
+
command_count: number;
|
|
167
|
+
} | {
|
|
168
|
+
type: "layer_created";
|
|
169
|
+
layer_id: string;
|
|
170
|
+
} | {
|
|
171
|
+
type: "layer_sealed";
|
|
172
|
+
layer_id: string;
|
|
173
|
+
} | {
|
|
174
|
+
type: "snapshot_imported";
|
|
175
|
+
layer_id: string;
|
|
176
|
+
} | {
|
|
177
|
+
type: "snapshot_exported";
|
|
178
|
+
layer_id: string;
|
|
179
|
+
entries: LiveRootFilesystemEntry[];
|
|
180
|
+
} | {
|
|
181
|
+
type: "overlay_created";
|
|
182
|
+
layer_id: string;
|
|
183
|
+
} | {
|
|
184
|
+
type: "root_filesystem_bootstrapped";
|
|
185
|
+
entry_count: number;
|
|
186
|
+
} | {
|
|
187
|
+
type: "guest_filesystem_result";
|
|
188
|
+
operation: LiveGuestFilesystemOperation;
|
|
189
|
+
path: string;
|
|
190
|
+
content?: string;
|
|
191
|
+
encoding?: LiveRootFilesystemEntryEncoding;
|
|
192
|
+
entries?: LiveGuestDirEntry[];
|
|
193
|
+
stat?: LiveGuestFilesystemStat;
|
|
194
|
+
exists?: boolean;
|
|
195
|
+
target?: string;
|
|
196
|
+
} | {
|
|
197
|
+
type: "guest_kernel_result";
|
|
198
|
+
payload: ArrayBuffer;
|
|
199
|
+
} | {
|
|
200
|
+
type: "root_filesystem_snapshot";
|
|
201
|
+
entries: LiveRootFilesystemEntry[];
|
|
202
|
+
} | {
|
|
203
|
+
type: "vm_disposed";
|
|
204
|
+
vm_id: string;
|
|
205
|
+
} | {
|
|
206
|
+
type: "process_started";
|
|
207
|
+
process_id: string;
|
|
208
|
+
pid?: number;
|
|
209
|
+
} | {
|
|
210
|
+
type: "stdin_written";
|
|
211
|
+
process_id: string;
|
|
212
|
+
accepted_bytes: number;
|
|
213
|
+
} | {
|
|
214
|
+
type: "pty_resized";
|
|
215
|
+
process_id: string;
|
|
216
|
+
cols: number;
|
|
217
|
+
rows: number;
|
|
218
|
+
} | {
|
|
219
|
+
type: "stdin_closed";
|
|
220
|
+
process_id: string;
|
|
221
|
+
} | {
|
|
222
|
+
type: "process_killed";
|
|
223
|
+
process_id: string;
|
|
224
|
+
} | {
|
|
225
|
+
type: "process_snapshot";
|
|
226
|
+
processes: LiveProcessSnapshotEntry[];
|
|
227
|
+
} | ({
|
|
228
|
+
type: "resource_snapshot";
|
|
229
|
+
} & LiveResourceSnapshot) | {
|
|
230
|
+
type: "listener_snapshot";
|
|
231
|
+
listener?: LiveSocketStateEntry;
|
|
232
|
+
} | {
|
|
233
|
+
type: "bound_udp_snapshot";
|
|
234
|
+
socket?: LiveSocketStateEntry;
|
|
235
|
+
} | {
|
|
236
|
+
type: "vm_fetch_result";
|
|
237
|
+
response_json: string;
|
|
238
|
+
} | {
|
|
239
|
+
type: "signal_state";
|
|
240
|
+
process_id: string;
|
|
241
|
+
handlers: Record<string, LiveSignalHandlerRegistration>;
|
|
242
|
+
} | {
|
|
243
|
+
type: "zombie_timer_count";
|
|
244
|
+
count: number;
|
|
245
|
+
} | {
|
|
246
|
+
type: "filesystem_result";
|
|
247
|
+
operation: LiveFilesystemOperation;
|
|
248
|
+
status: string;
|
|
249
|
+
payload_size_bytes: number;
|
|
250
|
+
} | {
|
|
251
|
+
type: "persistence_state";
|
|
252
|
+
key: string;
|
|
253
|
+
found: boolean;
|
|
254
|
+
payload_size_bytes: number;
|
|
255
|
+
} | {
|
|
256
|
+
type: "persistence_flushed";
|
|
257
|
+
key: string;
|
|
258
|
+
committed_bytes: number;
|
|
259
|
+
} | {
|
|
260
|
+
type: "rejected";
|
|
261
|
+
code: string;
|
|
262
|
+
message: string;
|
|
263
|
+
} | {
|
|
264
|
+
type: "ext_result";
|
|
265
|
+
envelope: LiveExtEnvelope;
|
|
266
|
+
};
|
|
267
|
+
export declare function fromGeneratedResponsePayload(payload: protocol.ResponsePayload): LiveResponsePayload;
|
|
268
|
+
export declare function fromGeneratedCronDispatch(value: protocol.CronDispatchEvent): LiveCronDispatch;
|