@mettlelabs/mettle 0.0.0-beta.1 → 0.0.0-beta.1-darwin-x64
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/THIRD_PARTY_NOTICES.md +11479 -0
- package/bin/mettle +4 -0
- package/harness/audit-investigation.mjs +203 -0
- package/harness/chunk-13tgmdey.mjs +33761 -0
- package/harness/chunk-1sygmp11.mjs +18142 -0
- package/harness/chunk-1ykxpmaz.mjs +7887 -0
- package/harness/chunk-2gt4cy7x.mjs +2290 -0
- package/harness/chunk-2pm2sayw.mjs +248 -0
- package/harness/chunk-32y07kkp.mjs +3747 -0
- package/harness/chunk-3m7jn5ac.mjs +16242 -0
- package/harness/chunk-3wvjs93w.mjs +538 -0
- package/harness/chunk-4bepyxmq.mjs +113 -0
- package/harness/chunk-4jtnt9k5.mjs +95 -0
- package/harness/chunk-50sbrf09.mjs +18972 -0
- package/harness/chunk-56csr8sw.mjs +322 -0
- package/harness/chunk-5cvb1jnb.mjs +41 -0
- package/harness/chunk-5wgmv4np.mjs +585 -0
- package/harness/chunk-65eyq32y.mjs +225 -0
- package/harness/chunk-6fnh6qhk.mjs +195 -0
- package/harness/chunk-6kgqw9ny.mjs +32303 -0
- package/harness/chunk-7b242j0n.mjs +14 -0
- package/harness/chunk-7bg2gnv2.mjs +7540 -0
- package/harness/chunk-ageqxj9v.mjs +63008 -0
- package/harness/chunk-b0qbt5jd.mjs +14 -0
- package/harness/chunk-b5g1r3fz.mjs +4785 -0
- package/harness/chunk-b71gpkxg.mjs +1514 -0
- package/harness/chunk-bdv1rx4a.mjs +20364 -0
- package/harness/chunk-c1631s2x.mjs +12241 -0
- package/harness/chunk-d5xgxsnp.mjs +74 -0
- package/harness/chunk-erg1fbh0.mjs +0 -0
- package/harness/chunk-fh78v9vn.mjs +19366 -0
- package/harness/chunk-fjx29qvp.mjs +50 -0
- package/harness/chunk-gryka6kg.mjs +39 -0
- package/harness/chunk-jb0r19et.mjs +180 -0
- package/harness/chunk-mfn574ss.mjs +179 -0
- package/harness/chunk-msg872ea.mjs +334 -0
- package/harness/chunk-nz5sv9as.mjs +1642 -0
- package/harness/chunk-p9d3cgvq.mjs +452 -0
- package/harness/chunk-pq6wvwxr.mjs +12 -0
- package/harness/chunk-qcm9arf8.mjs +7736 -0
- package/harness/chunk-qr8zfqjd.mjs +24 -0
- package/harness/chunk-rz2tz6jp.mjs +26 -0
- package/harness/chunk-sbkgc3kn.mjs +8 -0
- package/harness/chunk-v66qvpnb.mjs +169 -0
- package/harness/chunk-vjaxzab3.mjs +136 -0
- package/harness/chunk-vr1n5nza.mjs +1045 -0
- package/harness/chunk-vsf2zajv.mjs +3867 -0
- package/harness/chunk-wq253fj4.mjs +19041 -0
- package/harness/chunk-wyv7ceq4.mjs +0 -0
- package/harness/chunk-xnqknk2r.mjs +198 -0
- package/harness/chunk-xqyc4ca2.mjs +1890 -0
- package/harness/chunk-z6n9thea.mjs +45146 -0
- package/harness/chunk-zty0d3bw.mjs +0 -0
- package/harness/chunk-zvkxtj82.mjs +42 -0
- package/harness/issue-api-token.mjs +35 -0
- package/harness/launcher.mjs +159 -0
- package/harness/sandbox.mjs +132 -0
- package/harness/server.mjs +66322 -0
- package/package.json +10 -15
- package/bin/mettle.js +0 -51
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// node_modules/.bun/@mastra+core@1.71.0+95d98e20cbc6e6e1/node_modules/@mastra/core/dist/logger-DGUE8DHx.js
|
|
2
|
+
function isAdaptableLogger(logger) {
|
|
3
|
+
return typeof logger.__attachObservability === "function";
|
|
4
|
+
}
|
|
5
|
+
function exportTrackedException(ctx, error, metadata) {
|
|
6
|
+
if (!ctx?.options.export)
|
|
7
|
+
return;
|
|
8
|
+
try {
|
|
9
|
+
const mastraError = error;
|
|
10
|
+
ctx.getLogSink()?.error(error.message, {
|
|
11
|
+
...mastraError.id !== undefined ? { errorId: mastraError.id } : {},
|
|
12
|
+
...mastraError.domain !== undefined ? { domain: mastraError.domain } : {},
|
|
13
|
+
...mastraError.category !== undefined ? { category: mastraError.category } : {},
|
|
14
|
+
...mastraError.details !== undefined ? { details: mastraError.details } : {},
|
|
15
|
+
...error.cause instanceof Error ? { cause: error.cause.message } : {},
|
|
16
|
+
...metadata
|
|
17
|
+
});
|
|
18
|
+
} catch {}
|
|
19
|
+
}
|
|
20
|
+
function buildLogRecordData(args) {
|
|
21
|
+
const objectData = args.find((arg) => arg !== null && typeof arg === "object" && !Array.isArray(arg) && !(arg instanceof Error));
|
|
22
|
+
const errorArg = args.find((arg) => arg instanceof Error);
|
|
23
|
+
const extraArgs = args.filter((arg) => arg !== objectData && arg !== errorArg);
|
|
24
|
+
if (!objectData && !errorArg && extraArgs.length === 0)
|
|
25
|
+
return;
|
|
26
|
+
return {
|
|
27
|
+
...objectData ?? {},
|
|
28
|
+
...errorArg ? { error: {
|
|
29
|
+
name: errorArg.name,
|
|
30
|
+
message: errorArg.message,
|
|
31
|
+
stack: errorArg.stack
|
|
32
|
+
} } : {},
|
|
33
|
+
...extraArgs.length > 0 ? { args: extraArgs } : {}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
var RegisteredLogger = {
|
|
37
|
+
AGENT: "AGENT",
|
|
38
|
+
OBSERVABILITY: "OBSERVABILITY",
|
|
39
|
+
AUTH: "AUTH",
|
|
40
|
+
BROWSER: "BROWSER",
|
|
41
|
+
NETWORK: "NETWORK",
|
|
42
|
+
WORKFLOW: "WORKFLOW",
|
|
43
|
+
LLM: "LLM",
|
|
44
|
+
TTS: "TTS",
|
|
45
|
+
VOICE: "VOICE",
|
|
46
|
+
VECTOR: "VECTOR",
|
|
47
|
+
BUNDLER: "BUNDLER",
|
|
48
|
+
DEPLOYER: "DEPLOYER",
|
|
49
|
+
MEMORY: "MEMORY",
|
|
50
|
+
STORAGE: "STORAGE",
|
|
51
|
+
EMBEDDINGS: "EMBEDDINGS",
|
|
52
|
+
MCP_SERVER: "MCP_SERVER",
|
|
53
|
+
SERVER_CACHE: "SERVER_CACHE",
|
|
54
|
+
SERVER: "SERVER",
|
|
55
|
+
WORKSPACE: "WORKSPACE",
|
|
56
|
+
CHANNEL: "CHANNEL"
|
|
57
|
+
};
|
|
58
|
+
var LogLevel = {
|
|
59
|
+
DEBUG: "debug",
|
|
60
|
+
INFO: "info",
|
|
61
|
+
WARN: "warn",
|
|
62
|
+
ERROR: "error",
|
|
63
|
+
NONE: "silent"
|
|
64
|
+
};
|
|
65
|
+
var MastraLogger = class {
|
|
66
|
+
name;
|
|
67
|
+
level;
|
|
68
|
+
transports;
|
|
69
|
+
constructor(options = {}) {
|
|
70
|
+
this.name = options.name || "Mastra";
|
|
71
|
+
this.level = options.level || LogLevel.ERROR;
|
|
72
|
+
this.transports = new Map(Object.entries(options.transports || {}));
|
|
73
|
+
}
|
|
74
|
+
getTransports() {
|
|
75
|
+
return this.transports;
|
|
76
|
+
}
|
|
77
|
+
trackException(_error, _metadata) {}
|
|
78
|
+
async listLogs(transportId, params) {
|
|
79
|
+
if (!transportId || !this.transports.has(transportId))
|
|
80
|
+
return {
|
|
81
|
+
logs: [],
|
|
82
|
+
total: 0,
|
|
83
|
+
page: params?.page ?? 1,
|
|
84
|
+
perPage: params?.perPage ?? 100,
|
|
85
|
+
hasMore: false
|
|
86
|
+
};
|
|
87
|
+
return this.transports.get(transportId).listLogs?.(params) ?? {
|
|
88
|
+
logs: [],
|
|
89
|
+
total: 0,
|
|
90
|
+
page: params?.page ?? 1,
|
|
91
|
+
perPage: params?.perPage ?? 100,
|
|
92
|
+
hasMore: false
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async listLogsByRunId({ transportId, runId, fromDate, toDate, logLevel, filters, page, perPage }) {
|
|
96
|
+
if (!transportId || !this.transports.has(transportId) || !runId)
|
|
97
|
+
return {
|
|
98
|
+
logs: [],
|
|
99
|
+
total: 0,
|
|
100
|
+
page: page ?? 1,
|
|
101
|
+
perPage: perPage ?? 100,
|
|
102
|
+
hasMore: false
|
|
103
|
+
};
|
|
104
|
+
return this.transports.get(transportId).listLogsByRunId?.({
|
|
105
|
+
runId,
|
|
106
|
+
fromDate,
|
|
107
|
+
toDate,
|
|
108
|
+
logLevel,
|
|
109
|
+
filters,
|
|
110
|
+
page,
|
|
111
|
+
perPage
|
|
112
|
+
}) ?? {
|
|
113
|
+
logs: [],
|
|
114
|
+
total: 0,
|
|
115
|
+
page: page ?? 1,
|
|
116
|
+
perPage: perPage ?? 100,
|
|
117
|
+
hasMore: false
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var ConsoleLogger2 = class ConsoleLogger extends MastraLogger {
|
|
122
|
+
component;
|
|
123
|
+
filter;
|
|
124
|
+
#adapterContext;
|
|
125
|
+
constructor(options = {}) {
|
|
126
|
+
super(options);
|
|
127
|
+
this.component = options.component;
|
|
128
|
+
this.filter = options.filter;
|
|
129
|
+
}
|
|
130
|
+
__attachObservability(ctx) {
|
|
131
|
+
this.#adapterContext = ctx;
|
|
132
|
+
}
|
|
133
|
+
child(componentOrBindings) {
|
|
134
|
+
const component = typeof componentOrBindings === "string" ? componentOrBindings : componentOrBindings?.component ?? this.component;
|
|
135
|
+
const child = new ConsoleLogger({
|
|
136
|
+
name: this.name,
|
|
137
|
+
level: this.level,
|
|
138
|
+
component,
|
|
139
|
+
filter: this.filter
|
|
140
|
+
});
|
|
141
|
+
if (this.#adapterContext)
|
|
142
|
+
child.__attachObservability(this.#adapterContext);
|
|
143
|
+
return child;
|
|
144
|
+
}
|
|
145
|
+
#correlate(args) {
|
|
146
|
+
const ctx = this.#adapterContext;
|
|
147
|
+
if (!ctx?.options.correlation)
|
|
148
|
+
return args;
|
|
149
|
+
try {
|
|
150
|
+
const fields = ctx.resolveTraceFields();
|
|
151
|
+
return fields ? [...args, fields] : args;
|
|
152
|
+
} catch {
|
|
153
|
+
return args;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
#export(level, message, args) {
|
|
157
|
+
const ctx = this.#adapterContext;
|
|
158
|
+
if (!ctx?.options.export)
|
|
159
|
+
return;
|
|
160
|
+
try {
|
|
161
|
+
ctx.getLogSink()?.[level](message, buildLogRecordData(args));
|
|
162
|
+
} catch {}
|
|
163
|
+
}
|
|
164
|
+
shouldLog(level, message, args) {
|
|
165
|
+
if (!this.filter)
|
|
166
|
+
return true;
|
|
167
|
+
try {
|
|
168
|
+
return this.filter({
|
|
169
|
+
component: this.component,
|
|
170
|
+
level,
|
|
171
|
+
message,
|
|
172
|
+
args
|
|
173
|
+
});
|
|
174
|
+
} catch (e) {
|
|
175
|
+
console.error(`[Logger] Filter error for component=${this.component} level=${level}:`, e);
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
prefix() {
|
|
180
|
+
return this.component ? `[${this.component}] ` : "";
|
|
181
|
+
}
|
|
182
|
+
debug(message, ...args) {
|
|
183
|
+
if (this.level === LogLevel.DEBUG && this.shouldLog(LogLevel.DEBUG, message, args))
|
|
184
|
+
console.info(`${this.prefix()}${message}`, ...this.#correlate(args));
|
|
185
|
+
this.#export("debug", message, args);
|
|
186
|
+
}
|
|
187
|
+
info(message, ...args) {
|
|
188
|
+
if ((this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.INFO, message, args))
|
|
189
|
+
console.info(`${this.prefix()}${message}`, ...this.#correlate(args));
|
|
190
|
+
this.#export("info", message, args);
|
|
191
|
+
}
|
|
192
|
+
warn(message, ...args) {
|
|
193
|
+
if ((this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.WARN, message, args))
|
|
194
|
+
console.warn(`${this.prefix()}${message}`, ...this.#correlate(args));
|
|
195
|
+
this.#export("warn", message, args);
|
|
196
|
+
}
|
|
197
|
+
error(message, ...args) {
|
|
198
|
+
if ((this.level === LogLevel.ERROR || this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.ERROR, message, args))
|
|
199
|
+
console.error(`${this.prefix()}${message}`, ...this.#correlate(args));
|
|
200
|
+
this.#export("error", message, args);
|
|
201
|
+
}
|
|
202
|
+
trackException(error, metadata) {
|
|
203
|
+
exportTrackedException(this.#adapterContext, error, metadata);
|
|
204
|
+
}
|
|
205
|
+
async listLogs(_transportId, _params) {
|
|
206
|
+
return {
|
|
207
|
+
logs: [],
|
|
208
|
+
total: 0,
|
|
209
|
+
page: _params?.page ?? 1,
|
|
210
|
+
perPage: _params?.perPage ?? 100,
|
|
211
|
+
hasMore: false
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
async listLogsByRunId(_args) {
|
|
215
|
+
return {
|
|
216
|
+
logs: [],
|
|
217
|
+
total: 0,
|
|
218
|
+
page: _args.page ?? 1,
|
|
219
|
+
perPage: _args.perPage ?? 100,
|
|
220
|
+
hasMore: false
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// node_modules/.bun/@mastra+core@1.71.0+95d98e20cbc6e6e1/node_modules/@mastra/core/dist/base-B-BWYmtx.js
|
|
226
|
+
var MastraBase = class {
|
|
227
|
+
component = RegisteredLogger.LLM;
|
|
228
|
+
logger;
|
|
229
|
+
name;
|
|
230
|
+
#rawConfig;
|
|
231
|
+
constructor({ component, name, rawConfig }) {
|
|
232
|
+
this.component = component || RegisteredLogger.LLM;
|
|
233
|
+
this.name = name;
|
|
234
|
+
this.#rawConfig = rawConfig;
|
|
235
|
+
this.logger = new ConsoleLogger2({ name: `${this.component} - ${this.name}` });
|
|
236
|
+
}
|
|
237
|
+
toRawConfig() {
|
|
238
|
+
return this.#rawConfig;
|
|
239
|
+
}
|
|
240
|
+
__setRawConfig(rawConfig) {
|
|
241
|
+
this.#rawConfig = rawConfig;
|
|
242
|
+
}
|
|
243
|
+
__setLogger(logger) {
|
|
244
|
+
this.logger = "child" in logger && typeof logger.child === "function" ? logger.child({ component: this.component }) : logger;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export { isAdaptableLogger, buildLogRecordData, RegisteredLogger, LogLevel, ConsoleLogger2, MastraBase };
|