@mastra/client-js 1.55.0 → 1.55.1-alpha.0

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.js CHANGED
@@ -1659,9 +1659,9 @@ var Agent = class extends BaseResource {
1659
1659
  },
1660
1660
  onToolResultPart(value) {
1661
1661
  const toolInvocations = message.toolInvocations;
1662
- if (toolInvocations == null) throw new Error("tool_result must be preceded by a tool_call");
1662
+ if (toolInvocations == null) return;
1663
1663
  const toolInvocationIndex = toolInvocations.findIndex((invocation) => invocation.toolCallId === value.toolCallId);
1664
- if (toolInvocationIndex === -1) throw new Error("tool_result must be preceded by a tool_call with the same toolCallId");
1664
+ if (toolInvocationIndex === -1) return;
1665
1665
  const invocation = {
1666
1666
  ...toolInvocations[toolInvocationIndex],
1667
1667
  state: "result",
@@ -1939,9 +1939,9 @@ var Agent = class extends BaseResource {
1939
1939
  }
1940
1940
  case "tool-result": {
1941
1941
  const toolInvocations = message.toolInvocations;
1942
- if (toolInvocations == null) throw new Error("tool_result must be preceded by a tool_call");
1942
+ if (toolInvocations == null) break;
1943
1943
  const toolInvocationIndex = toolInvocations.findIndex((invocation) => invocation.toolCallId === chunk.payload.toolCallId);
1944
- if (toolInvocationIndex === -1) throw new Error("tool_result must be preceded by a tool_call with the same toolCallId");
1944
+ if (toolInvocationIndex === -1) break;
1945
1945
  const invocation = {
1946
1946
  ...toolInvocations[toolInvocationIndex],
1947
1947
  state: "result",