ai 7.0.127 → 7.0.129

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 (100) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/index.d.ts +230 -155
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +386 -209
  5. package/dist/index.js.map +1 -1
  6. package/dist/internal/index.d.ts +288 -70
  7. package/dist/internal/index.d.ts.map +1 -1
  8. package/dist/internal/index.js +407 -76
  9. package/dist/internal/index.js.map +1 -1
  10. package/dist/test/index.d.ts +25 -17
  11. package/dist/test/index.d.ts.map +1 -1
  12. package/dist/test/index.js +27 -21
  13. package/dist/test/index.js.map +1 -1
  14. package/docs/02-foundations/06-provider-options.mdx +11 -10
  15. package/docs/02-getting-started/03-nextjs-pages-router.mdx +1 -1
  16. package/docs/02-getting-started/07-expo.mdx +1 -1
  17. package/docs/03-agents/02-building-agents.mdx +16 -11
  18. package/docs/03-agents/07-workflow-agent.mdx +83 -15
  19. package/docs/03-ai-sdk-core/16-mcp-tools.mdx +44 -0
  20. package/docs/03-ai-sdk-core/17-runtime-and-tool-context.mdx +18 -14
  21. package/docs/03-ai-sdk-core/25-settings.mdx +3 -2
  22. package/docs/03-ai-sdk-core/26-reasoning.mdx +12 -5
  23. package/docs/03-ai-sdk-core/{32-evaluation.mdx → 32-decisions.mdx} +64 -67
  24. package/docs/03-ai-sdk-core/35-image-generation.mdx +3 -1
  25. package/docs/03-ai-sdk-core/45-provider-management.mdx +8 -8
  26. package/docs/03-ai-sdk-core/60-telemetry.mdx +40 -31
  27. package/docs/03-ai-sdk-core/65-lifecycle-callbacks.mdx +21 -22
  28. package/docs/03-ai-sdk-harnesses/08-terminal-ui.mdx +2 -2
  29. package/docs/04-ai-sdk-ui/21-error-handling.mdx +28 -3
  30. package/docs/06-advanced/09-multistep-interfaces.mdx +1 -1
  31. package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +2 -2
  32. package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +2 -2
  33. package/docs/07-reference/01-ai-sdk-core/14-decide.mdx +74 -0
  34. package/docs/07-reference/01-ai-sdk-core/23-create-mcp-client.mdx +58 -4
  35. package/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +11 -11
  36. package/docs/07-reference/01-ai-sdk-core/42-custom-provider.mdx +9 -9
  37. package/docs/07-reference/01-ai-sdk-core/66-extract-reasoning-middleware.mdx +24 -8
  38. package/docs/07-reference/02-ai-sdk-ui/32-prune-messages.mdx +1 -1
  39. package/docs/07-reference/03-ai-sdk-rsc/01-stream-ui.mdx +1 -0
  40. package/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +39 -2
  41. package/docs/07-reference/05-ai-sdk-errors/ai-decision-unsupported-question-type-error.mdx +31 -0
  42. package/docs/07-reference/05-ai-sdk-errors/ai-no-such-model-error.mdx +3 -3
  43. package/docs/07-reference/05-ai-sdk-errors/ai-no-such-provider-error.mdx +3 -3
  44. package/docs/08-migration-guides/23-migration-guide-7-0.mdx +1 -1
  45. package/docs/08-migration-guides/29-migration-guide-4-0.mdx +1 -1
  46. package/docs/09-troubleshooting/05-tool-invocation-missing-result.mdx +2 -2
  47. package/package.json +15 -15
  48. package/src/decide/decide-events.ts +129 -0
  49. package/src/{evaluate/evaluate.ts → decide/decide.ts} +36 -38
  50. package/src/decide/decision-provider.ts +11 -0
  51. package/src/decide/decision-result.ts +39 -0
  52. package/src/decide/index.ts +64 -0
  53. package/src/{evaluate → decide}/restricted-telemetry-dispatcher.ts +7 -7
  54. package/src/{evaluate/validate-evaluation.ts → decide/validate-decision.ts} +9 -9
  55. package/src/error/index.ts +10 -1
  56. package/src/generate-object/generate-object.ts +10 -0
  57. package/src/generate-object/stream-object.ts +10 -0
  58. package/src/generate-speech/generated-audio-file.ts +5 -4
  59. package/src/generate-speech/index.ts +13 -1
  60. package/src/generate-text/default-generate-text-result.ts +127 -0
  61. package/src/generate-text/generate-text.ts +5 -123
  62. package/src/generate-text/tool-approval-signature.ts +7 -4
  63. package/src/global.ts +3 -2
  64. package/src/index.ts +1 -1
  65. package/src/logger/deprecations.ts +72 -0
  66. package/src/logger/log-warnings.ts +25 -3
  67. package/src/middleware/extract-reasoning-middleware.ts +25 -6
  68. package/src/model/as-language-model-v3.ts +4 -0
  69. package/src/model/resolve-model.ts +45 -14
  70. package/src/prompt/convert-to-language-model-prompt.ts +7 -1
  71. package/src/realtime/encode-realtime-frame.ts +7 -2
  72. package/src/registry/custom-provider.ts +38 -26
  73. package/src/registry/index.ts +13 -1
  74. package/src/registry/no-such-provider-error.ts +2 -0
  75. package/src/registry/provider-registry.ts +56 -29
  76. package/src/telemetry/create-telemetry-dispatcher.ts +17 -5
  77. package/src/telemetry/telemetry.ts +35 -19
  78. package/src/telemetry/tracing-channel.ts +1 -1
  79. package/src/test/decision-mock-model-v4.ts +35 -0
  80. package/src/transcribe/index.ts +13 -1
  81. package/src/transcribe/transcribe.ts +1 -1
  82. package/src/types/index.ts +1 -0
  83. package/src/types/language-model.ts +9 -1
  84. package/src/types/usage.ts +21 -0
  85. package/src/ui/chat.ts +25 -9
  86. package/src/ui/convert-to-model-messages.ts +40 -8
  87. package/src/ui/http-chat-transport.ts +5 -3
  88. package/src/ui/process-text-stream.ts +5 -1
  89. package/src/ui/process-ui-message-stream.ts +21 -0
  90. package/src/ui/text-stream-chat-transport.ts +3 -1
  91. package/src/ui/ui-messages.ts +8 -0
  92. package/src/ui/unavailable-tool.ts +17 -0
  93. package/src/ui/validate-ui-messages.ts +10 -2
  94. package/docs/07-reference/01-ai-sdk-core/14-evaluate.mdx +0 -74
  95. package/docs/07-reference/05-ai-sdk-errors/ai-evaluation-unsupported-question-type-error.mdx +0 -31
  96. package/src/evaluate/evaluate-events.ts +0 -131
  97. package/src/evaluate/evaluation-provider.ts +0 -6
  98. package/src/evaluate/evaluation-result.ts +0 -39
  99. package/src/evaluate/index.ts +0 -13
  100. package/src/test/evaluation-mock-model-v4.ts +0 -27
package/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.129
4
+
5
+ ### Patch Changes
6
+
7
+ - e37d213: feat(ai): emit deprecation warnings with stable codes and deduplicate them
8
+ - 73d8343: fix(ai): preserve V2 provider-reported total tokens in raw usage
9
+ - 268225c: feat(provider): add a portable `max` reasoning level with native provider mappings, compatibility coercions, and budget-based fallback support.
10
+
11
+ Compatibility notes:
12
+
13
+ - **TypeScript source compatibility:** Adding `max` widens `LanguageModelV4CallOptions['reasoning']` and the derived `ReasoningLevel` type. Third-party providers and consumers with exhaustive switches or `Record<ReasoningLevel, ...>` mappings must handle `max` before upgrading. Ordinary calls using existing reasoning levels remain accepted.
14
+ - **Amazon Bedrock:** Existing Nova 2 calls using portable `reasoning: 'xhigh'` now send `maxReasoningEffort: 'high'` instead of the unsupported `'max'`, and return a compatibility warning. Anthropic and OpenAI Bedrock effort mappings retain their existing `xhigh` behavior. Partial Bedrock reasoning configurations continue to preserve explicit values and derive missing fields; explicit effort/budget overrides and disabled thinking no longer emit warnings for portable mappings that are not sent.
15
+ - **Fireworks:** Existing portable `minimal` and `xhigh` calls keep their request mappings to `low` and `high`, respectively, and now return compatibility warnings in generation and streaming results. Portable `max` maps to `high` with the same warning behavior.
16
+
17
+ **Release classification:** This remains a patch changeset under the repository's explicit release policy, which uses patch releases for both fixes and features. The TypeScript source-compatibility caveat for exhaustive consumers is disclosed above. Maintainers can override this classification with a `major` label if they decide to align the provider-spec addition with a future AI SDK major release.
18
+
19
+ - d83366e: fix(ai): publish the latest error after repeated failed stream resume attempts
20
+ - 34905a2: fix(ai): preserve provider options from approval-only tool messages
21
+ - 16ab882: fix(ai): recognize WebKit network errors
22
+ - f810ea3: fix(ai): prevent unavailable tools from exposing persisted output to models
23
+ - 19a127b: fix(ai): avoid duplicate slashes in chat reconnect URLs
24
+ - 0af2f7c: chore: upgrade to TypeScript 6
25
+ - 4c6979c: fix(harness): preserve adapter warnings in agent stream results and declare
26
+ their compatibility warning shapes
27
+ - Updated dependencies [fc1e19e]
28
+ - Updated dependencies [5094ebd]
29
+ - Updated dependencies [753f2e1]
30
+ - Updated dependencies [268225c]
31
+ - Updated dependencies [0af2f7c]
32
+ - Updated dependencies [ad64697]
33
+ - Updated dependencies [0c82824]
34
+ - @ai-sdk/provider-utils@5.0.55
35
+ - @ai-sdk/gateway@4.0.105
36
+ - @ai-sdk/provider@4.0.23
37
+
38
+ ## 7.0.128
39
+
40
+ ### Patch Changes
41
+
42
+ - 0fe8c67: fix: preserve tool approval state when resuming streams
43
+ - 2959d35: feat: rename `evaluate` to `decide`
44
+ - 0ca1ab9: Add durable non-streaming `WorkflowAgent.generate()` with a shared tool loop, a 20-step default, typed output, and core generation result semantics. Reuse core result and content construction through internal exports while preserving existing Workflow streaming behavior. Transport-independent approval creation remains separate follow-up work.
45
+ - d6b42fd: feat(ai): support custom reasoning delimiters in extractReasoningMiddleware
46
+ - ed6e72d: fix(ai): return successful empty transcripts for silent audio
47
+ - 2136151: Throw `InvalidResponseDataError` instead of a generic `Error` when a generated audio file's format cannot be determined from its media type, so callers can identify the failure with `AISDKError.isInstance`.
48
+ - Updated dependencies [131532b]
49
+ - Updated dependencies [2959d35]
50
+ - Updated dependencies [59116e6]
51
+ - Updated dependencies [6ac923a]
52
+ - @ai-sdk/gateway@4.0.104
53
+ - @ai-sdk/provider@4.0.22
54
+ - @ai-sdk/provider-utils@5.0.54
55
+
3
56
  ## 7.0.127
4
57
 
5
58
  ### Patch Changes