@mastra/server 1.62.0-alpha.7 → 1.62.0-alpha.9
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 +16 -0
- package/dist/{datasets-DmN9V4rU.js → datasets-CInAtVdf.js} +3 -1
- package/dist/datasets-CInAtVdf.js.map +1 -0
- package/dist/{datasets-CNtKg_3d.cjs → datasets-DYhcB-od.cjs} +3 -1
- package/dist/datasets-DYhcB-od.cjs.map +1 -0
- package/dist/{dist-CY6Z5mkR.cjs → dist-Czh_Btxb.cjs} +42 -5
- package/dist/dist-Czh_Btxb.cjs.map +1 -0
- package/dist/{dist-TEiNnD_u.js → dist-DkFSqWZ7.js} +42 -5
- package/dist/dist-DkFSqWZ7.js.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/datasets.cjs +1 -1
- package/dist/server/handlers/datasets.d.ts +10 -0
- package/dist/server/handlers/datasets.d.ts.map +1 -1
- package/dist/server/handlers/datasets.js +1 -1
- package/dist/server/schemas/datasets.d.ts +4 -0
- package/dist/server/schemas/datasets.d.ts.map +1 -1
- package/dist/server/schemas/index.cjs +1 -1
- package/dist/server/schemas/index.js +1 -1
- package/dist/server/server-adapter/routes/datasets.d.ts +10 -0
- package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/datasets-CNtKg_3d.cjs.map +0 -1
- package/dist/datasets-DmN9V4rU.js.map +0 -1
- package/dist/dist-CY6Z5mkR.cjs.map +0 -1
- package/dist/dist-TEiNnD_u.js.map +0 -1
|
@@ -4693,7 +4693,7 @@ function splitLines(text) {
|
|
|
4693
4693
|
return result;
|
|
4694
4694
|
}
|
|
4695
4695
|
//#endregion
|
|
4696
|
-
//#region ../memory/dist/src-
|
|
4696
|
+
//#region ../memory/dist/src-BTHCV1ov.js
|
|
4697
4697
|
var __defProp$3 = Object.defineProperty;
|
|
4698
4698
|
var __exportAll = (all, no_symbols) => {
|
|
4699
4699
|
let target = {};
|
|
@@ -8927,6 +8927,7 @@ async function cancelResponseBody$1(response) {
|
|
|
8927
8927
|
var initialGlobalFetch$1 = globalThis.fetch;
|
|
8928
8928
|
isNodeDefaultFetch$1(initialGlobalFetch$1);
|
|
8929
8929
|
function isNodeDefaultFetch$1(fetch) {
|
|
8930
|
+
if (typeof fetch !== "function") return false;
|
|
8930
8931
|
const source = Function.prototype.toString.call(fetch);
|
|
8931
8932
|
return source.includes("internal/deps/undici") || source.includes("lazy loading of undici");
|
|
8932
8933
|
}
|
|
@@ -13818,6 +13819,7 @@ var DownloadError$2 = class extends (_b$2$1 = AISDKError$3, _a$2$1 = symbol$2$1,
|
|
|
13818
13819
|
var initialGlobalFetch$2 = globalThis.fetch;
|
|
13819
13820
|
isNodeDefaultFetch$2(initialGlobalFetch$2);
|
|
13820
13821
|
function isNodeDefaultFetch$2(fetch) {
|
|
13822
|
+
if (typeof fetch !== "function") return false;
|
|
13821
13823
|
const source = Function.prototype.toString.call(fetch);
|
|
13822
13824
|
return source.includes("internal/deps/undici") || source.includes("lazy loading of undici");
|
|
13823
13825
|
}
|
|
@@ -29908,6 +29910,21 @@ var ReflectorRunner = class {
|
|
|
29908
29910
|
memory;
|
|
29909
29911
|
onReflectionCommitted;
|
|
29910
29912
|
mastra;
|
|
29913
|
+
/**
|
|
29914
|
+
* Per-lock-key observation-token count of the last unproductive synchronous
|
|
29915
|
+
* reflection (failed, or committed while still over the reflection
|
|
29916
|
+
* threshold). `call()` already runs the full bounded compression ladder for
|
|
29917
|
+
* a given input, so re-running it against unchanged observations cannot
|
|
29918
|
+
* succeed — threshold-triggered sync reflection is skipped while the count
|
|
29919
|
+
* is unchanged and retried as soon as the input differs.
|
|
29920
|
+
* Keyed by lock key (thread/resource), which is stable across generations —
|
|
29921
|
+
* record ids change every time a generation is created.
|
|
29922
|
+
*
|
|
29923
|
+
* Lifecycle: an entry is deleted when a sync reflection finishes under
|
|
29924
|
+
* threshold and replaced on each unproductive attempt. Entries are one
|
|
29925
|
+
* number per active thread/resource key and live for the runner's lifetime.
|
|
29926
|
+
*/
|
|
29927
|
+
syncReflectionSuppression = /* @__PURE__ */ new Map();
|
|
29911
29928
|
constructor(opts) {
|
|
29912
29929
|
this.reflectionConfig = opts.reflectionConfig;
|
|
29913
29930
|
this.observationConfig = opts.observationConfig;
|
|
@@ -29990,6 +30007,8 @@ var ReflectorRunner = class {
|
|
|
29990
30007
|
};
|
|
29991
30008
|
let reflectedTokens = 0;
|
|
29992
30009
|
let attemptNumber = 0;
|
|
30010
|
+
/** True when the latest attempt returned an empty block for non-empty input. */
|
|
30011
|
+
let emptyOutput = false;
|
|
29993
30012
|
while (currentLevel <= maxLevel) {
|
|
29994
30013
|
attemptNumber++;
|
|
29995
30014
|
const isRetry = attemptNumber > 1;
|
|
@@ -30053,14 +30072,18 @@ var ReflectorRunner = class {
|
|
|
30053
30072
|
}
|
|
30054
30073
|
finalProviderMetadata = result.providerMetadata ?? finalProviderMetadata;
|
|
30055
30074
|
parsed = parseReflectorOutput(result.text, observations, activeExtractors);
|
|
30075
|
+
emptyOutput = !parsed.degenerate && observations.trim().length > 0 && parsed.observations.trim().length === 0;
|
|
30056
30076
|
if (parsed.degenerate) {
|
|
30057
30077
|
omDebug(`[OM:callReflector] attempt #${attemptNumber}: degenerate repetition detected, treating as compression failure. ${describeDegenerateOutput(result.text, 2e3)}`);
|
|
30058
30078
|
reflectedTokens = originalTokens;
|
|
30079
|
+
} else if (emptyOutput) {
|
|
30080
|
+
omDebug(`[OM:callReflector] attempt #${attemptNumber}: empty observations block for non-empty input, treating as compression failure`);
|
|
30081
|
+
reflectedTokens = originalTokens;
|
|
30059
30082
|
} else reflectedTokens = this.tokenCounter.countObservations(parsed.observations);
|
|
30060
30083
|
omDebug(`[OM:callReflector] attempt #${attemptNumber} parsed: reflectedTokens=${reflectedTokens}, targetThreshold=${targetThreshold}, compressionValid=${validateCompression(reflectedTokens, targetThreshold)}, parsedObsLen=${parsed.observations?.length}, degenerate=${parsed.degenerate ?? false}`);
|
|
30061
|
-
if (!parsed.degenerate && (validateCompression(reflectedTokens, targetThreshold) || currentLevel >= maxLevel)) break;
|
|
30062
|
-
if (parsed.degenerate && currentLevel >= maxLevel) {
|
|
30063
|
-
omDebug(`[OM:callReflector] degenerate output persists at maxLevel=${maxLevel}, breaking`);
|
|
30084
|
+
if (!parsed.degenerate && !emptyOutput && (validateCompression(reflectedTokens, targetThreshold) || currentLevel >= maxLevel)) break;
|
|
30085
|
+
if ((parsed.degenerate || emptyOutput) && currentLevel >= maxLevel) {
|
|
30086
|
+
omDebug(`[OM:callReflector] ${parsed.degenerate ? "degenerate" : "empty"} output persists at maxLevel=${maxLevel}, breaking`);
|
|
30064
30087
|
break;
|
|
30065
30088
|
}
|
|
30066
30089
|
if (streamContext?.writer) {
|
|
@@ -30098,6 +30121,7 @@ var ReflectorRunner = class {
|
|
|
30098
30121
|
}
|
|
30099
30122
|
currentLevel = Math.min(currentLevel + 1, maxLevel);
|
|
30100
30123
|
}
|
|
30124
|
+
if (observations.trim().length > 0 && parsed.observations.trim().length === 0) throw new Error(`Reflector produced empty output after ${attemptNumber} attempt(s)${parsed.degenerate ? " (degenerate repetition)" : ""} — refusing to commit an empty reflection over ${originalTokens} observation tokens`);
|
|
30101
30125
|
const structuredExtraction = await extractStructuredValues({
|
|
30102
30126
|
agent,
|
|
30103
30127
|
source: "reflector",
|
|
@@ -30451,6 +30475,13 @@ var ReflectorRunner = class {
|
|
|
30451
30475
|
return;
|
|
30452
30476
|
}
|
|
30453
30477
|
}
|
|
30478
|
+
if (activationTriggeredBy === "threshold") {
|
|
30479
|
+
const suppressedAtTokens = this.syncReflectionSuppression.get(lockKey);
|
|
30480
|
+
if (suppressedAtTokens !== void 0 && observationTokens === suppressedAtTokens) {
|
|
30481
|
+
omDebug(`[OM:reflect] skipping sync reflection — observations unchanged at ${observationTokens} tokens since the last unproductive attempt; retrying once they change`);
|
|
30482
|
+
return;
|
|
30483
|
+
}
|
|
30484
|
+
}
|
|
30454
30485
|
await this.storage.setReflectingFlag(record.id, true);
|
|
30455
30486
|
registerOp(record.id, "reflecting");
|
|
30456
30487
|
const cycleId = crypto.randomUUID();
|
|
@@ -30511,6 +30542,8 @@ var ReflectorRunner = class {
|
|
|
30511
30542
|
reflection: reflectResult.observations,
|
|
30512
30543
|
tokenCount: reflectionTokenCount
|
|
30513
30544
|
});
|
|
30545
|
+
if (reflectionTokenCount >= reflectThreshold) this.syncReflectionSuppression.set(lockKey, reflectionTokenCount);
|
|
30546
|
+
else this.syncReflectionSuppression.delete(lockKey);
|
|
30514
30547
|
await this.notifyReflectionCommitted({
|
|
30515
30548
|
parentThreadId: requestedThreadId ?? record.threadId ?? "",
|
|
30516
30549
|
resourceId: record.resourceId ?? "",
|
|
@@ -30570,6 +30603,7 @@ var ReflectorRunner = class {
|
|
|
30570
30603
|
}
|
|
30571
30604
|
reflectionError = error instanceof Error ? error : new Error(String(error));
|
|
30572
30605
|
if (lifecycleError !== void 0 || abortSignal?.aborted) throw error;
|
|
30606
|
+
this.syncReflectionSuppression.set(lockKey, observationTokens);
|
|
30573
30607
|
omError("[OM] Reflection failed", error);
|
|
30574
30608
|
} finally {
|
|
30575
30609
|
try {
|
|
@@ -35007,6 +35041,7 @@ ${workingMemory}`;
|
|
|
35007
35041
|
instruction: omConfig.observation.instruction,
|
|
35008
35042
|
threadTitle: omConfig.observation.threadTitle,
|
|
35009
35043
|
observeAttachments: omConfig.observation.observeAttachments,
|
|
35044
|
+
continuationHints: omConfig.observation.continuationHints,
|
|
35010
35045
|
extract: omConfig.observation.extract
|
|
35011
35046
|
} : void 0,
|
|
35012
35047
|
reflection: omConfig.reflection ? {
|
|
@@ -35017,6 +35052,7 @@ ${workingMemory}`;
|
|
|
35017
35052
|
bufferActivation: omConfig.reflection.bufferActivation,
|
|
35018
35053
|
blockAfter: omConfig.reflection.blockAfter,
|
|
35019
35054
|
instruction: omConfig.reflection.instruction,
|
|
35055
|
+
continuationHints: omConfig.reflection.continuationHints,
|
|
35020
35056
|
extract: omConfig.reflection.extract
|
|
35021
35057
|
} : void 0
|
|
35022
35058
|
});
|
|
@@ -41184,6 +41220,7 @@ async function cancelResponseBody(response) {
|
|
|
41184
41220
|
var initialGlobalFetch = globalThis.fetch;
|
|
41185
41221
|
isNodeDefaultFetch(initialGlobalFetch);
|
|
41186
41222
|
function isNodeDefaultFetch(fetch) {
|
|
41223
|
+
if (typeof fetch !== "function") return false;
|
|
41187
41224
|
const source = Function.prototype.toString.call(fetch);
|
|
41188
41225
|
return source.includes("internal/deps/undici") || source.includes("lazy loading of undici");
|
|
41189
41226
|
}
|
|
@@ -46310,4 +46347,4 @@ const agentBuilderWorkflows = {
|
|
|
46310
46347
|
//#endregion
|
|
46311
46348
|
export { agentBuilderWorkflows };
|
|
46312
46349
|
|
|
46313
|
-
//# sourceMappingURL=dist-
|
|
46350
|
+
//# sourceMappingURL=dist-DkFSqWZ7.js.map
|