@mastra/react 1.2.6-alpha.8 → 1.3.0-alpha.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 +32 -0
- package/dist/agent/hooks.d.ts +1 -0
- package/dist/agent/hooks.d.ts.map +1 -1
- package/dist/index.cjs +42 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -14
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @mastra/react
|
|
2
2
|
|
|
3
|
+
## 1.3.0-alpha.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`c7d30cd`](https://github.com/mastra-ai/mastra/commit/c7d30cd86009c407df91105591f03cd6e3d2854d), [`ef03fbc`](https://github.com/mastra-ai/mastra/commit/ef03fbcc556bcbc04c9b3d06fab88771ecaa043c), [`6040ab9`](https://github.com/mastra-ai/mastra/commit/6040ab95bdfff38fceb1c0b9781a64a6d30f3cbd), [`a7bbe77`](https://github.com/mastra-ai/mastra/commit/a7bbe773577f60bc4761b534ef7ec6b476332dad), [`a7bbe77`](https://github.com/mastra-ai/mastra/commit/a7bbe773577f60bc4761b534ef7ec6b476332dad), [`4e68363`](https://github.com/mastra-ai/mastra/commit/4e683634f94ebd062d26a3bb6093a8dfc7263d37), [`9251370`](https://github.com/mastra-ai/mastra/commit/9251370ad413af464aa22d7566338bec5613e8de)]:
|
|
8
|
+
- @mastra/core@1.52.0-alpha.11
|
|
9
|
+
- @mastra/client-js@1.33.0-alpha.11
|
|
10
|
+
|
|
11
|
+
## 1.3.0-alpha.10
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Added request-scoped model overrides to agent execution and approvals, and fixed Studio model selection so each tab can use a different model without changing the agent's configured default. ([#19749](https://github.com/mastra-ai/mastra/pull/19749))
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
await agent.stream(messages, { model: 'google/gemini-2.5-flash' });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`41a5392`](https://github.com/mastra-ai/mastra/commit/41a5392d9f6c5e18d6b227f0fc0ddf49c50774e9), [`675fbff`](https://github.com/mastra-ai/mastra/commit/675fbff84d3274391b33e852f76083c38a5514e5), [`da009e1`](https://github.com/mastra-ai/mastra/commit/da009e1aacd89ed94b8d1b2af09c9d4fe7c4db49), [`35c2181`](https://github.com/mastra-ai/mastra/commit/35c2181e6a50e47c90ba36260db7c9723d54696f), [`b4b7ea8`](https://github.com/mastra-ai/mastra/commit/b4b7ea8733f033fc441ea47ed03f6afb17ec2248), [`675fbff`](https://github.com/mastra-ai/mastra/commit/675fbff84d3274391b33e852f76083c38a5514e5), [`c328769`](https://github.com/mastra-ai/mastra/commit/c3287698ff8ef98dba86d415faa566fa3e5f4d56), [`232fcbc`](https://github.com/mastra-ai/mastra/commit/232fcbc14fce625dd672ba043329c0b732c62be2), [`3491666`](https://github.com/mastra-ai/mastra/commit/34916663c4fdd43b48c21f4ab2d5fb6dcccc94f9)]:
|
|
24
|
+
- @mastra/core@1.52.0-alpha.10
|
|
25
|
+
- @mastra/client-js@1.33.0-alpha.10
|
|
26
|
+
|
|
27
|
+
## 1.2.6-alpha.9
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`0a2c22c`](https://github.com/mastra-ai/mastra/commit/0a2c22c902604439ec490319e14c17f331e0c84c), [`3a8024c`](https://github.com/mastra-ai/mastra/commit/3a8024ce615f8aa89479c0d71fe61d10bb0040be)]:
|
|
32
|
+
- @mastra/core@1.52.0-alpha.9
|
|
33
|
+
- @mastra/client-js@1.33.0-alpha.9
|
|
34
|
+
|
|
3
35
|
## 1.2.6-alpha.8
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/dist/agent/hooks.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/agent/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAY,eAAe,EAA4B,MAAM,iCAAiC,CAAC;AAE3G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAiB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAkBtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/agent/hooks.ts"],"names":[],"mappings":"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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1983,7 +1983,7 @@ var useChat = ({
|
|
|
1983
1983
|
const _onChunk = react.useRef(void 0);
|
|
1984
1984
|
const _networkRunId = react.useRef(void 0);
|
|
1985
1985
|
const _onNetworkChunk = react.useRef(void 0);
|
|
1986
|
-
const
|
|
1986
|
+
const _activeContinuation = react.useRef({ requestContext: propsRequestContext });
|
|
1987
1987
|
const _streamAbortRef = react.useRef(null);
|
|
1988
1988
|
const _threadSubscriptionAbortRef = react.useRef(null);
|
|
1989
1989
|
const _threadSubscriptionRef = react.useRef(
|
|
@@ -2009,7 +2009,10 @@ var useChat = ({
|
|
|
2009
2009
|
_currentRunId.current = extractRunIdFromMessages(formattedMessages);
|
|
2010
2010
|
}, [initialMessages]);
|
|
2011
2011
|
react.useEffect(() => {
|
|
2012
|
-
|
|
2012
|
+
_activeContinuation.current = {
|
|
2013
|
+
..._activeContinuation.current,
|
|
2014
|
+
requestContext: propsRequestContext
|
|
2015
|
+
};
|
|
2013
2016
|
}, [propsRequestContext]);
|
|
2014
2017
|
const normalizeSignalFileData = (data) => {
|
|
2015
2018
|
if (data instanceof URL) return data.toString();
|
|
@@ -2181,6 +2184,7 @@ var useChat = ({
|
|
|
2181
2184
|
}, [agentId, closeThreadSubscription, ensureThreadSubscription, resourceId, threadId, threadSignalsDisabled]);
|
|
2182
2185
|
const generate = async ({
|
|
2183
2186
|
coreUserMessages,
|
|
2187
|
+
model,
|
|
2184
2188
|
requestContext,
|
|
2185
2189
|
threadId: threadId2,
|
|
2186
2190
|
modelSettings,
|
|
@@ -2204,7 +2208,10 @@ var useChat = ({
|
|
|
2204
2208
|
} = modelSettings || {};
|
|
2205
2209
|
const resolvedRequestContext = requestContext ?? propsRequestContext;
|
|
2206
2210
|
const resolvedClientTools = clientTools ?? hookClientTools;
|
|
2207
|
-
|
|
2211
|
+
_activeContinuation.current = {
|
|
2212
|
+
model,
|
|
2213
|
+
requestContext: resolvedRequestContext
|
|
2214
|
+
};
|
|
2208
2215
|
setIsRunning(true);
|
|
2209
2216
|
const clientWithAbort = new clientJs.MastraClient({
|
|
2210
2217
|
...baseClient.options,
|
|
@@ -2214,6 +2221,7 @@ var useChat = ({
|
|
|
2214
2221
|
const runId = uuid.v4();
|
|
2215
2222
|
_currentRunId.current = runId;
|
|
2216
2223
|
const response = await agent.generate(coreUserMessages, {
|
|
2224
|
+
model,
|
|
2217
2225
|
runId,
|
|
2218
2226
|
maxSteps,
|
|
2219
2227
|
modelSettings: {
|
|
@@ -2256,6 +2264,7 @@ var useChat = ({
|
|
|
2256
2264
|
};
|
|
2257
2265
|
const stream = async ({
|
|
2258
2266
|
coreUserMessages,
|
|
2267
|
+
model,
|
|
2259
2268
|
requestContext,
|
|
2260
2269
|
threadId: threadId2,
|
|
2261
2270
|
onChunk,
|
|
@@ -2282,6 +2291,7 @@ var useChat = ({
|
|
|
2282
2291
|
const resolvedRequestContext = requestContext ?? propsRequestContext;
|
|
2283
2292
|
const resolvedClientTools = clientTools ?? hookClientTools;
|
|
2284
2293
|
const signalContinuationOptions = {
|
|
2294
|
+
model,
|
|
2285
2295
|
maxSteps,
|
|
2286
2296
|
modelSettings: {
|
|
2287
2297
|
frequencyPenalty,
|
|
@@ -2297,7 +2307,10 @@ var useChat = ({
|
|
|
2297
2307
|
requireToolApproval,
|
|
2298
2308
|
tracingOptions
|
|
2299
2309
|
};
|
|
2300
|
-
|
|
2310
|
+
_activeContinuation.current = {
|
|
2311
|
+
model,
|
|
2312
|
+
requestContext: resolvedRequestContext
|
|
2313
|
+
};
|
|
2301
2314
|
setIsRunning(true);
|
|
2302
2315
|
_streamAbortRef.current?.abort();
|
|
2303
2316
|
const internalAbort = new AbortController();
|
|
@@ -2314,6 +2327,7 @@ var useChat = ({
|
|
|
2314
2327
|
const streamWithLegacyRoute = async () => {
|
|
2315
2328
|
const runId = uuid.v4();
|
|
2316
2329
|
const response = await agent.stream(coreUserMessages, {
|
|
2330
|
+
model,
|
|
2317
2331
|
runId,
|
|
2318
2332
|
maxSteps,
|
|
2319
2333
|
untilIdle: true,
|
|
@@ -2358,6 +2372,7 @@ var useChat = ({
|
|
|
2358
2372
|
const messageContents = getSignalContents(coreUserMessages);
|
|
2359
2373
|
const requestContextRecord = resolvedRequestContext;
|
|
2360
2374
|
const streamOptions = {
|
|
2375
|
+
model,
|
|
2361
2376
|
maxSteps,
|
|
2362
2377
|
modelSettings: {
|
|
2363
2378
|
frequencyPenalty,
|
|
@@ -2426,6 +2441,7 @@ var useChat = ({
|
|
|
2426
2441
|
};
|
|
2427
2442
|
const network = async ({
|
|
2428
2443
|
coreUserMessages,
|
|
2444
|
+
model,
|
|
2429
2445
|
requestContext,
|
|
2430
2446
|
threadId: threadId2,
|
|
2431
2447
|
onNetworkChunk,
|
|
@@ -2435,7 +2451,10 @@ var useChat = ({
|
|
|
2435
2451
|
}) => {
|
|
2436
2452
|
const { frequencyPenalty, presencePenalty, maxRetries, maxTokens, temperature, topK, topP, maxSteps } = modelSettings || {};
|
|
2437
2453
|
const resolvedRequestContext = requestContext ?? propsRequestContext;
|
|
2438
|
-
|
|
2454
|
+
_activeContinuation.current = {
|
|
2455
|
+
model,
|
|
2456
|
+
requestContext: resolvedRequestContext
|
|
2457
|
+
};
|
|
2439
2458
|
setIsRunning(true);
|
|
2440
2459
|
const clientWithAbort = new clientJs.MastraClient({
|
|
2441
2460
|
...baseClient.options,
|
|
@@ -2444,6 +2463,7 @@ var useChat = ({
|
|
|
2444
2463
|
const agent = clientWithAbort.getAgent(agentId);
|
|
2445
2464
|
const runId = uuid.v4();
|
|
2446
2465
|
const response = await agent.network(coreUserMessages, {
|
|
2466
|
+
model,
|
|
2447
2467
|
maxSteps,
|
|
2448
2468
|
modelSettings: {
|
|
2449
2469
|
frequencyPenalty,
|
|
@@ -2486,11 +2506,12 @@ var useChat = ({
|
|
|
2486
2506
|
_onChunk.current = void 0;
|
|
2487
2507
|
_networkRunId.current = void 0;
|
|
2488
2508
|
_onNetworkChunk.current = void 0;
|
|
2489
|
-
|
|
2509
|
+
_activeContinuation.current = {};
|
|
2490
2510
|
};
|
|
2491
2511
|
const approveToolCall = async (toolCallId, resumeData) => {
|
|
2492
2512
|
const onChunk = _onChunk.current;
|
|
2493
2513
|
const currentRunId = _currentRunId.current;
|
|
2514
|
+
const continuation = _activeContinuation.current;
|
|
2494
2515
|
if (!currentRunId)
|
|
2495
2516
|
return console.info("[approveToolCall] approveToolCall can only be called after a stream has started");
|
|
2496
2517
|
setIsRunning(true);
|
|
@@ -2503,8 +2524,9 @@ var useChat = ({
|
|
|
2503
2524
|
threadId,
|
|
2504
2525
|
toolCallId,
|
|
2505
2526
|
approved: true,
|
|
2527
|
+
...continuation.model !== void 0 ? { streamOptions: { model: continuation.model } } : {},
|
|
2506
2528
|
...resumeData !== void 0 ? { resumeData } : {},
|
|
2507
|
-
requestContext:
|
|
2529
|
+
requestContext: continuation.requestContext
|
|
2508
2530
|
});
|
|
2509
2531
|
pendingToolApprovalIdsRef.current.delete(toolCallId);
|
|
2510
2532
|
setIsAwaitingToolApproval(pendingToolApprovalIdsRef.current.size > 0);
|
|
@@ -2523,7 +2545,7 @@ var useChat = ({
|
|
|
2523
2545
|
const response = await agent.approveToolCall({
|
|
2524
2546
|
runId: currentRunId,
|
|
2525
2547
|
toolCallId,
|
|
2526
|
-
|
|
2548
|
+
...continuation
|
|
2527
2549
|
});
|
|
2528
2550
|
await response.processDataStream({
|
|
2529
2551
|
onChunk: async (chunk) => {
|
|
@@ -2535,6 +2557,7 @@ var useChat = ({
|
|
|
2535
2557
|
const declineToolCall = async (toolCallId) => {
|
|
2536
2558
|
const onChunk = _onChunk.current;
|
|
2537
2559
|
const currentRunId = _currentRunId.current;
|
|
2560
|
+
const continuation = _activeContinuation.current;
|
|
2538
2561
|
if (!currentRunId)
|
|
2539
2562
|
return console.info("[declineToolCall] declineToolCall can only be called after a stream has started");
|
|
2540
2563
|
setIsRunning(true);
|
|
@@ -2547,7 +2570,8 @@ var useChat = ({
|
|
|
2547
2570
|
threadId,
|
|
2548
2571
|
toolCallId,
|
|
2549
2572
|
approved: false,
|
|
2550
|
-
|
|
2573
|
+
...continuation.model !== void 0 ? { streamOptions: { model: continuation.model } } : {},
|
|
2574
|
+
requestContext: continuation.requestContext
|
|
2551
2575
|
});
|
|
2552
2576
|
pendingToolApprovalIdsRef.current.delete(toolCallId);
|
|
2553
2577
|
setIsAwaitingToolApproval(pendingToolApprovalIdsRef.current.size > 0);
|
|
@@ -2566,7 +2590,7 @@ var useChat = ({
|
|
|
2566
2590
|
const response = await agent.declineToolCall({
|
|
2567
2591
|
runId: currentRunId,
|
|
2568
2592
|
toolCallId,
|
|
2569
|
-
|
|
2593
|
+
...continuation
|
|
2570
2594
|
});
|
|
2571
2595
|
await response.processDataStream({
|
|
2572
2596
|
onChunk: async (chunk) => {
|
|
@@ -2577,6 +2601,7 @@ var useChat = ({
|
|
|
2577
2601
|
};
|
|
2578
2602
|
const approveToolCallGenerate = async (toolCallId) => {
|
|
2579
2603
|
const currentRunId = _currentRunId.current;
|
|
2604
|
+
const continuation = _activeContinuation.current;
|
|
2580
2605
|
if (!currentRunId)
|
|
2581
2606
|
return console.info(
|
|
2582
2607
|
"[approveToolCallGenerate] approveToolCallGenerate can only be called after a generate has started"
|
|
@@ -2587,7 +2612,7 @@ var useChat = ({
|
|
|
2587
2612
|
const response = await agent.approveToolCallGenerate({
|
|
2588
2613
|
runId: currentRunId,
|
|
2589
2614
|
toolCallId,
|
|
2590
|
-
|
|
2615
|
+
...continuation
|
|
2591
2616
|
});
|
|
2592
2617
|
if (response && "uiMessages" in response.response && response.response.uiMessages) {
|
|
2593
2618
|
const dbMessages = dbFromServerUiMessages(response.response.uiMessages, { mode: "generate" });
|
|
@@ -2597,6 +2622,7 @@ var useChat = ({
|
|
|
2597
2622
|
};
|
|
2598
2623
|
const declineToolCallGenerate = async (toolCallId) => {
|
|
2599
2624
|
const currentRunId = _currentRunId.current;
|
|
2625
|
+
const continuation = _activeContinuation.current;
|
|
2600
2626
|
if (!currentRunId)
|
|
2601
2627
|
return console.info(
|
|
2602
2628
|
"[declineToolCallGenerate] declineToolCallGenerate can only be called after a generate has started"
|
|
@@ -2607,7 +2633,7 @@ var useChat = ({
|
|
|
2607
2633
|
const response = await agent.declineToolCallGenerate({
|
|
2608
2634
|
runId: currentRunId,
|
|
2609
2635
|
toolCallId,
|
|
2610
|
-
|
|
2636
|
+
...continuation
|
|
2611
2637
|
});
|
|
2612
2638
|
if (response && "uiMessages" in response.response && response.response.uiMessages) {
|
|
2613
2639
|
const dbMessages = dbFromServerUiMessages(response.response.uiMessages, { mode: "generate" });
|
|
@@ -2618,6 +2644,7 @@ var useChat = ({
|
|
|
2618
2644
|
const approveNetworkToolCall = async (toolName, runId) => {
|
|
2619
2645
|
const onNetworkChunk = _onNetworkChunk.current;
|
|
2620
2646
|
const networkRunId = runId || _networkRunId.current;
|
|
2647
|
+
const continuation = _activeContinuation.current;
|
|
2621
2648
|
if (!networkRunId)
|
|
2622
2649
|
return console.info(
|
|
2623
2650
|
"[approveNetworkToolCall] approveNetworkToolCall can only be called after a network stream has started"
|
|
@@ -2630,7 +2657,7 @@ var useChat = ({
|
|
|
2630
2657
|
const agent = baseClient.getAgent(agentId);
|
|
2631
2658
|
const response = await agent.approveNetworkToolCall({
|
|
2632
2659
|
runId: networkRunId,
|
|
2633
|
-
|
|
2660
|
+
...continuation
|
|
2634
2661
|
});
|
|
2635
2662
|
await response.processDataStream({
|
|
2636
2663
|
onChunk: async (chunk) => {
|
|
@@ -2644,6 +2671,7 @@ var useChat = ({
|
|
|
2644
2671
|
const declineNetworkToolCall = async (toolName, runId) => {
|
|
2645
2672
|
const onNetworkChunk = _onNetworkChunk.current;
|
|
2646
2673
|
const networkRunId = runId || _networkRunId.current;
|
|
2674
|
+
const continuation = _activeContinuation.current;
|
|
2647
2675
|
if (!networkRunId)
|
|
2648
2676
|
return console.info(
|
|
2649
2677
|
"[declineNetworkToolCall] declineNetworkToolCall can only be called after a network stream has started"
|
|
@@ -2656,7 +2684,7 @@ var useChat = ({
|
|
|
2656
2684
|
const agent = baseClient.getAgent(agentId);
|
|
2657
2685
|
const response = await agent.declineNetworkToolCall({
|
|
2658
2686
|
runId: networkRunId,
|
|
2659
|
-
|
|
2687
|
+
...continuation
|
|
2660
2688
|
});
|
|
2661
2689
|
await response.processDataStream({
|
|
2662
2690
|
onChunk: async (chunk) => {
|