@volcengine/ark-runtime 1.0.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 (123) hide show
  1. package/LICENSE.txt +202 -0
  2. package/README.md +104 -0
  3. package/dist/cjs/index.js +1717 -0
  4. package/dist/esm/client.d.ts +97 -0
  5. package/dist/esm/client.d.ts.map +1 -0
  6. package/dist/esm/config.d.ts +46 -0
  7. package/dist/esm/config.d.ts.map +1 -0
  8. package/dist/esm/encryption/encrypt-chat.d.ts +24 -0
  9. package/dist/esm/encryption/encrypt-chat.d.ts.map +1 -0
  10. package/dist/esm/encryption/index.d.ts +4 -0
  11. package/dist/esm/encryption/index.d.ts.map +1 -0
  12. package/dist/esm/encryption/key-agreement.d.ts +73 -0
  13. package/dist/esm/encryption/key-agreement.d.ts.map +1 -0
  14. package/dist/esm/index.d.ts +11 -0
  15. package/dist/esm/index.d.ts.map +1 -0
  16. package/dist/esm/index.mjs +1476 -0
  17. package/dist/esm/rslib-runtime.mjs +37 -0
  18. package/dist/esm/types/bot.d.ts +109 -0
  19. package/dist/esm/types/bot.d.ts.map +1 -0
  20. package/dist/esm/types/chat-completion.d.ts +167 -0
  21. package/dist/esm/types/chat-completion.d.ts.map +1 -0
  22. package/dist/esm/types/common.d.ts +29 -0
  23. package/dist/esm/types/common.d.ts.map +1 -0
  24. package/dist/esm/types/content-generation.d.ts +118 -0
  25. package/dist/esm/types/content-generation.d.ts.map +1 -0
  26. package/dist/esm/types/context.d.ts +49 -0
  27. package/dist/esm/types/context.d.ts.map +1 -0
  28. package/dist/esm/types/embeddings.d.ts +44 -0
  29. package/dist/esm/types/embeddings.d.ts.map +1 -0
  30. package/dist/esm/types/error.d.ts +45 -0
  31. package/dist/esm/types/error.d.ts.map +1 -0
  32. package/dist/esm/types/file.d.ts +66 -0
  33. package/dist/esm/types/file.d.ts.map +1 -0
  34. package/dist/esm/types/http-request-error.d.ts +13 -0
  35. package/dist/esm/types/http-request-error.d.ts.map +1 -0
  36. package/dist/esm/types/images.d.ts +78 -0
  37. package/dist/esm/types/images.d.ts.map +1 -0
  38. package/dist/esm/types/index.d.ts +13 -0
  39. package/dist/esm/types/index.d.ts.map +1 -0
  40. package/dist/esm/types/multimodal-embedding.d.ts +56 -0
  41. package/dist/esm/types/multimodal-embedding.d.ts.map +1 -0
  42. package/dist/esm/types/responses/enums.d.ts +38 -0
  43. package/dist/esm/types/responses/enums.d.ts.map +1 -0
  44. package/dist/esm/types/responses/helpers.d.ts +22 -0
  45. package/dist/esm/types/responses/helpers.d.ts.map +1 -0
  46. package/dist/esm/types/responses/index.d.ts +4 -0
  47. package/dist/esm/types/responses/index.d.ts.map +1 -0
  48. package/dist/esm/types/responses/types.d.ts +906 -0
  49. package/dist/esm/types/responses/types.d.ts.map +1 -0
  50. package/dist/esm/types/tokenization.d.ts +22 -0
  51. package/dist/esm/types/tokenization.d.ts.map +1 -0
  52. package/dist/esm/utils/breaker-provider.d.ts +9 -0
  53. package/dist/esm/utils/breaker-provider.d.ts.map +1 -0
  54. package/dist/esm/utils/breaker.d.ts +28 -0
  55. package/dist/esm/utils/breaker.d.ts.map +1 -0
  56. package/dist/esm/utils/normalize.d.ts +51 -0
  57. package/dist/esm/utils/normalize.d.ts.map +1 -0
  58. package/dist/esm/utils/request-builder.d.ts +15 -0
  59. package/dist/esm/utils/request-builder.d.ts.map +1 -0
  60. package/dist/esm/utils/request-id.d.ts +5 -0
  61. package/dist/esm/utils/request-id.d.ts.map +1 -0
  62. package/dist/esm/utils/retry.d.ts +11 -0
  63. package/dist/esm/utils/retry.d.ts.map +1 -0
  64. package/dist/esm/utils/sse-decoder.d.ts +23 -0
  65. package/dist/esm/utils/sse-decoder.d.ts.map +1 -0
  66. package/dist/esm/utils/stream-reader.d.ts +67 -0
  67. package/dist/esm/utils/stream-reader.d.ts.map +1 -0
  68. package/dist/tsconfig.tsbuildinfo +1 -0
  69. package/example/README.md +118 -0
  70. package/example/batch-chat.ts +64 -0
  71. package/example/bot-chat.ts +66 -0
  72. package/example/chat-completion-function-call.ts +141 -0
  73. package/example/chat-completion-reasoning.ts +64 -0
  74. package/example/chat-completion-vision.ts +70 -0
  75. package/example/chat-completion.ts +62 -0
  76. package/example/content-generation.ts +70 -0
  77. package/example/context.ts +69 -0
  78. package/example/embeddings.ts +31 -0
  79. package/example/file-upload.ts +53 -0
  80. package/example/images.ts +74 -0
  81. package/example/list-input-items.ts +34 -0
  82. package/example/multimodal-embeddings.ts +36 -0
  83. package/example/responses/basic.ts +75 -0
  84. package/example/responses/doubao-app.ts +53 -0
  85. package/example/responses/mcp.ts +66 -0
  86. package/example/responses/streaming.ts +45 -0
  87. package/example/responses/video.ts +74 -0
  88. package/example/responses/web-search.ts +52 -0
  89. package/example/structured-outputs.ts +71 -0
  90. package/example/tokenization.ts +30 -0
  91. package/package.json +47 -0
  92. package/src/client.ts +1199 -0
  93. package/src/config.ts +68 -0
  94. package/src/encryption/encrypt-chat.ts +146 -0
  95. package/src/encryption/index.ts +21 -0
  96. package/src/encryption/key-agreement.ts +270 -0
  97. package/src/index.ts +10 -0
  98. package/src/types/ark.d.ts +9 -0
  99. package/src/types/bot.ts +127 -0
  100. package/src/types/chat-completion.ts +228 -0
  101. package/src/types/common.ts +37 -0
  102. package/src/types/content-generation.ts +135 -0
  103. package/src/types/context.ts +59 -0
  104. package/src/types/embeddings.ts +74 -0
  105. package/src/types/error.ts +93 -0
  106. package/src/types/file.ts +76 -0
  107. package/src/types/http-request-error.ts +34 -0
  108. package/src/types/images.ts +102 -0
  109. package/src/types/index.ts +12 -0
  110. package/src/types/multimodal-embedding.ts +67 -0
  111. package/src/types/responses/enums.ts +163 -0
  112. package/src/types/responses/helpers.ts +67 -0
  113. package/src/types/responses/index.ts +3 -0
  114. package/src/types/responses/types.ts +1335 -0
  115. package/src/types/tokenization.ts +24 -0
  116. package/src/utils/breaker-provider.ts +17 -0
  117. package/src/utils/breaker.ts +56 -0
  118. package/src/utils/normalize.ts +154 -0
  119. package/src/utils/request-builder.ts +51 -0
  120. package/src/utils/request-id.ts +17 -0
  121. package/src/utils/retry.ts +76 -0
  122. package/src/utils/sse-decoder.ts +140 -0
  123. package/src/utils/stream-reader.ts +270 -0
@@ -0,0 +1,906 @@
1
+ import type { EventType, ItemType, MessageRole, ContentItemType, ContentItemImageDetail, ItemStatus, ResponseStatus, ThinkingType, TextType, ToolChoiceMode, ToolType, UserLocationType, ObjectType, ReasoningEffort, IncludeType, CacheType, ChunkingStrategyType, ActionType, SourceType, ApprovalMode, AnnotationType, ResponseImageProcessType, ResponsesServiceTier, ResponsesTruncation, DoubaoAppBlockType, ResponseDoubaoAppFeatureType } from "./enums";
2
+ export type { EventType, ItemType, MessageRole, ContentItemType, ContentItemImageDetail, ItemStatus, ResponseStatus, ThinkingType, TextType, ToolChoiceMode, ToolType, UserLocationType, ObjectType, ReasoningEffort, IncludeType, CacheType, ChunkingStrategyType, ActionType, SourceType, ApprovalMode, AnnotationType, ResponseImageProcessType, ResponsesServiceTier, ResponsesTruncation, DoubaoAppBlockType, ResponseDoubaoAppFeatureType, };
3
+ export interface Usage {
4
+ prompt_tokens: number;
5
+ completion_tokens: number;
6
+ total_tokens: number;
7
+ prompt_tokens_details?: PromptTokensDetail;
8
+ completion_tokens_details?: CompletionTokensDetail;
9
+ }
10
+ export interface PromptTokensDetail {
11
+ cached_tokens?: number;
12
+ }
13
+ export interface CompletionTokensDetail {
14
+ reasoning_tokens?: number;
15
+ }
16
+ export interface Error {
17
+ code?: string;
18
+ message: string;
19
+ }
20
+ export interface IncompleteDetails {
21
+ reason?: string;
22
+ }
23
+ export interface CoverImage {
24
+ url?: string;
25
+ width?: number;
26
+ height?: number;
27
+ }
28
+ export interface Annotation {
29
+ type: AnnotationType;
30
+ title: string;
31
+ url: string;
32
+ logo_url?: string;
33
+ mobile_url?: string;
34
+ site_name?: string;
35
+ publish_time?: string;
36
+ cover_image?: CoverImage;
37
+ summary?: string;
38
+ freshness_info?: string;
39
+ doc_id?: string;
40
+ doc_name?: string;
41
+ chunk_id?: number;
42
+ chunk_attachment?: Record<string, unknown>[];
43
+ }
44
+ export interface TextTranslationOptions {
45
+ source_language: string;
46
+ target_language: string;
47
+ }
48
+ export interface ImagePixelLimit {
49
+ max_pixels?: number;
50
+ min_pixels?: number;
51
+ }
52
+ export interface ContentItemText {
53
+ type: ContentItemType;
54
+ text: string;
55
+ translation_options?: TextTranslationOptions;
56
+ }
57
+ export interface ContentItemImage {
58
+ type: ContentItemType;
59
+ detail?: ContentItemImageDetail;
60
+ image_url?: string;
61
+ file_id?: string;
62
+ image_pixel_limit?: ImagePixelLimit;
63
+ }
64
+ export interface ContentItemVideo {
65
+ type: ContentItemType;
66
+ video_url: string;
67
+ file_id?: string;
68
+ fps?: number;
69
+ }
70
+ export interface AudioChunkingStrategy {
71
+ type: ChunkingStrategyType;
72
+ prefix_padding_ms?: number;
73
+ silence_duration_ms?: number;
74
+ threshold?: number;
75
+ }
76
+ export interface ContentItemAudio {
77
+ type: ContentItemType;
78
+ chunking_strategy?: AudioChunkingStrategy;
79
+ audio_url: string;
80
+ file_id?: string;
81
+ }
82
+ export interface ContentItemFile {
83
+ type: ContentItemType;
84
+ file_data?: string;
85
+ file_id?: string;
86
+ file_url?: string;
87
+ filename?: string;
88
+ }
89
+ export interface AudioChunk {
90
+ start_time?: number;
91
+ end_time?: number;
92
+ text?: string;
93
+ }
94
+ /** Discriminated union: `type` field selects variant */
95
+ export type ContentItem = ContentItemText | ContentItemImage | ContentItemVideo | ContentItemAudio | ContentItemFile;
96
+ /** MessageContent can be a simple string or an array of ContentItem */
97
+ export type MessageContent = string | ContentItem[];
98
+ export interface OutputContentItemText {
99
+ type: ContentItemType;
100
+ text: string;
101
+ annotations?: Annotation[];
102
+ }
103
+ export type OutputContentItem = OutputContentItemText;
104
+ export interface ReasoningSummaryPart {
105
+ type: string;
106
+ text: string;
107
+ }
108
+ export interface TranscriptionPart {
109
+ type: ContentItemType;
110
+ text: string;
111
+ chunks?: AudioChunk[];
112
+ }
113
+ export interface ItemEasyMessage {
114
+ type?: ItemType;
115
+ role: MessageRole;
116
+ content: MessageContent;
117
+ id?: string;
118
+ partial?: boolean;
119
+ }
120
+ export interface ItemInputMessage {
121
+ type?: ItemType;
122
+ role: MessageRole;
123
+ content: ContentItem[];
124
+ status?: ItemStatus;
125
+ id?: string;
126
+ partial?: boolean;
127
+ }
128
+ export interface ItemOutputMessage {
129
+ type?: ItemType;
130
+ role: MessageRole;
131
+ content: OutputContentItem[];
132
+ status?: ItemStatus;
133
+ id?: string;
134
+ }
135
+ export interface ItemFunctionToolCall {
136
+ arguments: string;
137
+ call_id: string;
138
+ name: string;
139
+ type: ItemType;
140
+ id?: string;
141
+ status?: ItemStatus;
142
+ }
143
+ export interface ItemFunctionToolCallOutput {
144
+ output: string;
145
+ call_id: string;
146
+ type: ItemType;
147
+ id?: string;
148
+ status?: ItemStatus;
149
+ }
150
+ export interface ItemReasoning {
151
+ id?: string;
152
+ type: ItemType;
153
+ summary?: ReasoningSummaryPart[];
154
+ status: ItemStatus;
155
+ }
156
+ export interface ItemTranscription {
157
+ id?: string;
158
+ type: ItemType;
159
+ transcription?: TranscriptionPart[];
160
+ status: ItemStatus;
161
+ }
162
+ export interface ItemReference {
163
+ id: string;
164
+ type?: ItemType;
165
+ }
166
+ export interface Action {
167
+ query: string;
168
+ type: ActionType;
169
+ }
170
+ export interface ItemFunctionWebSearch {
171
+ type: ItemType;
172
+ action?: Action;
173
+ status: ItemStatus;
174
+ id: string;
175
+ }
176
+ export interface ResponseImageProcessAction {
177
+ type: ResponseImageProcessType;
178
+ result_image_url?: string;
179
+ }
180
+ export interface ResponseImageProcessError {
181
+ message: string;
182
+ }
183
+ export interface ResponseImageProcessPointArgs {
184
+ image_index: number;
185
+ points: string;
186
+ draw_line: boolean;
187
+ }
188
+ export interface ResponseImageProcessGroundingArgs {
189
+ image_index: number;
190
+ bbox_str: string;
191
+ crop: boolean;
192
+ }
193
+ export interface ResponseImageProcessRotateArgs {
194
+ image_index: number;
195
+ degree: number;
196
+ }
197
+ export interface ResponseImageProcessZoomArgs {
198
+ image_index: number;
199
+ bbox_str: string;
200
+ }
201
+ export type ResponseImageProcessArgs = ResponseImageProcessPointArgs | ResponseImageProcessGroundingArgs | ResponseImageProcessRotateArgs | ResponseImageProcessZoomArgs;
202
+ export interface ItemFunctionImageProcess {
203
+ type: ItemType;
204
+ action?: ResponseImageProcessAction;
205
+ arguments?: ResponseImageProcessArgs;
206
+ status: ItemStatus;
207
+ id: string;
208
+ error?: ResponseImageProcessError;
209
+ }
210
+ export interface ImageProcessPointOptions {
211
+ enabled?: boolean;
212
+ }
213
+ export interface ImageProcessGroundingOptions {
214
+ enabled?: boolean;
215
+ }
216
+ export interface ImageProcessZoomOptions {
217
+ enabled?: boolean;
218
+ }
219
+ export interface ImageProcessRotateOptions {
220
+ enabled?: boolean;
221
+ }
222
+ export interface McpTool {
223
+ name: string;
224
+ description: string;
225
+ input_schema?: Record<string, unknown>;
226
+ }
227
+ export interface ItemFunctionMcpApprovalRequest {
228
+ type: ItemType;
229
+ server_label: string;
230
+ arguments: string;
231
+ name: string;
232
+ id?: string;
233
+ }
234
+ export interface ItemFunctionMcpApprovalResponse {
235
+ type: ItemType;
236
+ id?: string;
237
+ approve: boolean;
238
+ approval_request_id: string;
239
+ reason?: string;
240
+ }
241
+ export interface ItemFunctionMcpListTools {
242
+ type: ItemType;
243
+ server_label: string;
244
+ tools?: McpTool[];
245
+ id?: string;
246
+ error?: string;
247
+ }
248
+ export interface ItemFunctionMcpCall {
249
+ type: ItemType;
250
+ server_label: string;
251
+ approval_request_id?: string;
252
+ arguments: string;
253
+ error?: string;
254
+ name: string;
255
+ output?: string;
256
+ id?: string;
257
+ }
258
+ export interface ItemFunctionKnowledgeSearch {
259
+ type: ItemType;
260
+ queries?: string[];
261
+ knowledge_resource_id: string;
262
+ status: ItemStatus;
263
+ id?: string;
264
+ }
265
+ export interface DoubaoAppCallBlockOutputText {
266
+ id?: string;
267
+ type: DoubaoAppBlockType;
268
+ text: string;
269
+ status: ItemStatus;
270
+ parent_id?: string;
271
+ }
272
+ export interface DoubaoAppCallBlockReasoningText {
273
+ id?: string;
274
+ type: DoubaoAppBlockType;
275
+ text: string;
276
+ status: ItemStatus;
277
+ parent_id?: string;
278
+ }
279
+ export interface DoubaoAppSearchTextItem {
280
+ index?: number;
281
+ title?: string;
282
+ site_name?: string;
283
+ url?: string;
284
+ mobile_url?: string;
285
+ logo_url?: string;
286
+ cover_image?: CoverImage;
287
+ publish_time?: string;
288
+ freshness_info?: string;
289
+ summary?: string;
290
+ doc_id?: string;
291
+ doc_name?: string;
292
+ chunk_id?: number;
293
+ chunk_attachment?: Record<string, unknown>[];
294
+ }
295
+ export interface DoubaoAppSearchResult {
296
+ type?: string;
297
+ search_result?: DoubaoAppSearchTextItem[];
298
+ }
299
+ export interface DoubaoAppCallBlockSearch {
300
+ id?: string;
301
+ type: DoubaoAppBlockType;
302
+ status: ItemStatus;
303
+ parent_id?: string;
304
+ result?: DoubaoAppSearchResult;
305
+ }
306
+ export interface DoubaoAppCallBlockReasoningSearch {
307
+ id?: string;
308
+ type: DoubaoAppBlockType;
309
+ status: ItemStatus;
310
+ parent_id?: string;
311
+ result?: DoubaoAppSearchResult;
312
+ }
313
+ export type DoubaoAppCallBlock = DoubaoAppCallBlockOutputText | DoubaoAppCallBlockReasoningText | DoubaoAppCallBlockSearch | DoubaoAppCallBlockReasoningSearch;
314
+ export interface ItemDoubaoAppCall {
315
+ id?: string;
316
+ type: ItemType;
317
+ feature?: string;
318
+ blocks?: DoubaoAppCallBlock[];
319
+ status: ItemStatus;
320
+ }
321
+ export interface DoubaoAppFeature {
322
+ search?: ResponseDoubaoAppFeatureType;
323
+ summary?: ResponseDoubaoAppFeatureType;
324
+ }
325
+ export type InputItem = ItemEasyMessage | ItemInputMessage | ItemOutputMessage | ItemFunctionToolCall | ItemFunctionToolCallOutput | ItemReasoning | ItemReference | ItemFunctionImageProcess | ItemFunctionMcpApprovalRequest | ItemFunctionMcpApprovalResponse | ItemFunctionMcpListTools | ItemFunctionMcpCall | ItemFunctionWebSearch | ItemFunctionKnowledgeSearch | ItemDoubaoAppCall;
326
+ /** ResponsesInput can be a simple string or array of InputItem */
327
+ export type ResponsesInput = string | InputItem[];
328
+ export type OutputItem = ItemOutputMessage | ItemFunctionToolCall | ItemReasoning | ItemTranscription | ItemFunctionWebSearch | ItemFunctionImageProcess | ItemFunctionMcpApprovalRequest | ItemFunctionMcpListTools | ItemFunctionMcpCall | ItemFunctionKnowledgeSearch | ItemDoubaoAppCall;
329
+ export interface ToolFunction {
330
+ name: string;
331
+ strict?: boolean;
332
+ type: ToolType;
333
+ description?: string;
334
+ /** JSON schema describing the function parameters */
335
+ parameters?: Record<string, unknown>;
336
+ }
337
+ export interface UserLocation {
338
+ type: UserLocationType;
339
+ city?: string;
340
+ country?: string;
341
+ region?: string;
342
+ timezone?: string;
343
+ }
344
+ export interface ToolWebSearch {
345
+ type: ToolType;
346
+ limit?: number;
347
+ user_location?: UserLocation;
348
+ sources?: SourceType[];
349
+ max_keyword?: number;
350
+ }
351
+ export interface ToolImageProcess {
352
+ type: ToolType;
353
+ point?: ImageProcessPointOptions;
354
+ grounding?: ImageProcessGroundingOptions;
355
+ zoom?: ImageProcessZoomOptions;
356
+ rotate?: ImageProcessRotateOptions;
357
+ }
358
+ export interface McpAllowedToolsFilter {
359
+ tool_names: string[];
360
+ }
361
+ /** allowed_tools can be string[] (list) or {tool_names: string[]} (filter) */
362
+ export type McpAllowedTools = string[] | McpAllowedToolsFilter;
363
+ export interface McpToolApprovalFilterAlways {
364
+ tool_names?: string[];
365
+ }
366
+ export interface McpToolApprovalFilterNever {
367
+ tool_names?: string[];
368
+ }
369
+ export interface McpToolApprovalFilter {
370
+ always?: McpToolApprovalFilterAlways;
371
+ never?: McpToolApprovalFilterNever;
372
+ }
373
+ /** require_approval can be a mode string ("always"|"never") or a filter object */
374
+ export type McpRequireApproval = ApprovalMode | McpToolApprovalFilter;
375
+ export interface ToolMcp {
376
+ type: ToolType;
377
+ server_label: string;
378
+ server_url: string;
379
+ allowed_tools?: McpAllowedTools;
380
+ headers?: Record<string, string>;
381
+ require_approval?: McpRequireApproval;
382
+ server_description?: string;
383
+ }
384
+ export interface ToolKnowledgeSearch {
385
+ type: ToolType;
386
+ knowledge_resource_id: string;
387
+ description?: string;
388
+ limit?: number;
389
+ dense_weight?: number;
390
+ doc_filter?: Record<string, unknown>;
391
+ ranking_options?: Record<string, unknown>;
392
+ max_keyword?: number;
393
+ }
394
+ export interface ToolDoubaoApp {
395
+ type: ToolType;
396
+ feature?: DoubaoAppFeature;
397
+ user_location?: UserLocation;
398
+ }
399
+ export type ResponsesTool = ToolFunction | ToolWebSearch | ToolImageProcess | ToolMcp | ToolKnowledgeSearch | ToolDoubaoApp;
400
+ export interface FunctionToolChoice {
401
+ type: ToolType;
402
+ name: string;
403
+ }
404
+ export interface McpToolChoice {
405
+ type: ToolType;
406
+ server_label: string;
407
+ name?: string;
408
+ }
409
+ export interface WebSearchToolChoice {
410
+ type: ToolType;
411
+ }
412
+ export interface KnowledgeSearchToolChoice {
413
+ type: ToolType;
414
+ }
415
+ /** tool_choice can be a mode string or a specific tool choice object */
416
+ export type ResponsesToolChoice = ToolChoiceMode | FunctionToolChoice | McpToolChoice | WebSearchToolChoice | KnowledgeSearchToolChoice;
417
+ export interface ResponsesThinking {
418
+ type?: ThinkingType;
419
+ }
420
+ export interface ResponsesReasoning {
421
+ effort: ReasoningEffort;
422
+ }
423
+ export interface ResponsesCaching {
424
+ type?: CacheType;
425
+ prefix?: boolean;
426
+ }
427
+ export interface TextFormat {
428
+ type: TextType;
429
+ schema?: Record<string, unknown>;
430
+ name?: string;
431
+ description?: string;
432
+ strict?: boolean;
433
+ }
434
+ export interface ResponsesText {
435
+ format?: TextFormat;
436
+ }
437
+ export interface ContextManagement {
438
+ truncation?: ResponsesTruncation;
439
+ }
440
+ export interface ContextManagementResponse {
441
+ truncation?: ResponsesTruncation;
442
+ }
443
+ export interface ResponsesRequest {
444
+ input?: ResponsesInput;
445
+ model: string;
446
+ max_output_tokens?: number;
447
+ previous_response_id?: string;
448
+ thinking?: ResponsesThinking;
449
+ service_tier?: ResponsesServiceTier;
450
+ store?: boolean;
451
+ stream?: boolean;
452
+ temperature?: number;
453
+ tools?: ResponsesTool[];
454
+ top_p?: number;
455
+ instructions?: string;
456
+ include?: IncludeType[];
457
+ caching?: ResponsesCaching;
458
+ text?: ResponsesText;
459
+ expire_at?: number;
460
+ tool_choice?: ResponsesToolChoice;
461
+ parallel_tool_calls?: boolean;
462
+ max_tool_calls?: number;
463
+ reasoning?: ResponsesReasoning;
464
+ context_management?: ContextManagement;
465
+ }
466
+ export interface ResponseObject {
467
+ created_at: number;
468
+ error?: Error;
469
+ id: string;
470
+ incomplete_details?: IncompleteDetails;
471
+ max_output_tokens?: number;
472
+ model: string;
473
+ object: ObjectType;
474
+ output: OutputItem[];
475
+ previous_response_id?: string;
476
+ thinking?: ResponsesThinking;
477
+ service_tier?: ResponsesServiceTier;
478
+ status: ResponseStatus;
479
+ temperature?: number;
480
+ tools?: ResponsesTool[];
481
+ top_p?: number;
482
+ usage?: Usage;
483
+ caching?: ResponsesCaching;
484
+ text?: ResponsesText;
485
+ instructions?: string;
486
+ store?: boolean;
487
+ expire_at?: number;
488
+ tool_choice?: ResponsesToolChoice;
489
+ parallel_tool_calls?: boolean;
490
+ max_tool_calls?: number;
491
+ reasoning?: ResponsesReasoning;
492
+ context_management?: ContextManagementResponse;
493
+ }
494
+ export interface GetResponseRequest {
495
+ include?: IncludeType[];
496
+ }
497
+ export interface ListInputItemsRequest {
498
+ include?: IncludeType[];
499
+ limit?: number;
500
+ order?: "asc" | "desc";
501
+ after?: string;
502
+ before?: string;
503
+ }
504
+ export interface ListInputItemsResponse {
505
+ object: ObjectType;
506
+ data: InputItem[];
507
+ first_id?: string;
508
+ last_id?: string;
509
+ has_more: boolean;
510
+ }
511
+ export interface ResponseEvent {
512
+ type: EventType;
513
+ response: ResponseObject;
514
+ sequence_number: number;
515
+ }
516
+ export interface ResponseInProgressEvent {
517
+ type: EventType;
518
+ response: ResponseObject;
519
+ sequence_number: number;
520
+ }
521
+ export interface ResponseCompletedEvent {
522
+ type: EventType;
523
+ response: ResponseObject;
524
+ sequence_number: number;
525
+ }
526
+ export interface ResponseFailedEvent {
527
+ type: EventType;
528
+ response: ResponseObject;
529
+ sequence_number: number;
530
+ }
531
+ export interface ResponseIncompleteEvent {
532
+ type: EventType;
533
+ response: ResponseObject;
534
+ sequence_number: number;
535
+ }
536
+ export interface ItemEvent {
537
+ type: EventType;
538
+ item: OutputItem;
539
+ output_index: number;
540
+ sequence_number: number;
541
+ }
542
+ export interface ItemDoneEvent {
543
+ type: EventType;
544
+ item: OutputItem;
545
+ output_index: number;
546
+ sequence_number: number;
547
+ }
548
+ export interface ContentPartEvent {
549
+ type: EventType;
550
+ part: OutputContentItem;
551
+ item_id: string;
552
+ output_index: number;
553
+ content_index: number;
554
+ sequence_number: number;
555
+ }
556
+ export interface ContentPartDoneEvent {
557
+ type: EventType;
558
+ part: OutputContentItem;
559
+ item_id: string;
560
+ output_index: number;
561
+ content_index: number;
562
+ sequence_number: number;
563
+ }
564
+ export interface OutputTextEvent {
565
+ type: EventType;
566
+ delta: string;
567
+ item_id: string;
568
+ output_index: number;
569
+ content_index: number;
570
+ sequence_number: number;
571
+ annotations?: Annotation[];
572
+ }
573
+ export interface OutputTextDoneEvent {
574
+ type: EventType;
575
+ text: string;
576
+ item_id: string;
577
+ output_index: number;
578
+ content_index: number;
579
+ sequence_number: number;
580
+ annotations?: Annotation[];
581
+ }
582
+ export interface ResponseAnnotationAddedEvent {
583
+ type: EventType;
584
+ annotation: Annotation;
585
+ item_id: string;
586
+ output_index: number;
587
+ content_index: number;
588
+ annotation_index: number;
589
+ sequence_number: number;
590
+ }
591
+ export interface ReasoningSummaryPartEvent {
592
+ type: EventType;
593
+ part: ReasoningSummaryPart;
594
+ item_id: string;
595
+ output_index: number;
596
+ summary_index: number;
597
+ sequence_number: number;
598
+ }
599
+ export interface ReasoningSummaryPartDoneEvent {
600
+ type: EventType;
601
+ part: ReasoningSummaryPart;
602
+ item_id: string;
603
+ output_index: number;
604
+ summary_index: number;
605
+ sequence_number: number;
606
+ }
607
+ export interface ReasoningSummaryTextEvent {
608
+ type: EventType;
609
+ delta: string;
610
+ item_id: string;
611
+ output_index: number;
612
+ summary_index: number;
613
+ sequence_number: number;
614
+ }
615
+ export interface ReasoningSummaryTextDoneEvent {
616
+ type: EventType;
617
+ text: string;
618
+ item_id: string;
619
+ output_index: number;
620
+ summary_index: number;
621
+ sequence_number: number;
622
+ }
623
+ export interface FunctionCallArgumentsEvent {
624
+ type: EventType;
625
+ delta: string;
626
+ item_id: string;
627
+ output_index: number;
628
+ sequence_number: number;
629
+ call_id?: string;
630
+ }
631
+ export interface FunctionCallArgumentsDoneEvent {
632
+ type: EventType;
633
+ arguments: string;
634
+ item_id: string;
635
+ output_index: number;
636
+ sequence_number: number;
637
+ call_id?: string;
638
+ }
639
+ export interface TranscriptionPartEvent {
640
+ type: EventType;
641
+ part: TranscriptionPart;
642
+ item_id: string;
643
+ output_index: number;
644
+ content_index: number;
645
+ sequence_number: number;
646
+ }
647
+ export interface TranscriptionPartDoneEvent {
648
+ type: EventType;
649
+ part: TranscriptionPart;
650
+ item_id: string;
651
+ output_index: number;
652
+ content_index: number;
653
+ sequence_number: number;
654
+ }
655
+ export interface TranscriptionTextEvent {
656
+ type: EventType;
657
+ delta: string;
658
+ item_id: string;
659
+ output_index: number;
660
+ content_index: number;
661
+ sequence_number: number;
662
+ chunks?: AudioChunk[];
663
+ }
664
+ export interface TranscriptionTextDoneEvent {
665
+ type: EventType;
666
+ text: string;
667
+ item_id: string;
668
+ output_index: number;
669
+ content_index: number;
670
+ sequence_number: number;
671
+ chunks?: AudioChunk[];
672
+ }
673
+ export interface ErrorEvent {
674
+ type: EventType;
675
+ message: string;
676
+ code?: string;
677
+ sequence_number: number;
678
+ }
679
+ export interface ResponseWebSearchCallInProgressEvent {
680
+ type: EventType;
681
+ item_id: string;
682
+ output_index: number;
683
+ sequence_number: number;
684
+ }
685
+ export interface ResponseWebSearchCallSearchingEvent {
686
+ type: EventType;
687
+ item_id: string;
688
+ output_index: number;
689
+ sequence_number: number;
690
+ }
691
+ export interface ResponseWebSearchCallCompletedEvent {
692
+ type: EventType;
693
+ item_id: string;
694
+ output_index: number;
695
+ sequence_number: number;
696
+ }
697
+ export interface ResponseImageProcessCallInProgressEvent {
698
+ type: EventType;
699
+ item_id: string;
700
+ output_index: number;
701
+ sequence_number: number;
702
+ }
703
+ export interface ResponseImageProcessCallProcessingEvent {
704
+ type: EventType;
705
+ item_id: string;
706
+ output_index: number;
707
+ sequence_number: number;
708
+ }
709
+ export interface ResponseImageProcessCallCompletedEvent {
710
+ type: EventType;
711
+ item_id: string;
712
+ output_index: number;
713
+ sequence_number: number;
714
+ }
715
+ export interface ResponseImageProcessCallFailedEvent {
716
+ type: EventType;
717
+ item_id: string;
718
+ output_index: number;
719
+ sequence_number: number;
720
+ }
721
+ export interface ResponseMcpListToolsInProgressEvent {
722
+ type: EventType;
723
+ item_id: string;
724
+ output_index: number;
725
+ sequence_number: number;
726
+ }
727
+ export interface ResponseMcpListToolsCompletedEvent {
728
+ type: EventType;
729
+ item_id: string;
730
+ output_index: number;
731
+ sequence_number: number;
732
+ }
733
+ export interface ResponseMcpCallInProgressEvent {
734
+ type: EventType;
735
+ item_id: string;
736
+ output_index: number;
737
+ sequence_number: number;
738
+ }
739
+ export interface ResponseMcpCallArgumentsDeltaEvent {
740
+ type: EventType;
741
+ delta: string;
742
+ item_id: string;
743
+ output_index: number;
744
+ sequence_number: number;
745
+ }
746
+ export interface ResponseMcpCallArgumentsDoneEvent {
747
+ type: EventType;
748
+ arguments: string;
749
+ item_id: string;
750
+ output_index: number;
751
+ sequence_number: number;
752
+ }
753
+ export interface ResponseMcpCallCompletedEvent {
754
+ type: EventType;
755
+ item_id: string;
756
+ output_index: number;
757
+ sequence_number: number;
758
+ }
759
+ export interface ResponseMcpCallFailedEvent {
760
+ type: EventType;
761
+ item_id: string;
762
+ output_index: number;
763
+ sequence_number: number;
764
+ }
765
+ export interface ResponseMcpApprovalRequestEvent {
766
+ type: EventType;
767
+ item_id: string;
768
+ output_index: number;
769
+ sequence_number: number;
770
+ }
771
+ export interface ResponseKnowledgeSearchCallInProgressEvent {
772
+ type: EventType;
773
+ item_id: string;
774
+ output_index: number;
775
+ sequence_number: number;
776
+ }
777
+ export interface ResponseKnowledgeSearchCallSearchingEvent {
778
+ type: EventType;
779
+ item_id: string;
780
+ output_index: number;
781
+ sequence_number: number;
782
+ }
783
+ export interface ResponseKnowledgeSearchCallCompletedEvent {
784
+ type: EventType;
785
+ item_id: string;
786
+ output_index: number;
787
+ sequence_number: number;
788
+ }
789
+ export interface ResponseKnowledgeSearchCallFailedEvent {
790
+ type: EventType;
791
+ item_id: string;
792
+ output_index: number;
793
+ sequence_number: number;
794
+ }
795
+ export interface ResponseDoubaoAppCallInProgressEvent {
796
+ type: EventType;
797
+ item_id: string;
798
+ output_index: number;
799
+ sequence_number: number;
800
+ }
801
+ export interface ResponseDoubaoAppCallFailedEvent {
802
+ type: EventType;
803
+ item_id: string;
804
+ output_index: number;
805
+ sequence_number: number;
806
+ }
807
+ export interface ResponseDoubaoAppCallCompletedEvent {
808
+ type: EventType;
809
+ item_id: string;
810
+ output_index: number;
811
+ sequence_number: number;
812
+ }
813
+ export interface ResponseDoubaoAppCallBlockAddedEvent {
814
+ type: EventType;
815
+ block: DoubaoAppCallBlock;
816
+ item_id: string;
817
+ output_index: number;
818
+ sequence_number: number;
819
+ }
820
+ export interface ResponseDoubaoAppCallBlockDoneEvent {
821
+ type: EventType;
822
+ block: DoubaoAppCallBlock;
823
+ item_id: string;
824
+ output_index: number;
825
+ sequence_number: number;
826
+ }
827
+ export interface ResponseDoubaoAppCallReasoningTextDeltaEvent {
828
+ type: EventType;
829
+ delta: string;
830
+ item_id: string;
831
+ output_index: number;
832
+ block_index: number;
833
+ sequence_number: number;
834
+ }
835
+ export interface ResponseDoubaoAppCallReasoningTextDoneEvent {
836
+ type: EventType;
837
+ text: string;
838
+ item_id: string;
839
+ output_index: number;
840
+ block_index: number;
841
+ sequence_number: number;
842
+ }
843
+ export interface ResponseDoubaoAppCallOutputTextDeltaEvent {
844
+ type: EventType;
845
+ delta: string;
846
+ item_id: string;
847
+ output_index: number;
848
+ block_index: number;
849
+ sequence_number: number;
850
+ }
851
+ export interface ResponseDoubaoAppCallOutputTextDoneEvent {
852
+ type: EventType;
853
+ text: string;
854
+ item_id: string;
855
+ output_index: number;
856
+ block_index: number;
857
+ sequence_number: number;
858
+ }
859
+ export interface ResponseDoubaoAppCallReasoningSearchInProgressEvent {
860
+ type: EventType;
861
+ item_id: string;
862
+ output_index: number;
863
+ block_index: number;
864
+ sequence_number: number;
865
+ }
866
+ export interface ResponseDoubaoAppCallReasoningSearchSearchingEvent {
867
+ type: EventType;
868
+ item_id: string;
869
+ output_index: number;
870
+ block_index: number;
871
+ sequence_number: number;
872
+ search_result?: DoubaoAppSearchTextItem[];
873
+ }
874
+ export interface ResponseDoubaoAppCallReasoningSearchCompletedEvent {
875
+ type: EventType;
876
+ item_id: string;
877
+ output_index: number;
878
+ block_index: number;
879
+ sequence_number: number;
880
+ search_result?: DoubaoAppSearchTextItem[];
881
+ }
882
+ export interface ResponseDoubaoAppCallSearchInProgressEvent {
883
+ type: EventType;
884
+ item_id: string;
885
+ output_index: number;
886
+ block_index: number;
887
+ sequence_number: number;
888
+ }
889
+ export interface ResponseDoubaoAppCallSearchSearchingEvent {
890
+ type: EventType;
891
+ item_id: string;
892
+ output_index: number;
893
+ block_index: number;
894
+ sequence_number: number;
895
+ search_result?: DoubaoAppSearchTextItem[];
896
+ }
897
+ export interface ResponseDoubaoAppCallSearchCompletedEvent {
898
+ type: EventType;
899
+ item_id: string;
900
+ output_index: number;
901
+ block_index: number;
902
+ sequence_number: number;
903
+ search_result?: DoubaoAppSearchTextItem[];
904
+ }
905
+ export type Event = ResponseEvent | ResponseInProgressEvent | ResponseCompletedEvent | ResponseFailedEvent | ResponseIncompleteEvent | ItemEvent | ItemDoneEvent | ContentPartEvent | ContentPartDoneEvent | OutputTextEvent | OutputTextDoneEvent | ResponseAnnotationAddedEvent | ReasoningSummaryPartEvent | ReasoningSummaryPartDoneEvent | ReasoningSummaryTextEvent | ReasoningSummaryTextDoneEvent | FunctionCallArgumentsEvent | FunctionCallArgumentsDoneEvent | TranscriptionPartEvent | TranscriptionPartDoneEvent | TranscriptionTextEvent | TranscriptionTextDoneEvent | ErrorEvent | ResponseWebSearchCallInProgressEvent | ResponseWebSearchCallSearchingEvent | ResponseWebSearchCallCompletedEvent | ResponseImageProcessCallInProgressEvent | ResponseImageProcessCallProcessingEvent | ResponseImageProcessCallCompletedEvent | ResponseImageProcessCallFailedEvent | ResponseMcpListToolsInProgressEvent | ResponseMcpListToolsCompletedEvent | ResponseMcpCallInProgressEvent | ResponseMcpCallArgumentsDeltaEvent | ResponseMcpCallArgumentsDoneEvent | ResponseMcpCallCompletedEvent | ResponseMcpCallFailedEvent | ResponseMcpApprovalRequestEvent | ResponseKnowledgeSearchCallInProgressEvent | ResponseKnowledgeSearchCallSearchingEvent | ResponseKnowledgeSearchCallCompletedEvent | ResponseKnowledgeSearchCallFailedEvent | ResponseDoubaoAppCallInProgressEvent | ResponseDoubaoAppCallFailedEvent | ResponseDoubaoAppCallCompletedEvent | ResponseDoubaoAppCallBlockAddedEvent | ResponseDoubaoAppCallBlockDoneEvent | ResponseDoubaoAppCallReasoningTextDeltaEvent | ResponseDoubaoAppCallReasoningTextDoneEvent | ResponseDoubaoAppCallOutputTextDeltaEvent | ResponseDoubaoAppCallOutputTextDoneEvent | ResponseDoubaoAppCallSearchInProgressEvent | ResponseDoubaoAppCallSearchSearchingEvent | ResponseDoubaoAppCallSearchCompletedEvent | ResponseDoubaoAppCallReasoningSearchInProgressEvent | ResponseDoubaoAppCallReasoningSearchSearchingEvent | ResponseDoubaoAppCallReasoningSearchCompletedEvent;
906
+ //# sourceMappingURL=types.d.ts.map