@voltagent/server-core 1.0.22 → 1.0.23

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/edge.js CHANGED
@@ -874,11 +874,15 @@ var A2A_ROUTES = {
874
874
  var import_core2 = require("@voltagent/core");
875
875
  var import_core3 = require("@voltagent/core");
876
876
  var import_internal = require("@voltagent/internal");
877
+ var import_zod2 = require("zod");
878
+ var import_zod_from_json_schema2 = require("zod-from-json-schema");
879
+ var import_zod_from_json_schema_v32 = require("zod-from-json-schema-v3");
880
+
881
+ // src/utils/options.ts
882
+ var import_ai = require("ai");
877
883
  var import_zod = require("zod");
878
884
  var import_zod_from_json_schema = require("zod-from-json-schema");
879
885
  var import_zod_from_json_schema_v3 = require("zod-from-json-schema-v3");
880
-
881
- // src/utils/options.ts
882
886
  function processAgentOptions(body, signal) {
883
887
  const options = body.options || {};
884
888
  const processedOptions = {
@@ -888,6 +892,17 @@ function processAgentOptions(body, signal) {
888
892
  if (options.context && typeof options.context === "object" && !(options.context instanceof Map)) {
889
893
  processedOptions.context = new Map(Object.entries(options.context));
890
894
  }
895
+ if (options.experimental_output) {
896
+ const { type, schema: jsonSchema } = options.experimental_output;
897
+ if (type === "object" && jsonSchema) {
898
+ const zodSchema = ("toJSONSchema" in import_zod.z ? import_zod_from_json_schema.convertJsonSchemaToZod : import_zod_from_json_schema_v3.convertJsonSchemaToZod)(
899
+ jsonSchema
900
+ );
901
+ processedOptions.experimental_output = import_ai.Output.object({ schema: zodSchema });
902
+ } else if (type === "text") {
903
+ processedOptions.experimental_output = import_ai.Output.text();
904
+ }
905
+ }
891
906
  return processedOptions;
892
907
  }
893
908
  __name(processAgentOptions, "processAgentOptions");
@@ -966,7 +981,8 @@ async function handleGenerateText(agentId, body, deps, logger, signal) {
966
981
  usage,
967
982
  finishReason: result.finishReason,
968
983
  toolCalls: result.toolCalls,
969
- toolResults: result.toolResults
984
+ toolResults: result.toolResults,
985
+ ...result.experimental_output && { experimental_output: result.experimental_output }
970
986
  }
971
987
  };
972
988
  } catch (error) {
@@ -1108,7 +1124,7 @@ async function handleGenerateObject(agentId, body, deps, logger, signal) {
1108
1124
  }
1109
1125
  const { input, schema: jsonSchema } = body;
1110
1126
  const options = processAgentOptions(body, signal);
1111
- const zodSchema = ("toJSONSchema" in import_zod.z ? import_zod_from_json_schema.convertJsonSchemaToZod : import_zod_from_json_schema_v3.convertJsonSchemaToZod)(
1127
+ const zodSchema = ("toJSONSchema" in import_zod2.z ? import_zod_from_json_schema2.convertJsonSchemaToZod : import_zod_from_json_schema_v32.convertJsonSchemaToZod)(
1112
1128
  jsonSchema
1113
1129
  );
1114
1130
  const result = await agent.generateObject(input, zodSchema, options);
@@ -1144,7 +1160,7 @@ async function handleStreamObject(agentId, body, deps, logger, signal) {
1144
1160
  }
1145
1161
  const { input, schema: jsonSchema } = body;
1146
1162
  const options = processAgentOptions(body, signal);
1147
- const zodSchema = ("toJSONSchema" in import_zod.z ? import_zod_from_json_schema.convertJsonSchemaToZod : import_zod_from_json_schema_v3.convertJsonSchemaToZod)(
1163
+ const zodSchema = ("toJSONSchema" in import_zod2.z ? import_zod_from_json_schema2.convertJsonSchemaToZod : import_zod_from_json_schema_v32.convertJsonSchemaToZod)(
1148
1164
  jsonSchema
1149
1165
  );
1150
1166
  const result = await agent.streamObject(input, zodSchema, options);