@mastra/server 1.74.0 → 1.75.0-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/dist/{dist-D-O086vY.js → dist-DH39C5Bz.js} +50 -9
- package/dist/{dist-D-O086vY.js.map → dist-DH39C5Bz.js.map} +1 -1
- package/dist/{dist-BACW0Que.cjs → dist-IDt748Ya.cjs} +50 -9
- package/dist/{dist-BACW0Que.cjs.map → dist-IDt748Ya.cjs.map} +1 -1
- 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/responses.adapter.cjs +3 -2
- package/dist/server/handlers/responses.adapter.cjs.map +1 -1
- package/dist/server/handlers/responses.adapter.d.ts.map +1 -1
- package/dist/server/handlers/responses.adapter.js +3 -2
- package/dist/server/handlers/responses.adapter.js.map +1 -1
- package/package.json +5 -5
|
@@ -4637,7 +4637,7 @@ function splitLines(text) {
|
|
|
4637
4637
|
return result;
|
|
4638
4638
|
}
|
|
4639
4639
|
//#endregion
|
|
4640
|
-
//#region ../memory/dist/src-
|
|
4640
|
+
//#region ../memory/dist/src-BV9eXuMM.js
|
|
4641
4641
|
var __defProp$3 = Object.defineProperty;
|
|
4642
4642
|
var __exportAll = (all, no_symbols) => {
|
|
4643
4643
|
let target = {};
|
|
@@ -30498,8 +30498,23 @@ function getOpenAIPromptCacheRetention(providerOptions) {
|
|
|
30498
30498
|
const openaiOptions = providerOptions?.openai;
|
|
30499
30499
|
return typeof openaiOptions?.promptCacheRetention === "string" ? openaiOptions.promptCacheRetention.toLowerCase() : void 0;
|
|
30500
30500
|
}
|
|
30501
|
+
function isActivationTTLMap(activateAfterIdle) {
|
|
30502
|
+
return typeof activateAfterIdle === "object" && activateAfterIdle !== null;
|
|
30503
|
+
}
|
|
30504
|
+
/** The configured TTL for marker payloads. Per-provider maps are omitted; markers only carry scalar values. */
|
|
30505
|
+
function getMarkerActivationTTL(activateAfterIdle) {
|
|
30506
|
+
return isActivationTTLMap(activateAfterIdle) ? void 0 : activateAfterIdle;
|
|
30507
|
+
}
|
|
30508
|
+
/** A map entry applies when its key equals the model's provider before the first `.`, lowercased. */
|
|
30509
|
+
function resolveActivationTTLMapEntry(activateAfterIdle, modelContext) {
|
|
30510
|
+
const providerKey = normalize(modelContext?.provider).split(".")[0];
|
|
30511
|
+
if (providerKey && Object.hasOwn(activateAfterIdle.providers, providerKey)) return activateAfterIdle.providers[providerKey];
|
|
30512
|
+
return activateAfterIdle.default;
|
|
30513
|
+
}
|
|
30501
30514
|
function resolveActivationTTL(activateAfterIdle, modelContext) {
|
|
30502
|
-
|
|
30515
|
+
const ttl = isActivationTTLMap(activateAfterIdle) ? resolveActivationTTLMapEntry(activateAfterIdle, modelContext) : activateAfterIdle;
|
|
30516
|
+
if (ttl === void 0 || ttl === false) return;
|
|
30517
|
+
if (ttl !== "auto") return ttl;
|
|
30503
30518
|
return resolveAutoActivationTTL(modelContext);
|
|
30504
30519
|
}
|
|
30505
30520
|
function resolveAutoActivationTTL(modelContext) {
|
|
@@ -33273,7 +33288,7 @@ var ReflectorRunner = class {
|
|
|
33273
33288
|
messageTokens: getMaxThreshold(this.observationConfig.messageTokens),
|
|
33274
33289
|
observationTokens: getMaxThreshold(record ? this.getEffectiveReflectionTokens(record) : this.reflectionConfig.observationTokens),
|
|
33275
33290
|
scope: this.scope,
|
|
33276
|
-
activateAfterIdle: this.reflectionConfig.activateAfterIdle
|
|
33291
|
+
activateAfterIdle: getMarkerActivationTTL(this.reflectionConfig.activateAfterIdle)
|
|
33277
33292
|
};
|
|
33278
33293
|
}
|
|
33279
33294
|
/**
|
|
@@ -33704,7 +33719,7 @@ var ReflectorRunner = class {
|
|
|
33704
33719
|
currentModel: activationMetadata?.currentModel,
|
|
33705
33720
|
config: {
|
|
33706
33721
|
...this.getObservationMarkerConfig(freshRecord),
|
|
33707
|
-
activateAfterIdle: activationMetadata?.activateAfterIdle ?? this.reflectionConfig.activateAfterIdle
|
|
33722
|
+
activateAfterIdle: activationMetadata?.activateAfterIdle ?? getMarkerActivationTTL(this.reflectionConfig.activateAfterIdle)
|
|
33708
33723
|
}
|
|
33709
33724
|
});
|
|
33710
33725
|
writer.custom({
|
|
@@ -34389,6 +34404,32 @@ function parseActivationTTL(value, fieldPath) {
|
|
|
34389
34404
|
if (!Number.isFinite(amount) || amount < 0) throw new Error(`${fieldPath} must be a non-negative number of milliseconds or a duration string like "5m".`);
|
|
34390
34405
|
return amount * (unit === "ms" || unit === "msec" || unit === "msecs" || unit === "millisecond" || unit === "milliseconds" ? 1 : unit === "s" || unit === "sec" || unit === "secs" || unit === "second" || unit === "seconds" ? 1e3 : unit === "m" || unit === "min" || unit === "mins" || unit === "minute" || unit === "minutes" ? 6e4 : 36e5);
|
|
34391
34406
|
}
|
|
34407
|
+
/**
|
|
34408
|
+
* Parse an `activateAfterIdle` config value: a scalar TTL, or a per-provider map
|
|
34409
|
+
* like `{ default: 'auto', anthropic: '1h' }`.
|
|
34410
|
+
*/
|
|
34411
|
+
function parseActivationTTLConfig(value, fieldPath) {
|
|
34412
|
+
if (typeof value !== "object") return parseActivationTTL(value, fieldPath);
|
|
34413
|
+
if (value === null || Array.isArray(value)) throw new Error(`${fieldPath} must be a TTL value or an object of per-provider TTLs, e.g. { default: 'auto', anthropic: '1h' }.`);
|
|
34414
|
+
const entries = Object.entries(value).filter(([, entryValue]) => entryValue !== void 0);
|
|
34415
|
+
if (entries.length === 0) throw new Error(`${fieldPath} must set at least one provider or "default" when using per-provider TTLs, e.g. { default: 'auto', anthropic: '1h' }.`);
|
|
34416
|
+
const parsed = { providers: Object.create(null) };
|
|
34417
|
+
const seenKeys = /* @__PURE__ */ new Set();
|
|
34418
|
+
for (const [rawKey, entryValue] of entries) {
|
|
34419
|
+
const key = rawKey.trim().toLowerCase();
|
|
34420
|
+
const entryPath = `${fieldPath}.${rawKey}`;
|
|
34421
|
+
if (!key) throw new Error(`${fieldPath} contains an empty provider key.`);
|
|
34422
|
+
if (key.includes(".") || key.includes("/")) throw new Error(`${entryPath} is not a valid provider key. Use the provider name before the first ".", e.g. "anthropic" instead of "anthropic.messages".`);
|
|
34423
|
+
if (seenKeys.has(key)) throw new Error(`${entryPath} duplicates another key in ${fieldPath}. Provider keys are case-insensitive.`);
|
|
34424
|
+
seenKeys.add(key);
|
|
34425
|
+
if (entryValue !== false && typeof entryValue !== "number" && typeof entryValue !== "string") throw new Error(`${entryPath} must be a non-negative number of milliseconds, a duration string like "5m" or "1hr", "auto", or false.`);
|
|
34426
|
+
const ttl = entryValue === false ? false : parseActivationTTL(entryValue, entryPath);
|
|
34427
|
+
if (key === "default") {
|
|
34428
|
+
if (ttl !== false) parsed.default = ttl;
|
|
34429
|
+
} else parsed.providers[key] = ttl;
|
|
34430
|
+
}
|
|
34431
|
+
return parsed;
|
|
34432
|
+
}
|
|
34392
34433
|
let hasWarnedResourceScopeDeprecation = false;
|
|
34393
34434
|
/**
|
|
34394
34435
|
* ObservationalMemory - A three-agent memory system for long conversations.
|
|
@@ -34603,7 +34644,7 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
34603
34644
|
bufferTokens: asyncBufferingDisabled ? void 0 : resolveBufferTokens(config.observation?.bufferTokens ?? OBSERVATIONAL_MEMORY_DEFAULTS.observation.bufferTokens, config.observation?.messageTokens ?? OBSERVATIONAL_MEMORY_DEFAULTS.observation.messageTokens),
|
|
34604
34645
|
bufferOnIdle: config.observation?.bufferOnIdle ?? false,
|
|
34605
34646
|
bufferActivation: asyncBufferingDisabled ? void 0 : config.observation?.bufferActivation ?? OBSERVATIONAL_MEMORY_DEFAULTS.observation.bufferActivation,
|
|
34606
|
-
activateAfterIdle:
|
|
34647
|
+
activateAfterIdle: parseActivationTTLConfig(observationActivateAfterIdle, observationActivateAfterIdlePath),
|
|
34607
34648
|
activateOnProviderChange: config.observation?.activateOnProviderChange ?? config.activateOnProviderChange ?? false,
|
|
34608
34649
|
blockAfter: asyncBufferingDisabled ? void 0 : resolveBlockAfter(config.observation?.blockAfter ?? (config.observation?.bufferTokens ?? OBSERVATIONAL_MEMORY_DEFAULTS.observation.bufferTokens ? 1.2 : void 0), config.observation?.messageTokens ?? OBSERVATIONAL_MEMORY_DEFAULTS.observation.messageTokens),
|
|
34609
34650
|
previousObserverTokens: config.observation?.previousObserverTokens ?? 2e3,
|
|
@@ -34628,7 +34669,7 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
34628
34669
|
},
|
|
34629
34670
|
providerOptions: config.reflection?.providerOptions ?? OBSERVATIONAL_MEMORY_DEFAULTS.reflection.providerOptions,
|
|
34630
34671
|
bufferActivation: asyncBufferingDisabled ? void 0 : config?.reflection?.bufferActivation ?? OBSERVATIONAL_MEMORY_DEFAULTS.reflection.bufferActivation,
|
|
34631
|
-
activateAfterIdle:
|
|
34672
|
+
activateAfterIdle: parseActivationTTLConfig(config.reflection?.activateAfterIdle, "reflection.activateAfterIdle"),
|
|
34632
34673
|
activateOnProviderChange: config.reflection?.activateOnProviderChange ?? false,
|
|
34633
34674
|
blockAfter: asyncBufferingDisabled ? void 0 : resolveBlockAfter(config.reflection?.blockAfter ?? (config.reflection?.bufferActivation ?? OBSERVATIONAL_MEMORY_DEFAULTS.reflection.bufferActivation ? 1.2 : void 0), config.reflection?.observationTokens ?? OBSERVATIONAL_MEMORY_DEFAULTS.reflection.observationTokens),
|
|
34634
34675
|
instruction: config.reflection?.instruction,
|
|
@@ -34954,7 +34995,7 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
34954
34995
|
messageTokens: getMaxThreshold(this.observationConfig.messageTokens),
|
|
34955
34996
|
observationTokens: getMaxThreshold(this.reflectionConfig.observationTokens),
|
|
34956
34997
|
scope: this.scope,
|
|
34957
|
-
activateAfterIdle: this.observationConfig.activateAfterIdle
|
|
34998
|
+
activateAfterIdle: getMarkerActivationTTL(this.observationConfig.activateAfterIdle)
|
|
34958
34999
|
};
|
|
34959
35000
|
}
|
|
34960
35001
|
/**
|
|
@@ -36355,7 +36396,7 @@ ${formattedMessages}
|
|
|
36355
36396
|
currentModel,
|
|
36356
36397
|
config: {
|
|
36357
36398
|
...this.getObservationMarkerConfig(),
|
|
36358
|
-
activateAfterIdle: activationActivateAfterIdle ?? this.observationConfig.activateAfterIdle
|
|
36399
|
+
activateAfterIdle: activationActivateAfterIdle ?? getMarkerActivationTTL(this.observationConfig.activateAfterIdle)
|
|
36359
36400
|
}
|
|
36360
36401
|
});
|
|
36361
36402
|
opts.writer.custom({
|
|
@@ -50333,4 +50374,4 @@ const agentBuilderWorkflows = {
|
|
|
50333
50374
|
//#endregion
|
|
50334
50375
|
exports.agentBuilderWorkflows = agentBuilderWorkflows;
|
|
50335
50376
|
|
|
50336
|
-
//# sourceMappingURL=dist-
|
|
50377
|
+
//# sourceMappingURL=dist-IDt748Ya.cjs.map
|