@voltagent/server-core 1.0.22 → 1.0.24

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,15 @@ 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
+ // Try to access experimental_output safely - getter throws if not defined
986
+ ...(() => {
987
+ try {
988
+ return result.experimental_output ? { experimental_output: result.experimental_output } : {};
989
+ } catch {
990
+ return {};
991
+ }
992
+ })()
970
993
  }
971
994
  };
972
995
  } catch (error) {
@@ -1108,7 +1131,7 @@ async function handleGenerateObject(agentId, body, deps, logger, signal) {
1108
1131
  }
1109
1132
  const { input, schema: jsonSchema } = body;
1110
1133
  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)(
1134
+ const zodSchema = ("toJSONSchema" in import_zod2.z ? import_zod_from_json_schema2.convertJsonSchemaToZod : import_zod_from_json_schema_v32.convertJsonSchemaToZod)(
1112
1135
  jsonSchema
1113
1136
  );
1114
1137
  const result = await agent.generateObject(input, zodSchema, options);
@@ -1144,7 +1167,7 @@ async function handleStreamObject(agentId, body, deps, logger, signal) {
1144
1167
  }
1145
1168
  const { input, schema: jsonSchema } = body;
1146
1169
  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)(
1170
+ const zodSchema = ("toJSONSchema" in import_zod2.z ? import_zod_from_json_schema2.convertJsonSchemaToZod : import_zod_from_json_schema_v32.convertJsonSchemaToZod)(
1148
1171
  jsonSchema
1149
1172
  );
1150
1173
  const result = await agent.streamObject(input, zodSchema, options);