@rivet-dev/agentos-core 0.2.22 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +9 -9
  2. package/dist/agent-os.d.ts +71 -198
  3. package/dist/agent-os.js +480 -1206
  4. package/dist/agentos-package.d.ts +15 -4
  5. package/dist/agentos-package.js +1 -22
  6. package/dist/cron/cron-manager.js +0 -27
  7. package/dist/cron/types.d.ts +0 -12
  8. package/dist/default-software/coreutils.aospkg +4 -0
  9. package/dist/default-software/default-software.json +10 -0
  10. package/dist/default-software/diffutils.aospkg +0 -0
  11. package/dist/default-software/findutils.aospkg +0 -0
  12. package/dist/default-software/gawk.aospkg +0 -0
  13. package/dist/default-software/grep.aospkg +0 -0
  14. package/dist/default-software/gzip.aospkg +0 -0
  15. package/dist/default-software/sed.aospkg +0 -0
  16. package/dist/default-software/tar.aospkg +0 -0
  17. package/dist/default-software.d.ts +6 -5
  18. package/dist/default-software.js +17 -6
  19. package/dist/generated/VmLimitsConfig.d.ts +0 -2
  20. package/dist/host-dir-mount.d.ts +1 -1
  21. package/dist/host-dir-mount.js +1 -1
  22. package/dist/language-execution.d.ts +6 -2
  23. package/dist/options-schema.d.ts +10 -48
  24. package/dist/options-schema.js +10 -47
  25. package/dist/output-replay.d.ts +18 -0
  26. package/dist/output-replay.js +75 -0
  27. package/dist/packages.d.ts +0 -9
  28. package/dist/packages.js +0 -39
  29. package/dist/process-forest.d.ts +7 -0
  30. package/dist/process-forest.js +24 -0
  31. package/dist/runtime-compat.d.ts +13 -0
  32. package/dist/runtime-compat.js +3 -9
  33. package/dist/sidecar/binary.d.ts +1 -1
  34. package/dist/sidecar/binary.js +4 -4
  35. package/dist/sidecar/native-process-client.d.ts +1 -1
  36. package/dist/sidecar/rpc-client.d.ts +12 -18
  37. package/dist/sidecar/rpc-client.js +385 -188
  38. package/dist/types.d.ts +3 -11
  39. package/package.json +9 -45
  40. package/dist/generated/AcpLimitsConfig.d.ts +0 -20
  41. package/dist/generated/AcpLimitsConfig.js +0 -2
  42. package/dist/json-rpc.d.ts +0 -50
  43. package/dist/json-rpc.js +0 -22
  44. package/dist/session-api.d.ts +0 -180
  45. package/dist/session-api.js +0 -1
  46. package/dist/sidecar/agentos-protocol.d.ts +0 -719
  47. package/dist/sidecar/agentos-protocol.js +0 -1331
@@ -1,719 +0,0 @@
1
- import * as bare from "@rivetkit/bare-ts";
2
- export type i32 = number;
3
- export type u32 = number;
4
- export type u64 = bigint;
5
- export type JsonUtf8 = string;
6
- export declare function readJsonUtf8(bc: bare.ByteCursor): JsonUtf8;
7
- export declare function writeJsonUtf8(bc: bare.ByteCursor, x: JsonUtf8): void;
8
- export declare enum AcpRuntimeKind {
9
- JavaScript = "JavaScript",
10
- Python = "Python",
11
- WebAssembly = "WebAssembly"
12
- }
13
- export declare function readAcpRuntimeKind(bc: bare.ByteCursor): AcpRuntimeKind;
14
- export declare function writeAcpRuntimeKind(bc: bare.ByteCursor, x: AcpRuntimeKind): void;
15
- /**
16
- * Legacy connection-owned ACP messages below remain encoded only for the
17
- * dormant browser reference runtime. They are not part of the public AgentOS
18
- * session API, and the native sidecar rejects them. Native durable orchestration
19
- * uses the same structs internally as a private adapter-process driver until the
20
- * browser protocol can be split into its own schema.
21
- */
22
- export type AcpCreateSessionRequest = {
23
- readonly agentType: string;
24
- readonly runtime: AcpRuntimeKind;
25
- readonly cwd: string;
26
- readonly additionalDirectories: readonly string[];
27
- readonly args: readonly string[];
28
- readonly env: ReadonlyMap<string, string>;
29
- readonly protocolVersion: i32;
30
- readonly clientCapabilities: JsonUtf8;
31
- readonly mcpServers: JsonUtf8;
32
- readonly skipOsInstructions: boolean;
33
- readonly additionalInstructions: string | null;
34
- };
35
- export declare function readAcpCreateSessionRequest(bc: bare.ByteCursor): AcpCreateSessionRequest;
36
- export declare function writeAcpCreateSessionRequest(bc: bare.ByteCursor, x: AcpCreateSessionRequest): void;
37
- export type AcpSessionRequest = {
38
- readonly sessionId: string;
39
- readonly method: string;
40
- readonly params: JsonUtf8 | null;
41
- };
42
- export declare function readAcpSessionRequest(bc: bare.ByteCursor): AcpSessionRequest;
43
- export declare function writeAcpSessionRequest(bc: bare.ByteCursor, x: AcpSessionRequest): void;
44
- /**
45
- * Enumerate the agents available in this VM. The sidecar answers from the already
46
- * projected `/opt/agentos` packages (client parses no manifests).
47
- */
48
- export type AcpListAgentsRequest = {
49
- readonly reserved: boolean;
50
- };
51
- export declare function readAcpListAgentsRequest(bc: bare.ByteCursor): AcpListAgentsRequest;
52
- export declare function writeAcpListAgentsRequest(bc: bare.ByteCursor, x: AcpListAgentsRequest): void;
53
- export type AcpAgentEntry = {
54
- readonly id: string;
55
- readonly installed: boolean;
56
- readonly adapterEntrypoint: string;
57
- };
58
- export declare function readAcpAgentEntry(bc: bare.ByteCursor): AcpAgentEntry;
59
- export declare function writeAcpAgentEntry(bc: bare.ByteCursor, x: AcpAgentEntry): void;
60
- export type AcpListAgentsResponse = {
61
- readonly agents: readonly AcpAgentEntry[];
62
- };
63
- export declare function readAcpListAgentsResponse(bc: bare.ByteCursor): AcpListAgentsResponse;
64
- export declare function writeAcpListAgentsResponse(bc: bare.ByteCursor, x: AcpListAgentsResponse): void;
65
- /**
66
- * `openSession` is idempotent. Opening an existing durable ID restores its
67
- * adapter when unloaded; getSession/listSessions remain the storage-only ways to
68
- * inspect it without starting an adapter. The sidecar owns ACP session/new versus
69
- * native resume/load selection and returns only after negotiation has populated
70
- * the cached configuration/capability/agent-info fields. Omitted cwd resolves to
71
- * `/home/agentos` in the sidecar. Restoration reapplies the original cwd,
72
- * additionalDirectories, env, exact native ACP McpServer values, instruction
73
- * settings, and current configuration values. The response is intentionally
74
- * empty: the caller owns the requested public ID (or the documented `main`
75
- * default), and getSession is the only API that returns durable metadata.
76
- * permissionPolicy is an immutable AgentOS-side strategy for resolving native
77
- * ACP session/request_permission calls: allow_all (the default) selects an
78
- * adapter-provided allow option, reject_all selects a reject option or returns a
79
- * typed permission_policy_unsatisfied error when none is offered,
80
- * and ask durably exposes the adapter's exact options for a caller response. It
81
- * does not change VM permissions and is not sent to the ACP adapter as config.
82
- */
83
- export type AcpOpenSessionRequest = {
84
- readonly sessionId: string | null;
85
- readonly agent: string;
86
- readonly cwd: string | null;
87
- readonly additionalDirectories: JsonUtf8 | null;
88
- readonly env: JsonUtf8 | null;
89
- readonly mcpServers: JsonUtf8 | null;
90
- readonly permissionPolicy: string | null;
91
- readonly skipOsInstructions: boolean | null;
92
- readonly additionalInstructions: string | null;
93
- };
94
- export declare function readAcpOpenSessionRequest(bc: bare.ByteCursor): AcpOpenSessionRequest;
95
- export declare function writeAcpOpenSessionRequest(bc: bare.ByteCursor, x: AcpOpenSessionRequest): void;
96
- /**
97
- * This lookup never starts, restores, or queries an ACP adapter.
98
- */
99
- export type AcpGetDurableSessionRequest = {
100
- readonly sessionId: string | null;
101
- };
102
- export declare function readAcpGetDurableSessionRequest(bc: bare.ByteCursor): AcpGetDurableSessionRequest;
103
- export declare function writeAcpGetDurableSessionRequest(bc: bare.ByteCursor, x: AcpGetDurableSessionRequest): void;
104
- /**
105
- * Listing is an ordinary updatedAt/sessionId keyset traversal. It never starts,
106
- * restores, or queries an ACP adapter. It deliberately does not freeze a database
107
- * snapshot across pages: a session updated between page requests can move in the
108
- * ordering, which keeps cursors simple and avoids a snapshot registry.
109
- */
110
- export type AcpListDurableSessionsRequest = {
111
- readonly cursor: string | null;
112
- readonly limit: u32 | null;
113
- };
114
- export declare function readAcpListDurableSessionsRequest(bc: bare.ByteCursor): AcpListDurableSessionsRequest;
115
- export declare function writeAcpListDurableSessionsRequest(bc: bare.ByteCursor, x: AcpListDurableSessionsRequest): void;
116
- /**
117
- * Deletion is naturally idempotent by its target ID. It permanently
118
- * removes durable metadata and history after orderly runtime teardown.
119
- */
120
- export type AcpDeleteSessionRequest = {
121
- readonly sessionId: string | null;
122
- };
123
- export declare function readAcpDeleteSessionRequest(bc: bare.ByteCursor): AcpDeleteSessionRequest;
124
- export declare function writeAcpDeleteSessionRequest(bc: bare.ByteCursor, x: AcpDeleteSessionRequest): void;
125
- /**
126
- * Unload cancels active work and releases the adapter but preserves the durable
127
- * session and all history. A later prompt transparently restores it.
128
- */
129
- export type AcpUnloadSessionRequest = {
130
- readonly sessionId: string | null;
131
- };
132
- export declare function readAcpUnloadSessionRequest(bc: bare.ByteCursor): AcpUnloadSessionRequest;
133
- export declare function writeAcpUnloadSessionRequest(bc: bare.ByteCursor, x: AcpUnloadSessionRequest): void;
134
- /**
135
- * Prompt never creates a missing session. It transparently restores an unloaded
136
- * adapter, durably accepts input before dispatch, blocks through the turn, and
137
- * never automatically replays a prompt whose delivery became uncertain. The
138
- * sidecar imposes no absolute session/prompt deadline: long turns and ask-policy
139
- * permission waits remain active while the actor keep-awake scope is held.
140
- */
141
- export type AcpPromptRequest = {
142
- readonly sessionId: string | null;
143
- readonly idempotencyKey: string | null;
144
- readonly content: JsonUtf8;
145
- };
146
- export declare function readAcpPromptRequest(bc: bare.ByteCursor): AcpPromptRequest;
147
- export declare function writeAcpPromptRequest(bc: bare.ByteCursor, x: AcpPromptRequest): void;
148
- /**
149
- * Cancellation is first-writer-wins against prompt completion and returns its
150
- * typed race outcome.
151
- */
152
- export type AcpCancelPromptRequest = {
153
- readonly sessionId: string | null;
154
- };
155
- export declare function readAcpCancelPromptRequest(bc: bare.ByteCursor): AcpCancelPromptRequest;
156
- export declare function writeAcpCancelPromptRequest(bc: bare.ByteCursor, x: AcpCancelPromptRequest): void;
157
- /**
158
- * Respond to a pending native ACP session/request_permission. sessionId is
159
- * always the explicit caller-owned AgentOS identity; it never defaults to main.
160
- * requestId is globally unique AgentOS-owned correlation and never contains the
161
- * adapter JSON-RPC ID. optionId is one of the exact adapter-supplied ACP option
162
- * identifiers. Resolution is first-writer-wins. accepted means the decision won
163
- * that race and was delivered to the active ACP waiter, not that the tool ran.
164
- * Invalid options are typed invalid_permission_option errors and do not consume
165
- * the request. A terminal late response is non-throwing and names its reason.
166
- */
167
- export type AcpRespondPermissionRequest = {
168
- readonly sessionId: string;
169
- readonly requestId: string;
170
- readonly optionId: string;
171
- };
172
- export declare function readAcpRespondPermissionRequest(bc: bare.ByteCursor): AcpRespondPermissionRequest;
173
- export declare function writeAcpRespondPermissionRequest(bc: bare.ByteCursor, x: AcpRespondPermissionRequest): void;
174
- /**
175
- * History is SQLite-only and never starts, restores, or queries an adapter. It
176
- * stores the generic durable event union below; nested wire payloads retain
177
- * unknown extension metadata and clients mechanically expose them as one flat
178
- * top-level type union. Agent message/thought deltas are emitted live as ephemeral entries;
179
- * they enter durable history only when the message completes. Non-delta ACP
180
- * updates interleaved during a message remain in native arrival order.
181
- * before/after are exclusive and mutually exclusive. Cursor expiry is a typed
182
- * error, never a silent skip. History retention and response pages are bounded
183
- * by the VM's generous `limits.acp.*` settings; retention prunes oldest events.
184
- * Durable sequence values can repeat on live delivery because observers
185
- * deduplicate by (sessionId, sequence).
186
- */
187
- export type AcpReadHistoryRequest = {
188
- readonly sessionId: string | null;
189
- readonly before: u64 | null;
190
- readonly after: u64 | null;
191
- readonly limit: u32 | null;
192
- };
193
- export declare function readAcpReadHistoryRequest(bc: bare.ByteCursor): AcpReadHistoryRequest;
194
- export declare function writeAcpReadHistoryRequest(bc: bare.ByteCursor, x: AcpReadHistoryRequest): void;
195
- /**
196
- * Cached getters never start, restore, or query an adapter.
197
- */
198
- export type AcpGetSessionConfigRequest = {
199
- readonly sessionId: string | null;
200
- };
201
- export declare function readAcpGetSessionConfigRequest(bc: bare.ByteCursor): AcpGetSessionConfigRequest;
202
- export declare function writeAcpGetSessionConfigRequest(bc: bare.ByteCursor, x: AcpGetSessionConfigRequest): void;
203
- export type AcpGetSessionCapabilitiesRequest = {
204
- readonly sessionId: string | null;
205
- };
206
- export declare function readAcpGetSessionCapabilitiesRequest(bc: bare.ByteCursor): AcpGetSessionCapabilitiesRequest;
207
- export declare function writeAcpGetSessionCapabilitiesRequest(bc: bare.ByteCursor, x: AcpGetSessionCapabilitiesRequest): void;
208
- export type AcpGetSessionAgentInfoRequest = {
209
- readonly sessionId: string | null;
210
- };
211
- export declare function readAcpGetSessionAgentInfoRequest(bc: bare.ByteCursor): AcpGetSessionAgentInfoRequest;
212
- export declare function writeAcpGetSessionAgentInfoRequest(bc: bare.ByteCursor, x: AcpGetSessionAgentInfoRequest): void;
213
- /**
214
- * Setting configuration may transparently restore the adapter; ACP owns
215
- * validation and the response replaces the complete cached option collection.
216
- * `value` encodes exactly one native ACP string or boolean config value.
217
- */
218
- export type AcpSetSessionConfigOptionRequest = {
219
- readonly sessionId: string | null;
220
- readonly configId: string;
221
- readonly value: JsonUtf8;
222
- };
223
- export declare function readAcpSetSessionConfigOptionRequest(bc: bare.ByteCursor): AcpSetSessionConfigOptionRequest;
224
- export declare function writeAcpSetSessionConfigOptionRequest(bc: bare.ByteCursor, x: AcpSetSessionConfigOptionRequest): void;
225
- export type AcpGetSessionStateRequest = {
226
- readonly sessionId: string;
227
- };
228
- export declare function readAcpGetSessionStateRequest(bc: bare.ByteCursor): AcpGetSessionStateRequest;
229
- export declare function writeAcpGetSessionStateRequest(bc: bare.ByteCursor, x: AcpGetSessionStateRequest): void;
230
- export type AcpCloseSessionRequest = {
231
- readonly sessionId: string;
232
- };
233
- export declare function readAcpCloseSessionRequest(bc: bare.ByteCursor): AcpCloseSessionRequest;
234
- export declare function writeAcpCloseSessionRequest(bc: bare.ByteCursor, x: AcpCloseSessionRequest): void;
235
- /**
236
- * Resume a session that exists in durable storage but is not live in the current
237
- * VM (e.g. after a Rivet actor slept and woke with a fresh VM). The sidecar runs
238
- * the stateless resume state machine (native session/load when the agent supports
239
- * it, else a fresh session/new + transcript continuation preamble). `runtime`,
240
- * `cwd`, and `env` describe the fresh adapter launch used by the fallback tier.
241
- * `transcriptPath`, when present, is a guest-readable path the fallback preamble
242
- * points the agent at.
243
- */
244
- export type AcpResumeSessionRequest = {
245
- readonly sessionId: string;
246
- readonly agentType: string;
247
- readonly runtime: AcpRuntimeKind;
248
- readonly transcriptPath: string | null;
249
- readonly cwd: string;
250
- readonly additionalDirectories: readonly string[];
251
- readonly mcpServers: JsonUtf8;
252
- readonly env: ReadonlyMap<string, string>;
253
- };
254
- export declare function readAcpResumeSessionRequest(bc: bare.ByteCursor): AcpResumeSessionRequest;
255
- export declare function writeAcpResumeSessionRequest(bc: bare.ByteCursor, x: AcpResumeSessionRequest): void;
256
- /**
257
- * Browser RESUMABLE path only (AGENTOS-WEB-ASYNC-AGENTS.md §3.2.1): the kernel
258
- * worker feeds a chunk of the agent's stdout into the in-flight create_session /
259
- * session/prompt handshake. The synchronous sidecar would block inside one
260
- * pushFrame; the resumable browser path returns between steps so the worker can
261
- * service the agent's own syscalls (incl. pi's net call for inference) on fresh,
262
- * non-nested pushFrames. `processId` is the handshake handle returned in the
263
- * AcpPendingResponse for the originating create/prompt request.
264
- */
265
- export type AcpDeliverAgentOutputRequest = {
266
- readonly processId: string;
267
- readonly chunk: ArrayBuffer;
268
- };
269
- export declare function readAcpDeliverAgentOutputRequest(bc: bare.ByteCursor): AcpDeliverAgentOutputRequest;
270
- export declare function writeAcpDeliverAgentOutputRequest(bc: bare.ByteCursor, x: AcpDeliverAgentOutputRequest): void;
271
- export type AcpRequest = {
272
- readonly tag: "AcpOpenSessionRequest";
273
- readonly val: AcpOpenSessionRequest;
274
- } | {
275
- readonly tag: "AcpGetDurableSessionRequest";
276
- readonly val: AcpGetDurableSessionRequest;
277
- } | {
278
- readonly tag: "AcpListDurableSessionsRequest";
279
- readonly val: AcpListDurableSessionsRequest;
280
- } | {
281
- readonly tag: "AcpDeleteSessionRequest";
282
- readonly val: AcpDeleteSessionRequest;
283
- } | {
284
- readonly tag: "AcpUnloadSessionRequest";
285
- readonly val: AcpUnloadSessionRequest;
286
- } | {
287
- readonly tag: "AcpPromptRequest";
288
- readonly val: AcpPromptRequest;
289
- } | {
290
- readonly tag: "AcpCancelPromptRequest";
291
- readonly val: AcpCancelPromptRequest;
292
- } | {
293
- readonly tag: "AcpRespondPermissionRequest";
294
- readonly val: AcpRespondPermissionRequest;
295
- } | {
296
- readonly tag: "AcpReadHistoryRequest";
297
- readonly val: AcpReadHistoryRequest;
298
- } | {
299
- readonly tag: "AcpGetSessionConfigRequest";
300
- readonly val: AcpGetSessionConfigRequest;
301
- } | {
302
- readonly tag: "AcpSetSessionConfigOptionRequest";
303
- readonly val: AcpSetSessionConfigOptionRequest;
304
- } | {
305
- readonly tag: "AcpGetSessionCapabilitiesRequest";
306
- readonly val: AcpGetSessionCapabilitiesRequest;
307
- } | {
308
- readonly tag: "AcpGetSessionAgentInfoRequest";
309
- readonly val: AcpGetSessionAgentInfoRequest;
310
- } | {
311
- readonly tag: "AcpCreateSessionRequest";
312
- readonly val: AcpCreateSessionRequest;
313
- } | {
314
- readonly tag: "AcpSessionRequest";
315
- readonly val: AcpSessionRequest;
316
- } | {
317
- readonly tag: "AcpGetSessionStateRequest";
318
- readonly val: AcpGetSessionStateRequest;
319
- } | {
320
- readonly tag: "AcpCloseSessionRequest";
321
- readonly val: AcpCloseSessionRequest;
322
- } | {
323
- readonly tag: "AcpResumeSessionRequest";
324
- readonly val: AcpResumeSessionRequest;
325
- } | {
326
- readonly tag: "AcpDeliverAgentOutputRequest";
327
- readonly val: AcpDeliverAgentOutputRequest;
328
- } | {
329
- readonly tag: "AcpListAgentsRequest";
330
- readonly val: AcpListAgentsRequest;
331
- };
332
- export declare function readAcpRequest(bc: bare.ByteCursor): AcpRequest;
333
- export declare function writeAcpRequest(bc: bare.ByteCursor, x: AcpRequest): void;
334
- export declare function encodeAcpRequest(x: AcpRequest, config?: Partial<bare.Config>): Uint8Array;
335
- export declare function decodeAcpRequest(bytes: Uint8Array): AcpRequest;
336
- export type AcpDurableSessionInfo = {
337
- readonly sessionId: string;
338
- readonly agent: string;
339
- readonly cwd: string;
340
- readonly additionalDirectories: JsonUtf8;
341
- readonly state: JsonUtf8;
342
- readonly latestSequence: u64;
343
- readonly title: string | null;
344
- readonly metadata: JsonUtf8 | null;
345
- readonly createdAt: string;
346
- readonly updatedAt: string;
347
- };
348
- export declare function readAcpDurableSessionInfo(bc: bare.ByteCursor): AcpDurableSessionInfo;
349
- export declare function writeAcpDurableSessionInfo(bc: bare.ByteCursor, x: AcpDurableSessionInfo): void;
350
- export type AcpOpenSessionResponse = {
351
- readonly reserved: boolean;
352
- };
353
- export declare function readAcpOpenSessionResponse(bc: bare.ByteCursor): AcpOpenSessionResponse;
354
- export declare function writeAcpOpenSessionResponse(bc: bare.ByteCursor, x: AcpOpenSessionResponse): void;
355
- export type AcpGetDurableSessionResponse = {
356
- readonly session: AcpDurableSessionInfo;
357
- };
358
- export declare function readAcpGetDurableSessionResponse(bc: bare.ByteCursor): AcpGetDurableSessionResponse;
359
- export declare function writeAcpGetDurableSessionResponse(bc: bare.ByteCursor, x: AcpGetDurableSessionResponse): void;
360
- export type AcpListDurableSessionsResponse = {
361
- readonly sessions: readonly AcpDurableSessionInfo[];
362
- readonly nextCursor: string | null;
363
- };
364
- export declare function readAcpListDurableSessionsResponse(bc: bare.ByteCursor): AcpListDurableSessionsResponse;
365
- export declare function writeAcpListDurableSessionsResponse(bc: bare.ByteCursor, x: AcpListDurableSessionsResponse): void;
366
- export type AcpDeleteSessionResponse = {
367
- readonly reserved: boolean;
368
- };
369
- export declare function readAcpDeleteSessionResponse(bc: bare.ByteCursor): AcpDeleteSessionResponse;
370
- export declare function writeAcpDeleteSessionResponse(bc: bare.ByteCursor, x: AcpDeleteSessionResponse): void;
371
- export type AcpUnloadSessionResponse = {
372
- readonly reserved: boolean;
373
- };
374
- export declare function readAcpUnloadSessionResponse(bc: bare.ByteCursor): AcpUnloadSessionResponse;
375
- export declare function writeAcpUnloadSessionResponse(bc: bare.ByteCursor, x: AcpUnloadSessionResponse): void;
376
- export type AcpPromptResponse = {
377
- readonly sessionId: string;
378
- readonly message: JsonUtf8 | null;
379
- readonly stopReason: string;
380
- };
381
- export declare function readAcpPromptResponse(bc: bare.ByteCursor): AcpPromptResponse;
382
- export declare function writeAcpPromptResponse(bc: bare.ByteCursor, x: AcpPromptResponse): void;
383
- export type AcpCancelPromptResponse = {
384
- readonly status: string;
385
- };
386
- export declare function readAcpCancelPromptResponse(bc: bare.ByteCursor): AcpCancelPromptResponse;
387
- export declare function writeAcpCancelPromptResponse(bc: bare.ByteCursor, x: AcpCancelPromptResponse): void;
388
- export type AcpRespondPermissionResponse = {
389
- readonly status: string;
390
- readonly reason: string | null;
391
- };
392
- export declare function readAcpRespondPermissionResponse(bc: bare.ByteCursor): AcpRespondPermissionResponse;
393
- export declare function writeAcpRespondPermissionResponse(bc: bare.ByteCursor, x: AcpRespondPermissionResponse): void;
394
- /**
395
- * The generic internal wire/storage union. Native payloads retain their
396
- * negotiated ACP field names, optional values, and opaque _meta. Public clients
397
- * flatten SessionUpdate.sessionUpdate into top-level type and flatten permission
398
- * request/response fields beside the durability envelope; they do not expose
399
- * these internal update/request/response wrappers. Native adapter request IDs
400
- * and private ACP session IDs never enter the public union. Automatically
401
- * resolved permission requests are never persisted or emitted. An ask request
402
- * has no permission timeout: the active prompt remains awake until a response
403
- * or explicit adapter/session/VM lifecycle transition wins.
404
- */
405
- export type AcpDurableSessionUpdate = {
406
- readonly update: JsonUtf8;
407
- };
408
- export declare function readAcpDurableSessionUpdate(bc: bare.ByteCursor): AcpDurableSessionUpdate;
409
- export declare function writeAcpDurableSessionUpdate(bc: bare.ByteCursor, x: AcpDurableSessionUpdate): void;
410
- export type AcpDurablePermissionRequest = {
411
- readonly requestId: string;
412
- readonly request: JsonUtf8;
413
- };
414
- export declare function readAcpDurablePermissionRequest(bc: bare.ByteCursor): AcpDurablePermissionRequest;
415
- export declare function writeAcpDurablePermissionRequest(bc: bare.ByteCursor, x: AcpDurablePermissionRequest): void;
416
- export type AcpDurablePermissionResponse = {
417
- readonly requestId: string;
418
- readonly response: JsonUtf8;
419
- readonly status: string;
420
- readonly reason: string | null;
421
- };
422
- export declare function readAcpDurablePermissionResponse(bc: bare.ByteCursor): AcpDurablePermissionResponse;
423
- export declare function writeAcpDurablePermissionResponse(bc: bare.ByteCursor, x: AcpDurablePermissionResponse): void;
424
- export type AcpDurableEvent = {
425
- readonly tag: "AcpDurableSessionUpdate";
426
- readonly val: AcpDurableSessionUpdate;
427
- } | {
428
- readonly tag: "AcpDurablePermissionRequest";
429
- readonly val: AcpDurablePermissionRequest;
430
- } | {
431
- readonly tag: "AcpDurablePermissionResponse";
432
- readonly val: AcpDurablePermissionResponse;
433
- };
434
- export declare function readAcpDurableEvent(bc: bare.ByteCursor): AcpDurableEvent;
435
- export declare function writeAcpDurableEvent(bc: bare.ByteCursor, x: AcpDurableEvent): void;
436
- /**
437
- * AgentOS adds only this public identity, sequence, and timestamp envelope.
438
- */
439
- export type AcpDurableHistoryEntry = {
440
- readonly sessionId: string;
441
- readonly sequence: u64;
442
- readonly timestamp: string;
443
- readonly event: AcpDurableEvent;
444
- };
445
- export declare function readAcpDurableHistoryEntry(bc: bare.ByteCursor): AcpDurableHistoryEntry;
446
- export declare function writeAcpDurableHistoryEntry(bc: bare.ByteCursor, x: AcpDurableHistoryEntry): void;
447
- export type AcpHistoryPageResponse = {
448
- readonly events: readonly AcpDurableHistoryEntry[];
449
- readonly hasMoreBefore: boolean;
450
- readonly hasMoreAfter: boolean;
451
- };
452
- export declare function readAcpHistoryPageResponse(bc: bare.ByteCursor): AcpHistoryPageResponse;
453
- export declare function writeAcpHistoryPageResponse(bc: bare.ByteCursor, x: AcpHistoryPageResponse): void;
454
- export type AcpSessionConfigResponse = {
455
- readonly revision: u64;
456
- readonly options: JsonUtf8;
457
- };
458
- export declare function readAcpSessionConfigResponse(bc: bare.ByteCursor): AcpSessionConfigResponse;
459
- export declare function writeAcpSessionConfigResponse(bc: bare.ByteCursor, x: AcpSessionConfigResponse): void;
460
- export type AcpSessionCapabilitiesResponse = {
461
- readonly capabilities: JsonUtf8 | null;
462
- };
463
- export declare function readAcpSessionCapabilitiesResponse(bc: bare.ByteCursor): AcpSessionCapabilitiesResponse;
464
- export declare function writeAcpSessionCapabilitiesResponse(bc: bare.ByteCursor, x: AcpSessionCapabilitiesResponse): void;
465
- export type AcpSessionAgentInfoResponse = {
466
- readonly agentInfo: JsonUtf8 | null;
467
- };
468
- export declare function readAcpSessionAgentInfoResponse(bc: bare.ByteCursor): AcpSessionAgentInfoResponse;
469
- export declare function writeAcpSessionAgentInfoResponse(bc: bare.ByteCursor, x: AcpSessionAgentInfoResponse): void;
470
- export type AcpSessionCreatedResponse = {
471
- readonly sessionId: string;
472
- readonly pid: u32 | null;
473
- readonly modes: JsonUtf8 | null;
474
- readonly configOptions: readonly JsonUtf8[];
475
- readonly agentCapabilities: JsonUtf8 | null;
476
- readonly agentInfo: JsonUtf8 | null;
477
- };
478
- export declare function readAcpSessionCreatedResponse(bc: bare.ByteCursor): AcpSessionCreatedResponse;
479
- export declare function writeAcpSessionCreatedResponse(bc: bare.ByteCursor, x: AcpSessionCreatedResponse): void;
480
- export type AcpSessionRpcResponse = {
481
- readonly sessionId: string;
482
- readonly response: JsonUtf8;
483
- /**
484
- * Number of request-scoped AcpSessionEvent frames emitted before this
485
- * terminal response. Clients use this as an event-delivery barrier because
486
- * response and event frames travel on separate priority lanes.
487
- */
488
- readonly eventCount: u32;
489
- };
490
- export declare function readAcpSessionRpcResponse(bc: bare.ByteCursor): AcpSessionRpcResponse;
491
- export declare function writeAcpSessionRpcResponse(bc: bare.ByteCursor, x: AcpSessionRpcResponse): void;
492
- export type AcpSessionStateResponse = {
493
- readonly sessionId: string;
494
- readonly agentType: string;
495
- readonly processId: string;
496
- readonly pid: u32 | null;
497
- readonly closed: boolean;
498
- readonly exitCode: i32 | null;
499
- readonly modes: JsonUtf8 | null;
500
- readonly configOptions: readonly JsonUtf8[];
501
- readonly agentCapabilities: JsonUtf8 | null;
502
- readonly agentInfo: JsonUtf8 | null;
503
- };
504
- export declare function readAcpSessionStateResponse(bc: bare.ByteCursor): AcpSessionStateResponse;
505
- export declare function writeAcpSessionStateResponse(bc: bare.ByteCursor, x: AcpSessionStateResponse): void;
506
- export type AcpSessionClosedResponse = {
507
- readonly sessionId: string;
508
- };
509
- export declare function readAcpSessionClosedResponse(bc: bare.ByteCursor): AcpSessionClosedResponse;
510
- export declare function writeAcpSessionClosedResponse(bc: bare.ByteCursor, x: AcpSessionClosedResponse): void;
511
- /**
512
- * Result of AcpResumeSessionRequest. `sessionId` is the live ACP session id after
513
- * resume: equal to the requested id for native loads, or the freshly assigned id
514
- * for the fallback tier (the caller remaps external -> live). `mode` is "native"
515
- * (session/load|resume succeeded) or "fallback" (a new session was created and the
516
- * transcript-continuation preamble was armed for the next prompt).
517
- */
518
- export type AcpSessionResumedResponse = {
519
- readonly sessionId: string;
520
- readonly mode: string;
521
- };
522
- export declare function readAcpSessionResumedResponse(bc: bare.ByteCursor): AcpSessionResumedResponse;
523
- export declare function writeAcpSessionResumedResponse(bc: bare.ByteCursor, x: AcpSessionResumedResponse): void;
524
- export type AcpErrorResponse = {
525
- readonly code: string;
526
- readonly message: string;
527
- };
528
- export declare function readAcpErrorResponse(bc: bare.ByteCursor): AcpErrorResponse;
529
- export declare function writeAcpErrorResponse(bc: bare.ByteCursor, x: AcpErrorResponse): void;
530
- /**
531
- * Browser RESUMABLE path: the create_session / session/prompt request (and each
532
- * AcpDeliverAgentOutputRequest that has not yet completed the handshake) returns
533
- * this, carrying the `processId` handle the kernel worker drives the interaction
534
- * with. The real result (AcpSessionCreatedResponse / AcpSessionRpcResponse) is
535
- * delivered as the response to the AcpDeliverAgentOutputRequest that completes it.
536
- */
537
- export type AcpPendingResponse = {
538
- readonly processId: string;
539
- };
540
- export declare function readAcpPendingResponse(bc: bare.ByteCursor): AcpPendingResponse;
541
- export declare function writeAcpPendingResponse(bc: bare.ByteCursor, x: AcpPendingResponse): void;
542
- export type AcpResponse = {
543
- readonly tag: "AcpOpenSessionResponse";
544
- readonly val: AcpOpenSessionResponse;
545
- } | {
546
- readonly tag: "AcpGetDurableSessionResponse";
547
- readonly val: AcpGetDurableSessionResponse;
548
- } | {
549
- readonly tag: "AcpListDurableSessionsResponse";
550
- readonly val: AcpListDurableSessionsResponse;
551
- } | {
552
- readonly tag: "AcpDeleteSessionResponse";
553
- readonly val: AcpDeleteSessionResponse;
554
- } | {
555
- readonly tag: "AcpUnloadSessionResponse";
556
- readonly val: AcpUnloadSessionResponse;
557
- } | {
558
- readonly tag: "AcpPromptResponse";
559
- readonly val: AcpPromptResponse;
560
- } | {
561
- readonly tag: "AcpCancelPromptResponse";
562
- readonly val: AcpCancelPromptResponse;
563
- } | {
564
- readonly tag: "AcpRespondPermissionResponse";
565
- readonly val: AcpRespondPermissionResponse;
566
- } | {
567
- readonly tag: "AcpHistoryPageResponse";
568
- readonly val: AcpHistoryPageResponse;
569
- } | {
570
- readonly tag: "AcpSessionConfigResponse";
571
- readonly val: AcpSessionConfigResponse;
572
- } | {
573
- readonly tag: "AcpSessionCapabilitiesResponse";
574
- readonly val: AcpSessionCapabilitiesResponse;
575
- } | {
576
- readonly tag: "AcpSessionAgentInfoResponse";
577
- readonly val: AcpSessionAgentInfoResponse;
578
- } | {
579
- readonly tag: "AcpSessionCreatedResponse";
580
- readonly val: AcpSessionCreatedResponse;
581
- } | {
582
- readonly tag: "AcpSessionRpcResponse";
583
- readonly val: AcpSessionRpcResponse;
584
- } | {
585
- readonly tag: "AcpSessionStateResponse";
586
- readonly val: AcpSessionStateResponse;
587
- } | {
588
- readonly tag: "AcpSessionClosedResponse";
589
- readonly val: AcpSessionClosedResponse;
590
- } | {
591
- readonly tag: "AcpSessionResumedResponse";
592
- readonly val: AcpSessionResumedResponse;
593
- } | {
594
- readonly tag: "AcpErrorResponse";
595
- readonly val: AcpErrorResponse;
596
- } | {
597
- readonly tag: "AcpPendingResponse";
598
- readonly val: AcpPendingResponse;
599
- } | {
600
- readonly tag: "AcpListAgentsResponse";
601
- readonly val: AcpListAgentsResponse;
602
- };
603
- export declare function readAcpResponse(bc: bare.ByteCursor): AcpResponse;
604
- export declare function writeAcpResponse(bc: bare.ByteCursor, x: AcpResponse): void;
605
- export declare function encodeAcpResponse(x: AcpResponse, config?: Partial<bare.Config>): Uint8Array;
606
- export declare function decodeAcpResponse(bytes: Uint8Array): AcpResponse;
607
- /**
608
- * Live delivery uses the identical durable union/history envelope. Consumers
609
- * reconnect by subscribing, fetching after their last sequence, then
610
- * deduplicating by (sessionId, sequence); there is no second replay protocol.
611
- */
612
- export type AcpDurableSessionEvent = {
613
- readonly sessionId: string;
614
- readonly sequence: u64;
615
- readonly timestamp: string;
616
- readonly event: AcpDurableEvent;
617
- };
618
- export declare function readAcpDurableSessionEvent(bc: bare.ByteCursor): AcpDurableSessionEvent;
619
- export declare function writeAcpDurableSessionEvent(bc: bare.ByteCursor, x: AcpDurableSessionEvent): void;
620
- /**
621
- * Ephemeral entries are live-only ACP agent_message_chunk or
622
- * agent_thought_chunk updates. They are never persisted or sequenced; the
623
- * durable completed message is authoritative after reconnect.
624
- */
625
- export type AcpEphemeralSessionUpdateEvent = {
626
- readonly sessionId: string;
627
- readonly afterSequence: u64;
628
- readonly update: JsonUtf8;
629
- };
630
- export declare function readAcpEphemeralSessionUpdateEvent(bc: bare.ByteCursor): AcpEphemeralSessionUpdateEvent;
631
- export declare function writeAcpEphemeralSessionUpdateEvent(bc: bare.ByteCursor, x: AcpEphemeralSessionUpdateEvent): void;
632
- /**
633
- * Legacy browser-reference live event. Native durable clients ignore it and
634
- * consume AcpDurableSessionEvent/AcpEphemeralSessionUpdateEvent instead.
635
- */
636
- export type AcpSessionEvent = {
637
- readonly sessionId: string;
638
- readonly notification: JsonUtf8;
639
- };
640
- export declare function readAcpSessionEvent(bc: bare.ByteCursor): AcpSessionEvent;
641
- export declare function writeAcpSessionEvent(bc: bare.ByteCursor, x: AcpSessionEvent): void;
642
- export type AcpAgentStderrEvent = {
643
- readonly sessionId: string;
644
- readonly agentType: string;
645
- readonly processId: string;
646
- readonly chunk: ArrayBuffer;
647
- };
648
- export declare function readAcpAgentStderrEvent(bc: bare.ByteCursor): AcpAgentStderrEvent;
649
- export declare function writeAcpAgentStderrEvent(bc: bare.ByteCursor, x: AcpAgentStderrEvent): void;
650
- /**
651
- * Emitted when the ACP adapter process exits unexpectedly — a crash from the
652
- * host's perspective (any spontaneous exit, including code 0).
653
- * `restart` is "not_attempted": the sidecar never respawns an adapter or
654
- * replays an interrupted request implicitly. `restartCount` and `maxRestarts`
655
- * are therefore both zero. Explicit session restoration is a separate caller
656
- * operation.
657
- * `exitCode` is absent when the exit was observed indirectly (e.g. a write to
658
- * the adapter's stdin failed because the process was already gone).
659
- * `pid` is the host pid reported when the adapter process was launched.
660
- */
661
- export type AcpAgentExitedEvent = {
662
- readonly sessionId: string;
663
- readonly agentType: string;
664
- readonly processId: string;
665
- readonly pid: u32 | null;
666
- readonly exitCode: i32 | null;
667
- readonly restart: string;
668
- readonly restartCount: u32;
669
- readonly maxRestarts: u32;
670
- };
671
- export declare function readAcpAgentExitedEvent(bc: bare.ByteCursor): AcpAgentExitedEvent;
672
- export declare function writeAcpAgentExitedEvent(bc: bare.ByteCursor, x: AcpAgentExitedEvent): void;
673
- export type AcpEvent = {
674
- readonly tag: "AcpDurableSessionEvent";
675
- readonly val: AcpDurableSessionEvent;
676
- } | {
677
- readonly tag: "AcpEphemeralSessionUpdateEvent";
678
- readonly val: AcpEphemeralSessionUpdateEvent;
679
- } | {
680
- readonly tag: "AcpSessionEvent";
681
- readonly val: AcpSessionEvent;
682
- } | {
683
- readonly tag: "AcpAgentStderrEvent";
684
- readonly val: AcpAgentStderrEvent;
685
- } | {
686
- readonly tag: "AcpAgentExitedEvent";
687
- readonly val: AcpAgentExitedEvent;
688
- };
689
- export declare function readAcpEvent(bc: bare.ByteCursor): AcpEvent;
690
- export declare function writeAcpEvent(bc: bare.ByteCursor, x: AcpEvent): void;
691
- export declare function encodeAcpEvent(x: AcpEvent, config?: Partial<bare.Config>): Uint8Array;
692
- export declare function decodeAcpEvent(bytes: Uint8Array): AcpEvent;
693
- export type AcpHostRequestCallback = {
694
- readonly sessionId: string;
695
- readonly request: JsonUtf8;
696
- };
697
- export declare function readAcpHostRequestCallback(bc: bare.ByteCursor): AcpHostRequestCallback;
698
- export declare function writeAcpHostRequestCallback(bc: bare.ByteCursor, x: AcpHostRequestCallback): void;
699
- export type AcpCallback = {
700
- readonly tag: "AcpHostRequestCallback";
701
- readonly val: AcpHostRequestCallback;
702
- };
703
- export declare function readAcpCallback(bc: bare.ByteCursor): AcpCallback;
704
- export declare function writeAcpCallback(bc: bare.ByteCursor, x: AcpCallback): void;
705
- export declare function encodeAcpCallback(x: AcpCallback, config?: Partial<bare.Config>): Uint8Array;
706
- export declare function decodeAcpCallback(bytes: Uint8Array): AcpCallback;
707
- export type AcpHostRequestCallbackResponse = {
708
- readonly response: JsonUtf8 | null;
709
- };
710
- export declare function readAcpHostRequestCallbackResponse(bc: bare.ByteCursor): AcpHostRequestCallbackResponse;
711
- export declare function writeAcpHostRequestCallbackResponse(bc: bare.ByteCursor, x: AcpHostRequestCallbackResponse): void;
712
- export type AcpCallbackResponse = {
713
- readonly tag: "AcpHostRequestCallbackResponse";
714
- readonly val: AcpHostRequestCallbackResponse;
715
- };
716
- export declare function readAcpCallbackResponse(bc: bare.ByteCursor): AcpCallbackResponse;
717
- export declare function writeAcpCallbackResponse(bc: bare.ByteCursor, x: AcpCallbackResponse): void;
718
- export declare function encodeAcpCallbackResponse(x: AcpCallbackResponse, config?: Partial<bare.Config>): Uint8Array;
719
- export declare function decodeAcpCallbackResponse(bytes: Uint8Array): AcpCallbackResponse;