@steventsao/agent-session-core 0.1.11 → 0.1.13

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.
@@ -1,636 +0,0 @@
1
- /**
2
- * Centralized WebSocket Events
3
- *
4
- * Single source of truth for all socket event types used across:
5
- * - SessionSocket Durable Object (Cloudflare Worker)
6
- * - Client applications (React, etc.)
7
- * - E2B sandbox communication
8
- */
9
- import { z } from 'zod';
10
- export declare const ClientEventType: {
11
- readonly INIT: "INIT";
12
- readonly PING: "PING";
13
- readonly JOIN_SESSION: "JOIN_SESSION";
14
- readonly START_SANDBOX: "START_SANDBOX";
15
- readonly STOP_SANDBOX: "STOP_SANDBOX";
16
- readonly EXEC: "EXEC";
17
- readonly AGENT_MESSAGE: "AGENT_MESSAGE";
18
- readonly AGENT_STOP: "AGENT_STOP";
19
- readonly AGENT_RESET: "AGENT_RESET";
20
- };
21
- export type ClientEventType = (typeof ClientEventType)[keyof typeof ClientEventType];
22
- export declare const ServerEventType: {
23
- readonly CONNECTED: "CONNECTED";
24
- readonly READY: "READY";
25
- readonly PONG: "PONG";
26
- readonly MESSAGE_ACK: "MESSAGE_ACK";
27
- readonly MESSAGE_ERROR: "MESSAGE_ERROR";
28
- readonly EVENTS_BATCH: "EVENTS_BATCH";
29
- readonly SANDBOX_STATUS: "SANDBOX_STATUS";
30
- readonly LIFECYCLE: "LIFECYCLE";
31
- readonly TERM_DATA: "TERM_DATA";
32
- readonly EXEC_COMPLETE: "EXEC_COMPLETE";
33
- readonly SYSTEM: "SYSTEM";
34
- readonly ERROR: "ERROR";
35
- readonly AGENT_STARTED: "AGENT_STARTED";
36
- readonly AGENT_MESSAGE: "AGENT_MESSAGE";
37
- readonly AGENT_ACTION: "AGENT_ACTION";
38
- readonly AGENT_STEP_COMPLETE: "AGENT_STEP_COMPLETE";
39
- readonly AGENT_DONE: "AGENT_DONE";
40
- readonly AGENT_ERROR: "AGENT_ERROR";
41
- readonly AGENT_EVENT: "AGENT_EVENT";
42
- readonly FILE_UPLOADED: "FILE_UPLOADED";
43
- readonly FILES_SYNC: "FILES_SYNC";
44
- readonly TOC_REQUEST_RECEIVED: "TOC_REQUEST_RECEIVED";
45
- readonly TOC_AUTH_COMPLETED: "TOC_AUTH_COMPLETED";
46
- readonly TOC_DB_QUERY_STARTED: "TOC_DB_QUERY_STARTED";
47
- readonly TOC_DB_QUERY_COMPLETED: "TOC_DB_QUERY_COMPLETED";
48
- readonly TOC_GCS_DOWNLOAD_STARTED: "TOC_GCS_DOWNLOAD_STARTED";
49
- readonly TOC_GCS_DOWNLOAD_COMPLETED: "TOC_GCS_DOWNLOAD_COMPLETED";
50
- readonly TOC_SANDBOX_CREATED: "TOC_SANDBOX_CREATED";
51
- readonly TOC_EXTRACTION_STARTED: "TOC_EXTRACTION_STARTED";
52
- readonly TOC_EXTRACTION_COMPLETED: "TOC_EXTRACTION_COMPLETED";
53
- readonly TOC_RESPONSE_READY: "TOC_RESPONSE_READY";
54
- };
55
- export type ServerEventType = (typeof ServerEventType)[keyof typeof ServerEventType];
56
- export declare const SandboxStatus: {
57
- readonly IDLE: "idle";
58
- readonly BOOTING: "booting";
59
- readonly READY: "ready";
60
- readonly ERROR: "error";
61
- };
62
- export type SandboxStatus = (typeof SandboxStatus)[keyof typeof SandboxStatus];
63
- /**
64
- * Granular lifecycle phases for UI loading states
65
- * Common lifecycle events across different app types:
66
- * - idle: No sandbox running
67
- * - booting: Creating sandbox instance
68
- * - environment_ready: Sandbox created, basic environment up
69
- * - files_ready: App files synced/loaded (for app builders)
70
- * - installing: Installing dependencies
71
- * - starting: Starting services (dev server, etc.)
72
- * - interaction_ready: Ready for user interaction (agent can respond)
73
- * - ready: Fully ready (deprecated alias for interaction_ready)
74
- * - error: Something went wrong
75
- */
76
- export declare const SandboxLifecycle: {
77
- readonly IDLE: "idle";
78
- readonly BOOTING: "booting";
79
- readonly ENVIRONMENT_READY: "environment_ready";
80
- readonly FILES_READY: "files_ready";
81
- readonly INSTALLING: "installing";
82
- readonly STARTING: "starting";
83
- readonly INTERACTION_READY: "interaction_ready";
84
- readonly READY: "ready";
85
- readonly ERROR: "error";
86
- };
87
- export type SandboxLifecycle = (typeof SandboxLifecycle)[keyof typeof SandboxLifecycle];
88
- /**
89
- * Parse SYSTEM message to SandboxLifecycle phase
90
- */
91
- export declare function parseSystemMessageToLifecycle(msg: string): SandboxLifecycle | null;
92
- export interface InitEvent {
93
- type: 'INIT';
94
- userId?: string;
95
- metadata?: Record<string, unknown>;
96
- }
97
- export interface PingEvent {
98
- type: 'PING';
99
- }
100
- /**
101
- * Join session with optional cursor for event resumption (Manus pattern)
102
- * On reconnect, client sends lastEventId to receive missed events
103
- */
104
- export interface JoinSessionEvent {
105
- type: 'JOIN_SESSION';
106
- /** Last event ID received - server will send events after this cursor */
107
- lastEventId?: string;
108
- }
109
- /**
110
- * File to write to sandbox during bootstrap
111
- */
112
- export interface SandboxFile {
113
- path: string;
114
- content?: string;
115
- url?: string;
116
- encoding?: 'utf-8' | 'base64';
117
- }
118
- /**
119
- * Bootstrap options for sandbox file pre-population
120
- *
121
- * Supports three strategies (in order of preference):
122
- * 1. archiveUrl: Single tar.gz archive - fastest for many files
123
- * 2. bootstrapUrl: Fetch file manifest with individual URLs
124
- * 3. files: Inline files (legacy, causes WebSocket bloat)
125
- */
126
- export interface SandboxBootstrapOptions {
127
- /** URL to tar.gz archive containing all workspace files (preferred) */
128
- archiveUrl?: string;
129
- /** URL to fetch file manifest (returns SandboxFile[]) */
130
- bootstrapUrl?: string;
131
- /** Inline files to write directly */
132
- files?: SandboxFile[];
133
- /** Headers to include when fetching bootstrapUrl or archiveUrl */
134
- headers?: Record<string, string>;
135
- }
136
- export interface StartSandboxEvent {
137
- type: 'START_SANDBOX';
138
- template?: string;
139
- /** Bootstrap options for file pre-population before agent starts */
140
- bootstrap?: SandboxBootstrapOptions;
141
- }
142
- export interface StopSandboxEvent {
143
- type: 'STOP_SANDBOX';
144
- }
145
- export interface ExecEvent {
146
- type: 'EXEC';
147
- cmd: string;
148
- cwd?: string;
149
- }
150
- export interface AgentMessageClientEvent {
151
- type: 'AGENT_MESSAGE';
152
- /** Client-generated message ID for deterministic ack handling */
153
- clientMessageId?: string;
154
- content: string;
155
- model?: {
156
- id: string;
157
- provider?: string;
158
- };
159
- config?: {
160
- temperature?: number;
161
- maxTokens?: number;
162
- };
163
- /** Direct system prompt text */
164
- systemPrompt?: string;
165
- /** Named prompt template (e.g., "claude-code") */
166
- systemPromptName?: string;
167
- /** Variables to compile into the prompt template */
168
- systemPromptVariables?: Record<string, string>;
169
- agentType?: string;
170
- }
171
- export interface AgentStopEvent {
172
- type: 'AGENT_STOP';
173
- }
174
- export interface AgentResetEvent {
175
- type: 'AGENT_RESET';
176
- }
177
- export type ClientEvent = InitEvent | PingEvent | JoinSessionEvent | StartSandboxEvent | StopSandboxEvent | ExecEvent | AgentMessageClientEvent | AgentStopEvent | AgentResetEvent;
178
- /**
179
- * Optional metadata added to persistable server events
180
- * Events with eventId can be replayed on reconnection
181
- */
182
- export interface ServerEventMeta {
183
- /** Unique event identifier for cursor-based resumption */
184
- eventId?: string;
185
- /** Monotonic event sequence for deterministic replay */
186
- eventSequence?: number;
187
- /** Server timestamp when event was created */
188
- eventTimestamp?: number;
189
- }
190
- export interface ConnectedServerEvent {
191
- type: 'CONNECTED';
192
- clientId: string;
193
- sessionId: string;
194
- }
195
- export interface ReadyServerEvent {
196
- type: 'READY';
197
- sandboxId: string | null;
198
- sandboxUrl: string | null;
199
- }
200
- /**
201
- * Batch of events sent on reconnection (Manus eventsNotifyEventsAfter pattern)
202
- * Contains all events since the client's lastEventId cursor
203
- */
204
- export interface EventsBatchServerEvent {
205
- type: 'EVENTS_BATCH';
206
- /** Events since last cursor, in chronological order */
207
- events: PersistableServerEvent[];
208
- /** Latest event ID - client should use this as next cursor */
209
- lastEventId: string;
210
- /** Total events in batch */
211
- count: number;
212
- }
213
- export interface PongServerEvent {
214
- type: 'PONG';
215
- timestamp: number;
216
- }
217
- export interface SandboxStatusServerEvent {
218
- type: 'SANDBOX_STATUS';
219
- status: 'idle' | 'booting' | 'ready' | 'error';
220
- sandboxId?: string;
221
- sandboxUrl?: string;
222
- error?: string;
223
- }
224
- /**
225
- * Lifecycle event - granular phase transitions
226
- * Use for loading UI states and progress indicators
227
- */
228
- export interface LifecycleServerEvent {
229
- type: 'LIFECYCLE';
230
- phase: SandboxLifecycle;
231
- message?: string;
232
- progress?: number;
233
- metadata?: Record<string, unknown>;
234
- }
235
- export interface TermDataServerEvent {
236
- type: 'TERM_DATA';
237
- data: string;
238
- stream: 'stdout' | 'stderr';
239
- }
240
- export interface ExecCompleteServerEvent {
241
- type: 'EXEC_COMPLETE';
242
- exitCode: number;
243
- }
244
- export interface SystemServerEvent {
245
- type: 'SYSTEM';
246
- msg: string;
247
- }
248
- export interface ErrorServerEvent {
249
- type: 'ERROR';
250
- msg: string;
251
- code?: string;
252
- }
253
- export interface MessageAckServerEvent {
254
- type: 'MESSAGE_ACK';
255
- clientMessageId: string;
256
- receivedAt: number;
257
- }
258
- export interface MessageErrorServerEvent {
259
- type: 'MESSAGE_ERROR';
260
- clientMessageId: string;
261
- error: string;
262
- }
263
- export interface FileUploadedServerEvent {
264
- type: 'FILE_UPLOADED';
265
- path: string;
266
- filename: string;
267
- url: string;
268
- mimeType: string;
269
- description?: string;
270
- sizeBytes?: number;
271
- }
272
- export interface SandboxFile {
273
- path: string;
274
- name: string;
275
- isDir: boolean;
276
- size?: number;
277
- }
278
- export interface FilesSyncServerEvent {
279
- type: 'FILES_SYNC';
280
- files: SandboxFile[];
281
- dirs: string[];
282
- }
283
- export interface AgentStartedServerEvent {
284
- type: 'AGENT_STARTED';
285
- prompt?: string;
286
- clientMessageId?: string;
287
- }
288
- export interface TextContentBlock {
289
- type: 'text';
290
- text: string;
291
- }
292
- export interface ToolUseContentBlock {
293
- type: 'tool_use';
294
- id: string;
295
- name: string;
296
- input: Record<string, unknown>;
297
- }
298
- export interface ToolResultContentBlock {
299
- type: 'tool_result';
300
- tool_use_id: string;
301
- content: string | null;
302
- is_error?: boolean;
303
- }
304
- export type ContentBlock = TextContentBlock | ToolUseContentBlock | ToolResultContentBlock;
305
- export interface AgentMessageServerEvent {
306
- type: 'AGENT_MESSAGE';
307
- message?: {
308
- content: ContentBlock[];
309
- };
310
- subtype?: string;
311
- total_cost_usd?: number | null;
312
- duration_ms?: number | null;
313
- result?: string | null;
314
- clientMessageId?: string;
315
- }
316
- export interface AgentActionServerEvent {
317
- type: 'AGENT_ACTION';
318
- action: string;
319
- id?: string;
320
- input?: unknown;
321
- status: 'executing' | 'complete' | 'error';
322
- result?: string;
323
- error?: string;
324
- }
325
- export interface AgentStepCompleteServerEvent {
326
- type: 'AGENT_STEP_COMPLETE';
327
- success?: boolean;
328
- cost?: number;
329
- duration?: number;
330
- }
331
- export interface AgentDoneServerEvent {
332
- type: 'AGENT_DONE';
333
- exitCode?: number;
334
- sessionId?: string;
335
- clientMessageId?: string;
336
- }
337
- export interface AgentErrorServerEvent {
338
- type: 'AGENT_ERROR';
339
- error: string;
340
- clientMessageId?: string;
341
- }
342
- export interface AgentGenericServerEvent {
343
- type: 'AGENT_EVENT';
344
- [key: string]: unknown;
345
- }
346
- export interface TocEventServerEvent {
347
- type: 'TOC_REQUEST_RECEIVED' | 'TOC_AUTH_COMPLETED' | 'TOC_DB_QUERY_STARTED' | 'TOC_DB_QUERY_COMPLETED' | 'TOC_GCS_DOWNLOAD_STARTED' | 'TOC_GCS_DOWNLOAD_COMPLETED' | 'TOC_SANDBOX_CREATED' | 'TOC_EXTRACTION_STARTED' | 'TOC_EXTRACTION_COMPLETED' | 'TOC_RESPONSE_READY';
348
- data?: Record<string, unknown>;
349
- cost?: {
350
- duration_ms?: number;
351
- total_usd?: number;
352
- input_tokens?: number;
353
- output_tokens?: number;
354
- };
355
- }
356
- /**
357
- * Events that should be persisted and replayed on reconnection
358
- * These events have state significance (not ephemeral like PONG)
359
- */
360
- export type PersistableServerEvent = (SandboxStatusServerEvent | LifecycleServerEvent | AgentStartedServerEvent | AgentMessageServerEvent | AgentActionServerEvent | AgentDoneServerEvent | AgentErrorServerEvent | SystemServerEvent | TocEventServerEvent) & ServerEventMeta;
361
- /**
362
- * Event types that should NOT be persisted (ephemeral)
363
- */
364
- export declare const EPHEMERAL_EVENT_TYPES: Set<string>;
365
- /**
366
- * Check if a server event should be persisted for replay
367
- */
368
- export declare function isPersistableEvent(event: ServerEvent): boolean;
369
- export type ServerEvent = ConnectedServerEvent | ReadyServerEvent | EventsBatchServerEvent | PongServerEvent | MessageAckServerEvent | MessageErrorServerEvent | SandboxStatusServerEvent | LifecycleServerEvent | TermDataServerEvent | ExecCompleteServerEvent | SystemServerEvent | ErrorServerEvent | FileUploadedServerEvent | FilesSyncServerEvent | AgentStartedServerEvent | AgentMessageServerEvent | AgentActionServerEvent | AgentStepCompleteServerEvent | AgentDoneServerEvent | AgentErrorServerEvent | AgentGenericServerEvent | TocEventServerEvent;
370
- export declare const ToolUseBlockSchema: z.ZodObject<{
371
- type: z.ZodLiteral<"tool_use">;
372
- name: z.ZodString;
373
- input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
374
- }, "strip", z.ZodTypeAny, {
375
- type: "tool_use";
376
- name: string;
377
- input?: Record<string, unknown> | undefined;
378
- }, {
379
- type: "tool_use";
380
- name: string;
381
- input?: Record<string, unknown> | undefined;
382
- }>;
383
- export declare const TextBlockSchema: z.ZodObject<{
384
- type: z.ZodLiteral<"text">;
385
- text: z.ZodString;
386
- }, "strip", z.ZodTypeAny, {
387
- text: string;
388
- type: "text";
389
- }, {
390
- text: string;
391
- type: "text";
392
- }>;
393
- export declare const ContentBlockSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
394
- type: z.ZodLiteral<"tool_use">;
395
- name: z.ZodString;
396
- input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
397
- }, "strip", z.ZodTypeAny, {
398
- type: "tool_use";
399
- name: string;
400
- input?: Record<string, unknown> | undefined;
401
- }, {
402
- type: "tool_use";
403
- name: string;
404
- input?: Record<string, unknown> | undefined;
405
- }>, z.ZodObject<{
406
- type: z.ZodLiteral<"text">;
407
- text: z.ZodString;
408
- }, "strip", z.ZodTypeAny, {
409
- text: string;
410
- type: "text";
411
- }, {
412
- text: string;
413
- type: "text";
414
- }>]>;
415
- export declare const AssistantMessageSchema: z.ZodObject<{
416
- type: z.ZodLiteral<"assistant">;
417
- message: z.ZodObject<{
418
- content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
419
- type: z.ZodLiteral<"tool_use">;
420
- name: z.ZodString;
421
- input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
422
- }, "strip", z.ZodTypeAny, {
423
- type: "tool_use";
424
- name: string;
425
- input?: Record<string, unknown> | undefined;
426
- }, {
427
- type: "tool_use";
428
- name: string;
429
- input?: Record<string, unknown> | undefined;
430
- }>, z.ZodObject<{
431
- type: z.ZodLiteral<"text">;
432
- text: z.ZodString;
433
- }, "strip", z.ZodTypeAny, {
434
- text: string;
435
- type: "text";
436
- }, {
437
- text: string;
438
- type: "text";
439
- }>]>, "many">;
440
- }, "strip", z.ZodTypeAny, {
441
- content: ({
442
- type: "tool_use";
443
- name: string;
444
- input?: Record<string, unknown> | undefined;
445
- } | {
446
- text: string;
447
- type: "text";
448
- })[];
449
- }, {
450
- content: ({
451
- type: "tool_use";
452
- name: string;
453
- input?: Record<string, unknown> | undefined;
454
- } | {
455
- text: string;
456
- type: "text";
457
- })[];
458
- }>;
459
- }, "strip", z.ZodTypeAny, {
460
- type: "assistant";
461
- message: {
462
- content: ({
463
- type: "tool_use";
464
- name: string;
465
- input?: Record<string, unknown> | undefined;
466
- } | {
467
- text: string;
468
- type: "text";
469
- })[];
470
- };
471
- }, {
472
- type: "assistant";
473
- message: {
474
- content: ({
475
- type: "tool_use";
476
- name: string;
477
- input?: Record<string, unknown> | undefined;
478
- } | {
479
- text: string;
480
- type: "text";
481
- })[];
482
- };
483
- }>;
484
- export declare const ResultMessageSchema: z.ZodObject<{
485
- type: z.ZodLiteral<"result">;
486
- session_id: z.ZodOptional<z.ZodString>;
487
- total_cost_usd: z.ZodOptional<z.ZodNumber>;
488
- duration_ms: z.ZodOptional<z.ZodNumber>;
489
- }, "strip", z.ZodTypeAny, {
490
- type: "result";
491
- session_id?: string | undefined;
492
- total_cost_usd?: number | undefined;
493
- duration_ms?: number | undefined;
494
- }, {
495
- type: "result";
496
- session_id?: string | undefined;
497
- total_cost_usd?: number | undefined;
498
- duration_ms?: number | undefined;
499
- }>;
500
- export declare const ErrorMessageSchema: z.ZodObject<{
501
- type: z.ZodLiteral<"error">;
502
- error: z.ZodString;
503
- }, "strip", z.ZodTypeAny, {
504
- error: string;
505
- type: "error";
506
- }, {
507
- error: string;
508
- type: "error";
509
- }>;
510
- export declare const SystemMessageSchema: z.ZodObject<{
511
- type: z.ZodLiteral<"system">;
512
- message: z.ZodString;
513
- }, "strip", z.ZodTypeAny, {
514
- type: "system";
515
- message: string;
516
- }, {
517
- type: "system";
518
- message: string;
519
- }>;
520
- export declare const AgentOutputMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
521
- type: z.ZodLiteral<"assistant">;
522
- message: z.ZodObject<{
523
- content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
524
- type: z.ZodLiteral<"tool_use">;
525
- name: z.ZodString;
526
- input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
527
- }, "strip", z.ZodTypeAny, {
528
- type: "tool_use";
529
- name: string;
530
- input?: Record<string, unknown> | undefined;
531
- }, {
532
- type: "tool_use";
533
- name: string;
534
- input?: Record<string, unknown> | undefined;
535
- }>, z.ZodObject<{
536
- type: z.ZodLiteral<"text">;
537
- text: z.ZodString;
538
- }, "strip", z.ZodTypeAny, {
539
- text: string;
540
- type: "text";
541
- }, {
542
- text: string;
543
- type: "text";
544
- }>]>, "many">;
545
- }, "strip", z.ZodTypeAny, {
546
- content: ({
547
- type: "tool_use";
548
- name: string;
549
- input?: Record<string, unknown> | undefined;
550
- } | {
551
- text: string;
552
- type: "text";
553
- })[];
554
- }, {
555
- content: ({
556
- type: "tool_use";
557
- name: string;
558
- input?: Record<string, unknown> | undefined;
559
- } | {
560
- text: string;
561
- type: "text";
562
- })[];
563
- }>;
564
- }, "strip", z.ZodTypeAny, {
565
- type: "assistant";
566
- message: {
567
- content: ({
568
- type: "tool_use";
569
- name: string;
570
- input?: Record<string, unknown> | undefined;
571
- } | {
572
- text: string;
573
- type: "text";
574
- })[];
575
- };
576
- }, {
577
- type: "assistant";
578
- message: {
579
- content: ({
580
- type: "tool_use";
581
- name: string;
582
- input?: Record<string, unknown> | undefined;
583
- } | {
584
- text: string;
585
- type: "text";
586
- })[];
587
- };
588
- }>, z.ZodObject<{
589
- type: z.ZodLiteral<"result">;
590
- session_id: z.ZodOptional<z.ZodString>;
591
- total_cost_usd: z.ZodOptional<z.ZodNumber>;
592
- duration_ms: z.ZodOptional<z.ZodNumber>;
593
- }, "strip", z.ZodTypeAny, {
594
- type: "result";
595
- session_id?: string | undefined;
596
- total_cost_usd?: number | undefined;
597
- duration_ms?: number | undefined;
598
- }, {
599
- type: "result";
600
- session_id?: string | undefined;
601
- total_cost_usd?: number | undefined;
602
- duration_ms?: number | undefined;
603
- }>, z.ZodObject<{
604
- type: z.ZodLiteral<"error">;
605
- error: z.ZodString;
606
- }, "strip", z.ZodTypeAny, {
607
- error: string;
608
- type: "error";
609
- }, {
610
- error: string;
611
- type: "error";
612
- }>, z.ZodObject<{
613
- type: z.ZodLiteral<"system">;
614
- message: z.ZodString;
615
- }, "strip", z.ZodTypeAny, {
616
- type: "system";
617
- message: string;
618
- }, {
619
- type: "system";
620
- message: string;
621
- }>]>;
622
- export type ToolUseBlock = z.infer<typeof ToolUseBlockSchema>;
623
- export type TextBlock = z.infer<typeof TextBlockSchema>;
624
- export type AgentContentBlock = z.infer<typeof ContentBlockSchema>;
625
- export type AssistantMessage = z.infer<typeof AssistantMessageSchema>;
626
- export type ResultMessage = z.infer<typeof ResultMessageSchema>;
627
- export type ErrorMessage = z.infer<typeof ErrorMessageSchema>;
628
- export type SystemMessage = z.infer<typeof SystemMessageSchema>;
629
- export type AgentOutputMessage = z.infer<typeof AgentOutputMessageSchema>;
630
- export declare function parseAgentOutputMessage(line: string): AgentOutputMessage | null;
631
- export declare function isClientEvent(data: unknown): data is ClientEvent;
632
- export declare function isServerEvent(data: unknown): data is ServerEvent;
633
- export declare function parseServerEvent(json: string): ServerEvent | null;
634
- export declare function parseClientEvent(json: string): ClientEvent | null;
635
- export type ClientMessage = ClientEvent;
636
- //# sourceMappingURL=socket-events.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"socket-events.d.ts","sourceRoot":"","sources":["../src/socket-events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,eAAe;;;;;;;;;;CAiBlB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAMrF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+ClB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAMrF,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;CAUnB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAEx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