@rivet-dev/agentos-core 0.2.8-rc.1 → 0.2.8-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -38
- package/dist/agent-os.d.ts +189 -231
- package/dist/agent-os.js +756 -1162
- package/dist/agentos-package.d.ts +5 -3
- package/dist/agentos-package.js +5 -2
- package/dist/{host-tools-zod.d.ts → bindings-zod.d.ts} +1 -1
- package/dist/{host-tools-zod.js → bindings-zod.js} +27 -20
- package/dist/bindings.d.ts +43 -0
- package/dist/bindings.js +34 -0
- package/dist/cron/cron-manager.js +43 -10
- package/dist/cron/index.d.ts +1 -1
- package/dist/cron/types.d.ts +25 -9
- package/dist/filesystem-snapshot.d.ts +1 -2
- package/dist/filesystem-snapshot.js +0 -43
- package/dist/generated/AcpLimitsConfig.d.ts +16 -0
- package/dist/generated/BindingLimitsConfig.d.ts +10 -0
- package/dist/generated/CreateVmConfig.d.ts +2 -0
- package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
- package/dist/generated/ProcessLimitsConfig.js +2 -0
- package/dist/generated/VmGroupConfig.d.ts +5 -0
- package/dist/generated/VmGroupConfig.js +2 -0
- package/dist/generated/VmLimitsConfig.d.ts +4 -2
- 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/WasmLimitsConfig.d.ts +1 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.js +4 -5
- package/dist/layers.d.ts +5 -2
- package/dist/layers.js +0 -185
- package/dist/options-schema.d.ts +133 -31
- package/dist/options-schema.js +143 -26
- package/dist/runtime-compat.d.ts +6 -35
- package/dist/runtime-compat.js +84 -372
- package/dist/runtime.d.ts +5 -1
- package/dist/sandbox.d.ts +4 -4
- package/dist/sandbox.js +4 -4
- package/dist/session-api.d.ts +180 -0
- package/dist/session-api.js +1 -0
- package/dist/sidecar/agentos-protocol.d.ts +429 -29
- package/dist/sidecar/agentos-protocol.js +691 -93
- package/dist/sidecar/rpc-client.d.ts +18 -6
- package/dist/sidecar/rpc-client.js +78 -31
- package/dist/test/runtime.d.ts +2 -1
- package/dist/test/runtime.js +2 -1
- package/dist/test/terminal-harness.js +0 -3
- package/dist/types.d.ts +4 -5
- package/package.json +21 -20
- package/dist/agent-session-types.d.ts +0 -67
- package/dist/generated/ToolLimitsConfig.d.ts +0 -10
- package/dist/host-tools.d.ts +0 -45
- package/dist/host-tools.js +0 -35
- package/dist/overlay-filesystem.d.ts +0 -19
- package/dist/overlay-filesystem.js +0 -645
- /package/dist/generated/{ToolLimitsConfig.js → BindingLimitsConfig.js} +0 -0
- /package/dist/{agent-session-types.js → generated/VmUserConfig.js} +0 -0
|
@@ -40,11 +40,11 @@ interface NativeSidecarKernelProxyOptions {
|
|
|
40
40
|
* `configure_vm` rebuilds the whole VM configuration from each payload, so
|
|
41
41
|
* every runtime mount reconfigure must resend these or a post-boot
|
|
42
42
|
* `mountFs()` silently drops the `/opt/agentos` package projections and
|
|
43
|
-
*
|
|
43
|
+
* binding shim commands applied at boot.
|
|
44
44
|
*/
|
|
45
45
|
packages?: Parameters<SidecarProcess["configureVm"]>[2]["packages"];
|
|
46
46
|
packagesMountAt?: string;
|
|
47
|
-
|
|
47
|
+
bindingShimCommands?: string[];
|
|
48
48
|
commandGuestPaths: ReadonlyMap<string, string>;
|
|
49
49
|
onWasmCommandResolved?: (command: string) => void;
|
|
50
50
|
onDispose?: () => Promise<void>;
|
|
@@ -70,12 +70,13 @@ export declare class NativeSidecarKernelProxy {
|
|
|
70
70
|
private readonly ownsClient;
|
|
71
71
|
private readonly localMounts;
|
|
72
72
|
private readonly baseSidecarMounts;
|
|
73
|
+
private readonly dynamicSidecarMounts;
|
|
73
74
|
private readonly permissions;
|
|
74
75
|
private readonly commandPermissions;
|
|
75
76
|
private readonly loopbackExemptPorts;
|
|
76
77
|
private packages;
|
|
77
78
|
private readonly packagesMountAt;
|
|
78
|
-
private readonly
|
|
79
|
+
private readonly bindingShimCommands;
|
|
79
80
|
private readonly commandDrivers;
|
|
80
81
|
private readonly onWasmCommandResolved;
|
|
81
82
|
private readonly onDispose;
|
|
@@ -161,6 +162,13 @@ export declare class NativeSidecarKernelProxy {
|
|
|
161
162
|
sidecarMount?: SidecarMountDescriptor;
|
|
162
163
|
}): Promise<void>;
|
|
163
164
|
unmountFs(path: string): Promise<void>;
|
|
165
|
+
mountDescriptor(mount: SidecarMountDescriptor): Promise<void>;
|
|
166
|
+
unmountDescriptor(path: string): Promise<void>;
|
|
167
|
+
listMounts(): Promise<Array<{
|
|
168
|
+
path: string;
|
|
169
|
+
kind: string;
|
|
170
|
+
readOnly: boolean;
|
|
171
|
+
}>>;
|
|
164
172
|
private desiredSidecarMounts;
|
|
165
173
|
private reconfigureSidecarMounts;
|
|
166
174
|
private waitForMountReconfigure;
|
|
@@ -175,6 +183,7 @@ export declare class NativeSidecarKernelProxy {
|
|
|
175
183
|
port?: number;
|
|
176
184
|
}): KernelSocketSnapshot | null;
|
|
177
185
|
getSignalState(pid: number): KernelSignalState;
|
|
186
|
+
private scheduleSignalStateRefresh;
|
|
178
187
|
private refreshSocketLookup;
|
|
179
188
|
private refreshSignalState;
|
|
180
189
|
private refreshProcessSnapshot;
|
|
@@ -262,7 +271,7 @@ export interface AgentOsSidecarTransport {
|
|
|
262
271
|
dispose(): Promise<void>;
|
|
263
272
|
}
|
|
264
273
|
export interface AgentOsSidecarClientOptions {
|
|
265
|
-
|
|
274
|
+
createOwnershipTransport(bootstrap: AgentOsSidecarSessionBootstrap): Promise<AgentOsSidecarTransport>;
|
|
266
275
|
createId?: () => string;
|
|
267
276
|
now?: () => number;
|
|
268
277
|
}
|
|
@@ -284,13 +293,14 @@ export declare class AgentOsSidecarSessionHandle {
|
|
|
284
293
|
dispose(): Promise<void>;
|
|
285
294
|
}
|
|
286
295
|
export declare class AgentOsSidecarClient {
|
|
287
|
-
private readonly
|
|
296
|
+
private readonly createOwnershipTransport;
|
|
288
297
|
private readonly createId;
|
|
289
298
|
private readonly now;
|
|
290
299
|
private readonly sessions;
|
|
291
300
|
private disposed;
|
|
292
301
|
constructor(options: AgentOsSidecarClientOptions);
|
|
293
|
-
|
|
302
|
+
/** Open a physical sidecar ownership scope, not a durable ACP session. */
|
|
303
|
+
createOwnershipSession(options?: AgentOsSidecarSessionOptions): Promise<AgentOsSidecarSessionHandle>;
|
|
294
304
|
listSessions(): AgentOsSidecarSessionLifecycle[];
|
|
295
305
|
requireSessionLifecycle(sessionId: string): AgentOsSidecarSessionLifecycle;
|
|
296
306
|
listVms(sessionId: string): AgentOsSidecarVmLifecycle[];
|
|
@@ -315,6 +325,8 @@ export interface SidecarMountPluginDescriptor {
|
|
|
315
325
|
}
|
|
316
326
|
export interface SidecarMountDescriptor {
|
|
317
327
|
guestPath: string;
|
|
328
|
+
guestSource?: string;
|
|
329
|
+
guestFstype?: string;
|
|
318
330
|
readOnly: boolean;
|
|
319
331
|
plugin: SidecarMountPluginDescriptor;
|
|
320
332
|
}
|
|
@@ -20,7 +20,9 @@ function formatStructuredSidecarDetail(detail) {
|
|
|
20
20
|
if (entries.length === 0) {
|
|
21
21
|
return "";
|
|
22
22
|
}
|
|
23
|
-
return entries
|
|
23
|
+
return entries
|
|
24
|
+
.map(([key, value]) => `${key}=${JSON.stringify(value)}`)
|
|
25
|
+
.join(" ");
|
|
24
26
|
}
|
|
25
27
|
function logStructuredSidecarEvent(name, detail) {
|
|
26
28
|
if (!shouldLogStructuredSidecarEvent(name)) {
|
|
@@ -211,6 +213,7 @@ export class NativeSidecarKernelProxy {
|
|
|
211
213
|
ownsClient;
|
|
212
214
|
localMounts;
|
|
213
215
|
baseSidecarMounts;
|
|
216
|
+
dynamicSidecarMounts = [];
|
|
214
217
|
permissions;
|
|
215
218
|
commandPermissions;
|
|
216
219
|
loopbackExemptPorts;
|
|
@@ -218,7 +221,7 @@ export class NativeSidecarKernelProxy {
|
|
|
218
221
|
// later mount reconfigures resend linked packages too, not just boot ones.
|
|
219
222
|
packages;
|
|
220
223
|
packagesMountAt;
|
|
221
|
-
|
|
224
|
+
bindingShimCommands;
|
|
222
225
|
commandDrivers;
|
|
223
226
|
onWasmCommandResolved;
|
|
224
227
|
onDispose;
|
|
@@ -257,7 +260,7 @@ export class NativeSidecarKernelProxy {
|
|
|
257
260
|
this.loopbackExemptPorts = options.loopbackExemptPorts;
|
|
258
261
|
this.packages = options.packages ? [...options.packages] : [];
|
|
259
262
|
this.packagesMountAt = options.packagesMountAt;
|
|
260
|
-
this.
|
|
263
|
+
this.bindingShimCommands = options.bindingShimCommands;
|
|
261
264
|
this.commandDrivers = buildCommandMap(options.commandGuestPaths);
|
|
262
265
|
this.onWasmCommandResolved = options.onWasmCommandResolved;
|
|
263
266
|
this.onDispose = options.onDispose;
|
|
@@ -583,7 +586,7 @@ export class NativeSidecarKernelProxy {
|
|
|
583
586
|
return proc;
|
|
584
587
|
}
|
|
585
588
|
openShell(options) {
|
|
586
|
-
const
|
|
589
|
+
const terminalHandlers = new Set();
|
|
587
590
|
const stderrHandlers = new Set();
|
|
588
591
|
const command = options?.command ?? "sh";
|
|
589
592
|
const args = options?.args ??
|
|
@@ -638,7 +641,7 @@ export class NativeSidecarKernelProxy {
|
|
|
638
641
|
const normalized = normalizeSyntheticTerminalText(text);
|
|
639
642
|
updateSyntheticCursor(normalized);
|
|
640
643
|
const chunk = textEncoder.encode(normalized);
|
|
641
|
-
for (const handler of
|
|
644
|
+
for (const handler of terminalHandlers) {
|
|
642
645
|
handler(chunk);
|
|
643
646
|
}
|
|
644
647
|
};
|
|
@@ -649,7 +652,7 @@ export class NativeSidecarKernelProxy {
|
|
|
649
652
|
const normalized = normalizeSyntheticTerminalText(text);
|
|
650
653
|
updateSyntheticCursor(normalized);
|
|
651
654
|
const chunk = textEncoder.encode(normalized);
|
|
652
|
-
for (const handler of
|
|
655
|
+
for (const handler of terminalHandlers) {
|
|
653
656
|
handler(chunk);
|
|
654
657
|
}
|
|
655
658
|
};
|
|
@@ -694,7 +697,7 @@ export class NativeSidecarKernelProxy {
|
|
|
694
697
|
commandInFlight = false;
|
|
695
698
|
const promptPrefix = syntheticCursorAtLineStart ? "" : "\r\n";
|
|
696
699
|
const promptChunk = textEncoder.encode(`${promptPrefix}${promptText}`);
|
|
697
|
-
for (const handler of
|
|
700
|
+
for (const handler of terminalHandlers) {
|
|
698
701
|
handler(promptChunk);
|
|
699
702
|
}
|
|
700
703
|
syntheticCursorAtLineStart = false;
|
|
@@ -752,7 +755,7 @@ export class NativeSidecarKernelProxy {
|
|
|
752
755
|
}
|
|
753
756
|
};
|
|
754
757
|
let onData = null;
|
|
755
|
-
|
|
758
|
+
terminalHandlers.add((data) => onData?.(data));
|
|
756
759
|
if (options?.onStderr) {
|
|
757
760
|
stderrHandlers.add(options.onStderr);
|
|
758
761
|
}
|
|
@@ -921,7 +924,7 @@ export class NativeSidecarKernelProxy {
|
|
|
921
924
|
if (!sanitized) {
|
|
922
925
|
return;
|
|
923
926
|
}
|
|
924
|
-
for (const handler of
|
|
927
|
+
for (const handler of terminalHandlers) {
|
|
925
928
|
handler(sanitized);
|
|
926
929
|
}
|
|
927
930
|
if (commandInFlight) {
|
|
@@ -933,6 +936,11 @@ export class NativeSidecarKernelProxy {
|
|
|
933
936
|
if (!sanitized) {
|
|
934
937
|
return;
|
|
935
938
|
}
|
|
939
|
+
// `onData` is the ordered PTY rendering stream. `onStderr` remains an
|
|
940
|
+
// optional channel-specific diagnostic tap and must not also be rendered.
|
|
941
|
+
for (const handler of terminalHandlers) {
|
|
942
|
+
handler(sanitized);
|
|
943
|
+
}
|
|
936
944
|
for (const handler of stderrHandlers) {
|
|
937
945
|
handler(sanitized);
|
|
938
946
|
}
|
|
@@ -986,13 +994,7 @@ export class NativeSidecarKernelProxy {
|
|
|
986
994
|
const stdin = process.stdin;
|
|
987
995
|
const stdout = process.stdout;
|
|
988
996
|
const { onData, ...shellOptions } = options ?? {};
|
|
989
|
-
const shell = this.openShell(
|
|
990
|
-
...shellOptions,
|
|
991
|
-
onStderr: shellOptions.onStderr ??
|
|
992
|
-
((data) => {
|
|
993
|
-
process.stderr.write(data);
|
|
994
|
-
}),
|
|
995
|
-
});
|
|
997
|
+
const shell = this.openShell(shellOptions);
|
|
996
998
|
const outputHandler = onData ??
|
|
997
999
|
((data) => {
|
|
998
1000
|
stdout.write(data);
|
|
@@ -1164,9 +1166,34 @@ export class NativeSidecarKernelProxy {
|
|
|
1164
1166
|
applied.catch(() => { });
|
|
1165
1167
|
return applied;
|
|
1166
1168
|
}
|
|
1169
|
+
mountDescriptor(mount) {
|
|
1170
|
+
const normalized = posixPath.normalize(mount.guestPath);
|
|
1171
|
+
if (this.desiredSidecarMounts().some((existing) => posixPath.normalize(existing.guestPath) === normalized)) {
|
|
1172
|
+
return Promise.reject(new Error(`mount already exists: ${normalized}`));
|
|
1173
|
+
}
|
|
1174
|
+
this.dynamicSidecarMounts.push({ ...mount, guestPath: normalized });
|
|
1175
|
+
const applied = this.reconfigureSidecarMounts();
|
|
1176
|
+
applied.catch(() => { });
|
|
1177
|
+
return applied;
|
|
1178
|
+
}
|
|
1179
|
+
unmountDescriptor(path) {
|
|
1180
|
+
const normalized = posixPath.normalize(path);
|
|
1181
|
+
const index = this.dynamicSidecarMounts.findIndex((mount) => posixPath.normalize(mount.guestPath) === normalized);
|
|
1182
|
+
if (index < 0)
|
|
1183
|
+
return Promise.resolve();
|
|
1184
|
+
this.dynamicSidecarMounts.splice(index, 1);
|
|
1185
|
+
const applied = this.reconfigureSidecarMounts();
|
|
1186
|
+
applied.catch(() => { });
|
|
1187
|
+
return applied;
|
|
1188
|
+
}
|
|
1189
|
+
async listMounts() {
|
|
1190
|
+
await this.waitForMountReconfigure();
|
|
1191
|
+
return this.client.listMounts(this.session, this.vm);
|
|
1192
|
+
}
|
|
1167
1193
|
desiredSidecarMounts() {
|
|
1168
1194
|
return [
|
|
1169
1195
|
...this.baseSidecarMounts,
|
|
1196
|
+
...this.dynamicSidecarMounts,
|
|
1170
1197
|
...this.localMounts.map((mount) => mount.sidecarMount ?? {
|
|
1171
1198
|
guestPath: mount.path,
|
|
1172
1199
|
readOnly: mount.readOnly,
|
|
@@ -1183,8 +1210,8 @@ export class NativeSidecarKernelProxy {
|
|
|
1183
1210
|
return;
|
|
1184
1211
|
}
|
|
1185
1212
|
// Rust `configure_vm` rebuilds the whole VM configuration from this
|
|
1186
|
-
// payload, so resend the boot packages /
|
|
1187
|
-
// omitting them here strips the `/opt/agentos` projections and
|
|
1213
|
+
// payload, so resend the boot packages / binding shim commands too —
|
|
1214
|
+
// omitting them here strips the `/opt/agentos` projections and binding
|
|
1188
1215
|
// shims from the VM as a side effect of a runtime mount change.
|
|
1189
1216
|
await this.client.configureVm(this.session, this.vm, {
|
|
1190
1217
|
mounts: this.desiredSidecarMounts(),
|
|
@@ -1193,7 +1220,7 @@ export class NativeSidecarKernelProxy {
|
|
|
1193
1220
|
loopbackExemptPorts: this.loopbackExemptPorts,
|
|
1194
1221
|
packages: this.packages,
|
|
1195
1222
|
packagesMountAt: this.packagesMountAt,
|
|
1196
|
-
|
|
1223
|
+
bindingShimCommands: this.bindingShimCommands,
|
|
1197
1224
|
});
|
|
1198
1225
|
};
|
|
1199
1226
|
const previous = this.mountReconfigurePromise ?? Promise.resolve();
|
|
@@ -1238,11 +1265,17 @@ export class NativeSidecarKernelProxy {
|
|
|
1238
1265
|
}
|
|
1239
1266
|
getSignalState(pid) {
|
|
1240
1267
|
const entry = this.trackedProcesses.get(pid);
|
|
1241
|
-
if (entry
|
|
1242
|
-
this.
|
|
1243
|
-
}
|
|
1268
|
+
if (entry)
|
|
1269
|
+
this.scheduleSignalStateRefresh(entry);
|
|
1244
1270
|
return this.signalStates.get(pid) ?? { handlers: new Map() };
|
|
1245
1271
|
}
|
|
1272
|
+
scheduleSignalStateRefresh(entry) {
|
|
1273
|
+
if (this.signalRefreshes.has(entry.pid))
|
|
1274
|
+
return;
|
|
1275
|
+
const refresh = this.refreshSignalState(entry);
|
|
1276
|
+
this.signalRefreshes.set(entry.pid, refresh);
|
|
1277
|
+
void refresh.catch(() => { });
|
|
1278
|
+
}
|
|
1246
1279
|
async refreshSocketLookup(cache, key, lookup) {
|
|
1247
1280
|
try {
|
|
1248
1281
|
const socket = await lookup();
|
|
@@ -1334,7 +1367,11 @@ export class NativeSidecarKernelProxy {
|
|
|
1334
1367
|
entry.started = true;
|
|
1335
1368
|
this.updateTrackedProcessSnapshot(entry);
|
|
1336
1369
|
void this.refreshProcessSnapshot().catch(() => { });
|
|
1337
|
-
|
|
1370
|
+
// Signal metadata is advisory and must not hold process startup behind a
|
|
1371
|
+
// second sidecar RPC. Very short binding commands can finish while the
|
|
1372
|
+
// original execute response is still in flight; synchronously refreshing
|
|
1373
|
+
// here creates a circular wait with their output/exit delivery.
|
|
1374
|
+
this.scheduleSignalStateRefresh(entry);
|
|
1338
1375
|
void this.flushPendingStdin(entry).catch((error) => {
|
|
1339
1376
|
this.handleBackgroundProcessError(entry, error);
|
|
1340
1377
|
});
|
|
@@ -1362,10 +1399,7 @@ export class NativeSidecarKernelProxy {
|
|
|
1362
1399
|
}
|
|
1363
1400
|
entry.outputGeneration += 1;
|
|
1364
1401
|
void this.refreshProcessSnapshot().catch(() => { });
|
|
1365
|
-
|
|
1366
|
-
this.signalRefreshes.set(entry.pid, this.refreshSignalState(entry));
|
|
1367
|
-
await this.signalRefreshes.get(entry.pid);
|
|
1368
|
-
}
|
|
1402
|
+
this.scheduleSignalStateRefresh(entry);
|
|
1369
1403
|
const chunk = event.payload.chunk;
|
|
1370
1404
|
const listeners = event.payload.channel === "stdout"
|
|
1371
1405
|
? entry.onStdout
|
|
@@ -2083,17 +2117,18 @@ export class AgentOsSidecarSessionHandle {
|
|
|
2083
2117
|
}
|
|
2084
2118
|
}
|
|
2085
2119
|
export class AgentOsSidecarClient {
|
|
2086
|
-
|
|
2120
|
+
createOwnershipTransport;
|
|
2087
2121
|
createId;
|
|
2088
2122
|
now;
|
|
2089
2123
|
sessions = new Map();
|
|
2090
2124
|
disposed = false;
|
|
2091
2125
|
constructor(options) {
|
|
2092
|
-
this.
|
|
2126
|
+
this.createOwnershipTransport = options.createOwnershipTransport;
|
|
2093
2127
|
this.createId = options.createId ?? randomUUID;
|
|
2094
2128
|
this.now = options.now ?? Date.now;
|
|
2095
2129
|
}
|
|
2096
|
-
|
|
2130
|
+
/** Open a physical sidecar ownership scope, not a durable ACP session. */
|
|
2131
|
+
async createOwnershipSession(options = {}) {
|
|
2097
2132
|
this.assertActive();
|
|
2098
2133
|
const sessionId = this.createId();
|
|
2099
2134
|
const placement = clonePlacement(options.placement);
|
|
@@ -2112,7 +2147,7 @@ export class AgentOsSidecarClient {
|
|
|
2112
2147
|
};
|
|
2113
2148
|
this.sessions.set(sessionId, entry);
|
|
2114
2149
|
try {
|
|
2115
|
-
entry.transport = await this.
|
|
2150
|
+
entry.transport = await this.createOwnershipTransport({
|
|
2116
2151
|
sessionId,
|
|
2117
2152
|
placement: clonePlacement(placement),
|
|
2118
2153
|
metadata: cloneMetadata(metadata),
|
|
@@ -2278,6 +2313,8 @@ export function serializeMountConfigForSidecar(mount) {
|
|
|
2278
2313
|
if ("driver" in mount) {
|
|
2279
2314
|
return {
|
|
2280
2315
|
guestPath: mount.path,
|
|
2316
|
+
guestSource: mount.guestSource ?? "js_bridge",
|
|
2317
|
+
guestFstype: mount.guestFstype ?? "js_bridge",
|
|
2281
2318
|
readOnly: mount.readOnly ?? false,
|
|
2282
2319
|
plugin: {
|
|
2283
2320
|
id: "js_bridge",
|
|
@@ -2287,6 +2324,8 @@ export function serializeMountConfigForSidecar(mount) {
|
|
|
2287
2324
|
}
|
|
2288
2325
|
return {
|
|
2289
2326
|
guestPath: mount.path,
|
|
2327
|
+
guestSource: mount.guestSource ?? mount.plugin.id,
|
|
2328
|
+
guestFstype: mount.guestFstype ?? mount.plugin.id,
|
|
2290
2329
|
readOnly: mount.readOnly ?? false,
|
|
2291
2330
|
plugin: {
|
|
2292
2331
|
id: mount.plugin.id,
|
|
@@ -2295,6 +2334,14 @@ export function serializeMountConfigForSidecar(mount) {
|
|
|
2295
2334
|
};
|
|
2296
2335
|
}
|
|
2297
2336
|
export function serializeRootFilesystemForSidecar(config, bootstrapLower) {
|
|
2337
|
+
if (config?.type === "native") {
|
|
2338
|
+
return {
|
|
2339
|
+
mode: "ephemeral",
|
|
2340
|
+
disableDefaultBaseLayer: true,
|
|
2341
|
+
lowers: [],
|
|
2342
|
+
bootstrapEntries: [],
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2298
2345
|
const lowerInputs = [
|
|
2299
2346
|
...(config?.lowers ?? []),
|
|
2300
2347
|
...(bootstrapLower ? [bootstrapLower] : []),
|
package/dist/test/runtime.d.ts
CHANGED
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
export { type AgentOsRuntimeAdmin, getAgentOsKernel, getAgentOsRuntimeAdmin, } from "../agent-os.js";
|
|
8
8
|
export type { PermissionTier, WasmVmRuntimeOptions, } from "../runtime.js";
|
|
9
9
|
export type { DriverProcess, Kernel, KernelInterface, KernelRuntimeDriver, ProcessContext, VirtualFileSystem, } from "../runtime-compat.js";
|
|
10
|
-
export { AF_INET, AF_UNIX, allowAll,
|
|
10
|
+
export { AF_INET, AF_UNIX, allowAll, createKernel, createNodeHostNetworkAdapter, createNodeRuntime, createWasmVmRuntime, DEFAULT_FIRST_PARTY_TIERS, NodeFileSystem, SIGTERM, SOCK_DGRAM, SOCK_STREAM, WASMVM_COMMANDS, } from "../runtime-compat.js";
|
|
11
|
+
export { createInMemoryFileSystem } from "@rivet-dev/agentos-runtime-core/test-runtime";
|
|
11
12
|
export { TerminalHarness } from "./terminal-harness.js";
|
package/dist/test/runtime.js
CHANGED
|
@@ -5,5 +5,6 @@
|
|
|
5
5
|
* while the public SDK removes the raw vm.kernel escape hatch.
|
|
6
6
|
*/
|
|
7
7
|
export { getAgentOsKernel, getAgentOsRuntimeAdmin, } from "../agent-os.js";
|
|
8
|
-
export { AF_INET, AF_UNIX, allowAll,
|
|
8
|
+
export { AF_INET, AF_UNIX, allowAll, createKernel, createNodeHostNetworkAdapter, createNodeRuntime, createWasmVmRuntime, DEFAULT_FIRST_PARTY_TIERS, NodeFileSystem, SIGTERM, SOCK_DGRAM, SOCK_STREAM, WASMVM_COMMANDS, } from "../runtime-compat.js";
|
|
9
|
+
export { createInMemoryFileSystem } from "@rivet-dev/agentos-runtime-core/test-runtime";
|
|
9
10
|
export { TerminalHarness } from "./terminal-harness.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { AgentOsCreateSidecarOptions, AgentOsLimits, AgentOsOptions, AgentOsSharedSidecarOptions, AgentOsSidecarConfig, AgentOsSidecarDescription, AgentExitEvent, AgentExitHandler, AgentRestartOutcome, AgentStderrEvent, AgentStderrHandler, AgentRegistryEntry, BatchReadResult, BatchWriteEntry, BatchWriteResult, DirEntry, DynamicMountDescriptor, ExportRootFilesystemOptions, HttpRequest, HttpResponse, LimitWarning, LimitWarningHandler, MountConfig, MountInfo, MountConfigJsonObject, MountConfigJsonPrimitive, MountConfigJsonValue, NativeMountConfig, NativeMountPluginDescriptor, NativeRootFilesystemConfig, OverlayMountConfig, OverlayRootFilesystemConfig, PlainMountConfig, ProcessTreeNode, ProcessExit, ProcessOutput, ReaddirEntry, ReaddirRecursiveOptions, RootFilesystemConfig, RootLowerInput, SpawnedProcessInfo, SpawnOptions, ShellData, ShellExit, ShellOptions, } from "./agent-os.js";
|
|
2
|
+
export type * from "./session-api.js";
|
|
2
3
|
/**
|
|
3
4
|
* An agent type id — the `name` of an `/opt/agentos` agent package manifest
|
|
4
5
|
* (e.g. `"pi"`, `"claude"`). Agents are resolved by the SIDECAR from the projected
|
|
@@ -6,12 +7,10 @@ export type { AgentCapabilities, AgentInfo, AgentOsCreateSidecarOptions, AgentOs
|
|
|
6
7
|
* passes only the name, so any manifest `name` is a valid agent type.
|
|
7
8
|
*/
|
|
8
9
|
export type AgentType = string;
|
|
9
|
-
export type { CronAction, CronEvent, CronEventHandler, CronJob, CronJobInfo, CronJobOptions, ScheduleDriver, ScheduleEntry, ScheduleHandle, } from "./cron/index.js";
|
|
10
|
+
export type { CronAction, CronActionInfo, CronEvent, CronEventHandler, CronJob, CronJobInfo, CronJobOptions, ScheduleDriver, ScheduleEntry, ScheduleHandle, } from "./cron/index.js";
|
|
10
11
|
export type { HostDirBackendOptions, HostDirMountPluginConfig, NodeModulesMountConfig, } from "./host-dir-mount.js";
|
|
11
|
-
export type {
|
|
12
|
-
export type { AcpTimeoutErrorData, JsonRpcError, JsonRpcErrorData, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse, UnknownSessionErrorData, } from "./json-rpc.js";
|
|
12
|
+
export type { Binding, BindingExample, Bindings } from "./bindings.js";
|
|
13
13
|
export type { FilesystemSnapshotExport, LayerHandle, LayerStore, OverlayFilesystemMode, RootSnapshotExport, SnapshotImportSource, SnapshotLayerHandle, WritableLayerHandle, } from "./layers.js";
|
|
14
14
|
export type { SoftwareInput, SoftwareRoot } from "./packages.js";
|
|
15
15
|
export type { AgentBlock, PackageDescriptor, PackageRef, SoftwarePackageRef, } from "./agentos-package.js";
|
|
16
16
|
export type { ChildProcessPermissions, ConnectTerminalOptions, EnvPermissions, ExecOptions, ExecResult, FsPermissionRule, FsPermissions, KernelExecOptions, KernelExecResult, KernelSpawnOptions, NetworkAccessRequest, NetworkPermissions, OpenShellOptions, PatternPermissionRule, PermissionDecision, PermissionMode, Permissions, ProcessInfo, RulePermissions, StdioChannel, TimingMitigation, VirtualDirEntry, VirtualFileSystem, VirtualStat, } from "./runtime.js";
|
|
17
|
-
export type { PromptCapabilities } from "./agent-session-types.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivet-dev/agentos-core",
|
|
3
|
-
"version": "0.2.8-rc.
|
|
3
|
+
"version": "0.2.8-rc.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -46,24 +46,27 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"check-types": "pnpm run build:protocols && tsc --noEmit",
|
|
49
|
+
"check-types": "pnpm run build:protocols && tsc --noEmit && tsc -p tsconfig.type-tests.json",
|
|
50
50
|
"build": "pnpm run build:protocols && tsc",
|
|
51
51
|
"build:agentos-protocol": "node ./scripts/compile-agentos-protocol.mjs",
|
|
52
52
|
"build:protocols": "pnpm run build:agentos-protocol",
|
|
53
|
-
"test": "vitest run --reporter=verbose"
|
|
53
|
+
"test": "vitest run --exclude '**/*.nightly.test.ts' --reporter=verbose",
|
|
54
|
+
"test:unit": "vitest run tests/agent-exit-event.test.ts tests/agentos-package.test.ts tests/agentos-protocol.test.ts tests/allowed-node-builtins.test.ts tests/bindings-zod.test.ts tests/bindings.test.ts tests/cron-manager.test.ts tests/cron-timer-driver.test.ts tests/generated-protocol.test.ts tests/leak-agent-os-processes.test.ts tests/leak-rpc-client.test.ts tests/mount-descriptors.test.ts tests/mount-reconfigure.test.ts tests/options-schema.test.ts tests/public-api-exports.test.ts tests/root-filesystem-descriptors.test.ts tests/runtime-compat-mount.test.ts tests/session-event-ordering.test.ts tests/session-permission-surface.test.ts tests/sidecar-client.test.ts tests/sidecar-permission-descriptors.test.ts tests/wasm-permission-tiers.test.ts --fileParallelism=false",
|
|
55
|
+
"test:pr": "pnpm test:unit && vitest run tests/migration-parity.test.ts --fileParallelism=false --reporter=verbose",
|
|
56
|
+
"test:nightly": "vitest run tests/*.nightly.test.ts --reporter=verbose --passWithNoTests"
|
|
54
57
|
},
|
|
55
58
|
"dependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"@agentos-software/
|
|
58
|
-
"@agentos-software/
|
|
59
|
-
"@agentos-software/
|
|
60
|
-
"@agentos-software/
|
|
61
|
-
"@agentos-software/
|
|
62
|
-
"@agentos-software/pi
|
|
59
|
+
"@agentclientprotocol/sdk": "0.16.1",
|
|
60
|
+
"@agentos-software/claude-code": "0.2.7",
|
|
61
|
+
"@agentos-software/codex-cli": "0.3.4",
|
|
62
|
+
"@agentos-software/common": "0.2.8-rc.3",
|
|
63
|
+
"@agentos-software/manifest": "0.2.8-rc.3",
|
|
64
|
+
"@agentos-software/opencode": "0.2.7",
|
|
65
|
+
"@agentos-software/pi": "0.2.7",
|
|
63
66
|
"@aws-sdk/client-s3": "^3.1019.0",
|
|
64
|
-
"@rivet-dev/agentos-sidecar": "0.2.8-rc.
|
|
67
|
+
"@rivet-dev/agentos-sidecar": "0.2.8-rc.3",
|
|
65
68
|
"@rivetkit/bare-ts": "^0.6.2",
|
|
66
|
-
"@rivet-dev/agentos-runtime-core": "0.2.8-rc.
|
|
69
|
+
"@rivet-dev/agentos-runtime-core": "0.2.8-rc.3",
|
|
67
70
|
"@xterm/headless": "^6.0.0",
|
|
68
71
|
"better-sqlite3": "^12.8.0",
|
|
69
72
|
"croner": "^10.0.1",
|
|
@@ -75,8 +78,8 @@
|
|
|
75
78
|
"zod-to-json-schema": "^3.25.2"
|
|
76
79
|
},
|
|
77
80
|
"devDependencies": {
|
|
78
|
-
"@agentos-software/claude-code": "0.2.
|
|
79
|
-
"@agentos-software/codex": "0.2.
|
|
81
|
+
"@agentos-software/claude-code": "0.2.7",
|
|
82
|
+
"@agentos-software/codex": "0.2.7",
|
|
80
83
|
"@agentos-software/coreutils": "0.3.3",
|
|
81
84
|
"@agentos-software/curl": "0.3.3",
|
|
82
85
|
"@agentos-software/diffutils": "0.3.3",
|
|
@@ -88,17 +91,17 @@
|
|
|
88
91
|
"@agentos-software/git": "0.3.3",
|
|
89
92
|
"@agentos-software/grep": "0.3.3",
|
|
90
93
|
"@agentos-software/gzip": "0.3.3",
|
|
91
|
-
"@agentos-software/http-get": "0.3.3",
|
|
92
94
|
"@agentos-software/jq": "0.3.3",
|
|
93
|
-
"@agentos-software/opencode": "0.2.
|
|
94
|
-
"@agentos-software/pi": "0.2.
|
|
95
|
-
"@agentos-software/pi-cli": "0.2.8-rc.1",
|
|
95
|
+
"@agentos-software/opencode": "0.2.7",
|
|
96
|
+
"@agentos-software/pi": "0.2.7",
|
|
96
97
|
"@agentos-software/ripgrep": "0.3.3",
|
|
97
98
|
"@agentos-software/sed": "0.3.3",
|
|
98
99
|
"@agentos-software/tar": "0.3.3",
|
|
99
100
|
"@agentos-software/tree": "0.3.3",
|
|
100
101
|
"@agentos-software/vim": "0.3.3",
|
|
102
|
+
"@agentos-software/wget": "0.3.3",
|
|
101
103
|
"@agentos-software/yq": "0.3.3",
|
|
104
|
+
"@rivet-dev/agentos-test-harness": "0.2.8-rc.3",
|
|
102
105
|
"@anthropic-ai/claude-agent-sdk": "^0.2.87",
|
|
103
106
|
"@anthropic-ai/claude-code": "^2.1.86",
|
|
104
107
|
"@bare-ts/tools": "0.15.0",
|
|
@@ -106,9 +109,7 @@
|
|
|
106
109
|
"@browserbasehq/cli": "0.5.4",
|
|
107
110
|
"@browserbasehq/sdk": "2.10.0",
|
|
108
111
|
"@copilotkit/llmock": "^1.6.0",
|
|
109
|
-
"@mariozechner/pi-coding-agent": "^0.60.0",
|
|
110
112
|
"@types/node": "^22.10.2",
|
|
111
|
-
"pi-acp": "^0.0.23",
|
|
112
113
|
"sandbox-agent": "^0.4.2",
|
|
113
114
|
"typescript": "^5.7.2",
|
|
114
115
|
"vitest": "^2.1.8",
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { JsonRpcNotification } from "./json-rpc.js";
|
|
2
|
-
export type SessionEventHandler = (event: JsonRpcNotification) => void;
|
|
3
|
-
export interface PermissionRequest {
|
|
4
|
-
permissionId: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
params: Record<string, unknown>;
|
|
7
|
-
}
|
|
8
|
-
export type PermissionReply = "once" | "always" | "reject";
|
|
9
|
-
export type PermissionRequestHandler = (request: PermissionRequest) => void;
|
|
10
|
-
export interface SessionMode {
|
|
11
|
-
id: string;
|
|
12
|
-
name?: string;
|
|
13
|
-
label?: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
}
|
|
17
|
-
export interface SessionModeState {
|
|
18
|
-
currentModeId: string;
|
|
19
|
-
availableModes: SessionMode[];
|
|
20
|
-
}
|
|
21
|
-
export interface SessionConfigOption {
|
|
22
|
-
id: string;
|
|
23
|
-
category?: string;
|
|
24
|
-
label?: string;
|
|
25
|
-
description?: string;
|
|
26
|
-
currentValue?: string;
|
|
27
|
-
allowedValues?: Array<{
|
|
28
|
-
id: string;
|
|
29
|
-
label?: string;
|
|
30
|
-
}>;
|
|
31
|
-
readOnly?: boolean;
|
|
32
|
-
}
|
|
33
|
-
export interface PromptCapabilities {
|
|
34
|
-
audio?: boolean;
|
|
35
|
-
embeddedContext?: boolean;
|
|
36
|
-
image?: boolean;
|
|
37
|
-
[key: string]: unknown;
|
|
38
|
-
}
|
|
39
|
-
export interface AgentCapabilities {
|
|
40
|
-
permissions?: boolean;
|
|
41
|
-
plan_mode?: boolean;
|
|
42
|
-
questions?: boolean;
|
|
43
|
-
tool_calls?: boolean;
|
|
44
|
-
text_messages?: boolean;
|
|
45
|
-
images?: boolean;
|
|
46
|
-
file_attachments?: boolean;
|
|
47
|
-
session_lifecycle?: boolean;
|
|
48
|
-
error_events?: boolean;
|
|
49
|
-
reasoning?: boolean;
|
|
50
|
-
status?: boolean;
|
|
51
|
-
streaming_deltas?: boolean;
|
|
52
|
-
mcp_tools?: boolean;
|
|
53
|
-
promptCapabilities?: PromptCapabilities;
|
|
54
|
-
[key: string]: unknown;
|
|
55
|
-
}
|
|
56
|
-
export interface AgentInfo {
|
|
57
|
-
name: string;
|
|
58
|
-
title?: string;
|
|
59
|
-
version?: string;
|
|
60
|
-
[key: string]: unknown;
|
|
61
|
-
}
|
|
62
|
-
export interface SessionInitData {
|
|
63
|
-
modes?: SessionModeState;
|
|
64
|
-
configOptions?: SessionConfigOption[];
|
|
65
|
-
capabilities?: AgentCapabilities;
|
|
66
|
-
agentInfo?: AgentInfo;
|
|
67
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type ToolLimitsConfig = {
|
|
2
|
-
defaultToolTimeoutMs?: number;
|
|
3
|
-
maxToolTimeoutMs?: number;
|
|
4
|
-
maxRegisteredToolkits?: number;
|
|
5
|
-
maxRegisteredToolsPerVm?: number;
|
|
6
|
-
maxToolsPerToolkit?: number;
|
|
7
|
-
maxToolSchemaBytes?: number;
|
|
8
|
-
maxToolExamplesPerTool?: number;
|
|
9
|
-
maxToolExampleInputBytes?: number;
|
|
10
|
-
};
|
package/dist/host-tools.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ZodType } from "zod";
|
|
2
|
-
/** Maximum length for tool and toolkit descriptions (characters). */
|
|
3
|
-
export declare const MAX_TOOL_DESCRIPTION_LENGTH = 200;
|
|
4
|
-
/**
|
|
5
|
-
* A single tool that executes on the host.
|
|
6
|
-
* Mirrors the shape of AI SDK's tool() but with host-execution semantics.
|
|
7
|
-
*/
|
|
8
|
-
export interface HostTool<INPUT = any, OUTPUT = any> {
|
|
9
|
-
/** Description shown to the agent in --help and prompt docs. Max 200 characters. */
|
|
10
|
-
description: string;
|
|
11
|
-
/** Zod schema for the input. Drives CLI flag generation and validation. */
|
|
12
|
-
inputSchema: ZodType<INPUT>;
|
|
13
|
-
/** Runs on the host when the agent invokes the tool. */
|
|
14
|
-
execute: (input: INPUT) => Promise<OUTPUT> | OUTPUT;
|
|
15
|
-
/** Examples included in auto-generated prompt docs. */
|
|
16
|
-
examples?: ToolExample<INPUT>[];
|
|
17
|
-
/** Timeout in ms. Default: 30000. */
|
|
18
|
-
timeout?: number;
|
|
19
|
-
}
|
|
20
|
-
export interface ToolExample<INPUT = any> {
|
|
21
|
-
/** Human description of what this example does. */
|
|
22
|
-
description: string;
|
|
23
|
-
/** The input args for the example. */
|
|
24
|
-
input: INPUT;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* A named group of tools. Becomes a CLI binary: agentos-{name}.
|
|
28
|
-
*/
|
|
29
|
-
export interface ToolKit {
|
|
30
|
-
/** Toolkit name. Must be lowercase alphanumeric + hyphens. Becomes the CLI suffix: agentos-{name}. */
|
|
31
|
-
name: string;
|
|
32
|
-
/** Description shown in `agentos list-tools` and prompt docs. */
|
|
33
|
-
description: string;
|
|
34
|
-
/** The tools in this toolkit. Keys become subcommands. */
|
|
35
|
-
tools: Record<string, HostTool>;
|
|
36
|
-
}
|
|
37
|
-
/** Helper to create a HostTool with type inference. */
|
|
38
|
-
export declare function hostTool<INPUT, OUTPUT>(def: HostTool<INPUT, OUTPUT>): HostTool<INPUT, OUTPUT>;
|
|
39
|
-
/** Helper to create a ToolKit. */
|
|
40
|
-
export declare function toolKit(def: ToolKit): ToolKit;
|
|
41
|
-
/**
|
|
42
|
-
* Validate all description lengths in the given toolkits.
|
|
43
|
-
* Throws if any toolkit or tool description exceeds MAX_TOOL_DESCRIPTION_LENGTH.
|
|
44
|
-
*/
|
|
45
|
-
export declare function validateToolkits(toolKits: ToolKit[]): void;
|