@mastra/server 1.24.0-alpha.1 → 1.24.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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 1.24.0
4
+
5
+ ### Patch Changes
6
+
7
+ - **Fixed publishing older agent versions** ([#15154](https://github.com/mastra-ai/mastra/pull/15154))
8
+
9
+ Fixed agent editor to allow publishing older read-only versions. Previously, the Publish button was disabled when viewing a previous version. Now a "Publish This Version" button appears, enabling users to set any older version as the published version.
10
+
11
+ **Fixed Publish button being clickable without a saved draft**
12
+
13
+ The Publish button is now disabled until a draft version is saved. Previously, making edits would enable the Publish button even without a saved draft, which caused an error when clicked.
14
+
15
+ **Eliminated spurious 404 error logs for code-only agents**
16
+
17
+ The agent versions endpoint now checks both code-registered and stored agents before returning 404, and the frontend conditionally fetches stored agent details only when versions exist. This prevents noisy error logs when navigating to the editor for agents that haven't been published yet.
18
+
19
+ **Changed editor sections to be collapsed by default**
20
+
21
+ The System Prompt, Tools, and Variables sections in the agent editor are now collapsed by default when navigating to the editor page.
22
+
23
+ - Fixed the Responses API to use the agent default model when create requests omit model. ([#15140](https://github.com/mastra-ai/mastra/pull/15140))
24
+
25
+ - Updated dependencies [[`8db7663`](https://github.com/mastra-ai/mastra/commit/8db7663c9a9c735828094c359d2e327fd4f8fba3), [`153e864`](https://github.com/mastra-ai/mastra/commit/153e86476b425db7cd0dc8490050096e92964a38), [`715710d`](https://github.com/mastra-ai/mastra/commit/715710d12fa47cf88e09d41f13843eddc29327b0), [`378c6c4`](https://github.com/mastra-ai/mastra/commit/378c6c4755726e8d8cf83a14809b350b90d46c62), [`9f91fd5`](https://github.com/mastra-ai/mastra/commit/9f91fd538ab2a44f8cc740bcad8e51205f74fbea), [`ba6fa9c`](https://github.com/mastra-ai/mastra/commit/ba6fa9cc0f3e1912c49fd70d4c3bb8c44903ddaa)]:
26
+ - @mastra/core@1.24.0
27
+
3
28
  ## 1.24.0-alpha.1
4
29
 
5
30
  ### Patch Changes
@@ -1042,7 +1042,7 @@ function imageSize(input) {
1042
1042
  throw new TypeError(`unsupported file type: ${type}`);
1043
1043
  }
1044
1044
 
1045
- // ../memory/dist/chunk-ZEKCVX4E.js
1045
+ // ../memory/dist/chunk-42AZEBIK.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;
@@ -5123,13 +5123,29 @@ var ReflectorRunner = class {
5123
5123
  model
5124
5124
  });
5125
5125
  }
5126
- getObservationMarkerConfig() {
5126
+ getObservationMarkerConfig(record) {
5127
5127
  return {
5128
5128
  messageTokens: getMaxThreshold(this.observationConfig.messageTokens),
5129
- observationTokens: getMaxThreshold(this.reflectionConfig.observationTokens),
5129
+ observationTokens: getMaxThreshold(
5130
+ record ? this.getEffectiveReflectionTokens(record) : this.reflectionConfig.observationTokens
5131
+ ),
5130
5132
  scope: this.scope
5131
5133
  };
5132
5134
  }
5135
+ /**
5136
+ * Resolve the effective reflection observationTokens for a record.
5137
+ * Only explicit per-record overrides (stored under `_overrides`) win;
5138
+ * the initial config snapshot is ignored so instance-level changes
5139
+ * still take effect for existing records.
5140
+ */
5141
+ getEffectiveReflectionTokens(record) {
5142
+ const overrides = record.config?._overrides;
5143
+ const recordTokens = overrides?.reflection?.observationTokens;
5144
+ if (recordTokens) {
5145
+ return recordTokens;
5146
+ }
5147
+ return this.reflectionConfig.observationTokens;
5148
+ }
5133
5149
  /**
5134
5150
  * Call the Reflector agent with escalating compression levels.
5135
5151
  */
@@ -5318,7 +5334,7 @@ var ReflectorRunner = class {
5318
5334
  const freshRecord = await this.storage.getObservationalMemory(record.threadId, record.resourceId);
5319
5335
  const currentRecord = freshRecord ?? record;
5320
5336
  const observationTokens = currentRecord.observationTokenCount ?? 0;
5321
- const reflectThreshold = getMaxThreshold(this.reflectionConfig.observationTokens);
5337
+ const reflectThreshold = getMaxThreshold(this.getEffectiveReflectionTokens(currentRecord));
5322
5338
  const bufferActivation = this.reflectionConfig.bufferActivation ?? 0.5;
5323
5339
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
5324
5340
  const cycleId = `reflect-buf-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
@@ -5347,7 +5363,7 @@ var ReflectorRunner = class {
5347
5363
  recordId: record.id,
5348
5364
  threadId: record.threadId ?? "",
5349
5365
  threadIds: record.threadId ? [record.threadId] : [],
5350
- config: this.getObservationMarkerConfig()
5366
+ config: this.getObservationMarkerConfig(currentRecord)
5351
5367
  });
5352
5368
  void writer.custom(startMarker).catch(() => {
5353
5369
  });
@@ -5459,7 +5475,7 @@ ${unreflectedContent}` : freshRecord.bufferedReflection;
5459
5475
  threadId: freshRecord.threadId ?? "",
5460
5476
  generationCount: afterRecord?.generationCount ?? freshRecord.generationCount ?? 0,
5461
5477
  observations: afterRecord?.activeObservations,
5462
- config: this.getObservationMarkerConfig()
5478
+ config: this.getObservationMarkerConfig(freshRecord)
5463
5479
  });
5464
5480
  void writer.custom(activationMarker).catch(() => {
5465
5481
  });
@@ -5490,7 +5506,7 @@ ${unreflectedContent}` : freshRecord.bufferedReflection;
5490
5506
  observabilityContext
5491
5507
  } = opts;
5492
5508
  const lockKey = this.buffering.getLockKey(record.threadId, record.resourceId);
5493
- const reflectThreshold = getMaxThreshold(this.reflectionConfig.observationTokens);
5509
+ const reflectThreshold = getMaxThreshold(this.getEffectiveReflectionTokens(record));
5494
5510
  if (this.buffering.isAsyncReflectionEnabled() && observationTokens < reflectThreshold) {
5495
5511
  const shouldTrigger = (() => {
5496
5512
  if (!this.buffering.isAsyncReflectionEnabled()) return false;
@@ -5569,7 +5585,7 @@ ${unreflectedContent}` : freshRecord.bufferedReflection;
5569
5585
  recordId: record.id,
5570
5586
  threadId,
5571
5587
  threadIds: [threadId],
5572
- config: this.getObservationMarkerConfig()
5588
+ config: this.getObservationMarkerConfig(record)
5573
5589
  });
5574
5590
  await writer.custom(startMarker).catch(() => {
5575
5591
  });
@@ -9603,6 +9619,10 @@ function getOmObservabilityContext(args) {
9603
9619
  metrics: args.metrics
9604
9620
  };
9605
9621
  }
9622
+ var GATEWAY_STATE_KEY = "__isGatewayModel";
9623
+ function isMastraGatewayModel(model) {
9624
+ return model instanceof llm.ModelRouterLanguageModel && model.gatewayId === "mastra";
9625
+ }
9606
9626
  var ObservationalMemoryProcessor = class {
9607
9627
  id = "observational-memory";
9608
9628
  name = "Observational Memory";
@@ -9638,6 +9658,11 @@ var ObservationalMemoryProcessor = class {
9638
9658
  omDebug(`[OM:processInputStep:NO-CONTEXT] getThreadContext returned null \u2014 returning early`);
9639
9659
  return messageList;
9640
9660
  }
9661
+ if (isMastraGatewayModel(model)) {
9662
+ state[GATEWAY_STATE_KEY] = true;
9663
+ omDebug(`[OM:processInputStep:GATEWAY] gateway handles OM \u2014 skipping local processing`);
9664
+ return messageList;
9665
+ }
9641
9666
  const { threadId, resourceId } = context;
9642
9667
  const memoryContext = memory.parseMemoryRequestContext(requestContext);
9643
9668
  const readOnly = memoryContext?.memoryConfig?.readOnly;
@@ -9754,6 +9779,7 @@ var ObservationalMemoryProcessor = class {
9754
9779
  const state = _state ?? {};
9755
9780
  const context = this.engine.getThreadContext(requestContext, messageList);
9756
9781
  if (!context) return messageList;
9782
+ if (state[GATEWAY_STATE_KEY]) return messageList;
9757
9783
  const observabilityContext = getOmObservabilityContext(args);
9758
9784
  state.__omObservabilityContext = observabilityContext;
9759
9785
  return this.engine.getTokenCounter().runWithModelContext(state.__omActorModelContext, async () => {
@@ -9830,5 +9856,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
9830
9856
  exports.stripObservationGroups = stripObservationGroups;
9831
9857
  exports.truncateStringByTokens = truncateStringByTokens;
9832
9858
  exports.wrapInObservationGroup = wrapInObservationGroup;
9833
- //# sourceMappingURL=chunk-QOTVR5LN.cjs.map
9834
- //# sourceMappingURL=chunk-QOTVR5LN.cjs.map
9859
+ //# sourceMappingURL=chunk-73MTRRUV.cjs.map
9860
+ //# sourceMappingURL=chunk-73MTRRUV.cjs.map