@mastra/auth-supabase 1.1.3 → 1.1.4-alpha.1

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.
package/LICENSE.md CHANGED
@@ -1,10 +1,12 @@
1
1
  Portions of this software are licensed as follows:
2
2
 
3
- - All content that resides under any directory named "ee/" within this
3
+ - All content that resides under any directory named `ee/` within this
4
4
  repository, including but not limited to:
5
- - `packages/core/src/auth/ee/`
6
- - `packages/server/src/server/auth/ee/`
7
- is licensed under the license defined in `ee/LICENSE`.
5
+ - `@mastra/core/auth/ee`
6
+ - `@mastra/core/agent-builder/ee`
7
+ - `@mastra/editor/ee`
8
+
9
+ is licensed under the license defined in [`ee/LICENSE`](https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE).
8
10
 
9
11
  - All third-party components incorporated into the Mastra Software are
10
12
  licensed under the original license provided by the owner of the
package/README.md CHANGED
@@ -1,76 +1,40 @@
1
1
  # @mastra/auth-supabase
2
2
 
3
- A Supabase authentication integration for Mastra, providing seamless authentication and authorization capabilities using Supabase's authentication system.
4
-
5
- ## Requirements
6
-
7
- - Node.js 22.13.0 or later
8
- - Supabase project with authentication enabled
9
- - Supabase URL and anonymous key
3
+ `@mastra/auth-supabase` verifies Supabase access tokens and exposes Supabase users to Mastra's authorization layer. Use it when Supabase Auth already manages your application users and you want the same sessions to protect Mastra endpoints.
10
4
 
11
5
  ## Installation
12
6
 
13
7
  ```bash
14
8
  npm install @mastra/auth-supabase
15
- # or
16
- yarn add @mastra/auth-supabase
17
- # or
18
- pnpm add @mastra/auth-supabase
19
9
  ```
20
10
 
21
11
  ## Usage
22
12
 
13
+ Set `SUPABASE_URL` and `SUPABASE_ANON_KEY` before starting Mastra.
14
+
23
15
  ```typescript
24
16
  import { Mastra } from '@mastra/core/mastra';
25
17
  import { MastraAuthSupabase } from '@mastra/auth-supabase';
26
18
 
27
- // Initialize with environment variables
28
- const supabaseAuth = new MastraAuthSupabase();
29
-
30
- // Or initialize with explicit configuration
31
- const supabaseAuth = new MastraAuthSupabase({
32
- url: 'your-supabase-url',
33
- anonKey: 'your-supabase-anon-key',
34
- });
35
-
36
- // Enable auth in Mastra
37
- const mastra = new Mastra({
38
- ...
19
+ export const mastra = new Mastra({
39
20
  server: {
40
- auth: supabaseAuth,
21
+ auth: new MastraAuthSupabase({
22
+ url: process.env.SUPABASE_URL,
23
+ anonKey: process.env.SUPABASE_ANON_KEY,
24
+ }),
41
25
  },
42
26
  });
43
27
  ```
44
28
 
45
- ## Configuration
46
-
47
- The package can be configured in two ways:
48
-
49
- 1. **Environment Variables**:
50
- - `SUPABASE_URL`: Your Supabase project URL
51
- - `SUPABASE_ANON_KEY`: Your Supabase anonymous key
52
-
53
- 2. **Constructor Options**:
54
- ```typescript
55
- interface MastraAuthSupabaseOptions {
56
- url?: string;
57
- anonKey?: string;
58
- }
59
- ```
60
-
61
- ## Features
62
-
63
- - **Authentication**: Verifies user tokens and retrieves user information from Supabase
64
- - **Authorization**: Checks user permissions based on their role in Supabase
65
- - **Type Safety**: Full TypeScript support with proper type definitions
66
- - **Environment Variable Support**: Easy configuration through environment variables
29
+ ## Documentation
67
30
 
68
- ## API
31
+ - [Supabase integration guide](https://mastra.ai/integrations/auth/supabase)
32
+ - [Supabase provider reference](https://mastra.ai/reference/auth/supabase)
69
33
 
70
- ### `authenticateToken(token: string)`
34
+ ## Changelog
71
35
 
72
- Authenticates a user token and returns the user information if valid.
36
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/auth/supabase/CHANGELOG.md) for version history and release notes.
73
37
 
74
- ### `authorizeUser(user: User)`
38
+ ## Support
75
39
 
76
- Checks if a user has the required permissions (currently checks for admin status).
40
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
@@ -1,4 +1,4 @@
1
- import { i as IMastraLogger, u as RegisteredLogger } from "../index-S1lgaKO7.js";
1
+ import { i as IMastraLogger, u as RegisteredLogger } from "../index-Biaf3BmX.js";
2
2
  //#region src/base/MastraBase.d.ts
3
3
  declare class MastraBase {
4
4
  #private;
@@ -0,0 +1,319 @@
1
+ import { Transform } from "stream";
2
+ //#region src/logger/adapter.d.ts
3
+ /**
4
+ * OpenTelemetry-compatible trace correlation fields, injected at the top
5
+ * level of a logger's native record.
6
+ *
7
+ * Field names are part of the platform contract (snake_case, W3C formats):
8
+ * external consumers (e.g. the Studio logs view reading Railway stdout)
9
+ * parse structured log lines and look for exactly these keys.
10
+ */
11
+ interface TraceFields {
12
+ /** 32-char lowercase hex W3C trace id */
13
+ trace_id: string;
14
+ /**
15
+ * 16-char lowercase hex W3C span id.
16
+ *
17
+ * Optional, and omitted rather than emitted empty: the active span may be
18
+ * one observability never exports (an internal span, or one dropped by
19
+ * `excludeSpanTypes`), leaving no span id a consumer could look up. The
20
+ * trace is still addressable in that case, so the line keeps `trace_id` and
21
+ * drops only this field. Consumers must treat `span_id` as possibly absent.
22
+ */
23
+ span_id?: string;
24
+ }
25
+ /**
26
+ * Destination for log records derived from the logger's native record,
27
+ * exported to Mastra observability. Structurally compatible with
28
+ * `LoggerContext` from `@mastra/core/observability`.
29
+ */
30
+ interface AdapterLogSink {
31
+ debug(message: string, data?: Record<string, unknown>): void;
32
+ info(message: string, data?: Record<string, unknown>): void;
33
+ warn(message: string, data?: Record<string, unknown>): void;
34
+ error(message: string, data?: Record<string, unknown>): void;
35
+ }
36
+ interface LoggerAdapterOptions {
37
+ /** Inject trace_id/span_id into the logger's native records. */
38
+ correlation: boolean;
39
+ /** Export records derived from the native record to Mastra observability. */
40
+ export: boolean;
41
+ }
42
+ /**
43
+ * Context handed to an adaptable logger by Mastra when observability is
44
+ * wired up. All members are safe to call on every log call (synchronous,
45
+ * never throw).
46
+ */
47
+ interface LoggerAdapterContext {
48
+ /**
49
+ * Resolve correlation fields for the currently active span, or undefined
50
+ * when no span is active (in which case no trace fields are added).
51
+ */
52
+ resolveTraceFields: () => TraceFields | undefined;
53
+ /**
54
+ * Resolve the observability log sink at call time. Returns the
55
+ * span-correlated sink when a span is active, the global sink otherwise,
56
+ * and undefined when export is disabled or observability is not
57
+ * initialized. Records must still be written to the native destination
58
+ * regardless.
59
+ */
60
+ getLogSink: () => AdapterLogSink | undefined;
61
+ options: LoggerAdapterOptions;
62
+ }
63
+ /**
64
+ * Capability marker a logger implements to opt into native trace
65
+ * correlation and observability export. When a configured logger implements
66
+ * this, Mastra attaches observability directly instead of wrapping the
67
+ * logger in the deprecated `DualLogger`.
68
+ */
69
+ interface AdaptableLogger extends IMastraLogger {
70
+ __attachObservability(ctx: LoggerAdapterContext): void;
71
+ /**
72
+ * Stable identity for the attachment target. Loggers whose adapter context
73
+ * lives in state shared across a root/child family (e.g. PinoLogger's
74
+ * mixin ref cell) return that shared object, so attaching any family
75
+ * member is recognized as re-attaching the whole family. Defaults to the
76
+ * logger instance itself when absent.
77
+ */
78
+ __observabilityAttachmentKey?(): object;
79
+ }
80
+ declare function isAdaptableLogger(logger: IMastraLogger): logger is AdaptableLogger;
81
+ /**
82
+ * Export a tracked exception through the adapter sink, mirroring the
83
+ * DualLogger dual-write shape (`errorId`/`domain`/`category`/`details`/`cause`
84
+ * when present on a MastraError-like value). Never throws into the caller.
85
+ */
86
+ declare function exportTrackedException(ctx: LoggerAdapterContext | undefined, error: Error, metadata?: Record<string, unknown>): void;
87
+ /**
88
+ * Adapt IMastraLogger's variadic args into the structured `data` payload of
89
+ * an exported log record. Extracts the first plain object as data,
90
+ * serializes an Error arg, and collects remaining primitives under `args`
91
+ * so the derived record preserves all context from the native call.
92
+ */
93
+ declare function buildLogRecordData(args: unknown[]): Record<string, unknown> | undefined;
94
+ //#endregion
95
+ //#region src/logger/index.d.ts
96
+ declare const RegisteredLogger: {
97
+ readonly AGENT: 'AGENT';
98
+ readonly OBSERVABILITY: 'OBSERVABILITY';
99
+ readonly AUTH: 'AUTH';
100
+ readonly BROWSER: 'BROWSER';
101
+ readonly NETWORK: 'NETWORK';
102
+ readonly WORKFLOW: 'WORKFLOW';
103
+ readonly LLM: 'LLM';
104
+ readonly TTS: 'TTS';
105
+ readonly VOICE: 'VOICE';
106
+ readonly VECTOR: 'VECTOR';
107
+ readonly BUNDLER: 'BUNDLER';
108
+ readonly DEPLOYER: 'DEPLOYER';
109
+ readonly MEMORY: 'MEMORY';
110
+ readonly STORAGE: 'STORAGE';
111
+ readonly EMBEDDINGS: 'EMBEDDINGS';
112
+ readonly MCP_SERVER: 'MCP_SERVER';
113
+ readonly SERVER_CACHE: 'SERVER_CACHE';
114
+ readonly SERVER: 'SERVER';
115
+ readonly WORKSPACE: 'WORKSPACE';
116
+ readonly CHANNEL: 'CHANNEL';
117
+ };
118
+ type RegisteredLogger = (typeof RegisteredLogger)[keyof typeof RegisteredLogger];
119
+ declare const LogLevel: {
120
+ readonly DEBUG: 'debug';
121
+ readonly INFO: 'info';
122
+ readonly WARN: 'warn';
123
+ readonly ERROR: 'error';
124
+ readonly NONE: 'silent';
125
+ };
126
+ type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
127
+ interface BaseLogMessage {
128
+ runId?: string;
129
+ msg: string;
130
+ level: LogLevel;
131
+ time: Date;
132
+ pid: number;
133
+ hostname: string;
134
+ name: string;
135
+ }
136
+ declare abstract class LoggerTransport extends Transform {
137
+ constructor(opts?: any);
138
+ listLogsByRunId(_args: {
139
+ runId: string;
140
+ fromDate?: Date;
141
+ toDate?: Date;
142
+ logLevel?: LogLevel;
143
+ filters?: Record<string, any>;
144
+ page?: number;
145
+ perPage?: number;
146
+ }): Promise<{
147
+ logs: BaseLogMessage[];
148
+ total: number;
149
+ page: number;
150
+ perPage: number;
151
+ hasMore: boolean;
152
+ }>;
153
+ listLogs(_args?: {
154
+ fromDate?: Date;
155
+ toDate?: Date;
156
+ logLevel?: LogLevel;
157
+ filters?: Record<string, any>;
158
+ returnPaginationResults?: boolean;
159
+ page?: number;
160
+ perPage?: number;
161
+ }): Promise<{
162
+ logs: BaseLogMessage[];
163
+ total: number;
164
+ page: number;
165
+ perPage: number;
166
+ hasMore: boolean;
167
+ }>;
168
+ }
169
+ declare const createCustomTransport: (stream: Transform, listLogs?: LoggerTransport['listLogs'], listLogsByRunId?: LoggerTransport['listLogsByRunId']) => LoggerTransport;
170
+ interface IMastraLogger {
171
+ debug(message: string, ...args: any[]): void;
172
+ info(message: string, ...args: any[]): void;
173
+ warn(message: string, ...args: any[]): void;
174
+ error(message: string, ...args: any[]): void;
175
+ trackException(error: Error, metadata?: Record<string, unknown>): void;
176
+ getTransports(): Map<string, LoggerTransport>;
177
+ listLogs(_transportId: string, _params?: {
178
+ fromDate?: Date;
179
+ toDate?: Date;
180
+ logLevel?: LogLevel;
181
+ filters?: Record<string, any>;
182
+ page?: number;
183
+ perPage?: number;
184
+ }): Promise<{
185
+ logs: BaseLogMessage[];
186
+ total: number;
187
+ page: number;
188
+ perPage: number;
189
+ hasMore: boolean;
190
+ }>;
191
+ listLogsByRunId(_args: {
192
+ transportId: string;
193
+ runId: string;
194
+ fromDate?: Date;
195
+ toDate?: Date;
196
+ logLevel?: LogLevel;
197
+ filters?: Record<string, any>;
198
+ page?: number;
199
+ perPage?: number;
200
+ }): Promise<{
201
+ logs: BaseLogMessage[];
202
+ total: number;
203
+ page: number;
204
+ perPage: number;
205
+ hasMore: boolean;
206
+ }>;
207
+ }
208
+ declare abstract class MastraLogger implements IMastraLogger {
209
+ protected name: string;
210
+ protected level: LogLevel;
211
+ protected transports: Map<string, LoggerTransport>;
212
+ constructor(options?: {
213
+ name?: string;
214
+ level?: LogLevel;
215
+ transports?: Record<string, LoggerTransport>;
216
+ });
217
+ abstract debug(message: string, ...args: any[]): void;
218
+ abstract info(message: string, ...args: any[]): void;
219
+ abstract warn(message: string, ...args: any[]): void;
220
+ abstract error(message: string, ...args: any[]): void;
221
+ getTransports(): Map<string, LoggerTransport>;
222
+ trackException(_error: Error, _metadata?: Record<string, unknown>): void;
223
+ listLogs(transportId: string, params?: {
224
+ fromDate?: Date;
225
+ toDate?: Date;
226
+ logLevel?: LogLevel;
227
+ filters?: Record<string, any>;
228
+ page?: number;
229
+ perPage?: number;
230
+ }): Promise<{
231
+ logs: BaseLogMessage[];
232
+ total: number;
233
+ page: number;
234
+ perPage: number;
235
+ hasMore: boolean;
236
+ }>;
237
+ listLogsByRunId({ transportId, runId, fromDate, toDate, logLevel, filters, page, perPage }: {
238
+ transportId: string;
239
+ runId: string;
240
+ fromDate?: Date;
241
+ toDate?: Date;
242
+ logLevel?: LogLevel;
243
+ filters?: Record<string, any>;
244
+ page?: number;
245
+ perPage?: number;
246
+ }): Promise<{
247
+ logs: BaseLogMessage[];
248
+ total: number;
249
+ page: number;
250
+ perPage: number;
251
+ hasMore: boolean;
252
+ }>;
253
+ }
254
+ type LogFilterContext = {
255
+ component?: RegisteredLogger;
256
+ level: LogLevel;
257
+ message: string;
258
+ args: unknown[];
259
+ };
260
+ type LogFilter = (ctx: LogFilterContext) => boolean;
261
+ interface ConsoleLoggerOptions {
262
+ name?: string;
263
+ level?: LogLevel;
264
+ component?: RegisteredLogger;
265
+ filter?: LogFilter;
266
+ }
267
+ declare class ConsoleLogger extends MastraLogger {
268
+ #private;
269
+ protected component?: RegisteredLogger;
270
+ protected filter?: LogFilter;
271
+ constructor(options?: ConsoleLoggerOptions);
272
+ /**
273
+ * Adapter hook (see `AdaptableLogger`): enables native trace correlation
274
+ * (trace_id/span_id appended to console output) and observability export
275
+ * derived from the same record. Called by Mastra during setup.
276
+ */
277
+ __attachObservability(ctx: LoggerAdapterContext): void;
278
+ child(componentOrBindings: RegisteredLogger | Record<string, unknown>): ConsoleLogger;
279
+ private shouldLog;
280
+ private prefix;
281
+ debug(message: string, ...args: any[]): void;
282
+ info(message: string, ...args: any[]): void;
283
+ warn(message: string, ...args: any[]): void;
284
+ error(message: string, ...args: any[]): void;
285
+ trackException(error: Error, metadata?: Record<string, unknown>): void;
286
+ listLogs(_transportId: string, _params?: {
287
+ fromDate?: Date;
288
+ toDate?: Date;
289
+ logLevel?: LogLevel;
290
+ filters?: Record<string, any>;
291
+ page?: number;
292
+ perPage?: number;
293
+ }): Promise<{
294
+ logs: never[];
295
+ total: number;
296
+ page: number;
297
+ perPage: number;
298
+ hasMore: boolean;
299
+ }>;
300
+ listLogsByRunId(_args: {
301
+ transportId: string;
302
+ runId: string;
303
+ fromDate?: Date;
304
+ toDate?: Date;
305
+ logLevel?: LogLevel;
306
+ filters?: Record<string, any>;
307
+ page?: number;
308
+ perPage?: number;
309
+ }): Promise<{
310
+ logs: never[];
311
+ total: number;
312
+ page: number;
313
+ perPage: number;
314
+ hasMore: boolean;
315
+ }>;
316
+ }
317
+ //#endregion
318
+ export { buildLogRecordData as _, LogFilter as a, LoggerTransport as c, createCustomTransport as d, AdaptableLogger as f, TraceFields as g, LoggerAdapterOptions as h, IMastraLogger as i, MastraLogger as l, LoggerAdapterContext as m, ConsoleLogger as n, LogFilterContext as o, AdapterLogSink as p, ConsoleLoggerOptions as r, LogLevel as s, BaseLogMessage as t, RegisteredLogger as u, exportTrackedException as v, isAdaptableLogger as y };
319
+ //# sourceMappingURL=index-Biaf3BmX.d.ts.map
@@ -1,7 +1,7 @@
1
1
  export interface HonoRequestLike {
2
2
  raw?: Request;
3
- headers?: Headers;
4
- header(name: string): string | undefined;
3
+ headers?: Headers | Record<string, string | string[] | undefined>;
4
+ header?(name: string): string | undefined;
5
5
  }
6
6
  export type MastraAuthRequest = Request | HonoRequestLike;
7
7
  export type AuthenticateTokenFn<TUser, TResult = Promise<TUser | null>> = {
@@ -10,6 +10,10 @@ export type AuthenticateTokenFn<TUser, TResult = Promise<TUser | null>> = {
10
10
  export type AuthorizeUserFn<TUser, TResult = Promise<boolean> | boolean> = {
11
11
  bivarianceHack(user: TUser, request: MastraAuthRequest): TResult;
12
12
  }['bivarianceHack'];
13
+ /**
14
+ * Read a request header across fetch, Hono, and Express-style request shapes.
15
+ * Must not throw when `headers` is a plain object (Express `IncomingHttpHeaders`).
16
+ */
13
17
  export declare function getRequestHeader(request: MastraAuthRequest, name: string): string | null;
14
18
  export declare function getWebRequest(request: MastraAuthRequest): Request | undefined;
15
19
  export type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'ALL';
package/dist/index.cjs CHANGED
@@ -1,6 +1,46 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _supabase_supabase_js = require("@supabase/supabase-js");
3
3
  //#region ../../packages/_internal-core/dist/logger/index.js
4
+ /**
5
+ * Export a tracked exception through the adapter sink, mirroring the
6
+ * DualLogger dual-write shape (`errorId`/`domain`/`category`/`details`/`cause`
7
+ * when present on a MastraError-like value). Never throws into the caller.
8
+ */
9
+ function exportTrackedException(ctx, error, metadata) {
10
+ if (!ctx?.options.export) return;
11
+ try {
12
+ const mastraError = error;
13
+ ctx.getLogSink()?.error(error.message, {
14
+ ...mastraError.id !== void 0 ? { errorId: mastraError.id } : {},
15
+ ...mastraError.domain !== void 0 ? { domain: mastraError.domain } : {},
16
+ ...mastraError.category !== void 0 ? { category: mastraError.category } : {},
17
+ ...mastraError.details !== void 0 ? { details: mastraError.details } : {},
18
+ ...error.cause instanceof Error ? { cause: error.cause.message } : {},
19
+ ...metadata
20
+ });
21
+ } catch {}
22
+ }
23
+ /**
24
+ * Adapt IMastraLogger's variadic args into the structured `data` payload of
25
+ * an exported log record. Extracts the first plain object as data,
26
+ * serializes an Error arg, and collects remaining primitives under `args`
27
+ * so the derived record preserves all context from the native call.
28
+ */
29
+ function buildLogRecordData(args) {
30
+ const objectData = args.find((arg) => arg !== null && typeof arg === "object" && !Array.isArray(arg) && !(arg instanceof Error));
31
+ const errorArg = args.find((arg) => arg instanceof Error);
32
+ const extraArgs = args.filter((arg) => arg !== objectData && arg !== errorArg);
33
+ if (!objectData && !errorArg && extraArgs.length === 0) return void 0;
34
+ return {
35
+ ...objectData ?? {},
36
+ ...errorArg ? { error: {
37
+ name: errorArg.name,
38
+ message: errorArg.message,
39
+ stack: errorArg.stack
40
+ } } : {},
41
+ ...extraArgs.length > 0 ? { args: extraArgs } : {}
42
+ };
43
+ }
4
44
  const RegisteredLogger = {
5
45
  AGENT: "AGENT",
6
46
  OBSERVABILITY: "OBSERVABILITY",
@@ -87,19 +127,56 @@ var MastraLogger = class {
87
127
  var ConsoleLogger = class ConsoleLogger extends MastraLogger {
88
128
  component;
89
129
  filter;
130
+ #adapterContext;
90
131
  constructor(options = {}) {
91
132
  super(options);
92
133
  this.component = options.component;
93
134
  this.filter = options.filter;
94
135
  }
136
+ /**
137
+ * Adapter hook (see `AdaptableLogger`): enables native trace correlation
138
+ * (trace_id/span_id appended to console output) and observability export
139
+ * derived from the same record. Called by Mastra during setup.
140
+ */
141
+ __attachObservability(ctx) {
142
+ this.#adapterContext = ctx;
143
+ }
95
144
  child(componentOrBindings) {
96
145
  const component = typeof componentOrBindings === "string" ? componentOrBindings : componentOrBindings?.component ?? this.component;
97
- return new ConsoleLogger({
146
+ const child = new ConsoleLogger({
98
147
  name: this.name,
99
148
  level: this.level,
100
149
  component,
101
150
  filter: this.filter
102
151
  });
152
+ if (this.#adapterContext) child.__attachObservability(this.#adapterContext);
153
+ return child;
154
+ }
155
+ /**
156
+ * Native-record correlation: when a span is active, append the trace
157
+ * fields object to the console args so every destination sees them.
158
+ */
159
+ #correlate(args) {
160
+ const ctx = this.#adapterContext;
161
+ if (!ctx?.options.correlation) return args;
162
+ try {
163
+ const fields = ctx.resolveTraceFields();
164
+ return fields ? [...args, fields] : args;
165
+ } catch {
166
+ return args;
167
+ }
168
+ }
169
+ /**
170
+ * Export the record derived from the same native call to observability.
171
+ * Mirrors DualLogger semantics: export is independent of the console
172
+ * level filter, and never throws into the caller.
173
+ */
174
+ #export(level, message, args) {
175
+ const ctx = this.#adapterContext;
176
+ if (!ctx?.options.export) return;
177
+ try {
178
+ ctx.getLogSink()?.[level](message, buildLogRecordData(args));
179
+ } catch {}
103
180
  }
104
181
  shouldLog(level, message, args) {
105
182
  if (!this.filter) return true;
@@ -119,16 +196,23 @@ var ConsoleLogger = class ConsoleLogger extends MastraLogger {
119
196
  return this.component ? `[${this.component}] ` : "";
120
197
  }
121
198
  debug(message, ...args) {
122
- if (this.level === LogLevel.DEBUG && this.shouldLog(LogLevel.DEBUG, message, args)) console.info(`${this.prefix()}${message}`, ...args);
199
+ if (this.level === LogLevel.DEBUG && this.shouldLog(LogLevel.DEBUG, message, args)) console.info(`${this.prefix()}${message}`, ...this.#correlate(args));
200
+ this.#export("debug", message, args);
123
201
  }
124
202
  info(message, ...args) {
125
- if ((this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.INFO, message, args)) console.info(`${this.prefix()}${message}`, ...args);
203
+ if ((this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.INFO, message, args)) console.info(`${this.prefix()}${message}`, ...this.#correlate(args));
204
+ this.#export("info", message, args);
126
205
  }
127
206
  warn(message, ...args) {
128
- if ((this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.WARN, message, args)) console.warn(`${this.prefix()}${message}`, ...args);
207
+ if ((this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.WARN, message, args)) console.warn(`${this.prefix()}${message}`, ...this.#correlate(args));
208
+ this.#export("warn", message, args);
129
209
  }
130
210
  error(message, ...args) {
131
- if ((this.level === LogLevel.ERROR || this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.ERROR, message, args)) console.error(`${this.prefix()}${message}`, ...args);
211
+ if ((this.level === LogLevel.ERROR || this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.ERROR, message, args)) console.error(`${this.prefix()}${message}`, ...this.#correlate(args));
212
+ this.#export("error", message, args);
213
+ }
214
+ trackException(error, metadata) {
215
+ exportTrackedException(this.#adapterContext, error, metadata);
132
216
  }
133
217
  async listLogs(_transportId, _params) {
134
218
  return {