@mastra/server 1.58.0-alpha.7 → 1.58.0-alpha.8
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 +9 -0
- package/dist/{dist-DkY6iCA4.js → dist-D-2BtcNU.js} +18 -12
- package/dist/dist-D-2BtcNU.js.map +1 -0
- package/dist/{dist-fvOsjRn_.cjs → dist-DhqgxyoU.cjs} +18 -12
- package/dist/dist-DhqgxyoU.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/server/handlers/agent-builder.cjs +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/workflows.cjs +52 -21
- package/dist/server/handlers/workflows.cjs.map +1 -1
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +53 -22
- package/dist/server/handlers/workflows.js.map +1 -1
- package/package.json +7 -7
- package/dist/dist-DkY6iCA4.js.map +0 -1
- package/dist/dist-fvOsjRn_.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
+
## 1.58.0-alpha.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix workflow stream caching being tied to a single client connection. Cached chunks are now written per run rather than per subscriber, so `/observe` replays a complete history after a client disconnects mid-run, and concurrent subscribers to the same run no longer cache every chunk twice. ([#21020](https://github.com/mastra-ai/mastra/pull/21020))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`1c75e32`](https://github.com/mastra-ai/mastra/commit/1c75e32f7fc0b9fb6f548b4407feaec8a1440212), [`c47165c`](https://github.com/mastra-ai/mastra/commit/c47165c983c87594c6952f1fd2fa51a90205034c), [`e08e789`](https://github.com/mastra-ai/mastra/commit/e08e789c1bf4cd2fe46363f7a4728536ceccc9bd), [`35cc901`](https://github.com/mastra-ai/mastra/commit/35cc90102cf834a84827acaf9eee0b6d6d1e2a3b), [`a8b4cf0`](https://github.com/mastra-ai/mastra/commit/a8b4cf02823cffebc4751a53337dfacf097c1ae1), [`f33264f`](https://github.com/mastra-ai/mastra/commit/f33264f517ae603279afd5c4251e2b40f6dd3618), [`689f2c4`](https://github.com/mastra-ai/mastra/commit/689f2c4b6c0835fe455702b01d21daa8abcd9331), [`eeae63e`](https://github.com/mastra-ai/mastra/commit/eeae63e7fbe8e1f237adc69bca6e2ac13c5ca907), [`4c186a0`](https://github.com/mastra-ai/mastra/commit/4c186a017275f45e6ed4c09de0f89550e2d09e8c), [`b0fa077`](https://github.com/mastra-ai/mastra/commit/b0fa077bcbc9b08551846fe372a0d3d15b71ed72)]:
|
|
10
|
+
- @mastra/core@1.58.0-alpha.8
|
|
11
|
+
|
|
3
12
|
## 1.58.0-alpha.7
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -5959,7 +5959,7 @@ function splitLines(text) {
|
|
|
5959
5959
|
return result;
|
|
5960
5960
|
}
|
|
5961
5961
|
//#endregion
|
|
5962
|
-
//#region ../memory/dist/src-
|
|
5962
|
+
//#region ../memory/dist/src-hv0DMVM-.js
|
|
5963
5963
|
var __defProp$3 = Object.defineProperty;
|
|
5964
5964
|
var __exportAll = (all, no_symbols) => {
|
|
5965
5965
|
let target = {};
|
|
@@ -21485,6 +21485,16 @@ function sanitizeToolResultValue(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
21485
21485
|
}
|
|
21486
21486
|
return sanitizedObject;
|
|
21487
21487
|
}
|
|
21488
|
+
/**
|
|
21489
|
+
* Serializes a tool result without truncating it.
|
|
21490
|
+
*
|
|
21491
|
+
* Token accounting must see the full result: the truncation applied by
|
|
21492
|
+
* {@link formatToolResultForObserver} exists to bound what the Observer LLM reads,
|
|
21493
|
+
* not to describe what the agent's provider context actually holds.
|
|
21494
|
+
*/
|
|
21495
|
+
function serializeToolResultForTokenCounting(value) {
|
|
21496
|
+
return stringifyToolResult(value);
|
|
21497
|
+
}
|
|
21488
21498
|
function stringifyToolResult(value) {
|
|
21489
21499
|
if (typeof value === "string") return value;
|
|
21490
21500
|
const sanitized = sanitizeToolResultValue(value);
|
|
@@ -24078,7 +24088,7 @@ var TokenCounter = class TokenCounter {
|
|
|
24078
24088
|
let tokens = 0;
|
|
24079
24089
|
const cacheParts = [];
|
|
24080
24090
|
const countJsonContentPart = (contentPart) => {
|
|
24081
|
-
const formatted =
|
|
24091
|
+
const formatted = serializeToolResultForTokenCounting(contentPart);
|
|
24082
24092
|
tokens += this.countString(formatted);
|
|
24083
24093
|
cacheParts.push({
|
|
24084
24094
|
type: "json",
|
|
@@ -24441,7 +24451,7 @@ var TokenCounter = class TokenCounter {
|
|
|
24441
24451
|
const contentTokens = this.countMultimodalToolResultContent(part, resultForCounting);
|
|
24442
24452
|
if (contentTokens !== void 0) tokens += contentTokens;
|
|
24443
24453
|
else {
|
|
24444
|
-
const formattedResult =
|
|
24454
|
+
const formattedResult = serializeToolResultForTokenCounting(resultForCounting);
|
|
24445
24455
|
tokens += this.readOrPersistPartEstimate(part, usingStoredModelOutput ? "tool-result-model-output-json" : "tool-result-json", formattedResult);
|
|
24446
24456
|
}
|
|
24447
24457
|
if (typeof resultForCounting !== "string") overheadDelta -= 12;
|
|
@@ -27198,7 +27208,7 @@ var SyncObservationStrategy = class extends ObservationStrategy {
|
|
|
27198
27208
|
});
|
|
27199
27209
|
await this.storage.updateThread({
|
|
27200
27210
|
id: threadId,
|
|
27201
|
-
|
|
27211
|
+
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
27202
27212
|
metadata: newMetadata
|
|
27203
27213
|
});
|
|
27204
27214
|
if (shouldUpdateThreadTitle) threadUpdateMarker = createThreadUpdateMarker({
|
|
@@ -27388,7 +27398,7 @@ var AsyncBufferObservationStrategy = class extends ObservationStrategy {
|
|
|
27388
27398
|
});
|
|
27389
27399
|
await this.storage.updateThread({
|
|
27390
27400
|
id: threadId,
|
|
27391
|
-
|
|
27401
|
+
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
27392
27402
|
metadata: newMetadata
|
|
27393
27403
|
});
|
|
27394
27404
|
if (shouldUpdateThreadTitle) {
|
|
@@ -27731,7 +27741,7 @@ var ResourceScopedObservationStrategy = class extends ObservationStrategy {
|
|
|
27731
27741
|
});
|
|
27732
27742
|
await this.storage.updateThread({
|
|
27733
27743
|
id: update.threadId,
|
|
27734
|
-
|
|
27744
|
+
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
27735
27745
|
metadata: newMetadata
|
|
27736
27746
|
});
|
|
27737
27747
|
if (shouldUpdateThreadTitle) threadUpdateMarkers.push(createThreadUpdateMarker({
|
|
@@ -28662,7 +28672,6 @@ async function persistThreadExtractedValues(storage, extractors, threadId, value
|
|
|
28662
28672
|
});
|
|
28663
28673
|
await storage.updateThread({
|
|
28664
28674
|
id: threadId,
|
|
28665
|
-
title: thread.title ?? "",
|
|
28666
28675
|
metadata: newMetadata
|
|
28667
28676
|
});
|
|
28668
28677
|
}
|
|
@@ -31630,7 +31639,7 @@ ${formattedMessages}
|
|
|
31630
31639
|
const shouldUpdateThreadTitle = !!newTitle && newTitle.length >= 3 && newTitle !== oldTitle;
|
|
31631
31640
|
await this.storage.updateThread({
|
|
31632
31641
|
id: threadId,
|
|
31633
|
-
|
|
31642
|
+
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
31634
31643
|
metadata: newMetadata
|
|
31635
31644
|
});
|
|
31636
31645
|
}
|
|
@@ -31848,7 +31857,6 @@ ${formattedMessages}
|
|
|
31848
31857
|
});
|
|
31849
31858
|
await this.storage.updateThread({
|
|
31850
31859
|
id: threadId,
|
|
31851
|
-
title: thread.title ?? "",
|
|
31852
31860
|
metadata: newMetadata
|
|
31853
31861
|
});
|
|
31854
31862
|
}
|
|
@@ -32967,7 +32975,6 @@ var Memory = class extends MastraMemory {
|
|
|
32967
32975
|
if (!thread) throw new Error(`Thread ${threadId} not found`);
|
|
32968
32976
|
await memoryStore.updateThread({
|
|
32969
32977
|
id: threadId,
|
|
32970
|
-
title: thread.title || "",
|
|
32971
32978
|
metadata: {
|
|
32972
32979
|
...thread.metadata,
|
|
32973
32980
|
workingMemory
|
|
@@ -33056,7 +33063,6 @@ ${workingMemory}`;
|
|
|
33056
33063
|
if (!thread) throw new Error(`Thread ${threadId} not found`);
|
|
33057
33064
|
await memoryStore.updateThread({
|
|
33058
33065
|
id: threadId,
|
|
33059
|
-
title: thread.title || "",
|
|
33060
33066
|
metadata: {
|
|
33061
33067
|
...thread.metadata,
|
|
33062
33068
|
workingMemory
|
|
@@ -44772,4 +44778,4 @@ const agentBuilderWorkflows = {
|
|
|
44772
44778
|
//#endregion
|
|
44773
44779
|
export { agentBuilderWorkflows };
|
|
44774
44780
|
|
|
44775
|
-
//# sourceMappingURL=dist-
|
|
44781
|
+
//# sourceMappingURL=dist-D-2BtcNU.js.map
|