@mastra/core 0.4.1 → 0.4.2-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.
@@ -1,7 +1,7 @@
1
1
  import 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { A as Agent } from '../base-BVXgbD4Q.js';
4
+ export { A as Agent } from '../base-BdNHFjqH.js';
5
5
  import '../base-eWkcLLSb.js';
6
6
  import '../types-m9RryK9a.js';
7
7
  import '../voice/index.js';
@@ -1 +1 @@
1
- export { Agent } from '../chunk-ICUX73VZ.js';
1
+ export { Agent } from '../chunk-ORM3OCHX.js';
@@ -612,7 +612,7 @@ declare class Agent<TTools extends Record<string, ToolAction<any, any, any, any>
612
612
  runId?: string;
613
613
  }): Promise<{
614
614
  threadId: string;
615
- messages: any[];
615
+ messages: NonNullable<CoreMessage$1 | null>[];
616
616
  }>;
617
617
  saveResponse({ result, threadId, resourceId, runId, memoryConfig, }: {
618
618
  runId: string;
@@ -1,4 +1,4 @@
1
- import { Agent } from './chunk-ICUX73VZ.js';
1
+ import { Agent } from './chunk-ORM3OCHX.js';
2
2
  import { CohereClient } from 'cohere-ai';
3
3
 
4
4
  var CohereRelevanceScorer = class {
@@ -712,24 +712,10 @@ var Agent = class extends (_a = MastraBase) {
712
712
  }) : null;
713
713
  return {
714
714
  threadId: thread.id,
715
- messages: [{
715
+ messages: [memorySystemMessage ? {
716
716
  role: "system",
717
- content: `
718
-
719
- Analyze this message to determine if the user is referring to a previous conversation with the LLM.
720
- Specifically, identify if the user wants to reference specific information from that chat or if they want the LLM to use the previous chat messages as context for the current conversation.
721
- Extract any date ranges mentioned in the user message that could help identify the previous chat.
722
- Return dates in ISO format.
723
- If no specific dates are mentioned but time periods are (like "last week" or "past month"), calculate the appropriate date range.
724
- For the end date, return the date 1 day after the end of the time period.
725
- Today's date is ${(/* @__PURE__ */new Date()).toISOString()} and the time is ${(/* @__PURE__ */new Date()).toLocaleTimeString("en-US", {
726
- hour: "numeric",
727
- minute: "numeric",
728
- hour12: true
729
- })} ${memorySystemMessage ? `
730
-
731
- ${memorySystemMessage}` : ""}`
732
- }, ...this.sanitizeResponseMessages(memoryMessages), ...newMessages]
717
+ content: memorySystemMessage
718
+ } : null, ...this.sanitizeResponseMessages(memoryMessages), ...newMessages].filter(message => Boolean(message))
733
719
  };
734
720
  }
735
721
  return {
@@ -994,7 +980,7 @@ ${memorySystemMessage}` : ""}`
994
980
  }
995
981
  const systemMessage = {
996
982
  role: "system",
997
- content: `${this.instructions}. Today's date is ${(/* @__PURE__ */new Date()).toISOString()}`
983
+ content: `${this.instructions}.`
998
984
  };
999
985
  let coreMessages = messages;
1000
986
  let threadIdToUse = threadId;
@@ -1,5 +1,5 @@
1
1
  import { a as Metric, T as TestInfo, M as MetricResult } from '../types-m9RryK9a.js';
2
- import { A as Agent } from '../base-BVXgbD4Q.js';
2
+ import { A as Agent } from '../base-BdNHFjqH.js';
3
3
  import 'ai';
4
4
  import '../base-eWkcLLSb.js';
5
5
  import '@opentelemetry/api';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as Metric } from './types-m9RryK9a.js';
2
2
  export { M as MetricResult, T as TestInfo } from './types-m9RryK9a.js';
3
- import { T as ToolAction, A as Agent$1, i as AgentConfig, M as MastraStorage$1, a as MastraMemory$1, j as ToolExecutionContext, W as WorkflowOptions } from './base-BVXgbD4Q.js';
4
- export { Y as ActionContext, X as BaseCondition, B as BaseStructuredOutputType, o as CoreAssistantMessage, C as CoreMessage, n as CoreSystemMessage, Q as CoreTool, q as CoreToolMessage, p as CoreUserMessage, a5 as DependencyCheckOutput, s as EmbedManyResult, r as EmbedResult, E as EvalRow, ab as ExtractSchemaFromStep, ae as ExtractSchemaType, ac as ExtractStepResult, G as GenerateReturn, D as LLMInnerStreamOptions, F as LLMStreamObjectOptions, x as LLMStreamOptions, z as LLMTextObjectOptions, y as LLMTextOptions, L as LanguageModel, N as MemoryConfig, K as MessageResponse, H as MessageType, O as OutputType, af as PathsToStringProps, a2 as ResolverFunctionInput, a3 as ResolverFunctionOutput, R as RetryConfig, P as SharedMemoryConfig, b as StepAction, _ as StepCondition, e as StepConfig, Z as StepDef, S as StepExecutionContext, h as StepGraph, aa as StepId, ad as StepInputType, U as StepNode, f as StepResult, d as StepVariableType, k as StorageColumn, m as StorageGetMessagesArg, J as StorageThreadType, w as StreamReturn, v as StructuredOutput, u as StructuredOutputArrayItem, t as StructuredOutputType, a4 as SubscriberFunctionOutput, V as VariableReference, a7 as WorkflowActionParams, a8 as WorkflowActions, a6 as WorkflowActors, $ as WorkflowContext, a1 as WorkflowEvent, a0 as WorkflowLogMessage, l as WorkflowRow, g as WorkflowRunState, a9 as WorkflowState } from './base-BVXgbD4Q.js';
3
+ import { T as ToolAction, A as Agent$1, i as AgentConfig, M as MastraStorage$1, a as MastraMemory$1, j as ToolExecutionContext, W as WorkflowOptions } from './base-BdNHFjqH.js';
4
+ export { Y as ActionContext, X as BaseCondition, B as BaseStructuredOutputType, o as CoreAssistantMessage, C as CoreMessage, n as CoreSystemMessage, Q as CoreTool, q as CoreToolMessage, p as CoreUserMessage, a5 as DependencyCheckOutput, s as EmbedManyResult, r as EmbedResult, E as EvalRow, ab as ExtractSchemaFromStep, ae as ExtractSchemaType, ac as ExtractStepResult, G as GenerateReturn, D as LLMInnerStreamOptions, F as LLMStreamObjectOptions, x as LLMStreamOptions, z as LLMTextObjectOptions, y as LLMTextOptions, L as LanguageModel, N as MemoryConfig, K as MessageResponse, H as MessageType, O as OutputType, af as PathsToStringProps, a2 as ResolverFunctionInput, a3 as ResolverFunctionOutput, R as RetryConfig, P as SharedMemoryConfig, b as StepAction, _ as StepCondition, e as StepConfig, Z as StepDef, S as StepExecutionContext, h as StepGraph, aa as StepId, ad as StepInputType, U as StepNode, f as StepResult, d as StepVariableType, k as StorageColumn, m as StorageGetMessagesArg, J as StorageThreadType, w as StreamReturn, v as StructuredOutput, u as StructuredOutputArrayItem, t as StructuredOutputType, a4 as SubscriberFunctionOutput, V as VariableReference, a7 as WorkflowActionParams, a8 as WorkflowActions, a6 as WorkflowActors, $ as WorkflowContext, a1 as WorkflowEvent, a0 as WorkflowLogMessage, l as WorkflowRow, g as WorkflowRunState, a9 as WorkflowState } from './base-BdNHFjqH.js';
5
5
  import { M as MastraBase$1 } from './base-eWkcLLSb.js';
6
6
  export { O as OtelConfig, S as SamplingStrategy, T as Telemetry } from './base-eWkcLLSb.js';
7
7
  import { R as RegisteredLogger, a as LogLevel, T as TransportMap, L as Logger } from './index-C5uPdbs4.js';
@@ -20,8 +20,8 @@ import { MastraTTS as MastraTTS$1, TTSConfig } from './tts/index.js';
20
20
  export { TagMaskOptions, deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './utils.js';
21
21
  import { MastraVector as MastraVector$1 } from './vector/index.js';
22
22
  export { IndexStats, QueryResult, defaultEmbedder } from './vector/index.js';
23
- import { S as Step, W as Workflow$1 } from './workflow-B_sRFHFT.js';
24
- export { c as createStep } from './workflow-B_sRFHFT.js';
23
+ import { S as Step, W as Workflow$1 } from './workflow-CbKcJz7a.js';
24
+ export { c as createStep } from './workflow-CbKcJz7a.js';
25
25
  export { getStepResult, isErrorEvent, isTransitionEvent, isVariableReference } from './workflows/index.js';
26
26
  export { AvailableHooks, executeHook, registerHook } from './hooks/index.js';
27
27
  export { ArrayOperator, BaseFilterTranslator, BasicOperator, ElementOperator, FieldCondition, Filter, LogicalOperator, NumericOperator, OperatorCondition, OperatorSupport, QueryOperator, RegexOperator } from './filter/index.js';
package/dist/index.js CHANGED
@@ -6,13 +6,13 @@ import { Tool } from './chunk-ZINPRHAN.js';
6
6
  export { createTool } from './chunk-ZINPRHAN.js';
7
7
  export { Mastra } from './chunk-HPIB5X7E.js';
8
8
  import { MastraMemory } from './chunk-XD7K4XPP.js';
9
- export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from './chunk-QW25LZSR.js';
9
+ export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from './chunk-N7KZVQDK.js';
10
10
  import { MastraStorage, DefaultStorage } from './chunk-JIV6PDIN.js';
11
11
  export { DefaultStorage } from './chunk-JIV6PDIN.js';
12
12
  export { DefaultVectorDB, DefaultVectorDB as LibSQLVector } from './chunk-LKOVXFLE.js';
13
13
  import { MastraVector } from './chunk-7NPRQT5A.js';
14
14
  export { defaultEmbedder } from './chunk-7NPRQT5A.js';
15
- import { Agent } from './chunk-ICUX73VZ.js';
15
+ import { Agent } from './chunk-ORM3OCHX.js';
16
16
  export { InstrumentClass, OTLPTraceExporter as OTLPStorageExporter, Telemetry, hasActiveTelemetry, withSpan } from './chunk-4ZRHVG25.js';
17
17
  export { deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './chunk-WIBGG4X6.js';
18
18
  import { MastraDeployer } from './chunk-Z735LDV7.js';
@@ -1,6 +1,6 @@
1
- import { W as Workflow } from '../workflow-B_sRFHFT.js';
1
+ import { W as Workflow } from '../workflow-CbKcJz7a.js';
2
2
  import '../base-eWkcLLSb.js';
3
- import { T as ToolAction } from '../base-BVXgbD4Q.js';
3
+ import { T as ToolAction } from '../base-BdNHFjqH.js';
4
4
  import 'xstate';
5
5
  import 'zod';
6
6
  import '@opentelemetry/api';
@@ -1,7 +1,7 @@
1
1
  import 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { B as BaseStructuredOutputType, o as CoreAssistantMessage, C as CoreMessage, n as CoreSystemMessage, q as CoreToolMessage, p as CoreUserMessage, s as EmbedManyResult, r as EmbedResult, G as GenerateReturn, D as LLMInnerStreamOptions, F as LLMStreamObjectOptions, x as LLMStreamOptions, z as LLMTextObjectOptions, y as LLMTextOptions, L as LanguageModel, O as OutputType, w as StreamReturn, v as StructuredOutput, u as StructuredOutputArrayItem, t as StructuredOutputType } from '../base-BVXgbD4Q.js';
4
+ export { B as BaseStructuredOutputType, o as CoreAssistantMessage, C as CoreMessage, n as CoreSystemMessage, q as CoreToolMessage, p as CoreUserMessage, s as EmbedManyResult, r as EmbedResult, G as GenerateReturn, D as LLMInnerStreamOptions, F as LLMStreamObjectOptions, x as LLMStreamOptions, z as LLMTextObjectOptions, y as LLMTextOptions, L as LanguageModel, O as OutputType, w as StreamReturn, v as StructuredOutput, u as StructuredOutputArrayItem, t as StructuredOutputType } from '../base-BdNHFjqH.js';
5
5
  import '../index-C5uPdbs4.js';
6
6
  import '../base-eWkcLLSb.js';
7
7
  import '@opentelemetry/api';
@@ -1,6 +1,6 @@
1
- import { A as Agent, M as MastraStorage, a as MastraMemory } from '../base-BVXgbD4Q.js';
1
+ import { A as Agent, M as MastraStorage, a as MastraMemory } from '../base-BdNHFjqH.js';
2
2
  import { L as Logger, B as BaseLogMessage } from '../index-C5uPdbs4.js';
3
- import { W as Workflow } from '../workflow-B_sRFHFT.js';
3
+ import { W as Workflow } from '../workflow-CbKcJz7a.js';
4
4
  import { MastraVector } from '../vector/index.js';
5
5
  import { O as OtelConfig, T as Telemetry } from '../base-eWkcLLSb.js';
6
6
  import { MastraTTS } from '../tts/index.js';
@@ -1,4 +1,4 @@
1
- export { a as MastraMemory, N as MemoryConfig, K as MessageResponse, H as MessageType, P as SharedMemoryConfig, J as StorageThreadType } from '../base-BVXgbD4Q.js';
1
+ export { a as MastraMemory, N as MemoryConfig, K as MessageResponse, H as MessageType, P as SharedMemoryConfig, J as StorageThreadType } from '../base-BdNHFjqH.js';
2
2
  export { Message as AiMessageType } from 'ai';
3
3
  import '../base-eWkcLLSb.js';
4
4
  import '@opentelemetry/api';
@@ -1 +1 @@
1
- export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from '../chunk-QW25LZSR.js';
1
+ export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from '../chunk-N7KZVQDK.js';
@@ -1,5 +1,5 @@
1
- import { M as MastraStorage, ag as TABLE_NAMES, k as StorageColumn, J as StorageThreadType, H as MessageType, m as StorageGetMessagesArg, E as EvalRow } from '../base-BVXgbD4Q.js';
2
- export { ai as TABLE_EVALS, aj as TABLE_MESSAGES, ak as TABLE_THREADS, al as TABLE_TRACES, ah as TABLE_WORKFLOW_SNAPSHOT, l as WorkflowRow } from '../base-BVXgbD4Q.js';
1
+ import { M as MastraStorage, ag as TABLE_NAMES, k as StorageColumn, J as StorageThreadType, H as MessageType, m as StorageGetMessagesArg, E as EvalRow } from '../base-BdNHFjqH.js';
2
+ export { ai as TABLE_EVALS, aj as TABLE_MESSAGES, ak as TABLE_THREADS, al as TABLE_TRACES, ah as TABLE_WORKFLOW_SNAPSHOT, l as WorkflowRow } from '../base-BdNHFjqH.js';
3
3
  import '../base-eWkcLLSb.js';
4
4
  export { LibSQLVector as DefaultVectorDB, LibSQLVector } from '../vector/libsql/index.js';
5
5
  import 'ai';
@@ -3,7 +3,7 @@ import { SpanKind } from '@opentelemetry/api';
3
3
  import { ExportResult } from '@opentelemetry/core';
4
4
  import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
5
5
  import { L as Logger } from '../index-C5uPdbs4.js';
6
- import { M as MastraStorage } from '../base-BVXgbD4Q.js';
6
+ import { M as MastraStorage } from '../base-BdNHFjqH.js';
7
7
  import 'pino';
8
8
  import 'stream';
9
9
  import 'ai';
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { j as ToolExecutionContext, T as ToolAction, c as MastraPrimitives } from '../base-BVXgbD4Q.js';
3
- export { Q as CoreTool } from '../base-BVXgbD4Q.js';
2
+ import { j as ToolExecutionContext, T as ToolAction, c as MastraPrimitives } from '../base-BdNHFjqH.js';
3
+ export { Q as CoreTool } from '../base-BdNHFjqH.js';
4
4
  import 'ai';
5
5
  import '../base-eWkcLLSb.js';
6
6
  import '@opentelemetry/api';
@@ -1,6 +1,6 @@
1
1
  import { Snapshot } from 'xstate';
2
2
  import { z } from 'zod';
3
- import { S as StepExecutionContext, b as StepAction, R as RetryConfig, c as MastraPrimitives, W as WorkflowOptions, I as IAction, d as StepVariableType, e as StepConfig, f as StepResult, g as WorkflowRunState, h as StepGraph } from './base-BVXgbD4Q.js';
3
+ import { S as StepExecutionContext, b as StepAction, R as RetryConfig, c as MastraPrimitives, W as WorkflowOptions, I as IAction, d as StepVariableType, e as StepConfig, f as StepResult, g as WorkflowRunState, h as StepGraph } from './base-BdNHFjqH.js';
4
4
  import { M as MastraBase } from './base-eWkcLLSb.js';
5
5
 
6
6
  declare class Step<TStepId extends string = any, TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends StepExecutionContext<TSchemaIn> = StepExecutionContext<TSchemaIn>> implements StepAction<TStepId, TSchemaIn, TSchemaOut, TContext> {
@@ -1,6 +1,6 @@
1
- export { S as Step, W as Workflow, c as createStep } from '../workflow-B_sRFHFT.js';
2
- import { V as VariableReference, f as StepResult } from '../base-BVXgbD4Q.js';
3
- export { Y as ActionContext, X as BaseCondition, a5 as DependencyCheckOutput, ab as ExtractSchemaFromStep, ae as ExtractSchemaType, ac as ExtractStepResult, af as PathsToStringProps, a2 as ResolverFunctionInput, a3 as ResolverFunctionOutput, R as RetryConfig, b as StepAction, _ as StepCondition, e as StepConfig, Z as StepDef, S as StepExecutionContext, h as StepGraph, aa as StepId, ad as StepInputType, U as StepNode, d as StepVariableType, a4 as SubscriberFunctionOutput, a7 as WorkflowActionParams, a8 as WorkflowActions, a6 as WorkflowActors, $ as WorkflowContext, a1 as WorkflowEvent, a0 as WorkflowLogMessage, W as WorkflowOptions, g as WorkflowRunState, a9 as WorkflowState } from '../base-BVXgbD4Q.js';
1
+ export { S as Step, W as Workflow, c as createStep } from '../workflow-CbKcJz7a.js';
2
+ import { V as VariableReference, f as StepResult } from '../base-BdNHFjqH.js';
3
+ export { Y as ActionContext, X as BaseCondition, a5 as DependencyCheckOutput, ab as ExtractSchemaFromStep, ae as ExtractSchemaType, ac as ExtractStepResult, af as PathsToStringProps, a2 as ResolverFunctionInput, a3 as ResolverFunctionOutput, R as RetryConfig, b as StepAction, _ as StepCondition, e as StepConfig, Z as StepDef, S as StepExecutionContext, h as StepGraph, aa as StepId, ad as StepInputType, U as StepNode, d as StepVariableType, a4 as SubscriberFunctionOutput, a7 as WorkflowActionParams, a8 as WorkflowActions, a6 as WorkflowActors, $ as WorkflowContext, a1 as WorkflowEvent, a0 as WorkflowLogMessage, W as WorkflowOptions, g as WorkflowRunState, a9 as WorkflowState } from '../base-BdNHFjqH.js';
4
4
  import 'xstate';
5
5
  import 'zod';
6
6
  import '../base-eWkcLLSb.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/core",
3
- "version": "0.4.1",
3
+ "version": "0.4.2-alpha.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/core.esm.js",