@enclave-vm/types 2.11.1 → 2.13.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/esm/index.mjs +105 -6
- package/events.d.ts +151 -4
- package/index.d.ts +4 -4
- package/index.js +121 -6
- package/package.json +1 -1
- package/protocol.d.ts +26 -3
- package/schemas.d.ts +550 -51
package/esm/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// libs/types/src/protocol.ts
|
|
2
|
-
var PROTOCOL_VERSION =
|
|
2
|
+
var PROTOCOL_VERSION = 2;
|
|
3
|
+
var PROTOCOL_VERSION_V1 = 1;
|
|
3
4
|
var SESSION_ID_PREFIX = "s_";
|
|
4
5
|
var CALL_ID_PREFIX = "c_";
|
|
5
6
|
var REF_ID_PREFIX = "ref_";
|
|
@@ -27,7 +28,10 @@ var DEFAULT_SESSION_LIMITS = {
|
|
|
27
28
|
maxStdoutBytes: 262144,
|
|
28
29
|
maxToolResultBytes: 5242880,
|
|
29
30
|
toolTimeoutMs: 3e4,
|
|
30
|
-
heartbeatIntervalMs: 15e3
|
|
31
|
+
heartbeatIntervalMs: 15e3,
|
|
32
|
+
deadlineMs: 0,
|
|
33
|
+
perToolDeadlineMs: 3e4,
|
|
34
|
+
cancelOnFirstError: false
|
|
31
35
|
};
|
|
32
36
|
var SessionState = {
|
|
33
37
|
/** Session is starting up */
|
|
@@ -75,7 +79,15 @@ var EventType = {
|
|
|
75
79
|
/** Error event */
|
|
76
80
|
Error: "error",
|
|
77
81
|
/** Encrypted envelope (wraps other events) */
|
|
78
|
-
Encrypted: "enc"
|
|
82
|
+
Encrypted: "enc",
|
|
83
|
+
/** Partial result (GraphQL-inspired, data+errors coexist) */
|
|
84
|
+
PartialResult: "partial_result",
|
|
85
|
+
/** Tool execution progress */
|
|
86
|
+
ToolProgress: "tool_progress",
|
|
87
|
+
/** Deadline exceeded for execution */
|
|
88
|
+
DeadlineExceeded: "deadline_exceeded",
|
|
89
|
+
/** Action catalog changed (for long-lived connections) */
|
|
90
|
+
CatalogChanged: "catalog_changed"
|
|
79
91
|
};
|
|
80
92
|
function getEventType(event) {
|
|
81
93
|
return event.type;
|
|
@@ -104,6 +116,18 @@ function isHeartbeatEvent(event) {
|
|
|
104
116
|
function isErrorEvent(event) {
|
|
105
117
|
return event.type === EventType.Error;
|
|
106
118
|
}
|
|
119
|
+
function isPartialResultEvent(event) {
|
|
120
|
+
return event.type === EventType.PartialResult;
|
|
121
|
+
}
|
|
122
|
+
function isToolProgressEvent(event) {
|
|
123
|
+
return event.type === EventType.ToolProgress;
|
|
124
|
+
}
|
|
125
|
+
function isDeadlineExceededEvent(event) {
|
|
126
|
+
return event.type === EventType.DeadlineExceeded;
|
|
127
|
+
}
|
|
128
|
+
function isCatalogChangedEvent(event) {
|
|
129
|
+
return event.type === EventType.CatalogChanged;
|
|
130
|
+
}
|
|
107
131
|
var RuntimeChannelMessageType = {
|
|
108
132
|
/** Tool result submission from broker to runtime */
|
|
109
133
|
ToolResultSubmit: "tool_result_submit",
|
|
@@ -165,7 +189,7 @@ var MAX_MESSAGES_PER_KEY = 1073741824n;
|
|
|
165
189
|
|
|
166
190
|
// libs/types/src/schemas.ts
|
|
167
191
|
import { z } from "zod";
|
|
168
|
-
var ProtocolVersionSchema = z.literal(PROTOCOL_VERSION);
|
|
192
|
+
var ProtocolVersionSchema = z.union([z.literal(PROTOCOL_VERSION), z.literal(1)]);
|
|
169
193
|
var SessionIdSchema = z.string().startsWith(SESSION_ID_PREFIX).min(SESSION_ID_PREFIX.length + 1);
|
|
170
194
|
var CallIdSchema = z.string().startsWith(CALL_ID_PREFIX).min(CALL_ID_PREFIX.length + 1);
|
|
171
195
|
var RefIdSchema = z.string().startsWith(REF_ID_PREFIX).min(REF_ID_PREFIX.length + 1);
|
|
@@ -194,7 +218,10 @@ var SessionLimitsSchema = z.object({
|
|
|
194
218
|
maxStdoutBytes: z.number().int().positive().optional(),
|
|
195
219
|
maxToolResultBytes: z.number().int().positive().optional(),
|
|
196
220
|
toolTimeoutMs: z.number().int().positive().optional(),
|
|
197
|
-
heartbeatIntervalMs: z.number().int().positive().optional()
|
|
221
|
+
heartbeatIntervalMs: z.number().int().positive().optional(),
|
|
222
|
+
deadlineMs: z.number().int().nonnegative().optional(),
|
|
223
|
+
perToolDeadlineMs: z.number().int().positive().optional(),
|
|
224
|
+
cancelOnFirstError: z.boolean().optional()
|
|
198
225
|
});
|
|
199
226
|
var ToolConfigSchema = z.object({
|
|
200
227
|
timeout: z.number().int().positive().optional(),
|
|
@@ -238,10 +265,23 @@ var SessionStatsSchema = z.object({
|
|
|
238
265
|
toolCallCount: z.number().int().nonnegative(),
|
|
239
266
|
stdoutBytes: z.number().int().nonnegative()
|
|
240
267
|
});
|
|
268
|
+
var ErrorDetailSchema = z.discriminatedUnion("type", [
|
|
269
|
+
z.object({ type: z.literal("retry_info"), retryDelayMs: z.number().nonnegative() }),
|
|
270
|
+
z.object({ type: z.literal("upstream_info"), statusCode: z.number().int(), url: z.string() }),
|
|
271
|
+
z.object({ type: z.literal("validation_info"), field: z.string(), reason: z.string() }),
|
|
272
|
+
z.object({ type: z.literal("quota_info"), limit: z.number().nonnegative(), used: z.number().nonnegative() })
|
|
273
|
+
]);
|
|
274
|
+
var ErrorPayloadSchema = z.object({
|
|
275
|
+
code: z.string(),
|
|
276
|
+
message: z.string(),
|
|
277
|
+
path: z.array(z.string()).optional(),
|
|
278
|
+
details: z.array(ErrorDetailSchema).optional()
|
|
279
|
+
});
|
|
241
280
|
var FinalPayloadSchema = z.object({
|
|
242
281
|
ok: z.boolean(),
|
|
243
282
|
result: z.unknown().optional(),
|
|
244
283
|
error: ErrorInfoSchema.optional(),
|
|
284
|
+
errors: z.array(ErrorPayloadSchema).optional(),
|
|
245
285
|
stats: SessionStatsSchema.optional()
|
|
246
286
|
});
|
|
247
287
|
var HeartbeatPayloadSchema = z.object({
|
|
@@ -284,6 +324,45 @@ var ErrorEventSchema = BaseEventSchema.extend({
|
|
|
284
324
|
type: z.literal(EventType.Error),
|
|
285
325
|
payload: ErrorEventPayloadSchema
|
|
286
326
|
});
|
|
327
|
+
var PartialResultPayloadSchema = z.object({
|
|
328
|
+
path: z.array(z.string()),
|
|
329
|
+
data: z.unknown().optional(),
|
|
330
|
+
error: ErrorPayloadSchema.optional(),
|
|
331
|
+
hasNext: z.boolean()
|
|
332
|
+
});
|
|
333
|
+
var PartialResultEventSchema = BaseEventSchema.extend({
|
|
334
|
+
type: z.literal(EventType.PartialResult),
|
|
335
|
+
payload: PartialResultPayloadSchema
|
|
336
|
+
});
|
|
337
|
+
var ToolProgressPhaseSchema = z.enum(["connecting", "sending", "receiving", "processing"]);
|
|
338
|
+
var ToolProgressPayloadSchema = z.object({
|
|
339
|
+
callId: CallIdSchema,
|
|
340
|
+
phase: ToolProgressPhaseSchema,
|
|
341
|
+
bytesReceived: z.number().int().nonnegative().optional(),
|
|
342
|
+
totalBytes: z.number().int().nonnegative().optional(),
|
|
343
|
+
elapsedMs: z.number().nonnegative()
|
|
344
|
+
});
|
|
345
|
+
var ToolProgressEventSchema = BaseEventSchema.extend({
|
|
346
|
+
type: z.literal(EventType.ToolProgress),
|
|
347
|
+
payload: ToolProgressPayloadSchema
|
|
348
|
+
});
|
|
349
|
+
var DeadlineExceededPayloadSchema = z.object({
|
|
350
|
+
elapsedMs: z.number().nonnegative(),
|
|
351
|
+
budgetMs: z.number().positive()
|
|
352
|
+
});
|
|
353
|
+
var DeadlineExceededEventSchema = BaseEventSchema.extend({
|
|
354
|
+
type: z.literal(EventType.DeadlineExceeded),
|
|
355
|
+
payload: DeadlineExceededPayloadSchema
|
|
356
|
+
});
|
|
357
|
+
var CatalogChangedPayloadSchema = z.object({
|
|
358
|
+
version: z.string().min(1),
|
|
359
|
+
addedActions: z.array(z.string()),
|
|
360
|
+
removedActions: z.array(z.string())
|
|
361
|
+
});
|
|
362
|
+
var CatalogChangedEventSchema = BaseEventSchema.extend({
|
|
363
|
+
type: z.literal(EventType.CatalogChanged),
|
|
364
|
+
payload: CatalogChangedPayloadSchema
|
|
365
|
+
});
|
|
287
366
|
var StreamEventSchema = z.discriminatedUnion("type", [
|
|
288
367
|
SessionInitEventSchema,
|
|
289
368
|
StdoutEventSchema,
|
|
@@ -292,7 +371,11 @@ var StreamEventSchema = z.discriminatedUnion("type", [
|
|
|
292
371
|
ToolResultAppliedEventSchema,
|
|
293
372
|
FinalEventSchema,
|
|
294
373
|
HeartbeatEventSchema,
|
|
295
|
-
ErrorEventSchema
|
|
374
|
+
ErrorEventSchema,
|
|
375
|
+
PartialResultEventSchema,
|
|
376
|
+
ToolProgressEventSchema,
|
|
377
|
+
DeadlineExceededEventSchema,
|
|
378
|
+
CatalogChangedEventSchema
|
|
296
379
|
]);
|
|
297
380
|
var SupportedCurveSchema = z.enum([SupportedCurve.P256]);
|
|
298
381
|
var EncryptionAlgorithmSchema = z.enum([EncryptionAlgorithm.AES_GCM_256]);
|
|
@@ -407,10 +490,14 @@ export {
|
|
|
407
490
|
CallIdSchema,
|
|
408
491
|
CancelMessageSchema,
|
|
409
492
|
CancelPayloadSchema,
|
|
493
|
+
CatalogChangedEventSchema,
|
|
494
|
+
CatalogChangedPayloadSchema,
|
|
410
495
|
ClientHelloSchema,
|
|
411
496
|
CreateSessionRequestSchema,
|
|
412
497
|
DEFAULT_ALWAYS_ALLOW,
|
|
413
498
|
DEFAULT_SESSION_LIMITS,
|
|
499
|
+
DeadlineExceededEventSchema,
|
|
500
|
+
DeadlineExceededPayloadSchema,
|
|
414
501
|
EncryptedEnvelopePayloadSchema,
|
|
415
502
|
EncryptedEnvelopeSchema,
|
|
416
503
|
EncryptionAlgorithm,
|
|
@@ -420,9 +507,11 @@ export {
|
|
|
420
507
|
EncryptionMode,
|
|
421
508
|
EncryptionModeSchema,
|
|
422
509
|
EncryptionRequestSchema,
|
|
510
|
+
ErrorDetailSchema,
|
|
423
511
|
ErrorEventPayloadSchema,
|
|
424
512
|
ErrorEventSchema,
|
|
425
513
|
ErrorInfoSchema,
|
|
514
|
+
ErrorPayloadSchema,
|
|
426
515
|
EventType,
|
|
427
516
|
FilterMode,
|
|
428
517
|
FinalEventSchema,
|
|
@@ -438,6 +527,9 @@ export {
|
|
|
438
527
|
LogPayloadSchema,
|
|
439
528
|
MAX_MESSAGES_PER_KEY,
|
|
440
529
|
PROTOCOL_VERSION,
|
|
530
|
+
PROTOCOL_VERSION_V1,
|
|
531
|
+
PartialResultEventSchema,
|
|
532
|
+
PartialResultPayloadSchema,
|
|
441
533
|
PatternType,
|
|
442
534
|
ProtocolVersionSchema,
|
|
443
535
|
REF_ID_PREFIX,
|
|
@@ -462,6 +554,9 @@ export {
|
|
|
462
554
|
ToolCallEventSchema,
|
|
463
555
|
ToolCallPayloadSchema,
|
|
464
556
|
ToolConfigSchema,
|
|
557
|
+
ToolProgressEventSchema,
|
|
558
|
+
ToolProgressPayloadSchema,
|
|
559
|
+
ToolProgressPhaseSchema,
|
|
465
560
|
ToolResultAppliedEventSchema,
|
|
466
561
|
ToolResultAppliedPayloadSchema,
|
|
467
562
|
ToolResultSubmitMessageSchema,
|
|
@@ -472,17 +567,21 @@ export {
|
|
|
472
567
|
generateSessionId,
|
|
473
568
|
getEventType,
|
|
474
569
|
isCallId,
|
|
570
|
+
isCatalogChangedEvent,
|
|
571
|
+
isDeadlineExceededEvent,
|
|
475
572
|
isEncryptedEnvelope,
|
|
476
573
|
isErrorEvent,
|
|
477
574
|
isFinalEvent,
|
|
478
575
|
isHeartbeatEvent,
|
|
479
576
|
isLogEvent,
|
|
577
|
+
isPartialResultEvent,
|
|
480
578
|
isRefId,
|
|
481
579
|
isRefToken,
|
|
482
580
|
isSessionId,
|
|
483
581
|
isSessionInitEvent,
|
|
484
582
|
isStdoutEvent,
|
|
485
583
|
isToolCallEvent,
|
|
584
|
+
isToolProgressEvent,
|
|
486
585
|
isToolResultAppliedEvent,
|
|
487
586
|
parseCreateSessionRequest,
|
|
488
587
|
parseEncryptedEnvelope,
|
package/events.d.ts
CHANGED
|
@@ -4,6 +4,39 @@
|
|
|
4
4
|
* All event types that can be sent over the streaming protocol.
|
|
5
5
|
*/
|
|
6
6
|
import type { ProtocolVersion, SessionId, CallId, ErrorInfo, LogLevel } from './protocol.js';
|
|
7
|
+
/**
|
|
8
|
+
* Typed error details for structured error reporting.
|
|
9
|
+
*/
|
|
10
|
+
export type ErrorDetail = {
|
|
11
|
+
type: 'retry_info';
|
|
12
|
+
retryDelayMs: number;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'upstream_info';
|
|
15
|
+
statusCode: number;
|
|
16
|
+
url: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'validation_info';
|
|
19
|
+
field: string;
|
|
20
|
+
reason: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'quota_info';
|
|
23
|
+
limit: number;
|
|
24
|
+
used: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Rich error payload following gRPC error model.
|
|
28
|
+
* Supports per-path errors with typed details.
|
|
29
|
+
*/
|
|
30
|
+
export interface ErrorPayload {
|
|
31
|
+
/** Machine-readable error code (e.g., 'TOOL_TIMEOUT', 'VALIDATION_ERROR') */
|
|
32
|
+
code: string;
|
|
33
|
+
/** Human-readable error message */
|
|
34
|
+
message: string;
|
|
35
|
+
/** Path to the failing operation (like GraphQL path) */
|
|
36
|
+
path?: string[];
|
|
37
|
+
/** Typed error details for programmatic handling */
|
|
38
|
+
details?: ErrorDetail[];
|
|
39
|
+
}
|
|
7
40
|
/**
|
|
8
41
|
* Base event structure shared by all stream events.
|
|
9
42
|
*/
|
|
@@ -37,6 +70,14 @@ export declare const EventType: {
|
|
|
37
70
|
readonly Error: "error";
|
|
38
71
|
/** Encrypted envelope (wraps other events) */
|
|
39
72
|
readonly Encrypted: "enc";
|
|
73
|
+
/** Partial result (GraphQL-inspired, data+errors coexist) */
|
|
74
|
+
readonly PartialResult: "partial_result";
|
|
75
|
+
/** Tool execution progress */
|
|
76
|
+
readonly ToolProgress: "tool_progress";
|
|
77
|
+
/** Deadline exceeded for execution */
|
|
78
|
+
readonly DeadlineExceeded: "deadline_exceeded";
|
|
79
|
+
/** Action catalog changed (for long-lived connections) */
|
|
80
|
+
readonly CatalogChanged: "catalog_changed";
|
|
40
81
|
};
|
|
41
82
|
export type EventType = (typeof EventType)[keyof typeof EventType];
|
|
42
83
|
/**
|
|
@@ -139,14 +180,17 @@ export interface ToolResultAppliedEvent extends BaseEvent {
|
|
|
139
180
|
}
|
|
140
181
|
/**
|
|
141
182
|
* Final event payload.
|
|
183
|
+
* Supports mixed results (GraphQL-inspired): data and errors can coexist.
|
|
142
184
|
*/
|
|
143
185
|
export interface FinalPayload {
|
|
144
|
-
/** Whether
|
|
186
|
+
/** Whether all operations completed successfully */
|
|
145
187
|
ok: boolean;
|
|
146
|
-
/** Execution result (
|
|
188
|
+
/** Execution result (full aggregated result) */
|
|
147
189
|
result?: unknown;
|
|
148
|
-
/** Error information (if ok is false) */
|
|
190
|
+
/** Error information (if ok is false, legacy single error) */
|
|
149
191
|
error?: ErrorInfo;
|
|
192
|
+
/** Per-path errors (GraphQL-style errors array) */
|
|
193
|
+
errors?: ErrorPayload[];
|
|
150
194
|
/** Execution statistics */
|
|
151
195
|
stats?: SessionStats;
|
|
152
196
|
}
|
|
@@ -203,10 +247,97 @@ export interface ErrorEvent extends BaseEvent {
|
|
|
203
247
|
type: typeof EventType.Error;
|
|
204
248
|
payload: ErrorEventPayload;
|
|
205
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Partial result event payload.
|
|
252
|
+
* When code fans out to multiple APIs, results arrive incrementally.
|
|
253
|
+
*/
|
|
254
|
+
export interface PartialResultPayload {
|
|
255
|
+
/** Path to where this result slots in (like GraphQL path) */
|
|
256
|
+
path: string[];
|
|
257
|
+
/** The partial data (if this path succeeded) */
|
|
258
|
+
data?: unknown;
|
|
259
|
+
/** The error for this path (if this path failed) */
|
|
260
|
+
error?: ErrorPayload;
|
|
261
|
+
/** Whether more partial results are coming */
|
|
262
|
+
hasNext: boolean;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Partial result event.
|
|
266
|
+
* Emitted when individual parts of a fan-out execution complete.
|
|
267
|
+
*/
|
|
268
|
+
export interface PartialResultEvent extends BaseEvent {
|
|
269
|
+
type: typeof EventType.PartialResult;
|
|
270
|
+
payload: PartialResultPayload;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Tool progress phase.
|
|
274
|
+
*/
|
|
275
|
+
export type ToolProgressPhase = 'connecting' | 'sending' | 'receiving' | 'processing';
|
|
276
|
+
/**
|
|
277
|
+
* Tool progress event payload.
|
|
278
|
+
* Reports progress for long-running tool calls.
|
|
279
|
+
*/
|
|
280
|
+
export interface ToolProgressPayload {
|
|
281
|
+
/** Call ID of the tool call */
|
|
282
|
+
callId: CallId;
|
|
283
|
+
/** Current phase of execution */
|
|
284
|
+
phase: ToolProgressPhase;
|
|
285
|
+
/** Bytes received so far */
|
|
286
|
+
bytesReceived?: number;
|
|
287
|
+
/** Total bytes expected (if Content-Length known) */
|
|
288
|
+
totalBytes?: number;
|
|
289
|
+
/** Elapsed time in milliseconds */
|
|
290
|
+
elapsedMs: number;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Tool progress event.
|
|
294
|
+
* Emitted during long-running tool calls to report progress.
|
|
295
|
+
*/
|
|
296
|
+
export interface ToolProgressEvent extends BaseEvent {
|
|
297
|
+
type: typeof EventType.ToolProgress;
|
|
298
|
+
payload: ToolProgressPayload;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Deadline exceeded event payload.
|
|
302
|
+
*/
|
|
303
|
+
export interface DeadlineExceededPayload {
|
|
304
|
+
/** Total elapsed time in milliseconds */
|
|
305
|
+
elapsedMs: number;
|
|
306
|
+
/** The deadline budget that was exceeded in milliseconds */
|
|
307
|
+
budgetMs: number;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Deadline exceeded event.
|
|
311
|
+
* Emitted when execution exceeds the configured deadline.
|
|
312
|
+
*/
|
|
313
|
+
export interface DeadlineExceededEvent extends BaseEvent {
|
|
314
|
+
type: typeof EventType.DeadlineExceeded;
|
|
315
|
+
payload: DeadlineExceededPayload;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Catalog changed event payload.
|
|
319
|
+
* Notifies clients that the available action catalog has changed.
|
|
320
|
+
*/
|
|
321
|
+
export interface CatalogChangedPayload {
|
|
322
|
+
/** New catalog version hash */
|
|
323
|
+
version: string;
|
|
324
|
+
/** Names of newly added actions */
|
|
325
|
+
addedActions: string[];
|
|
326
|
+
/** Names of removed actions */
|
|
327
|
+
removedActions: string[];
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Catalog changed event.
|
|
331
|
+
* Emitted when the action catalog is updated (tools added/removed via OpenAPI polling).
|
|
332
|
+
*/
|
|
333
|
+
export interface CatalogChangedEvent extends BaseEvent {
|
|
334
|
+
type: typeof EventType.CatalogChanged;
|
|
335
|
+
payload: CatalogChangedPayload;
|
|
336
|
+
}
|
|
206
337
|
/**
|
|
207
338
|
* Union of all stream event types (excluding encrypted envelope).
|
|
208
339
|
*/
|
|
209
|
-
export type StreamEvent = SessionInitEvent | StdoutEvent | LogEvent | ToolCallEvent | ToolResultAppliedEvent | FinalEvent | HeartbeatEvent | ErrorEvent;
|
|
340
|
+
export type StreamEvent = SessionInitEvent | StdoutEvent | LogEvent | ToolCallEvent | ToolResultAppliedEvent | FinalEvent | HeartbeatEvent | ErrorEvent | PartialResultEvent | ToolProgressEvent | DeadlineExceededEvent | CatalogChangedEvent;
|
|
210
341
|
/**
|
|
211
342
|
* Get the event type from a stream event.
|
|
212
343
|
*/
|
|
@@ -243,6 +374,22 @@ export declare function isHeartbeatEvent(event: StreamEvent): event is Heartbeat
|
|
|
243
374
|
* Type guard for error event.
|
|
244
375
|
*/
|
|
245
376
|
export declare function isErrorEvent(event: StreamEvent): event is ErrorEvent;
|
|
377
|
+
/**
|
|
378
|
+
* Type guard for partial result event.
|
|
379
|
+
*/
|
|
380
|
+
export declare function isPartialResultEvent(event: StreamEvent): event is PartialResultEvent;
|
|
381
|
+
/**
|
|
382
|
+
* Type guard for tool progress event.
|
|
383
|
+
*/
|
|
384
|
+
export declare function isToolProgressEvent(event: StreamEvent): event is ToolProgressEvent;
|
|
385
|
+
/**
|
|
386
|
+
* Type guard for deadline exceeded event.
|
|
387
|
+
*/
|
|
388
|
+
export declare function isDeadlineExceededEvent(event: StreamEvent): event is DeadlineExceededEvent;
|
|
389
|
+
/**
|
|
390
|
+
* Type guard for catalog changed event.
|
|
391
|
+
*/
|
|
392
|
+
export declare function isCatalogChangedEvent(event: StreamEvent): event is CatalogChangedEvent;
|
|
246
393
|
/**
|
|
247
394
|
* Message types for the internal middleware <-> runtime channel.
|
|
248
395
|
*/
|
package/index.d.ts
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
-
export { PROTOCOL_VERSION, SESSION_ID_PREFIX, CALL_ID_PREFIX, REF_ID_PREFIX, generateSessionId, generateCallId, generateRefId, isSessionId, isCallId, isRefId, DEFAULT_SESSION_LIMITS, SessionState, LogLevel, isRefToken, createRefToken, } from './protocol.js';
|
|
8
|
+
export { PROTOCOL_VERSION, PROTOCOL_VERSION_V1, SESSION_ID_PREFIX, CALL_ID_PREFIX, REF_ID_PREFIX, generateSessionId, generateCallId, generateRefId, isSessionId, isCallId, isRefId, DEFAULT_SESSION_LIMITS, SessionState, LogLevel, isRefToken, createRefToken, } from './protocol.js';
|
|
9
9
|
export type { ProtocolVersion, SessionId, CallId, RefId, SessionLimits, ToolConfig, RefToken, ErrorInfo, } from './protocol.js';
|
|
10
|
-
export { EventType, RuntimeChannelMessageType, getEventType, isSessionInitEvent, isStdoutEvent, isLogEvent, isToolCallEvent, isToolResultAppliedEvent, isFinalEvent, isHeartbeatEvent, isErrorEvent, } from './events.js';
|
|
11
|
-
export type { BaseEvent, EncryptionConfig, SessionInitPayload, SessionInitEvent, StdoutPayload, StdoutEvent, LogPayload, LogEvent, ToolCallPayload, ToolCallEvent, ToolResultAppliedPayload, ToolResultAppliedEvent, FinalPayload, SessionStats, FinalEvent, HeartbeatPayload, HeartbeatEvent, ErrorEventPayload, ErrorEvent, StreamEvent, ToolResultSubmitPayload, ToolResultSubmitMessage, CancelPayload, CancelMessage, RuntimeChannelMessage, } from './events.js';
|
|
10
|
+
export { EventType, RuntimeChannelMessageType, getEventType, isSessionInitEvent, isStdoutEvent, isLogEvent, isToolCallEvent, isToolResultAppliedEvent, isFinalEvent, isHeartbeatEvent, isErrorEvent, isPartialResultEvent, isToolProgressEvent, isDeadlineExceededEvent, isCatalogChangedEvent, } from './events.js';
|
|
11
|
+
export type { BaseEvent, EncryptionConfig, SessionInitPayload, SessionInitEvent, StdoutPayload, StdoutEvent, LogPayload, LogEvent, ToolCallPayload, ToolCallEvent, ToolResultAppliedPayload, ToolResultAppliedEvent, FinalPayload, SessionStats, FinalEvent, HeartbeatPayload, HeartbeatEvent, ErrorEventPayload, ErrorEvent, StreamEvent, ToolResultSubmitPayload, ToolResultSubmitMessage, CancelPayload, CancelMessage, RuntimeChannelMessage, ErrorPayload, ErrorDetail, PartialResultPayload, PartialResultEvent, ToolProgressPhase, ToolProgressPayload, ToolProgressEvent, DeadlineExceededPayload, DeadlineExceededEvent, CatalogChangedPayload, CatalogChangedEvent, } from './events.js';
|
|
12
12
|
export { SupportedCurve, EncryptionAlgorithm, KeyDerivation, EncryptionMode, EncryptionErrorCode, HkdfInfo, AES_GCM_NONCE_SIZE, AES_GCM_TAG_SIZE, AES_256_KEY_SIZE, MAX_MESSAGES_PER_KEY, isEncryptedEnvelope, } from './encryption.js';
|
|
13
13
|
export type { EncryptedEnvelopePayload, EncryptedEnvelope, ClientHello, ServerHello, EncryptionRequest, SessionKeyInfo, MaybeEncrypted, } from './encryption.js';
|
|
14
|
-
export { ProtocolVersionSchema, SessionIdSchema, CallIdSchema, RefIdSchema, LogLevelSchema, SessionStateSchema, ErrorInfoSchema, RefTokenSchema, SessionLimitsSchema, ToolConfigSchema, BaseEventSchema, EncryptionConfigSchema, SessionInitPayloadSchema, StdoutPayloadSchema, LogPayloadSchema, ToolCallPayloadSchema, ToolResultAppliedPayloadSchema, SessionStatsSchema, FinalPayloadSchema, HeartbeatPayloadSchema, ErrorEventPayloadSchema, SessionInitEventSchema, StdoutEventSchema, LogEventSchema, ToolCallEventSchema, ToolResultAppliedEventSchema, FinalEventSchema, HeartbeatEventSchema, ErrorEventSchema, StreamEventSchema, SupportedCurveSchema, EncryptionAlgorithmSchema, KeyDerivationSchema, EncryptionModeSchema, EncryptedEnvelopePayloadSchema, EncryptedEnvelopeSchema, ClientHelloSchema, ServerHelloSchema, EncryptionRequestSchema, ToolResultSubmitPayloadSchema, ToolResultSubmitMessageSchema, CancelPayloadSchema, CancelMessageSchema, RuntimeChannelMessageSchema, CreateSessionRequestSchema, parseStreamEvent, parseEncryptedEnvelope, parseRuntimeChannelMessage, parseCreateSessionRequest, parseStreamEventOrEncrypted, } from './schemas.js';
|
|
14
|
+
export { ProtocolVersionSchema, SessionIdSchema, CallIdSchema, RefIdSchema, LogLevelSchema, SessionStateSchema, ErrorInfoSchema, RefTokenSchema, SessionLimitsSchema, ToolConfigSchema, BaseEventSchema, EncryptionConfigSchema, SessionInitPayloadSchema, StdoutPayloadSchema, LogPayloadSchema, ToolCallPayloadSchema, ToolResultAppliedPayloadSchema, SessionStatsSchema, FinalPayloadSchema, HeartbeatPayloadSchema, ErrorEventPayloadSchema, SessionInitEventSchema, StdoutEventSchema, LogEventSchema, ToolCallEventSchema, ToolResultAppliedEventSchema, FinalEventSchema, HeartbeatEventSchema, ErrorEventSchema, ErrorDetailSchema, ErrorPayloadSchema, PartialResultPayloadSchema, PartialResultEventSchema, ToolProgressPhaseSchema, ToolProgressPayloadSchema, ToolProgressEventSchema, DeadlineExceededPayloadSchema, DeadlineExceededEventSchema, CatalogChangedPayloadSchema, CatalogChangedEventSchema, StreamEventSchema, SupportedCurveSchema, EncryptionAlgorithmSchema, KeyDerivationSchema, EncryptionModeSchema, EncryptedEnvelopePayloadSchema, EncryptedEnvelopeSchema, ClientHelloSchema, ServerHelloSchema, EncryptionRequestSchema, ToolResultSubmitPayloadSchema, ToolResultSubmitMessageSchema, CancelPayloadSchema, CancelMessageSchema, RuntimeChannelMessageSchema, CreateSessionRequestSchema, parseStreamEvent, parseEncryptedEnvelope, parseRuntimeChannelMessage, parseCreateSessionRequest, parseStreamEventOrEncrypted, } from './schemas.js';
|
|
15
15
|
export type { ParsedStreamEvent, ParsedEncryptedEnvelope, ParsedRuntimeChannelMessage, ParsedCreateSessionRequest, } from './schemas.js';
|
|
16
16
|
export { FilterMode, PatternType, DEFAULT_ALWAYS_ALLOW } from './filter.js';
|
|
17
17
|
export type { ContentPattern, TypeFilter, ContentFilter, FilterRule, EventFilterConfig } from './filter.js';
|