@rivet-dev/agentos-core 0.0.0-main.2f99c77 → 0.0.0-main.5ac5a14

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 (62) hide show
  1. package/README.md +10 -196
  2. package/dist/agent-os.d.ts +508 -271
  3. package/dist/agent-os.js +2277 -1243
  4. package/dist/agentos-package.d.ts +6 -4
  5. package/dist/agentos-package.js +6 -3
  6. package/dist/base-filesystem.js +2 -2
  7. package/dist/{host-tools-zod.d.ts → bindings-zod.d.ts} +1 -1
  8. package/dist/{host-tools-zod.js → bindings-zod.js} +27 -20
  9. package/dist/bindings.d.ts +43 -0
  10. package/dist/bindings.js +34 -0
  11. package/dist/code-execution.d.ts +70 -0
  12. package/dist/code-execution.js +115 -0
  13. package/dist/cron/cron-manager.js +43 -10
  14. package/dist/cron/index.d.ts +1 -1
  15. package/dist/cron/types.d.ts +25 -9
  16. package/dist/filesystem-snapshot.d.ts +1 -2
  17. package/dist/filesystem-snapshot.js +0 -43
  18. package/dist/generated/AcpLimitsConfig.d.ts +16 -0
  19. package/dist/generated/BindingLimitsConfig.d.ts +10 -0
  20. package/dist/generated/CreateVmConfig.d.ts +2 -0
  21. package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
  22. package/dist/generated/ProcessLimitsConfig.js +2 -0
  23. package/dist/generated/VmGroupConfig.d.ts +5 -0
  24. package/dist/generated/VmGroupConfig.js +2 -0
  25. package/dist/generated/VmLimitsConfig.d.ts +4 -2
  26. package/dist/generated/VmUserAccountConfig.d.ts +9 -0
  27. package/dist/generated/VmUserAccountConfig.js +2 -0
  28. package/dist/generated/VmUserConfig.d.ts +19 -0
  29. package/dist/generated/WasmLimitsConfig.d.ts +1 -0
  30. package/dist/index.d.ts +7 -5
  31. package/dist/index.js +5 -5
  32. package/dist/language-execution.d.ts +170 -0
  33. package/dist/language-execution.js +1 -0
  34. package/dist/layers.d.ts +5 -2
  35. package/dist/layers.js +0 -185
  36. package/dist/options-schema.d.ts +150 -31
  37. package/dist/options-schema.js +159 -26
  38. package/dist/packages.d.ts +1 -1
  39. package/dist/runtime-compat.d.ts +6 -35
  40. package/dist/runtime-compat.js +85 -373
  41. package/dist/runtime.d.ts +5 -1
  42. package/dist/sandbox.d.ts +4 -4
  43. package/dist/sandbox.js +34 -21
  44. package/dist/session-api.d.ts +180 -0
  45. package/dist/session-api.js +1 -0
  46. package/dist/sidecar/agentos-protocol.d.ts +434 -32
  47. package/dist/sidecar/agentos-protocol.js +693 -93
  48. package/dist/sidecar/rpc-client.d.ts +18 -6
  49. package/dist/sidecar/rpc-client.js +88 -39
  50. package/dist/test/runtime.d.ts +2 -1
  51. package/dist/test/runtime.js +2 -1
  52. package/dist/test/terminal-harness.js +0 -3
  53. package/dist/types.d.ts +7 -6
  54. package/package.json +38 -28
  55. package/dist/agent-session-types.d.ts +0 -67
  56. package/dist/generated/ToolLimitsConfig.d.ts +0 -10
  57. package/dist/host-tools.d.ts +0 -45
  58. package/dist/host-tools.js +0 -35
  59. package/dist/overlay-filesystem.d.ts +0 -19
  60. package/dist/overlay-filesystem.js +0 -645
  61. /package/dist/generated/{ToolLimitsConfig.js → BindingLimitsConfig.js} +0 -0
  62. /package/dist/{agent-session-types.js → generated/VmUserConfig.js} +0 -0
@@ -1,6 +1,7 @@
1
1
  import * as bare from "@rivetkit/bare-ts";
2
2
  export type i32 = number;
3
3
  export type u32 = number;
4
+ export type u64 = bigint;
4
5
  export type JsonUtf8 = string;
5
6
  export declare function readJsonUtf8(bc: bare.ByteCursor): JsonUtf8;
6
7
  export declare function writeJsonUtf8(bc: bare.ByteCursor, x: JsonUtf8): void;
@@ -11,10 +12,18 @@ export declare enum AcpRuntimeKind {
11
12
  }
12
13
  export declare function readAcpRuntimeKind(bc: bare.ByteCursor): AcpRuntimeKind;
13
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
+ */
14
22
  export type AcpCreateSessionRequest = {
15
23
  readonly agentType: string;
16
24
  readonly runtime: AcpRuntimeKind;
17
25
  readonly cwd: string;
26
+ readonly additionalDirectories: readonly string[];
18
27
  readonly args: readonly string[];
19
28
  readonly env: ReadonlyMap<string, string>;
20
29
  readonly protocolVersion: i32;
@@ -53,6 +62,166 @@ export type AcpListAgentsResponse = {
53
62
  };
54
63
  export declare function readAcpListAgentsResponse(bc: bare.ByteCursor): AcpListAgentsResponse;
55
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;
56
225
  export type AcpGetSessionStateRequest = {
57
226
  readonly sessionId: string;
58
227
  };
@@ -67,15 +236,19 @@ export declare function writeAcpCloseSessionRequest(bc: bare.ByteCursor, x: AcpC
67
236
  * Resume a session that exists in durable storage but is not live in the current
68
237
  * VM (e.g. after a Rivet actor slept and woke with a fresh VM). The sidecar runs
69
238
  * the stateless resume state machine (native session/load when the agent supports
70
- * it, else a fresh session/new + transcript continuation preamble). `cwd`/`env`
71
- * describe the fresh adapter launch used by the fallback tier. `transcriptPath`,
72
- * when present, is a guest-readable path the fallback preamble points the agent at.
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.
73
243
  */
74
244
  export type AcpResumeSessionRequest = {
75
245
  readonly sessionId: string;
76
246
  readonly agentType: string;
247
+ readonly runtime: AcpRuntimeKind;
77
248
  readonly transcriptPath: string | null;
78
249
  readonly cwd: string;
250
+ readonly additionalDirectories: readonly string[];
251
+ readonly mcpServers: JsonUtf8;
79
252
  readonly env: ReadonlyMap<string, string>;
80
253
  };
81
254
  export declare function readAcpResumeSessionRequest(bc: bare.ByteCursor): AcpResumeSessionRequest;
@@ -96,6 +269,45 @@ export type AcpDeliverAgentOutputRequest = {
96
269
  export declare function readAcpDeliverAgentOutputRequest(bc: bare.ByteCursor): AcpDeliverAgentOutputRequest;
97
270
  export declare function writeAcpDeliverAgentOutputRequest(bc: bare.ByteCursor, x: AcpDeliverAgentOutputRequest): void;
98
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
+ } | {
99
311
  readonly tag: "AcpCreateSessionRequest";
100
312
  readonly val: AcpCreateSessionRequest;
101
313
  } | {
@@ -121,6 +333,140 @@ export declare function readAcpRequest(bc: bare.ByteCursor): AcpRequest;
121
333
  export declare function writeAcpRequest(bc: bare.ByteCursor, x: AcpRequest): void;
122
334
  export declare function encodeAcpRequest(x: AcpRequest, config?: Partial<bare.Config>): Uint8Array;
123
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;
124
470
  export type AcpSessionCreatedResponse = {
125
471
  readonly sessionId: string;
126
472
  readonly pid: u32 | null;
@@ -134,6 +480,12 @@ export declare function writeAcpSessionCreatedResponse(bc: bare.ByteCursor, x: A
134
480
  export type AcpSessionRpcResponse = {
135
481
  readonly sessionId: string;
136
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;
137
489
  };
138
490
  export declare function readAcpSessionRpcResponse(bc: bare.ByteCursor): AcpSessionRpcResponse;
139
491
  export declare function writeAcpSessionRpcResponse(bc: bare.ByteCursor, x: AcpSessionRpcResponse): void;
@@ -188,6 +540,42 @@ export type AcpPendingResponse = {
188
540
  export declare function readAcpPendingResponse(bc: bare.ByteCursor): AcpPendingResponse;
189
541
  export declare function writeAcpPendingResponse(bc: bare.ByteCursor, x: AcpPendingResponse): void;
190
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
+ } | {
191
579
  readonly tag: "AcpSessionCreatedResponse";
192
580
  readonly val: AcpSessionCreatedResponse;
193
581
  } | {
@@ -216,6 +604,35 @@ export declare function readAcpResponse(bc: bare.ByteCursor): AcpResponse;
216
604
  export declare function writeAcpResponse(bc: bare.ByteCursor, x: AcpResponse): void;
217
605
  export declare function encodeAcpResponse(x: AcpResponse, config?: Partial<bare.Config>): Uint8Array;
218
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
+ */
219
636
  export type AcpSessionEvent = {
220
637
  readonly sessionId: string;
221
638
  readonly notification: JsonUtf8;
@@ -231,23 +648,21 @@ export type AcpAgentStderrEvent = {
231
648
  export declare function readAcpAgentStderrEvent(bc: bare.ByteCursor): AcpAgentStderrEvent;
232
649
  export declare function writeAcpAgentStderrEvent(bc: bare.ByteCursor, x: AcpAgentStderrEvent): void;
233
650
  /**
234
- * Emitted when the ACP adapter process exits without an explicit close_session —
235
- * a crash from the host's perspective (any spontaneous exit, including code 0).
236
- * `restart` reports the sidecar's bounded auto-restart outcome:
237
- * "restarted" — adapter respawned and the session was natively re-attached
238
- * (session/load | session/resume) under the same sessionId;
239
- * the session stays live.
240
- * "unsupported" — the respawned adapter does not advertise a native resume
241
- * capability; the session record was evicted.
242
- * "failed" — the respawn or the native re-attach errored; evicted.
243
- * "exhausted" — maxRestarts was already spent for this session; evicted.
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.
244
657
  * `exitCode` is absent when the exit was observed indirectly (e.g. a write to
245
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.
246
660
  */
247
661
  export type AcpAgentExitedEvent = {
248
662
  readonly sessionId: string;
249
663
  readonly agentType: string;
250
664
  readonly processId: string;
665
+ readonly pid: u32 | null;
251
666
  readonly exitCode: i32 | null;
252
667
  readonly restart: string;
253
668
  readonly restartCount: u32;
@@ -256,6 +671,12 @@ export type AcpAgentExitedEvent = {
256
671
  export declare function readAcpAgentExitedEvent(bc: bare.ByteCursor): AcpAgentExitedEvent;
257
672
  export declare function writeAcpAgentExitedEvent(bc: bare.ByteCursor, x: AcpAgentExitedEvent): void;
258
673
  export type AcpEvent = {
674
+ readonly tag: "AcpDurableSessionEvent";
675
+ readonly val: AcpDurableSessionEvent;
676
+ } | {
677
+ readonly tag: "AcpEphemeralSessionUpdateEvent";
678
+ readonly val: AcpEphemeralSessionUpdateEvent;
679
+ } | {
259
680
  readonly tag: "AcpSessionEvent";
260
681
  readonly val: AcpSessionEvent;
261
682
  } | {
@@ -269,13 +690,6 @@ export declare function readAcpEvent(bc: bare.ByteCursor): AcpEvent;
269
690
  export declare function writeAcpEvent(bc: bare.ByteCursor, x: AcpEvent): void;
270
691
  export declare function encodeAcpEvent(x: AcpEvent, config?: Partial<bare.Config>): Uint8Array;
271
692
  export declare function decodeAcpEvent(bytes: Uint8Array): AcpEvent;
272
- export type AcpPermissionCallback = {
273
- readonly sessionId: string;
274
- readonly permissionId: string;
275
- readonly params: JsonUtf8;
276
- };
277
- export declare function readAcpPermissionCallback(bc: bare.ByteCursor): AcpPermissionCallback;
278
- export declare function writeAcpPermissionCallback(bc: bare.ByteCursor, x: AcpPermissionCallback): void;
279
693
  export type AcpHostRequestCallback = {
280
694
  readonly sessionId: string;
281
695
  readonly request: JsonUtf8;
@@ -283,9 +697,6 @@ export type AcpHostRequestCallback = {
283
697
  export declare function readAcpHostRequestCallback(bc: bare.ByteCursor): AcpHostRequestCallback;
284
698
  export declare function writeAcpHostRequestCallback(bc: bare.ByteCursor, x: AcpHostRequestCallback): void;
285
699
  export type AcpCallback = {
286
- readonly tag: "AcpPermissionCallback";
287
- readonly val: AcpPermissionCallback;
288
- } | {
289
700
  readonly tag: "AcpHostRequestCallback";
290
701
  readonly val: AcpHostRequestCallback;
291
702
  };
@@ -293,21 +704,12 @@ export declare function readAcpCallback(bc: bare.ByteCursor): AcpCallback;
293
704
  export declare function writeAcpCallback(bc: bare.ByteCursor, x: AcpCallback): void;
294
705
  export declare function encodeAcpCallback(x: AcpCallback, config?: Partial<bare.Config>): Uint8Array;
295
706
  export declare function decodeAcpCallback(bytes: Uint8Array): AcpCallback;
296
- export type AcpPermissionCallbackResponse = {
297
- readonly permissionId: string;
298
- readonly reply: string;
299
- };
300
- export declare function readAcpPermissionCallbackResponse(bc: bare.ByteCursor): AcpPermissionCallbackResponse;
301
- export declare function writeAcpPermissionCallbackResponse(bc: bare.ByteCursor, x: AcpPermissionCallbackResponse): void;
302
707
  export type AcpHostRequestCallbackResponse = {
303
708
  readonly response: JsonUtf8 | null;
304
709
  };
305
710
  export declare function readAcpHostRequestCallbackResponse(bc: bare.ByteCursor): AcpHostRequestCallbackResponse;
306
711
  export declare function writeAcpHostRequestCallbackResponse(bc: bare.ByteCursor, x: AcpHostRequestCallbackResponse): void;
307
712
  export type AcpCallbackResponse = {
308
- readonly tag: "AcpPermissionCallbackResponse";
309
- readonly val: AcpPermissionCallbackResponse;
310
- } | {
311
713
  readonly tag: "AcpHostRequestCallbackResponse";
312
714
  readonly val: AcpHostRequestCallbackResponse;
313
715
  };