@pipedog/openai 0.0.0-stage → 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.
@@ -0,0 +1,768 @@
1
+ type Dict = Record<string, any>;
2
+ /** Maximum number of startup `input` messages a session accepts. */
3
+ export declare const MAX_INPUT_ITEMS = 128;
4
+ /** One validation problem: where it is (wire keys) and what is wrong. */
5
+ export interface LiveModelValidationErrorDetail {
6
+ loc: (string | number)[];
7
+ msg: string;
8
+ }
9
+ /** Raised when data does not match a model, like pydantic's `ValidationError`. */
10
+ export declare class LiveModelValidationError extends Error {
11
+ name: string;
12
+ readonly title: string;
13
+ readonly details: LiveModelValidationErrorDetail[];
14
+ constructor(title: string, details: LiveModelValidationErrorDetail[]);
15
+ /** The list of problems (pydantic `ValidationError.errors()`). */
16
+ errors(): LiveModelValidationErrorDetail[];
17
+ }
18
+ /**
19
+ * Validates one value. `wire` is true when the value comes from wire data
20
+ * (`modelValidate`), where nested models use snake_case keys.
21
+ */
22
+ type Parser<T> = (value: unknown, wire: boolean) => T;
23
+ interface FieldSpec<T = unknown> {
24
+ parse: Parser<T>;
25
+ /** Factory for the default value; absent when the field is required. */
26
+ default?: () => T;
27
+ }
28
+ type FieldSpecs = Record<string, FieldSpec>;
29
+ /** Options for `modelDump()`. */
30
+ export interface ModelDumpOptions {
31
+ /** Leave out model fields whose value is `null`. */
32
+ excludeNone?: boolean;
33
+ }
34
+ /**
35
+ * Base class of the Live API models (pydantic `BaseModel`).
36
+ *
37
+ * Subclasses declare their fields with `declare` and describe them in the
38
+ * static `fields` table (parser and default). The constructor validates
39
+ * camelCase options; `modelValidate()` validates wire (snake_case) data;
40
+ * `modelDump()` produces wire data.
41
+ */
42
+ export declare abstract class LiveModel {
43
+ /** Field table: name, parser and default. */
44
+ static readonly fields: FieldSpecs;
45
+ /** What to do with unknown wire keys: drop them, or keep them in `modelExtra`. */
46
+ static readonly extra: "ignore" | "allow";
47
+ /** Unknown keys kept by models created with `extra = "allow"` (pydantic `model_extra`). */
48
+ modelExtra: Dict | null;
49
+ constructor(options?: object);
50
+ /**
51
+ * Validate wire data (snake_case keys) into a model (pydantic `model_validate`).
52
+ *
53
+ * @throws LiveModelValidationError If the data does not match the model.
54
+ */
55
+ static modelValidate<C extends abstract new (...args: any[]) => LiveModel>(this: C, data: unknown): InstanceType<C>;
56
+ /**
57
+ * The wire form of the model, with upstream's snake_case keys (pydantic
58
+ * `model_dump`). Nested models are dumped too.
59
+ */
60
+ modelDump(options?: ModelDumpOptions): Dict;
61
+ /** Serialize with the wire keys, as pydantic does. */
62
+ toJSON(): Dict;
63
+ }
64
+ export interface InputTextContentOptions {
65
+ type?: "input_text";
66
+ /** The text. */
67
+ text: string;
68
+ }
69
+ /**
70
+ * A text content part supplied by the client.
71
+ *
72
+ * - `type`: content type, always "input_text".
73
+ * - `text`: the text.
74
+ */
75
+ export declare class InputTextContent extends LiveModel {
76
+ static readonly fields: FieldSpecs;
77
+ type: "input_text";
78
+ text: string;
79
+ constructor(options: InputTextContentOptions);
80
+ }
81
+ export interface OutputTextContentOptions {
82
+ type?: "output_text";
83
+ /** The text. */
84
+ text: string;
85
+ }
86
+ /**
87
+ * A text content part attributed to the assistant.
88
+ *
89
+ * - `type`: content type, always "output_text".
90
+ * - `text`: the text.
91
+ */
92
+ export declare class OutputTextContent extends LiveModel {
93
+ static readonly fields: FieldSpecs;
94
+ type: "output_text";
95
+ text: string;
96
+ constructor(options: OutputTextContentOptions);
97
+ }
98
+ export interface InputItemOptions {
99
+ type?: "message";
100
+ /** Message role. */
101
+ role: "developer" | "user" | "assistant";
102
+ /** Exactly one text content part. */
103
+ content: (InputTextContent | OutputTextContent | InputTextContentOptions | OutputTextContentOptions)[];
104
+ }
105
+ /**
106
+ * A prior text-only conversation message seeded at session start.
107
+ *
108
+ * - `type`: item type, always "message".
109
+ * - `role`: message role. Developer and user messages carry `input_text`
110
+ * content; assistant messages carry `output_text`. A `system` role is not
111
+ * accepted here: application instructions belong in
112
+ * `SessionConfig.instructions` or a developer message.
113
+ * - `content`: exactly one text content part.
114
+ */
115
+ export declare class InputItem extends LiveModel {
116
+ static readonly fields: FieldSpecs;
117
+ type: "message";
118
+ role: "developer" | "user" | "assistant";
119
+ content: (InputTextContent | OutputTextContent)[];
120
+ constructor(options: InputItemOptions);
121
+ }
122
+ export interface AudioOutputConfigOptions {
123
+ /** Output voice name (defaults to `marin` server-side). */
124
+ voice?: string | null;
125
+ }
126
+ /**
127
+ * Output audio configuration.
128
+ *
129
+ * - `voice`: output voice name (defaults to `marin` server-side).
130
+ */
131
+ export declare class AudioOutputConfig extends LiveModel {
132
+ static readonly fields: FieldSpecs;
133
+ voice: string | null;
134
+ constructor(options?: AudioOutputConfigOptions);
135
+ }
136
+ export type AudioFormatType = "audio/pcm" | "audio/pcmu" | "audio/pcma";
137
+ export interface AudioFormatOptions {
138
+ /** `audio/pcm` (16 or 24 kHz PCM16), `audio/pcmu` or `audio/pcma` (8 kHz G.711). */
139
+ type?: AudioFormatType;
140
+ /** Sample rate in Hz. */
141
+ rate?: number;
142
+ }
143
+ /**
144
+ * WebSocket audio format, selected once at session start for input and output.
145
+ *
146
+ * - `type`: `audio/pcm` (16 or 24 kHz PCM16), `audio/pcmu` or `audio/pcma`
147
+ * (8 kHz G.711).
148
+ * - `rate`: sample rate in Hz.
149
+ */
150
+ export declare class AudioFormat extends LiveModel {
151
+ static readonly fields: FieldSpecs;
152
+ type: AudioFormatType;
153
+ rate: number;
154
+ constructor(options?: AudioFormatOptions);
155
+ }
156
+ export interface AudioConfigOptions {
157
+ /** Output audio configuration. */
158
+ output?: AudioOutputConfig | AudioOutputConfigOptions | null;
159
+ /** WebSocket audio format, shared by input and output. */
160
+ format?: AudioFormat | AudioFormatOptions | null;
161
+ }
162
+ /**
163
+ * Session audio configuration.
164
+ *
165
+ * - `output`: output audio configuration.
166
+ * - `format`: WebSocket audio format, shared by input and output.
167
+ */
168
+ export declare class AudioConfig extends LiveModel {
169
+ static readonly fields: FieldSpecs;
170
+ output: AudioOutputConfig | null;
171
+ format: AudioFormat | null;
172
+ constructor(options?: AudioConfigOptions);
173
+ }
174
+ export interface ClientDelegationConfigOptions {
175
+ type?: "client";
176
+ }
177
+ /**
178
+ * Delegation configuration selecting client delegation.
179
+ *
180
+ * - `type`: delegation type, always "client".
181
+ */
182
+ export declare class ClientDelegationConfig extends LiveModel {
183
+ static readonly fields: FieldSpecs;
184
+ type: "client";
185
+ constructor(options?: ClientDelegationConfigOptions);
186
+ }
187
+ export interface ResponsesDelegationConfigOptions {
188
+ type?: "responses";
189
+ /** Configuration of the backend Responses model. */
190
+ responses: Dict;
191
+ }
192
+ /**
193
+ * Delegation configuration selecting Responses delegation.
194
+ *
195
+ * - `type`: delegation type, always "responses".
196
+ * - `responses`: configuration of the backend Responses model: `model`,
197
+ * `instructions`, `tools`, `tool_choice`, `reasoning`,
198
+ * `max_output_tokens`, `service_tier`, and other Responses request fields
199
+ * the Live API accepts.
200
+ */
201
+ export declare class ResponsesDelegationConfig extends LiveModel {
202
+ static readonly fields: FieldSpecs;
203
+ type: "responses";
204
+ responses: Dict;
205
+ constructor(options: ResponsesDelegationConfigOptions);
206
+ }
207
+ export type DelegationConfig = ClientDelegationConfig | ResponsesDelegationConfig;
208
+ export interface SessionConfigOptions {
209
+ /** The live model. Required, and immutable after start. */
210
+ model: string;
211
+ /** Instructions for the live model. Immutable after start. */
212
+ instructions?: string | null;
213
+ /** Audio configuration. */
214
+ audio?: AudioConfig | AudioConfigOptions | null;
215
+ /** Delegation mode. Omitted selects client delegation. */
216
+ delegation?: DelegationConfig | ClientDelegationConfigOptions | ResponsesDelegationConfigOptions | null;
217
+ /** Prior text-only conversation messages. Startup-only. */
218
+ input?: (InputItem | InputItemOptions)[] | null;
219
+ /** Whether the server keeps the session for 30 days. Startup-only. */
220
+ store?: boolean | null;
221
+ }
222
+ /**
223
+ * Live session configuration, sent once with `session.start`.
224
+ *
225
+ * - `model`: the live model. Required, and immutable after start.
226
+ * - `instructions`: instructions for the live model. Immutable after start;
227
+ * `SessionInstructionsAppendEvent` adds more later.
228
+ * - `audio`: audio configuration. The output voice and format are immutable
229
+ * after start.
230
+ * - `delegation`: delegation mode. Omitted selects client delegation. The
231
+ * mode is immutable: switching needs a new session.
232
+ * - `input`: prior text-only conversation messages. Startup-only.
233
+ * - `store`: whether the server keeps the session for 30 days, as a
234
+ * downloadable recording and as a source for a fork. Startup-only; the
235
+ * server default is false.
236
+ */
237
+ export declare class SessionConfig extends LiveModel {
238
+ static readonly fields: FieldSpecs;
239
+ model: string;
240
+ instructions: string | null;
241
+ audio: AudioConfig | null;
242
+ delegation: DelegationConfig | null;
243
+ input: InputItem[] | null;
244
+ store: boolean | null;
245
+ constructor(options: SessionConfigOptions);
246
+ }
247
+ export interface SessionUpdateConfigOptions {
248
+ /** Replacement delegation settings, of the session's mode. */
249
+ delegation?: DelegationConfig | ClientDelegationConfigOptions | ResponsesDelegationConfigOptions | null;
250
+ }
251
+ /**
252
+ * The sparse session update a running session accepts.
253
+ *
254
+ * Only delegation settings can change, and only within the mode chosen at
255
+ * startup. Startup fields (`model`, `instructions`, `audio`, `input`) are not
256
+ * update fields.
257
+ *
258
+ * - `delegation`: replacement delegation settings, of the session's mode.
259
+ */
260
+ export declare class SessionUpdateConfig extends LiveModel {
261
+ static readonly fields: FieldSpecs;
262
+ delegation: DelegationConfig | null;
263
+ constructor(options?: SessionUpdateConfigOptions);
264
+ }
265
+ export interface ClientEventOptions {
266
+ /**
267
+ * Client-chosen identifier, echoed back as `client_event_id` on
268
+ * acknowledgments and errors.
269
+ */
270
+ eventId?: string;
271
+ }
272
+ /**
273
+ * Base class for events sent to the Live API.
274
+ *
275
+ * - `eventId`: client-chosen identifier, echoed back as `client_event_id` on
276
+ * acknowledgments and errors.
277
+ */
278
+ export declare class ClientEvent extends LiveModel {
279
+ static readonly fields: FieldSpecs;
280
+ eventId: string;
281
+ constructor(options?: ClientEventOptions);
282
+ /**
283
+ * Render the event as the JSON payload to send.
284
+ *
285
+ * Unset optional fields are omitted: the session schema is strict about
286
+ * unknown fields, and a `null` is not the same as an absent field.
287
+ *
288
+ * @returns The payload.
289
+ */
290
+ toPayload(): Dict;
291
+ }
292
+ export interface SessionStartEventOptions extends ClientEventOptions {
293
+ type?: "session.start";
294
+ /** The session configuration, including the model. */
295
+ session: SessionConfig | SessionConfigOptions;
296
+ }
297
+ /**
298
+ * Start the session. The first message on a WebSocket, sent exactly once.
299
+ *
300
+ * - `type`: event type, always "session.start".
301
+ * - `session`: the session configuration, including the model.
302
+ */
303
+ export declare class SessionStartEvent extends ClientEvent {
304
+ static readonly fields: FieldSpecs;
305
+ type: "session.start";
306
+ session: SessionConfig;
307
+ constructor(options: SessionStartEventOptions);
308
+ }
309
+ export interface SessionUpdateEventOptions extends ClientEventOptions {
310
+ type?: "session.update";
311
+ /** The sparse update. */
312
+ session: SessionUpdateConfig | SessionUpdateConfigOptions;
313
+ }
314
+ /**
315
+ * Apply a sparse update to a running session.
316
+ *
317
+ * - `type`: event type, always "session.update".
318
+ * - `session`: the sparse update.
319
+ */
320
+ export declare class SessionUpdateEvent extends ClientEvent {
321
+ static readonly fields: FieldSpecs;
322
+ type: "session.update";
323
+ session: SessionUpdateConfig;
324
+ constructor(options: SessionUpdateEventOptions);
325
+ }
326
+ export interface InputAudioAppendEventOptions extends ClientEventOptions {
327
+ type?: "session.input_audio.append";
328
+ /** Base64-encoded audio bytes. */
329
+ audio: string;
330
+ }
331
+ /**
332
+ * Append audio in the session's audio format. Not acknowledged.
333
+ *
334
+ * - `type`: event type, always "session.input_audio.append".
335
+ * - `audio`: base64-encoded audio bytes.
336
+ */
337
+ export declare class InputAudioAppendEvent extends ClientEvent {
338
+ static readonly fields: FieldSpecs;
339
+ type: "session.input_audio.append";
340
+ audio: string;
341
+ constructor(options: InputAudioAppendEventOptions);
342
+ }
343
+ export interface ContextAppendEventOptions extends ClientEventOptions {
344
+ /**
345
+ * The client delegation this content belongs to, or `null` for general
346
+ * session context. Always sent, including when it is `null`.
347
+ */
348
+ delegationId: string | null;
349
+ /** The text, at most 500 tokens. */
350
+ content: string;
351
+ }
352
+ /**
353
+ * Base class for the three context-append events.
354
+ *
355
+ * - `delegationId`: the client delegation this content belongs to, or `null`
356
+ * for general session context. Always sent, including when it is `null`.
357
+ * - `content`: the text, at most 500 tokens.
358
+ */
359
+ export declare class ContextAppendEvent extends ClientEvent {
360
+ static readonly fields: FieldSpecs;
361
+ delegationId: string | null;
362
+ content: string;
363
+ constructor(options: ContextAppendEventOptions);
364
+ /**
365
+ * Render the event, keeping `delegation_id` even when it is `null`.
366
+ *
367
+ * The field is required on these events, and `null` is meaningful: it marks
368
+ * the content as general session context rather than belonging to a
369
+ * delegation.
370
+ *
371
+ * @returns The payload.
372
+ */
373
+ toPayload(): Dict;
374
+ }
375
+ /**
376
+ * Append instructions the live model will follow, without replacing the
377
+ * startup ones.
378
+ *
379
+ * - `type`: event type, always "session.instructions.append".
380
+ */
381
+ export declare class SessionInstructionsAppendEvent extends ContextAppendEvent {
382
+ static readonly fields: FieldSpecs;
383
+ type: "session.instructions.append";
384
+ }
385
+ /**
386
+ * Append information to the live model's internal reasoning.
387
+ *
388
+ * The content is not spoken when appended, though the model can draw on it
389
+ * when a later user request makes it relevant. It is not a secrecy boundary.
390
+ *
391
+ * - `type`: event type, always "session.thinking.append".
392
+ */
393
+ export declare class SessionThinkingAppendEvent extends ContextAppendEvent {
394
+ static readonly fields: FieldSpecs;
395
+ type: "session.thinking.append";
396
+ }
397
+ /**
398
+ * Append information for the live model to speak aloud, in its own words.
399
+ *
400
+ * - `type`: event type, always "session.commentary.append".
401
+ */
402
+ export declare class SessionCommentaryAppendEvent extends ContextAppendEvent {
403
+ static readonly fields: FieldSpecs;
404
+ type: "session.commentary.append";
405
+ }
406
+ export interface FunctionCallOutputItemOptions {
407
+ type?: "function_call_output";
408
+ /** The `call_id` of the completed `function_call` item. */
409
+ callId: string;
410
+ /** The function output, as a string. */
411
+ output: string;
412
+ }
413
+ /**
414
+ * The result of a client-actionable function call from a Responses delegation.
415
+ *
416
+ * - `type`: item type, always "function_call_output".
417
+ * - `callId`: the `call_id` of the completed `function_call` item.
418
+ * - `output`: the function output, as a string.
419
+ */
420
+ export declare class FunctionCallOutputItem extends LiveModel {
421
+ static readonly fields: FieldSpecs;
422
+ type: "function_call_output";
423
+ callId: string;
424
+ output: string;
425
+ constructor(options: FunctionCallOutputItemOptions);
426
+ }
427
+ export interface ResponseItemCreateEventOptions extends ClientEventOptions {
428
+ type?: "response.item.create";
429
+ /** The input item, such as a function call output. */
430
+ item: FunctionCallOutputItem | Dict;
431
+ }
432
+ /**
433
+ * Queue an input item for the backend Responses model. Not acknowledged.
434
+ *
435
+ * Queueing an item does not start inference: `ResponseCreateEvent` does.
436
+ * Responses delegation only.
437
+ *
438
+ * - `type`: event type, always "response.item.create".
439
+ * - `item`: the input item, such as a function call output.
440
+ */
441
+ export declare class ResponseItemCreateEvent extends ClientEvent {
442
+ static readonly fields: FieldSpecs;
443
+ type: "response.item.create";
444
+ item: FunctionCallOutputItem | Dict;
445
+ constructor(options: ResponseItemCreateEventOptions);
446
+ }
447
+ export interface ResponseCreateEventOptions extends ClientEventOptions {
448
+ type?: "response.create";
449
+ }
450
+ /**
451
+ * Start or continue delegated Responses work. Responses delegation only.
452
+ *
453
+ * Every output required by the pending response must be queued first, or the
454
+ * command is rejected with `function_call_outputs_required`.
455
+ *
456
+ * - `type`: event type, always "response.create".
457
+ */
458
+ export declare class ResponseCreateEvent extends ClientEvent {
459
+ static readonly fields: FieldSpecs;
460
+ type: "response.create";
461
+ constructor(options?: ResponseCreateEventOptions);
462
+ }
463
+ export interface SessionCloseEventOptions extends ClientEventOptions {
464
+ type?: "session.close";
465
+ }
466
+ /**
467
+ * Request a graceful shutdown; the server answers with `session.closed`.
468
+ *
469
+ * - `type`: event type, always "session.close".
470
+ */
471
+ export declare class SessionCloseEvent extends ClientEvent {
472
+ static readonly fields: FieldSpecs;
473
+ type: "session.close";
474
+ constructor(options?: SessionCloseEventOptions);
475
+ }
476
+ /** Server event fields are read from wire data with `modelValidate()`. */
477
+ export type ServerEventOptions = Dict;
478
+ /**
479
+ * Base class for events received from the Live API.
480
+ *
481
+ * Unknown fields are retained (in `modelExtra`) so events keep parsing as the
482
+ * API grows.
483
+ *
484
+ * - `type`: the event type.
485
+ * - `eventId`: identifier of this server event.
486
+ * - `clientEventId`: the client event this one answers, when correlatable.
487
+ */
488
+ export declare class ServerEvent extends LiveModel {
489
+ static readonly extra: "allow";
490
+ static readonly fields: FieldSpecs;
491
+ type: string;
492
+ eventId: string | null;
493
+ clientEventId: string | null;
494
+ constructor(options: ServerEventOptions);
495
+ }
496
+ /**
497
+ * The resolved session, echoed by `session.started`, `session.updated` and
498
+ * `session.closed`.
499
+ *
500
+ * - `id`: session identifier. Opaque: forward it unchanged.
501
+ * - `expiresAt`: session expiry as a Unix timestamp in seconds.
502
+ * - `status`: session status.
503
+ * - `model`: the live model.
504
+ * - `instructions`: the startup instructions.
505
+ * - `audio`: audio configuration.
506
+ * - `delegation`: delegation configuration.
507
+ * - `input`: the startup conversation history.
508
+ * - `contextManagement`: long-session context handling.
509
+ */
510
+ export declare class SessionResource extends LiveModel {
511
+ static readonly extra: "allow";
512
+ static readonly fields: FieldSpecs;
513
+ id: string | null;
514
+ expiresAt: number | null;
515
+ status: string | null;
516
+ model: string | null;
517
+ instructions: string | null;
518
+ audio: Dict | null;
519
+ delegation: Dict | null;
520
+ input: Dict[] | null;
521
+ contextManagement: Dict | null;
522
+ constructor(options?: Dict);
523
+ }
524
+ /**
525
+ * The session is configured and ready for audio.
526
+ *
527
+ * - `type`: event type, always "session.started".
528
+ * - `session`: the resolved session.
529
+ */
530
+ export declare class SessionStartedEvent extends ServerEvent {
531
+ static readonly fields: FieldSpecs;
532
+ type: "session.started";
533
+ session: SessionResource;
534
+ }
535
+ /**
536
+ * A sparse `session.update` was applied.
537
+ *
538
+ * - `type`: event type, always "session.updated".
539
+ * - `session`: the complete resolved session, not just the changed fields.
540
+ */
541
+ export declare class SessionUpdatedEvent extends ServerEvent {
542
+ static readonly fields: FieldSpecs;
543
+ type: "session.updated";
544
+ session: SessionResource;
545
+ }
546
+ /**
547
+ * A chunk of output audio in the session's audio format.
548
+ *
549
+ * - `type`: event type, always "session.output_audio.delta".
550
+ * - `delta`: base64-encoded audio bytes.
551
+ */
552
+ export declare class OutputAudioDeltaEvent extends ServerEvent {
553
+ static readonly fields: FieldSpecs;
554
+ type: "session.output_audio.delta";
555
+ delta: string;
556
+ }
557
+ /**
558
+ * A timed transcript fragment of user or assistant speech.
559
+ *
560
+ * Fragments are frame-aligned, not word- or turn-aligned: accumulate them in
561
+ * order, and group them into turns in the application if it needs turns.
562
+ *
563
+ * - `type`: "session.input_transcript.delta" (the user) or
564
+ * "session.output_transcript.delta" (the assistant).
565
+ * - `delta`: the fragment text.
566
+ * - `startMs`: start of the fragment on the session timeline.
567
+ * - `endMs`: end of the fragment on the session timeline.
568
+ */
569
+ export declare class TranscriptDeltaEvent extends ServerEvent {
570
+ static readonly fields: FieldSpecs;
571
+ type: "session.input_transcript.delta" | "session.output_transcript.delta";
572
+ delta: string;
573
+ startMs: number | null;
574
+ endMs: number | null;
575
+ /** The speaker. */
576
+ get role(): "user" | "assistant";
577
+ }
578
+ /**
579
+ * A unit of work the live model delegated.
580
+ *
581
+ * The metadata carries no task text: a client delegator works out what to do
582
+ * from the conversation and application state it keeps itself.
583
+ *
584
+ * - `id`: delegation identifier, used to correlate returned context. Opaque:
585
+ * return it unchanged.
586
+ * - `type`: item type, always "delegation".
587
+ * - `target`: "client" or "responses".
588
+ * - `responseId`: for Responses delegations, the id of the Responses run.
589
+ */
590
+ export declare class DelegationMetadata extends LiveModel {
591
+ static readonly extra: "allow";
592
+ static readonly fields: FieldSpecs;
593
+ id: string;
594
+ type: string;
595
+ target: string;
596
+ responseId: string | null;
597
+ constructor(options: Dict);
598
+ }
599
+ /**
600
+ * The live model created a delegation.
601
+ *
602
+ * - `type`: event type, always "session.delegation.created".
603
+ * - `offsetMs`: position on the session timeline.
604
+ * - `delegation`: the delegation metadata.
605
+ */
606
+ export declare class SessionDelegationCreatedEvent extends ServerEvent {
607
+ static readonly fields: FieldSpecs;
608
+ type: "session.delegation.created";
609
+ offsetMs: number | null;
610
+ delegation: DelegationMetadata;
611
+ }
612
+ /**
613
+ * An output item of a Responses delegation.
614
+ *
615
+ * - `id`: item identifier.
616
+ * - `type`: item type, e.g. "function_call" or "message".
617
+ * - `status`: item status, e.g. "completed".
618
+ * - `callId`: for function calls, the call identifier to answer with.
619
+ * - `name`: for function calls, the function name.
620
+ * - `arguments`: for function calls, the JSON-encoded arguments.
621
+ */
622
+ export declare class ResponseOutputItem extends LiveModel {
623
+ static readonly extra: "allow";
624
+ static readonly fields: FieldSpecs;
625
+ id: string | null;
626
+ type: string | null;
627
+ status: string | null;
628
+ callId: string | null;
629
+ name: string | null;
630
+ arguments: string | null;
631
+ constructor(options?: Dict);
632
+ }
633
+ /**
634
+ * A Responses lifecycle event, wrapped with the delegation it belongs to.
635
+ *
636
+ * The nested event keeps its Responses meaning and is dispatched by its own
637
+ * complete `type`. Lifecycle snapshots inside are reduced — `output` is an
638
+ * empty array even at `response.completed` — so collect output items from
639
+ * their individual events rather than from a snapshot.
640
+ *
641
+ * - `type`: event type, always "response.event".
642
+ * - `delegationId`: the delegation this response belongs to, when known.
643
+ * - `event`: the nested Responses event.
644
+ */
645
+ export declare class ResponseEventEnvelope extends ServerEvent {
646
+ static readonly fields: FieldSpecs;
647
+ type: "response.event";
648
+ delegationId: string | null;
649
+ event: Dict;
650
+ /** The nested Responses event's type, or `""` if it has none. */
651
+ get innerType(): string;
652
+ }
653
+ /**
654
+ * Appended context was accepted and placed on the session timeline.
655
+ *
656
+ * Acceptance is not proof the model has spoken the content.
657
+ *
658
+ * - `type`: "session.instructions.appended", "session.thinking.appended" or
659
+ * "session.commentary.appended".
660
+ * - `startMs`: start of the accepted range.
661
+ * - `endMs`: end of the accepted range.
662
+ */
663
+ export declare class ContextAppendedEvent extends ServerEvent {
664
+ static readonly fields: FieldSpecs;
665
+ type: "session.instructions.appended" | "session.thinking.appended" | "session.commentary.appended";
666
+ startMs: number | null;
667
+ endMs: number | null;
668
+ }
669
+ /**
670
+ * Context utilization, when reported.
671
+ *
672
+ * - `usageRatio`: fraction of the context window in use.
673
+ */
674
+ export declare class ContextWindowUsage extends LiveModel {
675
+ static readonly extra: "allow";
676
+ static readonly fields: FieldSpecs;
677
+ usageRatio: number | null;
678
+ constructor(options?: Dict);
679
+ }
680
+ /**
681
+ * Cumulative live session usage.
682
+ *
683
+ * Backend token usage is not here: it belongs to the wrapped Responses
684
+ * lifecycle, on the nested `response.completed` event.
685
+ *
686
+ * - `seconds`: cumulative live audio duration in seconds.
687
+ */
688
+ export declare class Usage extends LiveModel {
689
+ static readonly extra: "allow";
690
+ static readonly fields: FieldSpecs;
691
+ seconds: number | null;
692
+ constructor(options?: Dict);
693
+ }
694
+ /**
695
+ * Periodic cumulative usage report.
696
+ *
697
+ * - `type`: event type, always "session.usage.updated".
698
+ * - `usage`: cumulative usage, not an increment to sum.
699
+ * - `contextWindow`: context utilization, when reported.
700
+ */
701
+ export declare class SessionUsageUpdatedEvent extends ServerEvent {
702
+ static readonly fields: FieldSpecs;
703
+ type: "session.usage.updated";
704
+ usage: Usage;
705
+ contextWindow: ContextWindowUsage | null;
706
+ }
707
+ /**
708
+ * Graceful shutdown completed. Transport closure alone is not finalization.
709
+ *
710
+ * - `type`: event type, always "session.closed".
711
+ * - `reason`: why the session closed.
712
+ * - `session`: the session snapshot, as configuration rather than a live
713
+ * session.
714
+ * - `usage`: final cumulative usage.
715
+ */
716
+ export declare class SessionClosedEvent extends ServerEvent {
717
+ static readonly fields: FieldSpecs;
718
+ type: "session.closed";
719
+ reason: string | null;
720
+ session: SessionResource | null;
721
+ usage: Usage | null;
722
+ }
723
+ /**
724
+ * The error envelope shared by Live API and normalized Responses errors.
725
+ *
726
+ * - `type`: error type, e.g. "invalid_request_error".
727
+ * - `code`: error code.
728
+ * - `message`: human-readable message.
729
+ * - `param`: the offending field, when one caused the failure.
730
+ * - `clientEventId`: the client event the error correlates to, when known.
731
+ */
732
+ export declare class ErrorDetails extends LiveModel {
733
+ static readonly extra: "allow";
734
+ static readonly fields: FieldSpecs;
735
+ type: string | null;
736
+ code: string | null;
737
+ message: string | null;
738
+ param: string | null;
739
+ clientEventId: string | null;
740
+ constructor(options?: Dict);
741
+ }
742
+ /**
743
+ * A startup, validation, command or delegated-Responses error.
744
+ *
745
+ * - `type`: event type, always "error".
746
+ * - `error`: the error details.
747
+ */
748
+ export declare class ErrorEvent extends ServerEvent {
749
+ static readonly fields: FieldSpecs;
750
+ type: "error";
751
+ error: ErrorDetails;
752
+ }
753
+ /** A server event this module doesn't model; its fields are retained as extras. */
754
+ export declare class UnknownServerEvent extends ServerEvent {
755
+ }
756
+ /**
757
+ * Parse a server event from its JSON text.
758
+ *
759
+ * Event types this module doesn't model become `UnknownServerEvent`.
760
+ *
761
+ * @param message The JSON text of one server event, as a string or UTF-8 bytes.
762
+ * @returns The parsed event.
763
+ * @throws Error If the text isn't a JSON object with a string `type`, or a
764
+ * modeled event fails validation (upstream: ValueError).
765
+ */
766
+ export declare function parseServerEvent(message: string | Uint8Array): ServerEvent;
767
+ export {};
768
+ //# sourceMappingURL=events.d.ts.map