@termlink/protocol 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,997 @@
1
+ import { z } from "zod";
2
+ import { type HostInfo, type SessionInfo } from "./common.js";
3
+ export declare const UserInput: z.ZodObject<{
4
+ text: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export type UserInput = z.infer<typeof UserInput>;
7
+ export declare const HostInfoCommand: z.ZodObject<{
8
+ v: z.ZodLiteral<1>;
9
+ kind: z.ZodLiteral<"cmd">;
10
+ reqId: z.ZodString;
11
+ type: z.ZodLiteral<"host.info">;
12
+ payload: z.ZodObject<{}, z.core.$strip>;
13
+ }, z.core.$strip>;
14
+ export declare const SessionListCommand: z.ZodObject<{
15
+ v: z.ZodLiteral<1>;
16
+ kind: z.ZodLiteral<"cmd">;
17
+ reqId: z.ZodString;
18
+ type: z.ZodLiteral<"session.list">;
19
+ payload: z.ZodObject<{}, z.core.$strip>;
20
+ }, z.core.$strip>;
21
+ export declare const SessionCreateCommand: z.ZodObject<{
22
+ v: z.ZodLiteral<1>;
23
+ kind: z.ZodLiteral<"cmd">;
24
+ reqId: z.ZodString;
25
+ type: z.ZodLiteral<"session.create">;
26
+ payload: z.ZodObject<{
27
+ provider: z.ZodString;
28
+ cwd: z.ZodString;
29
+ title: z.ZodOptional<z.ZodString>;
30
+ autoApprove: z.ZodOptional<z.ZodEnum<{
31
+ all: "all";
32
+ edits: "edits";
33
+ off: "off";
34
+ }>>;
35
+ cols: z.ZodOptional<z.ZodNumber>;
36
+ rows: z.ZodOptional<z.ZodNumber>;
37
+ clientId: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>;
39
+ }, z.core.$strip>;
40
+ export declare const SessionAttachCommand: z.ZodObject<{
41
+ v: z.ZodLiteral<1>;
42
+ kind: z.ZodLiteral<"cmd">;
43
+ reqId: z.ZodString;
44
+ type: z.ZodLiteral<"session.attach">;
45
+ payload: z.ZodObject<{
46
+ sessionId: z.ZodString;
47
+ afterSeq: z.ZodOptional<z.ZodNumber>;
48
+ clientId: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strip>;
50
+ }, z.core.$strip>;
51
+ export declare const SessionDetachCommand: z.ZodObject<{
52
+ v: z.ZodLiteral<1>;
53
+ kind: z.ZodLiteral<"cmd">;
54
+ reqId: z.ZodString;
55
+ type: z.ZodLiteral<"session.detach">;
56
+ payload: z.ZodObject<{
57
+ sessionId: z.ZodString;
58
+ clientId: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$strip>;
60
+ }, z.core.$strip>;
61
+ export declare const SessionSendCommand: z.ZodObject<{
62
+ v: z.ZodLiteral<1>;
63
+ kind: z.ZodLiteral<"cmd">;
64
+ reqId: z.ZodString;
65
+ type: z.ZodLiteral<"session.send">;
66
+ payload: z.ZodObject<{
67
+ sessionId: z.ZodString;
68
+ input: z.ZodObject<{
69
+ text: z.ZodString;
70
+ }, z.core.$strip>;
71
+ }, z.core.$strip>;
72
+ }, z.core.$strip>;
73
+ export declare const SessionInterruptCommand: z.ZodObject<{
74
+ v: z.ZodLiteral<1>;
75
+ kind: z.ZodLiteral<"cmd">;
76
+ reqId: z.ZodString;
77
+ type: z.ZodLiteral<"session.interrupt">;
78
+ payload: z.ZodObject<{
79
+ sessionId: z.ZodString;
80
+ }, z.core.$strip>;
81
+ }, z.core.$strip>;
82
+ export declare const SessionCloseCommand: z.ZodObject<{
83
+ v: z.ZodLiteral<1>;
84
+ kind: z.ZodLiteral<"cmd">;
85
+ reqId: z.ZodString;
86
+ type: z.ZodLiteral<"session.close">;
87
+ payload: z.ZodObject<{
88
+ sessionId: z.ZodString;
89
+ }, z.core.$strip>;
90
+ }, z.core.$strip>;
91
+ /** Changes agent session settings. Changing autoApprove also applies to approvals already waiting. */
92
+ export declare const SessionConfigureCommand: z.ZodObject<{
93
+ v: z.ZodLiteral<1>;
94
+ kind: z.ZodLiteral<"cmd">;
95
+ reqId: z.ZodString;
96
+ type: z.ZodLiteral<"session.configure">;
97
+ payload: z.ZodObject<{
98
+ sessionId: z.ZodString;
99
+ autoApprove: z.ZodOptional<z.ZodEnum<{
100
+ all: "all";
101
+ edits: "edits";
102
+ off: "off";
103
+ }>>;
104
+ }, z.core.$strip>;
105
+ }, z.core.$strip>;
106
+ export declare const InputRespondCommand: z.ZodObject<{
107
+ v: z.ZodLiteral<1>;
108
+ kind: z.ZodLiteral<"cmd">;
109
+ reqId: z.ZodString;
110
+ type: z.ZodLiteral<"input.respond">;
111
+ payload: z.ZodObject<{
112
+ sessionId: z.ZodString;
113
+ requestId: z.ZodString;
114
+ decisionId: z.ZodString;
115
+ answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
116
+ }, z.core.$strip>;
117
+ }, z.core.$strip>;
118
+ /** Sets the PTY size. The last client to ask wins; everyone hears terminal.size. */
119
+ export declare const TerminalResizeCommand: z.ZodObject<{
120
+ v: z.ZodLiteral<1>;
121
+ kind: z.ZodLiteral<"cmd">;
122
+ reqId: z.ZodString;
123
+ type: z.ZodLiteral<"terminal.resize">;
124
+ payload: z.ZodObject<{
125
+ cols: z.ZodNumber;
126
+ rows: z.ZodNumber;
127
+ sessionId: z.ZodString;
128
+ }, z.core.$strip>;
129
+ }, z.core.$strip>;
130
+ /**
131
+ * Flow control. `bytes` is how much terminal output this client has written to its
132
+ * terminal since it attached (cumulative). The host pauses the shell when the slowest
133
+ * client falls too far behind, so a phone on a slow link is not dropped by the relay.
134
+ */
135
+ export declare const TerminalAckCommand: z.ZodObject<{
136
+ v: z.ZodLiteral<1>;
137
+ kind: z.ZodLiteral<"cmd">;
138
+ reqId: z.ZodString;
139
+ type: z.ZodLiteral<"terminal.ack">;
140
+ payload: z.ZodObject<{
141
+ sessionId: z.ZodString;
142
+ clientId: z.ZodString;
143
+ bytes: z.ZodNumber;
144
+ }, z.core.$strip>;
145
+ }, z.core.$strip>;
146
+ /** Ends the shell process. Ctrl+C is not a command: it is the byte 0x03 written to the terminal. */
147
+ export declare const TerminalKillCommand: z.ZodObject<{
148
+ v: z.ZodLiteral<1>;
149
+ kind: z.ZodLiteral<"cmd">;
150
+ reqId: z.ZodString;
151
+ type: z.ZodLiteral<"terminal.kill">;
152
+ payload: z.ZodObject<{
153
+ sessionId: z.ZodString;
154
+ }, z.core.$strip>;
155
+ }, z.core.$strip>;
156
+ export declare const Command: z.ZodDiscriminatedUnion<[z.ZodObject<{
157
+ v: z.ZodLiteral<1>;
158
+ kind: z.ZodLiteral<"cmd">;
159
+ reqId: z.ZodString;
160
+ type: z.ZodLiteral<"host.info">;
161
+ payload: z.ZodObject<{}, z.core.$strip>;
162
+ }, z.core.$strip>, z.ZodObject<{
163
+ v: z.ZodLiteral<1>;
164
+ kind: z.ZodLiteral<"cmd">;
165
+ reqId: z.ZodString;
166
+ type: z.ZodLiteral<"session.list">;
167
+ payload: z.ZodObject<{}, z.core.$strip>;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ v: z.ZodLiteral<1>;
170
+ kind: z.ZodLiteral<"cmd">;
171
+ reqId: z.ZodString;
172
+ type: z.ZodLiteral<"session.create">;
173
+ payload: z.ZodObject<{
174
+ provider: z.ZodString;
175
+ cwd: z.ZodString;
176
+ title: z.ZodOptional<z.ZodString>;
177
+ autoApprove: z.ZodOptional<z.ZodEnum<{
178
+ all: "all";
179
+ edits: "edits";
180
+ off: "off";
181
+ }>>;
182
+ cols: z.ZodOptional<z.ZodNumber>;
183
+ rows: z.ZodOptional<z.ZodNumber>;
184
+ clientId: z.ZodOptional<z.ZodString>;
185
+ }, z.core.$strip>;
186
+ }, z.core.$strip>, z.ZodObject<{
187
+ v: z.ZodLiteral<1>;
188
+ kind: z.ZodLiteral<"cmd">;
189
+ reqId: z.ZodString;
190
+ type: z.ZodLiteral<"session.attach">;
191
+ payload: z.ZodObject<{
192
+ sessionId: z.ZodString;
193
+ afterSeq: z.ZodOptional<z.ZodNumber>;
194
+ clientId: z.ZodOptional<z.ZodString>;
195
+ }, z.core.$strip>;
196
+ }, z.core.$strip>, z.ZodObject<{
197
+ v: z.ZodLiteral<1>;
198
+ kind: z.ZodLiteral<"cmd">;
199
+ reqId: z.ZodString;
200
+ type: z.ZodLiteral<"session.detach">;
201
+ payload: z.ZodObject<{
202
+ sessionId: z.ZodString;
203
+ clientId: z.ZodOptional<z.ZodString>;
204
+ }, z.core.$strip>;
205
+ }, z.core.$strip>, z.ZodObject<{
206
+ v: z.ZodLiteral<1>;
207
+ kind: z.ZodLiteral<"cmd">;
208
+ reqId: z.ZodString;
209
+ type: z.ZodLiteral<"session.send">;
210
+ payload: z.ZodObject<{
211
+ sessionId: z.ZodString;
212
+ input: z.ZodObject<{
213
+ text: z.ZodString;
214
+ }, z.core.$strip>;
215
+ }, z.core.$strip>;
216
+ }, z.core.$strip>, z.ZodObject<{
217
+ v: z.ZodLiteral<1>;
218
+ kind: z.ZodLiteral<"cmd">;
219
+ reqId: z.ZodString;
220
+ type: z.ZodLiteral<"session.interrupt">;
221
+ payload: z.ZodObject<{
222
+ sessionId: z.ZodString;
223
+ }, z.core.$strip>;
224
+ }, z.core.$strip>, z.ZodObject<{
225
+ v: z.ZodLiteral<1>;
226
+ kind: z.ZodLiteral<"cmd">;
227
+ reqId: z.ZodString;
228
+ type: z.ZodLiteral<"session.close">;
229
+ payload: z.ZodObject<{
230
+ sessionId: z.ZodString;
231
+ }, z.core.$strip>;
232
+ }, z.core.$strip>, z.ZodObject<{
233
+ v: z.ZodLiteral<1>;
234
+ kind: z.ZodLiteral<"cmd">;
235
+ reqId: z.ZodString;
236
+ type: z.ZodLiteral<"session.configure">;
237
+ payload: z.ZodObject<{
238
+ sessionId: z.ZodString;
239
+ autoApprove: z.ZodOptional<z.ZodEnum<{
240
+ all: "all";
241
+ edits: "edits";
242
+ off: "off";
243
+ }>>;
244
+ }, z.core.$strip>;
245
+ }, z.core.$strip>, z.ZodObject<{
246
+ v: z.ZodLiteral<1>;
247
+ kind: z.ZodLiteral<"cmd">;
248
+ reqId: z.ZodString;
249
+ type: z.ZodLiteral<"input.respond">;
250
+ payload: z.ZodObject<{
251
+ sessionId: z.ZodString;
252
+ requestId: z.ZodString;
253
+ decisionId: z.ZodString;
254
+ answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
255
+ }, z.core.$strip>;
256
+ }, z.core.$strip>, z.ZodObject<{
257
+ v: z.ZodLiteral<1>;
258
+ kind: z.ZodLiteral<"cmd">;
259
+ reqId: z.ZodString;
260
+ type: z.ZodLiteral<"terminal.resize">;
261
+ payload: z.ZodObject<{
262
+ cols: z.ZodNumber;
263
+ rows: z.ZodNumber;
264
+ sessionId: z.ZodString;
265
+ }, z.core.$strip>;
266
+ }, z.core.$strip>, z.ZodObject<{
267
+ v: z.ZodLiteral<1>;
268
+ kind: z.ZodLiteral<"cmd">;
269
+ reqId: z.ZodString;
270
+ type: z.ZodLiteral<"terminal.ack">;
271
+ payload: z.ZodObject<{
272
+ sessionId: z.ZodString;
273
+ clientId: z.ZodString;
274
+ bytes: z.ZodNumber;
275
+ }, z.core.$strip>;
276
+ }, z.core.$strip>, z.ZodObject<{
277
+ v: z.ZodLiteral<1>;
278
+ kind: z.ZodLiteral<"cmd">;
279
+ reqId: z.ZodString;
280
+ type: z.ZodLiteral<"terminal.kill">;
281
+ payload: z.ZodObject<{
282
+ sessionId: z.ZodString;
283
+ }, z.core.$strip>;
284
+ }, z.core.$strip>], "type">;
285
+ export type Command = z.infer<typeof Command>;
286
+ export type CommandType = Command["type"];
287
+ export type CommandOf<T extends CommandType> = Extract<Command, {
288
+ type: T;
289
+ }>;
290
+ export type CommandPayload<T extends CommandType> = CommandOf<T>["payload"];
291
+ type Empty = Record<string, never>;
292
+ export interface CommandResults {
293
+ "host.info": HostInfo;
294
+ "session.list": {
295
+ sessions: SessionInfo[];
296
+ };
297
+ /** The creating connection is attached to the new session automatically. */
298
+ "session.create": {
299
+ session: SessionInfo;
300
+ };
301
+ /**
302
+ * Agent sessions: missed durable events follow; `gap` says some were evicted.
303
+ * Terminal sessions: a terminal.reset event and the current screen follow; gap is false.
304
+ */
305
+ "session.attach": {
306
+ session: SessionInfo;
307
+ gap: boolean;
308
+ oldestSeq: number;
309
+ replayed: number;
310
+ };
311
+ "session.detach": Empty;
312
+ "session.send": Empty;
313
+ "session.interrupt": Empty;
314
+ "session.close": Empty;
315
+ "session.configure": {
316
+ session: SessionInfo;
317
+ };
318
+ "input.respond": Empty;
319
+ "terminal.resize": {
320
+ session: SessionInfo;
321
+ };
322
+ "terminal.ack": Empty;
323
+ "terminal.kill": Empty;
324
+ }
325
+ export declare const ErrorCode: z.ZodEnum<{
326
+ bad_request: "bad_request";
327
+ conflict: "conflict";
328
+ forbidden: "forbidden";
329
+ internal: "internal";
330
+ not_found: "not_found";
331
+ unsupported: "unsupported";
332
+ }>;
333
+ export type ErrorCode = z.infer<typeof ErrorCode>;
334
+ export declare const Response: z.ZodUnion<readonly [z.ZodObject<{
335
+ v: z.ZodLiteral<1>;
336
+ kind: z.ZodLiteral<"res">;
337
+ reqId: z.ZodString;
338
+ ok: z.ZodLiteral<true>;
339
+ result: z.ZodUnknown;
340
+ }, z.core.$strip>, z.ZodObject<{
341
+ v: z.ZodLiteral<1>;
342
+ kind: z.ZodLiteral<"res">;
343
+ reqId: z.ZodString;
344
+ ok: z.ZodLiteral<false>;
345
+ error: z.ZodObject<{
346
+ code: z.ZodEnum<{
347
+ bad_request: "bad_request";
348
+ conflict: "conflict";
349
+ forbidden: "forbidden";
350
+ internal: "internal";
351
+ not_found: "not_found";
352
+ unsupported: "unsupported";
353
+ }>;
354
+ message: z.ZodString;
355
+ }, z.core.$strip>;
356
+ }, z.core.$strip>]>;
357
+ export type Response = z.infer<typeof Response>;
358
+ /** Everything a host sends to a client as JSON. Terminal bytes travel as binary frames. */
359
+ export declare const HostMessage: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
360
+ v: z.ZodLiteral<1>;
361
+ kind: z.ZodLiteral<"evt">;
362
+ type: z.ZodLiteral<"host.ready">;
363
+ ts: z.ZodNumber;
364
+ sessionId: z.ZodOptional<z.ZodString>;
365
+ seq: z.ZodOptional<z.ZodNumber>;
366
+ payload: z.ZodObject<{
367
+ hostId: z.ZodString;
368
+ name: z.ZodString;
369
+ version: z.ZodString;
370
+ protocol: z.ZodLiteral<1>;
371
+ os: z.ZodString;
372
+ providers: z.ZodArray<z.ZodObject<{
373
+ id: z.ZodString;
374
+ kind: z.ZodEnum<{
375
+ agent: "agent";
376
+ terminal: "terminal";
377
+ }>;
378
+ label: z.ZodString;
379
+ available: z.ZodBoolean;
380
+ version: z.ZodNullable<z.ZodString>;
381
+ detail: z.ZodNullable<z.ZodString>;
382
+ }, z.core.$strip>>;
383
+ roots: z.ZodOptional<z.ZodArray<z.ZodString>>;
384
+ }, z.core.$strip>;
385
+ }, z.core.$strip>, z.ZodObject<{
386
+ v: z.ZodLiteral<1>;
387
+ kind: z.ZodLiteral<"evt">;
388
+ type: z.ZodLiteral<"session.created">;
389
+ ts: z.ZodNumber;
390
+ sessionId: z.ZodOptional<z.ZodString>;
391
+ seq: z.ZodOptional<z.ZodNumber>;
392
+ payload: z.ZodObject<{
393
+ session: z.ZodObject<{
394
+ id: z.ZodString;
395
+ kind: z.ZodEnum<{
396
+ agent: "agent";
397
+ terminal: "terminal";
398
+ }>;
399
+ provider: z.ZodString;
400
+ providerSessionId: z.ZodNullable<z.ZodString>;
401
+ cwd: z.ZodString;
402
+ title: z.ZodNullable<z.ZodString>;
403
+ status: z.ZodEnum<{
404
+ closed: "closed";
405
+ idle: "idle";
406
+ running: "running";
407
+ starting: "starting";
408
+ waiting_input: "waiting_input";
409
+ }>;
410
+ createdAt: z.ZodNumber;
411
+ updatedAt: z.ZodNumber;
412
+ lastSeq: z.ZodNumber;
413
+ autoApprove: z.ZodOptional<z.ZodEnum<{
414
+ all: "all";
415
+ edits: "edits";
416
+ off: "off";
417
+ }>>;
418
+ cols: z.ZodOptional<z.ZodNumber>;
419
+ rows: z.ZodOptional<z.ZodNumber>;
420
+ pid: z.ZodOptional<z.ZodNumber>;
421
+ exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
422
+ }, z.core.$strip>;
423
+ }, z.core.$strip>;
424
+ }, z.core.$strip>, z.ZodObject<{
425
+ v: z.ZodLiteral<1>;
426
+ kind: z.ZodLiteral<"evt">;
427
+ type: z.ZodLiteral<"session.updated">;
428
+ ts: z.ZodNumber;
429
+ sessionId: z.ZodOptional<z.ZodString>;
430
+ seq: z.ZodOptional<z.ZodNumber>;
431
+ payload: z.ZodObject<{
432
+ session: z.ZodObject<{
433
+ id: z.ZodString;
434
+ kind: z.ZodEnum<{
435
+ agent: "agent";
436
+ terminal: "terminal";
437
+ }>;
438
+ provider: z.ZodString;
439
+ providerSessionId: z.ZodNullable<z.ZodString>;
440
+ cwd: z.ZodString;
441
+ title: z.ZodNullable<z.ZodString>;
442
+ status: z.ZodEnum<{
443
+ closed: "closed";
444
+ idle: "idle";
445
+ running: "running";
446
+ starting: "starting";
447
+ waiting_input: "waiting_input";
448
+ }>;
449
+ createdAt: z.ZodNumber;
450
+ updatedAt: z.ZodNumber;
451
+ lastSeq: z.ZodNumber;
452
+ autoApprove: z.ZodOptional<z.ZodEnum<{
453
+ all: "all";
454
+ edits: "edits";
455
+ off: "off";
456
+ }>>;
457
+ cols: z.ZodOptional<z.ZodNumber>;
458
+ rows: z.ZodOptional<z.ZodNumber>;
459
+ pid: z.ZodOptional<z.ZodNumber>;
460
+ exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
461
+ }, z.core.$strip>;
462
+ }, z.core.$strip>;
463
+ }, z.core.$strip>, z.ZodObject<{
464
+ v: z.ZodLiteral<1>;
465
+ kind: z.ZodLiteral<"evt">;
466
+ type: z.ZodLiteral<"session.closed">;
467
+ ts: z.ZodNumber;
468
+ sessionId: z.ZodOptional<z.ZodString>;
469
+ seq: z.ZodOptional<z.ZodNumber>;
470
+ payload: z.ZodObject<{
471
+ session: z.ZodObject<{
472
+ id: z.ZodString;
473
+ kind: z.ZodEnum<{
474
+ agent: "agent";
475
+ terminal: "terminal";
476
+ }>;
477
+ provider: z.ZodString;
478
+ providerSessionId: z.ZodNullable<z.ZodString>;
479
+ cwd: z.ZodString;
480
+ title: z.ZodNullable<z.ZodString>;
481
+ status: z.ZodEnum<{
482
+ closed: "closed";
483
+ idle: "idle";
484
+ running: "running";
485
+ starting: "starting";
486
+ waiting_input: "waiting_input";
487
+ }>;
488
+ createdAt: z.ZodNumber;
489
+ updatedAt: z.ZodNumber;
490
+ lastSeq: z.ZodNumber;
491
+ autoApprove: z.ZodOptional<z.ZodEnum<{
492
+ all: "all";
493
+ edits: "edits";
494
+ off: "off";
495
+ }>>;
496
+ cols: z.ZodOptional<z.ZodNumber>;
497
+ rows: z.ZodOptional<z.ZodNumber>;
498
+ pid: z.ZodOptional<z.ZodNumber>;
499
+ exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
500
+ }, z.core.$strip>;
501
+ reason: z.ZodNullable<z.ZodString>;
502
+ exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
503
+ }, z.core.$strip>;
504
+ }, z.core.$strip>, z.ZodObject<{
505
+ v: z.ZodLiteral<1>;
506
+ kind: z.ZodLiteral<"evt">;
507
+ type: z.ZodLiteral<"turn.started">;
508
+ ts: z.ZodNumber;
509
+ sessionId: z.ZodOptional<z.ZodString>;
510
+ seq: z.ZodOptional<z.ZodNumber>;
511
+ payload: z.ZodObject<{
512
+ turnId: z.ZodString;
513
+ userItemId: z.ZodOptional<z.ZodString>;
514
+ }, z.core.$strip>;
515
+ }, z.core.$strip>, z.ZodObject<{
516
+ v: z.ZodLiteral<1>;
517
+ kind: z.ZodLiteral<"evt">;
518
+ type: z.ZodLiteral<"turn.completed">;
519
+ ts: z.ZodNumber;
520
+ sessionId: z.ZodOptional<z.ZodString>;
521
+ seq: z.ZodOptional<z.ZodNumber>;
522
+ payload: z.ZodObject<{
523
+ turnId: z.ZodString;
524
+ status: z.ZodEnum<{
525
+ completed: "completed";
526
+ failed: "failed";
527
+ interrupted: "interrupted";
528
+ }>;
529
+ usage: z.ZodOptional<z.ZodObject<{
530
+ inputTokens: z.ZodNumber;
531
+ outputTokens: z.ZodNumber;
532
+ costUsd: z.ZodOptional<z.ZodNumber>;
533
+ }, z.core.$strip>>;
534
+ error: z.ZodOptional<z.ZodString>;
535
+ }, z.core.$strip>;
536
+ }, z.core.$strip>, z.ZodObject<{
537
+ v: z.ZodLiteral<1>;
538
+ kind: z.ZodLiteral<"evt">;
539
+ type: z.ZodLiteral<"item.started">;
540
+ ts: z.ZodNumber;
541
+ sessionId: z.ZodOptional<z.ZodString>;
542
+ seq: z.ZodOptional<z.ZodNumber>;
543
+ payload: z.ZodObject<{
544
+ turnId: z.ZodNullable<z.ZodString>;
545
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
546
+ id: z.ZodString;
547
+ status: z.ZodEnum<{
548
+ completed: "completed";
549
+ declined: "declined";
550
+ failed: "failed";
551
+ in_progress: "in_progress";
552
+ interrupted: "interrupted";
553
+ }>;
554
+ kind: z.ZodLiteral<"message">;
555
+ role: z.ZodEnum<{
556
+ assistant: "assistant";
557
+ user: "user";
558
+ }>;
559
+ text: z.ZodString;
560
+ }, z.core.$strip>, z.ZodObject<{
561
+ id: z.ZodString;
562
+ status: z.ZodEnum<{
563
+ completed: "completed";
564
+ declined: "declined";
565
+ failed: "failed";
566
+ in_progress: "in_progress";
567
+ interrupted: "interrupted";
568
+ }>;
569
+ kind: z.ZodLiteral<"reasoning">;
570
+ text: z.ZodString;
571
+ }, z.core.$strip>, z.ZodObject<{
572
+ id: z.ZodString;
573
+ status: z.ZodEnum<{
574
+ completed: "completed";
575
+ declined: "declined";
576
+ failed: "failed";
577
+ in_progress: "in_progress";
578
+ interrupted: "interrupted";
579
+ }>;
580
+ kind: z.ZodLiteral<"command">;
581
+ command: z.ZodString;
582
+ display: z.ZodOptional<z.ZodString>;
583
+ cwd: z.ZodOptional<z.ZodString>;
584
+ output: z.ZodOptional<z.ZodString>;
585
+ exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
586
+ }, z.core.$strip>, z.ZodObject<{
587
+ id: z.ZodString;
588
+ status: z.ZodEnum<{
589
+ completed: "completed";
590
+ declined: "declined";
591
+ failed: "failed";
592
+ in_progress: "in_progress";
593
+ interrupted: "interrupted";
594
+ }>;
595
+ kind: z.ZodLiteral<"file_change">;
596
+ changes: z.ZodArray<z.ZodObject<{
597
+ path: z.ZodString;
598
+ action: z.ZodEnum<{
599
+ add: "add";
600
+ delete: "delete";
601
+ modify: "modify";
602
+ rename: "rename";
603
+ }>;
604
+ movePath: z.ZodOptional<z.ZodString>;
605
+ diff: z.ZodOptional<z.ZodString>;
606
+ }, z.core.$strip>>;
607
+ }, z.core.$strip>, z.ZodObject<{
608
+ id: z.ZodString;
609
+ status: z.ZodEnum<{
610
+ completed: "completed";
611
+ declined: "declined";
612
+ failed: "failed";
613
+ in_progress: "in_progress";
614
+ interrupted: "interrupted";
615
+ }>;
616
+ kind: z.ZodLiteral<"tool">;
617
+ name: z.ZodString;
618
+ input: z.ZodOptional<z.ZodUnknown>;
619
+ output: z.ZodOptional<z.ZodUnknown>;
620
+ }, z.core.$strip>, z.ZodObject<{
621
+ id: z.ZodString;
622
+ status: z.ZodEnum<{
623
+ completed: "completed";
624
+ declined: "declined";
625
+ failed: "failed";
626
+ in_progress: "in_progress";
627
+ interrupted: "interrupted";
628
+ }>;
629
+ kind: z.ZodLiteral<"todo">;
630
+ entries: z.ZodArray<z.ZodObject<{
631
+ text: z.ZodString;
632
+ done: z.ZodBoolean;
633
+ }, z.core.$strip>>;
634
+ }, z.core.$strip>], "kind">;
635
+ }, z.core.$strip>;
636
+ }, z.core.$strip>, z.ZodObject<{
637
+ v: z.ZodLiteral<1>;
638
+ kind: z.ZodLiteral<"evt">;
639
+ type: z.ZodLiteral<"item.delta">;
640
+ ts: z.ZodNumber;
641
+ sessionId: z.ZodOptional<z.ZodString>;
642
+ seq: z.ZodOptional<z.ZodNumber>;
643
+ payload: z.ZodObject<{
644
+ itemId: z.ZodString;
645
+ field: z.ZodEnum<{
646
+ output: "output";
647
+ text: "text";
648
+ }>;
649
+ delta: z.ZodString;
650
+ }, z.core.$strip>;
651
+ }, z.core.$strip>, z.ZodObject<{
652
+ v: z.ZodLiteral<1>;
653
+ kind: z.ZodLiteral<"evt">;
654
+ type: z.ZodLiteral<"item.updated">;
655
+ ts: z.ZodNumber;
656
+ sessionId: z.ZodOptional<z.ZodString>;
657
+ seq: z.ZodOptional<z.ZodNumber>;
658
+ payload: z.ZodObject<{
659
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
660
+ id: z.ZodString;
661
+ status: z.ZodEnum<{
662
+ completed: "completed";
663
+ declined: "declined";
664
+ failed: "failed";
665
+ in_progress: "in_progress";
666
+ interrupted: "interrupted";
667
+ }>;
668
+ kind: z.ZodLiteral<"message">;
669
+ role: z.ZodEnum<{
670
+ assistant: "assistant";
671
+ user: "user";
672
+ }>;
673
+ text: z.ZodString;
674
+ }, z.core.$strip>, z.ZodObject<{
675
+ id: z.ZodString;
676
+ status: z.ZodEnum<{
677
+ completed: "completed";
678
+ declined: "declined";
679
+ failed: "failed";
680
+ in_progress: "in_progress";
681
+ interrupted: "interrupted";
682
+ }>;
683
+ kind: z.ZodLiteral<"reasoning">;
684
+ text: z.ZodString;
685
+ }, z.core.$strip>, z.ZodObject<{
686
+ id: z.ZodString;
687
+ status: z.ZodEnum<{
688
+ completed: "completed";
689
+ declined: "declined";
690
+ failed: "failed";
691
+ in_progress: "in_progress";
692
+ interrupted: "interrupted";
693
+ }>;
694
+ kind: z.ZodLiteral<"command">;
695
+ command: z.ZodString;
696
+ display: z.ZodOptional<z.ZodString>;
697
+ cwd: z.ZodOptional<z.ZodString>;
698
+ output: z.ZodOptional<z.ZodString>;
699
+ exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
700
+ }, z.core.$strip>, z.ZodObject<{
701
+ id: z.ZodString;
702
+ status: z.ZodEnum<{
703
+ completed: "completed";
704
+ declined: "declined";
705
+ failed: "failed";
706
+ in_progress: "in_progress";
707
+ interrupted: "interrupted";
708
+ }>;
709
+ kind: z.ZodLiteral<"file_change">;
710
+ changes: z.ZodArray<z.ZodObject<{
711
+ path: z.ZodString;
712
+ action: z.ZodEnum<{
713
+ add: "add";
714
+ delete: "delete";
715
+ modify: "modify";
716
+ rename: "rename";
717
+ }>;
718
+ movePath: z.ZodOptional<z.ZodString>;
719
+ diff: z.ZodOptional<z.ZodString>;
720
+ }, z.core.$strip>>;
721
+ }, z.core.$strip>, z.ZodObject<{
722
+ id: z.ZodString;
723
+ status: z.ZodEnum<{
724
+ completed: "completed";
725
+ declined: "declined";
726
+ failed: "failed";
727
+ in_progress: "in_progress";
728
+ interrupted: "interrupted";
729
+ }>;
730
+ kind: z.ZodLiteral<"tool">;
731
+ name: z.ZodString;
732
+ input: z.ZodOptional<z.ZodUnknown>;
733
+ output: z.ZodOptional<z.ZodUnknown>;
734
+ }, z.core.$strip>, z.ZodObject<{
735
+ id: z.ZodString;
736
+ status: z.ZodEnum<{
737
+ completed: "completed";
738
+ declined: "declined";
739
+ failed: "failed";
740
+ in_progress: "in_progress";
741
+ interrupted: "interrupted";
742
+ }>;
743
+ kind: z.ZodLiteral<"todo">;
744
+ entries: z.ZodArray<z.ZodObject<{
745
+ text: z.ZodString;
746
+ done: z.ZodBoolean;
747
+ }, z.core.$strip>>;
748
+ }, z.core.$strip>], "kind">;
749
+ }, z.core.$strip>;
750
+ }, z.core.$strip>, z.ZodObject<{
751
+ v: z.ZodLiteral<1>;
752
+ kind: z.ZodLiteral<"evt">;
753
+ type: z.ZodLiteral<"item.completed">;
754
+ ts: z.ZodNumber;
755
+ sessionId: z.ZodOptional<z.ZodString>;
756
+ seq: z.ZodOptional<z.ZodNumber>;
757
+ payload: z.ZodObject<{
758
+ turnId: z.ZodNullable<z.ZodString>;
759
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
760
+ id: z.ZodString;
761
+ status: z.ZodEnum<{
762
+ completed: "completed";
763
+ declined: "declined";
764
+ failed: "failed";
765
+ in_progress: "in_progress";
766
+ interrupted: "interrupted";
767
+ }>;
768
+ kind: z.ZodLiteral<"message">;
769
+ role: z.ZodEnum<{
770
+ assistant: "assistant";
771
+ user: "user";
772
+ }>;
773
+ text: z.ZodString;
774
+ }, z.core.$strip>, z.ZodObject<{
775
+ id: z.ZodString;
776
+ status: z.ZodEnum<{
777
+ completed: "completed";
778
+ declined: "declined";
779
+ failed: "failed";
780
+ in_progress: "in_progress";
781
+ interrupted: "interrupted";
782
+ }>;
783
+ kind: z.ZodLiteral<"reasoning">;
784
+ text: z.ZodString;
785
+ }, z.core.$strip>, z.ZodObject<{
786
+ id: z.ZodString;
787
+ status: z.ZodEnum<{
788
+ completed: "completed";
789
+ declined: "declined";
790
+ failed: "failed";
791
+ in_progress: "in_progress";
792
+ interrupted: "interrupted";
793
+ }>;
794
+ kind: z.ZodLiteral<"command">;
795
+ command: z.ZodString;
796
+ display: z.ZodOptional<z.ZodString>;
797
+ cwd: z.ZodOptional<z.ZodString>;
798
+ output: z.ZodOptional<z.ZodString>;
799
+ exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
800
+ }, z.core.$strip>, z.ZodObject<{
801
+ id: z.ZodString;
802
+ status: z.ZodEnum<{
803
+ completed: "completed";
804
+ declined: "declined";
805
+ failed: "failed";
806
+ in_progress: "in_progress";
807
+ interrupted: "interrupted";
808
+ }>;
809
+ kind: z.ZodLiteral<"file_change">;
810
+ changes: z.ZodArray<z.ZodObject<{
811
+ path: z.ZodString;
812
+ action: z.ZodEnum<{
813
+ add: "add";
814
+ delete: "delete";
815
+ modify: "modify";
816
+ rename: "rename";
817
+ }>;
818
+ movePath: z.ZodOptional<z.ZodString>;
819
+ diff: z.ZodOptional<z.ZodString>;
820
+ }, z.core.$strip>>;
821
+ }, z.core.$strip>, z.ZodObject<{
822
+ id: z.ZodString;
823
+ status: z.ZodEnum<{
824
+ completed: "completed";
825
+ declined: "declined";
826
+ failed: "failed";
827
+ in_progress: "in_progress";
828
+ interrupted: "interrupted";
829
+ }>;
830
+ kind: z.ZodLiteral<"tool">;
831
+ name: z.ZodString;
832
+ input: z.ZodOptional<z.ZodUnknown>;
833
+ output: z.ZodOptional<z.ZodUnknown>;
834
+ }, z.core.$strip>, z.ZodObject<{
835
+ id: z.ZodString;
836
+ status: z.ZodEnum<{
837
+ completed: "completed";
838
+ declined: "declined";
839
+ failed: "failed";
840
+ in_progress: "in_progress";
841
+ interrupted: "interrupted";
842
+ }>;
843
+ kind: z.ZodLiteral<"todo">;
844
+ entries: z.ZodArray<z.ZodObject<{
845
+ text: z.ZodString;
846
+ done: z.ZodBoolean;
847
+ }, z.core.$strip>>;
848
+ }, z.core.$strip>], "kind">;
849
+ }, z.core.$strip>;
850
+ }, z.core.$strip>, z.ZodObject<{
851
+ v: z.ZodLiteral<1>;
852
+ kind: z.ZodLiteral<"evt">;
853
+ type: z.ZodLiteral<"input.required">;
854
+ ts: z.ZodNumber;
855
+ sessionId: z.ZodOptional<z.ZodString>;
856
+ seq: z.ZodOptional<z.ZodNumber>;
857
+ payload: z.ZodObject<{
858
+ request: z.ZodObject<{
859
+ requestId: z.ZodString;
860
+ kind: z.ZodEnum<{
861
+ command_approval: "command_approval";
862
+ file_approval: "file_approval";
863
+ plan_approval: "plan_approval";
864
+ question: "question";
865
+ tool_approval: "tool_approval";
866
+ }>;
867
+ itemId: z.ZodOptional<z.ZodString>;
868
+ title: z.ZodString;
869
+ body: z.ZodOptional<z.ZodString>;
870
+ command: z.ZodOptional<z.ZodString>;
871
+ cwd: z.ZodOptional<z.ZodString>;
872
+ changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
873
+ path: z.ZodString;
874
+ action: z.ZodEnum<{
875
+ add: "add";
876
+ delete: "delete";
877
+ modify: "modify";
878
+ rename: "rename";
879
+ }>;
880
+ movePath: z.ZodOptional<z.ZodString>;
881
+ diff: z.ZodOptional<z.ZodString>;
882
+ }, z.core.$strip>>>;
883
+ toolName: z.ZodOptional<z.ZodString>;
884
+ toolInput: z.ZodOptional<z.ZodUnknown>;
885
+ questions: z.ZodOptional<z.ZodArray<z.ZodObject<{
886
+ id: z.ZodString;
887
+ question: z.ZodString;
888
+ options: z.ZodArray<z.ZodObject<{
889
+ label: z.ZodString;
890
+ description: z.ZodOptional<z.ZodString>;
891
+ }, z.core.$strip>>;
892
+ multiSelect: z.ZodBoolean;
893
+ }, z.core.$strip>>>;
894
+ decisions: z.ZodArray<z.ZodObject<{
895
+ id: z.ZodString;
896
+ label: z.ZodString;
897
+ effect: z.ZodEnum<{
898
+ allow: "allow";
899
+ allow_session: "allow_session";
900
+ cancel: "cancel";
901
+ deny: "deny";
902
+ }>;
903
+ }, z.core.$strip>>;
904
+ }, z.core.$strip>;
905
+ }, z.core.$strip>;
906
+ }, z.core.$strip>, z.ZodObject<{
907
+ v: z.ZodLiteral<1>;
908
+ kind: z.ZodLiteral<"evt">;
909
+ type: z.ZodLiteral<"input.resolved">;
910
+ ts: z.ZodNumber;
911
+ sessionId: z.ZodOptional<z.ZodString>;
912
+ seq: z.ZodOptional<z.ZodNumber>;
913
+ payload: z.ZodObject<{
914
+ requestId: z.ZodString;
915
+ decisionId: z.ZodNullable<z.ZodString>;
916
+ effect: z.ZodEnum<{
917
+ allow: "allow";
918
+ allow_session: "allow_session";
919
+ cancel: "cancel";
920
+ deny: "deny";
921
+ }>;
922
+ by: z.ZodEnum<{
923
+ host: "host";
924
+ policy: "policy";
925
+ user: "user";
926
+ }>;
927
+ }, z.core.$strip>;
928
+ }, z.core.$strip>, z.ZodObject<{
929
+ v: z.ZodLiteral<1>;
930
+ kind: z.ZodLiteral<"evt">;
931
+ type: z.ZodLiteral<"error">;
932
+ ts: z.ZodNumber;
933
+ sessionId: z.ZodOptional<z.ZodString>;
934
+ seq: z.ZodOptional<z.ZodNumber>;
935
+ payload: z.ZodObject<{
936
+ code: z.ZodString;
937
+ message: z.ZodString;
938
+ }, z.core.$strip>;
939
+ }, z.core.$strip>, z.ZodObject<{
940
+ v: z.ZodLiteral<1>;
941
+ kind: z.ZodLiteral<"evt">;
942
+ type: z.ZodLiteral<"provider.event">;
943
+ ts: z.ZodNumber;
944
+ sessionId: z.ZodOptional<z.ZodString>;
945
+ seq: z.ZodOptional<z.ZodNumber>;
946
+ payload: z.ZodObject<{
947
+ name: z.ZodString;
948
+ data: z.ZodUnknown;
949
+ }, z.core.$strip>;
950
+ }, z.core.$strip>, z.ZodObject<{
951
+ v: z.ZodLiteral<1>;
952
+ kind: z.ZodLiteral<"evt">;
953
+ type: z.ZodLiteral<"terminal.size">;
954
+ ts: z.ZodNumber;
955
+ sessionId: z.ZodOptional<z.ZodString>;
956
+ seq: z.ZodOptional<z.ZodNumber>;
957
+ payload: z.ZodObject<{
958
+ cols: z.ZodNumber;
959
+ rows: z.ZodNumber;
960
+ }, z.core.$strip>;
961
+ }, z.core.$strip>, z.ZodObject<{
962
+ v: z.ZodLiteral<1>;
963
+ kind: z.ZodLiteral<"evt">;
964
+ type: z.ZodLiteral<"terminal.reset">;
965
+ ts: z.ZodNumber;
966
+ sessionId: z.ZodOptional<z.ZodString>;
967
+ seq: z.ZodOptional<z.ZodNumber>;
968
+ payload: z.ZodObject<{
969
+ cols: z.ZodNumber;
970
+ rows: z.ZodNumber;
971
+ }, z.core.$strip>;
972
+ }, z.core.$strip>], "type">, z.ZodUnion<readonly [z.ZodObject<{
973
+ v: z.ZodLiteral<1>;
974
+ kind: z.ZodLiteral<"res">;
975
+ reqId: z.ZodString;
976
+ ok: z.ZodLiteral<true>;
977
+ result: z.ZodUnknown;
978
+ }, z.core.$strip>, z.ZodObject<{
979
+ v: z.ZodLiteral<1>;
980
+ kind: z.ZodLiteral<"res">;
981
+ reqId: z.ZodString;
982
+ ok: z.ZodLiteral<false>;
983
+ error: z.ZodObject<{
984
+ code: z.ZodEnum<{
985
+ bad_request: "bad_request";
986
+ conflict: "conflict";
987
+ forbidden: "forbidden";
988
+ internal: "internal";
989
+ not_found: "not_found";
990
+ unsupported: "unsupported";
991
+ }>;
992
+ message: z.ZodString;
993
+ }, z.core.$strip>;
994
+ }, z.core.$strip>]>]>;
995
+ export type HostMessage = z.infer<typeof HostMessage>;
996
+ export {};
997
+ //# sourceMappingURL=commands.d.ts.map