@zenning/ai 5.2.0 → 5.3.1

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
@@ -711,7 +711,7 @@ import {
711
711
  } from "@zenning/provider-utils";
712
712
 
713
713
  // src/version.ts
714
- var VERSION = true ? "5.2.0" : "0.0.0-test";
714
+ var VERSION = true ? "5.3.1" : "0.0.0-test";
715
715
 
716
716
  // src/util/download/download.ts
717
717
  var download = async ({ url }) => {
@@ -2995,6 +2995,11 @@ var uiMessageChunkSchema = z7.union([
2995
2995
  mediaType: z7.string(),
2996
2996
  providerMetadata: providerMetadataSchema.optional()
2997
2997
  }),
2998
+ z7.strictObject({
2999
+ type: z7.literal("source-execution-file"),
3000
+ sourceId: z7.string(),
3001
+ providerMetadata: providerMetadataSchema.optional()
3002
+ }),
2998
3003
  z7.strictObject({
2999
3004
  type: z7.custom(
3000
3005
  (value) => typeof value === "string" && value.startsWith("data-"),
@@ -3619,29 +3624,53 @@ function processUIMessageStream({
3619
3624
  break;
3620
3625
  }
3621
3626
  case "source-url": {
3622
- state.message.parts.push({
3623
- type: "source-url",
3624
- sourceId: chunk.sourceId,
3625
- url: chunk.url,
3626
- title: chunk.title,
3627
- providerMetadata: chunk.providerMetadata
3628
- });
3629
- write();
3627
+ const existingSource = state.message.parts.find(
3628
+ (part) => part.type === "source-url" && part.sourceId === chunk.sourceId
3629
+ );
3630
+ if (!existingSource) {
3631
+ state.message.parts.push({
3632
+ type: "source-url",
3633
+ sourceId: chunk.sourceId,
3634
+ url: chunk.url,
3635
+ title: chunk.title,
3636
+ providerMetadata: chunk.providerMetadata
3637
+ });
3638
+ write();
3639
+ }
3640
+ break;
3641
+ }
3642
+ case "source-execution-file": {
3643
+ const existingSource = state.message.parts.find(
3644
+ (part) => part.type === "source-execution-file" && part.sourceId === chunk.sourceId
3645
+ );
3646
+ if (!existingSource) {
3647
+ state.message.parts.push({
3648
+ type: "source-execution-file",
3649
+ sourceId: chunk.sourceId,
3650
+ providerMetadata: chunk.providerMetadata
3651
+ });
3652
+ write();
3653
+ }
3630
3654
  break;
3631
3655
  }
3632
3656
  case "source-document": {
3633
- state.message.parts.push({
3634
- type: "source-document",
3635
- sourceId: chunk.sourceId,
3636
- mediaType: chunk.mediaType,
3637
- title: chunk.title,
3638
- filename: chunk.filename,
3639
- fileId: chunk.fileId,
3640
- startIndex: chunk.startIndex,
3641
- endIndex: chunk.endIndex,
3642
- providerMetadata: chunk.providerMetadata
3643
- });
3644
- write();
3657
+ const existingSource = state.message.parts.find(
3658
+ (part) => part.type === "source-document" && part.sourceId === chunk.sourceId
3659
+ );
3660
+ if (!existingSource) {
3661
+ state.message.parts.push({
3662
+ type: "source-document",
3663
+ sourceId: chunk.sourceId,
3664
+ mediaType: chunk.mediaType,
3665
+ title: chunk.title,
3666
+ filename: chunk.filename,
3667
+ fileId: chunk.fileId,
3668
+ startIndex: chunk.startIndex,
3669
+ endIndex: chunk.endIndex,
3670
+ providerMetadata: chunk.providerMetadata
3671
+ });
3672
+ write();
3673
+ }
3645
3674
  break;
3646
3675
  }
3647
3676
  case "tool-input-start": {
@@ -10200,6 +10229,11 @@ var dynamicToolUIPartSchemas = [
10200
10229
  callProviderMetadata: providerMetadataSchema.optional()
10201
10230
  })
10202
10231
  ];
10232
+ var sourceExecutionFileUIPartSchema = z10.object({
10233
+ type: z10.literal("source-execution-file"),
10234
+ sourceId: z10.string(),
10235
+ providerMetadata: providerMetadataSchema.optional()
10236
+ });
10203
10237
  var toolUIPartSchemas = [
10204
10238
  z10.object({
10205
10239
  type: z10.string().startsWith("tool-"),
@@ -10254,6 +10288,7 @@ var uiMessageSchema = z10.object({
10254
10288
  sourceDocumentUIPartSchema,
10255
10289
  fileUIPartSchema,
10256
10290
  stepStartUIPartSchema,
10291
+ sourceExecutionFileUIPartSchema,
10257
10292
  dataUIPartSchema,
10258
10293
  ...dynamicToolUIPartSchemas,
10259
10294
  ...toolUIPartSchemas