@mastra/agent-builder 1.0.30 → 1.0.31
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/CHANGELOG.md +34 -0
- package/dist/index.js +215 -3
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @mastra/agent-builder
|
|
2
2
|
|
|
3
|
+
## 1.0.31
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dependencies updates: ([#15770](https://github.com/mastra-ai/mastra/pull/15770))
|
|
8
|
+
- Updated dependency [`@ai-sdk/anthropic-v5@npm:@ai-sdk/anthropic@2.0.77` ↗︎](https://www.npmjs.com/package/@ai-sdk/anthropic-v5/v/2.0.77) (from `npm:@ai-sdk/anthropic@2.0.61`, in `dependencies`)
|
|
9
|
+
- Updated dependency [`@ai-sdk/google-v5@npm:@ai-sdk/google@2.0.70` ↗︎](https://www.npmjs.com/package/@ai-sdk/google-v5/v/2.0.70) (from `npm:@ai-sdk/google@2.0.52`, in `dependencies`)
|
|
10
|
+
- Updated dependency [`@ai-sdk/groq-v5@npm:@ai-sdk/groq@2.0.38` ↗︎](https://www.npmjs.com/package/@ai-sdk/groq-v5/v/2.0.38) (from `npm:@ai-sdk/groq@2.0.34`, in `dependencies`)
|
|
11
|
+
- Updated dependency [`@ai-sdk/openai-v5@npm:@ai-sdk/openai@2.0.103` ↗︎](https://www.npmjs.com/package/@ai-sdk/openai-v5/v/2.0.103) (from `npm:@ai-sdk/openai@2.0.89`, in `dependencies`)
|
|
12
|
+
- Updated dependency [`@ai-sdk/xai-v5@npm:@ai-sdk/xai@2.0.68` ↗︎](https://www.npmjs.com/package/@ai-sdk/xai-v5/v/2.0.68) (from `npm:@ai-sdk/xai@2.0.57`, in `dependencies`)
|
|
13
|
+
- Updated dependencies [[`6db978c`](https://github.com/mastra-ai/mastra/commit/6db978c42e94e75540a504f7230086f0b5cd35f9), [`95b001f`](https://github.com/mastra-ai/mastra/commit/95b001f750af6947ad9d174cd47abffc776663a5), [`512a013`](https://github.com/mastra-ai/mastra/commit/512a013f285aa9c0aa8f08a35b2ce09f9938b017), [`e9becde`](https://github.com/mastra-ai/mastra/commit/e9becdeed9176b9f8392e557bde12b933f99cf7a), [`703a443`](https://github.com/mastra-ai/mastra/commit/703a44390c587d9c0b8ae94ec4edd8afb2a74044), [`808df1b`](https://github.com/mastra-ai/mastra/commit/808df1b39358b5f10b7317107e42b1fda7c87185)]:
|
|
14
|
+
- @mastra/core@1.29.1
|
|
15
|
+
- @mastra/memory@1.17.3
|
|
16
|
+
|
|
17
|
+
## 1.0.31-alpha.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- dependencies updates: ([#15770](https://github.com/mastra-ai/mastra/pull/15770))
|
|
22
|
+
- Updated dependency [`@ai-sdk/anthropic-v5@npm:@ai-sdk/anthropic@2.0.77` ↗︎](https://www.npmjs.com/package/@ai-sdk/anthropic-v5/v/2.0.77) (from `npm:@ai-sdk/anthropic@2.0.61`, in `dependencies`)
|
|
23
|
+
- Updated dependency [`@ai-sdk/google-v5@npm:@ai-sdk/google@2.0.70` ↗︎](https://www.npmjs.com/package/@ai-sdk/google-v5/v/2.0.70) (from `npm:@ai-sdk/google@2.0.52`, in `dependencies`)
|
|
24
|
+
- Updated dependency [`@ai-sdk/groq-v5@npm:@ai-sdk/groq@2.0.38` ↗︎](https://www.npmjs.com/package/@ai-sdk/groq-v5/v/2.0.38) (from `npm:@ai-sdk/groq@2.0.34`, in `dependencies`)
|
|
25
|
+
- Updated dependency [`@ai-sdk/openai-v5@npm:@ai-sdk/openai@2.0.103` ↗︎](https://www.npmjs.com/package/@ai-sdk/openai-v5/v/2.0.103) (from `npm:@ai-sdk/openai@2.0.89`, in `dependencies`)
|
|
26
|
+
- Updated dependency [`@ai-sdk/xai-v5@npm:@ai-sdk/xai@2.0.68` ↗︎](https://www.npmjs.com/package/@ai-sdk/xai-v5/v/2.0.68) (from `npm:@ai-sdk/xai@2.0.57`, in `dependencies`)
|
|
27
|
+
- Updated dependencies [[`703a443`](https://github.com/mastra-ai/mastra/commit/703a44390c587d9c0b8ae94ec4edd8afb2a74044), [`808df1b`](https://github.com/mastra-ai/mastra/commit/808df1b39358b5f10b7317107e42b1fda7c87185)]:
|
|
28
|
+
- @mastra/core@1.29.1-alpha.1
|
|
29
|
+
|
|
30
|
+
## 1.0.31-alpha.0
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [[`95b001f`](https://github.com/mastra-ai/mastra/commit/95b001f750af6947ad9d174cd47abffc776663a5)]:
|
|
35
|
+
- @mastra/memory@1.17.3-alpha.0
|
|
36
|
+
|
|
3
37
|
## 1.0.30
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -5199,7 +5199,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
5199
5199
|
);
|
|
5200
5200
|
return Object.fromEntries(normalizedHeaders.entries());
|
|
5201
5201
|
}
|
|
5202
|
-
var VERSION = "3.0.
|
|
5202
|
+
var VERSION = "3.0.23";
|
|
5203
5203
|
var getOriginalFetch = () => globalThis.fetch;
|
|
5204
5204
|
var getFromApi = async ({
|
|
5205
5205
|
url,
|
|
@@ -7246,6 +7246,7 @@ async function parseAuthMethod(headers) {
|
|
|
7246
7246
|
var gatewayAuthMethodSchema = lazyValidator(
|
|
7247
7247
|
() => zodSchema(z$1.union([z$1.literal("api-key"), z$1.literal("oidc")]))
|
|
7248
7248
|
);
|
|
7249
|
+
var KNOWN_MODEL_TYPES = ["embedding", "image", "language"];
|
|
7249
7250
|
var GatewayFetchMetadata = class {
|
|
7250
7251
|
constructor(config) {
|
|
7251
7252
|
this.config = config;
|
|
@@ -7316,8 +7317,12 @@ var gatewayAvailableModelsResponseSchema = lazyValidator(
|
|
|
7316
7317
|
provider: z$1.string(),
|
|
7317
7318
|
modelId: z$1.string()
|
|
7318
7319
|
}),
|
|
7319
|
-
modelType: z$1.
|
|
7320
|
+
modelType: z$1.string().nullish()
|
|
7320
7321
|
})
|
|
7322
|
+
).transform(
|
|
7323
|
+
(models) => models.filter(
|
|
7324
|
+
(m) => m.modelType == null || KNOWN_MODEL_TYPES.includes(m.modelType)
|
|
7325
|
+
)
|
|
7321
7326
|
)
|
|
7322
7327
|
})
|
|
7323
7328
|
)
|
|
@@ -7333,6 +7338,187 @@ var gatewayCreditsResponseSchema = lazyValidator(
|
|
|
7333
7338
|
}))
|
|
7334
7339
|
)
|
|
7335
7340
|
);
|
|
7341
|
+
var GatewaySpendReport = class {
|
|
7342
|
+
constructor(config) {
|
|
7343
|
+
this.config = config;
|
|
7344
|
+
}
|
|
7345
|
+
async getSpendReport(params) {
|
|
7346
|
+
try {
|
|
7347
|
+
const baseUrl = new URL(this.config.baseURL);
|
|
7348
|
+
const searchParams = new URLSearchParams();
|
|
7349
|
+
searchParams.set("start_date", params.startDate);
|
|
7350
|
+
searchParams.set("end_date", params.endDate);
|
|
7351
|
+
if (params.groupBy) {
|
|
7352
|
+
searchParams.set("group_by", params.groupBy);
|
|
7353
|
+
}
|
|
7354
|
+
if (params.datePart) {
|
|
7355
|
+
searchParams.set("date_part", params.datePart);
|
|
7356
|
+
}
|
|
7357
|
+
if (params.userId) {
|
|
7358
|
+
searchParams.set("user_id", params.userId);
|
|
7359
|
+
}
|
|
7360
|
+
if (params.model) {
|
|
7361
|
+
searchParams.set("model", params.model);
|
|
7362
|
+
}
|
|
7363
|
+
if (params.provider) {
|
|
7364
|
+
searchParams.set("provider", params.provider);
|
|
7365
|
+
}
|
|
7366
|
+
if (params.credentialType) {
|
|
7367
|
+
searchParams.set("credential_type", params.credentialType);
|
|
7368
|
+
}
|
|
7369
|
+
if (params.tags && params.tags.length > 0) {
|
|
7370
|
+
searchParams.set("tags", params.tags.join(","));
|
|
7371
|
+
}
|
|
7372
|
+
const { value } = await getFromApi({
|
|
7373
|
+
url: `${baseUrl.origin}/v1/report?${searchParams.toString()}`,
|
|
7374
|
+
headers: await resolve4(this.config.headers()),
|
|
7375
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
7376
|
+
gatewaySpendReportResponseSchema
|
|
7377
|
+
),
|
|
7378
|
+
failedResponseHandler: createJsonErrorResponseHandler({
|
|
7379
|
+
errorSchema: z$1.any(),
|
|
7380
|
+
errorToMessage: (data) => data
|
|
7381
|
+
}),
|
|
7382
|
+
fetch: this.config.fetch
|
|
7383
|
+
});
|
|
7384
|
+
return value;
|
|
7385
|
+
} catch (error) {
|
|
7386
|
+
throw await asGatewayError(error);
|
|
7387
|
+
}
|
|
7388
|
+
}
|
|
7389
|
+
};
|
|
7390
|
+
var gatewaySpendReportResponseSchema = lazySchema(
|
|
7391
|
+
() => zodSchema(
|
|
7392
|
+
z$1.object({
|
|
7393
|
+
results: z$1.array(
|
|
7394
|
+
z$1.object({
|
|
7395
|
+
day: z$1.string().optional(),
|
|
7396
|
+
hour: z$1.string().optional(),
|
|
7397
|
+
user: z$1.string().optional(),
|
|
7398
|
+
model: z$1.string().optional(),
|
|
7399
|
+
tag: z$1.string().optional(),
|
|
7400
|
+
provider: z$1.string().optional(),
|
|
7401
|
+
credential_type: z$1.enum(["byok", "system"]).optional(),
|
|
7402
|
+
total_cost: z$1.number(),
|
|
7403
|
+
market_cost: z$1.number().optional(),
|
|
7404
|
+
input_tokens: z$1.number().optional(),
|
|
7405
|
+
output_tokens: z$1.number().optional(),
|
|
7406
|
+
cached_input_tokens: z$1.number().optional(),
|
|
7407
|
+
cache_creation_input_tokens: z$1.number().optional(),
|
|
7408
|
+
reasoning_tokens: z$1.number().optional(),
|
|
7409
|
+
request_count: z$1.number().optional()
|
|
7410
|
+
}).transform(
|
|
7411
|
+
({
|
|
7412
|
+
credential_type,
|
|
7413
|
+
total_cost,
|
|
7414
|
+
market_cost,
|
|
7415
|
+
input_tokens,
|
|
7416
|
+
output_tokens,
|
|
7417
|
+
cached_input_tokens,
|
|
7418
|
+
cache_creation_input_tokens,
|
|
7419
|
+
reasoning_tokens,
|
|
7420
|
+
request_count,
|
|
7421
|
+
...rest
|
|
7422
|
+
}) => ({
|
|
7423
|
+
...rest,
|
|
7424
|
+
...credential_type !== void 0 ? { credentialType: credential_type } : {},
|
|
7425
|
+
totalCost: total_cost,
|
|
7426
|
+
...market_cost !== void 0 ? { marketCost: market_cost } : {},
|
|
7427
|
+
...input_tokens !== void 0 ? { inputTokens: input_tokens } : {},
|
|
7428
|
+
...output_tokens !== void 0 ? { outputTokens: output_tokens } : {},
|
|
7429
|
+
...cached_input_tokens !== void 0 ? { cachedInputTokens: cached_input_tokens } : {},
|
|
7430
|
+
...cache_creation_input_tokens !== void 0 ? { cacheCreationInputTokens: cache_creation_input_tokens } : {},
|
|
7431
|
+
...reasoning_tokens !== void 0 ? { reasoningTokens: reasoning_tokens } : {},
|
|
7432
|
+
...request_count !== void 0 ? { requestCount: request_count } : {}
|
|
7433
|
+
})
|
|
7434
|
+
)
|
|
7435
|
+
)
|
|
7436
|
+
})
|
|
7437
|
+
)
|
|
7438
|
+
);
|
|
7439
|
+
var GatewayGenerationInfoFetcher = class {
|
|
7440
|
+
constructor(config) {
|
|
7441
|
+
this.config = config;
|
|
7442
|
+
}
|
|
7443
|
+
async getGenerationInfo(params) {
|
|
7444
|
+
try {
|
|
7445
|
+
const baseUrl = new URL(this.config.baseURL);
|
|
7446
|
+
const { value } = await getFromApi({
|
|
7447
|
+
url: `${baseUrl.origin}/v1/generation?id=${encodeURIComponent(params.id)}`,
|
|
7448
|
+
headers: await resolve4(this.config.headers()),
|
|
7449
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
7450
|
+
gatewayGenerationInfoResponseSchema
|
|
7451
|
+
),
|
|
7452
|
+
failedResponseHandler: createJsonErrorResponseHandler({
|
|
7453
|
+
errorSchema: z$1.any(),
|
|
7454
|
+
errorToMessage: (data) => data
|
|
7455
|
+
}),
|
|
7456
|
+
fetch: this.config.fetch
|
|
7457
|
+
});
|
|
7458
|
+
return value;
|
|
7459
|
+
} catch (error) {
|
|
7460
|
+
throw await asGatewayError(error);
|
|
7461
|
+
}
|
|
7462
|
+
}
|
|
7463
|
+
};
|
|
7464
|
+
var gatewayGenerationInfoResponseSchema = lazySchema(
|
|
7465
|
+
() => zodSchema(
|
|
7466
|
+
z$1.object({
|
|
7467
|
+
data: z$1.object({
|
|
7468
|
+
id: z$1.string(),
|
|
7469
|
+
total_cost: z$1.number(),
|
|
7470
|
+
upstream_inference_cost: z$1.number(),
|
|
7471
|
+
usage: z$1.number(),
|
|
7472
|
+
created_at: z$1.string(),
|
|
7473
|
+
model: z$1.string(),
|
|
7474
|
+
is_byok: z$1.boolean(),
|
|
7475
|
+
provider_name: z$1.string(),
|
|
7476
|
+
streamed: z$1.boolean(),
|
|
7477
|
+
finish_reason: z$1.string(),
|
|
7478
|
+
latency: z$1.number(),
|
|
7479
|
+
generation_time: z$1.number(),
|
|
7480
|
+
native_tokens_prompt: z$1.number(),
|
|
7481
|
+
native_tokens_completion: z$1.number(),
|
|
7482
|
+
native_tokens_reasoning: z$1.number(),
|
|
7483
|
+
native_tokens_cached: z$1.number(),
|
|
7484
|
+
native_tokens_cache_creation: z$1.number(),
|
|
7485
|
+
billable_web_search_calls: z$1.number()
|
|
7486
|
+
}).transform(
|
|
7487
|
+
({
|
|
7488
|
+
total_cost,
|
|
7489
|
+
upstream_inference_cost,
|
|
7490
|
+
created_at,
|
|
7491
|
+
is_byok,
|
|
7492
|
+
provider_name,
|
|
7493
|
+
finish_reason,
|
|
7494
|
+
generation_time,
|
|
7495
|
+
native_tokens_prompt,
|
|
7496
|
+
native_tokens_completion,
|
|
7497
|
+
native_tokens_reasoning,
|
|
7498
|
+
native_tokens_cached,
|
|
7499
|
+
native_tokens_cache_creation,
|
|
7500
|
+
billable_web_search_calls,
|
|
7501
|
+
...rest
|
|
7502
|
+
}) => ({
|
|
7503
|
+
...rest,
|
|
7504
|
+
totalCost: total_cost,
|
|
7505
|
+
upstreamInferenceCost: upstream_inference_cost,
|
|
7506
|
+
createdAt: created_at,
|
|
7507
|
+
isByok: is_byok,
|
|
7508
|
+
providerName: provider_name,
|
|
7509
|
+
finishReason: finish_reason,
|
|
7510
|
+
generationTime: generation_time,
|
|
7511
|
+
promptTokens: native_tokens_prompt,
|
|
7512
|
+
completionTokens: native_tokens_completion,
|
|
7513
|
+
reasoningTokens: native_tokens_reasoning,
|
|
7514
|
+
cachedTokens: native_tokens_cached,
|
|
7515
|
+
cacheCreationTokens: native_tokens_cache_creation,
|
|
7516
|
+
billableWebSearchCalls: billable_web_search_calls
|
|
7517
|
+
})
|
|
7518
|
+
)
|
|
7519
|
+
}).transform(({ data }) => data)
|
|
7520
|
+
)
|
|
7521
|
+
);
|
|
7336
7522
|
var GatewayLanguageModel = class {
|
|
7337
7523
|
constructor(modelId, config) {
|
|
7338
7524
|
this.modelId = modelId;
|
|
@@ -7835,7 +8021,7 @@ async function getVercelRequestId() {
|
|
|
7835
8021
|
var _a93;
|
|
7836
8022
|
return (_a93 = getContext().headers) == null ? void 0 : _a93["x-vercel-id"];
|
|
7837
8023
|
}
|
|
7838
|
-
var VERSION2 = "2.0.
|
|
8024
|
+
var VERSION2 = "2.0.82";
|
|
7839
8025
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
7840
8026
|
function createGatewayProvider(options = {}) {
|
|
7841
8027
|
var _a93, _b92;
|
|
@@ -7933,6 +8119,30 @@ function createGatewayProvider(options = {}) {
|
|
|
7933
8119
|
);
|
|
7934
8120
|
});
|
|
7935
8121
|
};
|
|
8122
|
+
const getSpendReport = async (params) => {
|
|
8123
|
+
return new GatewaySpendReport({
|
|
8124
|
+
baseURL,
|
|
8125
|
+
headers: getHeaders,
|
|
8126
|
+
fetch: options.fetch
|
|
8127
|
+
}).getSpendReport(params).catch(async (error) => {
|
|
8128
|
+
throw await asGatewayError(
|
|
8129
|
+
error,
|
|
8130
|
+
await parseAuthMethod(await getHeaders())
|
|
8131
|
+
);
|
|
8132
|
+
});
|
|
8133
|
+
};
|
|
8134
|
+
const getGenerationInfo = async (params) => {
|
|
8135
|
+
return new GatewayGenerationInfoFetcher({
|
|
8136
|
+
baseURL,
|
|
8137
|
+
headers: getHeaders,
|
|
8138
|
+
fetch: options.fetch
|
|
8139
|
+
}).getGenerationInfo(params).catch(async (error) => {
|
|
8140
|
+
throw await asGatewayError(
|
|
8141
|
+
error,
|
|
8142
|
+
await parseAuthMethod(await getHeaders())
|
|
8143
|
+
);
|
|
8144
|
+
});
|
|
8145
|
+
};
|
|
7936
8146
|
const provider = function(modelId) {
|
|
7937
8147
|
if (new.target) {
|
|
7938
8148
|
throw new Error(
|
|
@@ -7943,6 +8153,8 @@ function createGatewayProvider(options = {}) {
|
|
|
7943
8153
|
};
|
|
7944
8154
|
provider.getAvailableModels = getAvailableModels;
|
|
7945
8155
|
provider.getCredits = getCredits;
|
|
8156
|
+
provider.getSpendReport = getSpendReport;
|
|
8157
|
+
provider.getGenerationInfo = getGenerationInfo;
|
|
7946
8158
|
provider.imageModel = (modelId) => {
|
|
7947
8159
|
return new GatewayImageModel(modelId, {
|
|
7948
8160
|
provider: "gateway",
|