@kernl-sdk/protocol 0.2.8 → 0.3.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.
Files changed (40) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +9 -0
  3. package/README.md +48 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -0
  7. package/dist/realtime/events.d.ts +313 -0
  8. package/dist/realtime/events.d.ts.map +1 -0
  9. package/dist/realtime/index.d.ts +4 -0
  10. package/dist/realtime/index.d.ts.map +1 -0
  11. package/dist/realtime/index.js +3 -0
  12. package/dist/realtime/model.d.ts +99 -0
  13. package/dist/realtime/model.d.ts.map +1 -0
  14. package/dist/realtime/types.d.ts +229 -0
  15. package/dist/realtime/types.d.ts.map +1 -0
  16. package/package.json +1 -1
  17. package/src/index.ts +1 -0
  18. package/src/realtime/events.ts +397 -0
  19. package/src/realtime/index.ts +3 -0
  20. package/src/realtime/model.ts +121 -0
  21. package/src/realtime/types.ts +276 -0
  22. package/.turbo/turbo-check-types.log +0 -4
  23. package/dist/codec.d.ts +0 -22
  24. package/dist/codec.d.ts.map +0 -1
  25. package/dist/embedding-model/embedding-model.d.ts +0 -57
  26. package/dist/embedding-model/embedding-model.d.ts.map +0 -1
  27. package/dist/embedding-model/embedding-model.js +0 -6
  28. package/dist/language-model/content.d.ts +0 -141
  29. package/dist/language-model/content.d.ts.map +0 -1
  30. package/dist/language-model/language-model.d.ts +0 -114
  31. package/dist/language-model/language-model.d.ts.map +0 -1
  32. package/dist/language-model/settings.d.ts +0 -99
  33. package/dist/language-model/settings.d.ts.map +0 -1
  34. package/dist/language-model/settings.js +0 -1
  35. package/dist/provider/metadata.d.ts +0 -21
  36. package/dist/provider/metadata.d.ts.map +0 -1
  37. package/dist/provider/metadata.js +0 -1
  38. /package/dist/{codec.js → realtime/events.js} +0 -0
  39. /package/dist/{language-model/content.js → realtime/model.js} +0 -0
  40. /package/dist/{language-model/language-model.js → realtime/types.js} +0 -0
@@ -0,0 +1,229 @@
1
+ import { SharedProviderOptions } from "../provider/index.js";
2
+ import { LanguageModelTool } from "../language-model/index.js";
3
+ export interface RealtimeConnectOptions {
4
+ /**
5
+ * Initial session configuration.
6
+ */
7
+ sessionConfig?: RealtimeSessionConfig;
8
+ /**
9
+ * Resume a previous session.
10
+ */
11
+ resume?: SessionResumeConfig;
12
+ /**
13
+ * Abort signal for cancelling connection.
14
+ */
15
+ abort?: AbortSignal;
16
+ /**
17
+ * Provider-specific options.
18
+ */
19
+ providerOptions?: SharedProviderOptions;
20
+ }
21
+ /**
22
+ * Configuration for a realtime session.
23
+ */
24
+ export interface RealtimeSessionConfig {
25
+ /**
26
+ * System instructions for the model.
27
+ */
28
+ instructions?: string;
29
+ /**
30
+ * Available tools the model can call.
31
+ */
32
+ tools?: LanguageModelTool[];
33
+ /**
34
+ * Tool choice behavior.
35
+ */
36
+ toolChoice?: RealtimeToolChoice;
37
+ /**
38
+ * Output modalities (text, audio, or both).
39
+ */
40
+ modalities?: RealtimeModality[];
41
+ /**
42
+ * Voice configuration for audio output.
43
+ */
44
+ voice?: VoiceConfig;
45
+ /**
46
+ * Audio format configuration.
47
+ */
48
+ audio?: AudioConfig;
49
+ /**
50
+ * Turn detection / VAD configuration.
51
+ */
52
+ turnDetection?: TurnDetectionConfig;
53
+ /**
54
+ * Provider-specific options.
55
+ */
56
+ providerOptions?: SharedProviderOptions;
57
+ }
58
+ /**
59
+ * Output modality for realtime sessions.
60
+ */
61
+ export type RealtimeModality = "text" | "audio";
62
+ /**
63
+ * Tool choice behavior for realtime sessions.
64
+ */
65
+ export type RealtimeToolChoice = {
66
+ kind: "auto";
67
+ } | {
68
+ kind: "none";
69
+ } | {
70
+ kind: "required";
71
+ };
72
+ /**
73
+ * Voice configuration for audio output.
74
+ */
75
+ export interface VoiceConfig {
76
+ /**
77
+ * Voice ID (provider-specific).
78
+ */
79
+ voiceId: string;
80
+ /**
81
+ * Playback speed multiplier.
82
+ */
83
+ speed?: number;
84
+ }
85
+ /**
86
+ * Audio format configuration for input and output.
87
+ */
88
+ export interface AudioConfig {
89
+ /**
90
+ * Input audio format.
91
+ */
92
+ inputFormat?: AudioFormat;
93
+ /**
94
+ * Output audio format.
95
+ */
96
+ outputFormat?: AudioFormat;
97
+ }
98
+ /**
99
+ * Audio format specification.
100
+ */
101
+ export interface AudioFormat {
102
+ /**
103
+ * MIME type (e.g., "audio/pcm", "audio/wav").
104
+ */
105
+ mimeType: string;
106
+ /**
107
+ * Sample rate in Hz.
108
+ */
109
+ sampleRate?: number;
110
+ /**
111
+ * Bits per sample.
112
+ */
113
+ bitDepth?: number;
114
+ /**
115
+ * Number of channels.
116
+ */
117
+ channels?: number;
118
+ }
119
+ /**
120
+ * Turn detection / VAD configuration.
121
+ */
122
+ export interface TurnDetectionConfig {
123
+ /**
124
+ * Detection mode.
125
+ */
126
+ mode: "server_vad" | "manual";
127
+ /**
128
+ * VAD threshold (0-1).
129
+ */
130
+ threshold?: number;
131
+ /**
132
+ * Silence duration to trigger end of speech (ms).
133
+ */
134
+ silenceDurationMs?: number;
135
+ /**
136
+ * Audio to include before speech start (ms).
137
+ */
138
+ prefixPaddingMs?: number;
139
+ /**
140
+ * Auto-create response on speech end.
141
+ */
142
+ createResponse?: boolean;
143
+ /**
144
+ * Allow interruption of ongoing response.
145
+ */
146
+ interruptResponse?: boolean;
147
+ }
148
+ /**
149
+ * Configuration for resuming a previous session.
150
+ */
151
+ export interface SessionResumeConfig {
152
+ /**
153
+ * Handle from a previous session.
154
+ */
155
+ handle: string;
156
+ }
157
+ /**
158
+ * Configuration for creating a response (for response.create event).
159
+ */
160
+ export interface RealtimeResponseConfig {
161
+ /**
162
+ * Override session instructions for this response.
163
+ */
164
+ instructions?: string;
165
+ /**
166
+ * Override tools for this response.
167
+ */
168
+ tools?: LanguageModelTool[];
169
+ /**
170
+ * Override modalities for this response.
171
+ */
172
+ modalities?: RealtimeModality[];
173
+ }
174
+ /**
175
+ * A realtime session as returned from the server.
176
+ */
177
+ export interface RealtimeSession {
178
+ /**
179
+ * Unique session identifier.
180
+ */
181
+ id: string;
182
+ /**
183
+ * Current session configuration.
184
+ */
185
+ config: RealtimeSessionConfig;
186
+ }
187
+ /**
188
+ * Error from a realtime session.
189
+ */
190
+ export interface RealtimeError {
191
+ /**
192
+ * Error code.
193
+ */
194
+ code: string;
195
+ /**
196
+ * Human-readable error message.
197
+ */
198
+ message: string;
199
+ /**
200
+ * Additional error details.
201
+ */
202
+ details?: Record<string, unknown>;
203
+ }
204
+ /**
205
+ * Token usage information for a response.
206
+ */
207
+ export interface RealtimeUsage {
208
+ /**
209
+ * Number of input tokens.
210
+ */
211
+ inputTokens?: number;
212
+ /**
213
+ * Number of output tokens.
214
+ */
215
+ outputTokens?: number;
216
+ /**
217
+ * Total number of tokens.
218
+ */
219
+ totalTokens?: number;
220
+ }
221
+ /**
222
+ * Status of a response.
223
+ */
224
+ export type ResponseStatus = "completed" | "interrupted" | "cancelled" | "failed";
225
+ /**
226
+ * Status of a realtime transport connection.
227
+ */
228
+ export type TransportStatus = "disconnected" | "connecting" | "connected" | "reconnecting" | "closed";
229
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/realtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;IAEtC;;OAEG;IACH,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAE7B;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,eAAe,CAAC,EAAE,qBAAqB,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,qBAA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AAe,GACvB,cAAc,GACd,YAAY,GACZ,WAAW,GACX,cAAc,GACd,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernl-sdk/protocol",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "Protocol specification for kernl",
5
5
  "keywords": [
6
6
  "kernl",
package/src/index.ts CHANGED
@@ -7,5 +7,6 @@
7
7
  export * from "./constants";
8
8
  export * from "./language-model";
9
9
  export * from "./embedding-model";
10
+ export * from "./realtime";
10
11
  export * from "./provider";
11
12
  export * from "./json";
@@ -0,0 +1,397 @@
1
+ import { SharedProviderMetadata } from "@/provider";
2
+ import { LanguageModelItem } from "@/language-model";
3
+ import {
4
+ RealtimeSession,
5
+ RealtimeSessionConfig,
6
+ RealtimeResponseConfig,
7
+ RealtimeError,
8
+ RealtimeUsage,
9
+ ResponseStatus,
10
+ } from "./types";
11
+
12
+ /**
13
+ * Base interface for all realtime events.
14
+ */
15
+ export interface RealtimeEventBase {
16
+ /**
17
+ * Unique identifier for this event.
18
+ */
19
+ id?: string;
20
+
21
+ /**
22
+ * Provider-specific metadata.
23
+ */
24
+ providerMetadata?: SharedProviderMetadata;
25
+ }
26
+
27
+ /**
28
+ * Union of all client → server events.
29
+ */
30
+ export type RealtimeClientEvent =
31
+ | SessionUpdateEvent
32
+ | ItemCreateEvent
33
+ | ItemDeleteEvent
34
+ | ItemTruncateEvent
35
+ | AudioInputAppendEvent
36
+ | AudioInputCommitEvent
37
+ | AudioInputClearEvent
38
+ | ActivityStartEvent
39
+ | ActivityEndEvent
40
+ | ResponseCreateEvent
41
+ | ResponseCancelEvent
42
+ | ToolResultEvent;
43
+
44
+ /**
45
+ * Union of all server → client events.
46
+ */
47
+ export type RealtimeServerEvent =
48
+ | SessionCreatedEvent
49
+ | SessionUpdatedEvent
50
+ | SessionErrorEvent
51
+ | ItemCreatedEvent
52
+ | ItemDeletedEvent
53
+ | ItemTruncatedEvent
54
+ | AudioInputCommittedEvent
55
+ | AudioInputClearedEvent
56
+ | SpeechStartedEvent
57
+ | SpeechStoppedEvent
58
+ | AudioOutputDeltaEvent
59
+ | AudioOutputDoneEvent
60
+ | TextOutputDeltaEvent
61
+ | TextOutputEvent
62
+ | TranscriptInputDeltaEvent
63
+ | TranscriptInputEvent
64
+ | TranscriptOutputDeltaEvent
65
+ | TranscriptOutputEvent
66
+ | ResponseCreatedEvent
67
+ | ResponseInterruptedEvent
68
+ | ResponseDoneEvent
69
+ | ToolStartEvent
70
+ | ToolDeltaEvent
71
+ | ToolCallEvent
72
+ | ToolCancelledEvent;
73
+
74
+ /**
75
+ * Client event to update session configuration.
76
+ */
77
+ export interface SessionUpdateEvent extends RealtimeEventBase {
78
+ readonly kind: "session.update";
79
+ config: RealtimeSessionConfig;
80
+ }
81
+
82
+ /**
83
+ * Client event to add an item to the conversation.
84
+ */
85
+ export interface ItemCreateEvent extends RealtimeEventBase {
86
+ readonly kind: "item.create";
87
+ item: LanguageModelItem;
88
+ previousItemId?: string;
89
+ }
90
+
91
+ /**
92
+ * Client event to delete an item from the conversation.
93
+ */
94
+ export interface ItemDeleteEvent extends RealtimeEventBase {
95
+ readonly kind: "item.delete";
96
+ itemId: string;
97
+ }
98
+
99
+ /**
100
+ * Client event to truncate assistant audio at a specific timestamp.
101
+ */
102
+ export interface ItemTruncateEvent extends RealtimeEventBase {
103
+ readonly kind: "item.truncate";
104
+ itemId: string;
105
+ audioEndMs: number;
106
+ }
107
+
108
+ /**
109
+ * Client event to append audio to the input buffer.
110
+ */
111
+ export interface AudioInputAppendEvent extends RealtimeEventBase {
112
+ readonly kind: "audio.input.append";
113
+ /**
114
+ * Base64-encoded audio data.
115
+ */
116
+ audio: string;
117
+ }
118
+
119
+ /**
120
+ * Client event to commit the audio input buffer as a user message.
121
+ */
122
+ export interface AudioInputCommitEvent extends RealtimeEventBase {
123
+ readonly kind: "audio.input.commit";
124
+ }
125
+
126
+ /**
127
+ * Client event to clear the audio input buffer.
128
+ */
129
+ export interface AudioInputClearEvent extends RealtimeEventBase {
130
+ readonly kind: "audio.input.clear";
131
+ }
132
+
133
+ /**
134
+ * Client event to signal start of user activity (manual VAD).
135
+ */
136
+ export interface ActivityStartEvent extends RealtimeEventBase {
137
+ readonly kind: "activity.start";
138
+ }
139
+
140
+ /**
141
+ * Client event to signal end of user activity (manual VAD).
142
+ */
143
+ export interface ActivityEndEvent extends RealtimeEventBase {
144
+ readonly kind: "activity.end";
145
+ }
146
+
147
+ /**
148
+ * Client event to trigger a model response.
149
+ */
150
+ export interface ResponseCreateEvent extends RealtimeEventBase {
151
+ readonly kind: "response.create";
152
+ config?: RealtimeResponseConfig;
153
+ }
154
+
155
+ /**
156
+ * Client event to cancel an in-progress response.
157
+ */
158
+ export interface ResponseCancelEvent extends RealtimeEventBase {
159
+ readonly kind: "response.cancel";
160
+ responseId?: string;
161
+ }
162
+
163
+ /**
164
+ * Server event indicating the session has been created.
165
+ */
166
+ export interface SessionCreatedEvent extends RealtimeEventBase {
167
+ readonly kind: "session.created";
168
+ session: RealtimeSession;
169
+ }
170
+
171
+ /**
172
+ * Server event indicating the session configuration has been updated.
173
+ */
174
+ export interface SessionUpdatedEvent extends RealtimeEventBase {
175
+ readonly kind: "session.updated";
176
+ session: RealtimeSession;
177
+ }
178
+
179
+ /**
180
+ * Server event indicating a session error.
181
+ */
182
+ export interface SessionErrorEvent extends RealtimeEventBase {
183
+ readonly kind: "session.error";
184
+ error: RealtimeError;
185
+ }
186
+
187
+ /**
188
+ * Server event indicating an item has been added to the conversation.
189
+ */
190
+ export interface ItemCreatedEvent extends RealtimeEventBase {
191
+ readonly kind: "item.created";
192
+ item: LanguageModelItem;
193
+ previousItemId?: string;
194
+ }
195
+
196
+ /**
197
+ * Server event indicating an item has been deleted.
198
+ */
199
+ export interface ItemDeletedEvent extends RealtimeEventBase {
200
+ readonly kind: "item.deleted";
201
+ itemId: string;
202
+ }
203
+
204
+ /**
205
+ * Server event indicating an item has been truncated.
206
+ */
207
+ export interface ItemTruncatedEvent extends RealtimeEventBase {
208
+ readonly kind: "item.truncated";
209
+ itemId: string;
210
+ audioEndMs: number;
211
+ }
212
+
213
+ /**
214
+ * Server event confirming the audio input buffer has been committed.
215
+ */
216
+ export interface AudioInputCommittedEvent extends RealtimeEventBase {
217
+ readonly kind: "audio.input.committed";
218
+ itemId: string;
219
+ }
220
+
221
+ /**
222
+ * Server event confirming the audio input buffer has been cleared.
223
+ */
224
+ export interface AudioInputClearedEvent extends RealtimeEventBase {
225
+ readonly kind: "audio.input.cleared";
226
+ }
227
+
228
+ /**
229
+ * Server event indicating speech has been detected (VAD).
230
+ */
231
+ export interface SpeechStartedEvent extends RealtimeEventBase {
232
+ readonly kind: "speech.started";
233
+ audioStartMs: number;
234
+ itemId: string;
235
+ }
236
+
237
+ /**
238
+ * Server event indicating speech has stopped (VAD).
239
+ */
240
+ export interface SpeechStoppedEvent extends RealtimeEventBase {
241
+ readonly kind: "speech.stopped";
242
+ audioEndMs: number;
243
+ itemId: string;
244
+ }
245
+
246
+ /**
247
+ * Server event containing an audio output chunk.
248
+ */
249
+ export interface AudioOutputDeltaEvent extends RealtimeEventBase {
250
+ readonly kind: "audio.output.delta";
251
+ responseId: string;
252
+ itemId: string;
253
+ /**
254
+ * Base64-encoded audio chunk.
255
+ */
256
+ audio: string;
257
+ }
258
+
259
+ /**
260
+ * Server event indicating audio output is complete.
261
+ */
262
+ export interface AudioOutputDoneEvent extends RealtimeEventBase {
263
+ readonly kind: "audio.output.done";
264
+ responseId: string;
265
+ itemId: string;
266
+ }
267
+
268
+ /**
269
+ * Server event containing a text output chunk.
270
+ */
271
+ export interface TextOutputDeltaEvent extends RealtimeEventBase {
272
+ readonly kind: "text.output.delta";
273
+ responseId: string;
274
+ itemId: string;
275
+ delta: string;
276
+ }
277
+
278
+ /**
279
+ * Server event containing the complete text output.
280
+ */
281
+ export interface TextOutputEvent extends RealtimeEventBase {
282
+ readonly kind: "text.output";
283
+ responseId: string;
284
+ itemId: string;
285
+ text: string;
286
+ }
287
+
288
+ /**
289
+ * Server event containing an input transcription chunk.
290
+ */
291
+ export interface TranscriptInputDeltaEvent extends RealtimeEventBase {
292
+ readonly kind: "transcript.input.delta";
293
+ itemId: string;
294
+ delta: string;
295
+ }
296
+
297
+ /**
298
+ * Server event containing the complete input transcription.
299
+ */
300
+ export interface TranscriptInputEvent extends RealtimeEventBase {
301
+ readonly kind: "transcript.input";
302
+ itemId: string;
303
+ text: string;
304
+ }
305
+
306
+ /**
307
+ * Server event containing an output transcription chunk.
308
+ */
309
+ export interface TranscriptOutputDeltaEvent extends RealtimeEventBase {
310
+ readonly kind: "transcript.output.delta";
311
+ responseId: string;
312
+ itemId: string;
313
+ delta: string;
314
+ }
315
+
316
+ /**
317
+ * Server event containing the complete output transcription.
318
+ */
319
+ export interface TranscriptOutputEvent extends RealtimeEventBase {
320
+ readonly kind: "transcript.output";
321
+ responseId: string;
322
+ itemId: string;
323
+ text: string;
324
+ }
325
+
326
+ /**
327
+ * Server event indicating a response has been created.
328
+ */
329
+ export interface ResponseCreatedEvent extends RealtimeEventBase {
330
+ readonly kind: "response.created";
331
+ responseId: string;
332
+ }
333
+
334
+ /**
335
+ * Server event indicating a response has been interrupted.
336
+ */
337
+ export interface ResponseInterruptedEvent extends RealtimeEventBase {
338
+ readonly kind: "response.interrupted";
339
+ responseId: string;
340
+ }
341
+
342
+ /**
343
+ * Server event indicating a response is complete.
344
+ */
345
+ export interface ResponseDoneEvent extends RealtimeEventBase {
346
+ readonly kind: "response.done";
347
+ responseId: string;
348
+ status: ResponseStatus;
349
+ usage?: RealtimeUsage;
350
+ }
351
+
352
+ /**
353
+ * Server event indicating a tool call has started.
354
+ */
355
+ export interface ToolStartEvent extends RealtimeEventBase {
356
+ readonly kind: "tool.start";
357
+ responseId: string;
358
+ callId: string;
359
+ toolId: string;
360
+ }
361
+
362
+ /**
363
+ * Server event containing a tool call arguments chunk.
364
+ */
365
+ export interface ToolDeltaEvent extends RealtimeEventBase {
366
+ readonly kind: "tool.delta";
367
+ callId: string;
368
+ delta: string;
369
+ }
370
+
371
+ /**
372
+ * Server event indicating the model wants to call a tool.
373
+ */
374
+ export interface ToolCallEvent extends RealtimeEventBase {
375
+ readonly kind: "tool.call";
376
+ callId: string;
377
+ toolId: string;
378
+ arguments: string;
379
+ }
380
+
381
+ /**
382
+ * Server event indicating a tool call has been cancelled.
383
+ */
384
+ export interface ToolCancelledEvent extends RealtimeEventBase {
385
+ readonly kind: "tool.cancelled";
386
+ callId: string;
387
+ }
388
+
389
+ /**
390
+ * Client event to submit a tool result.
391
+ */
392
+ export interface ToolResultEvent extends RealtimeEventBase {
393
+ readonly kind: "tool.result";
394
+ callId: string;
395
+ result?: string;
396
+ error?: string;
397
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./events";
3
+ export * from "./model";