@mastra/core 0.2.0 → 0.2.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.
Files changed (59) hide show
  1. package/dist/agent/index.d.ts +1 -1
  2. package/dist/agent/index.js +1 -15
  3. package/dist/{base-Bpb7Dmwe.d.ts → base-C7R9FwZ6.d.ts} +7 -7
  4. package/dist/base.js +0 -2
  5. package/dist/bundler/index.js +0 -3
  6. package/dist/{chunk-FGZVE4CM.js → chunk-4ZRHVG25.js} +2 -4
  7. package/dist/chunk-55GTEVHJ.js +1 -1
  8. package/dist/{chunk-U6J2FOU4.js → chunk-5HXXWLRX.js} +103 -101
  9. package/dist/{chunk-SB37QG7O.js → chunk-6TCTOQ3G.js} +38 -37
  10. package/dist/{chunk-OJ26F3J4.js → chunk-AN562ICT.js} +2 -0
  11. package/dist/chunk-AWEACB2T.js +1 -1
  12. package/dist/{chunk-MLWGYRJR.js → chunk-BB4KXGBU.js} +1 -5
  13. package/dist/chunk-C6A6W6XS.js +48 -20
  14. package/dist/{chunk-K4DFI76V.js → chunk-CUIUUULJ.js} +313 -204
  15. package/dist/{chunk-SDBM53G4.js → chunk-HT63PEVD.js} +10 -5
  16. package/dist/{chunk-VB7CO5ND.js → chunk-NUDAZEOG.js} +6 -2
  17. package/dist/{chunk-MEISIZMP.js → chunk-PNZK456O.js} +1 -1
  18. package/dist/chunk-SIFBBGY6.js +2 -2
  19. package/dist/{chunk-2JL6DQMZ.js → chunk-V4WSAQOP.js} +14 -14
  20. package/dist/{chunk-65VPTVVP.js → chunk-V5UMPUKC.js} +2 -2
  21. package/dist/{chunk-J3W3IHDO.js → chunk-VE4JJJSW.js} +43 -21
  22. package/dist/{chunk-3HBFW3Q7.js → chunk-ZINPRHAN.js} +0 -2
  23. package/dist/chunk-ZJOXJFJI.js +1 -2
  24. package/dist/deployer/index.d.ts +1 -1
  25. package/dist/deployer/index.js +0 -4
  26. package/dist/eval/index.d.ts +1 -1
  27. package/dist/eval/index.js +1 -3
  28. package/dist/filter/index.js +0 -1
  29. package/dist/hooks/index.js +1 -2
  30. package/dist/index.d.ts +5 -5
  31. package/dist/index.js +18 -22
  32. package/dist/integration/index.d.ts +2 -2
  33. package/dist/integration/index.js +1 -6
  34. package/dist/llm/index.d.ts +1 -1
  35. package/dist/llm/index.js +1 -1
  36. package/dist/logger/index.js +0 -1
  37. package/dist/mastra/index.d.ts +15 -14
  38. package/dist/mastra/index.js +1 -20
  39. package/dist/memory/index.d.ts +1 -1
  40. package/dist/memory/index.js +1 -11
  41. package/dist/relevance/index.js +1 -16
  42. package/dist/storage/index.d.ts +2 -2
  43. package/dist/storage/index.js +2 -7
  44. package/dist/telemetry/index.d.ts +1 -1
  45. package/dist/telemetry/index.js +1 -3
  46. package/dist/telemetry/otel-vendor.js +0 -1
  47. package/dist/tools/index.d.ts +2 -2
  48. package/dist/tools/index.js +1 -2
  49. package/dist/tts/index.js +1 -6
  50. package/dist/utils.js +0 -1
  51. package/dist/vector/index.d.ts +1 -1
  52. package/dist/vector/index.js +0 -3
  53. package/dist/vector/libsql/index.js +1 -6
  54. package/dist/{workflow-Cy8UTGCt.d.ts → workflow-7xHmmFH5.d.ts} +1 -1
  55. package/dist/workflows/index.d.ts +3 -3
  56. package/dist/workflows/index.js +1 -4
  57. package/package.json +10 -10
  58. package/dist/chunk-2SAHBQEF.js +0 -3
  59. /package/dist/{chunk-VDOJTUYY.js → chunk-ZDWFBE5L.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  import 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { A as Agent } from '../base-Bpb7Dmwe.js';
4
+ export { A as Agent } from '../base-C7R9FwZ6.js';
5
5
  import '../base-BbtPAA6f.js';
6
6
  import '../types-m9RryK9a.js';
7
7
  import 'sift';
@@ -1,15 +1 @@
1
- export { Agent } from '../chunk-K4DFI76V.js';
2
- import '../chunk-FGZVE4CM.js';
3
- import '../chunk-2SAHBQEF.js';
4
- import '../chunk-65VPTVVP.js';
5
- import '../chunk-U6J2FOU4.js';
6
- import '../chunk-RG66XEJT.js';
7
- import '../chunk-OJ26F3J4.js';
8
- import '../chunk-ZJOXJFJI.js';
9
- import '../chunk-55GTEVHJ.js';
10
- import '../chunk-AWEACB2T.js';
11
- import '../chunk-O2VP5JBC.js';
12
- import '../chunk-VB7CO5ND.js';
13
- import '../chunk-MLWGYRJR.js';
14
- import '../chunk-SIFBBGY6.js';
15
- import '../chunk-C6A6W6XS.js';
1
+ export { Agent } from '../chunk-CUIUUULJ.js';
@@ -1,5 +1,5 @@
1
1
  import * as ai from 'ai';
2
- import { EmbeddingModel, CoreMessage as CoreMessage$1, Message, UserContent, AssistantContent, LanguageModelV1, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, LanguageModel as LanguageModel$1, DeepPartial, ToolContent } from 'ai';
2
+ import { EmbeddingModel, CoreMessage as CoreMessage$1, Message, UserContent, AssistantContent, LanguageModelV1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, LanguageModel as LanguageModel$1, DeepPartial, ToolContent } from 'ai';
3
3
  import { M as MastraBase, T as Telemetry } from './base-BbtPAA6f.js';
4
4
  import { a as Metric, M as MetricResult, T as TestInfo } from './types-m9RryK9a.js';
5
5
  import { Query } from 'sift';
@@ -481,8 +481,8 @@ interface AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = und
481
481
  threadId?: string;
482
482
  memoryOptions?: MemoryConfig;
483
483
  runId?: string;
484
- onFinish?: (result: string) => Promise<void> | void;
485
- onStepFinish?: (step: string) => void;
484
+ onFinish?: (result: string) => unknown;
485
+ onStepFinish?: (step: string) => unknown;
486
486
  maxSteps?: number;
487
487
  output?: OutputType | Z;
488
488
  temperature?: number;
@@ -545,8 +545,8 @@ type LLMInnerStreamOptions = {
545
545
  tools?: ToolsInput;
546
546
  convertedTools?: Record<string, CoreTool>;
547
547
  messages: CoreMessage[];
548
- onStepFinish?: (step: string) => void;
549
- onFinish?: (result: string) => Promise<void> | void;
548
+ onStepFinish?: (step: string) => unknown;
549
+ onFinish?: (result: string) => unknown;
550
550
  maxSteps?: number;
551
551
  temperature?: number;
552
552
  toolChoice?: 'auto' | 'required';
@@ -764,7 +764,7 @@ declare abstract class MastraStorage extends MastraBase {
764
764
  static readonly TABLE_THREADS = "mastra_threads";
765
765
  /** @deprecated import { TABLE_TRACES } from '@mastra/core/storage' instead */
766
766
  static readonly TABLE_TRACES = "mastra_traces";
767
- hasInit: boolean;
767
+ protected hasInitialized: null | Promise<boolean>;
768
768
  constructor({ name }: {
769
769
  name: string;
770
770
  });
@@ -860,4 +860,4 @@ declare abstract class MastraStorage extends MastraBase {
860
860
  __getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
861
861
  }
862
862
 
863
- export { type WorkflowContext as $, Agent as A, type BaseStructuredOutputType as B, type CoreMessage as C, type LLMInnerStreamOptions as D, type EvalRow as E, type LLMStreamObjectOptions as F, type GenerateReturn as G, type MessageType as H, type IAction as I, type StorageThreadType as J, type MessageResponse as K, type LanguageModel as L, MastraStorage as M, type MemoryConfig as N, type OutputType as O, type SharedMemoryConfig as P, type CoreTool as Q, type RetryConfig as R, type StepExecutionContext as S, type ToolAction as T, type StepNode as U, type VariableReference as V, type WorkflowOptions as W, type BaseCondition as X, type ActionContext as Y, type StepDef as Z, type StepCondition as _, MastraMemory as a, type WorkflowLogMessage as a0, type WorkflowEvent as a1, type ResolverFunctionInput as a2, type ResolverFunctionOutput as a3, type SubscriberFunctionOutput as a4, type DependencyCheckOutput as a5, type WorkflowActors as a6, type WorkflowActionParams as a7, type WorkflowActions as a8, type WorkflowState as a9, type StepId as aa, type ExtractSchemaFromStep as ab, type ExtractStepResult as ac, type StepInputType as ad, type ExtractSchemaType as ae, type PathsToStringProps as af, type TABLE_NAMES as ag, TABLE_WORKFLOW_SNAPSHOT as ah, TABLE_EVALS as ai, TABLE_MESSAGES as aj, TABLE_THREADS as ak, TABLE_TRACES as al, type StepAction as b, type MastraPrimitives as c, type StepVariableType as d, type StepConfig as e, type StepResult as f, type WorkflowRunState as g, type StepGraph as h, type AgentConfig as i, type ToolExecutionContext as j, type StorageColumn as k, type WorkflowRow as l, type StorageGetMessagesArg as m, type CoreSystemMessage as n, type CoreAssistantMessage as o, type CoreUserMessage as p, type CoreToolMessage as q, type EmbedResult as r, type EmbedManyResult as s, type StructuredOutputType as t, type StructuredOutputArrayItem as u, type StructuredOutput as v, type StreamReturn as w, type LLMStreamOptions as x, type LLMTextOptions as y, type LLMTextObjectOptions as z };
863
+ export { type WorkflowContext as $, Agent as A, type BaseStructuredOutputType as B, type CoreMessage as C, type LLMInnerStreamOptions as D, type EvalRow as E, type LLMStreamObjectOptions as F, type GenerateReturn as G, type MessageType as H, type IAction as I, type StorageThreadType as J, type MessageResponse as K, type LanguageModel as L, MastraMemory as M, type MemoryConfig as N, type OutputType as O, type SharedMemoryConfig as P, type CoreTool as Q, type RetryConfig as R, type StepExecutionContext as S, type ToolAction as T, type StepNode as U, type VariableReference as V, type WorkflowOptions as W, type BaseCondition as X, type ActionContext as Y, type StepDef as Z, type StepCondition as _, MastraStorage as a, type WorkflowLogMessage as a0, type WorkflowEvent as a1, type ResolverFunctionInput as a2, type ResolverFunctionOutput as a3, type SubscriberFunctionOutput as a4, type DependencyCheckOutput as a5, type WorkflowActors as a6, type WorkflowActionParams as a7, type WorkflowActions as a8, type WorkflowState as a9, type StepId as aa, type ExtractSchemaFromStep as ab, type ExtractStepResult as ac, type StepInputType as ad, type ExtractSchemaType as ae, type PathsToStringProps as af, type TABLE_NAMES as ag, TABLE_WORKFLOW_SNAPSHOT as ah, TABLE_EVALS as ai, TABLE_MESSAGES as aj, TABLE_THREADS as ak, TABLE_TRACES as al, type StepAction as b, type MastraPrimitives as c, type StepVariableType as d, type StepConfig as e, type StepResult as f, type WorkflowRunState as g, type StepGraph as h, type AgentConfig as i, type ToolExecutionContext as j, type StorageColumn as k, type WorkflowRow as l, type StorageGetMessagesArg as m, type CoreSystemMessage as n, type CoreAssistantMessage as o, type CoreUserMessage as p, type CoreToolMessage as q, type EmbedResult as r, type EmbedManyResult as s, type StructuredOutputType as t, type StructuredOutputArrayItem as u, type StructuredOutput as v, type StreamReturn as w, type LLMStreamOptions as x, type LLMTextOptions as y, type LLMTextObjectOptions as z };
package/dist/base.js CHANGED
@@ -1,3 +1 @@
1
1
  export { MastraBase } from './chunk-AWEACB2T.js';
2
- import './chunk-O2VP5JBC.js';
3
- import './chunk-C6A6W6XS.js';
@@ -1,4 +1 @@
1
1
  export { MastraBundler } from '../chunk-22LC46YN.js';
2
- import '../chunk-AWEACB2T.js';
3
- import '../chunk-O2VP5JBC.js';
4
- import '../chunk-C6A6W6XS.js';
@@ -2,7 +2,6 @@ import { TABLE_TRACES } from './chunk-RG66XEJT.js';
2
2
  import { trace, context, propagation, SpanStatusCode, SpanKind } from '@opentelemetry/api';
3
3
  import { ExportResultCode } from '@opentelemetry/core';
4
4
  import { JsonTraceSerializer } from '@opentelemetry/otlp-transformer';
5
- import '@opentelemetry/sdk-trace-base';
6
5
 
7
6
  function hasActiveTelemetry(tracerName = "default-tracer") {
8
7
  try {
@@ -116,7 +115,7 @@ var OTLPTraceExporter = class {
116
115
  queue = [];
117
116
  serializer;
118
117
  logger;
119
- activeFlush = undefined;
118
+ activeFlush = void 0;
120
119
  constructor({ logger, storage }) {
121
120
  this.storage = storage;
122
121
  this.serializer = JsonTraceSerializer;
@@ -199,7 +198,7 @@ var OTLPTraceExporter = class {
199
198
  error: e
200
199
  });
201
200
  }).finally(() => {
202
- this.activeFlush = undefined;
201
+ this.activeFlush = void 0;
203
202
  });
204
203
  }
205
204
  async forceFlush() {
@@ -316,7 +315,6 @@ var Telemetry = class _Telemetry {
316
315
  span.end();
317
316
  return res;
318
317
  };
319
- var recordResult = recordResult2;
320
318
  if (context3.attributes) {
321
319
  span.setAttributes(context3.attributes);
322
320
  }
@@ -90,7 +90,7 @@ function deepMerge(target, source) {
90
90
  output[key] = sourceValue;
91
91
  } else if (sourceValue instanceof Object && targetValue instanceof Object && !Array.isArray(sourceValue) && !Array.isArray(targetValue)) {
92
92
  output[key] = deepMerge(targetValue, sourceValue);
93
- } else if (sourceValue !== undefined) {
93
+ } else if (sourceValue !== void 0) {
94
94
  output[key] = sourceValue;
95
95
  }
96
96
  });
@@ -15,7 +15,7 @@ var MastraStorage = class extends MastraBase {
15
15
  static TABLE_THREADS = TABLE_THREADS;
16
16
  /** @deprecated import { TABLE_TRACES } from '@mastra/core/storage' instead */
17
17
  static TABLE_TRACES = TABLE_TRACES;
18
- hasInit = false;
18
+ hasInitialized = null;
19
19
  constructor({ name }) {
20
20
  super({
21
21
  component: "STORAGE",
@@ -71,107 +71,109 @@ var MastraStorage = class extends MastraBase {
71
71
  return this.getTraces({ scope, page, perPage, attributes });
72
72
  }
73
73
  async init() {
74
- if (this.hasInit) {
74
+ if (await this.hasInitialized) {
75
75
  return;
76
76
  }
77
- await this.createTable({
78
- tableName: TABLE_WORKFLOW_SNAPSHOT,
79
- schema: {
80
- workflow_name: {
81
- type: "text"
82
- },
83
- run_id: {
84
- type: "text"
85
- },
86
- snapshot: {
87
- type: "text"
88
- },
89
- createdAt: {
90
- type: "timestamp"
91
- },
92
- updatedAt: {
93
- type: "timestamp"
77
+ this.hasInitialized = Promise.all([
78
+ this.createTable({
79
+ tableName: TABLE_WORKFLOW_SNAPSHOT,
80
+ schema: {
81
+ workflow_name: {
82
+ type: "text"
83
+ },
84
+ run_id: {
85
+ type: "text"
86
+ },
87
+ snapshot: {
88
+ type: "text"
89
+ },
90
+ createdAt: {
91
+ type: "timestamp"
92
+ },
93
+ updatedAt: {
94
+ type: "timestamp"
95
+ }
94
96
  }
95
- }
96
- });
97
- await this.createTable({
98
- tableName: TABLE_EVALS,
99
- schema: {
100
- input: {
101
- type: "text"
102
- },
103
- output: {
104
- type: "text"
105
- },
106
- result: {
107
- type: "jsonb"
108
- },
109
- agent_name: {
110
- type: "text"
111
- },
112
- metric_name: {
113
- type: "text"
114
- },
115
- instructions: {
116
- type: "text"
117
- },
118
- test_info: {
119
- type: "jsonb",
120
- nullable: true
121
- },
122
- global_run_id: {
123
- type: "text"
124
- },
125
- run_id: {
126
- type: "text"
127
- },
128
- created_at: {
129
- type: "timestamp"
97
+ }),
98
+ this.createTable({
99
+ tableName: TABLE_EVALS,
100
+ schema: {
101
+ input: {
102
+ type: "text"
103
+ },
104
+ output: {
105
+ type: "text"
106
+ },
107
+ result: {
108
+ type: "jsonb"
109
+ },
110
+ agent_name: {
111
+ type: "text"
112
+ },
113
+ metric_name: {
114
+ type: "text"
115
+ },
116
+ instructions: {
117
+ type: "text"
118
+ },
119
+ test_info: {
120
+ type: "jsonb",
121
+ nullable: true
122
+ },
123
+ global_run_id: {
124
+ type: "text"
125
+ },
126
+ run_id: {
127
+ type: "text"
128
+ },
129
+ created_at: {
130
+ type: "timestamp"
131
+ }
130
132
  }
131
- }
132
- });
133
- await this.createTable({
134
- tableName: TABLE_THREADS,
135
- schema: {
136
- id: { type: "text", nullable: false, primaryKey: true },
137
- resourceId: { type: "text", nullable: false },
138
- title: { type: "text", nullable: false },
139
- metadata: { type: "text", nullable: true },
140
- createdAt: { type: "timestamp", nullable: false },
141
- updatedAt: { type: "timestamp", nullable: false }
142
- }
143
- });
144
- await this.createTable({
145
- tableName: TABLE_MESSAGES,
146
- schema: {
147
- id: { type: "text", nullable: false, primaryKey: true },
148
- thread_id: { type: "text", nullable: false },
149
- content: { type: "text", nullable: false },
150
- role: { type: "text", nullable: false },
151
- type: { type: "text", nullable: false },
152
- createdAt: { type: "timestamp", nullable: false }
153
- }
154
- });
155
- await this.createTable({
156
- tableName: TABLE_TRACES,
157
- schema: {
158
- id: { type: "text", nullable: false, primaryKey: true },
159
- parentSpanId: { type: "text", nullable: true },
160
- name: { type: "text", nullable: false },
161
- traceId: { type: "text", nullable: false },
162
- scope: { type: "text", nullable: false },
163
- kind: { type: "integer", nullable: false },
164
- attributes: { type: "jsonb", nullable: true },
165
- status: { type: "jsonb", nullable: true },
166
- events: { type: "jsonb", nullable: true },
167
- links: { type: "jsonb", nullable: true },
168
- other: { type: "text", nullable: true },
169
- startTime: { type: "bigint", nullable: false },
170
- endTime: { type: "bigint", nullable: false },
171
- createdAt: { type: "timestamp", nullable: false }
172
- }
173
- });
174
- this.hasInit = true;
133
+ }),
134
+ this.createTable({
135
+ tableName: TABLE_THREADS,
136
+ schema: {
137
+ id: { type: "text", nullable: false, primaryKey: true },
138
+ resourceId: { type: "text", nullable: false },
139
+ title: { type: "text", nullable: false },
140
+ metadata: { type: "text", nullable: true },
141
+ createdAt: { type: "timestamp", nullable: false },
142
+ updatedAt: { type: "timestamp", nullable: false }
143
+ }
144
+ }),
145
+ this.createTable({
146
+ tableName: TABLE_MESSAGES,
147
+ schema: {
148
+ id: { type: "text", nullable: false, primaryKey: true },
149
+ thread_id: { type: "text", nullable: false },
150
+ content: { type: "text", nullable: false },
151
+ role: { type: "text", nullable: false },
152
+ type: { type: "text", nullable: false },
153
+ createdAt: { type: "timestamp", nullable: false }
154
+ }
155
+ }),
156
+ this.createTable({
157
+ tableName: TABLE_TRACES,
158
+ schema: {
159
+ id: { type: "text", nullable: false, primaryKey: true },
160
+ parentSpanId: { type: "text", nullable: true },
161
+ name: { type: "text", nullable: false },
162
+ traceId: { type: "text", nullable: false },
163
+ scope: { type: "text", nullable: false },
164
+ kind: { type: "integer", nullable: false },
165
+ attributes: { type: "jsonb", nullable: true },
166
+ status: { type: "jsonb", nullable: true },
167
+ events: { type: "jsonb", nullable: true },
168
+ links: { type: "jsonb", nullable: true },
169
+ other: { type: "text", nullable: true },
170
+ startTime: { type: "bigint", nullable: false },
171
+ endTime: { type: "bigint", nullable: false },
172
+ createdAt: { type: "timestamp", nullable: false }
173
+ }
174
+ })
175
+ ]).then(() => true);
176
+ await this.hasInitialized;
175
177
  }
176
178
  async persistWorkflowSnapshot({
177
179
  workflowName,
@@ -196,7 +198,7 @@ var MastraStorage = class extends MastraBase {
196
198
  workflowName,
197
199
  runId
198
200
  }) {
199
- if (!this.hasInit) {
201
+ if (!this.hasInitialized) {
200
202
  await this.init();
201
203
  }
202
204
  this.logger.debug("Loading workflow snapshot", { workflowName, runId });
@@ -214,7 +216,7 @@ var MastraStorage = class extends MastraBase {
214
216
  function safelyParseJSON(jsonString) {
215
217
  try {
216
218
  return JSON.parse(jsonString);
217
- } catch (e) {
219
+ } catch {
218
220
  return {};
219
221
  }
220
222
  }
@@ -522,7 +524,7 @@ var DefaultStorage = class extends MastraStorage {
522
524
  }
523
525
  transformEvalRow(row) {
524
526
  const resultValue = JSON.parse(row.result);
525
- const testInfoValue = row.test_info ? JSON.parse(row.test_info) : undefined;
527
+ const testInfoValue = row.test_info ? JSON.parse(row.test_info) : void 0;
526
528
  if (!resultValue || typeof resultValue !== "object" || !("score" in resultValue)) {
527
529
  throw new Error(`Invalid MetricResult format: ${JSON.stringify(resultValue)}`);
528
530
  }
@@ -3,38 +3,6 @@ import { context, trace } from '@opentelemetry/api';
3
3
  import { get } from 'radash';
4
4
  import sift from 'sift';
5
5
  import { setup, createActor, assign, fromPromise } from 'xstate';
6
- import 'zod';
7
-
8
- var Step = class {
9
- id;
10
- description;
11
- inputSchema;
12
- outputSchema;
13
- payload;
14
- execute;
15
- retryConfig;
16
- mastra;
17
- constructor({
18
- id,
19
- description,
20
- execute,
21
- payload,
22
- outputSchema,
23
- inputSchema,
24
- retryConfig
25
- }) {
26
- this.id = id;
27
- this.description = description ?? "";
28
- this.inputSchema = inputSchema;
29
- this.payload = payload;
30
- this.outputSchema = outputSchema;
31
- this.execute = execute;
32
- this.retryConfig = retryConfig;
33
- }
34
- };
35
- function createStep(opts) {
36
- return new Step(opts);
37
- }
38
6
 
39
7
  // src/workflows/utils.ts
40
8
  function isErrorEvent(stateEvent) {
@@ -48,7 +16,7 @@ function isVariableReference(value) {
48
16
  }
49
17
  function getStepResult(result) {
50
18
  if (result?.status === "success") return result.output;
51
- return undefined;
19
+ return void 0;
52
20
  }
53
21
 
54
22
  // src/workflows/workflow.ts
@@ -223,7 +191,7 @@ var Workflow = class extends MastraBase {
223
191
  const actorSnapshot = snapshot ? {
224
192
  ...snapshot,
225
193
  context: machineInput
226
- } : undefined;
194
+ } : void 0;
227
195
  this.logger.debug(`Creating actor with configuration`, {
228
196
  machineInput,
229
197
  actorSnapshot,
@@ -264,6 +232,7 @@ var Workflow = class extends MastraBase {
264
232
  context: state.context,
265
233
  activePaths: this.#getActivePathsAndStatus(state.value),
266
234
  timestamp: Date.now()
235
+ })?.catch(() => {
267
236
  });
268
237
  });
269
238
  }
@@ -698,7 +667,7 @@ var Workflow = class extends MastraBase {
698
667
  if (!isTransitionEvent(event)) return context.attempts;
699
668
  const { stepId } = params;
700
669
  const attemptCount = context.attempts[stepId];
701
- if (attemptCount === undefined) return context.attempts;
670
+ if (attemptCount === void 0) return context.attempts;
702
671
  return { ...context.attempts, [stepId]: attemptCount - 1 };
703
672
  }
704
673
  })
@@ -907,7 +876,7 @@ var Workflow = class extends MastraBase {
907
876
  if (result && result.status === "success") {
908
877
  return result.output;
909
878
  }
910
- return undefined;
879
+ return void 0;
911
880
  }
912
881
  };
913
882
  for (const [key, variable] of Object.entries(stepConfig.data)) {
@@ -921,7 +890,7 @@ var Workflow = class extends MastraBase {
921
890
  }
922
891
  );
923
892
  if (!sourceData && variable.step !== "trigger") {
924
- resolvedData[key] = undefined;
893
+ resolvedData[key] = void 0;
925
894
  continue;
926
895
  }
927
896
  const value = variable.path === "" || variable.path === "." ? sourceData : get(sourceData, variable.path);
@@ -1200,4 +1169,36 @@ var Workflow = class extends MastraBase {
1200
1169
  }
1201
1170
  };
1202
1171
 
1172
+ // src/workflows/step.ts
1173
+ var Step = class {
1174
+ id;
1175
+ description;
1176
+ inputSchema;
1177
+ outputSchema;
1178
+ payload;
1179
+ execute;
1180
+ retryConfig;
1181
+ mastra;
1182
+ constructor({
1183
+ id,
1184
+ description,
1185
+ execute,
1186
+ payload,
1187
+ outputSchema,
1188
+ inputSchema,
1189
+ retryConfig
1190
+ }) {
1191
+ this.id = id;
1192
+ this.description = description ?? "";
1193
+ this.inputSchema = inputSchema;
1194
+ this.payload = payload;
1195
+ this.outputSchema = outputSchema;
1196
+ this.execute = execute;
1197
+ this.retryConfig = retryConfig;
1198
+ }
1199
+ };
1200
+ function createStep(opts) {
1201
+ return new Step(opts);
1202
+ }
1203
+
1203
1204
  export { Step, Workflow, createStep, getStepResult, isErrorEvent, isTransitionEvent, isVariableReference };
@@ -70,6 +70,8 @@ var LibSQLFilterTranslator = class extends BaseFilterTranslator {
70
70
  // };
71
71
  // }
72
72
  };
73
+
74
+ // src/vector/libsql/sql-builder.ts
73
75
  var createBasicOperator = (symbol) => {
74
76
  return (key) => ({
75
77
  sql: `CASE
@@ -59,7 +59,7 @@ var MastraBase = class {
59
59
  // tracer: this.telemetry.tracer,
60
60
  tracer: this.telemetry.getBaggageTracer(),
61
61
  isEnabled: !!this.telemetry.tracer
62
- } : undefined;
62
+ } : void 0;
63
63
  }
64
64
  };
65
65
 
@@ -1,7 +1,3 @@
1
- // src/eval/metric.ts
2
- var Metric = class {
3
- };
4
-
5
1
  // src/hooks/mitt.ts
6
2
  function mitt(all) {
7
3
  all = all || /* @__PURE__ */ new Map();
@@ -84,4 +80,4 @@ function executeHook(hook, data) {
84
80
  });
85
81
  }
86
82
 
87
- export { AvailableHooks, Metric, executeHook, registerHook };
83
+ export { AvailableHooks, executeHook, registerHook };
@@ -2,41 +2,69 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
5
- var __typeError = (msg) => {
5
+ var __typeError = msg => {
6
6
  throw TypeError(msg);
7
7
  };
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true,
12
+ value
13
+ }) : obj[key] = value;
14
+ var __name = (target, value) => __defProp(target, "name", {
15
+ value,
16
+ configurable: true
17
+ });
18
+ var __decoratorStart = base => [,,, __create(base?.[__knownSymbol("metadata")] ?? null)];
11
19
  var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
12
- var __expectFn = (fn) => fn !== undefined && typeof fn !== "function" ? __typeError("Function expected") : fn;
13
- var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
20
+ var __expectFn = fn => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
21
+ var __decoratorContext = (kind, name, done, metadata, fns) => ({
22
+ kind: __decoratorStrings[kind],
23
+ name,
24
+ metadata,
25
+ addInitializer: fn => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null))
26
+ });
14
27
  var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
15
28
  var __runInitializers = (array, flags, self, value) => {
16
29
  for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
17
30
  return value;
18
31
  };
19
32
  var __decorateElement = (array, flags, name, decorators, target, extra) => {
20
- var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
21
- var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
22
- var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
23
- var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
24
- return __privateGet(this, extra);
25
- }, set [name](x) {
26
- return __privateSet(this, extra, x);
27
- } }, name));
33
+ var fn,
34
+ it,
35
+ done,
36
+ ctx,
37
+ access,
38
+ k = flags & 7,
39
+ s = !!(flags & 8),
40
+ p = !!(flags & 16);
41
+ var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0,
42
+ key = __decoratorStrings[k + 5];
43
+ var initializers = k > 3 && (array[j - 1] = []),
44
+ extraInitializers = array[j] || (array[j] = []);
45
+ var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : {
46
+ get [name]() {
47
+ return __privateGet(this, extra);
48
+ },
49
+ set [name](x) {
50
+ return __privateSet(this, extra, x);
51
+ }
52
+ }, name));
28
53
  k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
29
54
  for (var i = decorators.length - 1; i >= 0; i--) {
30
55
  ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
31
56
  if (k) {
32
- ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
33
- if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
57
+ ctx.static = s, ctx.private = p, access = ctx.access = {
58
+ has: p ? x => __privateIn(target, x) : x => name in x
59
+ };
60
+ if (k ^ 3) access.get = p ? x => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : x => x[name];
34
61
  if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
35
62
  }
36
- it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? undefined : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
37
- if (k ^ 4 || it === undefined) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
38
- else if (typeof it !== "object" || it === null) __typeError("Object expected");
39
- else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
63
+ it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : {
64
+ get: desc.get,
65
+ set: desc.set
66
+ } : target, ctx), done._ = 1;
67
+ if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);else if (typeof it !== "object" || it === null) __typeError("Object expected");else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
40
68
  }
41
69
  return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
42
70
  };