@mastra/playground-ui 19.0.0-alpha.3 → 19.0.0-alpha.5
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 +47 -0
- package/dist/index.cjs.js +29 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +29 -3
- package/dist/index.es.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @mastra/playground-ui
|
|
2
2
|
|
|
3
|
+
## 19.0.0-alpha.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`f21c626`](https://github.com/mastra-ai/mastra/commit/f21c6263789903ab9720b4d11373093298e97f15)]:
|
|
8
|
+
- @mastra/core@1.16.0-alpha.5
|
|
9
|
+
- @mastra/client-js@1.10.0-alpha.5
|
|
10
|
+
- @mastra/react@0.2.17-alpha.5
|
|
11
|
+
|
|
12
|
+
## 19.0.0-alpha.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Added `ModelByInputTokens` in `@mastra/memory` for token-threshold-based model selection in Observational Memory. ([#14614](https://github.com/mastra-ai/mastra/pull/14614))
|
|
17
|
+
|
|
18
|
+
When configured, OM automatically selects different observer or reflector models based on the actual input token count at the time the OM call runs.
|
|
19
|
+
|
|
20
|
+
Example usage:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { Memory, ModelByInputTokens } from '@mastra/memory';
|
|
24
|
+
|
|
25
|
+
const memory = new Memory({
|
|
26
|
+
options: {
|
|
27
|
+
observationalMemory: {
|
|
28
|
+
model: new ModelByInputTokens({
|
|
29
|
+
upTo: {
|
|
30
|
+
10_000: 'google/gemini-2.5-flash',
|
|
31
|
+
40_000: 'openai/gpt-4o',
|
|
32
|
+
1_000_000: 'openai/gpt-4.5',
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The `upTo` keys are inclusive upper bounds. OM resolves the matching tier directly at the observer or reflector call site. If the input exceeds the largest configured threshold, OM throws an error.
|
|
41
|
+
|
|
42
|
+
Improved Observational Memory tracing so traces show the observer and reflector spans and make it easier to see which resolved model was used at runtime.
|
|
43
|
+
|
|
44
|
+
- Updated dependencies [[`f14604c`](https://github.com/mastra-ai/mastra/commit/f14604c7ef01ba794e1a8d5c7bae5415852aacec), [`e06b520`](https://github.com/mastra-ai/mastra/commit/e06b520bdd5fdef844760c5e692c7852cbc5c240), [`dd9c4e0`](https://github.com/mastra-ai/mastra/commit/dd9c4e0a47962f1413e9b72114fcad912e19a0a6)]:
|
|
45
|
+
- @mastra/core@1.16.0-alpha.4
|
|
46
|
+
- @mastra/client-js@1.10.0-alpha.4
|
|
47
|
+
- @mastra/ai-sdk@1.2.1-alpha.0
|
|
48
|
+
- @mastra/react@0.2.17-alpha.4
|
|
49
|
+
|
|
3
50
|
## 19.0.0-alpha.3
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -22783,6 +22783,8 @@ const AgentMemoryConfig = ({ agentId }) => {
|
|
|
22783
22783
|
};
|
|
22784
22784
|
|
|
22785
22785
|
const formatTokens = (n) => {
|
|
22786
|
+
if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
|
|
22787
|
+
if (n >= 1e5) return `${(n / 1e3).toFixed(0)}k`;
|
|
22786
22788
|
if (n >= 1e3) return `${(n / 1e3).toFixed(1)}k`;
|
|
22787
22789
|
return Math.round(n).toString();
|
|
22788
22790
|
};
|
|
@@ -22790,6 +22792,11 @@ const getBarColor = (percentage) => {
|
|
|
22790
22792
|
if (percentage >= 60) return "bg-blue-500";
|
|
22791
22793
|
return "bg-green-500";
|
|
22792
22794
|
};
|
|
22795
|
+
const getModelLabel = (model, modelRouting) => {
|
|
22796
|
+
if (typeof model === "string") return model;
|
|
22797
|
+
if (modelRouting?.length) return "Auto (tiered)";
|
|
22798
|
+
return void 0;
|
|
22799
|
+
};
|
|
22793
22800
|
const useElapsedTime = (isActive) => {
|
|
22794
22801
|
const [elapsed, setElapsed] = React.useState(0);
|
|
22795
22802
|
const startTimeRef = React.useRef(null);
|
|
@@ -22816,6 +22823,7 @@ const ProgressBar = ({
|
|
|
22816
22823
|
label,
|
|
22817
22824
|
isActive = false,
|
|
22818
22825
|
model,
|
|
22826
|
+
modelRouting,
|
|
22819
22827
|
baseThreshold,
|
|
22820
22828
|
totalBudget
|
|
22821
22829
|
}) => {
|
|
@@ -22848,7 +22856,15 @@ const ProgressBar = ({
|
|
|
22848
22856
|
" ",
|
|
22849
22857
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-neutral5", children: model || "not configured" })
|
|
22850
22858
|
] }),
|
|
22851
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
22859
|
+
modelRouting?.length ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
22860
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-neutral4", children: "Routing:" }),
|
|
22861
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 pl-2 space-y-0.5", children: modelRouting.map((route) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-neutral5", children: [
|
|
22862
|
+
"≤",
|
|
22863
|
+
formatTokens(route.upTo),
|
|
22864
|
+
" → ",
|
|
22865
|
+
route.model
|
|
22866
|
+
] }, `${route.upTo}-${route.model}`)) })
|
|
22867
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
22852
22868
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-neutral4", children: "Threshold:" }),
|
|
22853
22869
|
" ",
|
|
22854
22870
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-neutral5", children: [
|
|
@@ -22969,8 +22985,16 @@ const AgentObservationalMemory = ({ agentId, resourceId, threadId }) => {
|
|
|
22969
22985
|
const history = omData?.history ?? [];
|
|
22970
22986
|
const omAgentConfig = configData?.config?.observationalMemory;
|
|
22971
22987
|
const recordConfig = record?.config;
|
|
22972
|
-
const
|
|
22973
|
-
const
|
|
22988
|
+
const observationModelRouting = recordConfig?.observationModelRouting ?? recordConfig?.observation?.routing ?? omAgentConfig?.observationModelRouting ?? omAgentConfig?.observation?.routing;
|
|
22989
|
+
const reflectionModelRouting = recordConfig?.reflectionModelRouting ?? recordConfig?.reflection?.routing ?? omAgentConfig?.reflectionModelRouting ?? omAgentConfig?.reflection?.routing;
|
|
22990
|
+
const observationModel = getModelLabel(
|
|
22991
|
+
recordConfig?.observationModel ?? recordConfig?.observation?.model ?? omAgentConfig?.observationModel ?? omAgentConfig?.model ?? omAgentConfig?.observation?.model,
|
|
22992
|
+
observationModelRouting
|
|
22993
|
+
);
|
|
22994
|
+
const reflectionModel = getModelLabel(
|
|
22995
|
+
recordConfig?.reflectionModel ?? recordConfig?.reflection?.model ?? omAgentConfig?.reflectionModel ?? omAgentConfig?.model ?? omAgentConfig?.reflection?.model,
|
|
22996
|
+
reflectionModelRouting
|
|
22997
|
+
);
|
|
22974
22998
|
const getThresholdValue = (threshold, defaultValue) => {
|
|
22975
22999
|
if (!threshold) return defaultValue;
|
|
22976
23000
|
if (typeof threshold === "number") return threshold;
|
|
@@ -23079,6 +23103,7 @@ const AgentObservationalMemory = ({ agentId, resourceId, threadId }) => {
|
|
|
23079
23103
|
label: "Messages",
|
|
23080
23104
|
isActive: isObserving,
|
|
23081
23105
|
model: observationModel,
|
|
23106
|
+
modelRouting: observationModelRouting,
|
|
23082
23107
|
baseThreshold: baseMessageTokens,
|
|
23083
23108
|
totalBudget
|
|
23084
23109
|
}
|
|
@@ -23092,6 +23117,7 @@ const AgentObservationalMemory = ({ agentId, resourceId, threadId }) => {
|
|
|
23092
23117
|
isActive: isReflecting,
|
|
23093
23118
|
baseThreshold: baseObservationTokens,
|
|
23094
23119
|
model: reflectionModel,
|
|
23120
|
+
modelRouting: reflectionModelRouting,
|
|
23095
23121
|
totalBudget
|
|
23096
23122
|
}
|
|
23097
23123
|
)
|