@mastra/react 1.6.0-alpha.10 → 1.6.0-alpha.12

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
@@ -2940,14 +2940,17 @@ function useStreamWorkflow({ debugMode, tracingOptions, onError }) {
2940
2940
  }
2941
2941
  }
2942
2942
  }
2943
- const streamWorkflow = useMutation(({ workflowId, runId, inputData, initialState, requestContext, perStep }) => {
2943
+ const streamWorkflow = useMutation(({ workflowId, runId, inputData, initialState, requestContext, perStep, resourceId }) => {
2944
2944
  setStreamResult({
2945
2945
  status: "pending",
2946
2946
  input: inputData,
2947
2947
  steps: {}
2948
2948
  });
2949
2949
  return consumeStream(async (signal) => {
2950
- const run = await client.getWorkflow(workflowId).createRun({ runId });
2950
+ const run = await client.getWorkflow(workflowId).createRun({
2951
+ runId,
2952
+ resourceId
2953
+ });
2951
2954
  if (signal.aborted) return;
2952
2955
  return run.stream({
2953
2956
  inputData,
@@ -2955,7 +2958,8 @@ function useStreamWorkflow({ debugMode, tracingOptions, onError }) {
2955
2958
  requestContext,
2956
2959
  closeOnSuspend: true,
2957
2960
  tracingOptions,
2958
- perStep: perStep ?? debugMode
2961
+ perStep: perStep ?? debugMode,
2962
+ resourceId
2959
2963
  });
2960
2964
  }, "Error streaming workflow");
2961
2965
  });
@@ -3026,9 +3030,12 @@ function useStreamWorkflow({ debugMode, tracingOptions, onError }) {
3026
3030
  */
3027
3031
  function useCreateWorkflowRun() {
3028
3032
  const client = useMastraClient();
3029
- return useMutation(async ({ workflowId, prevRunId }) => {
3033
+ return useMutation(async ({ workflowId, prevRunId, resourceId }) => {
3030
3034
  try {
3031
- const { runId: newRunId } = await client.getWorkflow(workflowId).createRun({ runId: prevRunId });
3035
+ const { runId: newRunId } = await client.getWorkflow(workflowId).createRun({
3036
+ runId: prevRunId,
3037
+ resourceId
3038
+ });
3032
3039
  return { runId: newRunId };
3033
3040
  } catch (error) {
3034
3041
  console.error("Error creating workflow run:", error);
@@ -3210,7 +3217,8 @@ const useBrowserSpeechRecognition = ({ language = "en-US" }) => {
3210
3217
  setState((prev) => ({
3211
3218
  ...prev,
3212
3219
  isListening: true,
3213
- error: null
3220
+ error: null,
3221
+ transcript: ""
3214
3222
  }));
3215
3223
  };
3216
3224
  recognition.onresult = (event) => {
@@ -3219,9 +3227,10 @@ const useBrowserSpeechRecognition = ({ language = "en-US" }) => {
3219
3227
  const transcript = event.results[i][0].transcript;
3220
3228
  if (event.results[i].isFinal) finalTranscript += transcript + " ";
3221
3229
  }
3230
+ if (!finalTranscript) return;
3222
3231
  setState((prev) => ({
3223
3232
  ...prev,
3224
- transcript: finalTranscript
3233
+ transcript: prev.transcript + finalTranscript
3225
3234
  }));
3226
3235
  };
3227
3236
  recognition.onerror = (event) => {