@mastra/react 0.1.0-beta.10 → 0.1.0-beta.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @mastra/react-hooks
2
2
 
3
+ ## 0.1.0-beta.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Support new Workflow tripwire run status. Tripwires that are thrown from within a workflow will now bubble up and return a graceful state with information about tripwires. ([#10947](https://github.com/mastra-ai/mastra/pull/10947))
8
+
9
+ When a workflow contains an agent step that triggers a tripwire, the workflow returns with `status: 'tripwire'` and includes tripwire details:
10
+
11
+ ```typescript showLineNumbers copy
12
+ const run = await workflow.createRun();
13
+ const result = await run.start({ inputData: { message: 'Hello' } });
14
+
15
+ if (result.status === 'tripwire') {
16
+ console.log('Workflow terminated by tripwire:', result.tripwire?.reason);
17
+ console.log('Processor ID:', result.tripwire?.processorId);
18
+ console.log('Retry requested:', result.tripwire?.retry);
19
+ }
20
+ ```
21
+
22
+ Adds new UI state for tripwire in agent chat and workflow UI.
23
+
24
+ This is distinct from `status: 'failed'` which indicates an unexpected error. A tripwire status means a processor intentionally stopped execution (e.g., for content moderation).
25
+
26
+ - Updated dependencies [[`3bf6c5f`](https://github.com/mastra-ai/mastra/commit/3bf6c5f104c25226cd84e0c77f9dec15f2cac2db)]:
27
+ - @mastra/client-js@1.0.0-beta.11
28
+
3
29
  ## 0.1.0-beta.10
4
30
 
5
31
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -51,7 +51,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
51
51
  return {
52
52
  ...prev,
53
53
  status: chunk.payload.workflowStatus,
54
- ...finalStatus === "success" && lastStep?.status === "success" ? { result: lastStep?.output } : finalStatus === "failed" && lastStep?.status === "failed" ? { error: lastStep?.error } : {}
54
+ ...finalStatus === "success" && lastStep?.status === "success" ? { result: lastStep?.output } : finalStatus === "failed" && lastStep?.status === "failed" ? { error: lastStep?.error } : finalStatus === "tripwire" && chunk.payload.tripwire ? { tripwire: chunk.payload.tripwire } : {}
55
55
  };
56
56
  }
57
57
  const { stepCallId, stepName, ...newPayload } = chunk.payload ?? {};
@@ -139,12 +139,17 @@ const toUIMessage = ({ chunk, conversation, metadata }) => {
139
139
  parts: [
140
140
  {
141
141
  type: "text",
142
- text: chunk.payload.tripwireReason
142
+ text: chunk.payload.reason
143
143
  }
144
144
  ],
145
145
  metadata: {
146
146
  ...metadata,
147
- status: "warning"
147
+ status: "tripwire",
148
+ tripwire: {
149
+ retry: chunk.payload.retry,
150
+ tripwirePayload: chunk.payload.metadata,
151
+ processorId: chunk.payload.processorId
152
+ }
148
153
  }
149
154
  };
150
155
  return [...result, newMessage];