@bridge4dev/runner 0.11.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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/dist/adapters/claude.d.ts +19 -0
  4. package/dist/adapters/claude.js +631 -0
  5. package/dist/adapters/codex-home.d.ts +61 -0
  6. package/dist/adapters/codex-home.js +234 -0
  7. package/dist/adapters/codex-protocol.d.ts +59 -0
  8. package/dist/adapters/codex-protocol.js +204 -0
  9. package/dist/adapters/codex.d.ts +61 -0
  10. package/dist/adapters/codex.js +1406 -0
  11. package/dist/adapters/types.d.ts +183 -0
  12. package/dist/adapters/types.js +5 -0
  13. package/dist/async-queue.d.ts +11 -0
  14. package/dist/async-queue.js +50 -0
  15. package/dist/attachments.d.ts +72 -0
  16. package/dist/attachments.js +149 -0
  17. package/dist/auth-relay.d.ts +57 -0
  18. package/dist/auth-relay.js +289 -0
  19. package/dist/config.d.ts +96 -0
  20. package/dist/config.js +73 -0
  21. package/dist/fsview.d.ts +20 -0
  22. package/dist/fsview.js +122 -0
  23. package/dist/git.d.ts +54 -0
  24. package/dist/git.js +168 -0
  25. package/dist/gitops.d.ts +136 -0
  26. package/dist/gitops.js +596 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.js +352 -0
  29. package/dist/journal.d.ts +118 -0
  30. package/dist/journal.js +300 -0
  31. package/dist/log.d.ts +7 -0
  32. package/dist/log.js +19 -0
  33. package/dist/paths.d.ts +7 -0
  34. package/dist/paths.js +33 -0
  35. package/dist/policy.d.ts +17 -0
  36. package/dist/policy.js +272 -0
  37. package/dist/protocol.d.ts +754 -0
  38. package/dist/protocol.js +154 -0
  39. package/dist/self-update.d.ts +75 -0
  40. package/dist/self-update.js +221 -0
  41. package/dist/status-file.d.ts +14 -0
  42. package/dist/status-file.js +29 -0
  43. package/dist/supervisor.d.ts +216 -0
  44. package/dist/supervisor.js +1648 -0
  45. package/dist/version.d.ts +2 -0
  46. package/dist/version.js +3 -0
  47. package/dist/ws-client.d.ts +30 -0
  48. package/dist/ws-client.js +171 -0
  49. package/package.json +52 -0
@@ -0,0 +1,754 @@
1
+ import { z } from 'zod';
2
+ export declare const SessionDescriptorSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ kind: z.ZodEnum<["TICKET", "CHAT"]>;
5
+ agent: z.ZodEnum<["CLAUDE", "CODEX"]>;
6
+ status: z.ZodEnum<["STARTING", "RUNNING", "WAITING_INPUT", "WAITING_PERMISSION", "REVIEW", "DONE", "FAILED", "STOPPED"]>;
7
+ prompt: z.ZodString;
8
+ providerSessionId: z.ZodNullable<z.ZodString>;
9
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ask", "plan", "auto", "full"]>>>;
10
+ model: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
11
+ effort: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
12
+ lastSeq: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
13
+ costUsd: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
14
+ epoch: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
15
+ activeMsBase: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
16
+ extraBudgetMinutes: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
17
+ workspace: z.ZodObject<{
18
+ id: z.ZodString;
19
+ path: z.ZodString;
20
+ projectId: z.ZodString;
21
+ trustMode: z.ZodEnum<["STRICT", "NORMAL", "AUTO"]>;
22
+ budgetUsd: z.ZodNullable<z.ZodNumber>;
23
+ budgetMinutes: z.ZodNullable<z.ZodNumber>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ path: string;
26
+ id: string;
27
+ projectId: string;
28
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
29
+ budgetUsd: number | null;
30
+ budgetMinutes: number | null;
31
+ }, {
32
+ path: string;
33
+ id: string;
34
+ projectId: string;
35
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
36
+ budgetUsd: number | null;
37
+ budgetMinutes: number | null;
38
+ }>;
39
+ tickets: z.ZodArray<z.ZodObject<{
40
+ id: z.ZodString;
41
+ number: z.ZodNumber;
42
+ title: z.ZodString;
43
+ }, "strip", z.ZodTypeAny, {
44
+ number: number;
45
+ id: string;
46
+ title: string;
47
+ }, {
48
+ number: number;
49
+ id: string;
50
+ title: string;
51
+ }>, "many">;
52
+ branchHint: z.ZodCatch<z.ZodOptional<z.ZodString>>;
53
+ mcp: z.ZodOptional<z.ZodObject<{
54
+ url: z.ZodString;
55
+ token: z.ZodString;
56
+ }, "strip", z.ZodTypeAny, {
57
+ url: string;
58
+ token: string;
59
+ }, {
60
+ url: string;
61
+ token: string;
62
+ }>>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ mode: "ask" | "plan" | "auto" | "full";
65
+ status: "STARTING" | "RUNNING" | "WAITING_INPUT" | "WAITING_PERMISSION" | "REVIEW" | "DONE" | "FAILED" | "STOPPED";
66
+ agent: "CLAUDE" | "CODEX";
67
+ id: string;
68
+ kind: "TICKET" | "CHAT";
69
+ model: string | null;
70
+ effort: string | null;
71
+ epoch: number;
72
+ prompt: string;
73
+ providerSessionId: string | null;
74
+ lastSeq: number;
75
+ costUsd: number;
76
+ activeMsBase: number;
77
+ extraBudgetMinutes: number | null;
78
+ workspace: {
79
+ path: string;
80
+ id: string;
81
+ projectId: string;
82
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
83
+ budgetUsd: number | null;
84
+ budgetMinutes: number | null;
85
+ };
86
+ tickets: {
87
+ number: number;
88
+ id: string;
89
+ title: string;
90
+ }[];
91
+ mcp?: {
92
+ url: string;
93
+ token: string;
94
+ } | undefined;
95
+ branchHint?: string | undefined;
96
+ }, {
97
+ status: "STARTING" | "RUNNING" | "WAITING_INPUT" | "WAITING_PERMISSION" | "REVIEW" | "DONE" | "FAILED" | "STOPPED";
98
+ agent: "CLAUDE" | "CODEX";
99
+ id: string;
100
+ kind: "TICKET" | "CHAT";
101
+ prompt: string;
102
+ providerSessionId: string | null;
103
+ workspace: {
104
+ path: string;
105
+ id: string;
106
+ projectId: string;
107
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
108
+ budgetUsd: number | null;
109
+ budgetMinutes: number | null;
110
+ };
111
+ tickets: {
112
+ number: number;
113
+ id: string;
114
+ title: string;
115
+ }[];
116
+ mode?: "ask" | "plan" | "auto" | "full" | undefined;
117
+ mcp?: {
118
+ url: string;
119
+ token: string;
120
+ } | undefined;
121
+ model?: string | null | undefined;
122
+ effort?: string | null | undefined;
123
+ epoch?: number | undefined;
124
+ lastSeq?: number | undefined;
125
+ costUsd?: number | undefined;
126
+ activeMsBase?: number | undefined;
127
+ extraBudgetMinutes?: number | null | undefined;
128
+ branchHint?: unknown;
129
+ }>;
130
+ export type SessionDescriptor = z.infer<typeof SessionDescriptorSchema>;
131
+ export declare const GatewayFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
132
+ type: z.ZodLiteral<"hello_ack">;
133
+ serverId: z.ZodString;
134
+ serverName: z.ZodString;
135
+ maxSessions: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
136
+ sessions: z.ZodArray<z.ZodObject<{
137
+ id: z.ZodString;
138
+ kind: z.ZodEnum<["TICKET", "CHAT"]>;
139
+ agent: z.ZodEnum<["CLAUDE", "CODEX"]>;
140
+ status: z.ZodEnum<["STARTING", "RUNNING", "WAITING_INPUT", "WAITING_PERMISSION", "REVIEW", "DONE", "FAILED", "STOPPED"]>;
141
+ prompt: z.ZodString;
142
+ providerSessionId: z.ZodNullable<z.ZodString>;
143
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ask", "plan", "auto", "full"]>>>;
144
+ model: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
145
+ effort: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
146
+ lastSeq: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
147
+ costUsd: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
148
+ epoch: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
149
+ activeMsBase: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
150
+ extraBudgetMinutes: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
151
+ workspace: z.ZodObject<{
152
+ id: z.ZodString;
153
+ path: z.ZodString;
154
+ projectId: z.ZodString;
155
+ trustMode: z.ZodEnum<["STRICT", "NORMAL", "AUTO"]>;
156
+ budgetUsd: z.ZodNullable<z.ZodNumber>;
157
+ budgetMinutes: z.ZodNullable<z.ZodNumber>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ path: string;
160
+ id: string;
161
+ projectId: string;
162
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
163
+ budgetUsd: number | null;
164
+ budgetMinutes: number | null;
165
+ }, {
166
+ path: string;
167
+ id: string;
168
+ projectId: string;
169
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
170
+ budgetUsd: number | null;
171
+ budgetMinutes: number | null;
172
+ }>;
173
+ tickets: z.ZodArray<z.ZodObject<{
174
+ id: z.ZodString;
175
+ number: z.ZodNumber;
176
+ title: z.ZodString;
177
+ }, "strip", z.ZodTypeAny, {
178
+ number: number;
179
+ id: string;
180
+ title: string;
181
+ }, {
182
+ number: number;
183
+ id: string;
184
+ title: string;
185
+ }>, "many">;
186
+ branchHint: z.ZodCatch<z.ZodOptional<z.ZodString>>;
187
+ mcp: z.ZodOptional<z.ZodObject<{
188
+ url: z.ZodString;
189
+ token: z.ZodString;
190
+ }, "strip", z.ZodTypeAny, {
191
+ url: string;
192
+ token: string;
193
+ }, {
194
+ url: string;
195
+ token: string;
196
+ }>>;
197
+ }, "strip", z.ZodTypeAny, {
198
+ mode: "ask" | "plan" | "auto" | "full";
199
+ status: "STARTING" | "RUNNING" | "WAITING_INPUT" | "WAITING_PERMISSION" | "REVIEW" | "DONE" | "FAILED" | "STOPPED";
200
+ agent: "CLAUDE" | "CODEX";
201
+ id: string;
202
+ kind: "TICKET" | "CHAT";
203
+ model: string | null;
204
+ effort: string | null;
205
+ epoch: number;
206
+ prompt: string;
207
+ providerSessionId: string | null;
208
+ lastSeq: number;
209
+ costUsd: number;
210
+ activeMsBase: number;
211
+ extraBudgetMinutes: number | null;
212
+ workspace: {
213
+ path: string;
214
+ id: string;
215
+ projectId: string;
216
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
217
+ budgetUsd: number | null;
218
+ budgetMinutes: number | null;
219
+ };
220
+ tickets: {
221
+ number: number;
222
+ id: string;
223
+ title: string;
224
+ }[];
225
+ mcp?: {
226
+ url: string;
227
+ token: string;
228
+ } | undefined;
229
+ branchHint?: string | undefined;
230
+ }, {
231
+ status: "STARTING" | "RUNNING" | "WAITING_INPUT" | "WAITING_PERMISSION" | "REVIEW" | "DONE" | "FAILED" | "STOPPED";
232
+ agent: "CLAUDE" | "CODEX";
233
+ id: string;
234
+ kind: "TICKET" | "CHAT";
235
+ prompt: string;
236
+ providerSessionId: string | null;
237
+ workspace: {
238
+ path: string;
239
+ id: string;
240
+ projectId: string;
241
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
242
+ budgetUsd: number | null;
243
+ budgetMinutes: number | null;
244
+ };
245
+ tickets: {
246
+ number: number;
247
+ id: string;
248
+ title: string;
249
+ }[];
250
+ mode?: "ask" | "plan" | "auto" | "full" | undefined;
251
+ mcp?: {
252
+ url: string;
253
+ token: string;
254
+ } | undefined;
255
+ model?: string | null | undefined;
256
+ effort?: string | null | undefined;
257
+ epoch?: number | undefined;
258
+ lastSeq?: number | undefined;
259
+ costUsd?: number | undefined;
260
+ activeMsBase?: number | undefined;
261
+ extraBudgetMinutes?: number | null | undefined;
262
+ branchHint?: unknown;
263
+ }>, "many">;
264
+ }, "strip", z.ZodTypeAny, {
265
+ type: "hello_ack";
266
+ serverName: string;
267
+ serverId: string;
268
+ sessions: {
269
+ mode: "ask" | "plan" | "auto" | "full";
270
+ status: "STARTING" | "RUNNING" | "WAITING_INPUT" | "WAITING_PERMISSION" | "REVIEW" | "DONE" | "FAILED" | "STOPPED";
271
+ agent: "CLAUDE" | "CODEX";
272
+ id: string;
273
+ kind: "TICKET" | "CHAT";
274
+ model: string | null;
275
+ effort: string | null;
276
+ epoch: number;
277
+ prompt: string;
278
+ providerSessionId: string | null;
279
+ lastSeq: number;
280
+ costUsd: number;
281
+ activeMsBase: number;
282
+ extraBudgetMinutes: number | null;
283
+ workspace: {
284
+ path: string;
285
+ id: string;
286
+ projectId: string;
287
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
288
+ budgetUsd: number | null;
289
+ budgetMinutes: number | null;
290
+ };
291
+ tickets: {
292
+ number: number;
293
+ id: string;
294
+ title: string;
295
+ }[];
296
+ mcp?: {
297
+ url: string;
298
+ token: string;
299
+ } | undefined;
300
+ branchHint?: string | undefined;
301
+ }[];
302
+ maxSessions?: number | undefined;
303
+ }, {
304
+ type: "hello_ack";
305
+ serverName: string;
306
+ serverId: string;
307
+ sessions: {
308
+ status: "STARTING" | "RUNNING" | "WAITING_INPUT" | "WAITING_PERMISSION" | "REVIEW" | "DONE" | "FAILED" | "STOPPED";
309
+ agent: "CLAUDE" | "CODEX";
310
+ id: string;
311
+ kind: "TICKET" | "CHAT";
312
+ prompt: string;
313
+ providerSessionId: string | null;
314
+ workspace: {
315
+ path: string;
316
+ id: string;
317
+ projectId: string;
318
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
319
+ budgetUsd: number | null;
320
+ budgetMinutes: number | null;
321
+ };
322
+ tickets: {
323
+ number: number;
324
+ id: string;
325
+ title: string;
326
+ }[];
327
+ mode?: "ask" | "plan" | "auto" | "full" | undefined;
328
+ mcp?: {
329
+ url: string;
330
+ token: string;
331
+ } | undefined;
332
+ model?: string | null | undefined;
333
+ effort?: string | null | undefined;
334
+ epoch?: number | undefined;
335
+ lastSeq?: number | undefined;
336
+ costUsd?: number | undefined;
337
+ activeMsBase?: number | undefined;
338
+ extraBudgetMinutes?: number | null | undefined;
339
+ branchHint?: unknown;
340
+ }[];
341
+ maxSessions?: unknown;
342
+ }>, z.ZodObject<{
343
+ type: z.ZodLiteral<"event_ack">;
344
+ sessionId: z.ZodString;
345
+ seq: z.ZodNumber;
346
+ }, "strip", z.ZodTypeAny, {
347
+ type: "event_ack";
348
+ sessionId: string;
349
+ seq: number;
350
+ }, {
351
+ type: "event_ack";
352
+ sessionId: string;
353
+ seq: number;
354
+ }>, z.ZodObject<{
355
+ type: z.ZodLiteral<"event_nack">;
356
+ sessionId: z.ZodString;
357
+ seq: z.ZodNumber;
358
+ reason: z.ZodString;
359
+ }, "strip", z.ZodTypeAny, {
360
+ reason: string;
361
+ type: "event_nack";
362
+ sessionId: string;
363
+ seq: number;
364
+ }, {
365
+ reason: string;
366
+ type: "event_nack";
367
+ sessionId: string;
368
+ seq: number;
369
+ }>, z.ZodObject<{
370
+ type: z.ZodLiteral<"session_start">;
371
+ session: z.ZodObject<{
372
+ id: z.ZodString;
373
+ kind: z.ZodEnum<["TICKET", "CHAT"]>;
374
+ agent: z.ZodEnum<["CLAUDE", "CODEX"]>;
375
+ status: z.ZodEnum<["STARTING", "RUNNING", "WAITING_INPUT", "WAITING_PERMISSION", "REVIEW", "DONE", "FAILED", "STOPPED"]>;
376
+ prompt: z.ZodString;
377
+ providerSessionId: z.ZodNullable<z.ZodString>;
378
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ask", "plan", "auto", "full"]>>>;
379
+ model: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
380
+ effort: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
381
+ lastSeq: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
382
+ costUsd: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
383
+ epoch: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
384
+ activeMsBase: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
385
+ extraBudgetMinutes: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
386
+ workspace: z.ZodObject<{
387
+ id: z.ZodString;
388
+ path: z.ZodString;
389
+ projectId: z.ZodString;
390
+ trustMode: z.ZodEnum<["STRICT", "NORMAL", "AUTO"]>;
391
+ budgetUsd: z.ZodNullable<z.ZodNumber>;
392
+ budgetMinutes: z.ZodNullable<z.ZodNumber>;
393
+ }, "strip", z.ZodTypeAny, {
394
+ path: string;
395
+ id: string;
396
+ projectId: string;
397
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
398
+ budgetUsd: number | null;
399
+ budgetMinutes: number | null;
400
+ }, {
401
+ path: string;
402
+ id: string;
403
+ projectId: string;
404
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
405
+ budgetUsd: number | null;
406
+ budgetMinutes: number | null;
407
+ }>;
408
+ tickets: z.ZodArray<z.ZodObject<{
409
+ id: z.ZodString;
410
+ number: z.ZodNumber;
411
+ title: z.ZodString;
412
+ }, "strip", z.ZodTypeAny, {
413
+ number: number;
414
+ id: string;
415
+ title: string;
416
+ }, {
417
+ number: number;
418
+ id: string;
419
+ title: string;
420
+ }>, "many">;
421
+ branchHint: z.ZodCatch<z.ZodOptional<z.ZodString>>;
422
+ mcp: z.ZodOptional<z.ZodObject<{
423
+ url: z.ZodString;
424
+ token: z.ZodString;
425
+ }, "strip", z.ZodTypeAny, {
426
+ url: string;
427
+ token: string;
428
+ }, {
429
+ url: string;
430
+ token: string;
431
+ }>>;
432
+ }, "strip", z.ZodTypeAny, {
433
+ mode: "ask" | "plan" | "auto" | "full";
434
+ status: "STARTING" | "RUNNING" | "WAITING_INPUT" | "WAITING_PERMISSION" | "REVIEW" | "DONE" | "FAILED" | "STOPPED";
435
+ agent: "CLAUDE" | "CODEX";
436
+ id: string;
437
+ kind: "TICKET" | "CHAT";
438
+ model: string | null;
439
+ effort: string | null;
440
+ epoch: number;
441
+ prompt: string;
442
+ providerSessionId: string | null;
443
+ lastSeq: number;
444
+ costUsd: number;
445
+ activeMsBase: number;
446
+ extraBudgetMinutes: number | null;
447
+ workspace: {
448
+ path: string;
449
+ id: string;
450
+ projectId: string;
451
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
452
+ budgetUsd: number | null;
453
+ budgetMinutes: number | null;
454
+ };
455
+ tickets: {
456
+ number: number;
457
+ id: string;
458
+ title: string;
459
+ }[];
460
+ mcp?: {
461
+ url: string;
462
+ token: string;
463
+ } | undefined;
464
+ branchHint?: string | undefined;
465
+ }, {
466
+ status: "STARTING" | "RUNNING" | "WAITING_INPUT" | "WAITING_PERMISSION" | "REVIEW" | "DONE" | "FAILED" | "STOPPED";
467
+ agent: "CLAUDE" | "CODEX";
468
+ id: string;
469
+ kind: "TICKET" | "CHAT";
470
+ prompt: string;
471
+ providerSessionId: string | null;
472
+ workspace: {
473
+ path: string;
474
+ id: string;
475
+ projectId: string;
476
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
477
+ budgetUsd: number | null;
478
+ budgetMinutes: number | null;
479
+ };
480
+ tickets: {
481
+ number: number;
482
+ id: string;
483
+ title: string;
484
+ }[];
485
+ mode?: "ask" | "plan" | "auto" | "full" | undefined;
486
+ mcp?: {
487
+ url: string;
488
+ token: string;
489
+ } | undefined;
490
+ model?: string | null | undefined;
491
+ effort?: string | null | undefined;
492
+ epoch?: number | undefined;
493
+ lastSeq?: number | undefined;
494
+ costUsd?: number | undefined;
495
+ activeMsBase?: number | undefined;
496
+ extraBudgetMinutes?: number | null | undefined;
497
+ branchHint?: unknown;
498
+ }>;
499
+ }, "strip", z.ZodTypeAny, {
500
+ type: "session_start";
501
+ session: {
502
+ mode: "ask" | "plan" | "auto" | "full";
503
+ status: "STARTING" | "RUNNING" | "WAITING_INPUT" | "WAITING_PERMISSION" | "REVIEW" | "DONE" | "FAILED" | "STOPPED";
504
+ agent: "CLAUDE" | "CODEX";
505
+ id: string;
506
+ kind: "TICKET" | "CHAT";
507
+ model: string | null;
508
+ effort: string | null;
509
+ epoch: number;
510
+ prompt: string;
511
+ providerSessionId: string | null;
512
+ lastSeq: number;
513
+ costUsd: number;
514
+ activeMsBase: number;
515
+ extraBudgetMinutes: number | null;
516
+ workspace: {
517
+ path: string;
518
+ id: string;
519
+ projectId: string;
520
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
521
+ budgetUsd: number | null;
522
+ budgetMinutes: number | null;
523
+ };
524
+ tickets: {
525
+ number: number;
526
+ id: string;
527
+ title: string;
528
+ }[];
529
+ mcp?: {
530
+ url: string;
531
+ token: string;
532
+ } | undefined;
533
+ branchHint?: string | undefined;
534
+ };
535
+ }, {
536
+ type: "session_start";
537
+ session: {
538
+ status: "STARTING" | "RUNNING" | "WAITING_INPUT" | "WAITING_PERMISSION" | "REVIEW" | "DONE" | "FAILED" | "STOPPED";
539
+ agent: "CLAUDE" | "CODEX";
540
+ id: string;
541
+ kind: "TICKET" | "CHAT";
542
+ prompt: string;
543
+ providerSessionId: string | null;
544
+ workspace: {
545
+ path: string;
546
+ id: string;
547
+ projectId: string;
548
+ trustMode: "STRICT" | "NORMAL" | "AUTO";
549
+ budgetUsd: number | null;
550
+ budgetMinutes: number | null;
551
+ };
552
+ tickets: {
553
+ number: number;
554
+ id: string;
555
+ title: string;
556
+ }[];
557
+ mode?: "ask" | "plan" | "auto" | "full" | undefined;
558
+ mcp?: {
559
+ url: string;
560
+ token: string;
561
+ } | undefined;
562
+ model?: string | null | undefined;
563
+ effort?: string | null | undefined;
564
+ epoch?: number | undefined;
565
+ lastSeq?: number | undefined;
566
+ costUsd?: number | undefined;
567
+ activeMsBase?: number | undefined;
568
+ extraBudgetMinutes?: number | null | undefined;
569
+ branchHint?: unknown;
570
+ };
571
+ }>, z.ZodObject<{
572
+ type: z.ZodLiteral<"session_message">;
573
+ sessionId: z.ZodString;
574
+ text: z.ZodString;
575
+ attachments: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodObject<{
576
+ id: z.ZodString;
577
+ fileName: z.ZodString;
578
+ mimeType: z.ZodString;
579
+ fileSize: z.ZodNumber;
580
+ }, "strip", z.ZodTypeAny, {
581
+ id: string;
582
+ fileName: string;
583
+ mimeType: string;
584
+ fileSize: number;
585
+ }, {
586
+ id: string;
587
+ fileName: string;
588
+ mimeType: string;
589
+ fileSize: number;
590
+ }>, "many">>>;
591
+ }, "strip", z.ZodTypeAny, {
592
+ type: "session_message";
593
+ text: string;
594
+ sessionId: string;
595
+ attachments?: {
596
+ id: string;
597
+ fileName: string;
598
+ mimeType: string;
599
+ fileSize: number;
600
+ }[] | undefined;
601
+ }, {
602
+ type: "session_message";
603
+ text: string;
604
+ sessionId: string;
605
+ attachments?: unknown;
606
+ }>, z.ZodObject<{
607
+ type: z.ZodLiteral<"permission_answer">;
608
+ sessionId: z.ZodString;
609
+ requestId: z.ZodString;
610
+ allow: z.ZodBoolean;
611
+ note: z.ZodOptional<z.ZodString>;
612
+ }, "strip", z.ZodTypeAny, {
613
+ allow: boolean;
614
+ type: "permission_answer";
615
+ requestId: string;
616
+ sessionId: string;
617
+ note?: string | undefined;
618
+ }, {
619
+ allow: boolean;
620
+ type: "permission_answer";
621
+ requestId: string;
622
+ sessionId: string;
623
+ note?: string | undefined;
624
+ }>, z.ZodObject<{
625
+ type: z.ZodLiteral<"session_stop">;
626
+ sessionId: z.ZodString;
627
+ }, "strip", z.ZodTypeAny, {
628
+ type: "session_stop";
629
+ sessionId: string;
630
+ }, {
631
+ type: "session_stop";
632
+ sessionId: string;
633
+ }>, z.ZodObject<{
634
+ type: z.ZodLiteral<"session_interrupt">;
635
+ sessionId: z.ZodString;
636
+ }, "strip", z.ZodTypeAny, {
637
+ type: "session_interrupt";
638
+ sessionId: string;
639
+ }, {
640
+ type: "session_interrupt";
641
+ sessionId: string;
642
+ }>, z.ZodObject<{
643
+ type: z.ZodLiteral<"server_settings">;
644
+ maxSessions: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
645
+ }, "strip", z.ZodTypeAny, {
646
+ type: "server_settings";
647
+ maxSessions?: number | undefined;
648
+ }, {
649
+ type: "server_settings";
650
+ maxSessions?: unknown;
651
+ }>, z.ZodObject<{
652
+ type: z.ZodLiteral<"session_settings">;
653
+ sessionId: z.ZodString;
654
+ model: z.ZodOptional<z.ZodString>;
655
+ mode: z.ZodOptional<z.ZodEnum<["ask", "plan", "auto", "full"]>>;
656
+ effort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
657
+ }, "strip", z.ZodTypeAny, {
658
+ type: "session_settings";
659
+ sessionId: string;
660
+ mode?: "ask" | "plan" | "auto" | "full" | undefined;
661
+ model?: string | undefined;
662
+ effort?: string | null | undefined;
663
+ }, {
664
+ type: "session_settings";
665
+ sessionId: string;
666
+ mode?: "ask" | "plan" | "auto" | "full" | undefined;
667
+ model?: string | undefined;
668
+ effort?: string | null | undefined;
669
+ }>, z.ZodObject<{
670
+ type: z.ZodLiteral<"command">;
671
+ requestId: z.ZodString;
672
+ name: z.ZodString;
673
+ workspaceId: z.ZodOptional<z.ZodString>;
674
+ sessionId: z.ZodOptional<z.ZodString>;
675
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
676
+ }, "strip", z.ZodTypeAny, {
677
+ type: "command";
678
+ name: string;
679
+ requestId: string;
680
+ args?: Record<string, unknown> | undefined;
681
+ sessionId?: string | undefined;
682
+ workspaceId?: string | undefined;
683
+ }, {
684
+ type: "command";
685
+ name: string;
686
+ requestId: string;
687
+ args?: Record<string, unknown> | undefined;
688
+ sessionId?: string | undefined;
689
+ workspaceId?: string | undefined;
690
+ }>, z.ZodObject<{
691
+ type: z.ZodLiteral<"revoked">;
692
+ reason: z.ZodString;
693
+ }, "strip", z.ZodTypeAny, {
694
+ reason: string;
695
+ type: "revoked";
696
+ }, {
697
+ reason: string;
698
+ type: "revoked";
699
+ }>, z.ZodObject<{
700
+ type: z.ZodLiteral<"error">;
701
+ message: z.ZodString;
702
+ }, "strip", z.ZodTypeAny, {
703
+ message: string;
704
+ type: "error";
705
+ }, {
706
+ message: string;
707
+ type: "error";
708
+ }>]>;
709
+ export type GatewayFrame = z.infer<typeof GatewayFrameSchema>;
710
+ export type SessionStatusValue = SessionDescriptor['status'];
711
+ export type RunnerFrame = {
712
+ type: 'hello';
713
+ runnerVersion: string;
714
+ osInfo?: string;
715
+ capabilities?: Record<string, unknown>;
716
+ } | {
717
+ type: 'event';
718
+ sessionId: string;
719
+ seq: number;
720
+ eventType: string;
721
+ payload: Record<string, unknown>;
722
+ } | {
723
+ type: 'session_status';
724
+ sessionId: string;
725
+ status: Exclude<SessionStatusValue, 'STARTING'>;
726
+ costUsd?: number;
727
+ providerSessionId?: string;
728
+ branch?: string;
729
+ worktreePath?: string;
730
+ errorMessage?: string;
731
+ /** Why it ended, when the reason is worth naming rather than an error. */
732
+ endReason?: 'TIME_BUDGET' | 'COST_BUDGET';
733
+ /** Agent-active milliseconds, cumulative across processes (session 7). */
734
+ activeMs?: number;
735
+ /**
736
+ * Resume generation this status belongs to (session 8). The API drops a
737
+ * frame stamped with an older epoch, which closes the «Стоп» ↔
738
+ * «Продолжить» race: a STOPPED written by the dying process can no longer
739
+ * land on the session that has already been picked back up.
740
+ */
741
+ epoch?: number;
742
+ } | {
743
+ type: 'session_unknown';
744
+ sessionId: string;
745
+ } | {
746
+ type: 'command_result';
747
+ requestId: string;
748
+ ok: boolean;
749
+ result?: unknown;
750
+ error?: string;
751
+ } | {
752
+ type: 'pong';
753
+ };
754
+ //# sourceMappingURL=protocol.d.ts.map