ai 5.0.0-beta.31 → 5.0.0-beta.32

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.mjs CHANGED
@@ -6650,6 +6650,7 @@ var DefaultStreamObjectResult = class {
6650
6650
  this._warnings = new DelayedPromise();
6651
6651
  this._request = new DelayedPromise();
6652
6652
  this._response = new DelayedPromise();
6653
+ this._finishReason = new DelayedPromise();
6653
6654
  const model = resolveLanguageModel(modelArg);
6654
6655
  const { maxRetries, retry } = prepareRetries({
6655
6656
  maxRetries: maxRetriesArg
@@ -6869,6 +6870,7 @@ var DefaultStreamObjectResult = class {
6869
6870
  ...fullResponse,
6870
6871
  headers: response == null ? void 0 : response.headers
6871
6872
  });
6873
+ self._finishReason.resolve(finishReason != null ? finishReason : "unknown");
6872
6874
  const validationResult = await outputStrategy.validateFinalResult(
6873
6875
  latestObjectJson,
6874
6876
  {
@@ -7003,6 +7005,9 @@ var DefaultStreamObjectResult = class {
7003
7005
  get response() {
7004
7006
  return this._response.promise;
7005
7007
  }
7008
+ get finishReason() {
7009
+ return this._finishReason.promise;
7010
+ }
7006
7011
  get partialObjectStream() {
7007
7012
  return createAsyncIterableStream(
7008
7013
  this.baseStream.pipeThrough(
@@ -7867,38 +7872,38 @@ var SUPPORTED_PROTOCOL_VERSIONS = [
7867
7872
  "2025-03-26",
7868
7873
  "2024-11-05"
7869
7874
  ];
7870
- var ClientOrServerImplementationSchema = z8.object({
7875
+ var ClientOrServerImplementationSchema = z8.looseObject({
7871
7876
  name: z8.string(),
7872
7877
  version: z8.string()
7873
- }).passthrough();
7874
- var BaseParamsSchema = z8.object({
7875
- _meta: z8.optional(z8.object({}).passthrough())
7876
- }).passthrough();
7878
+ });
7879
+ var BaseParamsSchema = z8.looseObject({
7880
+ _meta: z8.optional(z8.object({}).loose())
7881
+ });
7877
7882
  var ResultSchema = BaseParamsSchema;
7878
7883
  var RequestSchema = z8.object({
7879
7884
  method: z8.string(),
7880
7885
  params: z8.optional(BaseParamsSchema)
7881
7886
  });
7882
- var ServerCapabilitiesSchema = z8.object({
7883
- experimental: z8.optional(z8.object({}).passthrough()),
7884
- logging: z8.optional(z8.object({}).passthrough()),
7887
+ var ServerCapabilitiesSchema = z8.looseObject({
7888
+ experimental: z8.optional(z8.object({}).loose()),
7889
+ logging: z8.optional(z8.object({}).loose()),
7885
7890
  prompts: z8.optional(
7886
- z8.object({
7891
+ z8.looseObject({
7887
7892
  listChanged: z8.optional(z8.boolean())
7888
- }).passthrough()
7893
+ })
7889
7894
  ),
7890
7895
  resources: z8.optional(
7891
- z8.object({
7896
+ z8.looseObject({
7892
7897
  subscribe: z8.optional(z8.boolean()),
7893
7898
  listChanged: z8.optional(z8.boolean())
7894
- }).passthrough()
7899
+ })
7895
7900
  ),
7896
7901
  tools: z8.optional(
7897
- z8.object({
7902
+ z8.looseObject({
7898
7903
  listChanged: z8.optional(z8.boolean())
7899
- }).passthrough()
7904
+ })
7900
7905
  )
7901
- }).passthrough();
7906
+ });
7902
7907
  var InitializeResultSchema = ResultSchema.extend({
7903
7908
  protocolVersion: z8.string(),
7904
7909
  capabilities: ServerCapabilitiesSchema,
@@ -7913,21 +7918,21 @@ var ToolSchema = z8.object({
7913
7918
  description: z8.optional(z8.string()),
7914
7919
  inputSchema: z8.object({
7915
7920
  type: z8.literal("object"),
7916
- properties: z8.optional(z8.object({}).passthrough())
7917
- }).passthrough()
7918
- }).passthrough();
7921
+ properties: z8.optional(z8.object({}).loose())
7922
+ }).loose()
7923
+ }).loose();
7919
7924
  var ListToolsResultSchema = PaginatedResultSchema.extend({
7920
7925
  tools: z8.array(ToolSchema)
7921
7926
  });
7922
7927
  var TextContentSchema = z8.object({
7923
7928
  type: z8.literal("text"),
7924
7929
  text: z8.string()
7925
- }).passthrough();
7930
+ }).loose();
7926
7931
  var ImageContentSchema = z8.object({
7927
7932
  type: z8.literal("image"),
7928
- data: z8.string().base64(),
7933
+ data: z8.base64(),
7929
7934
  mimeType: z8.string()
7930
- }).passthrough();
7935
+ }).loose();
7931
7936
  var ResourceContentsSchema = z8.object({
7932
7937
  /**
7933
7938
  * The URI of this resource.
@@ -7937,17 +7942,17 @@ var ResourceContentsSchema = z8.object({
7937
7942
  * The MIME type of this resource, if known.
7938
7943
  */
7939
7944
  mimeType: z8.optional(z8.string())
7940
- }).passthrough();
7945
+ }).loose();
7941
7946
  var TextResourceContentsSchema = ResourceContentsSchema.extend({
7942
7947
  text: z8.string()
7943
7948
  });
7944
7949
  var BlobResourceContentsSchema = ResourceContentsSchema.extend({
7945
- blob: z8.string().base64()
7950
+ blob: z8.base64()
7946
7951
  });
7947
7952
  var EmbeddedResourceSchema = z8.object({
7948
7953
  type: z8.literal("resource"),
7949
7954
  resource: z8.union([TextResourceContentsSchema, BlobResourceContentsSchema])
7950
- }).passthrough();
7955
+ }).loose();
7951
7956
  var CallToolResultSchema = ResultSchema.extend({
7952
7957
  content: z8.array(
7953
7958
  z8.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema])
@@ -8145,11 +8150,11 @@ function isCustomMcpTransport(transport) {
8145
8150
  // src/tool/mcp/mcp-client.ts
8146
8151
  var CLIENT_VERSION = "1.0.0";
8147
8152
  async function createMCPClient(config) {
8148
- const client = new MCPClient(config);
8153
+ const client = new DefaultMCPClient(config);
8149
8154
  await client.init();
8150
8155
  return client;
8151
8156
  }
8152
- var MCPClient = class {
8157
+ var DefaultMCPClient = class {
8153
8158
  constructor({
8154
8159
  transport: transportConfig,
8155
8160
  name: name16 = "ai-sdk-mcp-client",