@rivet-dev/agentos-core 0.2.8-rc.2 → 0.2.8-rc.4

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 (55) hide show
  1. package/README.md +40 -37
  2. package/dist/agent-os.d.ts +184 -230
  3. package/dist/agent-os.js +751 -1158
  4. package/dist/agentos-package.d.ts +5 -3
  5. package/dist/agentos-package.js +5 -2
  6. package/dist/{host-tools-zod.d.ts → bindings-zod.d.ts} +1 -1
  7. package/dist/{host-tools-zod.js → bindings-zod.js} +27 -20
  8. package/dist/bindings.d.ts +43 -0
  9. package/dist/bindings.js +34 -0
  10. package/dist/cron/cron-manager.js +43 -10
  11. package/dist/cron/index.d.ts +1 -1
  12. package/dist/cron/types.d.ts +25 -9
  13. package/dist/filesystem-snapshot.d.ts +1 -2
  14. package/dist/filesystem-snapshot.js +0 -43
  15. package/dist/generated/AcpLimitsConfig.d.ts +16 -0
  16. package/dist/generated/BindingLimitsConfig.d.ts +10 -0
  17. package/dist/generated/CreateVmConfig.d.ts +2 -0
  18. package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
  19. package/dist/generated/ProcessLimitsConfig.js +2 -0
  20. package/dist/generated/VmGroupConfig.d.ts +5 -0
  21. package/dist/generated/VmGroupConfig.js +2 -0
  22. package/dist/generated/VmLimitsConfig.d.ts +4 -2
  23. package/dist/generated/VmUserAccountConfig.d.ts +9 -0
  24. package/dist/generated/VmUserAccountConfig.js +2 -0
  25. package/dist/generated/VmUserConfig.d.ts +19 -0
  26. package/dist/generated/WasmLimitsConfig.d.ts +1 -0
  27. package/dist/index.d.ts +4 -5
  28. package/dist/index.js +4 -5
  29. package/dist/layers.d.ts +5 -2
  30. package/dist/layers.js +0 -185
  31. package/dist/options-schema.d.ts +133 -31
  32. package/dist/options-schema.js +143 -26
  33. package/dist/runtime-compat.d.ts +4 -35
  34. package/dist/runtime-compat.js +84 -372
  35. package/dist/runtime.d.ts +3 -1
  36. package/dist/sandbox.d.ts +4 -4
  37. package/dist/sandbox.js +4 -4
  38. package/dist/session-api.d.ts +180 -0
  39. package/dist/session-api.js +1 -0
  40. package/dist/sidecar/agentos-protocol.d.ts +429 -29
  41. package/dist/sidecar/agentos-protocol.js +691 -93
  42. package/dist/sidecar/rpc-client.d.ts +18 -6
  43. package/dist/sidecar/rpc-client.js +66 -18
  44. package/dist/test/runtime.d.ts +2 -1
  45. package/dist/test/runtime.js +2 -1
  46. package/dist/types.d.ts +4 -5
  47. package/package.json +28 -27
  48. package/dist/agent-session-types.d.ts +0 -67
  49. package/dist/generated/ToolLimitsConfig.d.ts +0 -10
  50. package/dist/host-tools.d.ts +0 -45
  51. package/dist/host-tools.js +0 -35
  52. package/dist/overlay-filesystem.d.ts +0 -19
  53. package/dist/overlay-filesystem.js +0 -645
  54. /package/dist/generated/{ToolLimitsConfig.js → BindingLimitsConfig.js} +0 -0
  55. /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
  };
@@ -76,6 +245,8 @@ export type AcpResumeSessionRequest = {
76
245
  readonly agentType: string;
77
246
  readonly transcriptPath: string | null;
78
247
  readonly cwd: string;
248
+ readonly additionalDirectories: readonly string[];
249
+ readonly mcpServers: JsonUtf8;
79
250
  readonly env: ReadonlyMap<string, string>;
80
251
  };
81
252
  export declare function readAcpResumeSessionRequest(bc: bare.ByteCursor): AcpResumeSessionRequest;
@@ -96,6 +267,45 @@ export type AcpDeliverAgentOutputRequest = {
96
267
  export declare function readAcpDeliverAgentOutputRequest(bc: bare.ByteCursor): AcpDeliverAgentOutputRequest;
97
268
  export declare function writeAcpDeliverAgentOutputRequest(bc: bare.ByteCursor, x: AcpDeliverAgentOutputRequest): void;
98
269
  export type AcpRequest = {
270
+ readonly tag: "AcpOpenSessionRequest";
271
+ readonly val: AcpOpenSessionRequest;
272
+ } | {
273
+ readonly tag: "AcpGetDurableSessionRequest";
274
+ readonly val: AcpGetDurableSessionRequest;
275
+ } | {
276
+ readonly tag: "AcpListDurableSessionsRequest";
277
+ readonly val: AcpListDurableSessionsRequest;
278
+ } | {
279
+ readonly tag: "AcpDeleteSessionRequest";
280
+ readonly val: AcpDeleteSessionRequest;
281
+ } | {
282
+ readonly tag: "AcpUnloadSessionRequest";
283
+ readonly val: AcpUnloadSessionRequest;
284
+ } | {
285
+ readonly tag: "AcpPromptRequest";
286
+ readonly val: AcpPromptRequest;
287
+ } | {
288
+ readonly tag: "AcpCancelPromptRequest";
289
+ readonly val: AcpCancelPromptRequest;
290
+ } | {
291
+ readonly tag: "AcpRespondPermissionRequest";
292
+ readonly val: AcpRespondPermissionRequest;
293
+ } | {
294
+ readonly tag: "AcpReadHistoryRequest";
295
+ readonly val: AcpReadHistoryRequest;
296
+ } | {
297
+ readonly tag: "AcpGetSessionConfigRequest";
298
+ readonly val: AcpGetSessionConfigRequest;
299
+ } | {
300
+ readonly tag: "AcpSetSessionConfigOptionRequest";
301
+ readonly val: AcpSetSessionConfigOptionRequest;
302
+ } | {
303
+ readonly tag: "AcpGetSessionCapabilitiesRequest";
304
+ readonly val: AcpGetSessionCapabilitiesRequest;
305
+ } | {
306
+ readonly tag: "AcpGetSessionAgentInfoRequest";
307
+ readonly val: AcpGetSessionAgentInfoRequest;
308
+ } | {
99
309
  readonly tag: "AcpCreateSessionRequest";
100
310
  readonly val: AcpCreateSessionRequest;
101
311
  } | {
@@ -121,6 +331,140 @@ export declare function readAcpRequest(bc: bare.ByteCursor): AcpRequest;
121
331
  export declare function writeAcpRequest(bc: bare.ByteCursor, x: AcpRequest): void;
122
332
  export declare function encodeAcpRequest(x: AcpRequest, config?: Partial<bare.Config>): Uint8Array;
123
333
  export declare function decodeAcpRequest(bytes: Uint8Array): AcpRequest;
334
+ export type AcpDurableSessionInfo = {
335
+ readonly sessionId: string;
336
+ readonly agent: string;
337
+ readonly cwd: string;
338
+ readonly additionalDirectories: JsonUtf8;
339
+ readonly state: JsonUtf8;
340
+ readonly latestSequence: u64;
341
+ readonly title: string | null;
342
+ readonly metadata: JsonUtf8 | null;
343
+ readonly createdAt: string;
344
+ readonly updatedAt: string;
345
+ };
346
+ export declare function readAcpDurableSessionInfo(bc: bare.ByteCursor): AcpDurableSessionInfo;
347
+ export declare function writeAcpDurableSessionInfo(bc: bare.ByteCursor, x: AcpDurableSessionInfo): void;
348
+ export type AcpOpenSessionResponse = {
349
+ readonly reserved: boolean;
350
+ };
351
+ export declare function readAcpOpenSessionResponse(bc: bare.ByteCursor): AcpOpenSessionResponse;
352
+ export declare function writeAcpOpenSessionResponse(bc: bare.ByteCursor, x: AcpOpenSessionResponse): void;
353
+ export type AcpGetDurableSessionResponse = {
354
+ readonly session: AcpDurableSessionInfo;
355
+ };
356
+ export declare function readAcpGetDurableSessionResponse(bc: bare.ByteCursor): AcpGetDurableSessionResponse;
357
+ export declare function writeAcpGetDurableSessionResponse(bc: bare.ByteCursor, x: AcpGetDurableSessionResponse): void;
358
+ export type AcpListDurableSessionsResponse = {
359
+ readonly sessions: readonly AcpDurableSessionInfo[];
360
+ readonly nextCursor: string | null;
361
+ };
362
+ export declare function readAcpListDurableSessionsResponse(bc: bare.ByteCursor): AcpListDurableSessionsResponse;
363
+ export declare function writeAcpListDurableSessionsResponse(bc: bare.ByteCursor, x: AcpListDurableSessionsResponse): void;
364
+ export type AcpDeleteSessionResponse = {
365
+ readonly reserved: boolean;
366
+ };
367
+ export declare function readAcpDeleteSessionResponse(bc: bare.ByteCursor): AcpDeleteSessionResponse;
368
+ export declare function writeAcpDeleteSessionResponse(bc: bare.ByteCursor, x: AcpDeleteSessionResponse): void;
369
+ export type AcpUnloadSessionResponse = {
370
+ readonly reserved: boolean;
371
+ };
372
+ export declare function readAcpUnloadSessionResponse(bc: bare.ByteCursor): AcpUnloadSessionResponse;
373
+ export declare function writeAcpUnloadSessionResponse(bc: bare.ByteCursor, x: AcpUnloadSessionResponse): void;
374
+ export type AcpPromptResponse = {
375
+ readonly sessionId: string;
376
+ readonly message: JsonUtf8 | null;
377
+ readonly stopReason: string;
378
+ };
379
+ export declare function readAcpPromptResponse(bc: bare.ByteCursor): AcpPromptResponse;
380
+ export declare function writeAcpPromptResponse(bc: bare.ByteCursor, x: AcpPromptResponse): void;
381
+ export type AcpCancelPromptResponse = {
382
+ readonly status: string;
383
+ };
384
+ export declare function readAcpCancelPromptResponse(bc: bare.ByteCursor): AcpCancelPromptResponse;
385
+ export declare function writeAcpCancelPromptResponse(bc: bare.ByteCursor, x: AcpCancelPromptResponse): void;
386
+ export type AcpRespondPermissionResponse = {
387
+ readonly status: string;
388
+ readonly reason: string | null;
389
+ };
390
+ export declare function readAcpRespondPermissionResponse(bc: bare.ByteCursor): AcpRespondPermissionResponse;
391
+ export declare function writeAcpRespondPermissionResponse(bc: bare.ByteCursor, x: AcpRespondPermissionResponse): void;
392
+ /**
393
+ * The generic internal wire/storage union. Native payloads retain their
394
+ * negotiated ACP field names, optional values, and opaque _meta. Public clients
395
+ * flatten SessionUpdate.sessionUpdate into top-level type and flatten permission
396
+ * request/response fields beside the durability envelope; they do not expose
397
+ * these internal update/request/response wrappers. Native adapter request IDs
398
+ * and private ACP session IDs never enter the public union. Automatically
399
+ * resolved permission requests are never persisted or emitted. An ask request
400
+ * has no permission timeout: the active prompt remains awake until a response
401
+ * or explicit adapter/session/VM lifecycle transition wins.
402
+ */
403
+ export type AcpDurableSessionUpdate = {
404
+ readonly update: JsonUtf8;
405
+ };
406
+ export declare function readAcpDurableSessionUpdate(bc: bare.ByteCursor): AcpDurableSessionUpdate;
407
+ export declare function writeAcpDurableSessionUpdate(bc: bare.ByteCursor, x: AcpDurableSessionUpdate): void;
408
+ export type AcpDurablePermissionRequest = {
409
+ readonly requestId: string;
410
+ readonly request: JsonUtf8;
411
+ };
412
+ export declare function readAcpDurablePermissionRequest(bc: bare.ByteCursor): AcpDurablePermissionRequest;
413
+ export declare function writeAcpDurablePermissionRequest(bc: bare.ByteCursor, x: AcpDurablePermissionRequest): void;
414
+ export type AcpDurablePermissionResponse = {
415
+ readonly requestId: string;
416
+ readonly response: JsonUtf8;
417
+ readonly status: string;
418
+ readonly reason: string | null;
419
+ };
420
+ export declare function readAcpDurablePermissionResponse(bc: bare.ByteCursor): AcpDurablePermissionResponse;
421
+ export declare function writeAcpDurablePermissionResponse(bc: bare.ByteCursor, x: AcpDurablePermissionResponse): void;
422
+ export type AcpDurableEvent = {
423
+ readonly tag: "AcpDurableSessionUpdate";
424
+ readonly val: AcpDurableSessionUpdate;
425
+ } | {
426
+ readonly tag: "AcpDurablePermissionRequest";
427
+ readonly val: AcpDurablePermissionRequest;
428
+ } | {
429
+ readonly tag: "AcpDurablePermissionResponse";
430
+ readonly val: AcpDurablePermissionResponse;
431
+ };
432
+ export declare function readAcpDurableEvent(bc: bare.ByteCursor): AcpDurableEvent;
433
+ export declare function writeAcpDurableEvent(bc: bare.ByteCursor, x: AcpDurableEvent): void;
434
+ /**
435
+ * AgentOS adds only this public identity, sequence, and timestamp envelope.
436
+ */
437
+ export type AcpDurableHistoryEntry = {
438
+ readonly sessionId: string;
439
+ readonly sequence: u64;
440
+ readonly timestamp: string;
441
+ readonly event: AcpDurableEvent;
442
+ };
443
+ export declare function readAcpDurableHistoryEntry(bc: bare.ByteCursor): AcpDurableHistoryEntry;
444
+ export declare function writeAcpDurableHistoryEntry(bc: bare.ByteCursor, x: AcpDurableHistoryEntry): void;
445
+ export type AcpHistoryPageResponse = {
446
+ readonly events: readonly AcpDurableHistoryEntry[];
447
+ readonly hasMoreBefore: boolean;
448
+ readonly hasMoreAfter: boolean;
449
+ };
450
+ export declare function readAcpHistoryPageResponse(bc: bare.ByteCursor): AcpHistoryPageResponse;
451
+ export declare function writeAcpHistoryPageResponse(bc: bare.ByteCursor, x: AcpHistoryPageResponse): void;
452
+ export type AcpSessionConfigResponse = {
453
+ readonly revision: u64;
454
+ readonly options: JsonUtf8;
455
+ };
456
+ export declare function readAcpSessionConfigResponse(bc: bare.ByteCursor): AcpSessionConfigResponse;
457
+ export declare function writeAcpSessionConfigResponse(bc: bare.ByteCursor, x: AcpSessionConfigResponse): void;
458
+ export type AcpSessionCapabilitiesResponse = {
459
+ readonly capabilities: JsonUtf8 | null;
460
+ };
461
+ export declare function readAcpSessionCapabilitiesResponse(bc: bare.ByteCursor): AcpSessionCapabilitiesResponse;
462
+ export declare function writeAcpSessionCapabilitiesResponse(bc: bare.ByteCursor, x: AcpSessionCapabilitiesResponse): void;
463
+ export type AcpSessionAgentInfoResponse = {
464
+ readonly agentInfo: JsonUtf8 | null;
465
+ };
466
+ export declare function readAcpSessionAgentInfoResponse(bc: bare.ByteCursor): AcpSessionAgentInfoResponse;
467
+ export declare function writeAcpSessionAgentInfoResponse(bc: bare.ByteCursor, x: AcpSessionAgentInfoResponse): void;
124
468
  export type AcpSessionCreatedResponse = {
125
469
  readonly sessionId: string;
126
470
  readonly pid: u32 | null;
@@ -134,6 +478,12 @@ export declare function writeAcpSessionCreatedResponse(bc: bare.ByteCursor, x: A
134
478
  export type AcpSessionRpcResponse = {
135
479
  readonly sessionId: string;
136
480
  readonly response: JsonUtf8;
481
+ /**
482
+ * Number of request-scoped AcpSessionEvent frames emitted before this
483
+ * terminal response. Clients use this as an event-delivery barrier because
484
+ * response and event frames travel on separate priority lanes.
485
+ */
486
+ readonly eventCount: u32;
137
487
  };
138
488
  export declare function readAcpSessionRpcResponse(bc: bare.ByteCursor): AcpSessionRpcResponse;
139
489
  export declare function writeAcpSessionRpcResponse(bc: bare.ByteCursor, x: AcpSessionRpcResponse): void;
@@ -188,6 +538,42 @@ export type AcpPendingResponse = {
188
538
  export declare function readAcpPendingResponse(bc: bare.ByteCursor): AcpPendingResponse;
189
539
  export declare function writeAcpPendingResponse(bc: bare.ByteCursor, x: AcpPendingResponse): void;
190
540
  export type AcpResponse = {
541
+ readonly tag: "AcpOpenSessionResponse";
542
+ readonly val: AcpOpenSessionResponse;
543
+ } | {
544
+ readonly tag: "AcpGetDurableSessionResponse";
545
+ readonly val: AcpGetDurableSessionResponse;
546
+ } | {
547
+ readonly tag: "AcpListDurableSessionsResponse";
548
+ readonly val: AcpListDurableSessionsResponse;
549
+ } | {
550
+ readonly tag: "AcpDeleteSessionResponse";
551
+ readonly val: AcpDeleteSessionResponse;
552
+ } | {
553
+ readonly tag: "AcpUnloadSessionResponse";
554
+ readonly val: AcpUnloadSessionResponse;
555
+ } | {
556
+ readonly tag: "AcpPromptResponse";
557
+ readonly val: AcpPromptResponse;
558
+ } | {
559
+ readonly tag: "AcpCancelPromptResponse";
560
+ readonly val: AcpCancelPromptResponse;
561
+ } | {
562
+ readonly tag: "AcpRespondPermissionResponse";
563
+ readonly val: AcpRespondPermissionResponse;
564
+ } | {
565
+ readonly tag: "AcpHistoryPageResponse";
566
+ readonly val: AcpHistoryPageResponse;
567
+ } | {
568
+ readonly tag: "AcpSessionConfigResponse";
569
+ readonly val: AcpSessionConfigResponse;
570
+ } | {
571
+ readonly tag: "AcpSessionCapabilitiesResponse";
572
+ readonly val: AcpSessionCapabilitiesResponse;
573
+ } | {
574
+ readonly tag: "AcpSessionAgentInfoResponse";
575
+ readonly val: AcpSessionAgentInfoResponse;
576
+ } | {
191
577
  readonly tag: "AcpSessionCreatedResponse";
192
578
  readonly val: AcpSessionCreatedResponse;
193
579
  } | {
@@ -216,6 +602,35 @@ export declare function readAcpResponse(bc: bare.ByteCursor): AcpResponse;
216
602
  export declare function writeAcpResponse(bc: bare.ByteCursor, x: AcpResponse): void;
217
603
  export declare function encodeAcpResponse(x: AcpResponse, config?: Partial<bare.Config>): Uint8Array;
218
604
  export declare function decodeAcpResponse(bytes: Uint8Array): AcpResponse;
605
+ /**
606
+ * Live delivery uses the identical durable union/history envelope. Consumers
607
+ * reconnect by subscribing, fetching after their last sequence, then
608
+ * deduplicating by (sessionId, sequence); there is no second replay protocol.
609
+ */
610
+ export type AcpDurableSessionEvent = {
611
+ readonly sessionId: string;
612
+ readonly sequence: u64;
613
+ readonly timestamp: string;
614
+ readonly event: AcpDurableEvent;
615
+ };
616
+ export declare function readAcpDurableSessionEvent(bc: bare.ByteCursor): AcpDurableSessionEvent;
617
+ export declare function writeAcpDurableSessionEvent(bc: bare.ByteCursor, x: AcpDurableSessionEvent): void;
618
+ /**
619
+ * Ephemeral entries are live-only ACP agent_message_chunk or
620
+ * agent_thought_chunk updates. They are never persisted or sequenced; the
621
+ * durable completed message is authoritative after reconnect.
622
+ */
623
+ export type AcpEphemeralSessionUpdateEvent = {
624
+ readonly sessionId: string;
625
+ readonly afterSequence: u64;
626
+ readonly update: JsonUtf8;
627
+ };
628
+ export declare function readAcpEphemeralSessionUpdateEvent(bc: bare.ByteCursor): AcpEphemeralSessionUpdateEvent;
629
+ export declare function writeAcpEphemeralSessionUpdateEvent(bc: bare.ByteCursor, x: AcpEphemeralSessionUpdateEvent): void;
630
+ /**
631
+ * Legacy browser-reference live event. Native durable clients ignore it and
632
+ * consume AcpDurableSessionEvent/AcpEphemeralSessionUpdateEvent instead.
633
+ */
219
634
  export type AcpSessionEvent = {
220
635
  readonly sessionId: string;
221
636
  readonly notification: JsonUtf8;
@@ -231,23 +646,21 @@ export type AcpAgentStderrEvent = {
231
646
  export declare function readAcpAgentStderrEvent(bc: bare.ByteCursor): AcpAgentStderrEvent;
232
647
  export declare function writeAcpAgentStderrEvent(bc: bare.ByteCursor, x: AcpAgentStderrEvent): void;
233
648
  /**
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.
649
+ * Emitted when the ACP adapter process exits unexpectedly — a crash from the
650
+ * host's perspective (any spontaneous exit, including code 0).
651
+ * `restart` is "not_attempted": the sidecar never respawns an adapter or
652
+ * replays an interrupted request implicitly. `restartCount` and `maxRestarts`
653
+ * are therefore both zero. Explicit session restoration is a separate caller
654
+ * operation.
244
655
  * `exitCode` is absent when the exit was observed indirectly (e.g. a write to
245
656
  * the adapter's stdin failed because the process was already gone).
657
+ * `pid` is the host pid reported when the adapter process was launched.
246
658
  */
247
659
  export type AcpAgentExitedEvent = {
248
660
  readonly sessionId: string;
249
661
  readonly agentType: string;
250
662
  readonly processId: string;
663
+ readonly pid: u32 | null;
251
664
  readonly exitCode: i32 | null;
252
665
  readonly restart: string;
253
666
  readonly restartCount: u32;
@@ -256,6 +669,12 @@ export type AcpAgentExitedEvent = {
256
669
  export declare function readAcpAgentExitedEvent(bc: bare.ByteCursor): AcpAgentExitedEvent;
257
670
  export declare function writeAcpAgentExitedEvent(bc: bare.ByteCursor, x: AcpAgentExitedEvent): void;
258
671
  export type AcpEvent = {
672
+ readonly tag: "AcpDurableSessionEvent";
673
+ readonly val: AcpDurableSessionEvent;
674
+ } | {
675
+ readonly tag: "AcpEphemeralSessionUpdateEvent";
676
+ readonly val: AcpEphemeralSessionUpdateEvent;
677
+ } | {
259
678
  readonly tag: "AcpSessionEvent";
260
679
  readonly val: AcpSessionEvent;
261
680
  } | {
@@ -269,13 +688,6 @@ export declare function readAcpEvent(bc: bare.ByteCursor): AcpEvent;
269
688
  export declare function writeAcpEvent(bc: bare.ByteCursor, x: AcpEvent): void;
270
689
  export declare function encodeAcpEvent(x: AcpEvent, config?: Partial<bare.Config>): Uint8Array;
271
690
  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
691
  export type AcpHostRequestCallback = {
280
692
  readonly sessionId: string;
281
693
  readonly request: JsonUtf8;
@@ -283,9 +695,6 @@ export type AcpHostRequestCallback = {
283
695
  export declare function readAcpHostRequestCallback(bc: bare.ByteCursor): AcpHostRequestCallback;
284
696
  export declare function writeAcpHostRequestCallback(bc: bare.ByteCursor, x: AcpHostRequestCallback): void;
285
697
  export type AcpCallback = {
286
- readonly tag: "AcpPermissionCallback";
287
- readonly val: AcpPermissionCallback;
288
- } | {
289
698
  readonly tag: "AcpHostRequestCallback";
290
699
  readonly val: AcpHostRequestCallback;
291
700
  };
@@ -293,21 +702,12 @@ export declare function readAcpCallback(bc: bare.ByteCursor): AcpCallback;
293
702
  export declare function writeAcpCallback(bc: bare.ByteCursor, x: AcpCallback): void;
294
703
  export declare function encodeAcpCallback(x: AcpCallback, config?: Partial<bare.Config>): Uint8Array;
295
704
  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
705
  export type AcpHostRequestCallbackResponse = {
303
706
  readonly response: JsonUtf8 | null;
304
707
  };
305
708
  export declare function readAcpHostRequestCallbackResponse(bc: bare.ByteCursor): AcpHostRequestCallbackResponse;
306
709
  export declare function writeAcpHostRequestCallbackResponse(bc: bare.ByteCursor, x: AcpHostRequestCallbackResponse): void;
307
710
  export type AcpCallbackResponse = {
308
- readonly tag: "AcpPermissionCallbackResponse";
309
- readonly val: AcpPermissionCallbackResponse;
310
- } | {
311
711
  readonly tag: "AcpHostRequestCallbackResponse";
312
712
  readonly val: AcpHostRequestCallbackResponse;
313
713
  };