@the-seeker/server-agent 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,736 @@
1
+ import { z } from "zod";
2
+ export declare const PROTOCOL_VERSION = 1;
3
+ export declare const MAX_HEARTBEAT_BYTES = 131072;
4
+ export declare const MAX_RESPONSE_BYTES = 393216;
5
+ export declare const LOG_LINES_OPTIONS: readonly [100, 200, 500];
6
+ export declare const LOG_MAX_BYTES = 262144;
7
+ export declare const REQUEST_TIMEOUT_MS = 20000;
8
+ export declare const OFFLINE_AFTER_MS = 90000;
9
+ export declare const PROCESS_HISTORY_INTERVAL_MS = 60000;
10
+ export declare const SourceKindSchema: z.ZodEnum<{
11
+ pm2_out: "pm2_out";
12
+ pm2_err: "pm2_err";
13
+ nginx_access: "nginx_access";
14
+ nginx_error: "nginx_error";
15
+ systemd_journal: "systemd_journal";
16
+ }>;
17
+ export declare const SourceSchema: z.ZodObject<{
18
+ id: z.ZodString;
19
+ kind: z.ZodEnum<{
20
+ pm2_out: "pm2_out";
21
+ pm2_err: "pm2_err";
22
+ nginx_access: "nginx_access";
23
+ nginx_error: "nginx_error";
24
+ systemd_journal: "systemd_journal";
25
+ }>;
26
+ label: z.ZodString;
27
+ group: z.ZodString;
28
+ }, z.core.$strict>;
29
+ export type SourceKind = z.infer<typeof SourceKindSchema>;
30
+ export type Source = z.infer<typeof SourceSchema>;
31
+ export declare function makeSourceId(kind: SourceKind, rawName: string): string;
32
+ export declare const CapabilityStateSchema: z.ZodEnum<{
33
+ error: "error";
34
+ available: "available";
35
+ unsupported: "unsupported";
36
+ not_installed: "not_installed";
37
+ permission_denied: "permission_denied";
38
+ }>;
39
+ export declare const CapabilitiesSchema: z.ZodObject<{
40
+ host: z.ZodEnum<{
41
+ error: "error";
42
+ available: "available";
43
+ unsupported: "unsupported";
44
+ not_installed: "not_installed";
45
+ permission_denied: "permission_denied";
46
+ }>;
47
+ pm2: z.ZodEnum<{
48
+ error: "error";
49
+ available: "available";
50
+ unsupported: "unsupported";
51
+ not_installed: "not_installed";
52
+ permission_denied: "permission_denied";
53
+ }>;
54
+ systemd: z.ZodEnum<{
55
+ error: "error";
56
+ available: "available";
57
+ unsupported: "unsupported";
58
+ not_installed: "not_installed";
59
+ permission_denied: "permission_denied";
60
+ }>;
61
+ nginx: z.ZodEnum<{
62
+ error: "error";
63
+ available: "available";
64
+ unsupported: "unsupported";
65
+ not_installed: "not_installed";
66
+ permission_denied: "permission_denied";
67
+ }>;
68
+ }, z.core.$strict>;
69
+ export type CapabilityState = z.infer<typeof CapabilityStateSchema>;
70
+ export type Capabilities = z.infer<typeof CapabilitiesSchema>;
71
+ export declare const HostSchema: z.ZodObject<{
72
+ cpu_pct: z.ZodNullable<z.ZodNumber>;
73
+ cpu_count: z.ZodNumber;
74
+ load: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
75
+ mem: z.ZodNullable<z.ZodObject<{
76
+ used: z.ZodNumber;
77
+ total: z.ZodNumber;
78
+ }, z.core.$strict>>;
79
+ swap: z.ZodNullable<z.ZodObject<{
80
+ used: z.ZodNumber;
81
+ total: z.ZodNumber;
82
+ }, z.core.$strict>>;
83
+ disks: z.ZodArray<z.ZodObject<{
84
+ mount: z.ZodString;
85
+ fs: z.ZodString;
86
+ used: z.ZodNumber;
87
+ total: z.ZodNumber;
88
+ }, z.core.$strict>>;
89
+ net: z.ZodObject<{
90
+ rx_bps: z.ZodNullable<z.ZodNumber>;
91
+ tx_bps: z.ZodNullable<z.ZodNumber>;
92
+ }, z.core.$strict>;
93
+ uptime_sec: z.ZodNumber;
94
+ }, z.core.$strict>;
95
+ export declare const ProcessSchema: z.ZodObject<{
96
+ name: z.ZodString;
97
+ pm_id: z.ZodNumber;
98
+ status: z.ZodString;
99
+ cpu_pct: z.ZodNumber;
100
+ memory_bytes: z.ZodNumber;
101
+ restarts: z.ZodNumber;
102
+ unstable_restarts: z.ZodNumber;
103
+ uptime_ms: z.ZodNullable<z.ZodNumber>;
104
+ version: z.ZodNullable<z.ZodString>;
105
+ exec_mode: z.ZodNullable<z.ZodString>;
106
+ }, z.core.$strict>;
107
+ export declare const ServiceSchema: z.ZodObject<{
108
+ unit: z.ZodString;
109
+ active_state: z.ZodString;
110
+ sub_state: z.ZodString;
111
+ }, z.core.$strict>;
112
+ export type Host = z.infer<typeof HostSchema>;
113
+ export type Process = z.infer<typeof ProcessSchema>;
114
+ export type Service = z.infer<typeof ServiceSchema>;
115
+ export declare const HelloFrameSchema: z.ZodObject<{
116
+ type: z.ZodLiteral<"hello">;
117
+ protocol_version: z.ZodLiteral<1>;
118
+ agent_version: z.ZodString;
119
+ hostname: z.ZodString;
120
+ os: z.ZodObject<{
121
+ platform: z.ZodEnum<{
122
+ linux: "linux";
123
+ darwin: "darwin";
124
+ }>;
125
+ release: z.ZodString;
126
+ arch: z.ZodString;
127
+ }, z.core.$strict>;
128
+ cpu_count: z.ZodNumber;
129
+ boot_time: z.ZodISODateTime;
130
+ capabilities: z.ZodObject<{
131
+ host: z.ZodEnum<{
132
+ error: "error";
133
+ available: "available";
134
+ unsupported: "unsupported";
135
+ not_installed: "not_installed";
136
+ permission_denied: "permission_denied";
137
+ }>;
138
+ pm2: z.ZodEnum<{
139
+ error: "error";
140
+ available: "available";
141
+ unsupported: "unsupported";
142
+ not_installed: "not_installed";
143
+ permission_denied: "permission_denied";
144
+ }>;
145
+ systemd: z.ZodEnum<{
146
+ error: "error";
147
+ available: "available";
148
+ unsupported: "unsupported";
149
+ not_installed: "not_installed";
150
+ permission_denied: "permission_denied";
151
+ }>;
152
+ nginx: z.ZodEnum<{
153
+ error: "error";
154
+ available: "available";
155
+ unsupported: "unsupported";
156
+ not_installed: "not_installed";
157
+ permission_denied: "permission_denied";
158
+ }>;
159
+ }, z.core.$strict>;
160
+ sources: z.ZodArray<z.ZodObject<{
161
+ id: z.ZodString;
162
+ kind: z.ZodEnum<{
163
+ pm2_out: "pm2_out";
164
+ pm2_err: "pm2_err";
165
+ nginx_access: "nginx_access";
166
+ nginx_error: "nginx_error";
167
+ systemd_journal: "systemd_journal";
168
+ }>;
169
+ label: z.ZodString;
170
+ group: z.ZodString;
171
+ }, z.core.$strict>>;
172
+ }, z.core.$strict>;
173
+ export declare const HeartbeatFrameSchema: z.ZodObject<{
174
+ type: z.ZodLiteral<"heartbeat">;
175
+ seq: z.ZodNumber;
176
+ collected_at: z.ZodISODateTime;
177
+ host: z.ZodObject<{
178
+ cpu_pct: z.ZodNullable<z.ZodNumber>;
179
+ cpu_count: z.ZodNumber;
180
+ load: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
181
+ mem: z.ZodNullable<z.ZodObject<{
182
+ used: z.ZodNumber;
183
+ total: z.ZodNumber;
184
+ }, z.core.$strict>>;
185
+ swap: z.ZodNullable<z.ZodObject<{
186
+ used: z.ZodNumber;
187
+ total: z.ZodNumber;
188
+ }, z.core.$strict>>;
189
+ disks: z.ZodArray<z.ZodObject<{
190
+ mount: z.ZodString;
191
+ fs: z.ZodString;
192
+ used: z.ZodNumber;
193
+ total: z.ZodNumber;
194
+ }, z.core.$strict>>;
195
+ net: z.ZodObject<{
196
+ rx_bps: z.ZodNullable<z.ZodNumber>;
197
+ tx_bps: z.ZodNullable<z.ZodNumber>;
198
+ }, z.core.$strict>;
199
+ uptime_sec: z.ZodNumber;
200
+ }, z.core.$strict>;
201
+ processes: z.ZodArray<z.ZodObject<{
202
+ name: z.ZodString;
203
+ pm_id: z.ZodNumber;
204
+ status: z.ZodString;
205
+ cpu_pct: z.ZodNumber;
206
+ memory_bytes: z.ZodNumber;
207
+ restarts: z.ZodNumber;
208
+ unstable_restarts: z.ZodNumber;
209
+ uptime_ms: z.ZodNullable<z.ZodNumber>;
210
+ version: z.ZodNullable<z.ZodString>;
211
+ exec_mode: z.ZodNullable<z.ZodString>;
212
+ }, z.core.$strict>>;
213
+ services: z.ZodArray<z.ZodObject<{
214
+ unit: z.ZodString;
215
+ active_state: z.ZodString;
216
+ sub_state: z.ZodString;
217
+ }, z.core.$strict>>;
218
+ capabilities: z.ZodObject<{
219
+ host: z.ZodEnum<{
220
+ error: "error";
221
+ available: "available";
222
+ unsupported: "unsupported";
223
+ not_installed: "not_installed";
224
+ permission_denied: "permission_denied";
225
+ }>;
226
+ pm2: z.ZodEnum<{
227
+ error: "error";
228
+ available: "available";
229
+ unsupported: "unsupported";
230
+ not_installed: "not_installed";
231
+ permission_denied: "permission_denied";
232
+ }>;
233
+ systemd: z.ZodEnum<{
234
+ error: "error";
235
+ available: "available";
236
+ unsupported: "unsupported";
237
+ not_installed: "not_installed";
238
+ permission_denied: "permission_denied";
239
+ }>;
240
+ nginx: z.ZodEnum<{
241
+ error: "error";
242
+ available: "available";
243
+ unsupported: "unsupported";
244
+ not_installed: "not_installed";
245
+ permission_denied: "permission_denied";
246
+ }>;
247
+ }, z.core.$strict>;
248
+ sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
249
+ id: z.ZodString;
250
+ kind: z.ZodEnum<{
251
+ pm2_out: "pm2_out";
252
+ pm2_err: "pm2_err";
253
+ nginx_access: "nginx_access";
254
+ nginx_error: "nginx_error";
255
+ systemd_journal: "systemd_journal";
256
+ }>;
257
+ label: z.ZodString;
258
+ group: z.ZodString;
259
+ }, z.core.$strict>>>;
260
+ }, z.core.$strict>;
261
+ export declare const WelcomeFrameSchema: z.ZodObject<{
262
+ interval_sec: z.ZodNumber;
263
+ watched_services: z.ZodArray<z.ZodString>;
264
+ nginx_enabled: z.ZodBoolean;
265
+ type: z.ZodLiteral<"welcome">;
266
+ server_id: z.ZodString;
267
+ connection_generation: z.ZodNumber;
268
+ }, z.core.$strict>;
269
+ export declare const ConfigFrameSchema: z.ZodObject<{
270
+ interval_sec: z.ZodNumber;
271
+ watched_services: z.ZodArray<z.ZodString>;
272
+ nginx_enabled: z.ZodBoolean;
273
+ type: z.ZodLiteral<"config">;
274
+ }, z.core.$strict>;
275
+ export declare const LogsTailParamsSchema: z.ZodObject<{
276
+ source_id: z.ZodString;
277
+ lines: z.ZodLiteral<100 | 200 | 500>;
278
+ }, z.core.$strict>;
279
+ export declare const ServiceStatusParamsSchema: z.ZodObject<{
280
+ unit: z.ZodString;
281
+ }, z.core.$strict>;
282
+ export declare const Pm2DescribeParamsSchema: z.ZodObject<{
283
+ name: z.ZodString;
284
+ }, z.core.$strict>;
285
+ export declare const NginxSourcesParamsSchema: z.ZodObject<{}, z.core.$strict>;
286
+ export type LogsTailParams = z.infer<typeof LogsTailParamsSchema>;
287
+ export type ServiceStatusParams = z.infer<typeof ServiceStatusParamsSchema>;
288
+ export type Pm2DescribeParams = z.infer<typeof Pm2DescribeParamsSchema>;
289
+ export type NginxSourcesParams = z.infer<typeof NginxSourcesParamsSchema>;
290
+ export declare const RequestFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
291
+ action: z.ZodLiteral<"logs.tail">;
292
+ params: z.ZodObject<{
293
+ source_id: z.ZodString;
294
+ lines: z.ZodLiteral<100 | 200 | 500>;
295
+ }, z.core.$strict>;
296
+ type: z.ZodLiteral<"request">;
297
+ request_id: z.ZodUUID;
298
+ }, z.core.$strict>, z.ZodObject<{
299
+ action: z.ZodLiteral<"service.status">;
300
+ params: z.ZodObject<{
301
+ unit: z.ZodString;
302
+ }, z.core.$strict>;
303
+ type: z.ZodLiteral<"request">;
304
+ request_id: z.ZodUUID;
305
+ }, z.core.$strict>, z.ZodObject<{
306
+ action: z.ZodLiteral<"pm2.describe">;
307
+ params: z.ZodObject<{
308
+ name: z.ZodString;
309
+ }, z.core.$strict>;
310
+ type: z.ZodLiteral<"request">;
311
+ request_id: z.ZodUUID;
312
+ }, z.core.$strict>, z.ZodObject<{
313
+ action: z.ZodLiteral<"nginx.sources">;
314
+ params: z.ZodObject<{}, z.core.$strict>;
315
+ type: z.ZodLiteral<"request">;
316
+ request_id: z.ZodUUID;
317
+ }, z.core.$strict>], "action">;
318
+ export declare const LogsTailPayloadSchema: z.ZodObject<{
319
+ lines: z.ZodArray<z.ZodString>;
320
+ truncated: z.ZodBoolean;
321
+ bytes: z.ZodNumber;
322
+ source_id: z.ZodString;
323
+ }, z.core.$strict>;
324
+ export declare const ServiceStatusPayloadSchema: z.ZodObject<{
325
+ unit: z.ZodString;
326
+ active_state: z.ZodString;
327
+ sub_state: z.ZodString;
328
+ }, z.core.$strict>;
329
+ export declare const Pm2DescribePayloadSchema: z.ZodObject<{
330
+ name: z.ZodString;
331
+ pm_id: z.ZodNumber;
332
+ status: z.ZodString;
333
+ cpu_pct: z.ZodNumber;
334
+ memory_bytes: z.ZodNumber;
335
+ restarts: z.ZodNumber;
336
+ unstable_restarts: z.ZodNumber;
337
+ uptime_ms: z.ZodNullable<z.ZodNumber>;
338
+ version: z.ZodNullable<z.ZodString>;
339
+ exec_mode: z.ZodNullable<z.ZodString>;
340
+ }, z.core.$strict>;
341
+ export declare const NginxSourcesPayloadSchema: z.ZodObject<{
342
+ sources: z.ZodArray<z.ZodObject<{
343
+ id: z.ZodString;
344
+ kind: z.ZodEnum<{
345
+ pm2_out: "pm2_out";
346
+ pm2_err: "pm2_err";
347
+ nginx_access: "nginx_access";
348
+ nginx_error: "nginx_error";
349
+ systemd_journal: "systemd_journal";
350
+ }>;
351
+ label: z.ZodString;
352
+ group: z.ZodString;
353
+ }, z.core.$strict>>;
354
+ }, z.core.$strict>;
355
+ export type LogsTailPayload = z.infer<typeof LogsTailPayloadSchema>;
356
+ export type ServiceStatusPayload = z.infer<typeof ServiceStatusPayloadSchema>;
357
+ export type Pm2DescribePayload = z.infer<typeof Pm2DescribePayloadSchema>;
358
+ export type NginxSourcesPayload = z.infer<typeof NginxSourcesPayloadSchema>;
359
+ export declare const ResponseErrorSchema: z.ZodObject<{
360
+ code: z.ZodEnum<{
361
+ unsupported: "unsupported";
362
+ permission_denied: "permission_denied";
363
+ not_found: "not_found";
364
+ timeout: "timeout";
365
+ too_large: "too_large";
366
+ internal: "internal";
367
+ }>;
368
+ message: z.ZodString;
369
+ }, z.core.$strict>;
370
+ export declare const SuccessResponseFrameSchema: z.ZodObject<{
371
+ type: z.ZodLiteral<"response">;
372
+ request_id: z.ZodString;
373
+ ok: z.ZodLiteral<true>;
374
+ payload: z.ZodUnion<readonly [z.ZodObject<{
375
+ lines: z.ZodArray<z.ZodString>;
376
+ truncated: z.ZodBoolean;
377
+ bytes: z.ZodNumber;
378
+ source_id: z.ZodString;
379
+ }, z.core.$strict>, z.ZodObject<{
380
+ unit: z.ZodString;
381
+ active_state: z.ZodString;
382
+ sub_state: z.ZodString;
383
+ }, z.core.$strict>, z.ZodObject<{
384
+ name: z.ZodString;
385
+ pm_id: z.ZodNumber;
386
+ status: z.ZodString;
387
+ cpu_pct: z.ZodNumber;
388
+ memory_bytes: z.ZodNumber;
389
+ restarts: z.ZodNumber;
390
+ unstable_restarts: z.ZodNumber;
391
+ uptime_ms: z.ZodNullable<z.ZodNumber>;
392
+ version: z.ZodNullable<z.ZodString>;
393
+ exec_mode: z.ZodNullable<z.ZodString>;
394
+ }, z.core.$strict>, z.ZodObject<{
395
+ sources: z.ZodArray<z.ZodObject<{
396
+ id: z.ZodString;
397
+ kind: z.ZodEnum<{
398
+ pm2_out: "pm2_out";
399
+ pm2_err: "pm2_err";
400
+ nginx_access: "nginx_access";
401
+ nginx_error: "nginx_error";
402
+ systemd_journal: "systemd_journal";
403
+ }>;
404
+ label: z.ZodString;
405
+ group: z.ZodString;
406
+ }, z.core.$strict>>;
407
+ }, z.core.$strict>]>;
408
+ }, z.core.$strict>;
409
+ export declare const ErrorResponseFrameSchema: z.ZodObject<{
410
+ type: z.ZodLiteral<"response">;
411
+ request_id: z.ZodString;
412
+ ok: z.ZodLiteral<false>;
413
+ error: z.ZodObject<{
414
+ code: z.ZodEnum<{
415
+ unsupported: "unsupported";
416
+ permission_denied: "permission_denied";
417
+ not_found: "not_found";
418
+ timeout: "timeout";
419
+ too_large: "too_large";
420
+ internal: "internal";
421
+ }>;
422
+ message: z.ZodString;
423
+ }, z.core.$strict>;
424
+ }, z.core.$strict>;
425
+ export declare const ResponseFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
426
+ type: z.ZodLiteral<"response">;
427
+ request_id: z.ZodString;
428
+ ok: z.ZodLiteral<true>;
429
+ payload: z.ZodUnion<readonly [z.ZodObject<{
430
+ lines: z.ZodArray<z.ZodString>;
431
+ truncated: z.ZodBoolean;
432
+ bytes: z.ZodNumber;
433
+ source_id: z.ZodString;
434
+ }, z.core.$strict>, z.ZodObject<{
435
+ unit: z.ZodString;
436
+ active_state: z.ZodString;
437
+ sub_state: z.ZodString;
438
+ }, z.core.$strict>, z.ZodObject<{
439
+ name: z.ZodString;
440
+ pm_id: z.ZodNumber;
441
+ status: z.ZodString;
442
+ cpu_pct: z.ZodNumber;
443
+ memory_bytes: z.ZodNumber;
444
+ restarts: z.ZodNumber;
445
+ unstable_restarts: z.ZodNumber;
446
+ uptime_ms: z.ZodNullable<z.ZodNumber>;
447
+ version: z.ZodNullable<z.ZodString>;
448
+ exec_mode: z.ZodNullable<z.ZodString>;
449
+ }, z.core.$strict>, z.ZodObject<{
450
+ sources: z.ZodArray<z.ZodObject<{
451
+ id: z.ZodString;
452
+ kind: z.ZodEnum<{
453
+ pm2_out: "pm2_out";
454
+ pm2_err: "pm2_err";
455
+ nginx_access: "nginx_access";
456
+ nginx_error: "nginx_error";
457
+ systemd_journal: "systemd_journal";
458
+ }>;
459
+ label: z.ZodString;
460
+ group: z.ZodString;
461
+ }, z.core.$strict>>;
462
+ }, z.core.$strict>]>;
463
+ }, z.core.$strict>, z.ZodObject<{
464
+ type: z.ZodLiteral<"response">;
465
+ request_id: z.ZodString;
466
+ ok: z.ZodLiteral<false>;
467
+ error: z.ZodObject<{
468
+ code: z.ZodEnum<{
469
+ unsupported: "unsupported";
470
+ permission_denied: "permission_denied";
471
+ not_found: "not_found";
472
+ timeout: "timeout";
473
+ too_large: "too_large";
474
+ internal: "internal";
475
+ }>;
476
+ message: z.ZodString;
477
+ }, z.core.$strict>;
478
+ }, z.core.$strict>], "ok">;
479
+ export declare const AgentFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
480
+ type: z.ZodLiteral<"hello">;
481
+ protocol_version: z.ZodLiteral<1>;
482
+ agent_version: z.ZodString;
483
+ hostname: z.ZodString;
484
+ os: z.ZodObject<{
485
+ platform: z.ZodEnum<{
486
+ linux: "linux";
487
+ darwin: "darwin";
488
+ }>;
489
+ release: z.ZodString;
490
+ arch: z.ZodString;
491
+ }, z.core.$strict>;
492
+ cpu_count: z.ZodNumber;
493
+ boot_time: z.ZodISODateTime;
494
+ capabilities: z.ZodObject<{
495
+ host: z.ZodEnum<{
496
+ error: "error";
497
+ available: "available";
498
+ unsupported: "unsupported";
499
+ not_installed: "not_installed";
500
+ permission_denied: "permission_denied";
501
+ }>;
502
+ pm2: z.ZodEnum<{
503
+ error: "error";
504
+ available: "available";
505
+ unsupported: "unsupported";
506
+ not_installed: "not_installed";
507
+ permission_denied: "permission_denied";
508
+ }>;
509
+ systemd: z.ZodEnum<{
510
+ error: "error";
511
+ available: "available";
512
+ unsupported: "unsupported";
513
+ not_installed: "not_installed";
514
+ permission_denied: "permission_denied";
515
+ }>;
516
+ nginx: z.ZodEnum<{
517
+ error: "error";
518
+ available: "available";
519
+ unsupported: "unsupported";
520
+ not_installed: "not_installed";
521
+ permission_denied: "permission_denied";
522
+ }>;
523
+ }, z.core.$strict>;
524
+ sources: z.ZodArray<z.ZodObject<{
525
+ id: z.ZodString;
526
+ kind: z.ZodEnum<{
527
+ pm2_out: "pm2_out";
528
+ pm2_err: "pm2_err";
529
+ nginx_access: "nginx_access";
530
+ nginx_error: "nginx_error";
531
+ systemd_journal: "systemd_journal";
532
+ }>;
533
+ label: z.ZodString;
534
+ group: z.ZodString;
535
+ }, z.core.$strict>>;
536
+ }, z.core.$strict>, z.ZodObject<{
537
+ type: z.ZodLiteral<"heartbeat">;
538
+ seq: z.ZodNumber;
539
+ collected_at: z.ZodISODateTime;
540
+ host: z.ZodObject<{
541
+ cpu_pct: z.ZodNullable<z.ZodNumber>;
542
+ cpu_count: z.ZodNumber;
543
+ load: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
544
+ mem: z.ZodNullable<z.ZodObject<{
545
+ used: z.ZodNumber;
546
+ total: z.ZodNumber;
547
+ }, z.core.$strict>>;
548
+ swap: z.ZodNullable<z.ZodObject<{
549
+ used: z.ZodNumber;
550
+ total: z.ZodNumber;
551
+ }, z.core.$strict>>;
552
+ disks: z.ZodArray<z.ZodObject<{
553
+ mount: z.ZodString;
554
+ fs: z.ZodString;
555
+ used: z.ZodNumber;
556
+ total: z.ZodNumber;
557
+ }, z.core.$strict>>;
558
+ net: z.ZodObject<{
559
+ rx_bps: z.ZodNullable<z.ZodNumber>;
560
+ tx_bps: z.ZodNullable<z.ZodNumber>;
561
+ }, z.core.$strict>;
562
+ uptime_sec: z.ZodNumber;
563
+ }, z.core.$strict>;
564
+ processes: z.ZodArray<z.ZodObject<{
565
+ name: z.ZodString;
566
+ pm_id: z.ZodNumber;
567
+ status: z.ZodString;
568
+ cpu_pct: z.ZodNumber;
569
+ memory_bytes: z.ZodNumber;
570
+ restarts: z.ZodNumber;
571
+ unstable_restarts: z.ZodNumber;
572
+ uptime_ms: z.ZodNullable<z.ZodNumber>;
573
+ version: z.ZodNullable<z.ZodString>;
574
+ exec_mode: z.ZodNullable<z.ZodString>;
575
+ }, z.core.$strict>>;
576
+ services: z.ZodArray<z.ZodObject<{
577
+ unit: z.ZodString;
578
+ active_state: z.ZodString;
579
+ sub_state: z.ZodString;
580
+ }, z.core.$strict>>;
581
+ capabilities: z.ZodObject<{
582
+ host: z.ZodEnum<{
583
+ error: "error";
584
+ available: "available";
585
+ unsupported: "unsupported";
586
+ not_installed: "not_installed";
587
+ permission_denied: "permission_denied";
588
+ }>;
589
+ pm2: z.ZodEnum<{
590
+ error: "error";
591
+ available: "available";
592
+ unsupported: "unsupported";
593
+ not_installed: "not_installed";
594
+ permission_denied: "permission_denied";
595
+ }>;
596
+ systemd: z.ZodEnum<{
597
+ error: "error";
598
+ available: "available";
599
+ unsupported: "unsupported";
600
+ not_installed: "not_installed";
601
+ permission_denied: "permission_denied";
602
+ }>;
603
+ nginx: z.ZodEnum<{
604
+ error: "error";
605
+ available: "available";
606
+ unsupported: "unsupported";
607
+ not_installed: "not_installed";
608
+ permission_denied: "permission_denied";
609
+ }>;
610
+ }, z.core.$strict>;
611
+ sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
612
+ id: z.ZodString;
613
+ kind: z.ZodEnum<{
614
+ pm2_out: "pm2_out";
615
+ pm2_err: "pm2_err";
616
+ nginx_access: "nginx_access";
617
+ nginx_error: "nginx_error";
618
+ systemd_journal: "systemd_journal";
619
+ }>;
620
+ label: z.ZodString;
621
+ group: z.ZodString;
622
+ }, z.core.$strict>>>;
623
+ }, z.core.$strict>, z.ZodDiscriminatedUnion<[z.ZodObject<{
624
+ type: z.ZodLiteral<"response">;
625
+ request_id: z.ZodString;
626
+ ok: z.ZodLiteral<true>;
627
+ payload: z.ZodUnion<readonly [z.ZodObject<{
628
+ lines: z.ZodArray<z.ZodString>;
629
+ truncated: z.ZodBoolean;
630
+ bytes: z.ZodNumber;
631
+ source_id: z.ZodString;
632
+ }, z.core.$strict>, z.ZodObject<{
633
+ unit: z.ZodString;
634
+ active_state: z.ZodString;
635
+ sub_state: z.ZodString;
636
+ }, z.core.$strict>, z.ZodObject<{
637
+ name: z.ZodString;
638
+ pm_id: z.ZodNumber;
639
+ status: z.ZodString;
640
+ cpu_pct: z.ZodNumber;
641
+ memory_bytes: z.ZodNumber;
642
+ restarts: z.ZodNumber;
643
+ unstable_restarts: z.ZodNumber;
644
+ uptime_ms: z.ZodNullable<z.ZodNumber>;
645
+ version: z.ZodNullable<z.ZodString>;
646
+ exec_mode: z.ZodNullable<z.ZodString>;
647
+ }, z.core.$strict>, z.ZodObject<{
648
+ sources: z.ZodArray<z.ZodObject<{
649
+ id: z.ZodString;
650
+ kind: z.ZodEnum<{
651
+ pm2_out: "pm2_out";
652
+ pm2_err: "pm2_err";
653
+ nginx_access: "nginx_access";
654
+ nginx_error: "nginx_error";
655
+ systemd_journal: "systemd_journal";
656
+ }>;
657
+ label: z.ZodString;
658
+ group: z.ZodString;
659
+ }, z.core.$strict>>;
660
+ }, z.core.$strict>]>;
661
+ }, z.core.$strict>, z.ZodObject<{
662
+ type: z.ZodLiteral<"response">;
663
+ request_id: z.ZodString;
664
+ ok: z.ZodLiteral<false>;
665
+ error: z.ZodObject<{
666
+ code: z.ZodEnum<{
667
+ unsupported: "unsupported";
668
+ permission_denied: "permission_denied";
669
+ not_found: "not_found";
670
+ timeout: "timeout";
671
+ too_large: "too_large";
672
+ internal: "internal";
673
+ }>;
674
+ message: z.ZodString;
675
+ }, z.core.$strict>;
676
+ }, z.core.$strict>], "ok">], "type">;
677
+ export declare const GatewayFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
678
+ interval_sec: z.ZodNumber;
679
+ watched_services: z.ZodArray<z.ZodString>;
680
+ nginx_enabled: z.ZodBoolean;
681
+ type: z.ZodLiteral<"welcome">;
682
+ server_id: z.ZodString;
683
+ connection_generation: z.ZodNumber;
684
+ }, z.core.$strict>, z.ZodObject<{
685
+ interval_sec: z.ZodNumber;
686
+ watched_services: z.ZodArray<z.ZodString>;
687
+ nginx_enabled: z.ZodBoolean;
688
+ type: z.ZodLiteral<"config">;
689
+ }, z.core.$strict>, z.ZodDiscriminatedUnion<[z.ZodObject<{
690
+ action: z.ZodLiteral<"logs.tail">;
691
+ params: z.ZodObject<{
692
+ source_id: z.ZodString;
693
+ lines: z.ZodLiteral<100 | 200 | 500>;
694
+ }, z.core.$strict>;
695
+ type: z.ZodLiteral<"request">;
696
+ request_id: z.ZodUUID;
697
+ }, z.core.$strict>, z.ZodObject<{
698
+ action: z.ZodLiteral<"service.status">;
699
+ params: z.ZodObject<{
700
+ unit: z.ZodString;
701
+ }, z.core.$strict>;
702
+ type: z.ZodLiteral<"request">;
703
+ request_id: z.ZodUUID;
704
+ }, z.core.$strict>, z.ZodObject<{
705
+ action: z.ZodLiteral<"pm2.describe">;
706
+ params: z.ZodObject<{
707
+ name: z.ZodString;
708
+ }, z.core.$strict>;
709
+ type: z.ZodLiteral<"request">;
710
+ request_id: z.ZodUUID;
711
+ }, z.core.$strict>, z.ZodObject<{
712
+ action: z.ZodLiteral<"nginx.sources">;
713
+ params: z.ZodObject<{}, z.core.$strict>;
714
+ type: z.ZodLiteral<"request">;
715
+ request_id: z.ZodUUID;
716
+ }, z.core.$strict>], "action">], "type">;
717
+ export type HelloFrame = z.infer<typeof HelloFrameSchema>;
718
+ export type HeartbeatFrame = z.infer<typeof HeartbeatFrameSchema>;
719
+ export type WelcomeFrame = z.infer<typeof WelcomeFrameSchema>;
720
+ export type ConfigFrame = z.infer<typeof ConfigFrameSchema>;
721
+ export type RequestFrame = z.infer<typeof RequestFrameSchema>;
722
+ export type ResponseError = z.infer<typeof ResponseErrorSchema>;
723
+ export type SuccessResponseFrame = z.infer<typeof SuccessResponseFrameSchema>;
724
+ export type ErrorResponseFrame = z.infer<typeof ErrorResponseFrameSchema>;
725
+ export type ResponseFrame = z.infer<typeof ResponseFrameSchema>;
726
+ export type AgentFrame = z.infer<typeof AgentFrameSchema>;
727
+ export type GatewayFrame = z.infer<typeof GatewayFrameSchema>;
728
+ export type ParseResult<Frame> = {
729
+ readonly ok: true;
730
+ readonly frame: Frame;
731
+ } | {
732
+ readonly ok: false;
733
+ readonly error: SyntaxError | z.ZodError;
734
+ };
735
+ export declare function parseAgentFrame(text: string): ParseResult<AgentFrame>;
736
+ export declare function parseGatewayFrame(text: string): ParseResult<GatewayFrame>;