@rivet-dev/agentos-core 0.0.0-agentos-dylib-plugin.473700e

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 (75) hide show
  1. package/README.md +204 -0
  2. package/dist/agent-os.d.ts +560 -0
  3. package/dist/agent-os.js +3624 -0
  4. package/dist/agent-session-types.d.ts +67 -0
  5. package/dist/agent-session-types.js +1 -0
  6. package/dist/agents.d.ts +63 -0
  7. package/dist/agents.js +42 -0
  8. package/dist/base-filesystem.d.ts +34 -0
  9. package/dist/base-filesystem.js +173 -0
  10. package/dist/cron/cron-manager.d.ts +22 -0
  11. package/dist/cron/cron-manager.js +160 -0
  12. package/dist/cron/index.d.ts +5 -0
  13. package/dist/cron/index.js +3 -0
  14. package/dist/cron/parse-schedule.d.ts +25 -0
  15. package/dist/cron/parse-schedule.js +66 -0
  16. package/dist/cron/schedule-driver.d.ts +19 -0
  17. package/dist/cron/schedule-driver.js +1 -0
  18. package/dist/cron/timer-driver.d.ts +17 -0
  19. package/dist/cron/timer-driver.js +61 -0
  20. package/dist/cron/types.d.ts +55 -0
  21. package/dist/cron/types.js +1 -0
  22. package/dist/filesystem-snapshot.d.ts +14 -0
  23. package/dist/filesystem-snapshot.js +105 -0
  24. package/dist/host-dir-mount.d.ts +38 -0
  25. package/dist/host-dir-mount.js +34 -0
  26. package/dist/host-tools-zod.d.ts +7 -0
  27. package/dist/host-tools-zod.js +243 -0
  28. package/dist/host-tools.d.ts +45 -0
  29. package/dist/host-tools.js +26 -0
  30. package/dist/index.d.ts +10 -0
  31. package/dist/index.js +10 -0
  32. package/dist/js-bridge.d.ts +3 -0
  33. package/dist/js-bridge.js +2 -0
  34. package/dist/json-rpc.d.ts +50 -0
  35. package/dist/json-rpc.js +22 -0
  36. package/dist/layers.d.ts +51 -0
  37. package/dist/layers.js +185 -0
  38. package/dist/overlay-filesystem.d.ts +19 -0
  39. package/dist/overlay-filesystem.js +645 -0
  40. package/dist/packages.d.ts +127 -0
  41. package/dist/packages.js +335 -0
  42. package/dist/runtime-compat.d.ts +471 -0
  43. package/dist/runtime-compat.js +2009 -0
  44. package/dist/runtime.d.ts +336 -0
  45. package/dist/runtime.js +1 -0
  46. package/dist/sidecar/agent-os-protocol.d.ts +219 -0
  47. package/dist/sidecar/agent-os-protocol.js +594 -0
  48. package/dist/sidecar/binary.d.ts +9 -0
  49. package/dist/sidecar/binary.js +30 -0
  50. package/dist/sidecar/cargo.d.ts +2 -0
  51. package/dist/sidecar/cargo.js +142 -0
  52. package/dist/sidecar/native-process-client.d.ts +2 -0
  53. package/dist/sidecar/native-process-client.js +1 -0
  54. package/dist/sidecar/permissions.d.ts +3 -0
  55. package/dist/sidecar/permissions.js +54 -0
  56. package/dist/sidecar/process.d.ts +6 -0
  57. package/dist/sidecar/process.js +8 -0
  58. package/dist/sidecar/rpc-client.d.ts +244 -0
  59. package/dist/sidecar/rpc-client.js +2028 -0
  60. package/dist/test/docker.d.ts +133 -0
  61. package/dist/test/docker.js +336 -0
  62. package/dist/test/file-system.d.ts +39 -0
  63. package/dist/test/file-system.js +562 -0
  64. package/dist/test/mock-s3.d.ts +42 -0
  65. package/dist/test/mock-s3.js +292 -0
  66. package/dist/test/runtime.d.ts +11 -0
  67. package/dist/test/runtime.js +9 -0
  68. package/dist/test/sandbox-agent.d.ts +9 -0
  69. package/dist/test/sandbox-agent.js +395 -0
  70. package/dist/test/terminal-harness.d.ts +27 -0
  71. package/dist/test/terminal-harness.js +122 -0
  72. package/dist/types.d.ts +10 -0
  73. package/dist/types.js +1 -0
  74. package/fixtures/AGENTOS_SYSTEM_PROMPT.md +21 -0
  75. package/package.json +111 -0
@@ -0,0 +1,336 @@
1
+ export type StdioChannel = "stdout" | "stderr";
2
+ export type TimingMitigation = "off" | "freeze";
3
+ export type PermissionMode = "allow" | "deny";
4
+ export type PermissionDecision = PermissionMode;
5
+ export interface VirtualDirEntry {
6
+ name: string;
7
+ isDirectory: boolean;
8
+ isSymbolicLink?: boolean;
9
+ }
10
+ export interface VirtualStat {
11
+ mode: number;
12
+ size: number;
13
+ blocks: number;
14
+ dev: number;
15
+ rdev: number;
16
+ isDirectory: boolean;
17
+ isSymbolicLink: boolean;
18
+ atimeMs: number;
19
+ mtimeMs: number;
20
+ ctimeMs: number;
21
+ birthtimeMs: number;
22
+ ino: number;
23
+ nlink: number;
24
+ uid: number;
25
+ gid: number;
26
+ }
27
+ export interface VirtualFileSystem {
28
+ readFile(path: string): Promise<Uint8Array>;
29
+ readTextFile(path: string): Promise<string>;
30
+ readDir(path: string): Promise<string[]>;
31
+ readDirWithTypes(path: string): Promise<VirtualDirEntry[]>;
32
+ writeFile(path: string, content: string | Uint8Array): Promise<void>;
33
+ createDir(path: string): Promise<void>;
34
+ mkdir(path: string, options?: {
35
+ recursive?: boolean;
36
+ }): Promise<void>;
37
+ exists(path: string): Promise<boolean>;
38
+ stat(path: string): Promise<VirtualStat>;
39
+ removeFile(path: string): Promise<void>;
40
+ removeDir(path: string): Promise<void>;
41
+ rename(oldPath: string, newPath: string): Promise<void>;
42
+ realpath(path: string): Promise<string>;
43
+ symlink(target: string, linkPath: string): Promise<void>;
44
+ readlink(path: string): Promise<string>;
45
+ lstat(path: string): Promise<VirtualStat>;
46
+ link(oldPath: string, newPath: string): Promise<void>;
47
+ chmod(path: string, mode: number): Promise<void>;
48
+ chown(path: string, uid: number, gid: number): Promise<void>;
49
+ utimes(path: string, atime: number, mtime: number): Promise<void>;
50
+ truncate(path: string, length: number): Promise<void>;
51
+ pread(path: string, offset: number, length: number): Promise<Uint8Array>;
52
+ pwrite(path: string, offset: number, data: Uint8Array): Promise<void>;
53
+ }
54
+ export interface NetworkAccessRequest {
55
+ url?: string;
56
+ host?: string;
57
+ port?: number;
58
+ protocol?: string;
59
+ }
60
+ export interface FsPermissionRule {
61
+ mode: PermissionMode;
62
+ operations?: string[];
63
+ paths?: string[];
64
+ }
65
+ export interface PatternPermissionRule {
66
+ mode: PermissionMode;
67
+ operations?: string[];
68
+ patterns?: string[];
69
+ }
70
+ export interface RulePermissions<TRule> {
71
+ default?: PermissionMode;
72
+ rules: TRule[];
73
+ }
74
+ export type FsPermissions = PermissionMode | RulePermissions<FsPermissionRule>;
75
+ export type NetworkPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
76
+ export type ChildProcessPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
77
+ export type ProcessPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
78
+ export type EnvPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
79
+ export type ToolPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
80
+ export interface ProcessInfo {
81
+ pid: number;
82
+ ppid: number;
83
+ pgid: number;
84
+ sid: number;
85
+ driver: string;
86
+ command: string;
87
+ args: string[];
88
+ cwd: string;
89
+ status: "running" | "exited";
90
+ exitCode: number | null;
91
+ startTime: number;
92
+ exitTime: number | null;
93
+ }
94
+ export interface ManagedProcess {
95
+ pid: number;
96
+ writeStdin(data: Uint8Array | string): void;
97
+ closeStdin(): void;
98
+ kill(signal?: number): void;
99
+ wait(): Promise<number>;
100
+ readonly exitCode: number | null;
101
+ }
102
+ export interface ShellHandle {
103
+ pid: number;
104
+ write(data: Uint8Array | string): void;
105
+ onData: ((data: Uint8Array) => void) | null;
106
+ resize(cols: number, rows: number): void;
107
+ kill(signal?: number): void;
108
+ wait(): Promise<number>;
109
+ }
110
+ export interface OpenShellOptions {
111
+ command?: string;
112
+ args?: string[];
113
+ env?: Record<string, string>;
114
+ cwd?: string;
115
+ cols?: number;
116
+ rows?: number;
117
+ onStderr?: (data: Uint8Array) => void;
118
+ }
119
+ export interface ConnectTerminalOptions extends OpenShellOptions {
120
+ onData?: (data: Uint8Array) => void;
121
+ }
122
+ export interface ExecOptions {
123
+ env?: Record<string, string>;
124
+ cwd?: string;
125
+ stdin?: string | Uint8Array;
126
+ timeout?: number;
127
+ onStdout?: (data: Uint8Array) => void;
128
+ onStderr?: (data: Uint8Array) => void;
129
+ captureStdio?: boolean;
130
+ filePath?: string;
131
+ cpuTimeLimitMs?: number;
132
+ timingMitigation?: TimingMitigation;
133
+ }
134
+ export interface ExecResult {
135
+ exitCode: number;
136
+ stdout: string;
137
+ stderr: string;
138
+ }
139
+ export interface RunResult<T = unknown> {
140
+ value?: T;
141
+ code: number;
142
+ errorMessage?: string;
143
+ }
144
+ export interface KernelSpawnOptions extends ExecOptions {
145
+ stdio?: "pipe" | "inherit";
146
+ stdinFd?: number;
147
+ stdoutFd?: number;
148
+ stderrFd?: number;
149
+ streamStdin?: boolean;
150
+ }
151
+ export type KernelExecOptions = ExecOptions;
152
+ export type KernelExecResult = ExecResult;
153
+ export type StatInfo = VirtualStat;
154
+ export type DirEntry = VirtualDirEntry;
155
+ export type StdioEvent = {
156
+ channel: StdioChannel;
157
+ message: string;
158
+ };
159
+ export type StdioHook = (event: StdioEvent) => void;
160
+ export interface Permissions {
161
+ fs?: FsPermissions;
162
+ network?: NetworkPermissions;
163
+ childProcess?: ChildProcessPermissions;
164
+ process?: ProcessPermissions;
165
+ env?: EnvPermissions;
166
+ tool?: ToolPermissions;
167
+ }
168
+ export interface ResourceBudgets {
169
+ maxOutputBytes?: number;
170
+ maxBridgeCalls?: number;
171
+ maxTimers?: number;
172
+ maxChildProcesses?: number;
173
+ maxHandles?: number;
174
+ }
175
+ export interface ProcessConfig {
176
+ cwd?: string;
177
+ env?: Record<string, string>;
178
+ argv?: string[];
179
+ stdinIsTTY?: boolean;
180
+ stdoutIsTTY?: boolean;
181
+ stderrIsTTY?: boolean;
182
+ }
183
+ export interface OSConfig {
184
+ homedir?: string;
185
+ tmpdir?: string;
186
+ }
187
+ export interface CommandExecutor {
188
+ spawn(command: string, args: string[], options?: KernelSpawnOptions): ManagedProcess;
189
+ }
190
+ export interface NetworkAdapter {
191
+ fetch(url: string, options?: {
192
+ method?: string;
193
+ headers?: Record<string, string>;
194
+ body?: unknown;
195
+ }): Promise<{
196
+ ok: boolean;
197
+ status: number;
198
+ statusText: string;
199
+ headers: Record<string, string>;
200
+ body: string;
201
+ url: string;
202
+ redirected: boolean;
203
+ }>;
204
+ dnsLookup(hostname: string): Promise<{
205
+ address?: string;
206
+ family?: number;
207
+ error?: string;
208
+ code?: string;
209
+ }>;
210
+ httpRequest(url: string, options?: {
211
+ method?: string;
212
+ headers?: Record<string, string>;
213
+ body?: unknown;
214
+ }): Promise<{
215
+ status: number;
216
+ statusText: string;
217
+ headers: Record<string, string>;
218
+ body: string;
219
+ url: string;
220
+ }>;
221
+ }
222
+ export interface SystemDriver {
223
+ filesystem?: VirtualFileSystem;
224
+ network?: NetworkAdapter;
225
+ commandExecutor?: CommandExecutor;
226
+ permissions?: Permissions;
227
+ runtime: {
228
+ process: ProcessConfig;
229
+ os: OSConfig;
230
+ };
231
+ }
232
+ export interface RuntimeDriverOptions {
233
+ system: SystemDriver;
234
+ runtime: {
235
+ process: ProcessConfig;
236
+ os: OSConfig;
237
+ };
238
+ memoryLimit?: number;
239
+ cpuTimeLimitMs?: number;
240
+ timingMitigation?: TimingMitigation;
241
+ onStdio?: StdioHook;
242
+ payloadLimits?: {
243
+ base64TransferBytes?: number;
244
+ jsonPayloadBytes?: number;
245
+ };
246
+ resourceBudgets?: ResourceBudgets;
247
+ }
248
+ export interface NodeRuntimeDriver {
249
+ exec(code: string, options?: ExecOptions): Promise<ExecResult>;
250
+ run<T = unknown>(code: string, filePath?: string): Promise<RunResult<T>>;
251
+ dispose(): void;
252
+ terminate?(): Promise<void>;
253
+ readonly network?: Pick<NetworkAdapter, "fetch" | "dnsLookup" | "httpRequest">;
254
+ }
255
+ export interface NodeRuntimeDriverFactory {
256
+ createRuntimeDriver(options: RuntimeDriverOptions): NodeRuntimeDriver;
257
+ }
258
+ export interface KernelInterface {
259
+ vfs: VirtualFileSystem;
260
+ }
261
+ export interface Kernel extends KernelInterface {
262
+ mount(driver: KernelRuntimeDriver): Promise<void>;
263
+ dispose(): Promise<void>;
264
+ exec(command: string, options?: KernelExecOptions): Promise<KernelExecResult>;
265
+ spawn(command: string, args: string[], options?: KernelSpawnOptions): ManagedProcess;
266
+ openShell(options?: OpenShellOptions): ShellHandle;
267
+ connectTerminal(options?: ConnectTerminalOptions): Promise<number>;
268
+ mountFs(path: string, fs: VirtualFileSystem, options?: {
269
+ readOnly?: boolean;
270
+ }): void;
271
+ unmountFs(path: string): void;
272
+ readFile(path: string): Promise<Uint8Array>;
273
+ writeFile(path: string, content: string | Uint8Array): Promise<void>;
274
+ mkdir(path: string): Promise<void>;
275
+ readdir(path: string): Promise<string[]>;
276
+ stat(path: string): Promise<VirtualStat>;
277
+ exists(path: string): Promise<boolean>;
278
+ removeFile(path: string): Promise<void>;
279
+ removeDir(path: string): Promise<void>;
280
+ rename(oldPath: string, newPath: string): Promise<void>;
281
+ readonly commands: ReadonlyMap<string, string>;
282
+ readonly processes: ReadonlyMap<number, ProcessInfo>;
283
+ readonly env: Record<string, string>;
284
+ readonly cwd: string;
285
+ readonly socketTable: {
286
+ hasHostNetworkAdapter(): boolean;
287
+ findListener(_request: unknown): unknown | null;
288
+ findBoundUdp(_request: unknown): unknown | null;
289
+ };
290
+ readonly processTable: {
291
+ getSignalState(_pid: number): {
292
+ handlers: Map<number, unknown>;
293
+ };
294
+ };
295
+ readonly timerTable: Record<string, never>;
296
+ readonly zombieTimerCount: number;
297
+ }
298
+ export interface BindingTree {
299
+ [key: string]: BindingFunction | BindingTree;
300
+ }
301
+ export type BindingFunction = (...args: unknown[]) => unknown;
302
+ export interface NodeDriverOptions {
303
+ filesystem?: VirtualFileSystem;
304
+ networkAdapter?: NetworkAdapter;
305
+ commandExecutor?: CommandExecutor;
306
+ permissions?: Permissions;
307
+ processConfig?: ProcessConfig;
308
+ osConfig?: OSConfig;
309
+ }
310
+ export interface DefaultNetworkAdapterOptions {
311
+ loopbackExemptPorts?: number[];
312
+ }
313
+ export interface NodeRuntimeOptions {
314
+ systemDriver?: SystemDriver;
315
+ runtimeDriverFactory?: NodeRuntimeDriverFactory;
316
+ permissions?: Partial<Permissions>;
317
+ memoryLimit?: number;
318
+ bindings?: BindingTree;
319
+ loopbackExemptPorts?: number[];
320
+ }
321
+ export type NodeRuntimeDriverFactoryOptions = Record<string, never>;
322
+ export type NodeExecutionDriverOptions = RuntimeDriverOptions;
323
+ export interface KernelRuntimeDriver {
324
+ readonly kind: "node" | "wasmvm";
325
+ readonly name: string;
326
+ readonly commands: string[];
327
+ readonly commandDirs?: string[];
328
+ }
329
+ export type DriverProcess = ManagedProcess;
330
+ export type ProcessContext = Record<string, never>;
331
+ export type PermissionTier = "full" | "read-write" | "read-only" | "isolated";
332
+ export interface WasmVmRuntimeOptions {
333
+ wasmBinaryPath?: string;
334
+ commandDirs?: string[];
335
+ permissions?: Record<string, PermissionTier>;
336
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,219 @@
1
+ import * as bare from "@rivetkit/bare-ts";
2
+ export type i32 = number;
3
+ export type u32 = number;
4
+ export type JsonUtf8 = string;
5
+ export declare function readJsonUtf8(bc: bare.ByteCursor): JsonUtf8;
6
+ export declare function writeJsonUtf8(bc: bare.ByteCursor, x: JsonUtf8): void;
7
+ export declare enum AcpRuntimeKind {
8
+ JavaScript = "JavaScript",
9
+ Python = "Python",
10
+ WebAssembly = "WebAssembly"
11
+ }
12
+ export declare function readAcpRuntimeKind(bc: bare.ByteCursor): AcpRuntimeKind;
13
+ export declare function writeAcpRuntimeKind(bc: bare.ByteCursor, x: AcpRuntimeKind): void;
14
+ export type AcpCreateSessionRequest = {
15
+ readonly agentType: string;
16
+ readonly runtime: AcpRuntimeKind;
17
+ readonly adapterEntrypoint: string;
18
+ readonly cwd: string;
19
+ readonly args: readonly string[];
20
+ readonly env: ReadonlyMap<string, string>;
21
+ readonly protocolVersion: i32;
22
+ readonly clientCapabilities: JsonUtf8;
23
+ readonly mcpServers: JsonUtf8;
24
+ readonly skipOsInstructions: boolean;
25
+ readonly additionalInstructions: string | null;
26
+ };
27
+ export declare function readAcpCreateSessionRequest(bc: bare.ByteCursor): AcpCreateSessionRequest;
28
+ export declare function writeAcpCreateSessionRequest(bc: bare.ByteCursor, x: AcpCreateSessionRequest): void;
29
+ export type AcpSessionRequest = {
30
+ readonly sessionId: string;
31
+ readonly method: string;
32
+ readonly params: JsonUtf8 | null;
33
+ };
34
+ export declare function readAcpSessionRequest(bc: bare.ByteCursor): AcpSessionRequest;
35
+ export declare function writeAcpSessionRequest(bc: bare.ByteCursor, x: AcpSessionRequest): void;
36
+ export type AcpGetSessionStateRequest = {
37
+ readonly sessionId: string;
38
+ };
39
+ export declare function readAcpGetSessionStateRequest(bc: bare.ByteCursor): AcpGetSessionStateRequest;
40
+ export declare function writeAcpGetSessionStateRequest(bc: bare.ByteCursor, x: AcpGetSessionStateRequest): void;
41
+ export type AcpCloseSessionRequest = {
42
+ readonly sessionId: string;
43
+ };
44
+ export declare function readAcpCloseSessionRequest(bc: bare.ByteCursor): AcpCloseSessionRequest;
45
+ export declare function writeAcpCloseSessionRequest(bc: bare.ByteCursor, x: AcpCloseSessionRequest): void;
46
+ /**
47
+ * Resume a session that exists in durable storage but is not live in the current
48
+ * VM (e.g. after a Rivet actor slept and woke with a fresh VM). The sidecar runs
49
+ * the stateless resume state machine (native session/load when the agent supports
50
+ * it, else a fresh session/new + transcript continuation preamble). `cwd`/`env`
51
+ * describe the fresh adapter launch used by the fallback tier. `transcriptPath`,
52
+ * when present, is a guest-readable path the fallback preamble points the agent at.
53
+ */
54
+ export type AcpResumeSessionRequest = {
55
+ readonly sessionId: string;
56
+ readonly agentType: string;
57
+ readonly transcriptPath: string | null;
58
+ readonly cwd: string;
59
+ readonly env: ReadonlyMap<string, string>;
60
+ };
61
+ export declare function readAcpResumeSessionRequest(bc: bare.ByteCursor): AcpResumeSessionRequest;
62
+ export declare function writeAcpResumeSessionRequest(bc: bare.ByteCursor, x: AcpResumeSessionRequest): void;
63
+ export type AcpRequest = {
64
+ readonly tag: "AcpCreateSessionRequest";
65
+ readonly val: AcpCreateSessionRequest;
66
+ } | {
67
+ readonly tag: "AcpSessionRequest";
68
+ readonly val: AcpSessionRequest;
69
+ } | {
70
+ readonly tag: "AcpGetSessionStateRequest";
71
+ readonly val: AcpGetSessionStateRequest;
72
+ } | {
73
+ readonly tag: "AcpCloseSessionRequest";
74
+ readonly val: AcpCloseSessionRequest;
75
+ } | {
76
+ readonly tag: "AcpResumeSessionRequest";
77
+ readonly val: AcpResumeSessionRequest;
78
+ };
79
+ export declare function readAcpRequest(bc: bare.ByteCursor): AcpRequest;
80
+ export declare function writeAcpRequest(bc: bare.ByteCursor, x: AcpRequest): void;
81
+ export declare function encodeAcpRequest(x: AcpRequest, config?: Partial<bare.Config>): Uint8Array;
82
+ export declare function decodeAcpRequest(bytes: Uint8Array): AcpRequest;
83
+ export type AcpSessionCreatedResponse = {
84
+ readonly sessionId: string;
85
+ readonly pid: u32 | null;
86
+ readonly modes: JsonUtf8 | null;
87
+ readonly configOptions: readonly JsonUtf8[];
88
+ readonly agentCapabilities: JsonUtf8 | null;
89
+ readonly agentInfo: JsonUtf8 | null;
90
+ };
91
+ export declare function readAcpSessionCreatedResponse(bc: bare.ByteCursor): AcpSessionCreatedResponse;
92
+ export declare function writeAcpSessionCreatedResponse(bc: bare.ByteCursor, x: AcpSessionCreatedResponse): void;
93
+ export type AcpSessionRpcResponse = {
94
+ readonly sessionId: string;
95
+ readonly response: JsonUtf8;
96
+ };
97
+ export declare function readAcpSessionRpcResponse(bc: bare.ByteCursor): AcpSessionRpcResponse;
98
+ export declare function writeAcpSessionRpcResponse(bc: bare.ByteCursor, x: AcpSessionRpcResponse): void;
99
+ export type AcpSessionStateResponse = {
100
+ readonly sessionId: string;
101
+ readonly agentType: string;
102
+ readonly processId: string;
103
+ readonly pid: u32 | null;
104
+ readonly closed: boolean;
105
+ readonly exitCode: i32 | null;
106
+ readonly modes: JsonUtf8 | null;
107
+ readonly configOptions: readonly JsonUtf8[];
108
+ readonly agentCapabilities: JsonUtf8 | null;
109
+ readonly agentInfo: JsonUtf8 | null;
110
+ };
111
+ export declare function readAcpSessionStateResponse(bc: bare.ByteCursor): AcpSessionStateResponse;
112
+ export declare function writeAcpSessionStateResponse(bc: bare.ByteCursor, x: AcpSessionStateResponse): void;
113
+ export type AcpSessionClosedResponse = {
114
+ readonly sessionId: string;
115
+ };
116
+ export declare function readAcpSessionClosedResponse(bc: bare.ByteCursor): AcpSessionClosedResponse;
117
+ export declare function writeAcpSessionClosedResponse(bc: bare.ByteCursor, x: AcpSessionClosedResponse): void;
118
+ /**
119
+ * Result of AcpResumeSessionRequest. `sessionId` is the live ACP session id after
120
+ * resume: equal to the requested id for native loads, or the freshly assigned id
121
+ * for the fallback tier (the caller remaps external -> live). `mode` is "native"
122
+ * (session/load|resume succeeded) or "fallback" (a new session was created and the
123
+ * transcript-continuation preamble was armed for the next prompt).
124
+ */
125
+ export type AcpSessionResumedResponse = {
126
+ readonly sessionId: string;
127
+ readonly mode: string;
128
+ };
129
+ export declare function readAcpSessionResumedResponse(bc: bare.ByteCursor): AcpSessionResumedResponse;
130
+ export declare function writeAcpSessionResumedResponse(bc: bare.ByteCursor, x: AcpSessionResumedResponse): void;
131
+ export type AcpErrorResponse = {
132
+ readonly code: string;
133
+ readonly message: string;
134
+ };
135
+ export declare function readAcpErrorResponse(bc: bare.ByteCursor): AcpErrorResponse;
136
+ export declare function writeAcpErrorResponse(bc: bare.ByteCursor, x: AcpErrorResponse): void;
137
+ export type AcpResponse = {
138
+ readonly tag: "AcpSessionCreatedResponse";
139
+ readonly val: AcpSessionCreatedResponse;
140
+ } | {
141
+ readonly tag: "AcpSessionRpcResponse";
142
+ readonly val: AcpSessionRpcResponse;
143
+ } | {
144
+ readonly tag: "AcpSessionStateResponse";
145
+ readonly val: AcpSessionStateResponse;
146
+ } | {
147
+ readonly tag: "AcpSessionClosedResponse";
148
+ readonly val: AcpSessionClosedResponse;
149
+ } | {
150
+ readonly tag: "AcpSessionResumedResponse";
151
+ readonly val: AcpSessionResumedResponse;
152
+ } | {
153
+ readonly tag: "AcpErrorResponse";
154
+ readonly val: AcpErrorResponse;
155
+ };
156
+ export declare function readAcpResponse(bc: bare.ByteCursor): AcpResponse;
157
+ export declare function writeAcpResponse(bc: bare.ByteCursor, x: AcpResponse): void;
158
+ export declare function encodeAcpResponse(x: AcpResponse, config?: Partial<bare.Config>): Uint8Array;
159
+ export declare function decodeAcpResponse(bytes: Uint8Array): AcpResponse;
160
+ export type AcpSessionEvent = {
161
+ readonly sessionId: string;
162
+ readonly notification: JsonUtf8;
163
+ };
164
+ export declare function readAcpSessionEvent(bc: bare.ByteCursor): AcpSessionEvent;
165
+ export declare function writeAcpSessionEvent(bc: bare.ByteCursor, x: AcpSessionEvent): void;
166
+ export type AcpEvent = {
167
+ readonly tag: "AcpSessionEvent";
168
+ readonly val: AcpSessionEvent;
169
+ };
170
+ export declare function readAcpEvent(bc: bare.ByteCursor): AcpEvent;
171
+ export declare function writeAcpEvent(bc: bare.ByteCursor, x: AcpEvent): void;
172
+ export declare function encodeAcpEvent(x: AcpEvent, config?: Partial<bare.Config>): Uint8Array;
173
+ export declare function decodeAcpEvent(bytes: Uint8Array): AcpEvent;
174
+ export type AcpPermissionCallback = {
175
+ readonly sessionId: string;
176
+ readonly permissionId: string;
177
+ readonly params: JsonUtf8;
178
+ };
179
+ export declare function readAcpPermissionCallback(bc: bare.ByteCursor): AcpPermissionCallback;
180
+ export declare function writeAcpPermissionCallback(bc: bare.ByteCursor, x: AcpPermissionCallback): void;
181
+ export type AcpHostRequestCallback = {
182
+ readonly sessionId: string;
183
+ readonly request: JsonUtf8;
184
+ };
185
+ export declare function readAcpHostRequestCallback(bc: bare.ByteCursor): AcpHostRequestCallback;
186
+ export declare function writeAcpHostRequestCallback(bc: bare.ByteCursor, x: AcpHostRequestCallback): void;
187
+ export type AcpCallback = {
188
+ readonly tag: "AcpPermissionCallback";
189
+ readonly val: AcpPermissionCallback;
190
+ } | {
191
+ readonly tag: "AcpHostRequestCallback";
192
+ readonly val: AcpHostRequestCallback;
193
+ };
194
+ export declare function readAcpCallback(bc: bare.ByteCursor): AcpCallback;
195
+ export declare function writeAcpCallback(bc: bare.ByteCursor, x: AcpCallback): void;
196
+ export declare function encodeAcpCallback(x: AcpCallback, config?: Partial<bare.Config>): Uint8Array;
197
+ export declare function decodeAcpCallback(bytes: Uint8Array): AcpCallback;
198
+ export type AcpPermissionCallbackResponse = {
199
+ readonly permissionId: string;
200
+ readonly reply: string;
201
+ };
202
+ export declare function readAcpPermissionCallbackResponse(bc: bare.ByteCursor): AcpPermissionCallbackResponse;
203
+ export declare function writeAcpPermissionCallbackResponse(bc: bare.ByteCursor, x: AcpPermissionCallbackResponse): void;
204
+ export type AcpHostRequestCallbackResponse = {
205
+ readonly response: JsonUtf8 | null;
206
+ };
207
+ export declare function readAcpHostRequestCallbackResponse(bc: bare.ByteCursor): AcpHostRequestCallbackResponse;
208
+ export declare function writeAcpHostRequestCallbackResponse(bc: bare.ByteCursor, x: AcpHostRequestCallbackResponse): void;
209
+ export type AcpCallbackResponse = {
210
+ readonly tag: "AcpPermissionCallbackResponse";
211
+ readonly val: AcpPermissionCallbackResponse;
212
+ } | {
213
+ readonly tag: "AcpHostRequestCallbackResponse";
214
+ readonly val: AcpHostRequestCallbackResponse;
215
+ };
216
+ export declare function readAcpCallbackResponse(bc: bare.ByteCursor): AcpCallbackResponse;
217
+ export declare function writeAcpCallbackResponse(bc: bare.ByteCursor, x: AcpCallbackResponse): void;
218
+ export declare function encodeAcpCallbackResponse(x: AcpCallbackResponse, config?: Partial<bare.Config>): Uint8Array;
219
+ export declare function decodeAcpCallbackResponse(bytes: Uint8Array): AcpCallbackResponse;