@mastra/server 0.16.0 → 0.16.1-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.
@@ -8526,12 +8526,13 @@ var Memory = class extends memory.MastraMemory {
8526
8526
  });
8527
8527
  this.threadConfig = mergedConfig;
8528
8528
  }
8529
- async validateThreadIsOwnedByResource(threadId, resourceId) {
8529
+ async validateThreadIsOwnedByResource(threadId, resourceId, config) {
8530
+ const resourceScope = typeof config?.semanticRecall === "object" && config?.semanticRecall?.scope === "resource";
8530
8531
  const thread = await this.storage.getThreadById({ threadId });
8531
- if (!thread) {
8532
+ if (!thread && !resourceScope) {
8532
8533
  throw new Error(`No thread found with id ${threadId}`);
8533
8534
  }
8534
- if (thread.resourceId !== resourceId) {
8535
+ if (thread && thread.resourceId !== resourceId) {
8535
8536
  throw new Error(
8536
8537
  `Thread with id ${threadId} is for resource with id ${thread.resourceId} but resource ${resourceId} was queried.`
8537
8538
  );
@@ -8555,14 +8556,14 @@ var Memory = class extends memory.MastraMemory {
8555
8556
  selectBy,
8556
8557
  threadConfig
8557
8558
  }) {
8558
- if (resourceId) await this.validateThreadIsOwnedByResource(threadId, resourceId);
8559
+ const config = this.getMergedThreadConfig(threadConfig || {});
8560
+ if (resourceId) await this.validateThreadIsOwnedByResource(threadId, resourceId, config);
8559
8561
  const vectorResults = [];
8560
8562
  this.logger.debug(`Memory query() with:`, {
8561
8563
  threadId,
8562
8564
  selectBy,
8563
8565
  threadConfig
8564
8566
  });
8565
- const config = this.getMergedThreadConfig(threadConfig || {});
8566
8567
  this.checkStorageFeatureSupport(config);
8567
8568
  const defaultRange = DEFAULT_MESSAGE_RANGE;
8568
8569
  const defaultTopK = DEFAULT_TOP_K;
@@ -8661,8 +8662,8 @@ var Memory = class extends memory.MastraMemory {
8661
8662
  vectorMessageSearch,
8662
8663
  config
8663
8664
  }) {
8664
- if (resourceId) await this.validateThreadIsOwnedByResource(threadId, resourceId);
8665
8665
  const threadConfig = this.getMergedThreadConfig(config || {});
8666
+ if (resourceId) await this.validateThreadIsOwnedByResource(threadId, resourceId, threadConfig);
8666
8667
  if (!threadConfig.lastMessages && !threadConfig.semanticRecall) {
8667
8668
  return {
8668
8669
  messages: [],
@@ -15702,5 +15703,5 @@ exports.startAsyncAgentBuilderActionHandler = startAsyncAgentBuilderActionHandle
15702
15703
  exports.streamAgentBuilderActionHandler = streamAgentBuilderActionHandler;
15703
15704
  exports.streamVNextAgentBuilderActionHandler = streamVNextAgentBuilderActionHandler;
15704
15705
  exports.watchAgentBuilderActionHandler = watchAgentBuilderActionHandler;
15705
- //# sourceMappingURL=chunk-I77CGJTZ.cjs.map
15706
- //# sourceMappingURL=chunk-I77CGJTZ.cjs.map
15706
+ //# sourceMappingURL=chunk-7AF57YQY.cjs.map
15707
+ //# sourceMappingURL=chunk-7AF57YQY.cjs.map