@mastra/server 0.20.0 → 0.20.1-alpha.2

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.
@@ -8732,19 +8732,56 @@ var Memory = class extends MastraMemory {
8732
8732
  sortDirection
8733
8733
  });
8734
8734
  }
8735
- async saveThread({ thread }) {
8736
- return this.storage.saveThread({ thread });
8735
+ async handleWorkingMemoryFromMetadata({
8736
+ workingMemory,
8737
+ resourceId,
8738
+ memoryConfig
8739
+ }) {
8740
+ const config = this.getMergedThreadConfig(memoryConfig || {});
8741
+ if (config.workingMemory?.enabled) {
8742
+ this.checkStorageFeatureSupport(config);
8743
+ const scope = config.workingMemory.scope || "thread";
8744
+ if (scope === "resource" && resourceId) {
8745
+ await this.storage.updateResource({
8746
+ resourceId,
8747
+ workingMemory
8748
+ });
8749
+ }
8750
+ }
8751
+ }
8752
+ async saveThread({
8753
+ thread,
8754
+ memoryConfig
8755
+ }) {
8756
+ const savedThread = await this.storage.saveThread({ thread });
8757
+ if (thread.metadata?.workingMemory && typeof thread.metadata.workingMemory === "string" && thread.resourceId) {
8758
+ await this.handleWorkingMemoryFromMetadata({
8759
+ workingMemory: thread.metadata.workingMemory,
8760
+ resourceId: thread.resourceId,
8761
+ memoryConfig
8762
+ });
8763
+ }
8764
+ return savedThread;
8737
8765
  }
8738
8766
  async updateThread({
8739
8767
  id,
8740
8768
  title,
8741
- metadata
8769
+ metadata,
8770
+ memoryConfig
8742
8771
  }) {
8743
- return this.storage.updateThread({
8772
+ const updatedThread = await this.storage.updateThread({
8744
8773
  id,
8745
8774
  title,
8746
8775
  metadata
8747
8776
  });
8777
+ if (metadata?.workingMemory && typeof metadata.workingMemory === "string" && updatedThread.resourceId) {
8778
+ await this.handleWorkingMemoryFromMetadata({
8779
+ workingMemory: metadata.workingMemory,
8780
+ resourceId: updatedThread.resourceId,
8781
+ memoryConfig
8782
+ });
8783
+ }
8784
+ return updatedThread;
8748
8785
  }
8749
8786
  async deleteThread(threadId) {
8750
8787
  await this.storage.deleteThread({ threadId });
@@ -17983,5 +18020,5 @@ var sendAgentBuilderActionRunEventHandler = createAgentBuilderWorkflowHandler(
17983
18020
  );
17984
18021
 
17985
18022
  export { agent_builder_exports, cancelAgentBuilderActionRunHandler, createAgentBuilderActionRunHandler, getAgentBuilderActionByIdHandler, getAgentBuilderActionRunByIdHandler, getAgentBuilderActionRunExecutionResultHandler, getAgentBuilderActionRunsHandler, getAgentBuilderActionsHandler, resumeAgentBuilderActionHandler, resumeAsyncAgentBuilderActionHandler, sendAgentBuilderActionRunEventHandler, startAgentBuilderActionRunHandler, startAsyncAgentBuilderActionHandler, streamAgentBuilderActionHandler, streamVNextAgentBuilderActionHandler, watchAgentBuilderActionHandler };
17986
- //# sourceMappingURL=chunk-QDPOVUS4.js.map
17987
- //# sourceMappingURL=chunk-QDPOVUS4.js.map
18023
+ //# sourceMappingURL=chunk-GENJTHTZ.js.map
18024
+ //# sourceMappingURL=chunk-GENJTHTZ.js.map