@mastra/server 1.18.0-alpha.5 → 1.18.1-alpha.0
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 +39 -0
- package/dist/{chunk-SDKSW2BQ.js → chunk-FTGC7KXM.js} +6 -6
- package/dist/{chunk-SDKSW2BQ.js.map → chunk-FTGC7KXM.js.map} +1 -1
- package/dist/{chunk-GDWCOWNR.cjs → chunk-MS7GNCN3.cjs} +19 -19
- package/dist/{chunk-GDWCOWNR.cjs.map → chunk-MS7GNCN3.cjs.map} +1 -1
- package/dist/{chunk-HUAXEKGI.cjs → chunk-POOOTRUM.cjs} +29 -22
- package/dist/chunk-POOOTRUM.cjs.map +1 -0
- package/dist/{chunk-YUTITKH2.js → chunk-U5XW3WOS.js} +29 -22
- package/dist/chunk-U5XW3WOS.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{observational-memory-SN7GKMHZ-WOK4TGDH.cjs → observational-memory-SASGM6OW-2G3RBRTW.cjs} +26 -26
- package/dist/{observational-memory-SN7GKMHZ-WOK4TGDH.cjs.map → observational-memory-SASGM6OW-2G3RBRTW.cjs.map} +1 -1
- package/dist/{observational-memory-SN7GKMHZ-IWVBFBS6.js → observational-memory-SASGM6OW-3S6D4TAF.js} +3 -3
- package/dist/{observational-memory-SN7GKMHZ-IWVBFBS6.js.map → observational-memory-SASGM6OW-3S6D4TAF.js.map} +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +1 -1
- package/dist/server/server-adapter/index.cjs +16 -16
- package/dist/server/server-adapter/index.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-HUAXEKGI.cjs.map +0 -1
- package/dist/chunk-YUTITKH2.js.map +0 -1
|
@@ -1732,10 +1732,10 @@ function stripReflectionGroupMetadata(body) {
|
|
|
1732
1732
|
function generateAnchorId() {
|
|
1733
1733
|
return crypto$1.randomBytes(8).toString("hex");
|
|
1734
1734
|
}
|
|
1735
|
-
function wrapInObservationGroup(observations, range, id = generateAnchorId(),
|
|
1735
|
+
function wrapInObservationGroup(observations, range, id = generateAnchorId(), _sourceGroupIds, kind) {
|
|
1736
1736
|
const content = observations.trim();
|
|
1737
|
-
const
|
|
1738
|
-
return `<observation-group id="${id}" range="${range}"${
|
|
1737
|
+
const kindAttr = kind ? ` kind="${kind}"` : "";
|
|
1738
|
+
return `<observation-group id="${id}" range="${range}"${kindAttr}>
|
|
1739
1739
|
${content}
|
|
1740
1740
|
</observation-group>`;
|
|
1741
1741
|
}
|
|
@@ -1755,8 +1755,8 @@ function parseObservationGroups(observations) {
|
|
|
1755
1755
|
groups.push({
|
|
1756
1756
|
id,
|
|
1757
1757
|
range,
|
|
1758
|
-
|
|
1759
|
-
|
|
1758
|
+
kind: attributes.kind,
|
|
1759
|
+
content: match[2].trim()
|
|
1760
1760
|
});
|
|
1761
1761
|
}
|
|
1762
1762
|
return groups;
|
|
@@ -1767,12 +1767,22 @@ function stripObservationGroups(observations) {
|
|
|
1767
1767
|
}
|
|
1768
1768
|
return observations.replace(OBSERVATION_GROUP_PATTERN, (_match, _attributes, content) => content.trim()).replace(/\n{3,}/g, "\n\n").trim();
|
|
1769
1769
|
}
|
|
1770
|
+
function getRangeSegments(range) {
|
|
1771
|
+
return range.split(",").map((segment) => segment.trim()).filter(Boolean);
|
|
1772
|
+
}
|
|
1770
1773
|
function combineObservationGroupRanges(groups) {
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1774
|
+
const segments = groups.flatMap((group) => getRangeSegments(group.range));
|
|
1775
|
+
if (segments.length === 0) {
|
|
1776
|
+
return "";
|
|
1777
|
+
}
|
|
1778
|
+
const firstSegment = segments[0];
|
|
1779
|
+
const lastSegment = segments[segments.length - 1];
|
|
1780
|
+
const firstStart = firstSegment?.split(":")[0]?.trim();
|
|
1781
|
+
const lastEnd = lastSegment?.split(":").at(-1)?.trim();
|
|
1782
|
+
if (firstStart && lastEnd) {
|
|
1783
|
+
return `${firstStart}:${lastEnd}`;
|
|
1784
|
+
}
|
|
1785
|
+
return Array.from(new Set(segments)).join(",");
|
|
1776
1786
|
}
|
|
1777
1787
|
function renderObservationGroupsForReflection(observations) {
|
|
1778
1788
|
const groups = parseObservationGroups(observations);
|
|
@@ -1809,15 +1819,12 @@ function deriveObservationGroupProvenance(content, groups) {
|
|
|
1809
1819
|
});
|
|
1810
1820
|
const fallbackGroup = groups[Math.min(index, groups.length - 1)];
|
|
1811
1821
|
const resolvedGroups = matchingGroups.length > 0 ? matchingGroups : fallbackGroup ? [fallbackGroup] : [];
|
|
1812
|
-
const sourceGroupIds = Array.from(
|
|
1813
|
-
new Set(resolvedGroups.flatMap((group) => [group.id, ...group.sourceGroupIds ?? []]))
|
|
1814
|
-
);
|
|
1815
1822
|
const canonicalGroupId = getCanonicalGroupId(section.heading, index);
|
|
1816
1823
|
return {
|
|
1817
1824
|
id: canonicalGroupId,
|
|
1818
1825
|
range: combineObservationGroupRanges(resolvedGroups),
|
|
1819
|
-
|
|
1820
|
-
|
|
1826
|
+
kind: "reflection",
|
|
1827
|
+
content: section.body
|
|
1821
1828
|
};
|
|
1822
1829
|
});
|
|
1823
1830
|
}
|
|
@@ -1832,13 +1839,14 @@ function reconcileObservationGroupsFromReflection(content, sourceObservations) {
|
|
|
1832
1839
|
}
|
|
1833
1840
|
const derivedGroups = deriveObservationGroupProvenance(normalizedContent, sourceGroups);
|
|
1834
1841
|
if (derivedGroups.length > 0) {
|
|
1835
|
-
return derivedGroups.map((group) => wrapInObservationGroup(group.content, group.range, group.id, group.
|
|
1842
|
+
return derivedGroups.map((group) => wrapInObservationGroup(group.content, group.range, group.id, void 0, group.kind)).join("\n\n");
|
|
1836
1843
|
}
|
|
1837
1844
|
return wrapInObservationGroup(
|
|
1838
1845
|
normalizedContent,
|
|
1839
1846
|
combineObservationGroupRanges(sourceGroups),
|
|
1840
1847
|
generateAnchorId(),
|
|
1841
|
-
|
|
1848
|
+
void 0,
|
|
1849
|
+
"reflection"
|
|
1842
1850
|
);
|
|
1843
1851
|
}
|
|
1844
1852
|
function getMaxThreshold(threshold) {
|
|
@@ -4818,11 +4826,10 @@ Aim for a 2/10 detail level. Fewer, more generic observations are better than ma
|
|
|
4818
4826
|
};
|
|
4819
4827
|
function buildReflectorPrompt(observations, manualPrompt, compressionLevel, skipContinuationHints) {
|
|
4820
4828
|
const level = typeof compressionLevel === "number" ? compressionLevel : compressionLevel ? 1 : 0;
|
|
4821
|
-
const reflectionView =
|
|
4822
|
-
const anchoredObservations = injectAnchorIds(reflectionView);
|
|
4829
|
+
const reflectionView = stripObservationGroups(observations);
|
|
4823
4830
|
let prompt = `## OBSERVATIONS TO REFLECT ON
|
|
4824
4831
|
|
|
4825
|
-
${
|
|
4832
|
+
${reflectionView}
|
|
4826
4833
|
|
|
4827
4834
|
---
|
|
4828
4835
|
|
|
@@ -9434,5 +9441,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
|
|
|
9434
9441
|
exports.stripObservationGroups = stripObservationGroups;
|
|
9435
9442
|
exports.truncateStringByTokens = truncateStringByTokens;
|
|
9436
9443
|
exports.wrapInObservationGroup = wrapInObservationGroup;
|
|
9437
|
-
//# sourceMappingURL=chunk-
|
|
9438
|
-
//# sourceMappingURL=chunk-
|
|
9444
|
+
//# sourceMappingURL=chunk-POOOTRUM.cjs.map
|
|
9445
|
+
//# sourceMappingURL=chunk-POOOTRUM.cjs.map
|