@mettlelabs/mettle 0.0.0-0 → 0.0.0-beta.1-linux-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.
Files changed (59) hide show
  1. package/THIRD_PARTY_NOTICES.md +11479 -0
  2. package/bin/mettle +4 -0
  3. package/harness/audit-investigation.mjs +203 -0
  4. package/harness/chunk-13tgmdey.mjs +33761 -0
  5. package/harness/chunk-1sygmp11.mjs +18142 -0
  6. package/harness/chunk-1ykxpmaz.mjs +7887 -0
  7. package/harness/chunk-2gt4cy7x.mjs +2290 -0
  8. package/harness/chunk-2pm2sayw.mjs +248 -0
  9. package/harness/chunk-32y07kkp.mjs +3747 -0
  10. package/harness/chunk-3m7jn5ac.mjs +16242 -0
  11. package/harness/chunk-3wvjs93w.mjs +538 -0
  12. package/harness/chunk-4bepyxmq.mjs +113 -0
  13. package/harness/chunk-4jtnt9k5.mjs +95 -0
  14. package/harness/chunk-50sbrf09.mjs +18972 -0
  15. package/harness/chunk-56csr8sw.mjs +322 -0
  16. package/harness/chunk-5cvb1jnb.mjs +41 -0
  17. package/harness/chunk-5wgmv4np.mjs +585 -0
  18. package/harness/chunk-65eyq32y.mjs +225 -0
  19. package/harness/chunk-6fnh6qhk.mjs +195 -0
  20. package/harness/chunk-6kgqw9ny.mjs +32303 -0
  21. package/harness/chunk-7b242j0n.mjs +14 -0
  22. package/harness/chunk-7bg2gnv2.mjs +7540 -0
  23. package/harness/chunk-ageqxj9v.mjs +63008 -0
  24. package/harness/chunk-b0qbt5jd.mjs +14 -0
  25. package/harness/chunk-b5g1r3fz.mjs +4785 -0
  26. package/harness/chunk-b71gpkxg.mjs +1514 -0
  27. package/harness/chunk-bdv1rx4a.mjs +20364 -0
  28. package/harness/chunk-c1631s2x.mjs +12241 -0
  29. package/harness/chunk-d5xgxsnp.mjs +74 -0
  30. package/harness/chunk-erg1fbh0.mjs +0 -0
  31. package/harness/chunk-fh78v9vn.mjs +19366 -0
  32. package/harness/chunk-fjx29qvp.mjs +50 -0
  33. package/harness/chunk-gryka6kg.mjs +39 -0
  34. package/harness/chunk-jb0r19et.mjs +180 -0
  35. package/harness/chunk-mfn574ss.mjs +179 -0
  36. package/harness/chunk-msg872ea.mjs +334 -0
  37. package/harness/chunk-nz5sv9as.mjs +1642 -0
  38. package/harness/chunk-p9d3cgvq.mjs +452 -0
  39. package/harness/chunk-pq6wvwxr.mjs +12 -0
  40. package/harness/chunk-qcm9arf8.mjs +7736 -0
  41. package/harness/chunk-qr8zfqjd.mjs +24 -0
  42. package/harness/chunk-rz2tz6jp.mjs +26 -0
  43. package/harness/chunk-sbkgc3kn.mjs +8 -0
  44. package/harness/chunk-v66qvpnb.mjs +169 -0
  45. package/harness/chunk-vjaxzab3.mjs +136 -0
  46. package/harness/chunk-vr1n5nza.mjs +1045 -0
  47. package/harness/chunk-vsf2zajv.mjs +3867 -0
  48. package/harness/chunk-wq253fj4.mjs +19041 -0
  49. package/harness/chunk-wyv7ceq4.mjs +0 -0
  50. package/harness/chunk-xnqknk2r.mjs +198 -0
  51. package/harness/chunk-xqyc4ca2.mjs +1890 -0
  52. package/harness/chunk-z6n9thea.mjs +45146 -0
  53. package/harness/chunk-zty0d3bw.mjs +0 -0
  54. package/harness/chunk-zvkxtj82.mjs +42 -0
  55. package/harness/issue-api-token.mjs +35 -0
  56. package/harness/launcher.mjs +159 -0
  57. package/harness/sandbox.mjs +132 -0
  58. package/harness/server.mjs +66322 -0
  59. package/package.json +20 -3
@@ -0,0 +1,538 @@
1
+ import {
2
+ MastraBase
3
+ } from "./chunk-2pm2sayw.mjs";
4
+ import {
5
+ MastraError
6
+ } from "./chunk-v66qvpnb.mjs";
7
+ import {
8
+ createOpenAICompatible,
9
+ createOpenAI,
10
+ MastraModelGateway,
11
+ createAnthropic,
12
+ MASTRA_USER_AGENT,
13
+ createGoogleGenerativeAI
14
+ } from "./chunk-bdv1rx4a.mjs";
15
+ import {
16
+ __exportAll
17
+ } from "./chunk-vsf2zajv.mjs";
18
+
19
+ // node_modules/.bun/@isaacs+ttlcache@2.1.5/node_modules/@isaacs/ttlcache/dist/esm/index.js
20
+ var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
21
+ var now = () => perf.now();
22
+ var isPosInt = (n) => !!n && n === Math.floor(n) && n > 0 && isFinite(n);
23
+ var isPosIntOrInf = (n) => n === Infinity || isPosInt(n);
24
+ var TIMER_MAX = 2 ** 31 - 1;
25
+
26
+ class TTLCache {
27
+ expirations = Object.create(null);
28
+ data = new Map;
29
+ expirationMap = new Map;
30
+ ttl;
31
+ max;
32
+ updateAgeOnGet;
33
+ updateAgeOnHas;
34
+ noUpdateTTL;
35
+ noDisposeOnSet;
36
+ checkAgeOnGet;
37
+ checkAgeOnHas;
38
+ dispose;
39
+ timer;
40
+ timerExpiration;
41
+ immortalKeys = new Set;
42
+ constructor({ max = Infinity, ttl, updateAgeOnGet = false, checkAgeOnGet = false, updateAgeOnHas = false, checkAgeOnHas = false, noUpdateTTL = false, dispose, noDisposeOnSet = false } = {}) {
43
+ if (ttl !== undefined && !isPosIntOrInf(ttl)) {
44
+ throw new TypeError("ttl must be positive integer or Infinity if set");
45
+ }
46
+ if (!isPosIntOrInf(max)) {
47
+ throw new TypeError("max must be positive integer or Infinity");
48
+ }
49
+ this.ttl = ttl;
50
+ this.max = max;
51
+ this.updateAgeOnGet = !!updateAgeOnGet;
52
+ this.checkAgeOnGet = !!checkAgeOnGet;
53
+ this.updateAgeOnHas = !!updateAgeOnHas;
54
+ this.checkAgeOnHas = !!checkAgeOnHas;
55
+ this.noUpdateTTL = !!noUpdateTTL;
56
+ this.noDisposeOnSet = !!noDisposeOnSet;
57
+ if (dispose !== undefined) {
58
+ if (typeof dispose !== "function") {
59
+ throw new TypeError("dispose must be function if set");
60
+ }
61
+ this.dispose = dispose;
62
+ } else {
63
+ this.dispose = (_, __, ___) => {};
64
+ }
65
+ this.timer = undefined;
66
+ this.timerExpiration = undefined;
67
+ }
68
+ setTimer(expiration, ttl) {
69
+ if (this.timerExpiration && this.timerExpiration < expiration) {
70
+ return;
71
+ }
72
+ if (this.timer) {
73
+ clearTimeout(this.timer);
74
+ }
75
+ const t = setTimeout(() => {
76
+ this.timer = undefined;
77
+ this.timerExpiration = undefined;
78
+ this.purgeStale();
79
+ for (const exp in this.expirations) {
80
+ const e = Number(exp);
81
+ this.setTimer(e, e - now());
82
+ break;
83
+ }
84
+ }, Math.min(TIMER_MAX, Math.max(0, ttl)));
85
+ if (t.unref)
86
+ t.unref();
87
+ this.timerExpiration = expiration;
88
+ this.timer = t;
89
+ }
90
+ cancelTimer() {
91
+ if (this.timer) {
92
+ clearTimeout(this.timer);
93
+ this.timerExpiration = undefined;
94
+ this.timer = undefined;
95
+ }
96
+ }
97
+ cancelTimers() {
98
+ process.emitWarning("TTLCache.cancelTimers has been renamed to " + 'TTLCache.cancelTimer (no "s"), and will be removed in the next ' + "major version update");
99
+ return this.cancelTimer();
100
+ }
101
+ clear() {
102
+ const entries = this.dispose !== TTLCache.prototype.dispose ? [...this] : [];
103
+ this.data.clear();
104
+ this.expirationMap.clear();
105
+ this.cancelTimer();
106
+ this.expirations = Object.create(null);
107
+ for (const [key, val] of entries) {
108
+ this.dispose(val, key, "delete");
109
+ }
110
+ }
111
+ setTTL(key, ttl = this.ttl) {
112
+ const current = this.expirationMap.get(key);
113
+ if (current !== undefined) {
114
+ const exp = this.expirations[current];
115
+ if (!exp || exp.length <= 1) {
116
+ delete this.expirations[current];
117
+ } else {
118
+ this.expirations[current] = exp.filter((k) => k !== key);
119
+ }
120
+ }
121
+ if (ttl && ttl !== Infinity) {
122
+ this.immortalKeys.delete(key);
123
+ const expiration = Math.floor(now() + ttl);
124
+ this.expirationMap.set(key, expiration);
125
+ if (!this.expirations[expiration]) {
126
+ this.expirations[expiration] = [];
127
+ this.setTimer(expiration, ttl);
128
+ }
129
+ this.expirations[expiration].push(key);
130
+ } else {
131
+ this.immortalKeys.add(key);
132
+ this.expirationMap.set(key, Infinity);
133
+ }
134
+ }
135
+ set(key, val, { ttl = this.ttl, noUpdateTTL = this.noUpdateTTL, noDisposeOnSet = this.noDisposeOnSet } = {}) {
136
+ if (!isPosIntOrInf(ttl)) {
137
+ throw new TypeError("ttl must be positive integer or Infinity");
138
+ }
139
+ if (this.expirationMap.has(key)) {
140
+ if (!noUpdateTTL) {
141
+ this.setTTL(key, ttl);
142
+ }
143
+ const oldValue = this.data.get(key);
144
+ const disp = !noDisposeOnSet && this.data.has(key);
145
+ if (oldValue !== val) {
146
+ this.data.set(key, val);
147
+ if (disp) {
148
+ this.dispose(oldValue, key, "set");
149
+ }
150
+ }
151
+ } else {
152
+ this.setTTL(key, ttl);
153
+ this.data.set(key, val);
154
+ }
155
+ while (this.size > this.max) {
156
+ this.purgeToCapacity();
157
+ }
158
+ return this;
159
+ }
160
+ has(key, { checkAgeOnHas = this.checkAgeOnHas, ttl = this.ttl, updateAgeOnHas = this.updateAgeOnHas } = {}) {
161
+ if (this.data.has(key)) {
162
+ if (checkAgeOnHas && this.getRemainingTTL(key) === 0) {
163
+ this.delete(key);
164
+ return false;
165
+ }
166
+ if (updateAgeOnHas) {
167
+ this.setTTL(key, ttl);
168
+ }
169
+ return true;
170
+ }
171
+ return false;
172
+ }
173
+ getRemainingTTL(key) {
174
+ const expiration = this.expirationMap.get(key);
175
+ return expiration === Infinity ? expiration : expiration !== undefined ? Math.max(0, Math.ceil(expiration - now())) : 0;
176
+ }
177
+ get(key, { updateAgeOnGet = this.updateAgeOnGet, ttl = this.ttl, checkAgeOnGet = this.checkAgeOnGet } = {}) {
178
+ if (!this.data.has(key))
179
+ return;
180
+ const val = this.data.get(key);
181
+ if (checkAgeOnGet && this.getRemainingTTL(key) === 0) {
182
+ this.delete(key);
183
+ return;
184
+ }
185
+ if (updateAgeOnGet) {
186
+ this.setTTL(key, ttl);
187
+ }
188
+ return val;
189
+ }
190
+ delete(key) {
191
+ const current = this.expirationMap.get(key);
192
+ if (current !== undefined) {
193
+ const value = this.data.get(key);
194
+ this.data.delete(key);
195
+ this.expirationMap.delete(key);
196
+ this.immortalKeys.delete(key);
197
+ const exp = this.expirations[current];
198
+ if (exp) {
199
+ if (exp.length <= 1) {
200
+ delete this.expirations[current];
201
+ } else {
202
+ this.expirations[current] = exp.filter((k) => k !== key);
203
+ }
204
+ }
205
+ this.dispose(value, key, "delete");
206
+ if (this.size === 0) {
207
+ this.cancelTimer();
208
+ }
209
+ return true;
210
+ }
211
+ return false;
212
+ }
213
+ purgeToCapacity() {
214
+ for (const exp in this.expirations) {
215
+ const keys = this.expirations[exp];
216
+ if (this.size - keys.length >= this.max) {
217
+ delete this.expirations[exp];
218
+ const entries = [];
219
+ for (const key of keys) {
220
+ entries.push([key, this.data.get(key)]);
221
+ this.data.delete(key);
222
+ this.expirationMap.delete(key);
223
+ }
224
+ for (const [key, val] of entries) {
225
+ this.dispose(val, key, "evict");
226
+ }
227
+ } else {
228
+ const s = this.size - this.max;
229
+ const entries = [];
230
+ for (const key of keys.splice(0, s)) {
231
+ entries.push([key, this.data.get(key)]);
232
+ this.data.delete(key);
233
+ this.expirationMap.delete(key);
234
+ }
235
+ for (const [key, val] of entries) {
236
+ this.dispose(val, key, "evict");
237
+ }
238
+ return;
239
+ }
240
+ }
241
+ }
242
+ get size() {
243
+ return this.data.size;
244
+ }
245
+ purgeStale() {
246
+ const n = Math.ceil(now());
247
+ for (const exp in this.expirations) {
248
+ if (exp === "Infinity" || Number(exp) > n) {
249
+ return;
250
+ }
251
+ const keys = [...this.expirations[exp] || []];
252
+ const entries = [];
253
+ delete this.expirations[exp];
254
+ for (const key of keys) {
255
+ entries.push([key, this.data.get(key)]);
256
+ this.data.delete(key);
257
+ this.expirationMap.delete(key);
258
+ }
259
+ for (const [key, val] of entries) {
260
+ this.dispose(val, key, "stale");
261
+ }
262
+ }
263
+ if (this.size === 0) {
264
+ this.cancelTimer();
265
+ }
266
+ }
267
+ *entries() {
268
+ for (const exp in this.expirations) {
269
+ for (const key of this.expirations[exp]) {
270
+ yield [key, this.data.get(key)];
271
+ }
272
+ }
273
+ for (const key of this.immortalKeys) {
274
+ yield [key, this.data.get(key)];
275
+ }
276
+ }
277
+ *keys() {
278
+ for (const exp in this.expirations) {
279
+ for (const key of this.expirations[exp]) {
280
+ yield key;
281
+ }
282
+ }
283
+ for (const key of this.immortalKeys) {
284
+ yield key;
285
+ }
286
+ }
287
+ *values() {
288
+ for (const exp in this.expirations) {
289
+ for (const key of this.expirations[exp]) {
290
+ yield this.data.get(key);
291
+ }
292
+ }
293
+ for (const key of this.immortalKeys) {
294
+ yield this.data.get(key);
295
+ }
296
+ }
297
+ [Symbol.iterator]() {
298
+ return this.entries();
299
+ }
300
+ }
301
+
302
+ // node_modules/.bun/@mastra+core@1.71.0+95d98e20cbc6e6e1/node_modules/@mastra/core/dist/inmemory-D_cTX1px.js
303
+ var MastraServerCache = class extends MastraBase {
304
+ constructor({ name }) {
305
+ super({
306
+ component: "SERVER_CACHE",
307
+ name
308
+ });
309
+ }
310
+ async listPushIndexed(listKey, counterKey, value) {
311
+ const index = await this.increment(counterKey) - 1;
312
+ await this.listPush(listKey, {
313
+ ...value,
314
+ index
315
+ });
316
+ return index;
317
+ }
318
+ };
319
+ var InMemoryServerCache = class extends MastraServerCache {
320
+ cache;
321
+ ttlMs;
322
+ constructor(options = {}) {
323
+ super({ name: "InMemoryServerCache" });
324
+ this.ttlMs = options.ttlMs ?? 1000 * 60 * 5;
325
+ const ttl = this.ttlMs > 0 ? this.ttlMs : Infinity;
326
+ this.cache = new TTLCache({
327
+ max: options.maxSize ?? 1000,
328
+ ttl
329
+ });
330
+ }
331
+ async get(key) {
332
+ return this.cache.get(key);
333
+ }
334
+ async set(key, value, ttlMs) {
335
+ if (ttlMs === undefined) {
336
+ this.cache.set(key, value);
337
+ return;
338
+ }
339
+ this.cache.set(key, value, { ttl: ttlMs > 0 ? ttlMs : Infinity });
340
+ }
341
+ async listLength(key) {
342
+ const value = this.cache.get(key);
343
+ if (value === undefined)
344
+ return 0;
345
+ if (!Array.isArray(value))
346
+ throw new Error(`${key} exists but is not an array`);
347
+ return value.length;
348
+ }
349
+ async listPush(key, value) {
350
+ const existing = this.cache.get(key);
351
+ if (Array.isArray(existing)) {
352
+ existing.push(value);
353
+ if (this.ttlMs > 0)
354
+ this.cache.set(key, existing, { ttl: this.ttlMs });
355
+ } else if (existing !== undefined)
356
+ throw new Error(`${key} exists but is not an array`);
357
+ else
358
+ this.cache.set(key, [value]);
359
+ }
360
+ async listFromTo(key, from, to = -1) {
361
+ const list = this.cache.get(key);
362
+ if (Array.isArray(list)) {
363
+ const endIndex = to === -1 ? undefined : to + 1;
364
+ return list.slice(from, endIndex);
365
+ }
366
+ return [];
367
+ }
368
+ async delete(key) {
369
+ this.cache.delete(key);
370
+ }
371
+ async clear() {
372
+ this.cache.clear();
373
+ }
374
+ async increment(key) {
375
+ const value = this.cache.get(key);
376
+ let counter;
377
+ if (value === undefined)
378
+ counter = 1;
379
+ else if (typeof value === "number")
380
+ counter = value + 1;
381
+ else
382
+ throw new Error(`${key} exists but is not a number`);
383
+ this.cache.set(key, counter);
384
+ return counter;
385
+ }
386
+ };
387
+
388
+ // node_modules/.bun/@mastra+core@1.71.0+95d98e20cbc6e6e1/node_modules/@mastra/core/dist/netlify-B_pyJk7y.js
389
+ var netlify_exports = /* @__PURE__ */ __exportAll({ NetlifyGateway: () => NetlifyGateway });
390
+ var NetlifyGateway = class extends MastraModelGateway {
391
+ id = "netlify";
392
+ name = "Netlify AI Gateway";
393
+ tokenCache = new InMemoryServerCache;
394
+ async fetchProviders() {
395
+ const response = await fetch("https://api.netlify.com/api/v1/ai-gateway/providers");
396
+ if (!response.ok)
397
+ throw new Error(`Failed to fetch from Netlify: ${response.statusText}`);
398
+ const data = await response.json();
399
+ const config = {
400
+ apiKeyEnvVar: ["NETLIFY_TOKEN", "NETLIFY_SITE_ID"],
401
+ apiKeyHeader: "Authorization",
402
+ name: `Netlify`,
403
+ gateway: `netlify`,
404
+ models: [],
405
+ docUrl: "https://docs.netlify.com/build/ai-gateway/overview/"
406
+ };
407
+ for (const [providerId, provider] of Object.entries(data.providers))
408
+ for (const model of provider.models)
409
+ config.models.push(`${providerId}/${model}`);
410
+ return { netlify: config };
411
+ }
412
+ async buildUrl(routerId, envVars) {
413
+ const siteId = envVars?.["NETLIFY_SITE_ID"] || process.env["NETLIFY_SITE_ID"];
414
+ const netlifyToken = envVars?.["NETLIFY_TOKEN"] || process.env["NETLIFY_TOKEN"];
415
+ if (!netlifyToken)
416
+ throw new MastraError({
417
+ id: "NETLIFY_GATEWAY_NO_TOKEN",
418
+ domain: "LLM",
419
+ category: "UNKNOWN",
420
+ text: `Missing NETLIFY_TOKEN environment variable required for model: ${routerId}`
421
+ });
422
+ if (!siteId)
423
+ throw new MastraError({
424
+ id: "NETLIFY_GATEWAY_NO_SITE_ID",
425
+ domain: "LLM",
426
+ category: "UNKNOWN",
427
+ text: `Missing NETLIFY_SITE_ID environment variable required for model: ${routerId}`
428
+ });
429
+ try {
430
+ const tokenData = await this.getOrFetchToken(siteId, netlifyToken);
431
+ return tokenData.url.endsWith(`/`) ? tokenData.url.substring(0, tokenData.url.length - 1) : tokenData.url;
432
+ } catch (error) {
433
+ throw new MastraError({
434
+ id: "NETLIFY_GATEWAY_TOKEN_ERROR",
435
+ domain: "LLM",
436
+ category: "UNKNOWN",
437
+ text: `Failed to get Netlify AI Gateway token for model ${routerId}: ${error instanceof Error ? error.message : String(error)}`
438
+ });
439
+ }
440
+ }
441
+ async getOrFetchToken(siteId, netlifyToken) {
442
+ const cacheKey = `netlify-token:${siteId}:${netlifyToken}`;
443
+ const cached = await this.tokenCache.get(cacheKey);
444
+ if (cached && cached.expiresAt > Date.now() / 1000 + 60)
445
+ return {
446
+ token: cached.token,
447
+ url: cached.url
448
+ };
449
+ const response = await fetch(`https://api.netlify.com/api/v1/sites/${siteId}/ai-gateway/token`, {
450
+ method: "GET",
451
+ headers: { Authorization: `Bearer ${netlifyToken}` }
452
+ });
453
+ if (!response.ok) {
454
+ const error = await response.text();
455
+ throw new Error(`Failed to get Netlify AI Gateway token: ${response.status} ${error}`);
456
+ }
457
+ const tokenResponse = await response.json();
458
+ await this.tokenCache.set(cacheKey, {
459
+ token: tokenResponse.token,
460
+ url: tokenResponse.url,
461
+ expiresAt: tokenResponse.expires_at
462
+ });
463
+ return {
464
+ token: tokenResponse.token,
465
+ url: tokenResponse.url
466
+ };
467
+ }
468
+ async getApiKey(modelId) {
469
+ const siteId = process.env["NETLIFY_SITE_ID"];
470
+ const netlifyToken = process.env["NETLIFY_TOKEN"];
471
+ if (!netlifyToken)
472
+ throw new MastraError({
473
+ id: "NETLIFY_GATEWAY_NO_TOKEN",
474
+ domain: "LLM",
475
+ category: "UNKNOWN",
476
+ text: `Missing NETLIFY_TOKEN environment variable required for model: ${modelId}`
477
+ });
478
+ if (!siteId)
479
+ throw new MastraError({
480
+ id: "NETLIFY_GATEWAY_NO_SITE_ID",
481
+ domain: "LLM",
482
+ category: "UNKNOWN",
483
+ text: `Missing NETLIFY_SITE_ID environment variable required for model: ${modelId}`
484
+ });
485
+ try {
486
+ return (await this.getOrFetchToken(siteId, netlifyToken)).token;
487
+ } catch (error) {
488
+ throw new MastraError({
489
+ id: "NETLIFY_GATEWAY_TOKEN_ERROR",
490
+ domain: "LLM",
491
+ category: "UNKNOWN",
492
+ text: `Failed to get Netlify AI Gateway token for model ${modelId}: ${error instanceof Error ? error.message : String(error)}`
493
+ });
494
+ }
495
+ }
496
+ async resolveLanguageModel({ modelId, providerId, apiKey, headers }) {
497
+ const baseURL = await this.buildUrl(`${providerId}/${modelId}`);
498
+ const mastraHeaders = {
499
+ "User-Agent": MASTRA_USER_AGENT,
500
+ ...headers
501
+ };
502
+ switch (providerId) {
503
+ case "openai":
504
+ return createOpenAI({
505
+ apiKey,
506
+ baseURL,
507
+ headers: mastraHeaders
508
+ }).responses(modelId);
509
+ case "gemini":
510
+ return createGoogleGenerativeAI({
511
+ baseURL: `${baseURL}/v1beta/`,
512
+ apiKey,
513
+ headers: {
514
+ "user-agent": "google-genai-sdk/",
515
+ ...mastraHeaders
516
+ }
517
+ }).chat(modelId);
518
+ case "anthropic":
519
+ return createAnthropic({
520
+ apiKey,
521
+ baseURL: `${baseURL}/v1/`,
522
+ headers: {
523
+ "anthropic-version": "2023-06-01",
524
+ ...mastraHeaders
525
+ }
526
+ })(modelId);
527
+ default:
528
+ return createOpenAICompatible({
529
+ name: providerId,
530
+ apiKey,
531
+ baseURL,
532
+ headers: mastraHeaders,
533
+ supportsStructuredOutputs: true
534
+ }).chatModel(modelId);
535
+ }
536
+ }
537
+ };
538
+ export { TTLCache, InMemoryServerCache, netlify_exports, NetlifyGateway };
@@ -0,0 +1,113 @@
1
+ import {
2
+ globalRunRegistry,
3
+ getActiveDurableAgentWorkflowExecutions,
4
+ RunRegistry,
5
+ ExtendedRunRegistry,
6
+ publishAbortRequest,
7
+ subscribeToAbortRequests,
8
+ ensureRemoteAbortListener,
9
+ runDurableStreamUntilIdle,
10
+ runResumeDurableStreamUntilIdle,
11
+ serializeToolsMetadata,
12
+ serializeModelConfig,
13
+ serializeDurableState,
14
+ serializeDurableOptions,
15
+ createWorkflowInput,
16
+ resolveRuntimeDependencies,
17
+ rebuildRunToolsFromMastra,
18
+ resolveModel,
19
+ resolveInternalState,
20
+ resolveTool,
21
+ toolRequiresApproval,
22
+ runDurableFinishSideEffects,
23
+ prepareForDurableExecution,
24
+ createDurableAgentStream,
25
+ emitChunkEvent,
26
+ emitStepStartEvent,
27
+ emitStepFinishEvent,
28
+ emitFinishEvent,
29
+ emitErrorEvent,
30
+ emitSuspendedEvent,
31
+ executeDurableAgentScorers,
32
+ modelConfigSchema,
33
+ modelListEntrySchema,
34
+ accumulatedUsageSchema,
35
+ durableAgenticOutputSchema,
36
+ baseDurableAgenticInputSchema,
37
+ baseIterationStateSchema,
38
+ calculateAccumulatedUsage,
39
+ buildStepRecord,
40
+ createBaseIterationStateUpdate,
41
+ resolveDurableToolCallConcurrency,
42
+ createDurableBackgroundTaskCheckStep,
43
+ createDurableLLMExecutionStep,
44
+ createDurableToolCallStep,
45
+ createDurableLLMMappingStep,
46
+ defaultShouldPersistSnapshot,
47
+ createDurableAgenticWorkflow,
48
+ DurableAgent,
49
+ create_durable_agent_exports,
50
+ createDurableAgent,
51
+ isDurableAgent,
52
+ isLocalDurableAgent
53
+ } from "./chunk-qcm9arf8.mjs";
54
+ import"./chunk-ageqxj9v.mjs";
55
+ import"./chunk-6kgqw9ny.mjs";
56
+ import"./chunk-3m7jn5ac.mjs";
57
+ import"./chunk-z6n9thea.mjs";
58
+ import"./chunk-50sbrf09.mjs";
59
+ import"./chunk-c1631s2x.mjs";
60
+ import"./chunk-3wvjs93w.mjs";
61
+ export {
62
+ prepareForDurableExecution as A,
63
+ serializeDurableState as B,
64
+ createDurableAgentStream as C,
65
+ emitStepFinishEvent as D,
66
+ emitFinishEvent as E,
67
+ resolveRuntimeDependencies as F,
68
+ ensureRemoteAbortListener as G,
69
+ serializeToolsMetadata as H,
70
+ resolveTool as I,
71
+ ExtendedRunRegistry as J,
72
+ publishAbortRequest as K,
73
+ toolRequiresApproval as L,
74
+ rebuildRunToolsFromMastra as M,
75
+ resolveInternalState as N,
76
+ emitStepStartEvent as O,
77
+ resolveModel as P,
78
+ createWorkflowInput as R,
79
+ executeDurableAgentScorers as S,
80
+ emitErrorEvent as T,
81
+ runDurableStreamUntilIdle as U,
82
+ serializeModelConfig as V,
83
+ runResumeDurableStreamUntilIdle as W,
84
+ getActiveDurableAgentWorkflowExecutions as X,
85
+ RunRegistry as Y,
86
+ globalRunRegistry as Z,
87
+ baseDurableAgenticInputSchema as _,
88
+ DurableAgent as a,
89
+ modelConfigSchema as b,
90
+ createDurableLLMMappingStep as c,
91
+ createDurableBackgroundTaskCheckStep as d,
92
+ resolveDurableToolCallConcurrency as f,
93
+ accumulatedUsageSchema as g,
94
+ createBaseIterationStateUpdate as h,
95
+ isLocalDurableAgent as i,
96
+ runDurableFinishSideEffects as j,
97
+ emitSuspendedEvent as k,
98
+ createDurableToolCallStep as l,
99
+ calculateAccumulatedUsage as m,
100
+ create_durable_agent_exports as n,
101
+ createDurableAgenticWorkflow as o,
102
+ buildStepRecord as p,
103
+ subscribeToAbortRequests as q,
104
+ isDurableAgent as r,
105
+ defaultShouldPersistSnapshot as s,
106
+ createDurableAgent as t,
107
+ createDurableLLMExecutionStep as u,
108
+ baseIterationStateSchema as v,
109
+ emitChunkEvent as w,
110
+ modelListEntrySchema as x,
111
+ durableAgenticOutputSchema as y,
112
+ serializeDurableOptions as z
113
+ };