@mastra/core 0.0.0-commonjs-20250227130920

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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -0
  3. package/dist/agent/index.cjs +1865 -0
  4. package/dist/agent/index.d.cts +15 -0
  5. package/dist/agent/index.d.ts +15 -0
  6. package/dist/agent/index.js +1 -0
  7. package/dist/base-D90KQ4XI.d.ts +139 -0
  8. package/dist/base-hs9NDAZ2.d.cts +139 -0
  9. package/dist/base-nKCMCNrM.d.ts +920 -0
  10. package/dist/base-nhesrHv3.d.cts +920 -0
  11. package/dist/base.cjs +138 -0
  12. package/dist/base.d.cts +6 -0
  13. package/dist/base.d.ts +6 -0
  14. package/dist/base.js +1 -0
  15. package/dist/bundler/index.cjs +158 -0
  16. package/dist/bundler/index.d.cts +28 -0
  17. package/dist/bundler/index.d.ts +28 -0
  18. package/dist/bundler/index.js +1 -0
  19. package/dist/chunk-33GSTUNK.js +620 -0
  20. package/dist/chunk-4YRYBCOZ.js +10 -0
  21. package/dist/chunk-55NFNRKO.js +10 -0
  22. package/dist/chunk-5XPCMNGW.js +215 -0
  23. package/dist/chunk-B3M27AMP.js +1479 -0
  24. package/dist/chunk-BB4KXGBU.js +83 -0
  25. package/dist/chunk-C6A6W6XS.js +77 -0
  26. package/dist/chunk-HQ55LN2U.js +318 -0
  27. package/dist/chunk-KNVTCZW7.js +416 -0
  28. package/dist/chunk-LH47WVJL.js +61 -0
  29. package/dist/chunk-NGD2HQYW.js +346 -0
  30. package/dist/chunk-NUDAZEOG.js +35 -0
  31. package/dist/chunk-OZ4XVJ6F.js +49 -0
  32. package/dist/chunk-PHMSPCTC.js +145 -0
  33. package/dist/chunk-PNZK456O.js +88 -0
  34. package/dist/chunk-QAAJAHDB.js +37 -0
  35. package/dist/chunk-RG66XEJT.js +8 -0
  36. package/dist/chunk-SIFBBGY6.js +190 -0
  37. package/dist/chunk-SVEAENO7.js +22 -0
  38. package/dist/chunk-SY5244IR.js +1499 -0
  39. package/dist/chunk-W5HVJX45.js +402 -0
  40. package/dist/chunk-WIBGG4X6.js +173 -0
  41. package/dist/chunk-ZDWFBE5L.js +1 -0
  42. package/dist/chunk-ZINPRHAN.js +22 -0
  43. package/dist/deployer/index.cjs +165 -0
  44. package/dist/deployer/index.d.cts +19 -0
  45. package/dist/deployer/index.d.ts +19 -0
  46. package/dist/deployer/index.js +1 -0
  47. package/dist/eval/index.cjs +110 -0
  48. package/dist/eval/index.d.cts +28 -0
  49. package/dist/eval/index.d.ts +28 -0
  50. package/dist/eval/index.js +1 -0
  51. package/dist/filter/index.cjs +192 -0
  52. package/dist/filter/index.d.cts +90 -0
  53. package/dist/filter/index.d.ts +90 -0
  54. package/dist/filter/index.js +1 -0
  55. package/dist/hooks/index.cjs +87 -0
  56. package/dist/hooks/index.d.cts +33 -0
  57. package/dist/hooks/index.d.ts +33 -0
  58. package/dist/hooks/index.js +1 -0
  59. package/dist/index-mKY1XrpK.d.cts +90 -0
  60. package/dist/index-mKY1XrpK.d.ts +90 -0
  61. package/dist/index.cjs +6844 -0
  62. package/dist/index.d.cts +97 -0
  63. package/dist/index.d.ts +97 -0
  64. package/dist/index.js +119 -0
  65. package/dist/integration/index.cjs +113 -0
  66. package/dist/integration/index.d.cts +52 -0
  67. package/dist/integration/index.d.ts +52 -0
  68. package/dist/integration/index.js +1 -0
  69. package/dist/llm/index.cjs +2 -0
  70. package/dist/llm/index.d.cts +15 -0
  71. package/dist/llm/index.d.ts +15 -0
  72. package/dist/llm/index.js +1 -0
  73. package/dist/logger/index.cjs +159 -0
  74. package/dist/logger/index.d.cts +3 -0
  75. package/dist/logger/index.d.ts +3 -0
  76. package/dist/logger/index.js +1 -0
  77. package/dist/mastra/index.cjs +1741 -0
  78. package/dist/mastra/index.d.cts +67 -0
  79. package/dist/mastra/index.d.ts +67 -0
  80. package/dist/mastra/index.js +1 -0
  81. package/dist/memory/index.cjs +1907 -0
  82. package/dist/memory/index.d.cts +15 -0
  83. package/dist/memory/index.d.ts +15 -0
  84. package/dist/memory/index.js +1 -0
  85. package/dist/relevance/index.cjs +1927 -0
  86. package/dist/relevance/index.d.cts +21 -0
  87. package/dist/relevance/index.d.ts +21 -0
  88. package/dist/relevance/index.js +1 -0
  89. package/dist/storage/index.cjs +361 -0
  90. package/dist/storage/index.d.cts +15 -0
  91. package/dist/storage/index.d.ts +15 -0
  92. package/dist/storage/index.js +2 -0
  93. package/dist/storage/libsql/index.cjs +770 -0
  94. package/dist/storage/libsql/index.d.cts +81 -0
  95. package/dist/storage/libsql/index.d.ts +81 -0
  96. package/dist/storage/libsql/index.js +1 -0
  97. package/dist/telemetry/index.cjs +413 -0
  98. package/dist/telemetry/index.d.cts +51 -0
  99. package/dist/telemetry/index.d.ts +51 -0
  100. package/dist/telemetry/index.js +1 -0
  101. package/dist/telemetry/otel-vendor.cjs +52 -0
  102. package/dist/telemetry/otel-vendor.d.cts +7 -0
  103. package/dist/telemetry/otel-vendor.d.ts +7 -0
  104. package/dist/telemetry/otel-vendor.js +7 -0
  105. package/dist/tools/index.cjs +25 -0
  106. package/dist/tools/index.d.cts +29 -0
  107. package/dist/tools/index.d.ts +29 -0
  108. package/dist/tools/index.js +1 -0
  109. package/dist/tts/index.cjs +328 -0
  110. package/dist/tts/index.d.cts +28 -0
  111. package/dist/tts/index.d.ts +28 -0
  112. package/dist/tts/index.js +1 -0
  113. package/dist/types-m9RryK9a.d.cts +14 -0
  114. package/dist/types-m9RryK9a.d.ts +14 -0
  115. package/dist/utils.cjs +179 -0
  116. package/dist/utils.d.cts +26 -0
  117. package/dist/utils.d.ts +26 -0
  118. package/dist/utils.js +1 -0
  119. package/dist/vector/index.cjs +145 -0
  120. package/dist/vector/index.d.cts +30 -0
  121. package/dist/vector/index.d.ts +30 -0
  122. package/dist/vector/index.js +1 -0
  123. package/dist/vector/libsql/index.cjs +951 -0
  124. package/dist/vector/libsql/index.d.cts +29 -0
  125. package/dist/vector/libsql/index.d.ts +29 -0
  126. package/dist/vector/libsql/index.js +1 -0
  127. package/dist/voice/index.cjs +369 -0
  128. package/dist/voice/index.d.cts +67 -0
  129. package/dist/voice/index.d.ts +67 -0
  130. package/dist/voice/index.js +76 -0
  131. package/dist/workflow-DqQ4pON_.d.cts +84 -0
  132. package/dist/workflow-Ng_F_Zaf.d.ts +84 -0
  133. package/dist/workflows/index.cjs +1628 -0
  134. package/dist/workflows/index.d.cts +48 -0
  135. package/dist/workflows/index.d.ts +48 -0
  136. package/dist/workflows/index.js +1 -0
  137. package/package.json +162 -0
@@ -0,0 +1,15 @@
1
+ import 'ai';
2
+ import 'json-schema';
3
+ import 'zod';
4
+ export { A as Agent } from '../base-nhesrHv3.cjs';
5
+ import '../base-hs9NDAZ2.cjs';
6
+ import '../types-m9RryK9a.cjs';
7
+ import '../voice/index.cjs';
8
+ import 'sift';
9
+ import '../vector/index.cjs';
10
+ import '@opentelemetry/api';
11
+ import '../index-mKY1XrpK.cjs';
12
+ import 'stream';
13
+ import 'pino';
14
+ import '@opentelemetry/sdk-trace-base';
15
+ import '../tts/index.cjs';
@@ -0,0 +1,15 @@
1
+ import 'ai';
2
+ import 'json-schema';
3
+ import 'zod';
4
+ export { A as Agent } from '../base-nKCMCNrM.js';
5
+ import '../base-D90KQ4XI.js';
6
+ import '../types-m9RryK9a.js';
7
+ import '../voice/index.js';
8
+ import 'sift';
9
+ import '../vector/index.js';
10
+ import '@opentelemetry/api';
11
+ import '../index-mKY1XrpK.js';
12
+ import 'stream';
13
+ import 'pino';
14
+ import '@opentelemetry/sdk-trace-base';
15
+ import '../tts/index.js';
@@ -0,0 +1 @@
1
+ export { Agent } from '../chunk-SY5244IR.js';
@@ -0,0 +1,139 @@
1
+ import * as _opentelemetry_api from '@opentelemetry/api';
2
+ import { Tracer, Span } from '@opentelemetry/api';
3
+ import { R as RegisteredLogger, L as Logger } from './index-mKY1XrpK.js';
4
+ import { SpanExporter } from '@opentelemetry/sdk-trace-base';
5
+
6
+ /** Sampling strategy configuration for OpenTelemetry */
7
+ type SamplingStrategy = {
8
+ /** Sample traces based on a probability between 0 and 1 */
9
+ type: 'ratio';
10
+ /** Probability between 0 and 1 (e.g., 0.1 for 10% sampling) */
11
+ probability: number;
12
+ } | {
13
+ /** Sample all traces */
14
+ type: 'always_on';
15
+ } | {
16
+ /** Don't sample any traces */
17
+ type: 'always_off';
18
+ } | {
19
+ /** Use parent sampling decision if available, otherwise use root sampler */
20
+ type: 'parent_based';
21
+ /** Configuration for the root sampler when no parent context exists */
22
+ root: {
23
+ /** Probability between 0 and 1 for the root sampler */
24
+ probability: number;
25
+ };
26
+ };
27
+ /** Configuration options for OpenTelemetry */
28
+ type OtelConfig = {
29
+ /** Name of the service for telemetry identification */
30
+ serviceName?: string;
31
+ /** Whether telemetry is enabled. Defaults to true */
32
+ enabled?: boolean;
33
+ /** Name of the tracer to use. Defaults to 'mastra-tracer' */
34
+ tracerName?: string;
35
+ /** Sampling configuration to control trace data volume */
36
+ sampling?: SamplingStrategy;
37
+ /** Export configuration for sending telemetry data */
38
+ export?: {
39
+ /** Export to an OTLP (OpenTelemetry Protocol) endpoint */
40
+ type: 'otlp';
41
+ /** OTLP endpoint URL */
42
+ endpoint?: string;
43
+ /** Optional headers for OTLP requests */
44
+ headers?: Record<string, string>;
45
+ } | {
46
+ /** Export to console for development/debugging */
47
+ type: 'console';
48
+ } | {
49
+ type: 'custom';
50
+ tracerName?: string;
51
+ exporter: SpanExporter;
52
+ };
53
+ };
54
+
55
+ declare global {
56
+ var __TELEMETRY__: Telemetry | undefined;
57
+ }
58
+ declare class Telemetry {
59
+ tracer: Tracer;
60
+ name: string;
61
+ private constructor();
62
+ /**
63
+ * @deprecated This method does not do anything
64
+ */
65
+ shutdown(): Promise<void>;
66
+ /**
67
+ * Initialize telemetry with the given configuration
68
+ * @param config - Optional telemetry configuration object
69
+ * @returns Telemetry instance that can be used for tracing
70
+ */
71
+ static init(config?: OtelConfig): Telemetry;
72
+ /**
73
+ * Get the global telemetry instance
74
+ * @throws {Error} If telemetry has not been initialized
75
+ * @returns {Telemetry} The global telemetry instance
76
+ */
77
+ static get(): Telemetry;
78
+ /**
79
+ * Wraps a class instance with telemetry tracing
80
+ * @param instance The class instance to wrap
81
+ * @param options Optional configuration for tracing
82
+ * @returns Wrapped instance with all methods traced
83
+ */
84
+ traceClass<T extends object>(instance: T, options?: {
85
+ /** Base name for spans (e.g. 'integration', 'agent') */
86
+ spanNamePrefix?: string;
87
+ /** Additional attributes to add to all spans */
88
+ attributes?: Record<string, string>;
89
+ /** Methods to exclude from tracing */
90
+ excludeMethods?: string[];
91
+ /** Skip tracing if telemetry is not active */
92
+ skipIfNoTelemetry?: boolean;
93
+ }): T;
94
+ /**
95
+ * method to trace individual methods with proper context
96
+ * @param method The method to trace
97
+ * @param context Additional context for the trace
98
+ * @returns Wrapped method with tracing
99
+ */
100
+ traceMethod<TMethod extends Function>(method: TMethod, context: {
101
+ spanName: string;
102
+ attributes?: Record<string, string>;
103
+ skipIfNoTelemetry?: boolean;
104
+ parentSpan?: Span;
105
+ }): TMethod;
106
+ getBaggageTracer(): Tracer;
107
+ }
108
+
109
+ declare class MastraBase {
110
+ component: RegisteredLogger;
111
+ protected logger: Logger;
112
+ name?: string;
113
+ telemetry?: Telemetry;
114
+ constructor({ component, name }: {
115
+ component?: RegisteredLogger;
116
+ name?: string;
117
+ });
118
+ /**
119
+ * Set the logger for the agent
120
+ * @param logger
121
+ */
122
+ __setLogger(logger: Logger): void;
123
+ /**
124
+ * Set the telemetry for the
125
+ * @param telemetry
126
+ */
127
+ __setTelemetry(telemetry: Telemetry): void;
128
+ /**
129
+ * Get the telemetry on the vector
130
+ * @returns telemetry
131
+ */
132
+ __getTelemetry(): Telemetry | undefined;
133
+ get experimental_telemetry(): {
134
+ tracer: _opentelemetry_api.Tracer;
135
+ isEnabled: boolean;
136
+ } | undefined;
137
+ }
138
+
139
+ export { MastraBase as M, type OtelConfig as O, type SamplingStrategy as S, Telemetry as T };
@@ -0,0 +1,139 @@
1
+ import * as _opentelemetry_api from '@opentelemetry/api';
2
+ import { Tracer, Span } from '@opentelemetry/api';
3
+ import { R as RegisteredLogger, L as Logger } from './index-mKY1XrpK.cjs';
4
+ import { SpanExporter } from '@opentelemetry/sdk-trace-base';
5
+
6
+ /** Sampling strategy configuration for OpenTelemetry */
7
+ type SamplingStrategy = {
8
+ /** Sample traces based on a probability between 0 and 1 */
9
+ type: 'ratio';
10
+ /** Probability between 0 and 1 (e.g., 0.1 for 10% sampling) */
11
+ probability: number;
12
+ } | {
13
+ /** Sample all traces */
14
+ type: 'always_on';
15
+ } | {
16
+ /** Don't sample any traces */
17
+ type: 'always_off';
18
+ } | {
19
+ /** Use parent sampling decision if available, otherwise use root sampler */
20
+ type: 'parent_based';
21
+ /** Configuration for the root sampler when no parent context exists */
22
+ root: {
23
+ /** Probability between 0 and 1 for the root sampler */
24
+ probability: number;
25
+ };
26
+ };
27
+ /** Configuration options for OpenTelemetry */
28
+ type OtelConfig = {
29
+ /** Name of the service for telemetry identification */
30
+ serviceName?: string;
31
+ /** Whether telemetry is enabled. Defaults to true */
32
+ enabled?: boolean;
33
+ /** Name of the tracer to use. Defaults to 'mastra-tracer' */
34
+ tracerName?: string;
35
+ /** Sampling configuration to control trace data volume */
36
+ sampling?: SamplingStrategy;
37
+ /** Export configuration for sending telemetry data */
38
+ export?: {
39
+ /** Export to an OTLP (OpenTelemetry Protocol) endpoint */
40
+ type: 'otlp';
41
+ /** OTLP endpoint URL */
42
+ endpoint?: string;
43
+ /** Optional headers for OTLP requests */
44
+ headers?: Record<string, string>;
45
+ } | {
46
+ /** Export to console for development/debugging */
47
+ type: 'console';
48
+ } | {
49
+ type: 'custom';
50
+ tracerName?: string;
51
+ exporter: SpanExporter;
52
+ };
53
+ };
54
+
55
+ declare global {
56
+ var __TELEMETRY__: Telemetry | undefined;
57
+ }
58
+ declare class Telemetry {
59
+ tracer: Tracer;
60
+ name: string;
61
+ private constructor();
62
+ /**
63
+ * @deprecated This method does not do anything
64
+ */
65
+ shutdown(): Promise<void>;
66
+ /**
67
+ * Initialize telemetry with the given configuration
68
+ * @param config - Optional telemetry configuration object
69
+ * @returns Telemetry instance that can be used for tracing
70
+ */
71
+ static init(config?: OtelConfig): Telemetry;
72
+ /**
73
+ * Get the global telemetry instance
74
+ * @throws {Error} If telemetry has not been initialized
75
+ * @returns {Telemetry} The global telemetry instance
76
+ */
77
+ static get(): Telemetry;
78
+ /**
79
+ * Wraps a class instance with telemetry tracing
80
+ * @param instance The class instance to wrap
81
+ * @param options Optional configuration for tracing
82
+ * @returns Wrapped instance with all methods traced
83
+ */
84
+ traceClass<T extends object>(instance: T, options?: {
85
+ /** Base name for spans (e.g. 'integration', 'agent') */
86
+ spanNamePrefix?: string;
87
+ /** Additional attributes to add to all spans */
88
+ attributes?: Record<string, string>;
89
+ /** Methods to exclude from tracing */
90
+ excludeMethods?: string[];
91
+ /** Skip tracing if telemetry is not active */
92
+ skipIfNoTelemetry?: boolean;
93
+ }): T;
94
+ /**
95
+ * method to trace individual methods with proper context
96
+ * @param method The method to trace
97
+ * @param context Additional context for the trace
98
+ * @returns Wrapped method with tracing
99
+ */
100
+ traceMethod<TMethod extends Function>(method: TMethod, context: {
101
+ spanName: string;
102
+ attributes?: Record<string, string>;
103
+ skipIfNoTelemetry?: boolean;
104
+ parentSpan?: Span;
105
+ }): TMethod;
106
+ getBaggageTracer(): Tracer;
107
+ }
108
+
109
+ declare class MastraBase {
110
+ component: RegisteredLogger;
111
+ protected logger: Logger;
112
+ name?: string;
113
+ telemetry?: Telemetry;
114
+ constructor({ component, name }: {
115
+ component?: RegisteredLogger;
116
+ name?: string;
117
+ });
118
+ /**
119
+ * Set the logger for the agent
120
+ * @param logger
121
+ */
122
+ __setLogger(logger: Logger): void;
123
+ /**
124
+ * Set the telemetry for the
125
+ * @param telemetry
126
+ */
127
+ __setTelemetry(telemetry: Telemetry): void;
128
+ /**
129
+ * Get the telemetry on the vector
130
+ * @returns telemetry
131
+ */
132
+ __getTelemetry(): Telemetry | undefined;
133
+ get experimental_telemetry(): {
134
+ tracer: _opentelemetry_api.Tracer;
135
+ isEnabled: boolean;
136
+ } | undefined;
137
+ }
138
+
139
+ export { MastraBase as M, type OtelConfig as O, type SamplingStrategy as S, Telemetry as T };