@glexir/sdk 0.0.0-stage → 0.2.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 (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +292 -2
  3. package/dist/client.d.ts +61 -0
  4. package/dist/client.js +245 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/core/api-promise.d.ts +31 -0
  7. package/dist/core/api-promise.js +39 -0
  8. package/dist/core/api-promise.js.map +1 -0
  9. package/dist/core/errors.d.ts +70 -0
  10. package/dist/core/errors.js +118 -0
  11. package/dist/core/errors.js.map +1 -0
  12. package/dist/core/multipart.d.ts +16 -0
  13. package/dist/core/multipart.js +68 -0
  14. package/dist/core/multipart.js.map +1 -0
  15. package/dist/core/pagination.d.ts +41 -0
  16. package/dist/core/pagination.js +63 -0
  17. package/dist/core/pagination.js.map +1 -0
  18. package/dist/core/request-options.d.ts +29 -0
  19. package/dist/core/request-options.js +2 -0
  20. package/dist/core/request-options.js.map +1 -0
  21. package/dist/core/resource.d.ts +5 -0
  22. package/dist/core/resource.js +7 -0
  23. package/dist/core/resource.js.map +1 -0
  24. package/dist/core/retry.d.ts +13 -0
  25. package/dist/core/retry.js +65 -0
  26. package/dist/core/retry.js.map +1 -0
  27. package/dist/core/streaming.d.ts +44 -0
  28. package/dist/core/streaming.js +238 -0
  29. package/dist/core/streaming.js.map +1 -0
  30. package/dist/index.d.ts +20 -0
  31. package/dist/index.js +12 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/lib/chat-completion-stream.d.ts +26 -0
  34. package/dist/lib/chat-completion-stream.js +161 -0
  35. package/dist/lib/chat-completion-stream.js.map +1 -0
  36. package/dist/lib/output-text.d.ts +4 -0
  37. package/dist/lib/output-text.js +22 -0
  38. package/dist/lib/output-text.js.map +1 -0
  39. package/dist/lib/response-stream.d.ts +30 -0
  40. package/dist/lib/response-stream.js +122 -0
  41. package/dist/lib/response-stream.js.map +1 -0
  42. package/dist/lib/strict-schema.d.ts +11 -0
  43. package/dist/lib/strict-schema.js +116 -0
  44. package/dist/lib/strict-schema.js.map +1 -0
  45. package/dist/resources/audio.d.ts +46 -0
  46. package/dist/resources/audio.js +24 -0
  47. package/dist/resources/audio.js.map +1 -0
  48. package/dist/resources/batches.d.ts +20 -0
  49. package/dist/resources/batches.js +24 -0
  50. package/dist/resources/batches.js.map +1 -0
  51. package/dist/resources/chat.d.ts +63 -0
  52. package/dist/resources/chat.js +79 -0
  53. package/dist/resources/chat.js.map +1 -0
  54. package/dist/resources/conversations.d.ts +23 -0
  55. package/dist/resources/conversations.js +38 -0
  56. package/dist/resources/conversations.js.map +1 -0
  57. package/dist/resources/embeddings.d.ts +12 -0
  58. package/dist/resources/embeddings.js +34 -0
  59. package/dist/resources/embeddings.js.map +1 -0
  60. package/dist/resources/files.d.ts +15 -0
  61. package/dist/resources/files.js +27 -0
  62. package/dist/resources/files.js.map +1 -0
  63. package/dist/resources/models.d.ts +10 -0
  64. package/dist/resources/models.js +11 -0
  65. package/dist/resources/models.js.map +1 -0
  66. package/dist/resources/responses.d.ts +61 -0
  67. package/dist/resources/responses.js +85 -0
  68. package/dist/resources/responses.js.map +1 -0
  69. package/dist/types/audio.d.ts +172 -0
  70. package/dist/types/audio.js +2 -0
  71. package/dist/types/audio.js.map +1 -0
  72. package/dist/types/chat.d.ts +316 -0
  73. package/dist/types/chat.js +2 -0
  74. package/dist/types/chat.js.map +1 -0
  75. package/dist/types/conversations.d.ts +46 -0
  76. package/dist/types/conversations.js +2 -0
  77. package/dist/types/conversations.js.map +1 -0
  78. package/dist/types/platform.d.ts +151 -0
  79. package/dist/types/platform.js +2 -0
  80. package/dist/types/platform.js.map +1 -0
  81. package/dist/types/responses.d.ts +640 -0
  82. package/dist/types/responses.js +2 -0
  83. package/dist/types/responses.js.map +1 -0
  84. package/dist/types/shared.d.ts +108 -0
  85. package/dist/types/shared.js +2 -0
  86. package/dist/types/shared.js.map +1 -0
  87. package/dist/version.d.ts +1 -0
  88. package/dist/version.js +2 -0
  89. package/dist/version.js.map +1 -0
  90. package/package.json +37 -3
@@ -0,0 +1,640 @@
1
+ import type { CustomToolInputFormat, ErrorObject, Metadata, ModerationConfig, ModerationResult, ModerationError, PromptCacheBreakpoint, ReasoningEffort, ResponsesModel, ServiceTier, Verbosity } from './shared.js';
2
+ export interface ResponseInputText {
3
+ type: 'input_text';
4
+ text: string;
5
+ prompt_cache_breakpoint?: PromptCacheBreakpoint;
6
+ }
7
+ /** Image input (vision). Pass a URL or a `data:` URL. */
8
+ export interface ResponseInputImage {
9
+ type: 'input_image';
10
+ detail: 'low' | 'high' | 'auto' | 'original';
11
+ image_url?: string | null;
12
+ /** A file uploaded through `client.files` with purpose `user_data` or `vision`. */
13
+ file_id?: string | null;
14
+ prompt_cache_breakpoint?: PromptCacheBreakpoint;
15
+ }
16
+ /** File input such as a PDF: a URL, base64 `file_data`, or an uploaded `file_id`. */
17
+ export interface ResponseInputFile {
18
+ type: 'input_file';
19
+ detail?: 'auto' | 'low' | 'high';
20
+ file_data?: string;
21
+ file_id?: string | null;
22
+ file_url?: string;
23
+ filename?: string;
24
+ prompt_cache_breakpoint?: PromptCacheBreakpoint;
25
+ }
26
+ export type ResponseInputContent = ResponseInputText | ResponseInputImage | ResponseInputFile;
27
+ export interface FileCitation {
28
+ type: 'file_citation';
29
+ file_id: string;
30
+ filename: string;
31
+ index: number;
32
+ }
33
+ export interface URLCitation {
34
+ type: 'url_citation';
35
+ url: string;
36
+ title: string;
37
+ start_index: number;
38
+ end_index: number;
39
+ }
40
+ export interface ContainerFileCitation {
41
+ type: 'container_file_citation';
42
+ container_id: string;
43
+ file_id: string;
44
+ filename: string;
45
+ start_index: number;
46
+ end_index: number;
47
+ }
48
+ export interface FilePath {
49
+ type: 'file_path';
50
+ file_id: string;
51
+ index: number;
52
+ }
53
+ export type Annotation = FileCitation | URLCitation | ContainerFileCitation | FilePath;
54
+ export interface Logprob {
55
+ token: string;
56
+ bytes: number[];
57
+ logprob: number;
58
+ top_logprobs: Array<{
59
+ token: string;
60
+ bytes: number[];
61
+ logprob: number;
62
+ }>;
63
+ }
64
+ export interface ResponseOutputText {
65
+ type: 'output_text';
66
+ text: string;
67
+ annotations: Annotation[];
68
+ logprobs?: Logprob[];
69
+ }
70
+ export interface ResponseOutputRefusal {
71
+ type: 'refusal';
72
+ refusal: string;
73
+ }
74
+ export type MessagePhase = 'commentary' | 'final_answer';
75
+ /** The simplest way to write a message: `{ role: "user", content: "Hi" }`. */
76
+ export interface EasyInputMessage {
77
+ role: 'user' | 'assistant' | 'system' | 'developer';
78
+ content: string | ResponseInputContent[];
79
+ /** Preserve this on assistant messages you replay (gpt-5.3+ use it). */
80
+ phase?: MessagePhase | null;
81
+ type?: 'message';
82
+ }
83
+ export interface ResponseInputMessage {
84
+ type?: 'message';
85
+ role: 'user' | 'system' | 'developer';
86
+ content: ResponseInputContent[];
87
+ status?: 'in_progress' | 'completed' | 'incomplete';
88
+ }
89
+ export interface ResponseOutputMessage {
90
+ type: 'message';
91
+ id: string;
92
+ role: 'assistant';
93
+ status: 'in_progress' | 'completed' | 'incomplete';
94
+ content: Array<ResponseOutputText | ResponseOutputRefusal>;
95
+ phase?: MessagePhase | null;
96
+ }
97
+ export interface ResponseReasoningItem {
98
+ type: 'reasoning';
99
+ id: string;
100
+ summary: Array<{
101
+ type: 'summary_text';
102
+ text: string;
103
+ }>;
104
+ content?: Array<{
105
+ type: 'reasoning_text';
106
+ text: string;
107
+ }>;
108
+ /**
109
+ * Opaque reasoning state, returned by default. Replay the item unchanged in stateless
110
+ * (`store: false`) conversations; it is only valid on the account that produced it.
111
+ */
112
+ encrypted_content?: string | null;
113
+ status?: 'in_progress' | 'completed' | 'incomplete';
114
+ }
115
+ export type ToolCaller = {
116
+ type: 'direct';
117
+ } | {
118
+ type: 'program';
119
+ caller_id: string;
120
+ };
121
+ export interface ResponseFunctionToolCall {
122
+ type: 'function_call';
123
+ call_id: string;
124
+ name: string;
125
+ /** JSON-encoded arguments. */
126
+ arguments: string;
127
+ id?: string;
128
+ namespace?: string;
129
+ async?: boolean;
130
+ caller?: ToolCaller | null;
131
+ status?: 'in_progress' | 'completed' | 'incomplete';
132
+ }
133
+ export interface ResponseFunctionCallOutput {
134
+ type: 'function_call_output';
135
+ call_id: string;
136
+ /** A string, or multimodal content (text, images, files). */
137
+ output: string | ResponseInputContent[];
138
+ id?: string | null;
139
+ name?: string;
140
+ namespace?: string;
141
+ caller?: ToolCaller | null;
142
+ status?: 'in_progress' | 'completed' | 'incomplete' | null;
143
+ }
144
+ export interface ResponseCustomToolCall {
145
+ type: 'custom_tool_call';
146
+ call_id: string;
147
+ name: string;
148
+ /** Free-form input produced by the model (matches the tool's grammar if one is set). */
149
+ input: string;
150
+ id?: string;
151
+ namespace?: string;
152
+ async?: boolean;
153
+ caller?: ToolCaller | null;
154
+ }
155
+ export interface ResponseCustomToolCallOutput {
156
+ type: 'custom_tool_call_output';
157
+ call_id: string;
158
+ output: string | ResponseInputContent[];
159
+ id?: string;
160
+ }
161
+ /** Compacted conversation context. Opaque; replay it unchanged. */
162
+ export interface ResponseCompactionItem {
163
+ type: 'compaction';
164
+ encrypted_content: string;
165
+ id?: string;
166
+ created_by?: string;
167
+ }
168
+ /** Asks the model to compact the context now. Must be the final input item. */
169
+ export interface ResponseCompactionTrigger {
170
+ type: 'compaction_trigger';
171
+ id?: string;
172
+ }
173
+ /** References a stored item by ID (only with server-side state). */
174
+ export interface ResponseItemReference {
175
+ type?: 'item_reference' | null;
176
+ id: string;
177
+ }
178
+ /** Changes the reasoning effort for subsequent turns mid-conversation. */
179
+ export interface ResponseConfigurationUpdate {
180
+ type: 'configuration_update';
181
+ reasoning?: {
182
+ effort?: ReasoningEffort;
183
+ };
184
+ id?: string;
185
+ }
186
+ export type ResponseInputItem = EasyInputMessage | ResponseInputMessage | ResponseOutputMessage | ResponseReasoningItem | ResponseFunctionToolCall | ResponseFunctionCallOutput | ResponseCustomToolCall | ResponseCustomToolCallOutput | ResponseCompactionItem | ResponseCompactionTrigger | ResponseItemReference | ResponseConfigurationUpdate;
187
+ export type ResponseInput = string | ResponseInputItem[];
188
+ export type ResponseOutputItem = ResponseOutputMessage | ResponseReasoningItem | ResponseFunctionToolCall | ResponseFunctionCallOutput | ResponseCustomToolCall | ResponseCustomToolCallOutput | ResponseCompactionItem;
189
+ /** A persisted item, as returned by `responses.inputItems.list()` and conversation item endpoints. */
190
+ export type ResponseItem = (ResponseInputMessage & {
191
+ id: string;
192
+ status?: 'in_progress' | 'completed' | 'incomplete';
193
+ }) | ResponseOutputMessage | ResponseReasoningItem | (ResponseFunctionToolCall & {
194
+ id: string;
195
+ }) | (ResponseFunctionCallOutput & {
196
+ id: string;
197
+ }) | ResponseCustomToolCall | ResponseCustomToolCallOutput | ResponseCompactionItem;
198
+ /**
199
+ * A function the model can call; your code runs it. Glexir supports function, custom and
200
+ * namespace tools only. OpenAI-hosted tools (web search, file search, code interpreter,
201
+ * MCP, image generation, shell, computer use) are rejected by the gateway.
202
+ */
203
+ export interface FunctionTool {
204
+ type: 'function';
205
+ name: string;
206
+ description?: string | null;
207
+ /** JSON Schema for the arguments. */
208
+ parameters?: Record<string, unknown> | null;
209
+ /** Enforce the schema exactly. Omitted means best-effort strict. */
210
+ strict?: boolean | null;
211
+ output_schema?: Record<string, unknown> | null;
212
+ defer_loading?: boolean;
213
+ async?: boolean;
214
+ }
215
+ /** A tool that takes free-form text input, optionally constrained by a grammar. */
216
+ export interface CustomTool {
217
+ type: 'custom';
218
+ name: string;
219
+ description?: string;
220
+ format?: CustomToolInputFormat;
221
+ defer_loading?: boolean;
222
+ async?: boolean;
223
+ }
224
+ /** Groups related tools; calls carry the `namespace`. */
225
+ export interface NamespaceTool {
226
+ type: 'namespace';
227
+ name: string;
228
+ description: string;
229
+ tools: Array<Omit<FunctionTool, 'type'> & {
230
+ type: 'function';
231
+ } | CustomTool>;
232
+ }
233
+ export type Tool = FunctionTool | CustomTool | NamespaceTool;
234
+ export type ToolChoice = 'none' | 'auto' | 'required' | {
235
+ type: 'function';
236
+ name: string;
237
+ } | {
238
+ type: 'custom';
239
+ name: string;
240
+ } | {
241
+ type: 'allowed_tools';
242
+ mode: 'auto' | 'required';
243
+ tools: Array<Record<string, unknown>>;
244
+ };
245
+ export interface ResponseFormatTextJSONSchemaConfig {
246
+ type: 'json_schema';
247
+ /** a-z, A-Z, 0-9, underscores and dashes; max 64 characters. */
248
+ name: string;
249
+ schema: Record<string, unknown>;
250
+ description?: string;
251
+ strict?: boolean | null;
252
+ }
253
+ export type ResponseFormatTextConfig = {
254
+ type: 'text';
255
+ } | {
256
+ type: 'json_object';
257
+ } | ResponseFormatTextJSONSchemaConfig;
258
+ export interface ResponseTextConfig {
259
+ format?: ResponseFormatTextConfig;
260
+ verbosity?: Verbosity | null;
261
+ }
262
+ export interface Reasoning {
263
+ effort?: ReasoningEffort | null;
264
+ summary?: 'auto' | 'concise' | 'detailed' | null;
265
+ /** How much prior reasoning the model sees (gpt-5.6 defaults to `all_turns`). */
266
+ context?: 'auto' | 'current_turn' | 'all_turns' | null;
267
+ mode?: 'standard' | 'pro' | (string & {}) | null;
268
+ }
269
+ export type ResponseIncludable = 'reasoning.encrypted_content' | 'message.output_text.logprobs' | 'message.input_image.image_url' | (string & {});
270
+ export interface ResponsePromptCacheOptions {
271
+ mode?: 'implicit' | 'explicit';
272
+ ttl?: '30m' | (string & {});
273
+ prewarm?: boolean;
274
+ comparison_response_id?: string;
275
+ }
276
+ export interface ContextManagement {
277
+ type: 'compaction';
278
+ /** Auto-compact when the rendered context exceeds this many tokens. */
279
+ compact_threshold?: number;
280
+ }
281
+ export interface ResponseCreateParamsBase {
282
+ model: ResponsesModel;
283
+ input?: ResponseInput;
284
+ /** System/developer instructions. Not carried over by `previous_response_id`; resend each turn. */
285
+ instructions?: string | null;
286
+ /** Continue from a stored response. Cannot be combined with `conversation`. */
287
+ previous_response_id?: string | null;
288
+ /** Conversation whose items are prepended and appended to automatically. */
289
+ conversation?: string | {
290
+ id: string;
291
+ } | null;
292
+ /** Store the response for later retrieval. Glexir defaults this to `false`. */
293
+ store?: boolean | null;
294
+ /** Run asynchronously; poll with `retrieve` or stream with `stream: true`. */
295
+ background?: boolean | null;
296
+ include?: ResponseIncludable[] | null;
297
+ reasoning?: Reasoning | null;
298
+ text?: ResponseTextConfig;
299
+ tools?: Tool[];
300
+ tool_choice?: ToolChoice;
301
+ parallel_tool_calls?: boolean | null;
302
+ /** Includes reasoning tokens. */
303
+ max_output_tokens?: number | null;
304
+ max_tool_calls?: number | null;
305
+ metadata?: Metadata | null;
306
+ temperature?: number | null;
307
+ top_p?: number | null;
308
+ /** 0–20; requires `include: ["message.output_text.logprobs"]`. */
309
+ top_logprobs?: number | null;
310
+ service_tier?: ServiceTier | null;
311
+ prompt?: {
312
+ id: string;
313
+ version?: string | null;
314
+ variables?: Record<string, string | ResponseInputContent> | null;
315
+ } | null;
316
+ prompt_cache_key?: string;
317
+ prompt_cache_options?: ResponsePromptCacheOptions | null;
318
+ /** @deprecated Use `prompt_cache_options.ttl`. */
319
+ prompt_cache_retention?: 'in_memory' | '24h' | null;
320
+ context_management?: ContextManagement[] | null;
321
+ /** @deprecated Use `context_management`. */
322
+ truncation?: 'auto' | 'disabled' | null;
323
+ moderation?: ModerationConfig | null;
324
+ /** Stable hashed end-user ID used for abuse detection. Glexir sets one per API key if omitted. */
325
+ safety_identifier?: string;
326
+ stream_options?: {
327
+ include_obfuscation?: boolean;
328
+ } | null;
329
+ /** @deprecated Use `safety_identifier` and `prompt_cache_key`. */
330
+ user?: string;
331
+ /** Unknown fields are forwarded unchanged, so new API parameters work before the SDK types catch up. */
332
+ [key: string]: unknown;
333
+ }
334
+ export interface ResponseCreateParamsNonStreaming extends ResponseCreateParamsBase {
335
+ stream?: false | null;
336
+ }
337
+ export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase {
338
+ stream: true;
339
+ }
340
+ export type ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCreateParamsStreaming;
341
+ export interface ResponseRetrieveParams {
342
+ include?: ResponseIncludable[];
343
+ include_obfuscation?: boolean;
344
+ /** With `stream: true`, replay events after this sequence number (background responses only). */
345
+ starting_after?: number;
346
+ }
347
+ export interface InputItemListParams {
348
+ after?: string;
349
+ limit?: number;
350
+ order?: 'asc' | 'desc';
351
+ include?: ResponseIncludable[];
352
+ }
353
+ export interface InputTokenCountParams {
354
+ model?: ResponsesModel | null;
355
+ input?: ResponseInput | null;
356
+ instructions?: string | null;
357
+ previous_response_id?: string | null;
358
+ conversation?: string | {
359
+ id: string;
360
+ } | null;
361
+ reasoning?: Reasoning | null;
362
+ text?: ResponseTextConfig | null;
363
+ tools?: Tool[] | null;
364
+ tool_choice?: ToolChoice | null;
365
+ parallel_tool_calls?: boolean | null;
366
+ truncation?: 'auto' | 'disabled';
367
+ [key: string]: unknown;
368
+ }
369
+ export interface InputTokenCountResponse {
370
+ object: 'response.input_tokens';
371
+ input_tokens: number;
372
+ }
373
+ export interface ResponseCompactParams {
374
+ model: ResponsesModel | null;
375
+ input?: ResponseInput | null;
376
+ instructions?: string | null;
377
+ previous_response_id?: string | null;
378
+ prompt_cache_key?: string | null;
379
+ prompt_cache_options?: {
380
+ mode?: 'implicit' | 'explicit';
381
+ ttl?: string;
382
+ } | null;
383
+ service_tier?: ServiceTier | null;
384
+ [key: string]: unknown;
385
+ }
386
+ export interface CompactedResponse {
387
+ id: string;
388
+ object: 'response.compaction';
389
+ created_at: number;
390
+ output: ResponseOutputItem[];
391
+ usage: ResponseUsage;
392
+ }
393
+ export type ResponseStatus = 'queued' | 'in_progress' | 'completed' | 'incomplete' | 'failed' | 'cancelled';
394
+ export interface ResponseUsage {
395
+ input_tokens: number;
396
+ input_tokens_details: {
397
+ cached_tokens: number;
398
+ /** Tokens written to the prompt cache (billed at a premium on gpt-5.6+). */
399
+ cache_write_tokens?: number;
400
+ [key: string]: unknown;
401
+ };
402
+ output_tokens: number;
403
+ output_tokens_details: {
404
+ reasoning_tokens: number;
405
+ [key: string]: unknown;
406
+ };
407
+ total_tokens: number;
408
+ }
409
+ export interface ResponseError {
410
+ code: string;
411
+ message: string;
412
+ [key: string]: unknown;
413
+ }
414
+ export interface Response {
415
+ id: string;
416
+ object: 'response';
417
+ created_at: number;
418
+ model: string;
419
+ status?: ResponseStatus;
420
+ output: ResponseOutputItem[];
421
+ /**
422
+ * Concatenated text of every `output_text` part. Computed by the SDK; not sent by the API.
423
+ */
424
+ output_text: string;
425
+ error: ResponseError | null;
426
+ incomplete_details: {
427
+ reason?: 'max_output_tokens' | 'max_messages' | 'content_filter' | 'steered' | (string & {});
428
+ } | null;
429
+ instructions: string | ResponseInputItem[] | null;
430
+ metadata: Metadata | null;
431
+ parallel_tool_calls: boolean;
432
+ temperature: number | null;
433
+ top_p: number | null;
434
+ tool_choice: ToolChoice;
435
+ tools: Tool[];
436
+ background?: boolean | null;
437
+ completed_at?: number | null;
438
+ conversation?: {
439
+ id: string;
440
+ } | null;
441
+ previous_response_id?: string | null;
442
+ max_output_tokens?: number | null;
443
+ max_tool_calls?: number | null;
444
+ moderation?: {
445
+ input: ModerationResult | ModerationError;
446
+ output: ModerationResult | ModerationError;
447
+ } | null;
448
+ prompt_cache_key?: string;
449
+ reasoning?: Reasoning | null;
450
+ safety_identifier?: string;
451
+ /** The tier actually used to serve (and bill) this response. */
452
+ service_tier?: ServiceTier | null;
453
+ text?: ResponseTextConfig;
454
+ top_logprobs?: number | null;
455
+ truncation?: 'auto' | 'disabled' | null;
456
+ usage?: ResponseUsage;
457
+ /** `x-request-id` of the HTTP response. */
458
+ _request_id?: string | null;
459
+ [key: string]: unknown;
460
+ }
461
+ interface BaseEvent {
462
+ sequence_number: number;
463
+ }
464
+ interface LifecycleEvent<T extends string> extends BaseEvent {
465
+ type: T;
466
+ response: Response;
467
+ }
468
+ export type ResponseQueuedEvent = LifecycleEvent<'response.queued'>;
469
+ export type ResponseCreatedEvent = LifecycleEvent<'response.created'>;
470
+ export type ResponseInProgressEvent = LifecycleEvent<'response.in_progress'>;
471
+ export type ResponseCompletedEvent = LifecycleEvent<'response.completed'>;
472
+ export type ResponseIncompleteEvent = LifecycleEvent<'response.incomplete'>;
473
+ export type ResponseFailedEvent = LifecycleEvent<'response.failed'>;
474
+ export interface ResponseOutputItemAddedEvent extends BaseEvent {
475
+ type: 'response.output_item.added';
476
+ output_index: number;
477
+ item: ResponseOutputItem;
478
+ }
479
+ export interface ResponseOutputItemDoneEvent extends BaseEvent {
480
+ type: 'response.output_item.done';
481
+ output_index: number;
482
+ /** Take `encrypted_content` from this event, not from `.added`. */
483
+ item: ResponseOutputItem;
484
+ }
485
+ export interface ResponseContentPartAddedEvent extends BaseEvent {
486
+ type: 'response.content_part.added';
487
+ item_id: string;
488
+ output_index: number;
489
+ content_index: number;
490
+ part: ResponseOutputText | ResponseOutputRefusal | {
491
+ type: 'reasoning_text';
492
+ text: string;
493
+ };
494
+ }
495
+ export interface ResponseContentPartDoneEvent extends BaseEvent {
496
+ type: 'response.content_part.done';
497
+ item_id: string;
498
+ output_index: number;
499
+ content_index: number;
500
+ part: ResponseOutputText | ResponseOutputRefusal | {
501
+ type: 'reasoning_text';
502
+ text: string;
503
+ };
504
+ }
505
+ export interface ResponseTextDeltaEvent extends BaseEvent {
506
+ type: 'response.output_text.delta';
507
+ item_id: string;
508
+ output_index: number;
509
+ content_index: number;
510
+ delta: string;
511
+ logprobs: Logprob[];
512
+ obfuscation?: string;
513
+ }
514
+ export interface ResponseTextDoneEvent extends BaseEvent {
515
+ type: 'response.output_text.done';
516
+ item_id: string;
517
+ output_index: number;
518
+ content_index: number;
519
+ text: string;
520
+ logprobs: Logprob[];
521
+ }
522
+ export interface ResponseOutputTextAnnotationAddedEvent extends BaseEvent {
523
+ type: 'response.output_text.annotation.added';
524
+ item_id: string;
525
+ output_index: number;
526
+ content_index: number;
527
+ annotation_index: number;
528
+ annotation: Annotation;
529
+ }
530
+ export interface ResponseRefusalDeltaEvent extends BaseEvent {
531
+ type: 'response.refusal.delta';
532
+ item_id: string;
533
+ output_index: number;
534
+ content_index: number;
535
+ delta: string;
536
+ }
537
+ export interface ResponseRefusalDoneEvent extends BaseEvent {
538
+ type: 'response.refusal.done';
539
+ item_id: string;
540
+ output_index: number;
541
+ content_index: number;
542
+ refusal: string;
543
+ }
544
+ export interface ResponseReasoningSummaryPartAddedEvent extends BaseEvent {
545
+ type: 'response.reasoning_summary_part.added';
546
+ item_id: string;
547
+ output_index: number;
548
+ summary_index: number;
549
+ part: {
550
+ type: 'summary_text';
551
+ text: string;
552
+ };
553
+ }
554
+ export interface ResponseReasoningSummaryPartDoneEvent extends BaseEvent {
555
+ type: 'response.reasoning_summary_part.done';
556
+ item_id: string;
557
+ output_index: number;
558
+ summary_index: number;
559
+ part: {
560
+ type: 'summary_text';
561
+ text: string;
562
+ };
563
+ status?: 'completed' | 'incomplete';
564
+ }
565
+ export interface ResponseReasoningSummaryTextDeltaEvent extends BaseEvent {
566
+ type: 'response.reasoning_summary_text.delta';
567
+ item_id: string;
568
+ output_index: number;
569
+ summary_index: number;
570
+ delta: string;
571
+ obfuscation?: string;
572
+ }
573
+ export interface ResponseReasoningSummaryTextDoneEvent extends BaseEvent {
574
+ type: 'response.reasoning_summary_text.done';
575
+ item_id: string;
576
+ output_index: number;
577
+ summary_index: number;
578
+ text: string;
579
+ }
580
+ export interface ResponseReasoningTextDeltaEvent extends BaseEvent {
581
+ type: 'response.reasoning_text.delta';
582
+ item_id: string;
583
+ output_index: number;
584
+ content_index: number;
585
+ delta: string;
586
+ obfuscation?: string;
587
+ }
588
+ export interface ResponseReasoningTextDoneEvent extends BaseEvent {
589
+ type: 'response.reasoning_text.done';
590
+ item_id: string;
591
+ output_index: number;
592
+ content_index: number;
593
+ text: string;
594
+ }
595
+ export interface ResponseFunctionCallArgumentsDeltaEvent extends BaseEvent {
596
+ type: 'response.function_call_arguments.delta';
597
+ item_id: string;
598
+ output_index: number;
599
+ delta: string;
600
+ obfuscation?: string;
601
+ }
602
+ export interface ResponseFunctionCallArgumentsDoneEvent extends BaseEvent {
603
+ type: 'response.function_call_arguments.done';
604
+ item_id: string;
605
+ output_index: number;
606
+ name?: string;
607
+ arguments: string;
608
+ }
609
+ export interface ResponseCustomToolCallInputDeltaEvent extends BaseEvent {
610
+ type: 'response.custom_tool_call_input.delta';
611
+ item_id: string;
612
+ output_index: number;
613
+ delta: string;
614
+ obfuscation?: string;
615
+ }
616
+ export interface ResponseCustomToolCallInputDoneEvent extends BaseEvent {
617
+ type: 'response.custom_tool_call_input.done';
618
+ item_id: string;
619
+ output_index: number;
620
+ input: string;
621
+ }
622
+ export interface ResponseCompactionCompactingEvent extends BaseEvent {
623
+ type: 'response.compaction.compacting';
624
+ output_index?: number;
625
+ item_id?: string;
626
+ }
627
+ /** An error after the stream started. The SDK throws these as status-less `APIError`s. */
628
+ export interface ResponseErrorEvent extends BaseEvent {
629
+ type: 'error';
630
+ code: string | null;
631
+ message: string;
632
+ param: string | null;
633
+ error?: ErrorObject;
634
+ }
635
+ /** Sent on long-running streams to keep the connection open; carries no content. */
636
+ export interface ResponseKeepaliveEvent extends BaseEvent {
637
+ type: 'keepalive';
638
+ }
639
+ export type ResponseStreamEvent = ResponseQueuedEvent | ResponseCreatedEvent | ResponseInProgressEvent | ResponseCompletedEvent | ResponseIncompleteEvent | ResponseFailedEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseContentPartAddedEvent | ResponseContentPartDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent | ResponseOutputTextAnnotationAddedEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseReasoningSummaryPartAddedEvent | ResponseReasoningSummaryPartDoneEvent | ResponseReasoningSummaryTextDeltaEvent | ResponseReasoningSummaryTextDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseCustomToolCallInputDeltaEvent | ResponseCustomToolCallInputDoneEvent | ResponseCompactionCompactingEvent | ResponseErrorEvent | ResponseKeepaliveEvent;
640
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=responses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/types/responses.ts"],"names":[],"mappings":""}