ai 7.0.113 → 7.0.114

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 (73) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +6 -6
  3. package/dist/index.js +64 -44
  4. package/dist/index.js.map +1 -1
  5. package/dist/internal/index.js +78 -51
  6. package/dist/internal/index.js.map +1 -1
  7. package/docs/02-foundations/02-providers-and-models.mdx +3 -0
  8. package/docs/02-foundations/03-prompts.mdx +1 -1
  9. package/docs/02-foundations/04-tools.mdx +2 -2
  10. package/docs/02-foundations/06-provider-options.mdx +11 -11
  11. package/docs/02-getting-started/00-choosing-a-provider.mdx +4 -4
  12. package/docs/02-getting-started/02-nextjs-app-router.mdx +3 -3
  13. package/docs/02-getting-started/03-nextjs-pages-router.mdx +3 -3
  14. package/docs/02-getting-started/04-svelte.mdx +7 -7
  15. package/docs/02-getting-started/05-nuxt.mdx +7 -7
  16. package/docs/02-getting-started/06-nodejs.mdx +3 -3
  17. package/docs/02-getting-started/07-expo.mdx +3 -3
  18. package/docs/02-getting-started/08-tanstack-start.mdx +3 -3
  19. package/docs/02-getting-started/09-coding-agents.mdx +1 -1
  20. package/docs/03-agents/03-workflows.mdx +2 -2
  21. package/docs/03-agents/04-loop-control.mdx +1 -1
  22. package/docs/03-agents/05-configuring-call-options.mdx +4 -2
  23. package/docs/03-agents/06-memory.mdx +2 -2
  24. package/docs/03-agents/06-policy-tool-approvals.mdx +2 -2
  25. package/docs/03-agents/07-workflow-agent.mdx +11 -11
  26. package/docs/03-agents/08-terminal-ui.mdx +2 -2
  27. package/docs/03-ai-sdk-core/05-generating-text.mdx +2 -2
  28. package/docs/03-ai-sdk-core/17-mcp-apps.mdx +1 -1
  29. package/docs/03-ai-sdk-core/20-prompt-engineering.mdx +1 -1
  30. package/docs/03-ai-sdk-core/26-reasoning.mdx +13 -12
  31. package/docs/03-ai-sdk-core/31-reranking.mdx +12 -10
  32. package/docs/03-ai-sdk-core/32-evaluation.mdx +1 -1
  33. package/docs/03-ai-sdk-core/35-image-generation.mdx +2 -2
  34. package/docs/03-ai-sdk-core/37-speech.mdx +6 -6
  35. package/docs/03-ai-sdk-core/39-file-uploads.mdx +1 -1
  36. package/docs/03-ai-sdk-core/41-skill-uploads.mdx +1 -1
  37. package/docs/03-ai-sdk-core/42-batch.mdx +1 -1
  38. package/docs/03-ai-sdk-core/45-provider-management.mdx +21 -21
  39. package/docs/03-ai-sdk-core/60-telemetry.mdx +1 -1
  40. package/docs/03-ai-sdk-core/65-devtools.mdx +3 -3
  41. package/docs/03-ai-sdk-core/65-lifecycle-callbacks.mdx +1 -1
  42. package/docs/04-ai-sdk-ui/02-chatbot.mdx +3 -3
  43. package/docs/04-ai-sdk-ui/03-chatbot-message-persistence.mdx +3 -3
  44. package/docs/04-ai-sdk-ui/03-chatbot-resume-streams.mdx +1 -1
  45. package/docs/05-ai-sdk-rsc/02-streaming-react-components.mdx +5 -5
  46. package/docs/05-ai-sdk-rsc/04-multistep-interfaces.mdx +1 -1
  47. package/docs/05-ai-sdk-rsc/06-loading-state.mdx +1 -1
  48. package/docs/05-ai-sdk-rsc/10-migrating-to-ui.mdx +3 -3
  49. package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +5 -3
  50. package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +5 -3
  51. package/docs/07-reference/01-ai-sdk-core/06-rerank.mdx +5 -5
  52. package/docs/07-reference/01-ai-sdk-core/11-transcribe.mdx +1 -1
  53. package/docs/07-reference/01-ai-sdk-core/12-generate-speech.mdx +2 -2
  54. package/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +4 -2
  55. package/docs/07-reference/01-ai-sdk-core/20-start-batch.mdx +1 -1
  56. package/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +1 -1
  57. package/docs/07-reference/01-ai-sdk-core/42-custom-provider.mdx +4 -4
  58. package/docs/07-reference/01-ai-sdk-core/60-wrap-language-model.mdx +1 -1
  59. package/docs/07-reference/01-ai-sdk-core/61-wrap-image-model.mdx +1 -1
  60. package/docs/07-reference/02-ai-sdk-ui/50-direct-chat-transport.mdx +3 -3
  61. package/docs/07-reference/03-ai-sdk-rsc/01-stream-ui.mdx +1 -1
  62. package/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +8 -8
  63. package/docs/07-reference/06-ai-sdk-tui/01-run-agent-tui.mdx +1 -1
  64. package/docs/09-troubleshooting/11-use-chat-custom-request-options.mdx +3 -3
  65. package/docs/09-troubleshooting/13-repeated-assistant-messages.mdx +2 -2
  66. package/docs/09-troubleshooting/17-use-chat-stale-body-data.mdx +1 -1
  67. package/docs/09-troubleshooting/70-high-memory-usage-with-images.mdx +2 -2
  68. package/package.json +6 -6
  69. package/src/evaluate/evaluate.ts +1 -10
  70. package/src/generate-text/restricted-telemetry-dispatcher.ts +6 -58
  71. package/src/prompt/standardize-prompt.ts +2 -0
  72. package/src/telemetry/create-telemetry-dispatcher.ts +58 -6
  73. package/src/telemetry/filter-included-context.ts +57 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.114
4
+
5
+ ### Patch Changes
6
+
7
+ - b5679a7: fix(ai): filter tracing-channel context with telemetry allowlists
8
+ - ca31b89: Clarify in the prompt validation code that `allowSystemInMessages` permits all system messages, including instruction text.
9
+ - Updated dependencies [124b6ef]
10
+ - @ai-sdk/gateway@4.0.92
11
+
3
12
  ## 7.0.113
4
13
 
5
14
  ### Patch Changes
package/README.md CHANGED
@@ -30,7 +30,7 @@ By default, the AI SDK uses the [Vercel AI Gateway](https://vercel.com/docs/ai-g
30
30
 
31
31
  ```ts
32
32
  const result = await generateText({
33
- model: 'anthropic/claude-opus-4.6', // or 'openai/gpt-5.4', 'google/gemini-3-flash', etc.
33
+ model: 'anthropic/claude-opus-5.5', // or 'openai/gpt-6-astra', 'google/gemini-3.8-flash', etc.
34
34
  prompt: 'Hello!',
35
35
  });
36
36
  ```
@@ -45,7 +45,7 @@ npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google
45
45
  import { anthropic } from '@ai-sdk/anthropic';
46
46
 
47
47
  const result = await generateText({
48
- model: anthropic('claude-opus-4-6'), // or openai('gpt-5.4'), google('gemini-3-flash'), etc.
48
+ model: anthropic('claude-opus-5-5'), // or openai('gpt-6-astra'), google('gemini-3.8-flash'), etc.
49
49
  prompt: 'Hello!',
50
50
  });
51
51
  ```
@@ -58,7 +58,7 @@ const result = await generateText({
58
58
  import { generateText } from 'ai';
59
59
 
60
60
  const { text } = await generateText({
61
- model: 'openai/gpt-5.4', // use Vercel AI Gateway
61
+ model: 'openai/gpt-6-astra', // use Vercel AI Gateway
62
62
  prompt: 'What is an agent?',
63
63
  });
64
64
  ```
@@ -70,7 +70,7 @@ import { generateText, Output } from 'ai';
70
70
  import { z } from 'zod';
71
71
 
72
72
  const { output } = await generateText({
73
- model: 'openai/gpt-5.4',
73
+ model: 'openai/gpt-6-astra',
74
74
  output: Output.object({
75
75
  schema: z.object({
76
76
  recipe: z.object({
@@ -92,7 +92,7 @@ const { output } = await generateText({
92
92
  import { ToolLoopAgent } from 'ai';
93
93
 
94
94
  const sandboxAgent = new ToolLoopAgent({
95
- model: 'openai/gpt-5.4',
95
+ model: 'openai/gpt-6-astra',
96
96
  system: 'You are an agent with access to a shell environment.',
97
97
  tools: {
98
98
  shell: openai.tools.localShell({
@@ -124,7 +124,7 @@ import { openai } from '@ai-sdk/openai';
124
124
  import { ToolLoopAgent, InferAgentUIMessage } from 'ai';
125
125
 
126
126
  export const imageGenerationAgent = new ToolLoopAgent({
127
- model: 'openai/gpt-5.4',
127
+ model: 'openai/gpt-6-astra',
128
128
  tools: {
129
129
  generateImage: openai.tools.imageGeneration({
130
130
  partialImages: 3,
package/dist/index.js CHANGED
@@ -1334,7 +1334,7 @@ import {
1334
1334
  } from "@ai-sdk/provider-utils";
1335
1335
 
1336
1336
  // src/version.ts
1337
- var VERSION = true ? "7.0.113" : "0.0.0-test";
1337
+ var VERSION = true ? "7.0.114" : "0.0.0-test";
1338
1338
 
1339
1339
  // src/util/download/download.ts
1340
1340
  var download = async ({
@@ -4948,6 +4948,35 @@ function filterIncludedContext({
4948
4948
  )
4949
4949
  );
4950
4950
  }
4951
+ function filterToolsContext({
4952
+ toolsContext,
4953
+ includeToolsContext
4954
+ }) {
4955
+ if (includeToolsContext == null) {
4956
+ return {};
4957
+ }
4958
+ return Object.fromEntries(
4959
+ Object.entries(toolsContext).map(([toolName, toolContext]) => [
4960
+ toolName,
4961
+ filterToolContext({
4962
+ toolName,
4963
+ toolContext,
4964
+ includeToolsContext
4965
+ })
4966
+ ])
4967
+ );
4968
+ }
4969
+ function filterToolContext({
4970
+ toolName,
4971
+ toolContext,
4972
+ includeToolsContext
4973
+ }) {
4974
+ const includeToolContext = includeToolsContext == null ? void 0 : includeToolsContext[toolName];
4975
+ return filterIncludedContext({
4976
+ context: toolContext,
4977
+ includeContext: includeToolContext
4978
+ });
4979
+ }
4951
4980
 
4952
4981
  // src/telemetry/create-telemetry-dispatcher.ts
4953
4982
  import { asArray as asArray4 } from "@ai-sdk/provider-utils";
@@ -5119,12 +5148,37 @@ function getGlobalTelemetryIntegrations() {
5119
5148
  }
5120
5149
 
5121
5150
  // src/telemetry/create-telemetry-dispatcher.ts
5122
- function augmentEvent(event, telemetry) {
5123
- return Object.assign(
5151
+ function augmentEvent(event, telemetry, filterContext = false) {
5152
+ const augmentedEvent = Object.assign(
5124
5153
  Object.create(Object.getPrototypeOf(event)),
5125
5154
  event,
5126
- telemetry
5155
+ {
5156
+ recordInputs: telemetry.recordInputs,
5157
+ recordOutputs: telemetry.recordOutputs,
5158
+ functionId: telemetry.functionId
5159
+ }
5127
5160
  );
5161
+ if (filterContext && event != null && typeof event === "object" && "runtimeContext" in event) {
5162
+ augmentedEvent.runtimeContext = filterIncludedContext({
5163
+ context: event.runtimeContext,
5164
+ includeContext: telemetry.includeRuntimeContext
5165
+ });
5166
+ }
5167
+ if (filterContext && event != null && typeof event === "object") {
5168
+ if ("toolsContext" in event) {
5169
+ augmentedEvent.toolsContext = filterToolsContext({
5170
+ toolsContext: event.toolsContext,
5171
+ includeToolsContext: telemetry.includeToolsContext
5172
+ });
5173
+ } else if ("toolContext" in event && event.toolContext != null && "toolCall" in event && event.toolCall != null && typeof event.toolCall === "object" && "toolName" in event.toolCall) {
5174
+ augmentedEvent.toolContext = filterToolContext({
5175
+ toolName: event.toolCall.toolName,
5176
+ toolContext: event.toolContext,
5177
+ includeToolsContext: telemetry.includeToolsContext
5178
+ });
5179
+ }
5180
+ }
5181
+ return augmentedEvent;
5128
5182
  }
5129
5183
  function createTelemetryDispatcher({
5130
5184
  telemetry
@@ -5137,7 +5191,9 @@ function createTelemetryDispatcher({
5137
5191
  const telemetryMetadata = {
5138
5192
  recordInputs: telemetry == null ? void 0 : telemetry.recordInputs,
5139
5193
  recordOutputs: telemetry == null ? void 0 : telemetry.recordOutputs,
5140
- functionId: telemetry == null ? void 0 : telemetry.functionId
5194
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
5195
+ includeRuntimeContext: telemetry == null ? void 0 : telemetry.includeRuntimeContext,
5196
+ includeToolsContext: telemetry == null ? void 0 : telemetry.includeToolsContext
5141
5197
  };
5142
5198
  const mergeTelemetryCallback = (key) => {
5143
5199
  const integrationCallbacks = integrations.map((integration) => {
@@ -5163,14 +5219,14 @@ function createTelemetryDispatcher({
5163
5219
  runInTracingChannelSpan: async ({ type, event, execute }) => await runWithTracingChannelSpan(
5164
5220
  {
5165
5221
  type,
5166
- event: augmentEvent(event, telemetryMetadata)
5222
+ event: augmentEvent(event, telemetryMetadata, true)
5167
5223
  },
5168
5224
  execute
5169
5225
  ),
5170
5226
  startTracingChannelContext: ({ type, event, completion }) => openTelemetryChannelSpanContext({
5171
5227
  message: {
5172
5228
  type,
5173
- event: augmentEvent(event, telemetryMetadata)
5229
+ event: augmentEvent(event, telemetryMetadata, true)
5174
5230
  },
5175
5231
  completion
5176
5232
  }),
@@ -5362,35 +5418,6 @@ function restrictStepResult({
5362
5418
  providerMetadata: step.providerMetadata
5363
5419
  });
5364
5420
  }
5365
- function filterToolsContext({
5366
- toolsContext,
5367
- includeToolsContext
5368
- }) {
5369
- if (includeToolsContext == null) {
5370
- return {};
5371
- }
5372
- return Object.fromEntries(
5373
- Object.entries(toolsContext).map(([toolName, toolContext]) => [
5374
- toolName,
5375
- filterToolContext({
5376
- toolName,
5377
- toolContext,
5378
- includeToolsContext
5379
- })
5380
- ])
5381
- );
5382
- }
5383
- function filterToolContext({
5384
- toolName,
5385
- toolContext,
5386
- includeToolsContext
5387
- }) {
5388
- const includeToolContext = includeToolsContext == null ? void 0 : includeToolsContext[toolName];
5389
- return filterIncludedContext({
5390
- context: toolContext,
5391
- includeContext: includeToolContext
5392
- });
5393
- }
5394
5421
  function createRestrictedTelemetryDispatcher({
5395
5422
  telemetry,
5396
5423
  includeRuntimeContext,
@@ -14908,16 +14935,9 @@ async function evaluate({
14908
14935
  headers,
14909
14936
  providerOptions
14910
14937
  };
14911
- const tracingStartEvent = {
14912
- ...startEvent,
14913
- runtimeContext: filterIncludedContext({
14914
- context: runtimeContext,
14915
- includeContext: telemetry == null ? void 0 : telemetry.includeRuntimeContext
14916
- })
14917
- };
14918
14938
  return await runInTracingChannelSpan({
14919
14939
  type: "experimental_evaluate",
14920
- event: tracingStartEvent,
14940
+ event: startEvent,
14921
14941
  execute: async () => {
14922
14942
  var _a26, _b25, _c, _d, _e, _f, _g;
14923
14943
  await notify({