@copilotkitnext/core 1.52.2-next.3 → 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.cjs CHANGED
@@ -817,7 +817,7 @@ var RunHandler = class {
817
817
  code: CopilotKitCoreErrorCode.AGENT_CONNECT_FAILED,
818
818
  context
819
819
  });
820
- throw error;
820
+ return { newMessages: [] };
821
821
  }
822
822
  }
823
823
  /**
@@ -848,7 +848,7 @@ var RunHandler = class {
848
848
  code: CopilotKitCoreErrorCode.AGENT_RUN_FAILED,
849
849
  context
850
850
  });
851
- throw error;
851
+ return { newMessages: [] };
852
852
  }
853
853
  }
854
854
  /**
@@ -888,7 +888,6 @@ var RunHandler = class {
888
888
  if (tool?.agentId && tool.agentId !== agent.agentId) return false;
889
889
  let toolCallResult = "";
890
890
  let errorMessage;
891
- let isArgumentError = false;
892
891
  if (tool?.handler) {
893
892
  let parsedArgs;
894
893
  try {
@@ -896,7 +895,6 @@ var RunHandler = class {
896
895
  } catch (error) {
897
896
  const parseError = error instanceof Error ? error : new Error(String(error));
898
897
  errorMessage = parseError.message;
899
- isArgumentError = true;
900
898
  await this.core.emitError({
901
899
  error: parseError,
902
900
  code: CopilotKitCoreErrorCode.TOOL_ARGUMENT_PARSE_FAILED,
@@ -950,9 +948,8 @@ var RunHandler = class {
950
948
  result: errorMessage ? "" : toolCallResult,
951
949
  error: errorMessage
952
950
  }), "Subscriber onToolExecutionEnd error:");
953
- if (isArgumentError) throw new Error(errorMessage ?? "Tool execution failed");
954
951
  }
955
- if (!errorMessage || !isArgumentError) {
952
+ {
956
953
  const messageIndex = agent.messages.findIndex((m) => m.id === message.id);
957
954
  if (messageIndex === -1) return false;
958
955
  const toolMessage = {
@@ -973,7 +970,6 @@ var RunHandler = class {
973
970
  if (wildcardTool?.agentId && wildcardTool.agentId !== agent.agentId) return false;
974
971
  let toolCallResult = "";
975
972
  let errorMessage;
976
- let isArgumentError = false;
977
973
  if (wildcardTool?.handler) {
978
974
  let parsedArgs;
979
975
  try {
@@ -981,7 +977,6 @@ var RunHandler = class {
981
977
  } catch (error) {
982
978
  const parseError = error instanceof Error ? error : new Error(String(error));
983
979
  errorMessage = parseError.message;
984
- isArgumentError = true;
985
980
  await this.core.emitError({
986
981
  error: parseError,
987
982
  code: CopilotKitCoreErrorCode.TOOL_ARGUMENT_PARSE_FAILED,
@@ -1039,9 +1034,8 @@ var RunHandler = class {
1039
1034
  result: errorMessage ? "" : toolCallResult,
1040
1035
  error: errorMessage
1041
1036
  }), "Subscriber onToolExecutionEnd error:");
1042
- if (isArgumentError) throw new Error(errorMessage ?? "Tool execution failed");
1043
1037
  }
1044
- if (!errorMessage || !isArgumentError) {
1038
+ {
1045
1039
  const messageIndex = agent.messages.findIndex((m) => m.id === message.id);
1046
1040
  if (messageIndex === -1) return false;
1047
1041
  const toolMessage = {