@rivet-dev/agentos-core 0.0.0-codex-actor-plugin-contract-coverage.c7d8f87 → 0.0.0-fix-main-wasm-ownership.150c49a

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 (58) hide show
  1. package/README.md +39 -36
  2. package/dist/agent-os.d.ts +197 -232
  3. package/dist/agent-os.js +769 -1162
  4. package/dist/agentos-package.d.ts +4 -2
  5. package/dist/agentos-package.js +4 -1
  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 +134 -31
  32. package/dist/options-schema.js +144 -26
  33. package/dist/runtime-compat.d.ts +11 -37
  34. package/dist/runtime-compat.js +74 -374
  35. package/dist/runtime.d.ts +10 -3
  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 +420 -29
  41. package/dist/sidecar/agentos-protocol.js +683 -93
  42. package/dist/sidecar/native-process-client.d.ts +1 -1
  43. package/dist/sidecar/native-process-client.js +1 -1
  44. package/dist/sidecar/rpc-client.d.ts +39 -6
  45. package/dist/sidecar/rpc-client.js +111 -30
  46. package/dist/test/runtime.d.ts +2 -1
  47. package/dist/test/runtime.js +2 -1
  48. package/dist/test/terminal-harness.js +0 -3
  49. package/dist/types.d.ts +4 -5
  50. package/package.json +19 -17
  51. package/dist/agent-session-types.d.ts +0 -67
  52. package/dist/generated/ToolLimitsConfig.d.ts +0 -10
  53. package/dist/host-tools.d.ts +0 -45
  54. package/dist/host-tools.js +0 -35
  55. package/dist/overlay-filesystem.d.ts +0 -19
  56. package/dist/overlay-filesystem.js +0 -645
  57. /package/dist/generated/{ToolLimitsConfig.js → BindingLimitsConfig.js} +0 -0
  58. /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,6 +12,13 @@ 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;
@@ -53,6 +61,166 @@ export type AcpListAgentsResponse = {
53
61
  };
54
62
  export declare function readAcpListAgentsResponse(bc: bare.ByteCursor): AcpListAgentsResponse;
55
63
  export declare function writeAcpListAgentsResponse(bc: bare.ByteCursor, x: AcpListAgentsResponse): void;
64
+ /**
65
+ * `openSession` is idempotent. Opening an existing durable ID restores its
66
+ * adapter when unloaded; getSession/listSessions remain the storage-only ways to
67
+ * inspect it without starting an adapter. The sidecar owns ACP session/new versus
68
+ * native resume/load selection and returns only after negotiation has populated
69
+ * the cached configuration/capability/agent-info fields. Omitted cwd resolves to
70
+ * `/home/agentos` in the sidecar. Restoration reapplies the original cwd,
71
+ * additionalDirectories, env, exact native ACP McpServer values, instruction
72
+ * settings, and current configuration values. The response is intentionally
73
+ * empty: the caller owns the requested public ID (or the documented `main`
74
+ * default), and getSession is the only API that returns durable metadata.
75
+ * permissionPolicy is an immutable AgentOS-side strategy for resolving native
76
+ * ACP session/request_permission calls: allow_all (the default) selects an
77
+ * adapter-provided allow option, reject_all selects a reject option or returns a
78
+ * typed permission_policy_unsatisfied error when none is offered,
79
+ * and ask durably exposes the adapter's exact options for a caller response. It
80
+ * does not change VM permissions and is not sent to the ACP adapter as config.
81
+ */
82
+ export type AcpOpenSessionRequest = {
83
+ readonly sessionId: string | null;
84
+ readonly agent: string;
85
+ readonly cwd: string | null;
86
+ readonly additionalDirectories: JsonUtf8 | null;
87
+ readonly env: JsonUtf8 | null;
88
+ readonly mcpServers: JsonUtf8 | null;
89
+ readonly permissionPolicy: string | null;
90
+ readonly skipOsInstructions: boolean | null;
91
+ readonly additionalInstructions: string | null;
92
+ };
93
+ export declare function readAcpOpenSessionRequest(bc: bare.ByteCursor): AcpOpenSessionRequest;
94
+ export declare function writeAcpOpenSessionRequest(bc: bare.ByteCursor, x: AcpOpenSessionRequest): void;
95
+ /**
96
+ * This lookup never starts, restores, or queries an ACP adapter.
97
+ */
98
+ export type AcpGetDurableSessionRequest = {
99
+ readonly sessionId: string | null;
100
+ };
101
+ export declare function readAcpGetDurableSessionRequest(bc: bare.ByteCursor): AcpGetDurableSessionRequest;
102
+ export declare function writeAcpGetDurableSessionRequest(bc: bare.ByteCursor, x: AcpGetDurableSessionRequest): void;
103
+ /**
104
+ * Listing is an ordinary updatedAt/sessionId keyset traversal. It never starts,
105
+ * restores, or queries an ACP adapter. It deliberately does not freeze a database
106
+ * snapshot across pages: a session updated between page requests can move in the
107
+ * ordering, which keeps cursors simple and avoids a snapshot registry.
108
+ */
109
+ export type AcpListDurableSessionsRequest = {
110
+ readonly cursor: string | null;
111
+ readonly limit: u32 | null;
112
+ };
113
+ export declare function readAcpListDurableSessionsRequest(bc: bare.ByteCursor): AcpListDurableSessionsRequest;
114
+ export declare function writeAcpListDurableSessionsRequest(bc: bare.ByteCursor, x: AcpListDurableSessionsRequest): void;
115
+ /**
116
+ * Deletion is naturally idempotent by its target ID. It permanently
117
+ * removes durable metadata and history after orderly runtime teardown.
118
+ */
119
+ export type AcpDeleteSessionRequest = {
120
+ readonly sessionId: string | null;
121
+ };
122
+ export declare function readAcpDeleteSessionRequest(bc: bare.ByteCursor): AcpDeleteSessionRequest;
123
+ export declare function writeAcpDeleteSessionRequest(bc: bare.ByteCursor, x: AcpDeleteSessionRequest): void;
124
+ /**
125
+ * Unload cancels active work and releases the adapter but preserves the durable
126
+ * session and all history. A later prompt transparently restores it.
127
+ */
128
+ export type AcpUnloadSessionRequest = {
129
+ readonly sessionId: string | null;
130
+ };
131
+ export declare function readAcpUnloadSessionRequest(bc: bare.ByteCursor): AcpUnloadSessionRequest;
132
+ export declare function writeAcpUnloadSessionRequest(bc: bare.ByteCursor, x: AcpUnloadSessionRequest): void;
133
+ /**
134
+ * Prompt never creates a missing session. It transparently restores an unloaded
135
+ * adapter, durably accepts input before dispatch, blocks through the turn, and
136
+ * never automatically replays a prompt whose delivery became uncertain. The
137
+ * sidecar imposes no absolute session/prompt deadline: long turns and ask-policy
138
+ * permission waits remain active while the actor keep-awake scope is held.
139
+ */
140
+ export type AcpPromptRequest = {
141
+ readonly sessionId: string | null;
142
+ readonly idempotencyKey: string | null;
143
+ readonly content: JsonUtf8;
144
+ };
145
+ export declare function readAcpPromptRequest(bc: bare.ByteCursor): AcpPromptRequest;
146
+ export declare function writeAcpPromptRequest(bc: bare.ByteCursor, x: AcpPromptRequest): void;
147
+ /**
148
+ * Cancellation is first-writer-wins against prompt completion and returns its
149
+ * typed race outcome.
150
+ */
151
+ export type AcpCancelPromptRequest = {
152
+ readonly sessionId: string | null;
153
+ };
154
+ export declare function readAcpCancelPromptRequest(bc: bare.ByteCursor): AcpCancelPromptRequest;
155
+ export declare function writeAcpCancelPromptRequest(bc: bare.ByteCursor, x: AcpCancelPromptRequest): void;
156
+ /**
157
+ * Respond to a pending native ACP session/request_permission. sessionId is
158
+ * always the explicit caller-owned AgentOS identity; it never defaults to main.
159
+ * requestId is globally unique AgentOS-owned correlation and never contains the
160
+ * adapter JSON-RPC ID. optionId is one of the exact adapter-supplied ACP option
161
+ * identifiers. Resolution is first-writer-wins. accepted means the decision won
162
+ * that race and was delivered to the active ACP waiter, not that the tool ran.
163
+ * Invalid options are typed invalid_permission_option errors and do not consume
164
+ * the request. A terminal late response is non-throwing and names its reason.
165
+ */
166
+ export type AcpRespondPermissionRequest = {
167
+ readonly sessionId: string;
168
+ readonly requestId: string;
169
+ readonly optionId: string;
170
+ };
171
+ export declare function readAcpRespondPermissionRequest(bc: bare.ByteCursor): AcpRespondPermissionRequest;
172
+ export declare function writeAcpRespondPermissionRequest(bc: bare.ByteCursor, x: AcpRespondPermissionRequest): void;
173
+ /**
174
+ * History is SQLite-only and never starts, restores, or queries an adapter. It
175
+ * stores the generic durable event union below; nested wire payloads retain
176
+ * unknown extension metadata and clients mechanically expose them as one flat
177
+ * top-level type union. Agent message/thought deltas are emitted live as ephemeral entries;
178
+ * they enter durable history only when the message completes. Non-delta ACP
179
+ * updates interleaved during a message remain in native arrival order.
180
+ * before/after are exclusive and mutually exclusive. Cursor expiry is a typed
181
+ * error, never a silent skip. History retention and response pages are bounded
182
+ * by the VM's generous `limits.acp.*` settings; retention prunes oldest events.
183
+ * Durable sequence values can repeat on live delivery because observers
184
+ * deduplicate by (sessionId, sequence).
185
+ */
186
+ export type AcpReadHistoryRequest = {
187
+ readonly sessionId: string | null;
188
+ readonly before: u64 | null;
189
+ readonly after: u64 | null;
190
+ readonly limit: u32 | null;
191
+ };
192
+ export declare function readAcpReadHistoryRequest(bc: bare.ByteCursor): AcpReadHistoryRequest;
193
+ export declare function writeAcpReadHistoryRequest(bc: bare.ByteCursor, x: AcpReadHistoryRequest): void;
194
+ /**
195
+ * Cached getters never start, restore, or query an adapter.
196
+ */
197
+ export type AcpGetSessionConfigRequest = {
198
+ readonly sessionId: string | null;
199
+ };
200
+ export declare function readAcpGetSessionConfigRequest(bc: bare.ByteCursor): AcpGetSessionConfigRequest;
201
+ export declare function writeAcpGetSessionConfigRequest(bc: bare.ByteCursor, x: AcpGetSessionConfigRequest): void;
202
+ export type AcpGetSessionCapabilitiesRequest = {
203
+ readonly sessionId: string | null;
204
+ };
205
+ export declare function readAcpGetSessionCapabilitiesRequest(bc: bare.ByteCursor): AcpGetSessionCapabilitiesRequest;
206
+ export declare function writeAcpGetSessionCapabilitiesRequest(bc: bare.ByteCursor, x: AcpGetSessionCapabilitiesRequest): void;
207
+ export type AcpGetSessionAgentInfoRequest = {
208
+ readonly sessionId: string | null;
209
+ };
210
+ export declare function readAcpGetSessionAgentInfoRequest(bc: bare.ByteCursor): AcpGetSessionAgentInfoRequest;
211
+ export declare function writeAcpGetSessionAgentInfoRequest(bc: bare.ByteCursor, x: AcpGetSessionAgentInfoRequest): void;
212
+ /**
213
+ * Setting configuration may transparently restore the adapter; ACP owns
214
+ * validation and the response replaces the complete cached option collection.
215
+ * `value` encodes exactly one native ACP string or boolean config value.
216
+ */
217
+ export type AcpSetSessionConfigOptionRequest = {
218
+ readonly sessionId: string | null;
219
+ readonly configId: string;
220
+ readonly value: JsonUtf8;
221
+ };
222
+ export declare function readAcpSetSessionConfigOptionRequest(bc: bare.ByteCursor): AcpSetSessionConfigOptionRequest;
223
+ export declare function writeAcpSetSessionConfigOptionRequest(bc: bare.ByteCursor, x: AcpSetSessionConfigOptionRequest): void;
56
224
  export type AcpGetSessionStateRequest = {
57
225
  readonly sessionId: string;
58
226
  };
@@ -96,6 +264,45 @@ export type AcpDeliverAgentOutputRequest = {
96
264
  export declare function readAcpDeliverAgentOutputRequest(bc: bare.ByteCursor): AcpDeliverAgentOutputRequest;
97
265
  export declare function writeAcpDeliverAgentOutputRequest(bc: bare.ByteCursor, x: AcpDeliverAgentOutputRequest): void;
98
266
  export type AcpRequest = {
267
+ readonly tag: "AcpOpenSessionRequest";
268
+ readonly val: AcpOpenSessionRequest;
269
+ } | {
270
+ readonly tag: "AcpGetDurableSessionRequest";
271
+ readonly val: AcpGetDurableSessionRequest;
272
+ } | {
273
+ readonly tag: "AcpListDurableSessionsRequest";
274
+ readonly val: AcpListDurableSessionsRequest;
275
+ } | {
276
+ readonly tag: "AcpDeleteSessionRequest";
277
+ readonly val: AcpDeleteSessionRequest;
278
+ } | {
279
+ readonly tag: "AcpUnloadSessionRequest";
280
+ readonly val: AcpUnloadSessionRequest;
281
+ } | {
282
+ readonly tag: "AcpPromptRequest";
283
+ readonly val: AcpPromptRequest;
284
+ } | {
285
+ readonly tag: "AcpCancelPromptRequest";
286
+ readonly val: AcpCancelPromptRequest;
287
+ } | {
288
+ readonly tag: "AcpRespondPermissionRequest";
289
+ readonly val: AcpRespondPermissionRequest;
290
+ } | {
291
+ readonly tag: "AcpReadHistoryRequest";
292
+ readonly val: AcpReadHistoryRequest;
293
+ } | {
294
+ readonly tag: "AcpGetSessionConfigRequest";
295
+ readonly val: AcpGetSessionConfigRequest;
296
+ } | {
297
+ readonly tag: "AcpSetSessionConfigOptionRequest";
298
+ readonly val: AcpSetSessionConfigOptionRequest;
299
+ } | {
300
+ readonly tag: "AcpGetSessionCapabilitiesRequest";
301
+ readonly val: AcpGetSessionCapabilitiesRequest;
302
+ } | {
303
+ readonly tag: "AcpGetSessionAgentInfoRequest";
304
+ readonly val: AcpGetSessionAgentInfoRequest;
305
+ } | {
99
306
  readonly tag: "AcpCreateSessionRequest";
100
307
  readonly val: AcpCreateSessionRequest;
101
308
  } | {
@@ -121,6 +328,140 @@ export declare function readAcpRequest(bc: bare.ByteCursor): AcpRequest;
121
328
  export declare function writeAcpRequest(bc: bare.ByteCursor, x: AcpRequest): void;
122
329
  export declare function encodeAcpRequest(x: AcpRequest, config?: Partial<bare.Config>): Uint8Array;
123
330
  export declare function decodeAcpRequest(bytes: Uint8Array): AcpRequest;
331
+ export type AcpDurableSessionInfo = {
332
+ readonly sessionId: string;
333
+ readonly agent: string;
334
+ readonly cwd: string;
335
+ readonly additionalDirectories: JsonUtf8;
336
+ readonly state: JsonUtf8;
337
+ readonly latestSequence: u64;
338
+ readonly title: string | null;
339
+ readonly metadata: JsonUtf8 | null;
340
+ readonly createdAt: string;
341
+ readonly updatedAt: string;
342
+ };
343
+ export declare function readAcpDurableSessionInfo(bc: bare.ByteCursor): AcpDurableSessionInfo;
344
+ export declare function writeAcpDurableSessionInfo(bc: bare.ByteCursor, x: AcpDurableSessionInfo): void;
345
+ export type AcpOpenSessionResponse = {
346
+ readonly reserved: boolean;
347
+ };
348
+ export declare function readAcpOpenSessionResponse(bc: bare.ByteCursor): AcpOpenSessionResponse;
349
+ export declare function writeAcpOpenSessionResponse(bc: bare.ByteCursor, x: AcpOpenSessionResponse): void;
350
+ export type AcpGetDurableSessionResponse = {
351
+ readonly session: AcpDurableSessionInfo;
352
+ };
353
+ export declare function readAcpGetDurableSessionResponse(bc: bare.ByteCursor): AcpGetDurableSessionResponse;
354
+ export declare function writeAcpGetDurableSessionResponse(bc: bare.ByteCursor, x: AcpGetDurableSessionResponse): void;
355
+ export type AcpListDurableSessionsResponse = {
356
+ readonly sessions: readonly AcpDurableSessionInfo[];
357
+ readonly nextCursor: string | null;
358
+ };
359
+ export declare function readAcpListDurableSessionsResponse(bc: bare.ByteCursor): AcpListDurableSessionsResponse;
360
+ export declare function writeAcpListDurableSessionsResponse(bc: bare.ByteCursor, x: AcpListDurableSessionsResponse): void;
361
+ export type AcpDeleteSessionResponse = {
362
+ readonly reserved: boolean;
363
+ };
364
+ export declare function readAcpDeleteSessionResponse(bc: bare.ByteCursor): AcpDeleteSessionResponse;
365
+ export declare function writeAcpDeleteSessionResponse(bc: bare.ByteCursor, x: AcpDeleteSessionResponse): void;
366
+ export type AcpUnloadSessionResponse = {
367
+ readonly reserved: boolean;
368
+ };
369
+ export declare function readAcpUnloadSessionResponse(bc: bare.ByteCursor): AcpUnloadSessionResponse;
370
+ export declare function writeAcpUnloadSessionResponse(bc: bare.ByteCursor, x: AcpUnloadSessionResponse): void;
371
+ export type AcpPromptResponse = {
372
+ readonly sessionId: string;
373
+ readonly message: JsonUtf8 | null;
374
+ readonly stopReason: string;
375
+ };
376
+ export declare function readAcpPromptResponse(bc: bare.ByteCursor): AcpPromptResponse;
377
+ export declare function writeAcpPromptResponse(bc: bare.ByteCursor, x: AcpPromptResponse): void;
378
+ export type AcpCancelPromptResponse = {
379
+ readonly status: string;
380
+ };
381
+ export declare function readAcpCancelPromptResponse(bc: bare.ByteCursor): AcpCancelPromptResponse;
382
+ export declare function writeAcpCancelPromptResponse(bc: bare.ByteCursor, x: AcpCancelPromptResponse): void;
383
+ export type AcpRespondPermissionResponse = {
384
+ readonly status: string;
385
+ readonly reason: string | null;
386
+ };
387
+ export declare function readAcpRespondPermissionResponse(bc: bare.ByteCursor): AcpRespondPermissionResponse;
388
+ export declare function writeAcpRespondPermissionResponse(bc: bare.ByteCursor, x: AcpRespondPermissionResponse): void;
389
+ /**
390
+ * The generic internal wire/storage union. Native payloads retain their
391
+ * negotiated ACP field names, optional values, and opaque _meta. Public clients
392
+ * flatten SessionUpdate.sessionUpdate into top-level type and flatten permission
393
+ * request/response fields beside the durability envelope; they do not expose
394
+ * these internal update/request/response wrappers. Native adapter request IDs
395
+ * and private ACP session IDs never enter the public union. Automatically
396
+ * resolved permission requests are never persisted or emitted. An ask request
397
+ * has no permission timeout: the active prompt remains awake until a response
398
+ * or explicit adapter/session/VM lifecycle transition wins.
399
+ */
400
+ export type AcpDurableSessionUpdate = {
401
+ readonly update: JsonUtf8;
402
+ };
403
+ export declare function readAcpDurableSessionUpdate(bc: bare.ByteCursor): AcpDurableSessionUpdate;
404
+ export declare function writeAcpDurableSessionUpdate(bc: bare.ByteCursor, x: AcpDurableSessionUpdate): void;
405
+ export type AcpDurablePermissionRequest = {
406
+ readonly requestId: string;
407
+ readonly request: JsonUtf8;
408
+ };
409
+ export declare function readAcpDurablePermissionRequest(bc: bare.ByteCursor): AcpDurablePermissionRequest;
410
+ export declare function writeAcpDurablePermissionRequest(bc: bare.ByteCursor, x: AcpDurablePermissionRequest): void;
411
+ export type AcpDurablePermissionResponse = {
412
+ readonly requestId: string;
413
+ readonly response: JsonUtf8;
414
+ readonly status: string;
415
+ readonly reason: string | null;
416
+ };
417
+ export declare function readAcpDurablePermissionResponse(bc: bare.ByteCursor): AcpDurablePermissionResponse;
418
+ export declare function writeAcpDurablePermissionResponse(bc: bare.ByteCursor, x: AcpDurablePermissionResponse): void;
419
+ export type AcpDurableEvent = {
420
+ readonly tag: "AcpDurableSessionUpdate";
421
+ readonly val: AcpDurableSessionUpdate;
422
+ } | {
423
+ readonly tag: "AcpDurablePermissionRequest";
424
+ readonly val: AcpDurablePermissionRequest;
425
+ } | {
426
+ readonly tag: "AcpDurablePermissionResponse";
427
+ readonly val: AcpDurablePermissionResponse;
428
+ };
429
+ export declare function readAcpDurableEvent(bc: bare.ByteCursor): AcpDurableEvent;
430
+ export declare function writeAcpDurableEvent(bc: bare.ByteCursor, x: AcpDurableEvent): void;
431
+ /**
432
+ * AgentOS adds only this public identity, sequence, and timestamp envelope.
433
+ */
434
+ export type AcpDurableHistoryEntry = {
435
+ readonly sessionId: string;
436
+ readonly sequence: u64;
437
+ readonly timestamp: string;
438
+ readonly event: AcpDurableEvent;
439
+ };
440
+ export declare function readAcpDurableHistoryEntry(bc: bare.ByteCursor): AcpDurableHistoryEntry;
441
+ export declare function writeAcpDurableHistoryEntry(bc: bare.ByteCursor, x: AcpDurableHistoryEntry): void;
442
+ export type AcpHistoryPageResponse = {
443
+ readonly events: readonly AcpDurableHistoryEntry[];
444
+ readonly hasMoreBefore: boolean;
445
+ readonly hasMoreAfter: boolean;
446
+ };
447
+ export declare function readAcpHistoryPageResponse(bc: bare.ByteCursor): AcpHistoryPageResponse;
448
+ export declare function writeAcpHistoryPageResponse(bc: bare.ByteCursor, x: AcpHistoryPageResponse): void;
449
+ export type AcpSessionConfigResponse = {
450
+ readonly revision: u64;
451
+ readonly options: JsonUtf8;
452
+ };
453
+ export declare function readAcpSessionConfigResponse(bc: bare.ByteCursor): AcpSessionConfigResponse;
454
+ export declare function writeAcpSessionConfigResponse(bc: bare.ByteCursor, x: AcpSessionConfigResponse): void;
455
+ export type AcpSessionCapabilitiesResponse = {
456
+ readonly capabilities: JsonUtf8 | null;
457
+ };
458
+ export declare function readAcpSessionCapabilitiesResponse(bc: bare.ByteCursor): AcpSessionCapabilitiesResponse;
459
+ export declare function writeAcpSessionCapabilitiesResponse(bc: bare.ByteCursor, x: AcpSessionCapabilitiesResponse): void;
460
+ export type AcpSessionAgentInfoResponse = {
461
+ readonly agentInfo: JsonUtf8 | null;
462
+ };
463
+ export declare function readAcpSessionAgentInfoResponse(bc: bare.ByteCursor): AcpSessionAgentInfoResponse;
464
+ export declare function writeAcpSessionAgentInfoResponse(bc: bare.ByteCursor, x: AcpSessionAgentInfoResponse): void;
124
465
  export type AcpSessionCreatedResponse = {
125
466
  readonly sessionId: string;
126
467
  readonly pid: u32 | null;
@@ -188,6 +529,42 @@ export type AcpPendingResponse = {
188
529
  export declare function readAcpPendingResponse(bc: bare.ByteCursor): AcpPendingResponse;
189
530
  export declare function writeAcpPendingResponse(bc: bare.ByteCursor, x: AcpPendingResponse): void;
190
531
  export type AcpResponse = {
532
+ readonly tag: "AcpOpenSessionResponse";
533
+ readonly val: AcpOpenSessionResponse;
534
+ } | {
535
+ readonly tag: "AcpGetDurableSessionResponse";
536
+ readonly val: AcpGetDurableSessionResponse;
537
+ } | {
538
+ readonly tag: "AcpListDurableSessionsResponse";
539
+ readonly val: AcpListDurableSessionsResponse;
540
+ } | {
541
+ readonly tag: "AcpDeleteSessionResponse";
542
+ readonly val: AcpDeleteSessionResponse;
543
+ } | {
544
+ readonly tag: "AcpUnloadSessionResponse";
545
+ readonly val: AcpUnloadSessionResponse;
546
+ } | {
547
+ readonly tag: "AcpPromptResponse";
548
+ readonly val: AcpPromptResponse;
549
+ } | {
550
+ readonly tag: "AcpCancelPromptResponse";
551
+ readonly val: AcpCancelPromptResponse;
552
+ } | {
553
+ readonly tag: "AcpRespondPermissionResponse";
554
+ readonly val: AcpRespondPermissionResponse;
555
+ } | {
556
+ readonly tag: "AcpHistoryPageResponse";
557
+ readonly val: AcpHistoryPageResponse;
558
+ } | {
559
+ readonly tag: "AcpSessionConfigResponse";
560
+ readonly val: AcpSessionConfigResponse;
561
+ } | {
562
+ readonly tag: "AcpSessionCapabilitiesResponse";
563
+ readonly val: AcpSessionCapabilitiesResponse;
564
+ } | {
565
+ readonly tag: "AcpSessionAgentInfoResponse";
566
+ readonly val: AcpSessionAgentInfoResponse;
567
+ } | {
191
568
  readonly tag: "AcpSessionCreatedResponse";
192
569
  readonly val: AcpSessionCreatedResponse;
193
570
  } | {
@@ -216,6 +593,35 @@ export declare function readAcpResponse(bc: bare.ByteCursor): AcpResponse;
216
593
  export declare function writeAcpResponse(bc: bare.ByteCursor, x: AcpResponse): void;
217
594
  export declare function encodeAcpResponse(x: AcpResponse, config?: Partial<bare.Config>): Uint8Array;
218
595
  export declare function decodeAcpResponse(bytes: Uint8Array): AcpResponse;
596
+ /**
597
+ * Live delivery uses the identical durable union/history envelope. Consumers
598
+ * reconnect by subscribing, fetching after their last sequence, then
599
+ * deduplicating by (sessionId, sequence); there is no second replay protocol.
600
+ */
601
+ export type AcpDurableSessionEvent = {
602
+ readonly sessionId: string;
603
+ readonly sequence: u64;
604
+ readonly timestamp: string;
605
+ readonly event: AcpDurableEvent;
606
+ };
607
+ export declare function readAcpDurableSessionEvent(bc: bare.ByteCursor): AcpDurableSessionEvent;
608
+ export declare function writeAcpDurableSessionEvent(bc: bare.ByteCursor, x: AcpDurableSessionEvent): void;
609
+ /**
610
+ * Ephemeral entries are live-only ACP agent_message_chunk or
611
+ * agent_thought_chunk updates. They are never persisted or sequenced; the
612
+ * durable completed message is authoritative after reconnect.
613
+ */
614
+ export type AcpEphemeralSessionUpdateEvent = {
615
+ readonly sessionId: string;
616
+ readonly afterSequence: u64;
617
+ readonly update: JsonUtf8;
618
+ };
619
+ export declare function readAcpEphemeralSessionUpdateEvent(bc: bare.ByteCursor): AcpEphemeralSessionUpdateEvent;
620
+ export declare function writeAcpEphemeralSessionUpdateEvent(bc: bare.ByteCursor, x: AcpEphemeralSessionUpdateEvent): void;
621
+ /**
622
+ * Legacy browser-reference live event. Native durable clients ignore it and
623
+ * consume AcpDurableSessionEvent/AcpEphemeralSessionUpdateEvent instead.
624
+ */
219
625
  export type AcpSessionEvent = {
220
626
  readonly sessionId: string;
221
627
  readonly notification: JsonUtf8;
@@ -231,23 +637,21 @@ export type AcpAgentStderrEvent = {
231
637
  export declare function readAcpAgentStderrEvent(bc: bare.ByteCursor): AcpAgentStderrEvent;
232
638
  export declare function writeAcpAgentStderrEvent(bc: bare.ByteCursor, x: AcpAgentStderrEvent): void;
233
639
  /**
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.
640
+ * Emitted when the ACP adapter process exits unexpectedly — a crash from the
641
+ * host's perspective (any spontaneous exit, including code 0).
642
+ * `restart` is "not_attempted": the sidecar never respawns an adapter or
643
+ * replays an interrupted request implicitly. `restartCount` and `maxRestarts`
644
+ * are therefore both zero. Explicit session restoration is a separate caller
645
+ * operation.
244
646
  * `exitCode` is absent when the exit was observed indirectly (e.g. a write to
245
647
  * the adapter's stdin failed because the process was already gone).
648
+ * `pid` is the host pid reported when the adapter process was launched.
246
649
  */
247
650
  export type AcpAgentExitedEvent = {
248
651
  readonly sessionId: string;
249
652
  readonly agentType: string;
250
653
  readonly processId: string;
654
+ readonly pid: u32 | null;
251
655
  readonly exitCode: i32 | null;
252
656
  readonly restart: string;
253
657
  readonly restartCount: u32;
@@ -256,6 +660,12 @@ export type AcpAgentExitedEvent = {
256
660
  export declare function readAcpAgentExitedEvent(bc: bare.ByteCursor): AcpAgentExitedEvent;
257
661
  export declare function writeAcpAgentExitedEvent(bc: bare.ByteCursor, x: AcpAgentExitedEvent): void;
258
662
  export type AcpEvent = {
663
+ readonly tag: "AcpDurableSessionEvent";
664
+ readonly val: AcpDurableSessionEvent;
665
+ } | {
666
+ readonly tag: "AcpEphemeralSessionUpdateEvent";
667
+ readonly val: AcpEphemeralSessionUpdateEvent;
668
+ } | {
259
669
  readonly tag: "AcpSessionEvent";
260
670
  readonly val: AcpSessionEvent;
261
671
  } | {
@@ -269,13 +679,6 @@ export declare function readAcpEvent(bc: bare.ByteCursor): AcpEvent;
269
679
  export declare function writeAcpEvent(bc: bare.ByteCursor, x: AcpEvent): void;
270
680
  export declare function encodeAcpEvent(x: AcpEvent, config?: Partial<bare.Config>): Uint8Array;
271
681
  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
682
  export type AcpHostRequestCallback = {
280
683
  readonly sessionId: string;
281
684
  readonly request: JsonUtf8;
@@ -283,9 +686,6 @@ export type AcpHostRequestCallback = {
283
686
  export declare function readAcpHostRequestCallback(bc: bare.ByteCursor): AcpHostRequestCallback;
284
687
  export declare function writeAcpHostRequestCallback(bc: bare.ByteCursor, x: AcpHostRequestCallback): void;
285
688
  export type AcpCallback = {
286
- readonly tag: "AcpPermissionCallback";
287
- readonly val: AcpPermissionCallback;
288
- } | {
289
689
  readonly tag: "AcpHostRequestCallback";
290
690
  readonly val: AcpHostRequestCallback;
291
691
  };
@@ -293,21 +693,12 @@ export declare function readAcpCallback(bc: bare.ByteCursor): AcpCallback;
293
693
  export declare function writeAcpCallback(bc: bare.ByteCursor, x: AcpCallback): void;
294
694
  export declare function encodeAcpCallback(x: AcpCallback, config?: Partial<bare.Config>): Uint8Array;
295
695
  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
696
  export type AcpHostRequestCallbackResponse = {
303
697
  readonly response: JsonUtf8 | null;
304
698
  };
305
699
  export declare function readAcpHostRequestCallbackResponse(bc: bare.ByteCursor): AcpHostRequestCallbackResponse;
306
700
  export declare function writeAcpHostRequestCallbackResponse(bc: bare.ByteCursor, x: AcpHostRequestCallbackResponse): void;
307
701
  export type AcpCallbackResponse = {
308
- readonly tag: "AcpPermissionCallbackResponse";
309
- readonly val: AcpPermissionCallbackResponse;
310
- } | {
311
702
  readonly tag: "AcpHostRequestCallbackResponse";
312
703
  readonly val: AcpHostRequestCallbackResponse;
313
704
  };