@hydra-acp/cli 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,1465 @@
1
+ import { FastifyInstance } from 'fastify';
2
+ import { z } from 'zod';
3
+ import { Readable, Writable } from 'node:stream';
4
+ import { WebSocket } from 'ws';
5
+
6
+ declare const ExtensionBody: z.ZodObject<{
7
+ command: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
8
+ args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
9
+ env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
10
+ enabled: z.ZodDefault<z.ZodBoolean>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ command: string[];
13
+ args: string[];
14
+ env: Record<string, string>;
15
+ enabled: boolean;
16
+ }, {
17
+ command?: string[] | undefined;
18
+ args?: string[] | undefined;
19
+ env?: Record<string, string> | undefined;
20
+ enabled?: boolean | undefined;
21
+ }>;
22
+ type ExtensionBody = z.infer<typeof ExtensionBody>;
23
+ type ExtensionConfig = ExtensionBody & {
24
+ name: string;
25
+ };
26
+ declare const HydraConfig: z.ZodObject<{
27
+ daemon: z.ZodObject<{
28
+ host: z.ZodDefault<z.ZodString>;
29
+ port: z.ZodDefault<z.ZodNumber>;
30
+ authToken: z.ZodString;
31
+ logLevel: z.ZodDefault<z.ZodEnum<["debug", "info", "warn", "error"]>>;
32
+ tls: z.ZodOptional<z.ZodObject<{
33
+ cert: z.ZodString;
34
+ key: z.ZodString;
35
+ }, "strip", z.ZodTypeAny, {
36
+ cert: string;
37
+ key: string;
38
+ }, {
39
+ cert: string;
40
+ key: string;
41
+ }>>;
42
+ sessionIdleTimeoutSeconds: z.ZodDefault<z.ZodNumber>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ host: string;
45
+ port: number;
46
+ authToken: string;
47
+ logLevel: "debug" | "info" | "warn" | "error";
48
+ sessionIdleTimeoutSeconds: number;
49
+ tls?: {
50
+ cert: string;
51
+ key: string;
52
+ } | undefined;
53
+ }, {
54
+ authToken: string;
55
+ host?: string | undefined;
56
+ port?: number | undefined;
57
+ logLevel?: "debug" | "info" | "warn" | "error" | undefined;
58
+ tls?: {
59
+ cert: string;
60
+ key: string;
61
+ } | undefined;
62
+ sessionIdleTimeoutSeconds?: number | undefined;
63
+ }>;
64
+ registry: z.ZodDefault<z.ZodObject<{
65
+ url: z.ZodDefault<z.ZodString>;
66
+ ttlHours: z.ZodDefault<z.ZodNumber>;
67
+ }, "strip", z.ZodTypeAny, {
68
+ url: string;
69
+ ttlHours: number;
70
+ }, {
71
+ url?: string | undefined;
72
+ ttlHours?: number | undefined;
73
+ }>>;
74
+ defaultAgent: z.ZodDefault<z.ZodString>;
75
+ defaultCwd: z.ZodDefault<z.ZodString>;
76
+ sessionListColdLimit: z.ZodDefault<z.ZodNumber>;
77
+ extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
78
+ command: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
79
+ args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
80
+ env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
81
+ enabled: z.ZodDefault<z.ZodBoolean>;
82
+ }, "strip", z.ZodTypeAny, {
83
+ command: string[];
84
+ args: string[];
85
+ env: Record<string, string>;
86
+ enabled: boolean;
87
+ }, {
88
+ command?: string[] | undefined;
89
+ args?: string[] | undefined;
90
+ env?: Record<string, string> | undefined;
91
+ enabled?: boolean | undefined;
92
+ }>>>;
93
+ tui: z.ZodDefault<z.ZodObject<{
94
+ repaintThrottleMs: z.ZodDefault<z.ZodNumber>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ repaintThrottleMs: number;
97
+ }, {
98
+ repaintThrottleMs?: number | undefined;
99
+ }>>;
100
+ }, "strip", z.ZodTypeAny, {
101
+ daemon: {
102
+ host: string;
103
+ port: number;
104
+ authToken: string;
105
+ logLevel: "debug" | "info" | "warn" | "error";
106
+ sessionIdleTimeoutSeconds: number;
107
+ tls?: {
108
+ cert: string;
109
+ key: string;
110
+ } | undefined;
111
+ };
112
+ extensions: Record<string, {
113
+ command: string[];
114
+ args: string[];
115
+ env: Record<string, string>;
116
+ enabled: boolean;
117
+ }>;
118
+ tui: {
119
+ repaintThrottleMs: number;
120
+ };
121
+ registry: {
122
+ url: string;
123
+ ttlHours: number;
124
+ };
125
+ defaultAgent: string;
126
+ defaultCwd: string;
127
+ sessionListColdLimit: number;
128
+ }, {
129
+ daemon: {
130
+ authToken: string;
131
+ host?: string | undefined;
132
+ port?: number | undefined;
133
+ logLevel?: "debug" | "info" | "warn" | "error" | undefined;
134
+ tls?: {
135
+ cert: string;
136
+ key: string;
137
+ } | undefined;
138
+ sessionIdleTimeoutSeconds?: number | undefined;
139
+ };
140
+ extensions?: Record<string, {
141
+ command?: string[] | undefined;
142
+ args?: string[] | undefined;
143
+ env?: Record<string, string> | undefined;
144
+ enabled?: boolean | undefined;
145
+ }> | undefined;
146
+ tui?: {
147
+ repaintThrottleMs?: number | undefined;
148
+ } | undefined;
149
+ registry?: {
150
+ url?: string | undefined;
151
+ ttlHours?: number | undefined;
152
+ } | undefined;
153
+ defaultAgent?: string | undefined;
154
+ defaultCwd?: string | undefined;
155
+ sessionListColdLimit?: number | undefined;
156
+ }>;
157
+ type HydraConfig = z.infer<typeof HydraConfig>;
158
+ declare function loadConfig(): Promise<HydraConfig>;
159
+ declare function ensureConfig(): Promise<HydraConfig>;
160
+ declare function writeConfig(config: HydraConfig): Promise<void>;
161
+ declare function generateAuthToken(): string;
162
+ declare function defaultConfig(): HydraConfig;
163
+
164
+ declare const RegistryAgent: z.ZodObject<{
165
+ id: z.ZodString;
166
+ name: z.ZodString;
167
+ version: z.ZodOptional<z.ZodString>;
168
+ description: z.ZodOptional<z.ZodString>;
169
+ authors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
170
+ license: z.ZodOptional<z.ZodString>;
171
+ icon: z.ZodOptional<z.ZodString>;
172
+ repository: z.ZodOptional<z.ZodString>;
173
+ website: z.ZodOptional<z.ZodString>;
174
+ distribution: z.ZodObject<{
175
+ npx: z.ZodOptional<z.ZodObject<{
176
+ package: z.ZodString;
177
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
178
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
179
+ }, "strip", z.ZodTypeAny, {
180
+ package: string;
181
+ args?: string[] | undefined;
182
+ env?: Record<string, string> | undefined;
183
+ }, {
184
+ package: string;
185
+ args?: string[] | undefined;
186
+ env?: Record<string, string> | undefined;
187
+ }>>;
188
+ binary: z.ZodOptional<z.ZodObject<{
189
+ "darwin-aarch64": z.ZodOptional<z.ZodObject<{
190
+ archive: z.ZodOptional<z.ZodString>;
191
+ cmd: z.ZodOptional<z.ZodString>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ archive?: string | undefined;
194
+ cmd?: string | undefined;
195
+ }, {
196
+ archive?: string | undefined;
197
+ cmd?: string | undefined;
198
+ }>>;
199
+ "darwin-x86_64": z.ZodOptional<z.ZodObject<{
200
+ archive: z.ZodOptional<z.ZodString>;
201
+ cmd: z.ZodOptional<z.ZodString>;
202
+ }, "strip", z.ZodTypeAny, {
203
+ archive?: string | undefined;
204
+ cmd?: string | undefined;
205
+ }, {
206
+ archive?: string | undefined;
207
+ cmd?: string | undefined;
208
+ }>>;
209
+ "linux-aarch64": z.ZodOptional<z.ZodObject<{
210
+ archive: z.ZodOptional<z.ZodString>;
211
+ cmd: z.ZodOptional<z.ZodString>;
212
+ }, "strip", z.ZodTypeAny, {
213
+ archive?: string | undefined;
214
+ cmd?: string | undefined;
215
+ }, {
216
+ archive?: string | undefined;
217
+ cmd?: string | undefined;
218
+ }>>;
219
+ "linux-x86_64": z.ZodOptional<z.ZodObject<{
220
+ archive: z.ZodOptional<z.ZodString>;
221
+ cmd: z.ZodOptional<z.ZodString>;
222
+ }, "strip", z.ZodTypeAny, {
223
+ archive?: string | undefined;
224
+ cmd?: string | undefined;
225
+ }, {
226
+ archive?: string | undefined;
227
+ cmd?: string | undefined;
228
+ }>>;
229
+ "windows-x86_64": z.ZodOptional<z.ZodObject<{
230
+ archive: z.ZodOptional<z.ZodString>;
231
+ cmd: z.ZodOptional<z.ZodString>;
232
+ }, "strip", z.ZodTypeAny, {
233
+ archive?: string | undefined;
234
+ cmd?: string | undefined;
235
+ }, {
236
+ archive?: string | undefined;
237
+ cmd?: string | undefined;
238
+ }>>;
239
+ "windows-aarch64": z.ZodOptional<z.ZodObject<{
240
+ archive: z.ZodOptional<z.ZodString>;
241
+ cmd: z.ZodOptional<z.ZodString>;
242
+ }, "strip", z.ZodTypeAny, {
243
+ archive?: string | undefined;
244
+ cmd?: string | undefined;
245
+ }, {
246
+ archive?: string | undefined;
247
+ cmd?: string | undefined;
248
+ }>>;
249
+ }, "strip", z.ZodTypeAny, {
250
+ "darwin-aarch64"?: {
251
+ archive?: string | undefined;
252
+ cmd?: string | undefined;
253
+ } | undefined;
254
+ "darwin-x86_64"?: {
255
+ archive?: string | undefined;
256
+ cmd?: string | undefined;
257
+ } | undefined;
258
+ "linux-aarch64"?: {
259
+ archive?: string | undefined;
260
+ cmd?: string | undefined;
261
+ } | undefined;
262
+ "linux-x86_64"?: {
263
+ archive?: string | undefined;
264
+ cmd?: string | undefined;
265
+ } | undefined;
266
+ "windows-x86_64"?: {
267
+ archive?: string | undefined;
268
+ cmd?: string | undefined;
269
+ } | undefined;
270
+ "windows-aarch64"?: {
271
+ archive?: string | undefined;
272
+ cmd?: string | undefined;
273
+ } | undefined;
274
+ }, {
275
+ "darwin-aarch64"?: {
276
+ archive?: string | undefined;
277
+ cmd?: string | undefined;
278
+ } | undefined;
279
+ "darwin-x86_64"?: {
280
+ archive?: string | undefined;
281
+ cmd?: string | undefined;
282
+ } | undefined;
283
+ "linux-aarch64"?: {
284
+ archive?: string | undefined;
285
+ cmd?: string | undefined;
286
+ } | undefined;
287
+ "linux-x86_64"?: {
288
+ archive?: string | undefined;
289
+ cmd?: string | undefined;
290
+ } | undefined;
291
+ "windows-x86_64"?: {
292
+ archive?: string | undefined;
293
+ cmd?: string | undefined;
294
+ } | undefined;
295
+ "windows-aarch64"?: {
296
+ archive?: string | undefined;
297
+ cmd?: string | undefined;
298
+ } | undefined;
299
+ }>>;
300
+ uvx: z.ZodOptional<z.ZodObject<{
301
+ package: z.ZodString;
302
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
303
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
304
+ }, "strip", z.ZodTypeAny, {
305
+ package: string;
306
+ args?: string[] | undefined;
307
+ env?: Record<string, string> | undefined;
308
+ }, {
309
+ package: string;
310
+ args?: string[] | undefined;
311
+ env?: Record<string, string> | undefined;
312
+ }>>;
313
+ }, "strip", z.ZodTypeAny, {
314
+ binary?: {
315
+ "darwin-aarch64"?: {
316
+ archive?: string | undefined;
317
+ cmd?: string | undefined;
318
+ } | undefined;
319
+ "darwin-x86_64"?: {
320
+ archive?: string | undefined;
321
+ cmd?: string | undefined;
322
+ } | undefined;
323
+ "linux-aarch64"?: {
324
+ archive?: string | undefined;
325
+ cmd?: string | undefined;
326
+ } | undefined;
327
+ "linux-x86_64"?: {
328
+ archive?: string | undefined;
329
+ cmd?: string | undefined;
330
+ } | undefined;
331
+ "windows-x86_64"?: {
332
+ archive?: string | undefined;
333
+ cmd?: string | undefined;
334
+ } | undefined;
335
+ "windows-aarch64"?: {
336
+ archive?: string | undefined;
337
+ cmd?: string | undefined;
338
+ } | undefined;
339
+ } | undefined;
340
+ npx?: {
341
+ package: string;
342
+ args?: string[] | undefined;
343
+ env?: Record<string, string> | undefined;
344
+ } | undefined;
345
+ uvx?: {
346
+ package: string;
347
+ args?: string[] | undefined;
348
+ env?: Record<string, string> | undefined;
349
+ } | undefined;
350
+ }, {
351
+ binary?: {
352
+ "darwin-aarch64"?: {
353
+ archive?: string | undefined;
354
+ cmd?: string | undefined;
355
+ } | undefined;
356
+ "darwin-x86_64"?: {
357
+ archive?: string | undefined;
358
+ cmd?: string | undefined;
359
+ } | undefined;
360
+ "linux-aarch64"?: {
361
+ archive?: string | undefined;
362
+ cmd?: string | undefined;
363
+ } | undefined;
364
+ "linux-x86_64"?: {
365
+ archive?: string | undefined;
366
+ cmd?: string | undefined;
367
+ } | undefined;
368
+ "windows-x86_64"?: {
369
+ archive?: string | undefined;
370
+ cmd?: string | undefined;
371
+ } | undefined;
372
+ "windows-aarch64"?: {
373
+ archive?: string | undefined;
374
+ cmd?: string | undefined;
375
+ } | undefined;
376
+ } | undefined;
377
+ npx?: {
378
+ package: string;
379
+ args?: string[] | undefined;
380
+ env?: Record<string, string> | undefined;
381
+ } | undefined;
382
+ uvx?: {
383
+ package: string;
384
+ args?: string[] | undefined;
385
+ env?: Record<string, string> | undefined;
386
+ } | undefined;
387
+ }>;
388
+ }, "strip", z.ZodTypeAny, {
389
+ name: string;
390
+ id: string;
391
+ distribution: {
392
+ binary?: {
393
+ "darwin-aarch64"?: {
394
+ archive?: string | undefined;
395
+ cmd?: string | undefined;
396
+ } | undefined;
397
+ "darwin-x86_64"?: {
398
+ archive?: string | undefined;
399
+ cmd?: string | undefined;
400
+ } | undefined;
401
+ "linux-aarch64"?: {
402
+ archive?: string | undefined;
403
+ cmd?: string | undefined;
404
+ } | undefined;
405
+ "linux-x86_64"?: {
406
+ archive?: string | undefined;
407
+ cmd?: string | undefined;
408
+ } | undefined;
409
+ "windows-x86_64"?: {
410
+ archive?: string | undefined;
411
+ cmd?: string | undefined;
412
+ } | undefined;
413
+ "windows-aarch64"?: {
414
+ archive?: string | undefined;
415
+ cmd?: string | undefined;
416
+ } | undefined;
417
+ } | undefined;
418
+ npx?: {
419
+ package: string;
420
+ args?: string[] | undefined;
421
+ env?: Record<string, string> | undefined;
422
+ } | undefined;
423
+ uvx?: {
424
+ package: string;
425
+ args?: string[] | undefined;
426
+ env?: Record<string, string> | undefined;
427
+ } | undefined;
428
+ };
429
+ version?: string | undefined;
430
+ description?: string | undefined;
431
+ authors?: string[] | undefined;
432
+ license?: string | undefined;
433
+ icon?: string | undefined;
434
+ repository?: string | undefined;
435
+ website?: string | undefined;
436
+ }, {
437
+ name: string;
438
+ id: string;
439
+ distribution: {
440
+ binary?: {
441
+ "darwin-aarch64"?: {
442
+ archive?: string | undefined;
443
+ cmd?: string | undefined;
444
+ } | undefined;
445
+ "darwin-x86_64"?: {
446
+ archive?: string | undefined;
447
+ cmd?: string | undefined;
448
+ } | undefined;
449
+ "linux-aarch64"?: {
450
+ archive?: string | undefined;
451
+ cmd?: string | undefined;
452
+ } | undefined;
453
+ "linux-x86_64"?: {
454
+ archive?: string | undefined;
455
+ cmd?: string | undefined;
456
+ } | undefined;
457
+ "windows-x86_64"?: {
458
+ archive?: string | undefined;
459
+ cmd?: string | undefined;
460
+ } | undefined;
461
+ "windows-aarch64"?: {
462
+ archive?: string | undefined;
463
+ cmd?: string | undefined;
464
+ } | undefined;
465
+ } | undefined;
466
+ npx?: {
467
+ package: string;
468
+ args?: string[] | undefined;
469
+ env?: Record<string, string> | undefined;
470
+ } | undefined;
471
+ uvx?: {
472
+ package: string;
473
+ args?: string[] | undefined;
474
+ env?: Record<string, string> | undefined;
475
+ } | undefined;
476
+ };
477
+ version?: string | undefined;
478
+ description?: string | undefined;
479
+ authors?: string[] | undefined;
480
+ license?: string | undefined;
481
+ icon?: string | undefined;
482
+ repository?: string | undefined;
483
+ website?: string | undefined;
484
+ }>;
485
+ type RegistryAgent = z.infer<typeof RegistryAgent>;
486
+ declare const RegistryDocument: z.ZodObject<{
487
+ version: z.ZodString;
488
+ agents: z.ZodArray<z.ZodObject<{
489
+ id: z.ZodString;
490
+ name: z.ZodString;
491
+ version: z.ZodOptional<z.ZodString>;
492
+ description: z.ZodOptional<z.ZodString>;
493
+ authors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
494
+ license: z.ZodOptional<z.ZodString>;
495
+ icon: z.ZodOptional<z.ZodString>;
496
+ repository: z.ZodOptional<z.ZodString>;
497
+ website: z.ZodOptional<z.ZodString>;
498
+ distribution: z.ZodObject<{
499
+ npx: z.ZodOptional<z.ZodObject<{
500
+ package: z.ZodString;
501
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
502
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
503
+ }, "strip", z.ZodTypeAny, {
504
+ package: string;
505
+ args?: string[] | undefined;
506
+ env?: Record<string, string> | undefined;
507
+ }, {
508
+ package: string;
509
+ args?: string[] | undefined;
510
+ env?: Record<string, string> | undefined;
511
+ }>>;
512
+ binary: z.ZodOptional<z.ZodObject<{
513
+ "darwin-aarch64": z.ZodOptional<z.ZodObject<{
514
+ archive: z.ZodOptional<z.ZodString>;
515
+ cmd: z.ZodOptional<z.ZodString>;
516
+ }, "strip", z.ZodTypeAny, {
517
+ archive?: string | undefined;
518
+ cmd?: string | undefined;
519
+ }, {
520
+ archive?: string | undefined;
521
+ cmd?: string | undefined;
522
+ }>>;
523
+ "darwin-x86_64": z.ZodOptional<z.ZodObject<{
524
+ archive: z.ZodOptional<z.ZodString>;
525
+ cmd: z.ZodOptional<z.ZodString>;
526
+ }, "strip", z.ZodTypeAny, {
527
+ archive?: string | undefined;
528
+ cmd?: string | undefined;
529
+ }, {
530
+ archive?: string | undefined;
531
+ cmd?: string | undefined;
532
+ }>>;
533
+ "linux-aarch64": z.ZodOptional<z.ZodObject<{
534
+ archive: z.ZodOptional<z.ZodString>;
535
+ cmd: z.ZodOptional<z.ZodString>;
536
+ }, "strip", z.ZodTypeAny, {
537
+ archive?: string | undefined;
538
+ cmd?: string | undefined;
539
+ }, {
540
+ archive?: string | undefined;
541
+ cmd?: string | undefined;
542
+ }>>;
543
+ "linux-x86_64": z.ZodOptional<z.ZodObject<{
544
+ archive: z.ZodOptional<z.ZodString>;
545
+ cmd: z.ZodOptional<z.ZodString>;
546
+ }, "strip", z.ZodTypeAny, {
547
+ archive?: string | undefined;
548
+ cmd?: string | undefined;
549
+ }, {
550
+ archive?: string | undefined;
551
+ cmd?: string | undefined;
552
+ }>>;
553
+ "windows-x86_64": z.ZodOptional<z.ZodObject<{
554
+ archive: z.ZodOptional<z.ZodString>;
555
+ cmd: z.ZodOptional<z.ZodString>;
556
+ }, "strip", z.ZodTypeAny, {
557
+ archive?: string | undefined;
558
+ cmd?: string | undefined;
559
+ }, {
560
+ archive?: string | undefined;
561
+ cmd?: string | undefined;
562
+ }>>;
563
+ "windows-aarch64": z.ZodOptional<z.ZodObject<{
564
+ archive: z.ZodOptional<z.ZodString>;
565
+ cmd: z.ZodOptional<z.ZodString>;
566
+ }, "strip", z.ZodTypeAny, {
567
+ archive?: string | undefined;
568
+ cmd?: string | undefined;
569
+ }, {
570
+ archive?: string | undefined;
571
+ cmd?: string | undefined;
572
+ }>>;
573
+ }, "strip", z.ZodTypeAny, {
574
+ "darwin-aarch64"?: {
575
+ archive?: string | undefined;
576
+ cmd?: string | undefined;
577
+ } | undefined;
578
+ "darwin-x86_64"?: {
579
+ archive?: string | undefined;
580
+ cmd?: string | undefined;
581
+ } | undefined;
582
+ "linux-aarch64"?: {
583
+ archive?: string | undefined;
584
+ cmd?: string | undefined;
585
+ } | undefined;
586
+ "linux-x86_64"?: {
587
+ archive?: string | undefined;
588
+ cmd?: string | undefined;
589
+ } | undefined;
590
+ "windows-x86_64"?: {
591
+ archive?: string | undefined;
592
+ cmd?: string | undefined;
593
+ } | undefined;
594
+ "windows-aarch64"?: {
595
+ archive?: string | undefined;
596
+ cmd?: string | undefined;
597
+ } | undefined;
598
+ }, {
599
+ "darwin-aarch64"?: {
600
+ archive?: string | undefined;
601
+ cmd?: string | undefined;
602
+ } | undefined;
603
+ "darwin-x86_64"?: {
604
+ archive?: string | undefined;
605
+ cmd?: string | undefined;
606
+ } | undefined;
607
+ "linux-aarch64"?: {
608
+ archive?: string | undefined;
609
+ cmd?: string | undefined;
610
+ } | undefined;
611
+ "linux-x86_64"?: {
612
+ archive?: string | undefined;
613
+ cmd?: string | undefined;
614
+ } | undefined;
615
+ "windows-x86_64"?: {
616
+ archive?: string | undefined;
617
+ cmd?: string | undefined;
618
+ } | undefined;
619
+ "windows-aarch64"?: {
620
+ archive?: string | undefined;
621
+ cmd?: string | undefined;
622
+ } | undefined;
623
+ }>>;
624
+ uvx: z.ZodOptional<z.ZodObject<{
625
+ package: z.ZodString;
626
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
627
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
628
+ }, "strip", z.ZodTypeAny, {
629
+ package: string;
630
+ args?: string[] | undefined;
631
+ env?: Record<string, string> | undefined;
632
+ }, {
633
+ package: string;
634
+ args?: string[] | undefined;
635
+ env?: Record<string, string> | undefined;
636
+ }>>;
637
+ }, "strip", z.ZodTypeAny, {
638
+ binary?: {
639
+ "darwin-aarch64"?: {
640
+ archive?: string | undefined;
641
+ cmd?: string | undefined;
642
+ } | undefined;
643
+ "darwin-x86_64"?: {
644
+ archive?: string | undefined;
645
+ cmd?: string | undefined;
646
+ } | undefined;
647
+ "linux-aarch64"?: {
648
+ archive?: string | undefined;
649
+ cmd?: string | undefined;
650
+ } | undefined;
651
+ "linux-x86_64"?: {
652
+ archive?: string | undefined;
653
+ cmd?: string | undefined;
654
+ } | undefined;
655
+ "windows-x86_64"?: {
656
+ archive?: string | undefined;
657
+ cmd?: string | undefined;
658
+ } | undefined;
659
+ "windows-aarch64"?: {
660
+ archive?: string | undefined;
661
+ cmd?: string | undefined;
662
+ } | undefined;
663
+ } | undefined;
664
+ npx?: {
665
+ package: string;
666
+ args?: string[] | undefined;
667
+ env?: Record<string, string> | undefined;
668
+ } | undefined;
669
+ uvx?: {
670
+ package: string;
671
+ args?: string[] | undefined;
672
+ env?: Record<string, string> | undefined;
673
+ } | undefined;
674
+ }, {
675
+ binary?: {
676
+ "darwin-aarch64"?: {
677
+ archive?: string | undefined;
678
+ cmd?: string | undefined;
679
+ } | undefined;
680
+ "darwin-x86_64"?: {
681
+ archive?: string | undefined;
682
+ cmd?: string | undefined;
683
+ } | undefined;
684
+ "linux-aarch64"?: {
685
+ archive?: string | undefined;
686
+ cmd?: string | undefined;
687
+ } | undefined;
688
+ "linux-x86_64"?: {
689
+ archive?: string | undefined;
690
+ cmd?: string | undefined;
691
+ } | undefined;
692
+ "windows-x86_64"?: {
693
+ archive?: string | undefined;
694
+ cmd?: string | undefined;
695
+ } | undefined;
696
+ "windows-aarch64"?: {
697
+ archive?: string | undefined;
698
+ cmd?: string | undefined;
699
+ } | undefined;
700
+ } | undefined;
701
+ npx?: {
702
+ package: string;
703
+ args?: string[] | undefined;
704
+ env?: Record<string, string> | undefined;
705
+ } | undefined;
706
+ uvx?: {
707
+ package: string;
708
+ args?: string[] | undefined;
709
+ env?: Record<string, string> | undefined;
710
+ } | undefined;
711
+ }>;
712
+ }, "strip", z.ZodTypeAny, {
713
+ name: string;
714
+ id: string;
715
+ distribution: {
716
+ binary?: {
717
+ "darwin-aarch64"?: {
718
+ archive?: string | undefined;
719
+ cmd?: string | undefined;
720
+ } | undefined;
721
+ "darwin-x86_64"?: {
722
+ archive?: string | undefined;
723
+ cmd?: string | undefined;
724
+ } | undefined;
725
+ "linux-aarch64"?: {
726
+ archive?: string | undefined;
727
+ cmd?: string | undefined;
728
+ } | undefined;
729
+ "linux-x86_64"?: {
730
+ archive?: string | undefined;
731
+ cmd?: string | undefined;
732
+ } | undefined;
733
+ "windows-x86_64"?: {
734
+ archive?: string | undefined;
735
+ cmd?: string | undefined;
736
+ } | undefined;
737
+ "windows-aarch64"?: {
738
+ archive?: string | undefined;
739
+ cmd?: string | undefined;
740
+ } | undefined;
741
+ } | undefined;
742
+ npx?: {
743
+ package: string;
744
+ args?: string[] | undefined;
745
+ env?: Record<string, string> | undefined;
746
+ } | undefined;
747
+ uvx?: {
748
+ package: string;
749
+ args?: string[] | undefined;
750
+ env?: Record<string, string> | undefined;
751
+ } | undefined;
752
+ };
753
+ version?: string | undefined;
754
+ description?: string | undefined;
755
+ authors?: string[] | undefined;
756
+ license?: string | undefined;
757
+ icon?: string | undefined;
758
+ repository?: string | undefined;
759
+ website?: string | undefined;
760
+ }, {
761
+ name: string;
762
+ id: string;
763
+ distribution: {
764
+ binary?: {
765
+ "darwin-aarch64"?: {
766
+ archive?: string | undefined;
767
+ cmd?: string | undefined;
768
+ } | undefined;
769
+ "darwin-x86_64"?: {
770
+ archive?: string | undefined;
771
+ cmd?: string | undefined;
772
+ } | undefined;
773
+ "linux-aarch64"?: {
774
+ archive?: string | undefined;
775
+ cmd?: string | undefined;
776
+ } | undefined;
777
+ "linux-x86_64"?: {
778
+ archive?: string | undefined;
779
+ cmd?: string | undefined;
780
+ } | undefined;
781
+ "windows-x86_64"?: {
782
+ archive?: string | undefined;
783
+ cmd?: string | undefined;
784
+ } | undefined;
785
+ "windows-aarch64"?: {
786
+ archive?: string | undefined;
787
+ cmd?: string | undefined;
788
+ } | undefined;
789
+ } | undefined;
790
+ npx?: {
791
+ package: string;
792
+ args?: string[] | undefined;
793
+ env?: Record<string, string> | undefined;
794
+ } | undefined;
795
+ uvx?: {
796
+ package: string;
797
+ args?: string[] | undefined;
798
+ env?: Record<string, string> | undefined;
799
+ } | undefined;
800
+ };
801
+ version?: string | undefined;
802
+ description?: string | undefined;
803
+ authors?: string[] | undefined;
804
+ license?: string | undefined;
805
+ icon?: string | undefined;
806
+ repository?: string | undefined;
807
+ website?: string | undefined;
808
+ }>, "many">;
809
+ extensions: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
810
+ }, "strip", z.ZodTypeAny, {
811
+ version: string;
812
+ agents: {
813
+ name: string;
814
+ id: string;
815
+ distribution: {
816
+ binary?: {
817
+ "darwin-aarch64"?: {
818
+ archive?: string | undefined;
819
+ cmd?: string | undefined;
820
+ } | undefined;
821
+ "darwin-x86_64"?: {
822
+ archive?: string | undefined;
823
+ cmd?: string | undefined;
824
+ } | undefined;
825
+ "linux-aarch64"?: {
826
+ archive?: string | undefined;
827
+ cmd?: string | undefined;
828
+ } | undefined;
829
+ "linux-x86_64"?: {
830
+ archive?: string | undefined;
831
+ cmd?: string | undefined;
832
+ } | undefined;
833
+ "windows-x86_64"?: {
834
+ archive?: string | undefined;
835
+ cmd?: string | undefined;
836
+ } | undefined;
837
+ "windows-aarch64"?: {
838
+ archive?: string | undefined;
839
+ cmd?: string | undefined;
840
+ } | undefined;
841
+ } | undefined;
842
+ npx?: {
843
+ package: string;
844
+ args?: string[] | undefined;
845
+ env?: Record<string, string> | undefined;
846
+ } | undefined;
847
+ uvx?: {
848
+ package: string;
849
+ args?: string[] | undefined;
850
+ env?: Record<string, string> | undefined;
851
+ } | undefined;
852
+ };
853
+ version?: string | undefined;
854
+ description?: string | undefined;
855
+ authors?: string[] | undefined;
856
+ license?: string | undefined;
857
+ icon?: string | undefined;
858
+ repository?: string | undefined;
859
+ website?: string | undefined;
860
+ }[];
861
+ extensions?: unknown[] | undefined;
862
+ }, {
863
+ version: string;
864
+ agents: {
865
+ name: string;
866
+ id: string;
867
+ distribution: {
868
+ binary?: {
869
+ "darwin-aarch64"?: {
870
+ archive?: string | undefined;
871
+ cmd?: string | undefined;
872
+ } | undefined;
873
+ "darwin-x86_64"?: {
874
+ archive?: string | undefined;
875
+ cmd?: string | undefined;
876
+ } | undefined;
877
+ "linux-aarch64"?: {
878
+ archive?: string | undefined;
879
+ cmd?: string | undefined;
880
+ } | undefined;
881
+ "linux-x86_64"?: {
882
+ archive?: string | undefined;
883
+ cmd?: string | undefined;
884
+ } | undefined;
885
+ "windows-x86_64"?: {
886
+ archive?: string | undefined;
887
+ cmd?: string | undefined;
888
+ } | undefined;
889
+ "windows-aarch64"?: {
890
+ archive?: string | undefined;
891
+ cmd?: string | undefined;
892
+ } | undefined;
893
+ } | undefined;
894
+ npx?: {
895
+ package: string;
896
+ args?: string[] | undefined;
897
+ env?: Record<string, string> | undefined;
898
+ } | undefined;
899
+ uvx?: {
900
+ package: string;
901
+ args?: string[] | undefined;
902
+ env?: Record<string, string> | undefined;
903
+ } | undefined;
904
+ };
905
+ version?: string | undefined;
906
+ description?: string | undefined;
907
+ authors?: string[] | undefined;
908
+ license?: string | undefined;
909
+ icon?: string | undefined;
910
+ repository?: string | undefined;
911
+ website?: string | undefined;
912
+ }[];
913
+ extensions?: unknown[] | undefined;
914
+ }>;
915
+ type RegistryDocument = z.infer<typeof RegistryDocument>;
916
+ declare class Registry {
917
+ private config;
918
+ private cache;
919
+ constructor(config: HydraConfig);
920
+ load(): Promise<RegistryDocument>;
921
+ refresh(): Promise<RegistryDocument>;
922
+ getAgent(id: string): Promise<RegistryAgent | undefined>;
923
+ private isFresh;
924
+ private fetchFromNetwork;
925
+ private readDiskCache;
926
+ private writeDiskCache;
927
+ }
928
+ interface SpawnPlan {
929
+ command: string;
930
+ args: string[];
931
+ env: Record<string, string>;
932
+ }
933
+ declare function planSpawn(agent: RegistryAgent, extraArgs?: string[]): SpawnPlan;
934
+
935
+ type JsonRpcId = string | number;
936
+ interface JsonRpcRequest {
937
+ jsonrpc: "2.0";
938
+ id: JsonRpcId;
939
+ method: string;
940
+ params?: unknown;
941
+ }
942
+ interface JsonRpcNotification {
943
+ jsonrpc: "2.0";
944
+ method: string;
945
+ params?: unknown;
946
+ }
947
+ interface JsonRpcResponse {
948
+ jsonrpc: "2.0";
949
+ id: JsonRpcId;
950
+ result?: unknown;
951
+ error?: JsonRpcError;
952
+ }
953
+ interface JsonRpcError {
954
+ code: number;
955
+ message: string;
956
+ data?: unknown;
957
+ }
958
+ type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;
959
+ declare const HistoryPolicy: z.ZodEnum<["full", "pending_only", "none"]>;
960
+ type HistoryPolicy = z.infer<typeof HistoryPolicy>;
961
+ declare const SessionAttachParams: z.ZodObject<{
962
+ sessionId: z.ZodString;
963
+ historyPolicy: z.ZodDefault<z.ZodEnum<["full", "pending_only", "none"]>>;
964
+ clientInfo: z.ZodOptional<z.ZodObject<{
965
+ name: z.ZodString;
966
+ version: z.ZodOptional<z.ZodString>;
967
+ }, "strip", z.ZodTypeAny, {
968
+ name: string;
969
+ version?: string | undefined;
970
+ }, {
971
+ name: string;
972
+ version?: string | undefined;
973
+ }>>;
974
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
975
+ }, "strip", z.ZodTypeAny, {
976
+ sessionId: string;
977
+ historyPolicy: "full" | "pending_only" | "none";
978
+ clientInfo?: {
979
+ name: string;
980
+ version?: string | undefined;
981
+ } | undefined;
982
+ _meta?: Record<string, unknown> | undefined;
983
+ }, {
984
+ sessionId: string;
985
+ clientInfo?: {
986
+ name: string;
987
+ version?: string | undefined;
988
+ } | undefined;
989
+ historyPolicy?: "full" | "pending_only" | "none" | undefined;
990
+ _meta?: Record<string, unknown> | undefined;
991
+ }>;
992
+ type SessionAttachParams = z.infer<typeof SessionAttachParams>;
993
+ declare const SessionDetachParams: z.ZodObject<{
994
+ sessionId: z.ZodString;
995
+ }, "strip", z.ZodTypeAny, {
996
+ sessionId: string;
997
+ }, {
998
+ sessionId: string;
999
+ }>;
1000
+ type SessionDetachParams = z.infer<typeof SessionDetachParams>;
1001
+ declare const SessionListParams: z.ZodObject<{
1002
+ cwd: z.ZodOptional<z.ZodString>;
1003
+ cursor: z.ZodOptional<z.ZodString>;
1004
+ limit: z.ZodOptional<z.ZodNumber>;
1005
+ }, "strip", z.ZodTypeAny, {
1006
+ cwd?: string | undefined;
1007
+ cursor?: string | undefined;
1008
+ limit?: number | undefined;
1009
+ }, {
1010
+ cwd?: string | undefined;
1011
+ cursor?: string | undefined;
1012
+ limit?: number | undefined;
1013
+ }>;
1014
+ type SessionListParams = z.infer<typeof SessionListParams>;
1015
+ declare const SessionListEntry: z.ZodObject<{
1016
+ sessionId: z.ZodString;
1017
+ upstreamSessionId: z.ZodOptional<z.ZodString>;
1018
+ cwd: z.ZodString;
1019
+ title: z.ZodOptional<z.ZodString>;
1020
+ agentId: z.ZodOptional<z.ZodString>;
1021
+ updatedAt: z.ZodString;
1022
+ attachedClients: z.ZodNumber;
1023
+ status: z.ZodDefault<z.ZodEnum<["live", "cold"]>>;
1024
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1025
+ }, "strip", z.ZodTypeAny, {
1026
+ status: "live" | "cold";
1027
+ cwd: string;
1028
+ sessionId: string;
1029
+ updatedAt: string;
1030
+ attachedClients: number;
1031
+ agentId?: string | undefined;
1032
+ upstreamSessionId?: string | undefined;
1033
+ title?: string | undefined;
1034
+ _meta?: Record<string, unknown> | undefined;
1035
+ }, {
1036
+ cwd: string;
1037
+ sessionId: string;
1038
+ updatedAt: string;
1039
+ attachedClients: number;
1040
+ status?: "live" | "cold" | undefined;
1041
+ agentId?: string | undefined;
1042
+ upstreamSessionId?: string | undefined;
1043
+ title?: string | undefined;
1044
+ _meta?: Record<string, unknown> | undefined;
1045
+ }>;
1046
+ type SessionListEntry = z.infer<typeof SessionListEntry>;
1047
+ declare const SessionListResult: z.ZodObject<{
1048
+ sessions: z.ZodArray<z.ZodObject<{
1049
+ sessionId: z.ZodString;
1050
+ upstreamSessionId: z.ZodOptional<z.ZodString>;
1051
+ cwd: z.ZodString;
1052
+ title: z.ZodOptional<z.ZodString>;
1053
+ agentId: z.ZodOptional<z.ZodString>;
1054
+ updatedAt: z.ZodString;
1055
+ attachedClients: z.ZodNumber;
1056
+ status: z.ZodDefault<z.ZodEnum<["live", "cold"]>>;
1057
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1058
+ }, "strip", z.ZodTypeAny, {
1059
+ status: "live" | "cold";
1060
+ cwd: string;
1061
+ sessionId: string;
1062
+ updatedAt: string;
1063
+ attachedClients: number;
1064
+ agentId?: string | undefined;
1065
+ upstreamSessionId?: string | undefined;
1066
+ title?: string | undefined;
1067
+ _meta?: Record<string, unknown> | undefined;
1068
+ }, {
1069
+ cwd: string;
1070
+ sessionId: string;
1071
+ updatedAt: string;
1072
+ attachedClients: number;
1073
+ status?: "live" | "cold" | undefined;
1074
+ agentId?: string | undefined;
1075
+ upstreamSessionId?: string | undefined;
1076
+ title?: string | undefined;
1077
+ _meta?: Record<string, unknown> | undefined;
1078
+ }>, "many">;
1079
+ nextCursor: z.ZodOptional<z.ZodString>;
1080
+ }, "strip", z.ZodTypeAny, {
1081
+ sessions: {
1082
+ status: "live" | "cold";
1083
+ cwd: string;
1084
+ sessionId: string;
1085
+ updatedAt: string;
1086
+ attachedClients: number;
1087
+ agentId?: string | undefined;
1088
+ upstreamSessionId?: string | undefined;
1089
+ title?: string | undefined;
1090
+ _meta?: Record<string, unknown> | undefined;
1091
+ }[];
1092
+ nextCursor?: string | undefined;
1093
+ }, {
1094
+ sessions: {
1095
+ cwd: string;
1096
+ sessionId: string;
1097
+ updatedAt: string;
1098
+ attachedClients: number;
1099
+ status?: "live" | "cold" | undefined;
1100
+ agentId?: string | undefined;
1101
+ upstreamSessionId?: string | undefined;
1102
+ title?: string | undefined;
1103
+ _meta?: Record<string, unknown> | undefined;
1104
+ }[];
1105
+ nextCursor?: string | undefined;
1106
+ }>;
1107
+ type SessionListResult = z.infer<typeof SessionListResult>;
1108
+ interface SessionCapabilities {
1109
+ attach?: Record<string, never>;
1110
+ list?: boolean;
1111
+ }
1112
+ interface PromptCapabilities {
1113
+ image?: boolean;
1114
+ audio?: boolean;
1115
+ embeddedContext?: boolean;
1116
+ }
1117
+ interface McpCapabilities {
1118
+ http?: boolean;
1119
+ sse?: boolean;
1120
+ }
1121
+ interface AgentCapabilities {
1122
+ promptCapabilities?: PromptCapabilities;
1123
+ mcpCapabilities?: McpCapabilities;
1124
+ loadSession?: boolean;
1125
+ sessionCapabilities?: SessionCapabilities;
1126
+ }
1127
+ interface InitializeResult {
1128
+ protocolVersion: number;
1129
+ agentCapabilities: AgentCapabilities;
1130
+ agentInfo: {
1131
+ name: string;
1132
+ version: string;
1133
+ };
1134
+ authMethods?: Array<{
1135
+ id: string;
1136
+ description: string;
1137
+ }>;
1138
+ }
1139
+
1140
+ interface MessageStream {
1141
+ send(message: JsonRpcMessage): Promise<void>;
1142
+ onMessage(handler: (message: JsonRpcMessage) => void): void;
1143
+ onClose(handler: (err?: Error) => void): void;
1144
+ close(): Promise<void>;
1145
+ }
1146
+ declare function ndjsonStreamFromStdio(stdout: Readable, stdin: Writable): MessageStream;
1147
+
1148
+ type RequestHandler = (params: unknown, method: string) => Promise<unknown>;
1149
+ type NotificationHandler = (params: unknown, method: string) => void;
1150
+ declare class JsonRpcConnection {
1151
+ private stream;
1152
+ private requestHandlers;
1153
+ private defaultRequestHandler;
1154
+ private notificationHandlers;
1155
+ private pending;
1156
+ private closed;
1157
+ private closeHandlers;
1158
+ constructor(stream: MessageStream);
1159
+ onRequest(method: string, handler: RequestHandler): void;
1160
+ setDefaultHandler(handler: RequestHandler): void;
1161
+ onNotification(method: string, handler: NotificationHandler): void;
1162
+ onClose(handler: (err?: Error) => void): void;
1163
+ request<T = unknown>(method: string, params?: unknown): Promise<T>;
1164
+ requestWithId<T = unknown>(method: string, params?: unknown): {
1165
+ id: JsonRpcId;
1166
+ response: Promise<T>;
1167
+ };
1168
+ notify(method: string, params?: unknown): Promise<void>;
1169
+ close(): Promise<void>;
1170
+ private handleIncoming;
1171
+ private handleRequest;
1172
+ private handleNotification;
1173
+ private handleResponse;
1174
+ private sendError;
1175
+ private handleClose;
1176
+ }
1177
+
1178
+ interface AgentInstanceOptions {
1179
+ agentId: string;
1180
+ cwd: string;
1181
+ plan: SpawnPlan;
1182
+ extraEnv?: Record<string, string>;
1183
+ }
1184
+ declare class AgentInstance {
1185
+ readonly agentId: string;
1186
+ readonly cwd: string;
1187
+ readonly connection: JsonRpcConnection;
1188
+ private child;
1189
+ private exited;
1190
+ private exitHandlers;
1191
+ private constructor();
1192
+ static spawn(opts: AgentInstanceOptions): AgentInstance;
1193
+ onExit(handler: (code: number | null, signal: NodeJS.Signals | null) => void): void;
1194
+ isAlive(): boolean;
1195
+ kill(signal?: NodeJS.Signals): Promise<void>;
1196
+ }
1197
+
1198
+ interface AttachedClient {
1199
+ clientId: string;
1200
+ connection: JsonRpcConnection;
1201
+ clientInfo?: {
1202
+ name: string;
1203
+ version?: string;
1204
+ };
1205
+ }
1206
+ interface CachedNotification {
1207
+ method: string;
1208
+ params: unknown;
1209
+ recordedAt: number;
1210
+ }
1211
+ interface SpawnReplacementAgentParams {
1212
+ agentId: string;
1213
+ cwd: string;
1214
+ agentArgs?: string[];
1215
+ }
1216
+ interface SpawnReplacementAgentResult {
1217
+ agent: AgentInstance;
1218
+ upstreamSessionId: string;
1219
+ agentMeta?: Record<string, unknown>;
1220
+ }
1221
+ type SpawnReplacementAgent = (params: SpawnReplacementAgentParams) => Promise<SpawnReplacementAgentResult>;
1222
+ interface SessionInit {
1223
+ cwd: string;
1224
+ agentId: string;
1225
+ agent: AgentInstance;
1226
+ upstreamSessionId: string;
1227
+ title?: string;
1228
+ sessionId?: string;
1229
+ agentMeta?: Record<string, unknown>;
1230
+ agentArgs?: string[];
1231
+ idleTimeoutMs?: number;
1232
+ spawnReplacementAgent?: SpawnReplacementAgent;
1233
+ }
1234
+ interface CloseOptions {
1235
+ deleteRecord?: boolean;
1236
+ }
1237
+ declare class Session {
1238
+ readonly sessionId: string;
1239
+ readonly cwd: string;
1240
+ agentId: string;
1241
+ agent: AgentInstance;
1242
+ upstreamSessionId: string;
1243
+ agentMeta: Record<string, unknown> | undefined;
1244
+ readonly agentArgs: string[] | undefined;
1245
+ title: string | undefined;
1246
+ updatedAt: number;
1247
+ private clients;
1248
+ private history;
1249
+ private promptQueue;
1250
+ private promptInFlight;
1251
+ private closed;
1252
+ private closeHandlers;
1253
+ private titleHandlers;
1254
+ private firstPromptSeeded;
1255
+ private inFlightPermissions;
1256
+ private internalPromptCapture;
1257
+ private idleTimeoutMs;
1258
+ private idleTimer;
1259
+ private spawnReplacementAgent;
1260
+ private agentChangeHandlers;
1261
+ private agentAdvertisedCommands;
1262
+ constructor(init: SessionInit);
1263
+ private broadcastMergedCommands;
1264
+ private wireAgent;
1265
+ onAgentChange(handler: (info: {
1266
+ agentId: string;
1267
+ upstreamSessionId: string;
1268
+ }) => void): void;
1269
+ get attachedCount(): number;
1270
+ attach(client: AttachedClient, historyPolicy: HistoryPolicy): CachedNotification[];
1271
+ replayPendingPermissions(client: AttachedClient): void;
1272
+ detach(clientId: string): void;
1273
+ prompt(clientId: string, params: unknown): Promise<unknown>;
1274
+ private broadcastPromptReceived;
1275
+ private broadcastTurnComplete;
1276
+ cancel(clientId: string): Promise<void>;
1277
+ forwardRequest(method: string, params: unknown): Promise<unknown>;
1278
+ private rewriteForAgent;
1279
+ close(opts?: CloseOptions): Promise<void>;
1280
+ onClose(handler: (opts: {
1281
+ deleteRecord: boolean;
1282
+ }) => void): void;
1283
+ onTitleChange(handler: (title: string) => void): void;
1284
+ private setTitle;
1285
+ private maybeSeedTitleFromPrompt;
1286
+ private maybeApplyAgentSessionInfo;
1287
+ private handleSlashCommand;
1288
+ private runTitleCommand;
1289
+ private runTitleRegen;
1290
+ private runInternalPrompt;
1291
+ private runSwitchCommand;
1292
+ private buildSwitchTranscript;
1293
+ private broadcastAgentSwitch;
1294
+ private markClosed;
1295
+ private maybeStartIdleTimer;
1296
+ private cancelIdleTimer;
1297
+ private rewriteForClient;
1298
+ private recordAndBroadcast;
1299
+ private handlePermissionRequest;
1300
+ private enqueuePrompt;
1301
+ private drainQueue;
1302
+ }
1303
+
1304
+ declare const SessionRecord: z.ZodObject<{
1305
+ version: z.ZodLiteral<1>;
1306
+ sessionId: z.ZodString;
1307
+ upstreamSessionId: z.ZodString;
1308
+ agentId: z.ZodString;
1309
+ cwd: z.ZodString;
1310
+ title: z.ZodOptional<z.ZodString>;
1311
+ agentArgs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1312
+ createdAt: z.ZodString;
1313
+ updatedAt: z.ZodString;
1314
+ }, "strip", z.ZodTypeAny, {
1315
+ version: 1;
1316
+ cwd: string;
1317
+ agentId: string;
1318
+ upstreamSessionId: string;
1319
+ sessionId: string;
1320
+ updatedAt: string;
1321
+ createdAt: string;
1322
+ title?: string | undefined;
1323
+ agentArgs?: string[] | undefined;
1324
+ }, {
1325
+ version: 1;
1326
+ cwd: string;
1327
+ agentId: string;
1328
+ upstreamSessionId: string;
1329
+ sessionId: string;
1330
+ updatedAt: string;
1331
+ createdAt: string;
1332
+ title?: string | undefined;
1333
+ agentArgs?: string[] | undefined;
1334
+ }>;
1335
+ type SessionRecord = z.infer<typeof SessionRecord>;
1336
+ declare class SessionStore {
1337
+ write(record: Omit<SessionRecord, "version">): Promise<void>;
1338
+ read(sessionId: string): Promise<SessionRecord | undefined>;
1339
+ delete(sessionId: string): Promise<void>;
1340
+ list(): Promise<SessionRecord[]>;
1341
+ }
1342
+
1343
+ interface CreateSessionParams {
1344
+ cwd: string;
1345
+ agentId: string;
1346
+ mcpServers?: unknown[];
1347
+ title?: string;
1348
+ agentArgs?: string[];
1349
+ }
1350
+ interface ResurrectParams {
1351
+ hydraSessionId: string;
1352
+ upstreamSessionId: string;
1353
+ agentId: string;
1354
+ cwd: string;
1355
+ title?: string;
1356
+ agentArgs?: string[];
1357
+ }
1358
+ type AgentSpawner = (opts: AgentInstanceOptions) => AgentInstance;
1359
+ interface SessionManagerOptions {
1360
+ idleTimeoutMs?: number;
1361
+ }
1362
+ declare class SessionManager {
1363
+ private registry;
1364
+ private sessions;
1365
+ private resurrectionInflight;
1366
+ private spawner;
1367
+ private store;
1368
+ private idleTimeoutMs;
1369
+ constructor(registry: Registry, spawner?: AgentSpawner, store?: SessionStore, options?: SessionManagerOptions);
1370
+ create(params: CreateSessionParams): Promise<Session>;
1371
+ resurrect(params: ResurrectParams): Promise<Session>;
1372
+ private doResurrect;
1373
+ private bootstrapAgent;
1374
+ private attachManagerHooks;
1375
+ loadFromDisk(sessionId: string): Promise<ResurrectParams | undefined>;
1376
+ get(sessionId: string): Session | undefined;
1377
+ resolveCanonicalId(input: string): Promise<string | undefined>;
1378
+ require(sessionId: string): Session;
1379
+ list(filter?: {
1380
+ cwd?: string;
1381
+ }): Promise<SessionListEntry[]>;
1382
+ deleteRecord(sessionId: string): Promise<boolean>;
1383
+ private persistTitle;
1384
+ private persistAgentChange;
1385
+ closeAll(): Promise<void>;
1386
+ }
1387
+
1388
+ interface ExtensionContext {
1389
+ daemonUrl: string;
1390
+ daemonHost: string;
1391
+ daemonPort: number;
1392
+ daemonToken: string;
1393
+ daemonWsUrl: string;
1394
+ hydraHome: string;
1395
+ }
1396
+ type ExtensionStatus = "running" | "stopped" | "restarting" | "disabled";
1397
+ interface ExtensionInfo {
1398
+ name: string;
1399
+ status: ExtensionStatus;
1400
+ pid: number | undefined;
1401
+ enabled: boolean;
1402
+ restartCount: number;
1403
+ startedAt: number | undefined;
1404
+ lastExitCode: number | undefined;
1405
+ logPath: string;
1406
+ }
1407
+ declare class ExtensionManager {
1408
+ private entries;
1409
+ private stopping;
1410
+ private context;
1411
+ constructor(extensions: ExtensionConfig[], context?: ExtensionContext);
1412
+ setContext(context: ExtensionContext): void;
1413
+ start(): Promise<void>;
1414
+ stop(): Promise<void>;
1415
+ list(): ExtensionInfo[];
1416
+ get(name: string): ExtensionInfo | undefined;
1417
+ has(name: string): boolean;
1418
+ startByName(name: string): Promise<ExtensionInfo>;
1419
+ stopByName(name: string): Promise<ExtensionInfo>;
1420
+ restartByName(name: string): Promise<ExtensionInfo>;
1421
+ register(config: ExtensionConfig): ExtensionInfo;
1422
+ unregister(name: string): Promise<void>;
1423
+ private terminate;
1424
+ private infoFor;
1425
+ private makeEntry;
1426
+ private reapOrphans;
1427
+ private spawn;
1428
+ private scheduleRestart;
1429
+ }
1430
+
1431
+ declare module "fastify" {
1432
+ interface FastifyContextConfig {
1433
+ skipAuth?: boolean;
1434
+ }
1435
+ }
1436
+ interface DaemonHandle {
1437
+ app: FastifyInstance;
1438
+ manager: SessionManager;
1439
+ registry: Registry;
1440
+ extensions: ExtensionManager;
1441
+ shutdown: () => Promise<void>;
1442
+ }
1443
+ declare function startDaemon(config: HydraConfig): Promise<DaemonHandle>;
1444
+
1445
+ declare function wsToMessageStream(ws: WebSocket): MessageStream;
1446
+
1447
+ declare function hydraHome(): string;
1448
+ declare const paths: {
1449
+ home: typeof hydraHome;
1450
+ config: () => string;
1451
+ pidFile: () => string;
1452
+ logFile: () => string;
1453
+ currentLogFile: () => string;
1454
+ registryCache: () => string;
1455
+ agentsDir: () => string;
1456
+ agentDir: (id: string) => string;
1457
+ sessionsDir: () => string;
1458
+ sessionFile: (id: string) => string;
1459
+ extensionsDir: () => string;
1460
+ extensionLogFile: (name: string) => string;
1461
+ extensionPidFile: (name: string) => string;
1462
+ tuiHistoryFile: () => string;
1463
+ };
1464
+
1465
+ export { type AgentCapabilities, AgentInstance, HistoryPolicy, HydraConfig, type InitializeResult, JsonRpcConnection, type MessageStream, Registry, Session, SessionAttachParams, type SessionCapabilities, SessionDetachParams, SessionListEntry, SessionListParams, SessionListResult, SessionManager, defaultConfig, ensureConfig, generateAuthToken, loadConfig, ndjsonStreamFromStdio, paths, planSpawn, startDaemon, writeConfig, wsToMessageStream };