@mastra/server 0.0.0-fix-model-router-machine-cache-20251021232825 → 0.0.0-fix-memory-search-fetch-20251027160505

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +112 -3
  2. package/dist/{chunk-XDAYZS6N.js → chunk-6VPAV4ZV.js} +69 -59
  3. package/dist/chunk-6VPAV4ZV.js.map +1 -0
  4. package/dist/{chunk-ZKSVHRWS.js → chunk-ABCBHBR7.js} +44 -18
  5. package/dist/chunk-ABCBHBR7.js.map +1 -0
  6. package/dist/{chunk-KA6P5BNS.cjs → chunk-B7QWVGQQ.cjs} +33 -12
  7. package/dist/chunk-B7QWVGQQ.cjs.map +1 -0
  8. package/dist/{chunk-VY4ENABS.cjs → chunk-CJFKRVED.cjs} +2 -3
  9. package/dist/chunk-CJFKRVED.cjs.map +1 -0
  10. package/dist/{chunk-6APHVRA5.cjs → chunk-EGLGMBWW.cjs} +62 -36
  11. package/dist/chunk-EGLGMBWW.cjs.map +1 -0
  12. package/dist/{chunk-TOP25AIO.cjs → chunk-K5T5A3AL.cjs} +4 -4
  13. package/dist/{chunk-TOP25AIO.cjs.map → chunk-K5T5A3AL.cjs.map} +1 -1
  14. package/dist/{chunk-YWOK4F5A.js → chunk-KSFLUEWV.js} +2 -3
  15. package/dist/chunk-KSFLUEWV.js.map +1 -0
  16. package/dist/{chunk-HPXAM2PG.js → chunk-MN2TZQ7I.js} +3 -3
  17. package/dist/{chunk-HPXAM2PG.js.map → chunk-MN2TZQ7I.js.map} +1 -1
  18. package/dist/{chunk-CO4OYKRH.js → chunk-OGK26QPW.js} +58 -104
  19. package/dist/chunk-OGK26QPW.js.map +1 -0
  20. package/dist/{chunk-ZEDPVPID.cjs → chunk-Y7SH5ZKM.cjs} +58 -104
  21. package/dist/chunk-Y7SH5ZKM.cjs.map +1 -0
  22. package/dist/{chunk-FHSOPERI.cjs → chunk-YSHNCC6F.cjs} +69 -58
  23. package/dist/chunk-YSHNCC6F.cjs.map +1 -0
  24. package/dist/{chunk-7IG6734E.js → chunk-ZLBL4NQC.js} +29 -10
  25. package/dist/chunk-ZLBL4NQC.js.map +1 -0
  26. package/dist/server/handlers/a2a.cjs +7 -7
  27. package/dist/server/handlers/a2a.js +1 -1
  28. package/dist/server/handlers/agent-builder.cjs +16 -16
  29. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  30. package/dist/server/handlers/agent-builder.js +1 -1
  31. package/dist/server/handlers/agents.cjs +23 -19
  32. package/dist/server/handlers/agents.d.ts +4 -0
  33. package/dist/server/handlers/agents.d.ts.map +1 -1
  34. package/dist/server/handlers/agents.js +1 -1
  35. package/dist/server/handlers/memory.cjs +16 -16
  36. package/dist/server/handlers/memory.d.ts.map +1 -1
  37. package/dist/server/handlers/memory.js +1 -1
  38. package/dist/server/handlers/workflows.cjs +27 -19
  39. package/dist/server/handlers/workflows.d.ts +8 -2
  40. package/dist/server/handlers/workflows.d.ts.map +1 -1
  41. package/dist/server/handlers/workflows.js +1 -1
  42. package/dist/server/handlers.cjs +15 -20
  43. package/dist/server/handlers.d.ts +0 -1
  44. package/dist/server/handlers.d.ts.map +1 -1
  45. package/dist/server/handlers.js +6 -7
  46. package/dist/server/utils.d.ts.map +1 -1
  47. package/package.json +7 -7
  48. package/dist/chunk-67GYDFSB.js +0 -160
  49. package/dist/chunk-67GYDFSB.js.map +0 -1
  50. package/dist/chunk-6APHVRA5.cjs.map +0 -1
  51. package/dist/chunk-6ZR275MD.cjs +0 -165
  52. package/dist/chunk-6ZR275MD.cjs.map +0 -1
  53. package/dist/chunk-7IG6734E.js.map +0 -1
  54. package/dist/chunk-CO4OYKRH.js.map +0 -1
  55. package/dist/chunk-FHSOPERI.cjs.map +0 -1
  56. package/dist/chunk-KA6P5BNS.cjs.map +0 -1
  57. package/dist/chunk-VY4ENABS.cjs.map +0 -1
  58. package/dist/chunk-XDAYZS6N.js.map +0 -1
  59. package/dist/chunk-YWOK4F5A.js.map +0 -1
  60. package/dist/chunk-ZEDPVPID.cjs.map +0 -1
  61. package/dist/chunk-ZKSVHRWS.js.map +0 -1
  62. package/dist/server/handlers/telemetry.cjs +0 -20
  63. package/dist/server/handlers/telemetry.cjs.map +0 -1
  64. package/dist/server/handlers/telemetry.d.ts +0 -33
  65. package/dist/server/handlers/telemetry.d.ts.map +0 -1
  66. package/dist/server/handlers/telemetry.js +0 -3
  67. package/dist/server/handlers/telemetry.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, createWorkflowRunHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, watchWorkflowHandler, streamWorkflowHandler, streamVNextWorkflowHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, getWorkflowRunsHandler, cancelWorkflowRunHandler, sendWorkflowRunEventHandler } from './chunk-7IG6734E.js';
1
+ import { getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, createWorkflowRunHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, watchWorkflowHandler, streamLegacyWorkflowHandler, streamVNextWorkflowHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, getWorkflowRunsHandler, cancelWorkflowRunHandler, sendWorkflowRunEventHandler } from './chunk-ZLBL4NQC.js';
2
2
  import { require_token_error } from './chunk-TOCYBDP2.js';
3
3
  import { openai } from './chunk-ZULZ2752.js';
4
4
  import { createIdGenerator, AISDKError, isAbortError, getErrorMessage, APICallError, delay, safeParseJSON, safeValidateTypes, convertAsyncIteratorToReadableStream, validatorSymbol } from './chunk-RQK4FQUD.js';
5
- import { WorkflowRegistry, getWorkflowInfo } from './chunk-YWOK4F5A.js';
5
+ import { WorkflowRegistry, getWorkflowInfo } from './chunk-KSFLUEWV.js';
6
6
  import { handleError } from './chunk-CY4TP3FK.js';
7
7
  import { HTTPException } from './chunk-MMROOK5J.js';
8
8
  import { __commonJS, __export, __toESM } from './chunk-PR4QN5HX.js';
@@ -10282,8 +10282,8 @@ var __experimental_updateWorkingMemoryToolVNext = (config) => {
10282
10282
  });
10283
10283
  };
10284
10284
  var CHARS_PER_TOKEN = 4;
10285
- var DEFAULT_MESSAGE_RANGE = { before: 2, after: 2 };
10286
- var DEFAULT_TOP_K = 2;
10285
+ var DEFAULT_MESSAGE_RANGE = { before: 1, after: 1 };
10286
+ var DEFAULT_TOP_K = 4;
10287
10287
  var isZodObject = (v) => v instanceof ZodObject;
10288
10288
  var Memory = class extends MastraMemory {
10289
10289
  constructor(config = {}) {
@@ -10300,7 +10300,7 @@ var Memory = class extends MastraMemory {
10300
10300
  this.threadConfig = mergedConfig;
10301
10301
  }
10302
10302
  async validateThreadIsOwnedByResource(threadId, resourceId, config) {
10303
- const resourceScope = typeof config?.semanticRecall === "object" && config?.semanticRecall?.scope === "resource";
10303
+ const resourceScope = typeof config?.semanticRecall === "object" && config?.semanticRecall?.scope !== `thread` || config.semanticRecall === true;
10304
10304
  const thread = await this.storage.getThreadById({ threadId });
10305
10305
  if (!thread && !resourceScope) {
10306
10306
  throw new Error(`No thread found with id ${threadId}`);
@@ -10312,7 +10312,9 @@ var Memory = class extends MastraMemory {
10312
10312
  }
10313
10313
  }
10314
10314
  checkStorageFeatureSupport(config) {
10315
- if (typeof config.semanticRecall === `object` && config.semanticRecall.scope === `resource` && !this.storage.supports.selectByIncludeResourceScope) {
10315
+ const resourceScope = typeof config.semanticRecall === "object" && config.semanticRecall.scope !== "thread" || // resource scope is now default
10316
+ config.semanticRecall === true;
10317
+ if (resourceScope && !this.storage.supports.selectByIncludeResourceScope) {
10316
10318
  throw new Error(
10317
10319
  `Memory error: Attached storage adapter "${this.storage.name || "unknown"}" doesn't support semanticRecall: { scope: "resource" } yet and currently only supports per-thread semantic recall.`
10318
10320
  );
@@ -10347,7 +10349,12 @@ var Memory = class extends MastraMemory {
10347
10349
  topK: config?.semanticRecall?.topK ?? defaultTopK,
10348
10350
  messageRange: config?.semanticRecall?.messageRange ?? defaultRange
10349
10351
  };
10350
- const resourceScope = typeof config?.semanticRecall === "object" && config?.semanticRecall?.scope === `resource`;
10352
+ const resourceScope = typeof config?.semanticRecall === "object" && config?.semanticRecall?.scope !== `thread` || config.semanticRecall === true;
10353
+ if (resourceScope && !resourceId && config?.semanticRecall && selectBy?.vectorSearchString) {
10354
+ throw new Error(
10355
+ `Memory error: Resource-scoped semantic recall is enabled but no resourceId was provided. Either provide a resourceId or explicitly set semanticRecall.scope to 'thread'.`
10356
+ );
10357
+ }
10351
10358
  if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector) {
10352
10359
  const { embeddings, dimension } = await this.embedMessageContent(selectBy.vectorSearchString);
10353
10360
  const { indexName } = await this.createEmbeddingIndex(dimension, config);
@@ -10490,7 +10497,7 @@ var Memory = class extends MastraMemory {
10490
10497
  const config = this.getMergedThreadConfig(memoryConfig || {});
10491
10498
  if (config.workingMemory?.enabled) {
10492
10499
  this.checkStorageFeatureSupport(config);
10493
- const scope = config.workingMemory.scope || "thread";
10500
+ const scope = config.workingMemory.scope || "resource";
10494
10501
  if (scope === "resource" && resourceId) {
10495
10502
  await this.storage.updateResource({
10496
10503
  resourceId,
@@ -10547,7 +10554,12 @@ var Memory = class extends MastraMemory {
10547
10554
  throw new Error("Working memory is not enabled for this memory instance");
10548
10555
  }
10549
10556
  this.checkStorageFeatureSupport(config);
10550
- const scope = config.workingMemory.scope || "thread";
10557
+ const scope = config.workingMemory.scope || "resource";
10558
+ if (scope === "resource" && !resourceId) {
10559
+ throw new Error(
10560
+ `Memory error: Resource-scoped working memory is enabled but no resourceId was provided. Either provide a resourceId or explicitly set workingMemory.scope to 'thread'.`
10561
+ );
10562
+ }
10551
10563
  if (scope === "resource" && resourceId) {
10552
10564
  await this.storage.updateResource({
10553
10565
  resourceId,
@@ -10619,7 +10631,12 @@ ${workingMemory}`;
10619
10631
  reason = `started new working memory`;
10620
10632
  }
10621
10633
  workingMemory = template?.content ? workingMemory.replaceAll(template?.content, "") : workingMemory;
10622
- const scope = config.workingMemory.scope || "thread";
10634
+ const scope = config.workingMemory.scope || "resource";
10635
+ if (scope === "resource" && !resourceId) {
10636
+ throw new Error(
10637
+ `Memory error: Resource-scoped working memory is enabled but no resourceId was provided. Either provide a resourceId or explicitly set workingMemory.scope to 'thread'.`
10638
+ );
10639
+ }
10623
10640
  if (scope === "resource" && resourceId) {
10624
10641
  await this.storage.updateResource({
10625
10642
  resourceId,
@@ -10836,8 +10853,13 @@ ${workingMemory}`;
10836
10853
  return null;
10837
10854
  }
10838
10855
  this.checkStorageFeatureSupport(config);
10839
- const scope = config.workingMemory.scope || "thread";
10856
+ const scope = config.workingMemory.scope || "resource";
10840
10857
  let workingMemoryData = null;
10858
+ if (scope === "resource" && !resourceId) {
10859
+ throw new Error(
10860
+ `Memory error: Resource-scoped working memory is enabled but no resourceId was provided. Either provide a resourceId or explicitly set workingMemory.scope to 'thread'.`
10861
+ );
10862
+ }
10841
10863
  if (scope === "resource" && resourceId) {
10842
10864
  const resource = await this.storage.getResourceById({ resourceId });
10843
10865
  workingMemoryData = resource?.workingMemory || null;
@@ -14140,7 +14162,7 @@ You have access to an enhanced set of tools based on production coding agent pat
14140
14162
  ### Task Management
14141
14163
  - **taskManager**: Create and track multi-step coding tasks with states (pending, in_progress, completed, blocked). Use this for complex projects that require systematic progress tracking.
14142
14164
 
14143
- ### Code Discovery & Analysis
14165
+ ### Code Discovery & Analysis
14144
14166
  - **codeAnalyzer**: Analyze codebase structure, discover definitions (functions, classes, interfaces), map dependencies, and understand architectural patterns.
14145
14167
  - **smartSearch**: Intelligent search with context awareness, pattern matching, and relevance scoring.
14146
14168
 
@@ -14350,7 +14372,7 @@ export const mastra = new Mastra({
14350
14372
  workflows: { weatherWorkflow },
14351
14373
  agents: { weatherAgent },
14352
14374
  storage: new LibSQLStore({
14353
- // stores telemetry, evals, ... into memory storage, if it needs to persist, change to file:../mastra.db
14375
+ // stores observability, evals, ... into memory storage, if it needs to persist, change to file:../mastra.db
14354
14376
  url: ":memory:",
14355
14377
  }),
14356
14378
  logger: new PinoLogger({
@@ -18347,7 +18369,9 @@ var planningIterationStep = createStep({
18347
18369
  research
18348
18370
  });
18349
18371
  const result = await planningAgent.generate(planningPrompt, {
18350
- output: PlanningAgentOutputSchema
18372
+ structuredOutput: {
18373
+ schema: PlanningAgentOutputSchema
18374
+ }
18351
18375
  // maxSteps: 15,
18352
18376
  });
18353
18377
  const planResult = await result.object;
@@ -19053,7 +19077,9 @@ var workflowResearchStep = createStep({
19053
19077
  hasWorkflowsDir: inputData.structure.hasWorkflowsDir
19054
19078
  });
19055
19079
  const result = await researchAgent.generate(researchPrompt, {
19056
- output: WorkflowResearchResultSchema
19080
+ structuredOutput: {
19081
+ schema: WorkflowResearchResultSchema
19082
+ }
19057
19083
  // stopWhen: stepCountIs(10),
19058
19084
  });
19059
19085
  const researchResult = await result.object;
@@ -19447,7 +19473,7 @@ var watchAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
19447
19473
  "Watching agent builder action"
19448
19474
  );
19449
19475
  var streamAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
19450
- streamWorkflowHandler,
19476
+ streamLegacyWorkflowHandler,
19451
19477
  "Streaming agent builder action"
19452
19478
  );
19453
19479
  var streamVNextAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
@@ -19476,5 +19502,5 @@ var sendAgentBuilderActionRunEventHandler = createAgentBuilderWorkflowHandler(
19476
19502
  );
19477
19503
 
19478
19504
  export { agent_builder_exports, cancelAgentBuilderActionRunHandler, createAgentBuilderActionRunHandler, getAgentBuilderActionByIdHandler, getAgentBuilderActionRunByIdHandler, getAgentBuilderActionRunExecutionResultHandler, getAgentBuilderActionRunsHandler, getAgentBuilderActionsHandler, resumeAgentBuilderActionHandler, resumeAsyncAgentBuilderActionHandler, sendAgentBuilderActionRunEventHandler, startAgentBuilderActionRunHandler, startAsyncAgentBuilderActionHandler, streamAgentBuilderActionHandler, streamVNextAgentBuilderActionHandler, watchAgentBuilderActionHandler };
19479
- //# sourceMappingURL=chunk-ZKSVHRWS.js.map
19480
- //# sourceMappingURL=chunk-ZKSVHRWS.js.map
19505
+ //# sourceMappingURL=chunk-ABCBHBR7.js.map
19506
+ //# sourceMappingURL=chunk-ABCBHBR7.js.map