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