@voltagent/server-core 1.0.14 → 1.0.16

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.
@@ -1816,6 +1816,9 @@ interface SuccessResponse<T = any> {
1816
1816
  interface ErrorResponse {
1817
1817
  success: false;
1818
1818
  error: string;
1819
+ httpStatus?: number;
1820
+ code?: string;
1821
+ name?: string;
1819
1822
  }
1820
1823
  type ApiResponse<T = any> = SuccessResponse<T> | ErrorResponse;
1821
1824
  type StreamResponse = Response | ReadableStream | ErrorResponse;
@@ -1816,6 +1816,9 @@ interface SuccessResponse<T = any> {
1816
1816
  interface ErrorResponse {
1817
1817
  success: false;
1818
1818
  error: string;
1819
+ httpStatus?: number;
1820
+ code?: string;
1821
+ name?: string;
1819
1822
  }
1820
1823
  type ApiResponse<T = any> = SuccessResponse<T> | ErrorResponse;
1821
1824
  type StreamResponse = Response | ReadableStream | ErrorResponse;
package/dist/edge.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as A2ARequestContext, r as A2A_ROUTES, m as AGENT_ROUTES, L as LOG_ROUTES, n as OBSERVABILITY_MEMORY_ROUTES, O as OBSERVABILITY_ROUTES, W as WORKFLOW_ROUTES, v as executeA2ARequest, ae as getConversationMessagesHandler, al as getOrCreateLogger, af as getWorkingMemoryHandler, Y as handleChatStream, a3 as handleExecuteWorkflow, Z as handleGenerateObject, T as handleGenerateText, $ as handleGetAgent, a0 as handleGetAgentHistory, Q as handleGetAgents, ab as handleGetLogs, a2 as handleGetWorkflow, a8 as handleGetWorkflowState, a1 as handleGetWorkflows, a7 as handleResumeWorkflow, _ as handleStreamObject, X as handleStreamText, a4 as handleStreamWorkflow, a5 as handleSuspendWorkflow, i as isErrorResponse, ad as listMemoryConversationsHandler, ac as listMemoryUsersHandler, ag as mapLogResponse, t as parseJsonRpcRequest, u as resolveAgentCard } from './edge-Dta7YML6.mjs';
1
+ export { C as A2ARequestContext, r as A2A_ROUTES, m as AGENT_ROUTES, L as LOG_ROUTES, n as OBSERVABILITY_MEMORY_ROUTES, O as OBSERVABILITY_ROUTES, W as WORKFLOW_ROUTES, v as executeA2ARequest, ae as getConversationMessagesHandler, al as getOrCreateLogger, af as getWorkingMemoryHandler, Y as handleChatStream, a3 as handleExecuteWorkflow, Z as handleGenerateObject, T as handleGenerateText, $ as handleGetAgent, a0 as handleGetAgentHistory, Q as handleGetAgents, ab as handleGetLogs, a2 as handleGetWorkflow, a8 as handleGetWorkflowState, a1 as handleGetWorkflows, a7 as handleResumeWorkflow, _ as handleStreamObject, X as handleStreamText, a4 as handleStreamWorkflow, a5 as handleSuspendWorkflow, i as isErrorResponse, ad as listMemoryConversationsHandler, ac as listMemoryUsersHandler, ag as mapLogResponse, t as parseJsonRpcRequest, u as resolveAgentCard } from './edge-roRNuNX6.mjs';
2
2
  import '@voltagent/core';
3
3
  import '@voltagent/internal';
4
4
  import 'ai';
package/dist/edge.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as A2ARequestContext, r as A2A_ROUTES, m as AGENT_ROUTES, L as LOG_ROUTES, n as OBSERVABILITY_MEMORY_ROUTES, O as OBSERVABILITY_ROUTES, W as WORKFLOW_ROUTES, v as executeA2ARequest, ae as getConversationMessagesHandler, al as getOrCreateLogger, af as getWorkingMemoryHandler, Y as handleChatStream, a3 as handleExecuteWorkflow, Z as handleGenerateObject, T as handleGenerateText, $ as handleGetAgent, a0 as handleGetAgentHistory, Q as handleGetAgents, ab as handleGetLogs, a2 as handleGetWorkflow, a8 as handleGetWorkflowState, a1 as handleGetWorkflows, a7 as handleResumeWorkflow, _ as handleStreamObject, X as handleStreamText, a4 as handleStreamWorkflow, a5 as handleSuspendWorkflow, i as isErrorResponse, ad as listMemoryConversationsHandler, ac as listMemoryUsersHandler, ag as mapLogResponse, t as parseJsonRpcRequest, u as resolveAgentCard } from './edge-Dta7YML6.js';
1
+ export { C as A2ARequestContext, r as A2A_ROUTES, m as AGENT_ROUTES, L as LOG_ROUTES, n as OBSERVABILITY_MEMORY_ROUTES, O as OBSERVABILITY_ROUTES, W as WORKFLOW_ROUTES, v as executeA2ARequest, ae as getConversationMessagesHandler, al as getOrCreateLogger, af as getWorkingMemoryHandler, Y as handleChatStream, a3 as handleExecuteWorkflow, Z as handleGenerateObject, T as handleGenerateText, $ as handleGetAgent, a0 as handleGetAgentHistory, Q as handleGetAgents, ab as handleGetLogs, a2 as handleGetWorkflow, a8 as handleGetWorkflowState, a1 as handleGetWorkflows, a7 as handleResumeWorkflow, _ as handleStreamObject, X as handleStreamText, a4 as handleStreamWorkflow, a5 as handleSuspendWorkflow, i as isErrorResponse, ad as listMemoryConversationsHandler, ac as listMemoryUsersHandler, ag as mapLogResponse, t as parseJsonRpcRequest, u as resolveAgentCard } from './edge-roRNuNX6.js';
2
2
  import '@voltagent/core';
3
3
  import '@voltagent/internal';
4
4
  import 'ai';
package/dist/edge.js CHANGED
@@ -827,6 +827,7 @@ var A2A_ROUTES = {
827
827
 
828
828
  // src/handlers/agent.handlers.ts
829
829
  var import_core2 = require("@voltagent/core");
830
+ var import_core3 = require("@voltagent/core");
830
831
  var import_internal = require("@voltagent/internal");
831
832
  var import_zod = require("zod");
832
833
  var import_zod_from_json_schema = require("zod-from-json-schema");
@@ -912,7 +913,7 @@ async function handleGenerateText(agentId, body, deps, logger, signal) {
912
913
  const { input } = body;
913
914
  const options = processAgentOptions(body, signal);
914
915
  const result = await agent.generateText(input, options);
915
- const usage = result.usage ? (0, import_core2.convertUsage)(result.usage) : void 0;
916
+ const usage = result.usage ? (0, import_core3.convertUsage)(result.usage) : void 0;
916
917
  return {
917
918
  success: true,
918
919
  data: {
@@ -925,6 +926,15 @@ async function handleGenerateText(agentId, body, deps, logger, signal) {
925
926
  };
926
927
  } catch (error) {
927
928
  logger.error("Failed to generate text", { error });
929
+ if (error instanceof import_core2.ClientHTTPError) {
930
+ return {
931
+ success: false,
932
+ error: error.message,
933
+ code: error.code,
934
+ name: error.name,
935
+ httpStatus: error.httpStatus
936
+ };
937
+ }
928
938
  return {
929
939
  success: false,
930
940
  error: error instanceof Error ? error.message : "Unknown error"
@@ -1181,10 +1191,10 @@ async function handleGetAgentHistory(agentId, page, limit, deps, logger) {
1181
1191
  __name(handleGetAgentHistory, "handleGetAgentHistory");
1182
1192
 
1183
1193
  // src/handlers/log.handlers.ts
1184
- var import_core3 = require("@voltagent/core");
1194
+ var import_core4 = require("@voltagent/core");
1185
1195
  async function handleGetLogs(options, _deps, logger) {
1186
1196
  try {
1187
- const logBuffer = (0, import_core3.getGlobalLogBuffer)();
1197
+ const logBuffer = (0, import_core4.getGlobalLogBuffer)();
1188
1198
  const limit = options.limit || 100;
1189
1199
  const filter = {
1190
1200
  level: options.level,
@@ -1216,7 +1226,7 @@ async function handleGetLogs(options, _deps, logger) {
1216
1226
  __name(handleGetLogs, "handleGetLogs");
1217
1227
 
1218
1228
  // src/handlers/workflow.handlers.ts
1219
- var import_core4 = require("@voltagent/core");
1229
+ var import_core5 = require("@voltagent/core");
1220
1230
  var import_internal2 = require("@voltagent/internal");
1221
1231
  async function handleGetWorkflows(deps, logger) {
1222
1232
  try {
@@ -1249,21 +1259,21 @@ async function handleGetWorkflow(workflowId, deps, logger) {
1249
1259
  let resumeSchema = null;
1250
1260
  if (registeredWorkflow?.inputSchema) {
1251
1261
  try {
1252
- inputSchema = (0, import_core4.zodSchemaToJsonUI)(registeredWorkflow.inputSchema);
1262
+ inputSchema = (0, import_core5.zodSchemaToJsonUI)(registeredWorkflow.inputSchema);
1253
1263
  } catch (error) {
1254
1264
  logger.warn("Failed to convert input schema to JSON schema:", { error });
1255
1265
  }
1256
1266
  }
1257
1267
  if (registeredWorkflow?.suspendSchema) {
1258
1268
  try {
1259
- suspendSchema = (0, import_core4.zodSchemaToJsonUI)(registeredWorkflow.suspendSchema);
1269
+ suspendSchema = (0, import_core5.zodSchemaToJsonUI)(registeredWorkflow.suspendSchema);
1260
1270
  } catch (error) {
1261
1271
  logger.warn("Failed to convert suspend schema to JSON schema:", { error });
1262
1272
  }
1263
1273
  }
1264
1274
  if (registeredWorkflow?.resumeSchema) {
1265
1275
  try {
1266
- resumeSchema = (0, import_core4.zodSchemaToJsonUI)(registeredWorkflow.resumeSchema);
1276
+ resumeSchema = (0, import_core5.zodSchemaToJsonUI)(registeredWorkflow.resumeSchema);
1267
1277
  } catch (error) {
1268
1278
  logger.warn("Failed to convert resume schema to JSON schema:", { error });
1269
1279
  }
@@ -1282,28 +1292,28 @@ async function handleGetWorkflow(workflowId, deps, logger) {
1282
1292
  const convertedStep = { ...step };
1283
1293
  if ("inputSchema" in step && step.inputSchema) {
1284
1294
  try {
1285
- convertedStep.inputSchema = (0, import_core4.zodSchemaToJsonUI)(step.inputSchema);
1295
+ convertedStep.inputSchema = (0, import_core5.zodSchemaToJsonUI)(step.inputSchema);
1286
1296
  } catch (error) {
1287
1297
  logger.warn("Failed to convert input schema for step:", { error });
1288
1298
  }
1289
1299
  }
1290
1300
  if ("outputSchema" in step && step.outputSchema) {
1291
1301
  try {
1292
- convertedStep.outputSchema = (0, import_core4.zodSchemaToJsonUI)(step.outputSchema);
1302
+ convertedStep.outputSchema = (0, import_core5.zodSchemaToJsonUI)(step.outputSchema);
1293
1303
  } catch (error) {
1294
1304
  logger.warn("Failed to convert output schema for step:", { error });
1295
1305
  }
1296
1306
  }
1297
1307
  if ("suspendSchema" in step && step.suspendSchema) {
1298
1308
  try {
1299
- convertedStep.suspendSchema = (0, import_core4.zodSchemaToJsonUI)(step.suspendSchema);
1309
+ convertedStep.suspendSchema = (0, import_core5.zodSchemaToJsonUI)(step.suspendSchema);
1300
1310
  } catch (error) {
1301
1311
  logger.warn("Failed to convert suspend schema for step:", { error });
1302
1312
  }
1303
1313
  }
1304
1314
  if ("resumeSchema" in step && step.resumeSchema) {
1305
1315
  try {
1306
- convertedStep.resumeSchema = (0, import_core4.zodSchemaToJsonUI)(step.resumeSchema);
1316
+ convertedStep.resumeSchema = (0, import_core5.zodSchemaToJsonUI)(step.resumeSchema);
1307
1317
  } catch (error) {
1308
1318
  logger.warn("Failed to convert resume schema for step:", { error });
1309
1319
  }