@mastra/server 1.32.0-alpha.3 → 1.32.0-alpha.4
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 +31 -0
- package/dist/{chunk-LCAQQOLF.js → chunk-356JZOB2.js} +29 -4
- package/dist/chunk-356JZOB2.js.map +1 -0
- package/dist/{chunk-RP7OLAVZ.js → chunk-4HRTLLE6.js} +38 -22
- package/dist/chunk-4HRTLLE6.js.map +1 -0
- package/dist/{chunk-TEVHVRZI.js → chunk-4WWS6GKP.js} +3 -3
- package/dist/{chunk-TEVHVRZI.js.map → chunk-4WWS6GKP.js.map} +1 -1
- package/dist/{chunk-6XN2MNYW.cjs → chunk-6AYGQBID.cjs} +39 -21
- package/dist/chunk-6AYGQBID.cjs.map +1 -0
- package/dist/{chunk-KZ3ERBUT.cjs → chunk-BNR5CIPX.cjs} +32 -3
- package/dist/chunk-BNR5CIPX.cjs.map +1 -0
- package/dist/{chunk-ZATCZFSW.cjs → chunk-BOFX5I7S.cjs} +5 -5
- package/dist/{chunk-ZATCZFSW.cjs.map → chunk-BOFX5I7S.cjs.map} +1 -1
- package/dist/{chunk-5UK4WOHD.cjs → chunk-CQUVNOZ6.cjs} +2 -2
- package/dist/chunk-CQUVNOZ6.cjs.map +1 -0
- package/dist/{chunk-ETWIAKQ7.cjs → chunk-EYSAQHCP.cjs} +4 -4
- package/dist/{chunk-ETWIAKQ7.cjs.map → chunk-EYSAQHCP.cjs.map} +1 -1
- package/dist/{chunk-OTRCNZO4.js → chunk-FQ7YYW4Q.js} +2 -2
- package/dist/chunk-FQ7YYW4Q.js.map +1 -0
- package/dist/{chunk-COAE7JJY.js → chunk-IIM2YSQ4.js} +3 -3
- package/dist/{chunk-COAE7JJY.js.map → chunk-IIM2YSQ4.js.map} +1 -1
- package/dist/{chunk-S65F3MGF.js → chunk-M5I6LD6N.js} +3 -3
- package/dist/{chunk-S65F3MGF.js.map → chunk-M5I6LD6N.js.map} +1 -1
- package/dist/{chunk-GOFGQSF7.js → chunk-MOWSRYNJ.js} +65 -6
- package/dist/chunk-MOWSRYNJ.js.map +1 -0
- package/dist/{chunk-I7EPR6KM.js → chunk-PPD3LELX.js} +24 -6
- package/dist/chunk-PPD3LELX.js.map +1 -0
- package/dist/{chunk-MIK6X2SR.cjs → chunk-Q5EQ3HQY.cjs} +6 -6
- package/dist/{chunk-MIK6X2SR.cjs.map → chunk-Q5EQ3HQY.cjs.map} +1 -1
- package/dist/{chunk-QNTYBN3J.js → chunk-QMEGOGRN.js} +3 -3
- package/dist/{chunk-QNTYBN3J.js.map → chunk-QMEGOGRN.js.map} +1 -1
- package/dist/{chunk-N4IQKTJO.cjs → chunk-RGGZPBPR.cjs} +5 -5
- package/dist/{chunk-N4IQKTJO.cjs.map → chunk-RGGZPBPR.cjs.map} +1 -1
- package/dist/{chunk-LVJUHHZY.js → chunk-RQVAWLYS.js} +3 -3
- package/dist/{chunk-LVJUHHZY.js.map → chunk-RQVAWLYS.js.map} +1 -1
- package/dist/{chunk-GVLAYCDU.cjs → chunk-SZT2CUS6.cjs} +4 -4
- package/dist/{chunk-GVLAYCDU.cjs.map → chunk-SZT2CUS6.cjs.map} +1 -1
- package/dist/{chunk-ZSEAPJ73.cjs → chunk-W4VETOUS.cjs} +4 -4
- package/dist/{chunk-ZSEAPJ73.cjs.map → chunk-W4VETOUS.cjs.map} +1 -1
- package/dist/{chunk-NP5C5PIL.js → chunk-XDGV7WG3.js} +3 -3
- package/dist/{chunk-NP5C5PIL.js.map → chunk-XDGV7WG3.js.map} +1 -1
- package/dist/{chunk-IMPWOZUQ.cjs → chunk-YTCMTRWU.cjs} +81 -20
- package/dist/chunk-YTCMTRWU.cjs.map +1 -0
- package/dist/{chunk-CPZEA2XG.cjs → chunk-ZW7DMFEG.cjs} +38 -22
- package/dist/chunk-ZW7DMFEG.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{observational-memory-UMDC4VC2-3I52URYY.cjs → observational-memory-FBBKXNO5-3V6BP5K3.cjs} +26 -26
- package/dist/{observational-memory-UMDC4VC2-3I52URYY.cjs.map → observational-memory-FBBKXNO5-3V6BP5K3.cjs.map} +1 -1
- package/dist/{observational-memory-UMDC4VC2-X5QMTUND.js → observational-memory-FBBKXNO5-I7J47ELO.js} +3 -3
- package/dist/{observational-memory-UMDC4VC2-X5QMTUND.js.map → observational-memory-FBBKXNO5-I7J47ELO.js.map} +1 -1
- package/dist/server/handlers/a2a.cjs +10 -10
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agents.cjs +38 -38
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/conversations.cjs +5 -5
- package/dist/server/handlers/conversations.js +1 -1
- package/dist/server/handlers/mcp.cjs +17 -9
- package/dist/server/handlers/mcp.d.ts +46 -0
- package/dist/server/handlers/mcp.d.ts.map +1 -1
- package/dist/server/handlers/mcp.js +1 -1
- package/dist/server/handlers/responses.cjs +4 -4
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -8
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers.cjs +18 -18
- package/dist/server/handlers.js +9 -9
- package/dist/server/schemas/index.cjs +15 -15
- package/dist/server/schemas/index.js +1 -1
- package/dist/server/schemas/mcp.d.ts +36 -0
- package/dist/server/schemas/mcp.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +88 -83
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.js +14 -9
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/mcp.d.ts +44 -0
- package/dist/server/server-adapter/routes/mcp.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/chunk-5UK4WOHD.cjs.map +0 -1
- package/dist/chunk-6XN2MNYW.cjs.map +0 -1
- package/dist/chunk-CPZEA2XG.cjs.map +0 -1
- package/dist/chunk-GOFGQSF7.js.map +0 -1
- package/dist/chunk-I7EPR6KM.js.map +0 -1
- package/dist/chunk-IMPWOZUQ.cjs.map +0 -1
- package/dist/chunk-KZ3ERBUT.cjs.map +0 -1
- package/dist/chunk-LCAQQOLF.js.map +0 -1
- package/dist/chunk-OTRCNZO4.js.map +0 -1
- package/dist/chunk-RP7OLAVZ.js.map +0 -1
|
@@ -1042,7 +1042,7 @@ function imageSize(input) {
|
|
|
1042
1042
|
throw new TypeError(`unsupported file type: ${type}`);
|
|
1043
1043
|
}
|
|
1044
1044
|
|
|
1045
|
-
// ../memory/dist/chunk-
|
|
1045
|
+
// ../memory/dist/chunk-BPJLUC2F.js
|
|
1046
1046
|
var OM_DEBUG_LOG = process.env.OM_DEBUG ? path.join(process.cwd(), "om-debug.log") : null;
|
|
1047
1047
|
function omDebug(msg) {
|
|
1048
1048
|
if (!OM_DEBUG_LOG) return;
|
|
@@ -4751,6 +4751,7 @@ var ObserverRunner = class {
|
|
|
4751
4751
|
observedMessageIds;
|
|
4752
4752
|
resolveModel;
|
|
4753
4753
|
tokenCounter;
|
|
4754
|
+
mastra;
|
|
4754
4755
|
/** Captured prompt/response from the last observer call (for repro capture). */
|
|
4755
4756
|
lastExchange;
|
|
4756
4757
|
constructor(opts) {
|
|
@@ -4758,9 +4759,13 @@ var ObserverRunner = class {
|
|
|
4758
4759
|
this.observedMessageIds = opts.observedMessageIds;
|
|
4759
4760
|
this.resolveModel = opts.resolveModel;
|
|
4760
4761
|
this.tokenCounter = opts.tokenCounter;
|
|
4762
|
+
this.mastra = opts.mastra;
|
|
4763
|
+
}
|
|
4764
|
+
__registerMastra(mastra) {
|
|
4765
|
+
this.mastra = mastra;
|
|
4761
4766
|
}
|
|
4762
4767
|
createAgent(model, isMultiThread = false) {
|
|
4763
|
-
|
|
4768
|
+
const agent$1 = new agent.Agent({
|
|
4764
4769
|
id: isMultiThread ? "multi-thread-observer" : "observational-memory-observer",
|
|
4765
4770
|
name: isMultiThread ? "multi-thread-observer" : "Observer",
|
|
4766
4771
|
instructions: buildObserverSystemPrompt(
|
|
@@ -4770,6 +4775,10 @@ var ObserverRunner = class {
|
|
|
4770
4775
|
),
|
|
4771
4776
|
model
|
|
4772
4777
|
});
|
|
4778
|
+
if (this.mastra) {
|
|
4779
|
+
agent$1.__registerMastra(this.mastra);
|
|
4780
|
+
}
|
|
4781
|
+
return agent$1;
|
|
4773
4782
|
}
|
|
4774
4783
|
async withAbortCheck(fn, abortSignal) {
|
|
4775
4784
|
if (abortSignal?.aborted) {
|
|
@@ -5285,6 +5294,7 @@ var ReflectorRunner = class {
|
|
|
5285
5294
|
persistMarkerToStorage;
|
|
5286
5295
|
persistMarkerToMessage;
|
|
5287
5296
|
getCompressionStartLevel;
|
|
5297
|
+
mastra;
|
|
5288
5298
|
constructor(opts) {
|
|
5289
5299
|
this.reflectionConfig = opts.reflectionConfig;
|
|
5290
5300
|
this.observationConfig = opts.observationConfig;
|
|
@@ -5297,14 +5307,22 @@ var ReflectorRunner = class {
|
|
|
5297
5307
|
this.persistMarkerToStorage = opts.persistMarkerToStorage;
|
|
5298
5308
|
this.persistMarkerToMessage = opts.persistMarkerToMessage;
|
|
5299
5309
|
this.getCompressionStartLevel = opts.getCompressionStartLevel;
|
|
5310
|
+
this.mastra = opts.mastra;
|
|
5311
|
+
}
|
|
5312
|
+
__registerMastra(mastra) {
|
|
5313
|
+
this.mastra = mastra;
|
|
5300
5314
|
}
|
|
5301
5315
|
createAgent(model) {
|
|
5302
|
-
|
|
5316
|
+
const agent$1 = new agent.Agent({
|
|
5303
5317
|
id: "observational-memory-reflector",
|
|
5304
5318
|
name: "Reflector",
|
|
5305
5319
|
instructions: buildReflectorSystemPrompt(this.reflectionConfig.instruction),
|
|
5306
5320
|
model
|
|
5307
5321
|
});
|
|
5322
|
+
if (this.mastra) {
|
|
5323
|
+
agent$1.__registerMastra(this.mastra);
|
|
5324
|
+
}
|
|
5325
|
+
return agent$1;
|
|
5308
5326
|
}
|
|
5309
5327
|
getObservationMarkerConfig(record) {
|
|
5310
5328
|
return {
|
|
@@ -7588,6 +7606,7 @@ var ObservationalMemory = class _ObservationalMemory {
|
|
|
7588
7606
|
buffering;
|
|
7589
7607
|
shouldObscureThreadIds = false;
|
|
7590
7608
|
hasher = e();
|
|
7609
|
+
mastra;
|
|
7591
7610
|
/**
|
|
7592
7611
|
* Track message IDs observed during this instance's lifetime.
|
|
7593
7612
|
* Prevents re-observing messages when per-thread lastObservedAt cursors
|
|
@@ -7654,20 +7673,10 @@ var ObservationalMemory = class _ObservationalMemory {
|
|
|
7654
7673
|
this.scope = config.scope ?? "thread";
|
|
7655
7674
|
this.retrieval = Boolean(config.retrieval);
|
|
7656
7675
|
this.onIndexObservations = config.onIndexObservations;
|
|
7657
|
-
|
|
7658
|
-
const
|
|
7659
|
-
const
|
|
7660
|
-
|
|
7661
|
-
throw new Error(
|
|
7662
|
-
`Observational Memory requires a model to be set. Use \`observationalMemory: true\` for the default (google/gemini-2.5-flash), or set a model explicitly:
|
|
7663
|
-
|
|
7664
|
-
observationalMemory: {
|
|
7665
|
-
model: "$provider/$model",
|
|
7666
|
-
}
|
|
7667
|
-
|
|
7668
|
-
See https://mastra.ai/docs/memory/observational-memory#models for model recommendations and alternatives.`
|
|
7669
|
-
);
|
|
7670
|
-
}
|
|
7676
|
+
this.mastra = config.mastra;
|
|
7677
|
+
const resolveModel = (model, defaultModel) => model === "default" ? defaultModel : model;
|
|
7678
|
+
const observationModel = resolveModel(config.model, chunk3D55EABW_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.observation.model) ?? resolveModel(config.observation?.model, chunk3D55EABW_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.observation.model) ?? resolveModel(config.reflection?.model, chunk3D55EABW_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.observation.model) ?? chunk3D55EABW_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.observation.model;
|
|
7679
|
+
const reflectionModel = resolveModel(config.model, chunk3D55EABW_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.reflection.model) ?? resolveModel(config.reflection?.model, chunk3D55EABW_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.reflection.model) ?? resolveModel(config.observation?.model, chunk3D55EABW_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.reflection.model) ?? chunk3D55EABW_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.reflection.model;
|
|
7671
7680
|
const messageTokens = config.observation?.messageTokens ?? chunk3D55EABW_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.observation.messageTokens;
|
|
7672
7681
|
const observationTokens = config.reflection?.observationTokens ?? chunk3D55EABW_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.reflection.observationTokens;
|
|
7673
7682
|
const isSharedBudget = config.shareTokenBudget ?? false;
|
|
@@ -7753,7 +7762,8 @@ Async buffering is enabled by default \u2014 this opt-out is only needed when us
|
|
|
7753
7762
|
observationConfig: this.observationConfig,
|
|
7754
7763
|
observedMessageIds: this.observedMessageIds,
|
|
7755
7764
|
resolveModel: (inputTokens) => this.resolveObservationModel(inputTokens),
|
|
7756
|
-
tokenCounter: this.tokenCounter
|
|
7765
|
+
tokenCounter: this.tokenCounter,
|
|
7766
|
+
mastra: config.mastra
|
|
7757
7767
|
});
|
|
7758
7768
|
this.buffering = new BufferingCoordinator({
|
|
7759
7769
|
observationConfig: this.observationConfig,
|
|
@@ -7771,13 +7781,19 @@ Async buffering is enabled by default \u2014 this opt-out is only needed when us
|
|
|
7771
7781
|
persistMarkerToStorage: (m, t2, r) => this.persistMarkerToStorage(m, t2, r),
|
|
7772
7782
|
persistMarkerToMessage: (m, ml, t2, r) => this.persistMarkerToMessage(m, ml, t2, r),
|
|
7773
7783
|
getCompressionStartLevel: (rc) => this.getCompressionStartLevel(rc),
|
|
7774
|
-
resolveModel: (inputTokens) => this.resolveReflectionModel(inputTokens)
|
|
7784
|
+
resolveModel: (inputTokens) => this.resolveReflectionModel(inputTokens),
|
|
7785
|
+
mastra: config.mastra
|
|
7775
7786
|
});
|
|
7776
7787
|
this.validateBufferConfig();
|
|
7777
7788
|
omDebug(
|
|
7778
7789
|
`[OM:init] new ObservationalMemory instance created \u2014 scope=${this.scope}, messageTokens=${JSON.stringify(this.observationConfig.messageTokens)}, obsAsyncEnabled=${this.buffering.isAsyncObservationEnabled()}, bufferTokens=${this.observationConfig.bufferTokens}, bufferActivation=${this.observationConfig.bufferActivation}, blockAfter=${this.observationConfig.blockAfter}, reflectionTokens=${this.reflectionConfig.observationTokens}, refAsyncEnabled=${this.buffering.isAsyncReflectionEnabled()}, refAsyncActivation=${this.reflectionConfig.bufferActivation}, refBlockAfter=${this.reflectionConfig.blockAfter}`
|
|
7779
7790
|
);
|
|
7780
7791
|
}
|
|
7792
|
+
__registerMastra(mastra) {
|
|
7793
|
+
this.mastra = mastra;
|
|
7794
|
+
this.observer.__registerMastra(mastra);
|
|
7795
|
+
this.reflector.__registerMastra(mastra);
|
|
7796
|
+
}
|
|
7781
7797
|
/**
|
|
7782
7798
|
* Get the current configuration for this OM instance.
|
|
7783
7799
|
* Used by the server to expose config to the UI when OM is added via processors.
|
|
@@ -7886,7 +7902,7 @@ Async buffering is enabled by default \u2014 this opt-out is only needed when us
|
|
|
7886
7902
|
if (!modelToResolve) {
|
|
7887
7903
|
return void 0;
|
|
7888
7904
|
}
|
|
7889
|
-
const resolved = await llm.resolveModelConfig(modelToResolve, requestContext);
|
|
7905
|
+
const resolved = await llm.resolveModelConfig(modelToResolve, requestContext, this.mastra);
|
|
7890
7906
|
return {
|
|
7891
7907
|
provider: resolved.provider,
|
|
7892
7908
|
modelId: resolved.modelId
|
|
@@ -10364,5 +10380,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
|
|
|
10364
10380
|
exports.stripObservationGroups = stripObservationGroups;
|
|
10365
10381
|
exports.truncateStringByTokens = truncateStringByTokens;
|
|
10366
10382
|
exports.wrapInObservationGroup = wrapInObservationGroup;
|
|
10367
|
-
//# sourceMappingURL=chunk-
|
|
10368
|
-
//# sourceMappingURL=chunk-
|
|
10383
|
+
//# sourceMappingURL=chunk-ZW7DMFEG.cjs.map
|
|
10384
|
+
//# sourceMappingURL=chunk-ZW7DMFEG.cjs.map
|