@ai-sdk/otel 1.0.164 → 1.0.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Attributes, Context, Link, SpanKind, TraceState, Tracer } from "@opentelemetry/api";
2
2
  import { DurableTelemetryContext, EmbedEndEvent, EmbedStartEvent, EmbeddingModelCallEndEvent, EmbeddingModelCallStartEvent, Experimental_DecideEndEvent, Experimental_DecideStartEvent, Experimental_DecisionModelCallEndEvent, Experimental_DecisionModelCallStartEvent, Experimental_StreamTranscriptionEndEvent, Experimental_StreamTranscriptionStartEvent, GenerateObjectEndEvent, GenerateObjectStartEvent, GenerateObjectStepEndEvent, GenerateObjectStepStartEvent, GenerateSpeechEndEvent, GenerateSpeechStartEvent, GenerateTextAbortEvent, GenerateTextEndEvent, GenerateTextStartEvent, GenerateTextStepEndEvent, GenerateTextStepErrorEvent, GenerateTextStepStartEvent, InferTelemetryEvent, LanguageModelCallEndEvent, LanguageModelCallStartEvent, Output, RerankEndEvent, RerankStartEvent, RerankingModelCallEndEvent, RerankingModelCallStartEvent, Telemetry, ToolExecutionEndEvent, ToolExecutionStartEvent, ToolSet, TranscriptionEndEvent, TranscriptionStartEvent } from "ai";
3
- import { APICallError, LanguageModelV4Prompt } from "@ai-sdk/provider";
3
+ import { APICallError, JSONValue, LanguageModelV4Prompt, SharedV4FileDataReference, SharedV4FileDataText, SharedV4FileDataUrl, SharedV4ProviderOptions, SharedV4ProviderReference } from "@ai-sdk/provider";
4
4
  //#region src/durable-span-ids.d.ts
5
5
  /** Compatible with the OpenTelemetry SDK's Sampler interface. */
6
6
  type Sampler = {
@@ -35,6 +35,787 @@ export declare class OpenTelemetryIdGenerator {
35
35
  }, startSpan: () => T): T;
36
36
  }
37
37
  //#endregion
38
+ //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/schemas.d.cts
39
+ declare global {
40
+ interface File {}
41
+ }
42
+ //#endregion
43
+ //#region ../provider-utils/dist/index.d.ts
44
+ //#endregion
45
+ //#region src/types/data-content.d.ts
46
+ /**
47
+ * Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer.
48
+ */
49
+ type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
50
+ //#endregion
51
+ //#region src/types/file-data.d.ts
52
+ /**
53
+ * File data variant containing raw bytes (`Uint8Array`, `ArrayBuffer`, or
54
+ * `Buffer`) or a base64-encoded string.
55
+ *
56
+ * This is slightly more permissive than `SharedV4FileDataData`.
57
+ */
58
+ interface FileDataData {
59
+ type: 'data';
60
+ data: DataContent;
61
+ }
62
+ /**
63
+ * File data variant containing a URL that points to the file.
64
+ */
65
+ type FileDataUrl = SharedV4FileDataUrl;
66
+ /**
67
+ * File data variant containing a provider reference (`{ [provider]: id }`).
68
+ */
69
+ type FileDataReference = SharedV4FileDataReference;
70
+ /**
71
+ * File data variant containing inline text content (e.g. an inline text
72
+ * document).
73
+ */
74
+ type FileDataText = SharedV4FileDataText;
75
+ /**
76
+ * File data as a tagged discriminated union:
77
+ *
78
+ * - `{ type: 'data', data }`: raw bytes (`Uint8Array`, `ArrayBuffer`, or
79
+ * `Buffer`) or a base64-encoded string.
80
+ * - `{ type: 'url', url }`: a URL that points to the file.
81
+ * - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
82
+ * - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
83
+ */
84
+ type FileData = FileDataData | FileDataUrl | FileDataReference | FileDataText;
85
+ //#endregion
86
+ //#region src/types/provider-options.d.ts
87
+ /**
88
+ * Additional provider-specific options.
89
+ *
90
+ * They are passed through to the provider from the AI SDK and enable
91
+ * provider-specific functionality that can be fully encapsulated in the provider.
92
+ */
93
+ type ProviderOptions = SharedV4ProviderOptions;
94
+ //#endregion
95
+ //#region src/types/provider-reference.d.ts
96
+ /**
97
+ * A mapping of provider names to provider-specific file identifiers.
98
+ *
99
+ * Provider references allow files to be identified across different
100
+ * providers without re-uploading, by storing each provider's own
101
+ * identifier for the same logical file.
102
+ */
103
+ type ProviderReference = SharedV4ProviderReference;
104
+ //#endregion
105
+ //#region src/types/content-part.d.ts
106
+ /**
107
+ * Text content part of a prompt. It contains a string of text.
108
+ */
109
+ interface TextPart {
110
+ type: 'text';
111
+ /**
112
+ * The text content.
113
+ */
114
+ text: string;
115
+ /**
116
+ * Additional provider-specific metadata. They are passed through
117
+ * to the provider from the AI SDK and enable provider-specific
118
+ * functionality that can be fully encapsulated in the provider.
119
+ */
120
+ providerOptions?: ProviderOptions;
121
+ }
122
+ /**
123
+ * Image content part of a prompt. It contains an image.
124
+ *
125
+ * @deprecated Use `FilePart` with `mediaType: 'image'` instead:
126
+ * `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
127
+ */
128
+ interface ImagePart {
129
+ type: 'image';
130
+ /**
131
+ * Image data. Can either be:
132
+ *
133
+ * - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
134
+ * - URL: a URL that points to the image
135
+ * - ProviderReference: a provider reference from `uploadFile`
136
+ */
137
+ image: DataContent | URL | ProviderReference;
138
+ /**
139
+ * Optional IANA media type of the image.
140
+ *
141
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
142
+ */
143
+ mediaType?: string;
144
+ /**
145
+ * Additional provider-specific metadata. They are passed through
146
+ * to the provider from the AI SDK and enable provider-specific
147
+ * functionality that can be fully encapsulated in the provider.
148
+ */
149
+ providerOptions?: ProviderOptions;
150
+ }
151
+ /**
152
+ * File content part of a prompt. It contains a file.
153
+ */
154
+ interface FilePart {
155
+ type: 'file';
156
+ /**
157
+ * File data. Either a tagged shape or a bare shorthand:
158
+ *
159
+ * - `{ type: 'data', data }` or bare `DataContent`: raw bytes
160
+ * (base64 string, Uint8Array, ArrayBuffer, Buffer)
161
+ * - `{ type: 'url', url }` or bare `URL`: a URL that points to the file
162
+ * - `{ type: 'reference', reference }` or bare `ProviderReference`:
163
+ * a provider reference from `uploadFile`
164
+ * - `{ type: 'text', text }`: inline text content (tagged only)
165
+ */
166
+ data: FileData | DataContent | URL | ProviderReference;
167
+ /**
168
+ * Optional filename of the file.
169
+ */
170
+ filename?: string;
171
+ /**
172
+ * Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
173
+ * the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
174
+ *
175
+ * `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
176
+ * top-level segment alone (e.g. `image`). Providers can use the helpers in
177
+ * `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
178
+ * `detectMediaType`) to resolve the field according to their API
179
+ * requirements.
180
+ *
181
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
182
+ */
183
+ mediaType: string;
184
+ /**
185
+ * Additional provider-specific metadata. They are passed through
186
+ * to the provider from the AI SDK and enable provider-specific
187
+ * functionality that can be fully encapsulated in the provider.
188
+ */
189
+ providerOptions?: ProviderOptions;
190
+ }
191
+ /**
192
+ * Reasoning content part of a prompt. It contains a reasoning.
193
+ */
194
+ interface ReasoningPart {
195
+ type: 'reasoning';
196
+ /**
197
+ * The reasoning text.
198
+ */
199
+ text: string;
200
+ /**
201
+ * Additional provider-specific metadata. They are passed through
202
+ * to the provider from the AI SDK and enable provider-specific
203
+ * functionality that can be fully encapsulated in the provider.
204
+ */
205
+ providerOptions?: ProviderOptions;
206
+ }
207
+ /**
208
+ * Custom content part of a prompt. It contains no standardized payload beyond
209
+ * provider-specific options.
210
+ */
211
+ interface CustomPart {
212
+ type: 'custom';
213
+ /**
214
+ * The kind of custom content, in the format `{provider}.{provider-type}`.
215
+ */
216
+ kind: `${string}.${string}`;
217
+ /**
218
+ * Additional provider-specific metadata. They are passed through
219
+ * to the provider from the AI SDK and enable provider-specific
220
+ * functionality that can be fully encapsulated in the provider.
221
+ */
222
+ providerOptions?: ProviderOptions;
223
+ }
224
+ /**
225
+ * Reasoning file content part of a prompt. It contains a file generated as part of reasoning.
226
+ */
227
+ interface ReasoningFilePart {
228
+ type: 'reasoning-file';
229
+ /**
230
+ * Reasoning file data.
231
+ *
232
+ * Reasoning files originate from a model's reasoning output and are always
233
+ * raw bytes or a fetchable URL. Unlike `FilePart.data`, the `reference` and
234
+ * `text` shapes are not supported here: provider references describe files
235
+ * uploaded by the user (not produced as model output), and reasoning text is
236
+ * carried by `ReasoningPart` rather than as a file.
237
+ *
238
+ * Either a tagged shape or a bare shorthand:
239
+ *
240
+ * - `{ type: 'data', data }` or bare `DataContent`: raw bytes
241
+ * (base64 string, Uint8Array, ArrayBuffer, Buffer)
242
+ * - `{ type: 'url', url }` or bare `URL`: a URL that points to the file
243
+ */
244
+ data: FileDataData | FileDataUrl | DataContent | URL;
245
+ /**
246
+ * IANA media type of the file.
247
+ *
248
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
249
+ */
250
+ mediaType: string;
251
+ /**
252
+ * Additional provider-specific metadata. They are passed through
253
+ * to the provider from the AI SDK and enable provider-specific
254
+ * functionality that can be fully encapsulated in the provider.
255
+ */
256
+ providerOptions?: ProviderOptions;
257
+ }
258
+ /**
259
+ * Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
260
+ */
261
+ interface ToolCallPart {
262
+ type: 'tool-call';
263
+ /**
264
+ * ID of the tool call. This ID is used to match the tool call with the tool result.
265
+ */
266
+ toolCallId: string;
267
+ /**
268
+ * Name of the tool that is being called.
269
+ */
270
+ toolName: string;
271
+ /**
272
+ * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
273
+ */
274
+ input: unknown;
275
+ /**
276
+ * Additional provider-specific metadata. They are passed through
277
+ * to the provider from the AI SDK and enable provider-specific
278
+ * functionality that can be fully encapsulated in the provider.
279
+ */
280
+ providerOptions?: ProviderOptions;
281
+ /**
282
+ * Whether the tool call was executed by the provider.
283
+ */
284
+ providerExecuted?: boolean;
285
+ }
286
+ /**
287
+ * Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
288
+ */
289
+ interface ToolResultPart {
290
+ type: 'tool-result';
291
+ /**
292
+ * ID of the tool call that this result is associated with.
293
+ */
294
+ toolCallId: string;
295
+ /**
296
+ * Name of the tool that generated this result.
297
+ */
298
+ toolName: string;
299
+ /**
300
+ * Result of the tool call. This is a JSON-serializable object.
301
+ */
302
+ output: ToolResultOutput;
303
+ /**
304
+ * Additional provider-specific metadata. They are passed through
305
+ * to the provider from the AI SDK and enable provider-specific
306
+ * functionality that can be fully encapsulated in the provider.
307
+ */
308
+ providerOptions?: ProviderOptions;
309
+ }
310
+ /**
311
+ * Output of a tool result.
312
+ */
313
+ type ToolResultOutput = {
314
+ /**
315
+ * Text tool output that should be directly sent to the API.
316
+ */
317
+ type: 'text';
318
+ value: string;
319
+ /**
320
+ * Provider-specific options.
321
+ */
322
+ providerOptions?: ProviderOptions;
323
+ } | {
324
+ type: 'json';
325
+ value: JSONValue;
326
+ /**
327
+ * Provider-specific options.
328
+ */
329
+ providerOptions?: ProviderOptions;
330
+ } | {
331
+ /**
332
+ * Type when the user has denied the execution of the tool call.
333
+ */
334
+ type: 'execution-denied';
335
+ /**
336
+ * Optional reason for the execution denial.
337
+ */
338
+ reason?: string;
339
+ /**
340
+ * Provider-specific options.
341
+ */
342
+ providerOptions?: ProviderOptions;
343
+ } | {
344
+ type: 'error-text';
345
+ value: string;
346
+ /**
347
+ * Provider-specific options.
348
+ */
349
+ providerOptions?: ProviderOptions;
350
+ } | {
351
+ type: 'error-json';
352
+ value: JSONValue;
353
+ /**
354
+ * Provider-specific options.
355
+ */
356
+ providerOptions?: ProviderOptions;
357
+ } | {
358
+ type: 'content';
359
+ value: Array<{
360
+ type: 'text';
361
+ /**
362
+ * Text content.
363
+ */
364
+ text: string;
365
+ /**
366
+ * Provider-specific options.
367
+ */
368
+ providerOptions?: ProviderOptions;
369
+ } | {
370
+ type: 'file';
371
+ /**
372
+ * File data as a tagged discriminated union:
373
+ *
374
+ * - `{ type: 'data', data }`: raw bytes
375
+ * (base64 string, Uint8Array, ArrayBuffer, Buffer)
376
+ * - `{ type: 'url', url }`: a URL that points to the file
377
+ * - `{ type: 'reference', reference }`: a provider reference
378
+ * from `uploadFile`
379
+ * - `{ type: 'text', text }`: inline text content (e.g. an inline
380
+ * text document)
381
+ */
382
+ data: FileData;
383
+ /**
384
+ * Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
385
+ * the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
386
+ *
387
+ * `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
388
+ * top-level segment alone (e.g. `image`). Providers can use the helpers in
389
+ * `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
390
+ * `detectMediaType`) to resolve the field according to their API
391
+ * requirements.
392
+ *
393
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
394
+ */
395
+ mediaType: string;
396
+ /**
397
+ * Optional filename of the file.
398
+ */
399
+ filename?: string;
400
+ /**
401
+ * Provider-specific options.
402
+ */
403
+ providerOptions?: ProviderOptions;
404
+ } | {
405
+ /**
406
+ * @deprecated Use 'file' with mediaType + tagged data instead:
407
+ * `{ type: 'file', mediaType, data: { type: 'data', data } }`.
408
+ */
409
+ type: 'file-data';
410
+ /**
411
+ * Base-64 encoded media data.
412
+ */
413
+ data: string;
414
+ /**
415
+ * IANA media type.
416
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
417
+ */
418
+ mediaType: string;
419
+ /**
420
+ * Optional filename of the file.
421
+ */
422
+ filename?: string;
423
+ /**
424
+ * Provider-specific options.
425
+ */
426
+ providerOptions?: ProviderOptions;
427
+ } | {
428
+ /**
429
+ * @deprecated Use 'file' with mediaType and tagged data instead:
430
+ * `{ type: 'file', mediaType, data: { type: 'url', url: new URL(url) } }`.
431
+ */
432
+ type: 'file-url';
433
+ /**
434
+ * URL of the file.
435
+ */
436
+ url: string;
437
+ /**
438
+ * IANA media type.
439
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
440
+ */
441
+ mediaType?: string;
442
+ /**
443
+ * Provider-specific options.
444
+ */
445
+ providerOptions?: ProviderOptions;
446
+ } | {
447
+ /**
448
+ * @deprecated Use 'file' with tagged data instead:
449
+ * `{ type: 'file', mediaType, data: { type: 'reference', reference } }`.
450
+ */
451
+ type: 'file-id';
452
+ /**
453
+ * ID of the file.
454
+ *
455
+ * If you use multiple providers, you need to
456
+ * specify the provider specific ids using
457
+ * the Record option. The key is the provider
458
+ * name, e.g. 'openai' or 'anthropic'.
459
+ */
460
+ fileId: string | Record<string, string>;
461
+ /**
462
+ * Provider-specific options.
463
+ */
464
+ providerOptions?: ProviderOptions;
465
+ } | {
466
+ /**
467
+ * @deprecated Use 'file' with tagged data instead:
468
+ * `{ type: 'file', mediaType, data: { type: 'reference', reference } }`.
469
+ */
470
+ type: 'file-reference';
471
+ /**
472
+ * Provider-specific references for the file.
473
+ * The key is the provider name, e.g. 'openai' or 'anthropic'.
474
+ */
475
+ providerReference: ProviderReference;
476
+ /**
477
+ * Provider-specific options.
478
+ */
479
+ providerOptions?: ProviderOptions;
480
+ } | {
481
+ /**
482
+ * @deprecated Use 'file' with mediaType (e.g. 'image' or a specific
483
+ * `image/*` subtype) and tagged data instead:
484
+ * `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
485
+ */
486
+ type: 'image-data';
487
+ /**
488
+ * Base-64 encoded image data.
489
+ */
490
+ data: string;
491
+ /**
492
+ * IANA media type.
493
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
494
+ */
495
+ mediaType: string;
496
+ /**
497
+ * Provider-specific options.
498
+ */
499
+ providerOptions?: ProviderOptions;
500
+ } | {
501
+ /**
502
+ * @deprecated Use 'file' with `mediaType: 'image'` (or a specific
503
+ * `image/*` subtype) and tagged data instead:
504
+ * `{ type: 'file', mediaType: 'image', data: { type: 'url', url: new URL(url) } }`.
505
+ */
506
+ type: 'image-url';
507
+ /**
508
+ * URL of the image.
509
+ */
510
+ url: string;
511
+ /**
512
+ * Provider-specific options.
513
+ */
514
+ providerOptions?: ProviderOptions;
515
+ } | {
516
+ /**
517
+ * @deprecated Use 'file' with `mediaType: 'image'` (or a specific
518
+ * `image/*` subtype) and tagged data instead:
519
+ * `{ type: 'file', mediaType: 'image', data: { type: 'reference', reference } }`.
520
+ */
521
+ type: 'image-file-id';
522
+ /**
523
+ * Image that is referenced using a provider file id.
524
+ *
525
+ * If you use multiple providers, you need to
526
+ * specify the provider specific ids using
527
+ * the Record option. The key is the provider
528
+ * name, e.g. 'openai' or 'anthropic'.
529
+ */
530
+ fileId: string | Record<string, string>;
531
+ /**
532
+ * Provider-specific options.
533
+ */
534
+ providerOptions?: ProviderOptions;
535
+ } | {
536
+ /**
537
+ * @deprecated Use 'file' with `mediaType: 'image'` (or a specific
538
+ * `image/*` subtype) and tagged data instead:
539
+ * `{ type: 'file', mediaType: 'image', data: { type: 'reference', reference } }`.
540
+ */
541
+ type: 'image-file-reference';
542
+ /**
543
+ * Provider-specific references for the image file.
544
+ * The key is the provider name, e.g. 'openai' or 'anthropic'.
545
+ */
546
+ providerReference: ProviderReference;
547
+ /**
548
+ * Provider-specific options.
549
+ */
550
+ providerOptions?: ProviderOptions;
551
+ } | {
552
+ /**
553
+ * Custom content part. This can be used to implement
554
+ * provider-specific content parts.
555
+ */
556
+ type: 'custom';
557
+ /**
558
+ * Provider-specific options.
559
+ */
560
+ providerOptions?: ProviderOptions;
561
+ }>;
562
+ };
563
+ //#endregion
564
+ //#region src/types/context.d.ts
565
+ /**
566
+ * A context object that is passed into tool execution.
567
+ */
568
+ type Context$1 = Record<string, unknown>;
569
+ //#endregion
570
+ //#region src/types/tool-approval-request.d.ts
571
+ /**
572
+ * Tool approval request prompt part.
573
+ */
574
+ type ToolApprovalRequest = {
575
+ type: 'tool-approval-request';
576
+ /**
577
+ * ID of the tool approval.
578
+ */
579
+ approvalId: string;
580
+ /**
581
+ * ID of the tool call that the approval request is for.
582
+ */
583
+ toolCallId: string;
584
+ /**
585
+ * Reason why the tool call requires approval.
586
+ */
587
+ reason?: string;
588
+ /**
589
+ * Flag indicating whether the tool was automatically approved or denied.
590
+ *
591
+ * @default false
592
+ */
593
+ isAutomatic?: boolean;
594
+ /**
595
+ * HMAC-SHA256 signature binding this approval to its tool call.
596
+ * Present only when `experimental_toolApprovalSecret` is configured.
597
+ */
598
+ signature?: string;
599
+ /**
600
+ * Tool input before input schema validation and transformation.
601
+ *
602
+ * This is included when it differs from the validated tool input so that
603
+ * approved tool calls can be safely revalidated before execution.
604
+ */
605
+ inputSchemaInput?: unknown;
606
+ };
607
+ //#endregion
608
+ //#region src/types/assistant-model-message.d.ts
609
+ /**
610
+ * An assistant message. It can contain text, tool calls, or a combination of text and tool calls.
611
+ */
612
+ type AssistantModelMessage = {
613
+ role: 'assistant';
614
+ content: AssistantContent;
615
+ /**
616
+ * Additional provider-specific metadata. They are passed through
617
+ * to the provider from the AI SDK and enable provider-specific
618
+ * functionality that can be fully encapsulated in the provider.
619
+ */
620
+ providerOptions?: ProviderOptions;
621
+ };
622
+ /**
623
+ * Content of an assistant message.
624
+ * It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
625
+ */
626
+ type AssistantContent = string | Array<TextPart | CustomPart | FilePart | ReasoningPart | ReasoningFilePart | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
627
+ //#endregion
628
+ //#region src/types/system-model-message.d.ts
629
+ /**
630
+ * A system message. It can contain system information.
631
+ *
632
+ * Note: using the "system" part of the prompt is strongly preferred
633
+ * to increase the resilience against prompt injection attacks,
634
+ * and because not all providers support several system messages.
635
+ */
636
+ type SystemModelMessage = {
637
+ role: 'system';
638
+ content: string;
639
+ /**
640
+ * Additional provider-specific metadata. They are passed through
641
+ * to the provider from the AI SDK and enable provider-specific
642
+ * functionality that can be fully encapsulated in the provider.
643
+ */
644
+ providerOptions?: ProviderOptions;
645
+ };
646
+ //#endregion
647
+ //#region src/types/tool-approval-response.d.ts
648
+ /**
649
+ * Tool approval response prompt part.
650
+ */
651
+ type ToolApprovalResponse = {
652
+ type: 'tool-approval-response';
653
+ /**
654
+ * ID of the tool approval.
655
+ */
656
+ approvalId: string;
657
+ /**
658
+ * Flag indicating whether the approval was granted or denied.
659
+ */
660
+ approved: boolean;
661
+ /**
662
+ * Optional reason for the approval or denial.
663
+ *
664
+ * For denied tool calls, the reason is included in the `execution-denied`
665
+ * tool result that is sent to the model. For approved tool calls that are
666
+ * executed by the SDK, the reason remains in the message history: it is not
667
+ * included in the model prompt and is not exposed through a dedicated tool
668
+ * execution option. For provider-executed tools, the approval response
669
+ * (including the reason) is forwarded to the provider.
670
+ */
671
+ reason?: string;
672
+ /**
673
+ * Flag indicating whether the tool call is provider-executed.
674
+ * Only provider-executed tool approval responses should be sent to the model.
675
+ */
676
+ providerExecuted?: boolean;
677
+ };
678
+ //#endregion
679
+ //#region src/types/tool-model-message.d.ts
680
+ /**
681
+ * A tool message. It contains the result of one or more tool calls.
682
+ */
683
+ type ToolModelMessage = {
684
+ role: 'tool';
685
+ content: ToolContent;
686
+ /**
687
+ * Additional provider-specific metadata. They are passed through
688
+ * to the provider from the AI SDK and enable provider-specific
689
+ * functionality that can be fully encapsulated in the provider.
690
+ */
691
+ providerOptions?: ProviderOptions;
692
+ };
693
+ /**
694
+ * Content of a tool message. It is an array of tool result parts.
695
+ */
696
+ type ToolContent = Array<ToolResultPart | ToolApprovalResponse>;
697
+ //#endregion
698
+ //#region src/types/user-model-message.d.ts
699
+ /**
700
+ * A user message. It can contain text or a combination of text and images.
701
+ */
702
+ type UserModelMessage = {
703
+ role: 'user';
704
+ content: UserContent;
705
+ /**
706
+ * Additional provider-specific metadata. They are passed through
707
+ * to the provider from the AI SDK and enable provider-specific
708
+ * functionality that can be fully encapsulated in the provider.
709
+ */
710
+ providerOptions?: ProviderOptions;
711
+ };
712
+ /**
713
+ * Content of a user message. It can be a string or an array of text and image parts.
714
+ */
715
+ type UserContent = string | Array<TextPart | ImagePart | FilePart>;
716
+ //#endregion
717
+ //#region src/types/model-message.d.ts
718
+ /**
719
+ * A message that can be used in the `messages` field of a prompt.
720
+ * It can be a user message, an assistant message, or a tool message.
721
+ */
722
+ type ModelMessage = SystemModelMessage | UserModelMessage | AssistantModelMessage | ToolModelMessage;
723
+ //#endregion
724
+ //#region src/gen-ai-format-messages.d.ts
725
+ type SemConvPart = {
726
+ type: 'text';
727
+ content: string;
728
+ } | {
729
+ type: 'reasoning';
730
+ content: string;
731
+ } | {
732
+ type: 'tool_call';
733
+ id: string | null;
734
+ name: string;
735
+ arguments?: unknown;
736
+ } | {
737
+ type: 'tool_call_response';
738
+ id: string | null;
739
+ response: unknown;
740
+ } | {
741
+ type: 'blob';
742
+ modality: string;
743
+ mime_type: string | null;
744
+ content: string;
745
+ } | {
746
+ type: string;
747
+ [key: string]: unknown;
748
+ };
749
+ interface SemConvInputMessage {
750
+ role: string;
751
+ parts: SemConvPart[];
752
+ }
753
+ interface SemConvOutputMessage {
754
+ role: string;
755
+ parts: SemConvPart[];
756
+ finish_reason: string;
757
+ }
758
+ interface SemConvSystemInstruction {
759
+ type: string;
760
+ content?: string;
761
+ [key: string]: unknown;
762
+ }
763
+ /**
764
+ * Converts a system value to the gen_ai.system_instructions SemConv format.
765
+ * Accepts a plain string, a single SystemModelMessage, or an array of them.
766
+ * Schema: array of parts, each with at least { type, content }.
767
+ */
768
+ export declare function formatSystemInstructions(system: string | {
769
+ role: 'system';
770
+ content: string;
771
+ } | Array<{
772
+ role: 'system';
773
+ content: string;
774
+ }>): SemConvSystemInstruction[];
775
+ /**
776
+ * Converts a LanguageModelV4Prompt to the gen_ai.input.messages SemConv format.
777
+ * Messages are preserved in the order they were sent to the model.
778
+ */
779
+ export declare function formatInputMessages(prompt: LanguageModelV4Prompt): SemConvInputMessage[];
780
+ /**
781
+ * Converts user-facing ModelMessage[] (and optional prompt string) to the
782
+ * gen_ai.input.messages SemConv format while preserving message order.
783
+ */
784
+ export declare function formatModelMessages({ prompt, messages }: {
785
+ prompt: string | Array<ModelMessage> | undefined;
786
+ messages: Array<ModelMessage> | undefined;
787
+ }): SemConvInputMessage[];
788
+ /**
789
+ * Converts step result data to the gen_ai.output.messages SemConv format.
790
+ */
791
+ export declare function formatOutputMessages({ text, reasoning, toolCalls, toolResults, files, finishReason }: {
792
+ text?: string;
793
+ reasoning?: ReadonlyArray<{
794
+ text?: string;
795
+ }>;
796
+ toolCalls?: ReadonlyArray<{
797
+ toolCallId: string;
798
+ toolName: string;
799
+ input: unknown;
800
+ }>;
801
+ toolResults?: ReadonlyArray<{
802
+ toolCallId: string;
803
+ output: unknown;
804
+ }>;
805
+ files?: ReadonlyArray<{
806
+ mediaType: string;
807
+ base64: string;
808
+ }>;
809
+ finishReason: string;
810
+ }): SemConvOutputMessage[];
811
+ /**
812
+ * Converts generateObject result to the gen_ai.output.messages SemConv format.
813
+ */
814
+ export declare function formatObjectOutputMessages({ objectText, finishReason }: {
815
+ objectText: string;
816
+ finishReason: string;
817
+ }): SemConvOutputMessage[];
818
+ //#endregion
38
819
  //#region src/supplemental-attributes.d.ts
39
820
  type OpenTelemetrySpanType = 'operation' | 'step' | 'languageModel' | 'tool' | 'embedding' | 'reranking' | 'experimental_decision';
40
821
  type EnrichSpan = (options: {
@@ -202,19 +983,6 @@ export declare class OpenTelemetry implements Telemetry {
202
983
  onError(error: unknown): void;
203
984
  }
204
985
  //#endregion
205
- //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/schemas.d.cts
206
- declare global {
207
- interface File {}
208
- }
209
- //#endregion
210
- //#region ../provider-utils/dist/index.d.ts
211
- //#endregion
212
- //#region src/types/context.d.ts
213
- /**
214
- * A context object that is passed into tool execution.
215
- */
216
- type Context$1 = Record<string, unknown>;
217
- //#endregion
218
986
  //#region src/legacy-open-telemetry.d.ts
219
987
  interface OtelStepStartEvent<TOOLS extends ToolSet = ToolSet, RUNTIME_CONTEXT extends Context$1 = Context$1, OUTPUT extends Output.Output = Output.Output> extends GenerateTextStepStartEvent<TOOLS, RUNTIME_CONTEXT, OUTPUT> {
220
988
  readonly promptMessages?: LanguageModelV4Prompt;
@@ -292,5 +1060,5 @@ export declare class LegacyOpenTelemetry implements Telemetry {
292
1060
  onError(error: unknown): void;
293
1061
  }
294
1062
  //#endregion
295
- export type { EnrichSpan, OpenTelemetryOptions, OpenTelemetrySpanType };
1063
+ export type { EnrichSpan, OpenTelemetryOptions, OpenTelemetrySpanType, SemConvInputMessage, SemConvOutputMessage, SemConvPart, SemConvSystemInstruction };
296
1064
  //# sourceMappingURL=index.d.ts.map