@enclave-vm/types 0.0.1 → 2.9.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.
package/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # @enclave-vm/types
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@enclave-vm/types.svg)](https://www.npmjs.com/package/@enclave-vm/types)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
6
+
7
+ > Type definitions and Zod schemas for the EnclaveJS streaming runtime protocol
8
+
9
+ The @enclave-vm/types package provides TypeScript type definitions and runtime validation schemas for the EnclaveJS streaming protocol. It serves as the foundation for type-safe communication between EnclaveJS components.
10
+
11
+ ## Features
12
+
13
+ - **TypeScript-First**: Full TypeScript support with strict typing
14
+ - **Zod Schemas**: Runtime validation for all protocol messages
15
+ - **Protocol Types**: Complete type definitions for streaming messages
16
+ - **Session Types**: Types for session management and state
17
+ - **Tool Types**: Type definitions for tool calls and responses
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @enclave-vm/types
23
+ # or
24
+ yarn add @enclave-vm/types
25
+ # or
26
+ pnpm add @enclave-vm/types
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ```typescript
32
+ import { StreamMessage, ToolCallMessage, ToolResultMessage, SessionState } from '@enclave-vm/types';
33
+
34
+ // Type-safe message handling
35
+ function handleMessage(message: StreamMessage) {
36
+ switch (message.type) {
37
+ case 'tool_call':
38
+ const toolCall = message as ToolCallMessage;
39
+ console.log(`Tool: ${toolCall.name}, Args:`, toolCall.args);
40
+ break;
41
+ case 'tool_result':
42
+ const result = message as ToolResultMessage;
43
+ console.log(`Result:`, result.data);
44
+ break;
45
+ }
46
+ }
47
+ ```
48
+
49
+ ## Protocol Messages
50
+
51
+ ### Stream Messages
52
+
53
+ ```typescript
54
+ import { StreamMessageSchema, StreamMessage } from '@enclave-vm/types';
55
+
56
+ // Validate incoming messages
57
+ const message = StreamMessageSchema.parse(rawMessage);
58
+ ```
59
+
60
+ ### Tool Calls
61
+
62
+ ```typescript
63
+ import { ToolCallMessage, ToolResultMessage } from '@enclave-vm/types';
64
+
65
+ const toolCall: ToolCallMessage = {
66
+ type: 'tool_call',
67
+ id: 'call_123',
68
+ name: 'getUser',
69
+ args: { userId: 1 },
70
+ };
71
+
72
+ const toolResult: ToolResultMessage = {
73
+ type: 'tool_result',
74
+ id: 'call_123',
75
+ data: { name: 'Alice', email: 'alice@example.com' },
76
+ };
77
+ ```
78
+
79
+ ### Session State
80
+
81
+ ```typescript
82
+ import { SessionState, SessionStatus } from '@enclave-vm/types';
83
+
84
+ const session: SessionState = {
85
+ id: 'session_abc',
86
+ status: 'running',
87
+ createdAt: new Date(),
88
+ toolCallCount: 5,
89
+ };
90
+ ```
91
+
92
+ ## Zod Schemas
93
+
94
+ All types have corresponding Zod schemas for runtime validation:
95
+
96
+ ```typescript
97
+ import { StreamMessageSchema, ToolCallMessageSchema, SessionStateSchema } from '@enclave-vm/types';
98
+
99
+ // Parse and validate
100
+ const message = StreamMessageSchema.safeParse(untrustedData);
101
+ if (message.success) {
102
+ // message.data is typed correctly
103
+ handleMessage(message.data);
104
+ } else {
105
+ console.error('Invalid message:', message.error);
106
+ }
107
+ ```
108
+
109
+ ## Related Packages
110
+
111
+ | Package | Description |
112
+ | ------------------------------------------- | ---------------------------------- |
113
+ | [@enclave-vm/stream](../enclavejs-stream) | Streaming protocol implementation |
114
+ | [@enclave-vm/broker](../enclavejs-broker) | Tool broker and session management |
115
+ | [@enclave-vm/client](../enclavejs-client) | Browser/Node.js client SDK |
116
+ | [@enclave-vm/react](../enclavejs-react) | React hooks and components |
117
+ | [@enclave-vm/runtime](../enclavejs-runtime) | Standalone runtime worker |
118
+
119
+ ## License
120
+
121
+ Apache-2.0
package/esm/index.mjs ADDED
@@ -0,0 +1,492 @@
1
+ // libs/enclavejs-types/src/protocol.ts
2
+ var PROTOCOL_VERSION = 1;
3
+ var SESSION_ID_PREFIX = "s_";
4
+ var CALL_ID_PREFIX = "c_";
5
+ var REF_ID_PREFIX = "ref_";
6
+ function generateSessionId() {
7
+ return `${SESSION_ID_PREFIX}${crypto.randomUUID()}`;
8
+ }
9
+ function generateCallId() {
10
+ return `${CALL_ID_PREFIX}${crypto.randomUUID()}`;
11
+ }
12
+ function generateRefId() {
13
+ return `${REF_ID_PREFIX}${crypto.randomUUID()}`;
14
+ }
15
+ function isSessionId(value) {
16
+ return value.startsWith(SESSION_ID_PREFIX);
17
+ }
18
+ function isCallId(value) {
19
+ return value.startsWith(CALL_ID_PREFIX);
20
+ }
21
+ function isRefId(value) {
22
+ return value.startsWith(REF_ID_PREFIX);
23
+ }
24
+ var DEFAULT_SESSION_LIMITS = {
25
+ sessionTtlMs: 6e4,
26
+ maxToolCalls: 50,
27
+ maxStdoutBytes: 262144,
28
+ maxToolResultBytes: 5242880,
29
+ toolTimeoutMs: 3e4,
30
+ heartbeatIntervalMs: 15e3
31
+ };
32
+ var SessionState = {
33
+ /** Session is starting up */
34
+ Starting: "starting",
35
+ /** Session is actively running code */
36
+ Running: "running",
37
+ /** Session is waiting for a tool result */
38
+ WaitingForTool: "waiting_for_tool",
39
+ /** Session completed successfully */
40
+ Completed: "completed",
41
+ /** Session was cancelled */
42
+ Cancelled: "cancelled",
43
+ /** Session failed with an error */
44
+ Failed: "failed"
45
+ };
46
+ function isRefToken(value) {
47
+ return typeof value === "object" && value !== null && "$ref" in value && typeof value.$ref === "object" && value.$ref !== null && "id" in value.$ref && typeof value.$ref.id === "string" && isRefId(value.$ref.id);
48
+ }
49
+ function createRefToken(id) {
50
+ return { $ref: { id } };
51
+ }
52
+ var LogLevel = {
53
+ Debug: "debug",
54
+ Info: "info",
55
+ Warn: "warn",
56
+ Error: "error"
57
+ };
58
+
59
+ // libs/enclavejs-types/src/events.ts
60
+ var EventType = {
61
+ /** Session initialization */
62
+ SessionInit: "session_init",
63
+ /** Standard output chunk */
64
+ Stdout: "stdout",
65
+ /** Log message */
66
+ Log: "log",
67
+ /** Tool call request from runtime */
68
+ ToolCall: "tool_call",
69
+ /** Tool result acknowledgment */
70
+ ToolResultApplied: "tool_result_applied",
71
+ /** Session completed */
72
+ Final: "final",
73
+ /** Keep-alive heartbeat */
74
+ Heartbeat: "heartbeat",
75
+ /** Error event */
76
+ Error: "error",
77
+ /** Encrypted envelope (wraps other events) */
78
+ Encrypted: "enc"
79
+ };
80
+ function getEventType(event) {
81
+ return event.type;
82
+ }
83
+ function isSessionInitEvent(event) {
84
+ return event.type === EventType.SessionInit;
85
+ }
86
+ function isStdoutEvent(event) {
87
+ return event.type === EventType.Stdout;
88
+ }
89
+ function isLogEvent(event) {
90
+ return event.type === EventType.Log;
91
+ }
92
+ function isToolCallEvent(event) {
93
+ return event.type === EventType.ToolCall;
94
+ }
95
+ function isToolResultAppliedEvent(event) {
96
+ return event.type === EventType.ToolResultApplied;
97
+ }
98
+ function isFinalEvent(event) {
99
+ return event.type === EventType.Final;
100
+ }
101
+ function isHeartbeatEvent(event) {
102
+ return event.type === EventType.Heartbeat;
103
+ }
104
+ function isErrorEvent(event) {
105
+ return event.type === EventType.Error;
106
+ }
107
+ var RuntimeChannelMessageType = {
108
+ /** Tool result submission from broker to runtime */
109
+ ToolResultSubmit: "tool_result_submit",
110
+ /** Cancel session request */
111
+ Cancel: "cancel"
112
+ };
113
+
114
+ // libs/enclavejs-types/src/encryption.ts
115
+ var SupportedCurve = {
116
+ P256: "P-256"
117
+ };
118
+ var EncryptionAlgorithm = {
119
+ /** AES-GCM with 256-bit key */
120
+ AES_GCM_256: "AES-GCM-256"
121
+ };
122
+ var KeyDerivation = {
123
+ /** HKDF with SHA-256 */
124
+ HKDF_SHA256: "HKDF-SHA-256"
125
+ };
126
+ var EncryptionMode = {
127
+ /** Encryption is disabled */
128
+ Disabled: "disabled",
129
+ /** Encryption is optional (server decides) */
130
+ Optional: "optional",
131
+ /** Encryption is required */
132
+ Required: "required"
133
+ };
134
+ var EncryptionErrorCode = {
135
+ /** Handshake failed */
136
+ HandshakeFailed: "ENCRYPTION_HANDSHAKE_FAILED",
137
+ /** Key derivation failed */
138
+ KeyDerivationFailed: "ENCRYPTION_KEY_DERIVATION_FAILED",
139
+ /** Decryption failed (invalid ciphertext or authentication) */
140
+ DecryptionFailed: "ENCRYPTION_DECRYPTION_FAILED",
141
+ /** Nonce reuse detected */
142
+ NonceReuse: "ENCRYPTION_NONCE_REUSE",
143
+ /** Key expired or needs rotation */
144
+ KeyExpired: "ENCRYPTION_KEY_EXPIRED",
145
+ /** Unsupported algorithm */
146
+ UnsupportedAlgorithm: "ENCRYPTION_UNSUPPORTED_ALGORITHM",
147
+ /** Invalid public key */
148
+ InvalidPublicKey: "ENCRYPTION_INVALID_PUBLIC_KEY",
149
+ /** Signature verification failed */
150
+ SignatureVerificationFailed: "ENCRYPTION_SIGNATURE_VERIFICATION_FAILED"
151
+ };
152
+ function isEncryptedEnvelope(value) {
153
+ return typeof value === "object" && value !== null && "type" in value && value.type === "enc" && "payload" in value && typeof value.payload === "object" && value.payload !== null && "kid" in value.payload && "nonceB64" in value.payload && "ciphertextB64" in value.payload;
154
+ }
155
+ var HkdfInfo = {
156
+ /** Client -> Server encryption key */
157
+ ClientToServer: "enclavejs-c2s-enc",
158
+ /** Server -> Client encryption key */
159
+ ServerToClient: "enclavejs-s2c-enc"
160
+ };
161
+ var AES_GCM_NONCE_SIZE = 12;
162
+ var AES_GCM_TAG_SIZE = 16;
163
+ var AES_256_KEY_SIZE = 32;
164
+ var MAX_MESSAGES_PER_KEY = 1073741824n;
165
+
166
+ // libs/enclavejs-types/src/schemas.ts
167
+ import { z } from "zod";
168
+ var ProtocolVersionSchema = z.literal(PROTOCOL_VERSION);
169
+ var SessionIdSchema = z.string().startsWith(SESSION_ID_PREFIX).min(SESSION_ID_PREFIX.length + 1);
170
+ var CallIdSchema = z.string().startsWith(CALL_ID_PREFIX).min(CALL_ID_PREFIX.length + 1);
171
+ var RefIdSchema = z.string().startsWith(REF_ID_PREFIX).min(REF_ID_PREFIX.length + 1);
172
+ var LogLevelSchema = z.enum([LogLevel.Debug, LogLevel.Info, LogLevel.Warn, LogLevel.Error]);
173
+ var SessionStateSchema = z.enum([
174
+ SessionState.Starting,
175
+ SessionState.Running,
176
+ SessionState.WaitingForTool,
177
+ SessionState.Completed,
178
+ SessionState.Cancelled,
179
+ SessionState.Failed
180
+ ]);
181
+ var ErrorInfoSchema = z.object({
182
+ message: z.string(),
183
+ code: z.string().optional(),
184
+ stack: z.string().optional()
185
+ });
186
+ var RefTokenSchema = z.object({
187
+ $ref: z.object({
188
+ id: RefIdSchema
189
+ })
190
+ });
191
+ var SessionLimitsSchema = z.object({
192
+ sessionTtlMs: z.number().int().positive().optional(),
193
+ maxToolCalls: z.number().int().positive().optional(),
194
+ maxStdoutBytes: z.number().int().positive().optional(),
195
+ maxToolResultBytes: z.number().int().positive().optional(),
196
+ toolTimeoutMs: z.number().int().positive().optional(),
197
+ heartbeatIntervalMs: z.number().int().positive().optional()
198
+ });
199
+ var ToolConfigSchema = z.object({
200
+ timeout: z.number().int().positive().optional(),
201
+ retryable: z.boolean().optional(),
202
+ maxRetries: z.number().int().nonnegative().optional(),
203
+ runtimeReadable: z.boolean().optional()
204
+ });
205
+ var BaseEventSchema = z.object({
206
+ protocolVersion: ProtocolVersionSchema,
207
+ sessionId: SessionIdSchema,
208
+ seq: z.number().int().nonnegative()
209
+ });
210
+ var EncryptionConfigSchema = z.object({
211
+ enabled: z.boolean(),
212
+ keyId: z.string().optional()
213
+ });
214
+ var SessionInitPayloadSchema = z.object({
215
+ cancelUrl: z.string(),
216
+ expiresAt: z.string().datetime(),
217
+ encryption: EncryptionConfigSchema,
218
+ replayUrl: z.string().optional()
219
+ });
220
+ var StdoutPayloadSchema = z.object({
221
+ chunk: z.string()
222
+ });
223
+ var LogPayloadSchema = z.object({
224
+ level: LogLevelSchema,
225
+ message: z.string(),
226
+ data: z.record(z.string(), z.unknown()).optional()
227
+ });
228
+ var ToolCallPayloadSchema = z.object({
229
+ callId: CallIdSchema,
230
+ toolName: z.string().min(1),
231
+ args: z.unknown()
232
+ });
233
+ var ToolResultAppliedPayloadSchema = z.object({
234
+ callId: CallIdSchema
235
+ });
236
+ var SessionStatsSchema = z.object({
237
+ durationMs: z.number().nonnegative(),
238
+ toolCallCount: z.number().int().nonnegative(),
239
+ stdoutBytes: z.number().int().nonnegative()
240
+ });
241
+ var FinalPayloadSchema = z.object({
242
+ ok: z.boolean(),
243
+ result: z.unknown().optional(),
244
+ error: ErrorInfoSchema.optional(),
245
+ stats: SessionStatsSchema.optional()
246
+ });
247
+ var HeartbeatPayloadSchema = z.object({
248
+ ts: z.string().datetime()
249
+ });
250
+ var ErrorEventPayloadSchema = z.object({
251
+ message: z.string(),
252
+ code: z.string().optional(),
253
+ recoverable: z.boolean().optional()
254
+ });
255
+ var SessionInitEventSchema = BaseEventSchema.extend({
256
+ type: z.literal(EventType.SessionInit),
257
+ payload: SessionInitPayloadSchema
258
+ });
259
+ var StdoutEventSchema = BaseEventSchema.extend({
260
+ type: z.literal(EventType.Stdout),
261
+ payload: StdoutPayloadSchema
262
+ });
263
+ var LogEventSchema = BaseEventSchema.extend({
264
+ type: z.literal(EventType.Log),
265
+ payload: LogPayloadSchema
266
+ });
267
+ var ToolCallEventSchema = BaseEventSchema.extend({
268
+ type: z.literal(EventType.ToolCall),
269
+ payload: ToolCallPayloadSchema
270
+ });
271
+ var ToolResultAppliedEventSchema = BaseEventSchema.extend({
272
+ type: z.literal(EventType.ToolResultApplied),
273
+ payload: ToolResultAppliedPayloadSchema
274
+ });
275
+ var FinalEventSchema = BaseEventSchema.extend({
276
+ type: z.literal(EventType.Final),
277
+ payload: FinalPayloadSchema
278
+ });
279
+ var HeartbeatEventSchema = BaseEventSchema.extend({
280
+ type: z.literal(EventType.Heartbeat),
281
+ payload: HeartbeatPayloadSchema
282
+ });
283
+ var ErrorEventSchema = BaseEventSchema.extend({
284
+ type: z.literal(EventType.Error),
285
+ payload: ErrorEventPayloadSchema
286
+ });
287
+ var StreamEventSchema = z.discriminatedUnion("type", [
288
+ SessionInitEventSchema,
289
+ StdoutEventSchema,
290
+ LogEventSchema,
291
+ ToolCallEventSchema,
292
+ ToolResultAppliedEventSchema,
293
+ FinalEventSchema,
294
+ HeartbeatEventSchema,
295
+ ErrorEventSchema
296
+ ]);
297
+ var SupportedCurveSchema = z.enum([SupportedCurve.P256]);
298
+ var EncryptionAlgorithmSchema = z.enum([EncryptionAlgorithm.AES_GCM_256]);
299
+ var KeyDerivationSchema = z.enum([KeyDerivation.HKDF_SHA256]);
300
+ var EncryptionModeSchema = z.enum([EncryptionMode.Disabled, EncryptionMode.Optional, EncryptionMode.Required]);
301
+ var EncryptedEnvelopePayloadSchema = z.object({
302
+ kid: z.string().min(1),
303
+ nonceB64: z.string().min(1),
304
+ ciphertextB64: z.string().min(1),
305
+ tagB64: z.string().optional()
306
+ });
307
+ var EncryptedEnvelopeSchema = z.object({
308
+ protocolVersion: ProtocolVersionSchema,
309
+ sessionId: SessionIdSchema,
310
+ seq: z.number().int().nonnegative(),
311
+ type: z.literal(EventType.Encrypted),
312
+ payload: EncryptedEnvelopePayloadSchema
313
+ });
314
+ var ClientHelloSchema = z.object({
315
+ protocolVersion: ProtocolVersionSchema,
316
+ clientEphemeralPubKeyB64: z.string().min(1),
317
+ curve: SupportedCurveSchema,
318
+ supportedAlgorithms: z.array(EncryptionAlgorithmSchema).min(1)
319
+ });
320
+ var ServerHelloSchema = z.object({
321
+ protocolVersion: ProtocolVersionSchema,
322
+ serverEphemeralPubKeyB64: z.string().min(1),
323
+ curve: SupportedCurveSchema,
324
+ selectedAlgorithm: EncryptionAlgorithmSchema,
325
+ kdf: KeyDerivationSchema,
326
+ keyId: z.string().min(1),
327
+ signatureB64: z.string().optional()
328
+ });
329
+ var EncryptionRequestSchema = z.object({
330
+ mode: EncryptionModeSchema,
331
+ clientHello: ClientHelloSchema.optional()
332
+ });
333
+ var ToolResultSubmitPayloadSchema = z.object({
334
+ callId: CallIdSchema,
335
+ ok: z.boolean(),
336
+ result: z.unknown().optional(),
337
+ error: ErrorInfoSchema.optional()
338
+ });
339
+ var ToolResultSubmitMessageSchema = z.object({
340
+ protocolVersion: ProtocolVersionSchema,
341
+ sessionId: SessionIdSchema,
342
+ type: z.literal(RuntimeChannelMessageType.ToolResultSubmit),
343
+ payload: ToolResultSubmitPayloadSchema
344
+ });
345
+ var CancelPayloadSchema = z.object({
346
+ reason: z.string().optional()
347
+ });
348
+ var CancelMessageSchema = z.object({
349
+ protocolVersion: ProtocolVersionSchema,
350
+ sessionId: SessionIdSchema,
351
+ type: z.literal(RuntimeChannelMessageType.Cancel),
352
+ payload: CancelPayloadSchema
353
+ });
354
+ var RuntimeChannelMessageSchema = z.discriminatedUnion("type", [
355
+ ToolResultSubmitMessageSchema,
356
+ CancelMessageSchema
357
+ ]);
358
+ var CreateSessionRequestSchema = z.object({
359
+ protocolVersion: ProtocolVersionSchema,
360
+ code: z.string().min(1),
361
+ limits: SessionLimitsSchema.optional(),
362
+ encryption: EncryptionRequestSchema.optional()
363
+ });
364
+ function parseStreamEvent(data) {
365
+ return StreamEventSchema.safeParse(data);
366
+ }
367
+ function parseEncryptedEnvelope(data) {
368
+ return EncryptedEnvelopeSchema.safeParse(data);
369
+ }
370
+ function parseRuntimeChannelMessage(data) {
371
+ return RuntimeChannelMessageSchema.safeParse(data);
372
+ }
373
+ function parseCreateSessionRequest(data) {
374
+ return CreateSessionRequestSchema.safeParse(data);
375
+ }
376
+ function parseStreamEventOrEncrypted(data) {
377
+ if (typeof data === "object" && data !== null && "type" in data && data.type === EventType.Encrypted) {
378
+ return EncryptedEnvelopeSchema.safeParse(data);
379
+ }
380
+ return StreamEventSchema.safeParse(data);
381
+ }
382
+
383
+ // libs/enclavejs-types/src/filter.ts
384
+ var FilterMode = {
385
+ /** Include only events matching the filter (whitelist) */
386
+ Include: "include",
387
+ /** Exclude events matching the filter (blacklist) */
388
+ Exclude: "exclude"
389
+ };
390
+ var PatternType = {
391
+ /** Exact string match */
392
+ Exact: "exact",
393
+ /** Prefix match (startsWith) */
394
+ Prefix: "prefix",
395
+ /** Regular expression */
396
+ Regex: "regex",
397
+ /** Glob pattern (supports * and **) */
398
+ Glob: "glob"
399
+ };
400
+ var DEFAULT_ALWAYS_ALLOW = ["session_init", "final"];
401
+ export {
402
+ AES_256_KEY_SIZE,
403
+ AES_GCM_NONCE_SIZE,
404
+ AES_GCM_TAG_SIZE,
405
+ BaseEventSchema,
406
+ CALL_ID_PREFIX,
407
+ CallIdSchema,
408
+ CancelMessageSchema,
409
+ CancelPayloadSchema,
410
+ ClientHelloSchema,
411
+ CreateSessionRequestSchema,
412
+ DEFAULT_ALWAYS_ALLOW,
413
+ DEFAULT_SESSION_LIMITS,
414
+ EncryptedEnvelopePayloadSchema,
415
+ EncryptedEnvelopeSchema,
416
+ EncryptionAlgorithm,
417
+ EncryptionAlgorithmSchema,
418
+ EncryptionConfigSchema,
419
+ EncryptionErrorCode,
420
+ EncryptionMode,
421
+ EncryptionModeSchema,
422
+ EncryptionRequestSchema,
423
+ ErrorEventPayloadSchema,
424
+ ErrorEventSchema,
425
+ ErrorInfoSchema,
426
+ EventType,
427
+ FilterMode,
428
+ FinalEventSchema,
429
+ FinalPayloadSchema,
430
+ HeartbeatEventSchema,
431
+ HeartbeatPayloadSchema,
432
+ HkdfInfo,
433
+ KeyDerivation,
434
+ KeyDerivationSchema,
435
+ LogEventSchema,
436
+ LogLevel,
437
+ LogLevelSchema,
438
+ LogPayloadSchema,
439
+ MAX_MESSAGES_PER_KEY,
440
+ PROTOCOL_VERSION,
441
+ PatternType,
442
+ ProtocolVersionSchema,
443
+ REF_ID_PREFIX,
444
+ RefIdSchema,
445
+ RefTokenSchema,
446
+ RuntimeChannelMessageSchema,
447
+ RuntimeChannelMessageType,
448
+ SESSION_ID_PREFIX,
449
+ ServerHelloSchema,
450
+ SessionIdSchema,
451
+ SessionInitEventSchema,
452
+ SessionInitPayloadSchema,
453
+ SessionLimitsSchema,
454
+ SessionState,
455
+ SessionStateSchema,
456
+ SessionStatsSchema,
457
+ StdoutEventSchema,
458
+ StdoutPayloadSchema,
459
+ StreamEventSchema,
460
+ SupportedCurve,
461
+ SupportedCurveSchema,
462
+ ToolCallEventSchema,
463
+ ToolCallPayloadSchema,
464
+ ToolConfigSchema,
465
+ ToolResultAppliedEventSchema,
466
+ ToolResultAppliedPayloadSchema,
467
+ ToolResultSubmitMessageSchema,
468
+ ToolResultSubmitPayloadSchema,
469
+ createRefToken,
470
+ generateCallId,
471
+ generateRefId,
472
+ generateSessionId,
473
+ getEventType,
474
+ isCallId,
475
+ isEncryptedEnvelope,
476
+ isErrorEvent,
477
+ isFinalEvent,
478
+ isHeartbeatEvent,
479
+ isLogEvent,
480
+ isRefId,
481
+ isRefToken,
482
+ isSessionId,
483
+ isSessionInitEvent,
484
+ isStdoutEvent,
485
+ isToolCallEvent,
486
+ isToolResultAppliedEvent,
487
+ parseCreateSessionRequest,
488
+ parseEncryptedEnvelope,
489
+ parseRuntimeChannelMessage,
490
+ parseStreamEvent,
491
+ parseStreamEventOrEncrypted
492
+ };
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": false,
4
+ "main": "./index.mjs",
5
+ "module": "./index.mjs"
6
+ }