@copilotkitnext/core 1.52.2-next.2 → 1.52.2-next.4

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.umd.js CHANGED
@@ -891,7 +891,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
891
891
  code: CopilotKitCoreErrorCode.AGENT_CONNECT_FAILED,
892
892
  context
893
893
  });
894
- throw error;
894
+ return { newMessages: [] };
895
895
  }
896
896
  }
897
897
  /**
@@ -922,7 +922,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
922
922
  code: CopilotKitCoreErrorCode.AGENT_RUN_FAILED,
923
923
  context
924
924
  });
925
- throw error;
925
+ return { newMessages: [] };
926
926
  }
927
927
  }
928
928
  /**
@@ -962,7 +962,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
962
962
  if ((tool === null || tool === void 0 ? void 0 : tool.agentId) && tool.agentId !== agent.agentId) return false;
963
963
  let toolCallResult = "";
964
964
  let errorMessage;
965
- let isArgumentError = false;
966
965
  if (tool === null || tool === void 0 ? void 0 : tool.handler) {
967
966
  let parsedArgs;
968
967
  try {
@@ -970,7 +969,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
970
969
  } catch (error) {
971
970
  const parseError = error instanceof Error ? error : new Error(String(error));
972
971
  errorMessage = parseError.message;
973
- isArgumentError = true;
974
972
  await this.core.emitError({
975
973
  error: parseError,
976
974
  code: CopilotKitCoreErrorCode.TOOL_ARGUMENT_PARSE_FAILED,
@@ -1030,12 +1028,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1030
1028
  error: errorMessage
1031
1029
  });
1032
1030
  }, "Subscriber onToolExecutionEnd error:");
1033
- if (isArgumentError) {
1034
- var _errorMessage;
1035
- throw new Error((_errorMessage = errorMessage) !== null && _errorMessage !== void 0 ? _errorMessage : "Tool execution failed");
1036
- }
1037
1031
  }
1038
- if (!errorMessage || !isArgumentError) {
1032
+ {
1039
1033
  const messageIndex = agent.messages.findIndex((m) => m.id === message.id);
1040
1034
  if (messageIndex === -1) return false;
1041
1035
  const toolMessage = {
@@ -1056,7 +1050,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1056
1050
  if ((wildcardTool === null || wildcardTool === void 0 ? void 0 : wildcardTool.agentId) && wildcardTool.agentId !== agent.agentId) return false;
1057
1051
  let toolCallResult = "";
1058
1052
  let errorMessage;
1059
- let isArgumentError = false;
1060
1053
  if (wildcardTool === null || wildcardTool === void 0 ? void 0 : wildcardTool.handler) {
1061
1054
  let parsedArgs;
1062
1055
  try {
@@ -1064,7 +1057,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1064
1057
  } catch (error) {
1065
1058
  const parseError = error instanceof Error ? error : new Error(String(error));
1066
1059
  errorMessage = parseError.message;
1067
- isArgumentError = true;
1068
1060
  await this.core.emitError({
1069
1061
  error: parseError,
1070
1062
  code: CopilotKitCoreErrorCode.TOOL_ARGUMENT_PARSE_FAILED,
@@ -1128,12 +1120,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1128
1120
  error: errorMessage
1129
1121
  });
1130
1122
  }, "Subscriber onToolExecutionEnd error:");
1131
- if (isArgumentError) {
1132
- var _errorMessage2;
1133
- throw new Error((_errorMessage2 = errorMessage) !== null && _errorMessage2 !== void 0 ? _errorMessage2 : "Tool execution failed");
1134
- }
1135
1123
  }
1136
- if (!errorMessage || !isArgumentError) {
1124
+ {
1137
1125
  const messageIndex = agent.messages.findIndex((m) => m.id === message.id);
1138
1126
  if (messageIndex === -1) return false;
1139
1127
  const toolMessage = {