@sentry/mcp-server 0.26.0 → 0.28.0
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/dist/cli/parse.cjs +1 -1
- package/dist/cli/parse.d.cts +1 -1
- package/dist/cli/parse.d.cts.map +1 -1
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.d.ts.map +1 -1
- package/dist/cli/parse.js +1 -1
- package/dist/cli/resolve.cjs +1 -1
- package/dist/cli/resolve.d.cts +1 -1
- package/dist/cli/resolve.d.ts +1 -1
- package/dist/cli/resolve.js +1 -1
- package/dist/cli/types.d.cts +1 -1
- package/dist/cli/types.d.ts +1 -1
- package/dist/cli/usage.cjs +1 -1
- package/dist/cli/usage.js +1 -1
- package/dist/{config-BoFBjXRq-CGHqlnJ9.cjs → config-CEjP2CYO-CZKUamRu.cjs} +2 -2
- package/dist/{config-BoFBjXRq-CGHqlnJ9.cjs.map → config-CEjP2CYO-CZKUamRu.cjs.map} +1 -1
- package/dist/{config-BoFBjXRq-CMdBQOkQ.js → config-CEjP2CYO-DNCUeo0R.js} +2 -2
- package/dist/{config-BoFBjXRq-CMdBQOkQ.js.map → config-CEjP2CYO-DNCUeo0R.js.map} +1 -1
- package/dist/config-CwE3_vz4.cjs +7 -0
- package/dist/{config-BEgU9ylR.js → config-HqPAzoGg.js} +1 -1
- package/dist/index.cjs +1910 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1908 -143
- package/dist/index.js.map +1 -1
- package/dist/{parse-46t_fITC.js → parse-B9o4fVyT.js} +12 -1
- package/dist/parse-B9o4fVyT.js.map +1 -0
- package/dist/{parse-BjIH83SX.cjs → parse-c_3eNB2Z.cjs} +12 -1
- package/dist/parse-c_3eNB2Z.cjs.map +1 -0
- package/dist/{resolve-CdTP9riu.cjs → resolve-DFUPLqHE.cjs} +11 -1
- package/dist/resolve-DFUPLqHE.cjs.map +1 -0
- package/dist/{resolve-Cg3SH2zt.js → resolve-DpUhCbfh.js} +11 -1
- package/dist/resolve-DpUhCbfh.js.map +1 -0
- package/dist/{stdio-C47PFfCl.js → stdio-By-q6V_4.js} +3 -3
- package/dist/{stdio-C47PFfCl.js.map → stdio-By-q6V_4.js.map} +1 -1
- package/dist/{stdio-DFfz0_Ua.cjs → stdio-CjpLGbyD.cjs} +3 -3
- package/dist/{stdio-DFfz0_Ua.cjs.map → stdio-CjpLGbyD.cjs.map} +1 -1
- package/dist/transports/stdio.cjs +1 -1
- package/dist/transports/stdio.js +1 -1
- package/dist/{types-D5f00mg9.d.ts → types--Ysz5ZMd.d.cts} +12 -1
- package/dist/types--Ysz5ZMd.d.cts.map +1 -0
- package/dist/{types-DpmAC3S8.d.cts → types-BlGRNCea.d.ts} +12 -1
- package/dist/types-BlGRNCea.d.ts.map +1 -0
- package/dist/{usage-DD58xBe3.cjs → usage-D9Tpyb5N.cjs} +15 -5
- package/dist/usage-D9Tpyb5N.cjs.map +1 -0
- package/dist/{usage-BzYvqaru.js → usage-DR57Krum.js} +15 -5
- package/dist/usage-DR57Krum.js.map +1 -0
- package/package.json +6 -6
- package/dist/config-rZ982IEm.cjs +0 -7
- package/dist/parse-46t_fITC.js.map +0 -1
- package/dist/parse-BjIH83SX.cjs.map +0 -1
- package/dist/resolve-CdTP9riu.cjs.map +0 -1
- package/dist/resolve-Cg3SH2zt.js.map +0 -1
- package/dist/types-D5f00mg9.d.ts.map +0 -1
- package/dist/types-DpmAC3S8.d.cts.map +0 -1
- package/dist/usage-BzYvqaru.js.map +0 -1
- package/dist/usage-DD58xBe3.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_chunk = require('./chunk-DoeelZqw.cjs');
|
|
3
|
-
const require_resolve = require('./resolve-
|
|
4
|
-
const require_stdio = require('./stdio-
|
|
5
|
-
const
|
|
6
|
-
const require_usage = require('./usage-
|
|
7
|
-
const require_parse = require('./parse-
|
|
3
|
+
const require_resolve = require('./resolve-DFUPLqHE.cjs');
|
|
4
|
+
const require_stdio = require('./stdio-CjpLGbyD.cjs');
|
|
5
|
+
const require_config_CEjP2CYO = require('./config-CEjP2CYO-CZKUamRu.cjs');
|
|
6
|
+
const require_usage = require('./usage-D9Tpyb5N.cjs');
|
|
7
|
+
const require_parse = require('./parse-c_3eNB2Z.cjs');
|
|
8
8
|
const zod = require_chunk.__toESM(require("zod"));
|
|
9
9
|
const node_util = require_chunk.__toESM(require("node:util"));
|
|
10
10
|
const __sentry_core = require_chunk.__toESM(require("@sentry/core"));
|
|
@@ -1752,7 +1752,7 @@ function logIssue(error, contextsOrOptions, attachmentsArg) {
|
|
|
1752
1752
|
}
|
|
1753
1753
|
|
|
1754
1754
|
//#endregion
|
|
1755
|
-
//#region ../mcp-core/dist/schema-
|
|
1755
|
+
//#region ../mcp-core/dist/schema-VoUcElu5.js
|
|
1756
1756
|
/**
|
|
1757
1757
|
* Schema for Sentry API error responses.
|
|
1758
1758
|
*
|
|
@@ -2175,6 +2175,31 @@ const EventAttachmentSchema = zod.z.object({
|
|
|
2175
2175
|
});
|
|
2176
2176
|
const EventAttachmentListSchema = zod.z.array(EventAttachmentSchema);
|
|
2177
2177
|
/**
|
|
2178
|
+
* Schema for individual tag values within an issue's tag distribution.
|
|
2179
|
+
*
|
|
2180
|
+
* Represents a single value's occurrence count and percentage within a tag.
|
|
2181
|
+
*/
|
|
2182
|
+
const IssueTagValueSchema = zod.z.object({
|
|
2183
|
+
key: zod.z.string().nullable().optional(),
|
|
2184
|
+
name: zod.z.string().nullable().optional(),
|
|
2185
|
+
value: zod.z.string().nullable(),
|
|
2186
|
+
count: zod.z.number(),
|
|
2187
|
+
lastSeen: zod.z.string().datetime().nullable().optional(),
|
|
2188
|
+
firstSeen: zod.z.string().datetime().nullable().optional()
|
|
2189
|
+
});
|
|
2190
|
+
/**
|
|
2191
|
+
* Schema for Sentry issue tag values response.
|
|
2192
|
+
*
|
|
2193
|
+
* Contains aggregate counts of unique tag values for an issue,
|
|
2194
|
+
* useful for understanding the distribution of tags like URL, browser, etc.
|
|
2195
|
+
*/
|
|
2196
|
+
const IssueTagValuesSchema = zod.z.object({
|
|
2197
|
+
key: zod.z.string(),
|
|
2198
|
+
name: zod.z.string(),
|
|
2199
|
+
totalValues: zod.z.number(),
|
|
2200
|
+
topValues: zod.z.array(IssueTagValueSchema)
|
|
2201
|
+
});
|
|
2202
|
+
/**
|
|
2178
2203
|
* Schema for Sentry trace metadata response.
|
|
2179
2204
|
*
|
|
2180
2205
|
* Contains high-level statistics about a trace including span counts,
|
|
@@ -2464,7 +2489,7 @@ function createApiError(message, status, detail, responseBody) {
|
|
|
2464
2489
|
}
|
|
2465
2490
|
|
|
2466
2491
|
//#endregion
|
|
2467
|
-
//#region ../mcp-core/dist/client-
|
|
2492
|
+
//#region ../mcp-core/dist/client-B2nQcl5S.js
|
|
2468
2493
|
/**
|
|
2469
2494
|
* Mapping of common network error codes to user-friendly messages.
|
|
2470
2495
|
* These help users understand and resolve connection issues.
|
|
@@ -2562,6 +2587,27 @@ var SentryApiService = class {
|
|
|
2562
2587
|
return require_resolve.isSentryHost(this.host);
|
|
2563
2588
|
}
|
|
2564
2589
|
/**
|
|
2590
|
+
* Validates and applies time parameters to a URLSearchParams object.
|
|
2591
|
+
*
|
|
2592
|
+
* Enforces mutual exclusivity between relative (statsPeriod) and
|
|
2593
|
+
* absolute (start/end) time ranges, and ensures start/end are paired.
|
|
2594
|
+
*
|
|
2595
|
+
* @param queryParams The URLSearchParams to modify
|
|
2596
|
+
* @param statsPeriod Relative time period (e.g., "24h", "7d")
|
|
2597
|
+
* @param start Absolute start time (ISO 8601)
|
|
2598
|
+
* @param end Absolute end time (ISO 8601)
|
|
2599
|
+
* @throws {ApiValidationError} If time parameters are invalid
|
|
2600
|
+
*/
|
|
2601
|
+
applyTimeParams(queryParams, statsPeriod, start, end) {
|
|
2602
|
+
if (statsPeriod && (start || end)) throw new ApiValidationError("Cannot use both statsPeriod and start/end parameters. Use either statsPeriod for relative time or start/end for absolute time.");
|
|
2603
|
+
if (start && !end || !start && end) throw new ApiValidationError("Both start and end parameters must be provided together for absolute time ranges.");
|
|
2604
|
+
if (statsPeriod) queryParams.set("statsPeriod", statsPeriod);
|
|
2605
|
+
else if (start && end) {
|
|
2606
|
+
queryParams.set("start", start);
|
|
2607
|
+
queryParams.set("end", end);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
/**
|
|
2565
2611
|
* Internal method for making authenticated requests to Sentry API.
|
|
2566
2612
|
*
|
|
2567
2613
|
* Handles:
|
|
@@ -3156,13 +3202,7 @@ var SentryApiService = class {
|
|
|
3156
3202
|
const searchQuery = new URLSearchParams();
|
|
3157
3203
|
if (dataset) searchQuery.set("dataset", dataset);
|
|
3158
3204
|
if (project) searchQuery.set("project", project);
|
|
3159
|
-
|
|
3160
|
-
if (start && !end || !start && end) throw new ApiValidationError("Both start and end parameters must be provided together for absolute time ranges.");
|
|
3161
|
-
if (statsPeriod) searchQuery.set("statsPeriod", statsPeriod);
|
|
3162
|
-
else if (start && end) {
|
|
3163
|
-
searchQuery.set("start", start);
|
|
3164
|
-
searchQuery.set("end", end);
|
|
3165
|
-
}
|
|
3205
|
+
this.applyTimeParams(searchQuery, statsPeriod, start, end);
|
|
3166
3206
|
if (useCache !== void 0) searchQuery.set("useCache", useCache ? "1" : "0");
|
|
3167
3207
|
if (useFlagsBackend !== void 0) searchQuery.set("useFlagsBackend", useFlagsBackend ? "1" : "0");
|
|
3168
3208
|
const body = await this.requestJSON(searchQuery.toString() ? `/organizations/${organizationSlug}/tags/?${searchQuery.toString()}` : `/organizations/${organizationSlug}/tags/`, void 0, opts);
|
|
@@ -3202,13 +3242,7 @@ var SentryApiService = class {
|
|
|
3202
3242
|
queryParams.set("itemType", itemType);
|
|
3203
3243
|
queryParams.set("attributeType", attributeType);
|
|
3204
3244
|
if (project) queryParams.set("project", project);
|
|
3205
|
-
|
|
3206
|
-
if (start && !end || !start && end) throw new ApiValidationError("Both start and end parameters must be provided together for absolute time ranges.");
|
|
3207
|
-
if (statsPeriod) queryParams.set("statsPeriod", statsPeriod);
|
|
3208
|
-
else if (start && end) {
|
|
3209
|
-
queryParams.set("start", start);
|
|
3210
|
-
queryParams.set("end", end);
|
|
3211
|
-
}
|
|
3245
|
+
this.applyTimeParams(queryParams, statsPeriod, start, end);
|
|
3212
3246
|
const url = `/organizations/${organizationSlug}/trace-items/attributes/?${queryParams.toString()}`;
|
|
3213
3247
|
const body = await this.requestJSON(url, void 0, opts);
|
|
3214
3248
|
return Array.isArray(body) ? body : [];
|
|
@@ -3262,6 +3296,35 @@ var SentryApiService = class {
|
|
|
3262
3296
|
const body = await this.requestJSON(`/organizations/${organizationSlug}/issues/${issueId}/`, void 0, opts);
|
|
3263
3297
|
return IssueSchema.parse(body);
|
|
3264
3298
|
}
|
|
3299
|
+
/**
|
|
3300
|
+
* Retrieves tag value distribution for a specific issue.
|
|
3301
|
+
*
|
|
3302
|
+
* Returns aggregate counts of unique tag values, useful for understanding
|
|
3303
|
+
* how an issue is distributed across different tag values (e.g., URLs,
|
|
3304
|
+
* browsers, environments).
|
|
3305
|
+
*
|
|
3306
|
+
* @param params Query parameters
|
|
3307
|
+
* @param params.organizationSlug Organization identifier
|
|
3308
|
+
* @param params.issueId Issue identifier (short ID or numeric ID)
|
|
3309
|
+
* @param params.tagKey Tag key to get values for (e.g., "url", "browser", "environment")
|
|
3310
|
+
* @param opts Request options
|
|
3311
|
+
* @returns Tag value distribution with counts and percentages
|
|
3312
|
+
*
|
|
3313
|
+
* @example
|
|
3314
|
+
* ```typescript
|
|
3315
|
+
* const tagValues = await apiService.getIssueTagValues({
|
|
3316
|
+
* organizationSlug: "my-org",
|
|
3317
|
+
* issueId: "PROJECT-123",
|
|
3318
|
+
* tagKey: "url"
|
|
3319
|
+
* });
|
|
3320
|
+
* console.log(`Total unique values: ${tagValues.totalValues}`);
|
|
3321
|
+
* tagValues.topValues.forEach(v => console.log(`${v.value}: ${v.count}`));
|
|
3322
|
+
* ```
|
|
3323
|
+
*/
|
|
3324
|
+
async getIssueTagValues({ organizationSlug, issueId, tagKey }, opts) {
|
|
3325
|
+
const body = await this.requestJSON(`/organizations/${organizationSlug}/issues/${issueId}/tags/${tagKey}/`, void 0, opts);
|
|
3326
|
+
return IssueTagValuesSchema.parse(body);
|
|
3327
|
+
}
|
|
3265
3328
|
async getEventForIssue({ organizationSlug, issueId, eventId }, opts) {
|
|
3266
3329
|
const body = await this.requestJSON(`/organizations/${organizationSlug}/issues/${issueId}/events/${eventId}/`, void 0, opts);
|
|
3267
3330
|
const parseResult = EventSchema.safeParse(body);
|
|
@@ -3402,13 +3465,7 @@ var SentryApiService = class {
|
|
|
3402
3465
|
queryParams.set("per_page", params.limit.toString());
|
|
3403
3466
|
queryParams.set("query", params.query);
|
|
3404
3467
|
queryParams.set("dataset", "errors");
|
|
3405
|
-
|
|
3406
|
-
if (params.start && !params.end || !params.start && params.end) throw new ApiValidationError("Both start and end parameters must be provided together for absolute time ranges.");
|
|
3407
|
-
if (params.statsPeriod) queryParams.set("statsPeriod", params.statsPeriod);
|
|
3408
|
-
else if (params.start && params.end) {
|
|
3409
|
-
queryParams.set("start", params.start);
|
|
3410
|
-
queryParams.set("end", params.end);
|
|
3411
|
-
}
|
|
3468
|
+
this.applyTimeParams(queryParams, params.statsPeriod, params.start, params.end);
|
|
3412
3469
|
if (params.projectId) queryParams.set("project", params.projectId);
|
|
3413
3470
|
let apiSort = params.sort;
|
|
3414
3471
|
if (params.sort?.includes("(") && !params.sort?.includes("equation|")) {
|
|
@@ -3436,13 +3493,7 @@ var SentryApiService = class {
|
|
|
3436
3493
|
queryParams.set("per_page", params.limit.toString());
|
|
3437
3494
|
queryParams.set("query", params.query);
|
|
3438
3495
|
queryParams.set("dataset", params.dataset);
|
|
3439
|
-
|
|
3440
|
-
if (params.start && !params.end || !params.start && params.end) throw new ApiValidationError("Both start and end parameters must be provided together for absolute time ranges.");
|
|
3441
|
-
if (params.statsPeriod) queryParams.set("statsPeriod", params.statsPeriod);
|
|
3442
|
-
else if (params.start && params.end) {
|
|
3443
|
-
queryParams.set("start", params.start);
|
|
3444
|
-
queryParams.set("end", params.end);
|
|
3445
|
-
}
|
|
3496
|
+
this.applyTimeParams(queryParams, params.statsPeriod, params.start, params.end);
|
|
3446
3497
|
if (params.projectId) queryParams.set("project", params.projectId);
|
|
3447
3498
|
if (params.dataset === "spans") queryParams.set("sampling", "NORMAL");
|
|
3448
3499
|
let apiSort = params.sort;
|
|
@@ -3605,7 +3656,7 @@ function validateRegionUrl(regionUrl, baseHost) {
|
|
|
3605
3656
|
}
|
|
3606
3657
|
|
|
3607
3658
|
//#endregion
|
|
3608
|
-
//#region ../mcp-core/dist/api-
|
|
3659
|
+
//#region ../mcp-core/dist/api-DVbaHIM5.js
|
|
3609
3660
|
/**
|
|
3610
3661
|
* Create a Sentry API service from server context with optional region override
|
|
3611
3662
|
* @param context - Server context containing host and access token
|
|
@@ -3626,7 +3677,7 @@ function apiServiceFromContext(context$1, opts = {}) {
|
|
|
3626
3677
|
}
|
|
3627
3678
|
|
|
3628
3679
|
//#endregion
|
|
3629
|
-
//#region ../mcp-core/dist/whoami-
|
|
3680
|
+
//#region ../mcp-core/dist/whoami-CEHtgXJv.js
|
|
3630
3681
|
var whoami_default = defineTool({
|
|
3631
3682
|
name: "whoami",
|
|
3632
3683
|
description: [
|
|
@@ -3659,7 +3710,7 @@ var whoami_default = defineTool({
|
|
|
3659
3710
|
});
|
|
3660
3711
|
|
|
3661
3712
|
//#endregion
|
|
3662
|
-
//#region ../mcp-core/dist/find-organizations-
|
|
3713
|
+
//#region ../mcp-core/dist/find-organizations-Bs2wsqQ7.js
|
|
3663
3714
|
const RESULT_LIMIT$2 = 25;
|
|
3664
3715
|
var find_organizations_default = defineTool({
|
|
3665
3716
|
name: "find_organizations",
|
|
@@ -3711,7 +3762,7 @@ var find_organizations_default = defineTool({
|
|
|
3711
3762
|
});
|
|
3712
3763
|
|
|
3713
3764
|
//#endregion
|
|
3714
|
-
//#region ../mcp-core/dist/find-teams-
|
|
3765
|
+
//#region ../mcp-core/dist/find-teams-CgsSmQ8X.js
|
|
3715
3766
|
const RESULT_LIMIT$1 = 25;
|
|
3716
3767
|
var find_teams_default = defineTool({
|
|
3717
3768
|
name: "find_teams",
|
|
@@ -3759,7 +3810,7 @@ var find_teams_default = defineTool({
|
|
|
3759
3810
|
});
|
|
3760
3811
|
|
|
3761
3812
|
//#endregion
|
|
3762
|
-
//#region ../mcp-core/dist/find-projects-
|
|
3813
|
+
//#region ../mcp-core/dist/find-projects-Cxw1nnPQ.js
|
|
3763
3814
|
const RESULT_LIMIT = 25;
|
|
3764
3815
|
var find_projects_default = defineTool({
|
|
3765
3816
|
name: "find_projects",
|
|
@@ -3803,7 +3854,7 @@ var find_projects_default = defineTool({
|
|
|
3803
3854
|
});
|
|
3804
3855
|
|
|
3805
3856
|
//#endregion
|
|
3806
|
-
//#region ../mcp-core/dist/find-releases-
|
|
3857
|
+
//#region ../mcp-core/dist/find-releases-zWgFsagR.js
|
|
3807
3858
|
var find_releases_default = defineTool({
|
|
3808
3859
|
name: "find_releases",
|
|
3809
3860
|
skills: ["inspect"],
|
|
@@ -5048,7 +5099,7 @@ function enhanceNotFoundError(error, params) {
|
|
|
5048
5099
|
}
|
|
5049
5100
|
|
|
5050
5101
|
//#endregion
|
|
5051
|
-
//#region ../mcp-core/dist/get-issue-details-
|
|
5102
|
+
//#region ../mcp-core/dist/get-issue-details-CsNkINzN.js
|
|
5052
5103
|
var get_issue_details_default = defineTool({
|
|
5053
5104
|
name: "get_issue_details",
|
|
5054
5105
|
skills: [
|
|
@@ -5229,7 +5280,122 @@ function shouldFetchTraceForEvent(event) {
|
|
|
5229
5280
|
}
|
|
5230
5281
|
|
|
5231
5282
|
//#endregion
|
|
5232
|
-
//#region ../mcp-core/dist/get-
|
|
5283
|
+
//#region ../mcp-core/dist/get-issue-tag-values-B4lzlivL.js
|
|
5284
|
+
var get_issue_tag_values_default = defineTool({
|
|
5285
|
+
name: "get_issue_tag_values",
|
|
5286
|
+
skills: ["inspect"],
|
|
5287
|
+
requiredScopes: ["event:read"],
|
|
5288
|
+
description: [
|
|
5289
|
+
"Get tag value distribution for a specific Sentry issue.",
|
|
5290
|
+
"",
|
|
5291
|
+
"Use this tool when you need to:",
|
|
5292
|
+
"- Understand how an issue is distributed across different tag values",
|
|
5293
|
+
"- Get aggregate counts of unique tag values (e.g., 'how many unique URLs are affected')",
|
|
5294
|
+
"- Analyze which browsers, environments, or URLs are most impacted by an issue",
|
|
5295
|
+
"- View the tag distributions page data programmatically",
|
|
5296
|
+
"",
|
|
5297
|
+
"Common tag keys:",
|
|
5298
|
+
"- `url`: Request URLs affected by the issue",
|
|
5299
|
+
"- `browser`: Browser types and versions",
|
|
5300
|
+
"- `browser.name`: Browser names only",
|
|
5301
|
+
"- `os`: Operating systems",
|
|
5302
|
+
"- `environment`: Deployment environments (production, staging, etc.)",
|
|
5303
|
+
"- `release`: Software releases",
|
|
5304
|
+
"- `device`: Device types",
|
|
5305
|
+
"- `user`: Affected users",
|
|
5306
|
+
"",
|
|
5307
|
+
"<examples>",
|
|
5308
|
+
"### Get URL distribution for an issue",
|
|
5309
|
+
"```",
|
|
5310
|
+
"get_issue_tag_values(organizationSlug='my-organization', issueId='PROJECT-123', tagKey='url')",
|
|
5311
|
+
"```",
|
|
5312
|
+
"",
|
|
5313
|
+
"### Get browser distribution using issue URL",
|
|
5314
|
+
"```",
|
|
5315
|
+
"get_issue_tag_values(issueUrl='https://sentry.io/issues/PROJECT-123/', tagKey='browser')",
|
|
5316
|
+
"```",
|
|
5317
|
+
"",
|
|
5318
|
+
"### Get environment distribution",
|
|
5319
|
+
"```",
|
|
5320
|
+
"get_issue_tag_values(organizationSlug='my-organization', issueId='PROJECT-123', tagKey='environment')",
|
|
5321
|
+
"```",
|
|
5322
|
+
"</examples>",
|
|
5323
|
+
"",
|
|
5324
|
+
"<hints>",
|
|
5325
|
+
"- If user provides a Sentry URL, pass the ENTIRE URL to issueUrl parameter unchanged",
|
|
5326
|
+
"- Common tag keys: url, browser, browser.name, os, environment, release, device, user",
|
|
5327
|
+
"- Tag keys are case-sensitive",
|
|
5328
|
+
"</hints>"
|
|
5329
|
+
].join("\n"),
|
|
5330
|
+
inputSchema: {
|
|
5331
|
+
organizationSlug: ParamOrganizationSlug.optional(),
|
|
5332
|
+
regionUrl: ParamRegionUrl.nullable().default(null),
|
|
5333
|
+
issueId: ParamIssueShortId.optional(),
|
|
5334
|
+
issueUrl: ParamIssueUrl.optional(),
|
|
5335
|
+
tagKey: zod.z.string().trim().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/, "Tag key must contain only alphanumeric characters, dots, hyphens, and underscores, and must start with an alphanumeric character").describe("The tag key to get values for (e.g., 'url', 'browser', 'environment', 'release').")
|
|
5336
|
+
},
|
|
5337
|
+
annotations: {
|
|
5338
|
+
readOnlyHint: true,
|
|
5339
|
+
openWorldHint: true
|
|
5340
|
+
},
|
|
5341
|
+
async handler(params, context$1) {
|
|
5342
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
5343
|
+
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
5344
|
+
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
5345
|
+
if (!params.tagKey) throw new UserInputError("`tagKey` is required. Common values: url, browser, environment, release, os, device, user");
|
|
5346
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
5347
|
+
organizationSlug: params.organizationSlug,
|
|
5348
|
+
issueId: params.issueId,
|
|
5349
|
+
issueUrl: params.issueUrl
|
|
5350
|
+
});
|
|
5351
|
+
(0, __sentry_core.setTag)("organization.slug", orgSlug);
|
|
5352
|
+
let tagValues;
|
|
5353
|
+
try {
|
|
5354
|
+
tagValues = await apiService.getIssueTagValues({
|
|
5355
|
+
organizationSlug: orgSlug,
|
|
5356
|
+
issueId: parsedIssueId,
|
|
5357
|
+
tagKey: params.tagKey
|
|
5358
|
+
});
|
|
5359
|
+
} catch (error) {
|
|
5360
|
+
if (error instanceof ApiNotFoundError) throw enhanceNotFoundError(error, {
|
|
5361
|
+
organizationSlug: orgSlug,
|
|
5362
|
+
issueId: parsedIssueId,
|
|
5363
|
+
tagKey: params.tagKey
|
|
5364
|
+
});
|
|
5365
|
+
throw error;
|
|
5366
|
+
}
|
|
5367
|
+
let output = `# Tag Distribution: ${tagValues.name}\n\n`;
|
|
5368
|
+
output += `**Issue**: ${parsedIssueId}\n`;
|
|
5369
|
+
output += `**Tag Key**: \`${tagValues.key}\`\n`;
|
|
5370
|
+
output += `**Total Unique Values**: ${tagValues.totalValues}\n\n`;
|
|
5371
|
+
if (tagValues.topValues.length === 0) {
|
|
5372
|
+
output += "No values found for this tag.\n";
|
|
5373
|
+
return output;
|
|
5374
|
+
}
|
|
5375
|
+
output += "## Top Values\n\n";
|
|
5376
|
+
output += "| Value | Count | First Seen | Last Seen |\n";
|
|
5377
|
+
output += "|-------|-------|------------|----------|\n";
|
|
5378
|
+
for (const value of tagValues.topValues) {
|
|
5379
|
+
const firstSeen = value.firstSeen ? new Date(value.firstSeen).toISOString().split("T")[0] : "-";
|
|
5380
|
+
const lastSeen = value.lastSeen ? new Date(value.lastSeen).toISOString().split("T")[0] : "-";
|
|
5381
|
+
const rawValue = value.value ?? "(null)";
|
|
5382
|
+
let displayValue = rawValue.length > 60 ? `${rawValue.substring(0, 57)}...` : rawValue;
|
|
5383
|
+
displayValue = displayValue.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/`/g, "\\`").replace(/\n/g, " ");
|
|
5384
|
+
output += `| \`${displayValue}\` | ${value.count} | ${firstSeen} | ${lastSeen} |\n`;
|
|
5385
|
+
}
|
|
5386
|
+
if (tagValues.topValues.length > 0 && tagValues.totalValues > 0) {
|
|
5387
|
+
const shownCount = tagValues.topValues.length;
|
|
5388
|
+
output += `\n*Showing top ${shownCount} of ${tagValues.totalValues} unique values*\n`;
|
|
5389
|
+
}
|
|
5390
|
+
output += "\n## Using this information\n\n";
|
|
5391
|
+
output += `- Use \`get_issue_details(organizationSlug='${orgSlug}', issueId='${parsedIssueId}')\` to see the full issue details\n`;
|
|
5392
|
+
output += `- Try other tag keys like: url, browser, environment, release, os, device, user\n`;
|
|
5393
|
+
return output;
|
|
5394
|
+
}
|
|
5395
|
+
});
|
|
5396
|
+
|
|
5397
|
+
//#endregion
|
|
5398
|
+
//#region ../mcp-core/dist/get-trace-details-DAPondqS.js
|
|
5233
5399
|
const MAX_DEPTH = 2;
|
|
5234
5400
|
const MINIMUM_DURATION_THRESHOLD_MS = 10;
|
|
5235
5401
|
const MIN_MEANINGFUL_CHILD_DURATION = 5;
|
|
@@ -5528,7 +5694,7 @@ function formatTraceOutput({ organizationSlug, traceId, traceMeta, trace: trace$
|
|
|
5528
5694
|
}
|
|
5529
5695
|
|
|
5530
5696
|
//#endregion
|
|
5531
|
-
//#region ../mcp-core/dist/get-event-attachment-
|
|
5697
|
+
//#region ../mcp-core/dist/get-event-attachment-C-huGpTH.js
|
|
5532
5698
|
var get_event_attachment_default = defineTool({
|
|
5533
5699
|
name: "get_event_attachment",
|
|
5534
5700
|
skills: ["inspect"],
|
|
@@ -5664,7 +5830,7 @@ var get_event_attachment_default = defineTool({
|
|
|
5664
5830
|
});
|
|
5665
5831
|
|
|
5666
5832
|
//#endregion
|
|
5667
|
-
//#region ../mcp-core/dist/formatting-
|
|
5833
|
+
//#region ../mcp-core/dist/formatting-CIwRyNGU.js
|
|
5668
5834
|
/**
|
|
5669
5835
|
* Helper function to format assignedTo field for display
|
|
5670
5836
|
*/
|
|
@@ -5676,7 +5842,7 @@ function formatAssignedTo(assignedTo) {
|
|
|
5676
5842
|
}
|
|
5677
5843
|
|
|
5678
5844
|
//#endregion
|
|
5679
|
-
//#region ../mcp-core/dist/update-issue-
|
|
5845
|
+
//#region ../mcp-core/dist/update-issue-BArI_SjL.js
|
|
5680
5846
|
var update_issue_default = defineTool({
|
|
5681
5847
|
name: "update_issue",
|
|
5682
5848
|
skills: ["triage"],
|
|
@@ -5973,6 +6139,20 @@ var name10$1 = "AI_NoSuchModelError";
|
|
|
5973
6139
|
var marker11$1 = `vercel.ai.error.${name10$1}`;
|
|
5974
6140
|
var symbol11$1 = Symbol.for(marker11$1);
|
|
5975
6141
|
var _a11$1;
|
|
6142
|
+
var NoSuchModelError = class extends AISDKError {
|
|
6143
|
+
constructor({ errorName = name10$1, modelId, modelType, message = `No such ${modelType}: ${modelId}` }) {
|
|
6144
|
+
super({
|
|
6145
|
+
name: errorName,
|
|
6146
|
+
message
|
|
6147
|
+
});
|
|
6148
|
+
this[_a11$1] = true;
|
|
6149
|
+
this.modelId = modelId;
|
|
6150
|
+
this.modelType = modelType;
|
|
6151
|
+
}
|
|
6152
|
+
static isInstance(error) {
|
|
6153
|
+
return AISDKError.hasMarker(error, marker11$1);
|
|
6154
|
+
}
|
|
6155
|
+
};
|
|
5976
6156
|
_a11$1 = symbol11$1;
|
|
5977
6157
|
var name11$1 = "AI_TooManyEmbeddingValuesForCallError";
|
|
5978
6158
|
var marker12$1 = `vercel.ai.error.${name11$1}`;
|
|
@@ -6508,6 +6688,10 @@ var postToApi = async ({ url, headers = {}, body, successfulResponseHandler, fai
|
|
|
6508
6688
|
throw error;
|
|
6509
6689
|
}
|
|
6510
6690
|
};
|
|
6691
|
+
async function resolve(value) {
|
|
6692
|
+
if (typeof value === "function") value = value();
|
|
6693
|
+
return Promise.resolve(value);
|
|
6694
|
+
}
|
|
6511
6695
|
var createJsonErrorResponseHandler = ({ errorSchema, errorToMessage, isRetryable }) => async ({ response, url, requestBodyValues }) => {
|
|
6512
6696
|
const responseBody = await response.text();
|
|
6513
6697
|
const responseHeaders = extractResponseHeaders(response);
|
|
@@ -6823,7 +7007,7 @@ function getResponseMetadata({ id, model, created }) {
|
|
|
6823
7007
|
timestamp: created != null ? /* @__PURE__ */ new Date(created * 1e3) : void 0
|
|
6824
7008
|
};
|
|
6825
7009
|
}
|
|
6826
|
-
function prepareTools({ mode, useLegacyFunctionCalling = false, structuredOutputs }) {
|
|
7010
|
+
function prepareTools$1({ mode, useLegacyFunctionCalling = false, structuredOutputs }) {
|
|
6827
7011
|
var _a$2;
|
|
6828
7012
|
const tools = ((_a$2 = mode.tools) == null ? void 0 : _a$2.length) ? mode.tools : void 0;
|
|
6829
7013
|
const toolWarnings = [];
|
|
@@ -7051,7 +7235,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
7051
7235
|
}
|
|
7052
7236
|
switch (type) {
|
|
7053
7237
|
case "regular": {
|
|
7054
|
-
const { tools, tool_choice, functions, function_call, toolWarnings } = prepareTools({
|
|
7238
|
+
const { tools, tool_choice, functions, function_call, toolWarnings } = prepareTools$1({
|
|
7055
7239
|
mode,
|
|
7056
7240
|
useLegacyFunctionCalling,
|
|
7057
7241
|
structuredOutputs: this.supportsStructuredOutputs
|
|
@@ -8946,49 +9130,1278 @@ function createOpenAI(options = {}) {
|
|
|
8946
9130
|
provider.tools = openaiTools;
|
|
8947
9131
|
return provider;
|
|
8948
9132
|
}
|
|
8949
|
-
var openai = createOpenAI({ compatibility: "strict" });
|
|
9133
|
+
var openai = createOpenAI({ compatibility: "strict" });
|
|
9134
|
+
|
|
9135
|
+
//#endregion
|
|
9136
|
+
//#region ../mcp-core/dist/openai-provider-Cc13TpEA.js
|
|
9137
|
+
const DEFAULT_OPENAI_MODEL = "gpt-5";
|
|
9138
|
+
let configuredBaseUrl$1;
|
|
9139
|
+
/**
|
|
9140
|
+
* Configure the OpenAI base URL (CLI flag only, not environment variable).
|
|
9141
|
+
* This must be called explicitly - it cannot be set via environment variables for security.
|
|
9142
|
+
*/
|
|
9143
|
+
function setOpenAIBaseUrl(baseUrl) {
|
|
9144
|
+
configuredBaseUrl$1 = baseUrl;
|
|
9145
|
+
}
|
|
9146
|
+
/**
|
|
9147
|
+
* Retrieve an OpenAI language model configured from environment variables and explicit config.
|
|
9148
|
+
*
|
|
9149
|
+
* Works with:
|
|
9150
|
+
* - OpenAI API directly (default)
|
|
9151
|
+
* - Any OpenAI-compatible API via custom base URL (Vercel AI Gateway, Azure OpenAI, etc.)
|
|
9152
|
+
*
|
|
9153
|
+
* Configuration:
|
|
9154
|
+
* - OPENAI_API_KEY: API key for authentication (required)
|
|
9155
|
+
* - OPENAI_MODEL: Model to use (default: "gpt-5") - env var OK
|
|
9156
|
+
* - Base URL: Must be set via setOpenAIBaseUrl() - NOT from env vars (security risk)
|
|
9157
|
+
*
|
|
9158
|
+
* Note: Model name format depends on your provider:
|
|
9159
|
+
* - Direct OpenAI: "gpt-4o", "gpt-4-turbo", etc.
|
|
9160
|
+
* - Vercel AI Gateway: "openai/gpt-4o", "anthropic/claude-sonnet-4.5", etc.
|
|
9161
|
+
* - Other providers: Check their documentation
|
|
9162
|
+
*/
|
|
9163
|
+
function getOpenAIModel(model) {
|
|
9164
|
+
const defaultModel = process.env.OPENAI_MODEL || DEFAULT_OPENAI_MODEL;
|
|
9165
|
+
const factory = createOpenAI({
|
|
9166
|
+
...configuredBaseUrl$1 && { baseURL: configuredBaseUrl$1 },
|
|
9167
|
+
headers: { "User-Agent": require_stdio.USER_AGENT }
|
|
9168
|
+
});
|
|
9169
|
+
return factory(model ?? defaultModel);
|
|
9170
|
+
}
|
|
9171
|
+
|
|
9172
|
+
//#endregion
|
|
9173
|
+
//#region ../../node_modules/.pnpm/@ai-sdk+anthropic@1.2.12_zod@3.25.76/node_modules/@ai-sdk/anthropic/dist/index.mjs
|
|
9174
|
+
var anthropicErrorDataSchema = zod.z.object({
|
|
9175
|
+
type: zod.z.literal("error"),
|
|
9176
|
+
error: zod.z.object({
|
|
9177
|
+
type: zod.z.string(),
|
|
9178
|
+
message: zod.z.string()
|
|
9179
|
+
})
|
|
9180
|
+
});
|
|
9181
|
+
var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
|
|
9182
|
+
errorSchema: anthropicErrorDataSchema,
|
|
9183
|
+
errorToMessage: (data) => data.error.message
|
|
9184
|
+
});
|
|
9185
|
+
function prepareTools(mode) {
|
|
9186
|
+
var _a$2;
|
|
9187
|
+
const tools = ((_a$2 = mode.tools) == null ? void 0 : _a$2.length) ? mode.tools : void 0;
|
|
9188
|
+
const toolWarnings = [];
|
|
9189
|
+
const betas = /* @__PURE__ */ new Set();
|
|
9190
|
+
if (tools == null) return {
|
|
9191
|
+
tools: void 0,
|
|
9192
|
+
tool_choice: void 0,
|
|
9193
|
+
toolWarnings,
|
|
9194
|
+
betas
|
|
9195
|
+
};
|
|
9196
|
+
const anthropicTools2 = [];
|
|
9197
|
+
for (const tool$1 of tools) switch (tool$1.type) {
|
|
9198
|
+
case "function":
|
|
9199
|
+
anthropicTools2.push({
|
|
9200
|
+
name: tool$1.name,
|
|
9201
|
+
description: tool$1.description,
|
|
9202
|
+
input_schema: tool$1.parameters
|
|
9203
|
+
});
|
|
9204
|
+
break;
|
|
9205
|
+
case "provider-defined":
|
|
9206
|
+
switch (tool$1.id) {
|
|
9207
|
+
case "anthropic.computer_20250124":
|
|
9208
|
+
betas.add("computer-use-2025-01-24");
|
|
9209
|
+
anthropicTools2.push({
|
|
9210
|
+
name: tool$1.name,
|
|
9211
|
+
type: "computer_20250124",
|
|
9212
|
+
display_width_px: tool$1.args.displayWidthPx,
|
|
9213
|
+
display_height_px: tool$1.args.displayHeightPx,
|
|
9214
|
+
display_number: tool$1.args.displayNumber
|
|
9215
|
+
});
|
|
9216
|
+
break;
|
|
9217
|
+
case "anthropic.computer_20241022":
|
|
9218
|
+
betas.add("computer-use-2024-10-22");
|
|
9219
|
+
anthropicTools2.push({
|
|
9220
|
+
name: tool$1.name,
|
|
9221
|
+
type: "computer_20241022",
|
|
9222
|
+
display_width_px: tool$1.args.displayWidthPx,
|
|
9223
|
+
display_height_px: tool$1.args.displayHeightPx,
|
|
9224
|
+
display_number: tool$1.args.displayNumber
|
|
9225
|
+
});
|
|
9226
|
+
break;
|
|
9227
|
+
case "anthropic.text_editor_20250124":
|
|
9228
|
+
betas.add("computer-use-2025-01-24");
|
|
9229
|
+
anthropicTools2.push({
|
|
9230
|
+
name: tool$1.name,
|
|
9231
|
+
type: "text_editor_20250124"
|
|
9232
|
+
});
|
|
9233
|
+
break;
|
|
9234
|
+
case "anthropic.text_editor_20241022":
|
|
9235
|
+
betas.add("computer-use-2024-10-22");
|
|
9236
|
+
anthropicTools2.push({
|
|
9237
|
+
name: tool$1.name,
|
|
9238
|
+
type: "text_editor_20241022"
|
|
9239
|
+
});
|
|
9240
|
+
break;
|
|
9241
|
+
case "anthropic.bash_20250124":
|
|
9242
|
+
betas.add("computer-use-2025-01-24");
|
|
9243
|
+
anthropicTools2.push({
|
|
9244
|
+
name: tool$1.name,
|
|
9245
|
+
type: "bash_20250124"
|
|
9246
|
+
});
|
|
9247
|
+
break;
|
|
9248
|
+
case "anthropic.bash_20241022":
|
|
9249
|
+
betas.add("computer-use-2024-10-22");
|
|
9250
|
+
anthropicTools2.push({
|
|
9251
|
+
name: tool$1.name,
|
|
9252
|
+
type: "bash_20241022"
|
|
9253
|
+
});
|
|
9254
|
+
break;
|
|
9255
|
+
default:
|
|
9256
|
+
toolWarnings.push({
|
|
9257
|
+
type: "unsupported-tool",
|
|
9258
|
+
tool: tool$1
|
|
9259
|
+
});
|
|
9260
|
+
break;
|
|
9261
|
+
}
|
|
9262
|
+
break;
|
|
9263
|
+
default:
|
|
9264
|
+
toolWarnings.push({
|
|
9265
|
+
type: "unsupported-tool",
|
|
9266
|
+
tool: tool$1
|
|
9267
|
+
});
|
|
9268
|
+
break;
|
|
9269
|
+
}
|
|
9270
|
+
const toolChoice = mode.toolChoice;
|
|
9271
|
+
if (toolChoice == null) return {
|
|
9272
|
+
tools: anthropicTools2,
|
|
9273
|
+
tool_choice: void 0,
|
|
9274
|
+
toolWarnings,
|
|
9275
|
+
betas
|
|
9276
|
+
};
|
|
9277
|
+
const type = toolChoice.type;
|
|
9278
|
+
switch (type) {
|
|
9279
|
+
case "auto": return {
|
|
9280
|
+
tools: anthropicTools2,
|
|
9281
|
+
tool_choice: { type: "auto" },
|
|
9282
|
+
toolWarnings,
|
|
9283
|
+
betas
|
|
9284
|
+
};
|
|
9285
|
+
case "required": return {
|
|
9286
|
+
tools: anthropicTools2,
|
|
9287
|
+
tool_choice: { type: "any" },
|
|
9288
|
+
toolWarnings,
|
|
9289
|
+
betas
|
|
9290
|
+
};
|
|
9291
|
+
case "none": return {
|
|
9292
|
+
tools: void 0,
|
|
9293
|
+
tool_choice: void 0,
|
|
9294
|
+
toolWarnings,
|
|
9295
|
+
betas
|
|
9296
|
+
};
|
|
9297
|
+
case "tool": return {
|
|
9298
|
+
tools: anthropicTools2,
|
|
9299
|
+
tool_choice: {
|
|
9300
|
+
type: "tool",
|
|
9301
|
+
name: toolChoice.toolName
|
|
9302
|
+
},
|
|
9303
|
+
toolWarnings,
|
|
9304
|
+
betas
|
|
9305
|
+
};
|
|
9306
|
+
default: {
|
|
9307
|
+
const _exhaustiveCheck = type;
|
|
9308
|
+
throw new UnsupportedFunctionalityError({ functionality: `Unsupported tool choice type: ${_exhaustiveCheck}` });
|
|
9309
|
+
}
|
|
9310
|
+
}
|
|
9311
|
+
}
|
|
9312
|
+
function convertToAnthropicMessagesPrompt({ prompt, sendReasoning, warnings }) {
|
|
9313
|
+
var _a$2, _b, _c, _d;
|
|
9314
|
+
const betas = /* @__PURE__ */ new Set();
|
|
9315
|
+
const blocks = groupIntoBlocks(prompt);
|
|
9316
|
+
let system = void 0;
|
|
9317
|
+
const messages = [];
|
|
9318
|
+
function getCacheControl(providerMetadata) {
|
|
9319
|
+
var _a2$2;
|
|
9320
|
+
const anthropic2 = providerMetadata == null ? void 0 : providerMetadata.anthropic;
|
|
9321
|
+
const cacheControlValue = (_a2$2 = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ? _a2$2 : anthropic2 == null ? void 0 : anthropic2.cache_control;
|
|
9322
|
+
return cacheControlValue;
|
|
9323
|
+
}
|
|
9324
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
9325
|
+
const block = blocks[i];
|
|
9326
|
+
const isLastBlock = i === blocks.length - 1;
|
|
9327
|
+
const type = block.type;
|
|
9328
|
+
switch (type) {
|
|
9329
|
+
case "system": {
|
|
9330
|
+
if (system != null) throw new UnsupportedFunctionalityError({ functionality: "Multiple system messages that are separated by user/assistant messages" });
|
|
9331
|
+
system = block.messages.map(({ content, providerMetadata }) => ({
|
|
9332
|
+
type: "text",
|
|
9333
|
+
text: content,
|
|
9334
|
+
cache_control: getCacheControl(providerMetadata)
|
|
9335
|
+
}));
|
|
9336
|
+
break;
|
|
9337
|
+
}
|
|
9338
|
+
case "user": {
|
|
9339
|
+
const anthropicContent = [];
|
|
9340
|
+
for (const message of block.messages) {
|
|
9341
|
+
const { role, content } = message;
|
|
9342
|
+
switch (role) {
|
|
9343
|
+
case "user": {
|
|
9344
|
+
for (let j = 0; j < content.length; j++) {
|
|
9345
|
+
const part = content[j];
|
|
9346
|
+
const isLastPart = j === content.length - 1;
|
|
9347
|
+
const cacheControl = (_a$2 = getCacheControl(part.providerMetadata)) != null ? _a$2 : isLastPart ? getCacheControl(message.providerMetadata) : void 0;
|
|
9348
|
+
switch (part.type) {
|
|
9349
|
+
case "text": {
|
|
9350
|
+
anthropicContent.push({
|
|
9351
|
+
type: "text",
|
|
9352
|
+
text: part.text,
|
|
9353
|
+
cache_control: cacheControl
|
|
9354
|
+
});
|
|
9355
|
+
break;
|
|
9356
|
+
}
|
|
9357
|
+
case "image": {
|
|
9358
|
+
anthropicContent.push({
|
|
9359
|
+
type: "image",
|
|
9360
|
+
source: part.image instanceof URL ? {
|
|
9361
|
+
type: "url",
|
|
9362
|
+
url: part.image.toString()
|
|
9363
|
+
} : {
|
|
9364
|
+
type: "base64",
|
|
9365
|
+
media_type: (_b = part.mimeType) != null ? _b : "image/jpeg",
|
|
9366
|
+
data: convertUint8ArrayToBase64(part.image)
|
|
9367
|
+
},
|
|
9368
|
+
cache_control: cacheControl
|
|
9369
|
+
});
|
|
9370
|
+
break;
|
|
9371
|
+
}
|
|
9372
|
+
case "file": {
|
|
9373
|
+
if (part.mimeType !== "application/pdf") throw new UnsupportedFunctionalityError({ functionality: "Non-PDF files in user messages" });
|
|
9374
|
+
betas.add("pdfs-2024-09-25");
|
|
9375
|
+
anthropicContent.push({
|
|
9376
|
+
type: "document",
|
|
9377
|
+
source: part.data instanceof URL ? {
|
|
9378
|
+
type: "url",
|
|
9379
|
+
url: part.data.toString()
|
|
9380
|
+
} : {
|
|
9381
|
+
type: "base64",
|
|
9382
|
+
media_type: "application/pdf",
|
|
9383
|
+
data: part.data
|
|
9384
|
+
},
|
|
9385
|
+
cache_control: cacheControl
|
|
9386
|
+
});
|
|
9387
|
+
break;
|
|
9388
|
+
}
|
|
9389
|
+
}
|
|
9390
|
+
}
|
|
9391
|
+
break;
|
|
9392
|
+
}
|
|
9393
|
+
case "tool": {
|
|
9394
|
+
for (let i2 = 0; i2 < content.length; i2++) {
|
|
9395
|
+
const part = content[i2];
|
|
9396
|
+
const isLastPart = i2 === content.length - 1;
|
|
9397
|
+
const cacheControl = (_c = getCacheControl(part.providerMetadata)) != null ? _c : isLastPart ? getCacheControl(message.providerMetadata) : void 0;
|
|
9398
|
+
const toolResultContent = part.content != null ? part.content.map((part2) => {
|
|
9399
|
+
var _a2$2;
|
|
9400
|
+
switch (part2.type) {
|
|
9401
|
+
case "text": return {
|
|
9402
|
+
type: "text",
|
|
9403
|
+
text: part2.text,
|
|
9404
|
+
cache_control: void 0
|
|
9405
|
+
};
|
|
9406
|
+
case "image": return {
|
|
9407
|
+
type: "image",
|
|
9408
|
+
source: {
|
|
9409
|
+
type: "base64",
|
|
9410
|
+
media_type: (_a2$2 = part2.mimeType) != null ? _a2$2 : "image/jpeg",
|
|
9411
|
+
data: part2.data
|
|
9412
|
+
},
|
|
9413
|
+
cache_control: void 0
|
|
9414
|
+
};
|
|
9415
|
+
}
|
|
9416
|
+
}) : JSON.stringify(part.result);
|
|
9417
|
+
anthropicContent.push({
|
|
9418
|
+
type: "tool_result",
|
|
9419
|
+
tool_use_id: part.toolCallId,
|
|
9420
|
+
content: toolResultContent,
|
|
9421
|
+
is_error: part.isError,
|
|
9422
|
+
cache_control: cacheControl
|
|
9423
|
+
});
|
|
9424
|
+
}
|
|
9425
|
+
break;
|
|
9426
|
+
}
|
|
9427
|
+
default: {
|
|
9428
|
+
const _exhaustiveCheck = role;
|
|
9429
|
+
throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
|
|
9430
|
+
}
|
|
9431
|
+
}
|
|
9432
|
+
}
|
|
9433
|
+
messages.push({
|
|
9434
|
+
role: "user",
|
|
9435
|
+
content: anthropicContent
|
|
9436
|
+
});
|
|
9437
|
+
break;
|
|
9438
|
+
}
|
|
9439
|
+
case "assistant": {
|
|
9440
|
+
const anthropicContent = [];
|
|
9441
|
+
for (let j = 0; j < block.messages.length; j++) {
|
|
9442
|
+
const message = block.messages[j];
|
|
9443
|
+
const isLastMessage = j === block.messages.length - 1;
|
|
9444
|
+
const { content } = message;
|
|
9445
|
+
for (let k = 0; k < content.length; k++) {
|
|
9446
|
+
const part = content[k];
|
|
9447
|
+
const isLastContentPart = k === content.length - 1;
|
|
9448
|
+
const cacheControl = (_d = getCacheControl(part.providerMetadata)) != null ? _d : isLastContentPart ? getCacheControl(message.providerMetadata) : void 0;
|
|
9449
|
+
switch (part.type) {
|
|
9450
|
+
case "text": {
|
|
9451
|
+
anthropicContent.push({
|
|
9452
|
+
type: "text",
|
|
9453
|
+
text: isLastBlock && isLastMessage && isLastContentPart ? part.text.trim() : part.text,
|
|
9454
|
+
cache_control: cacheControl
|
|
9455
|
+
});
|
|
9456
|
+
break;
|
|
9457
|
+
}
|
|
9458
|
+
case "reasoning": {
|
|
9459
|
+
if (sendReasoning) anthropicContent.push({
|
|
9460
|
+
type: "thinking",
|
|
9461
|
+
thinking: part.text,
|
|
9462
|
+
signature: part.signature,
|
|
9463
|
+
cache_control: cacheControl
|
|
9464
|
+
});
|
|
9465
|
+
else warnings.push({
|
|
9466
|
+
type: "other",
|
|
9467
|
+
message: "sending reasoning content is disabled for this model"
|
|
9468
|
+
});
|
|
9469
|
+
break;
|
|
9470
|
+
}
|
|
9471
|
+
case "redacted-reasoning": {
|
|
9472
|
+
anthropicContent.push({
|
|
9473
|
+
type: "redacted_thinking",
|
|
9474
|
+
data: part.data,
|
|
9475
|
+
cache_control: cacheControl
|
|
9476
|
+
});
|
|
9477
|
+
break;
|
|
9478
|
+
}
|
|
9479
|
+
case "tool-call": {
|
|
9480
|
+
anthropicContent.push({
|
|
9481
|
+
type: "tool_use",
|
|
9482
|
+
id: part.toolCallId,
|
|
9483
|
+
name: part.toolName,
|
|
9484
|
+
input: part.args,
|
|
9485
|
+
cache_control: cacheControl
|
|
9486
|
+
});
|
|
9487
|
+
break;
|
|
9488
|
+
}
|
|
9489
|
+
}
|
|
9490
|
+
}
|
|
9491
|
+
}
|
|
9492
|
+
messages.push({
|
|
9493
|
+
role: "assistant",
|
|
9494
|
+
content: anthropicContent
|
|
9495
|
+
});
|
|
9496
|
+
break;
|
|
9497
|
+
}
|
|
9498
|
+
default: {
|
|
9499
|
+
const _exhaustiveCheck = type;
|
|
9500
|
+
throw new Error(`Unsupported type: ${_exhaustiveCheck}`);
|
|
9501
|
+
}
|
|
9502
|
+
}
|
|
9503
|
+
}
|
|
9504
|
+
return {
|
|
9505
|
+
prompt: {
|
|
9506
|
+
system,
|
|
9507
|
+
messages
|
|
9508
|
+
},
|
|
9509
|
+
betas
|
|
9510
|
+
};
|
|
9511
|
+
}
|
|
9512
|
+
function groupIntoBlocks(prompt) {
|
|
9513
|
+
const blocks = [];
|
|
9514
|
+
let currentBlock = void 0;
|
|
9515
|
+
for (const message of prompt) {
|
|
9516
|
+
const { role } = message;
|
|
9517
|
+
switch (role) {
|
|
9518
|
+
case "system": {
|
|
9519
|
+
if ((currentBlock == null ? void 0 : currentBlock.type) !== "system") {
|
|
9520
|
+
currentBlock = {
|
|
9521
|
+
type: "system",
|
|
9522
|
+
messages: []
|
|
9523
|
+
};
|
|
9524
|
+
blocks.push(currentBlock);
|
|
9525
|
+
}
|
|
9526
|
+
currentBlock.messages.push(message);
|
|
9527
|
+
break;
|
|
9528
|
+
}
|
|
9529
|
+
case "assistant": {
|
|
9530
|
+
if ((currentBlock == null ? void 0 : currentBlock.type) !== "assistant") {
|
|
9531
|
+
currentBlock = {
|
|
9532
|
+
type: "assistant",
|
|
9533
|
+
messages: []
|
|
9534
|
+
};
|
|
9535
|
+
blocks.push(currentBlock);
|
|
9536
|
+
}
|
|
9537
|
+
currentBlock.messages.push(message);
|
|
9538
|
+
break;
|
|
9539
|
+
}
|
|
9540
|
+
case "user": {
|
|
9541
|
+
if ((currentBlock == null ? void 0 : currentBlock.type) !== "user") {
|
|
9542
|
+
currentBlock = {
|
|
9543
|
+
type: "user",
|
|
9544
|
+
messages: []
|
|
9545
|
+
};
|
|
9546
|
+
blocks.push(currentBlock);
|
|
9547
|
+
}
|
|
9548
|
+
currentBlock.messages.push(message);
|
|
9549
|
+
break;
|
|
9550
|
+
}
|
|
9551
|
+
case "tool": {
|
|
9552
|
+
if ((currentBlock == null ? void 0 : currentBlock.type) !== "user") {
|
|
9553
|
+
currentBlock = {
|
|
9554
|
+
type: "user",
|
|
9555
|
+
messages: []
|
|
9556
|
+
};
|
|
9557
|
+
blocks.push(currentBlock);
|
|
9558
|
+
}
|
|
9559
|
+
currentBlock.messages.push(message);
|
|
9560
|
+
break;
|
|
9561
|
+
}
|
|
9562
|
+
default: {
|
|
9563
|
+
const _exhaustiveCheck = role;
|
|
9564
|
+
throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
|
|
9565
|
+
}
|
|
9566
|
+
}
|
|
9567
|
+
}
|
|
9568
|
+
return blocks;
|
|
9569
|
+
}
|
|
9570
|
+
function mapAnthropicStopReason(finishReason) {
|
|
9571
|
+
switch (finishReason) {
|
|
9572
|
+
case "end_turn":
|
|
9573
|
+
case "stop_sequence": return "stop";
|
|
9574
|
+
case "tool_use": return "tool-calls";
|
|
9575
|
+
case "max_tokens": return "length";
|
|
9576
|
+
default: return "unknown";
|
|
9577
|
+
}
|
|
9578
|
+
}
|
|
9579
|
+
var AnthropicMessagesLanguageModel = class {
|
|
9580
|
+
constructor(modelId, settings, config) {
|
|
9581
|
+
this.specificationVersion = "v1";
|
|
9582
|
+
this.defaultObjectGenerationMode = "tool";
|
|
9583
|
+
this.modelId = modelId;
|
|
9584
|
+
this.settings = settings;
|
|
9585
|
+
this.config = config;
|
|
9586
|
+
}
|
|
9587
|
+
supportsUrl(url) {
|
|
9588
|
+
return url.protocol === "https:";
|
|
9589
|
+
}
|
|
9590
|
+
get provider() {
|
|
9591
|
+
return this.config.provider;
|
|
9592
|
+
}
|
|
9593
|
+
get supportsImageUrls() {
|
|
9594
|
+
return this.config.supportsImageUrls;
|
|
9595
|
+
}
|
|
9596
|
+
async getArgs({ mode, prompt, maxTokens = 4096, temperature, topP, topK, frequencyPenalty, presencePenalty, stopSequences, responseFormat, seed, providerMetadata: providerOptions }) {
|
|
9597
|
+
var _a$2, _b, _c;
|
|
9598
|
+
const type = mode.type;
|
|
9599
|
+
const warnings = [];
|
|
9600
|
+
if (frequencyPenalty != null) warnings.push({
|
|
9601
|
+
type: "unsupported-setting",
|
|
9602
|
+
setting: "frequencyPenalty"
|
|
9603
|
+
});
|
|
9604
|
+
if (presencePenalty != null) warnings.push({
|
|
9605
|
+
type: "unsupported-setting",
|
|
9606
|
+
setting: "presencePenalty"
|
|
9607
|
+
});
|
|
9608
|
+
if (seed != null) warnings.push({
|
|
9609
|
+
type: "unsupported-setting",
|
|
9610
|
+
setting: "seed"
|
|
9611
|
+
});
|
|
9612
|
+
if (responseFormat != null && responseFormat.type !== "text") warnings.push({
|
|
9613
|
+
type: "unsupported-setting",
|
|
9614
|
+
setting: "responseFormat",
|
|
9615
|
+
details: "JSON response format is not supported."
|
|
9616
|
+
});
|
|
9617
|
+
const { prompt: messagesPrompt, betas: messagesBetas } = convertToAnthropicMessagesPrompt({
|
|
9618
|
+
prompt,
|
|
9619
|
+
sendReasoning: (_a$2 = this.settings.sendReasoning) != null ? _a$2 : true,
|
|
9620
|
+
warnings
|
|
9621
|
+
});
|
|
9622
|
+
const anthropicOptions = parseProviderOptions({
|
|
9623
|
+
provider: "anthropic",
|
|
9624
|
+
providerOptions,
|
|
9625
|
+
schema: anthropicProviderOptionsSchema
|
|
9626
|
+
});
|
|
9627
|
+
const isThinking = ((_b = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _b.type) === "enabled";
|
|
9628
|
+
const thinkingBudget = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.budgetTokens;
|
|
9629
|
+
const baseArgs = {
|
|
9630
|
+
model: this.modelId,
|
|
9631
|
+
max_tokens: maxTokens,
|
|
9632
|
+
temperature,
|
|
9633
|
+
top_k: topK,
|
|
9634
|
+
top_p: topP,
|
|
9635
|
+
stop_sequences: stopSequences,
|
|
9636
|
+
...isThinking && { thinking: {
|
|
9637
|
+
type: "enabled",
|
|
9638
|
+
budget_tokens: thinkingBudget
|
|
9639
|
+
} },
|
|
9640
|
+
system: messagesPrompt.system,
|
|
9641
|
+
messages: messagesPrompt.messages
|
|
9642
|
+
};
|
|
9643
|
+
if (isThinking) {
|
|
9644
|
+
if (thinkingBudget == null) throw new UnsupportedFunctionalityError({ functionality: "thinking requires a budget" });
|
|
9645
|
+
if (baseArgs.temperature != null) {
|
|
9646
|
+
baseArgs.temperature = void 0;
|
|
9647
|
+
warnings.push({
|
|
9648
|
+
type: "unsupported-setting",
|
|
9649
|
+
setting: "temperature",
|
|
9650
|
+
details: "temperature is not supported when thinking is enabled"
|
|
9651
|
+
});
|
|
9652
|
+
}
|
|
9653
|
+
if (topK != null) {
|
|
9654
|
+
baseArgs.top_k = void 0;
|
|
9655
|
+
warnings.push({
|
|
9656
|
+
type: "unsupported-setting",
|
|
9657
|
+
setting: "topK",
|
|
9658
|
+
details: "topK is not supported when thinking is enabled"
|
|
9659
|
+
});
|
|
9660
|
+
}
|
|
9661
|
+
if (topP != null) {
|
|
9662
|
+
baseArgs.top_p = void 0;
|
|
9663
|
+
warnings.push({
|
|
9664
|
+
type: "unsupported-setting",
|
|
9665
|
+
setting: "topP",
|
|
9666
|
+
details: "topP is not supported when thinking is enabled"
|
|
9667
|
+
});
|
|
9668
|
+
}
|
|
9669
|
+
baseArgs.max_tokens = maxTokens + thinkingBudget;
|
|
9670
|
+
}
|
|
9671
|
+
switch (type) {
|
|
9672
|
+
case "regular": {
|
|
9673
|
+
const { tools, tool_choice, toolWarnings, betas: toolsBetas } = prepareTools(mode);
|
|
9674
|
+
return {
|
|
9675
|
+
args: {
|
|
9676
|
+
...baseArgs,
|
|
9677
|
+
tools,
|
|
9678
|
+
tool_choice
|
|
9679
|
+
},
|
|
9680
|
+
warnings: [...warnings, ...toolWarnings],
|
|
9681
|
+
betas: /* @__PURE__ */ new Set([...messagesBetas, ...toolsBetas])
|
|
9682
|
+
};
|
|
9683
|
+
}
|
|
9684
|
+
case "object-json": throw new UnsupportedFunctionalityError({ functionality: "json-mode object generation" });
|
|
9685
|
+
case "object-tool": {
|
|
9686
|
+
const { name: name$2, description: description$73, parameters } = mode.tool;
|
|
9687
|
+
return {
|
|
9688
|
+
args: {
|
|
9689
|
+
...baseArgs,
|
|
9690
|
+
tools: [{
|
|
9691
|
+
name: name$2,
|
|
9692
|
+
description: description$73,
|
|
9693
|
+
input_schema: parameters
|
|
9694
|
+
}],
|
|
9695
|
+
tool_choice: {
|
|
9696
|
+
type: "tool",
|
|
9697
|
+
name: name$2
|
|
9698
|
+
}
|
|
9699
|
+
},
|
|
9700
|
+
warnings,
|
|
9701
|
+
betas: messagesBetas
|
|
9702
|
+
};
|
|
9703
|
+
}
|
|
9704
|
+
default: {
|
|
9705
|
+
const _exhaustiveCheck = type;
|
|
9706
|
+
throw new Error(`Unsupported type: ${_exhaustiveCheck}`);
|
|
9707
|
+
}
|
|
9708
|
+
}
|
|
9709
|
+
}
|
|
9710
|
+
async getHeaders({ betas, headers }) {
|
|
9711
|
+
return combineHeaders(await resolve(this.config.headers), betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}, headers);
|
|
9712
|
+
}
|
|
9713
|
+
buildRequestUrl(isStreaming) {
|
|
9714
|
+
var _a$2, _b, _c;
|
|
9715
|
+
return (_c = (_b = (_a$2 = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a$2, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
|
|
9716
|
+
}
|
|
9717
|
+
transformRequestBody(args) {
|
|
9718
|
+
var _a$2, _b, _c;
|
|
9719
|
+
return (_c = (_b = (_a$2 = this.config).transformRequestBody) == null ? void 0 : _b.call(_a$2, args)) != null ? _c : args;
|
|
9720
|
+
}
|
|
9721
|
+
async doGenerate(options) {
|
|
9722
|
+
var _a$2, _b, _c, _d;
|
|
9723
|
+
const { args, warnings, betas } = await this.getArgs(options);
|
|
9724
|
+
const { responseHeaders, value: response, rawValue: rawResponse } = await postJsonToApi({
|
|
9725
|
+
url: this.buildRequestUrl(false),
|
|
9726
|
+
headers: await this.getHeaders({
|
|
9727
|
+
betas,
|
|
9728
|
+
headers: options.headers
|
|
9729
|
+
}),
|
|
9730
|
+
body: this.transformRequestBody(args),
|
|
9731
|
+
failedResponseHandler: anthropicFailedResponseHandler,
|
|
9732
|
+
successfulResponseHandler: createJsonResponseHandler(anthropicMessagesResponseSchema),
|
|
9733
|
+
abortSignal: options.abortSignal,
|
|
9734
|
+
fetch: this.config.fetch
|
|
9735
|
+
});
|
|
9736
|
+
const { messages: rawPrompt,...rawSettings } = args;
|
|
9737
|
+
let text$1 = "";
|
|
9738
|
+
for (const content of response.content) if (content.type === "text") text$1 += content.text;
|
|
9739
|
+
let toolCalls = void 0;
|
|
9740
|
+
if (response.content.some((content) => content.type === "tool_use")) {
|
|
9741
|
+
toolCalls = [];
|
|
9742
|
+
for (const content of response.content) if (content.type === "tool_use") toolCalls.push({
|
|
9743
|
+
toolCallType: "function",
|
|
9744
|
+
toolCallId: content.id,
|
|
9745
|
+
toolName: content.name,
|
|
9746
|
+
args: JSON.stringify(content.input)
|
|
9747
|
+
});
|
|
9748
|
+
}
|
|
9749
|
+
const reasoning = response.content.filter((content) => content.type === "redacted_thinking" || content.type === "thinking").map((content) => content.type === "thinking" ? {
|
|
9750
|
+
type: "text",
|
|
9751
|
+
text: content.thinking,
|
|
9752
|
+
signature: content.signature
|
|
9753
|
+
} : {
|
|
9754
|
+
type: "redacted",
|
|
9755
|
+
data: content.data
|
|
9756
|
+
});
|
|
9757
|
+
return {
|
|
9758
|
+
text: text$1,
|
|
9759
|
+
reasoning: reasoning.length > 0 ? reasoning : void 0,
|
|
9760
|
+
toolCalls,
|
|
9761
|
+
finishReason: mapAnthropicStopReason(response.stop_reason),
|
|
9762
|
+
usage: {
|
|
9763
|
+
promptTokens: response.usage.input_tokens,
|
|
9764
|
+
completionTokens: response.usage.output_tokens
|
|
9765
|
+
},
|
|
9766
|
+
rawCall: {
|
|
9767
|
+
rawPrompt,
|
|
9768
|
+
rawSettings
|
|
9769
|
+
},
|
|
9770
|
+
rawResponse: {
|
|
9771
|
+
headers: responseHeaders,
|
|
9772
|
+
body: rawResponse
|
|
9773
|
+
},
|
|
9774
|
+
response: {
|
|
9775
|
+
id: (_a$2 = response.id) != null ? _a$2 : void 0,
|
|
9776
|
+
modelId: (_b = response.model) != null ? _b : void 0
|
|
9777
|
+
},
|
|
9778
|
+
warnings,
|
|
9779
|
+
providerMetadata: { anthropic: {
|
|
9780
|
+
cacheCreationInputTokens: (_c = response.usage.cache_creation_input_tokens) != null ? _c : null,
|
|
9781
|
+
cacheReadInputTokens: (_d = response.usage.cache_read_input_tokens) != null ? _d : null
|
|
9782
|
+
} },
|
|
9783
|
+
request: { body: JSON.stringify(args) }
|
|
9784
|
+
};
|
|
9785
|
+
}
|
|
9786
|
+
async doStream(options) {
|
|
9787
|
+
const { args, warnings, betas } = await this.getArgs(options);
|
|
9788
|
+
const body = {
|
|
9789
|
+
...args,
|
|
9790
|
+
stream: true
|
|
9791
|
+
};
|
|
9792
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
9793
|
+
url: this.buildRequestUrl(true),
|
|
9794
|
+
headers: await this.getHeaders({
|
|
9795
|
+
betas,
|
|
9796
|
+
headers: options.headers
|
|
9797
|
+
}),
|
|
9798
|
+
body: this.transformRequestBody(body),
|
|
9799
|
+
failedResponseHandler: anthropicFailedResponseHandler,
|
|
9800
|
+
successfulResponseHandler: createEventSourceResponseHandler(anthropicMessagesChunkSchema),
|
|
9801
|
+
abortSignal: options.abortSignal,
|
|
9802
|
+
fetch: this.config.fetch
|
|
9803
|
+
});
|
|
9804
|
+
const { messages: rawPrompt,...rawSettings } = args;
|
|
9805
|
+
let finishReason = "unknown";
|
|
9806
|
+
const usage = {
|
|
9807
|
+
promptTokens: NaN,
|
|
9808
|
+
completionTokens: NaN
|
|
9809
|
+
};
|
|
9810
|
+
const toolCallContentBlocks = {};
|
|
9811
|
+
let providerMetadata = void 0;
|
|
9812
|
+
let blockType = void 0;
|
|
9813
|
+
return {
|
|
9814
|
+
stream: response.pipeThrough(new TransformStream({ transform(chunk, controller) {
|
|
9815
|
+
var _a$2, _b, _c, _d;
|
|
9816
|
+
if (!chunk.success) {
|
|
9817
|
+
controller.enqueue({
|
|
9818
|
+
type: "error",
|
|
9819
|
+
error: chunk.error
|
|
9820
|
+
});
|
|
9821
|
+
return;
|
|
9822
|
+
}
|
|
9823
|
+
const value = chunk.value;
|
|
9824
|
+
switch (value.type) {
|
|
9825
|
+
case "ping": return;
|
|
9826
|
+
case "content_block_start": {
|
|
9827
|
+
const contentBlockType = value.content_block.type;
|
|
9828
|
+
blockType = contentBlockType;
|
|
9829
|
+
switch (contentBlockType) {
|
|
9830
|
+
case "text":
|
|
9831
|
+
case "thinking": return;
|
|
9832
|
+
case "redacted_thinking": {
|
|
9833
|
+
controller.enqueue({
|
|
9834
|
+
type: "redacted-reasoning",
|
|
9835
|
+
data: value.content_block.data
|
|
9836
|
+
});
|
|
9837
|
+
return;
|
|
9838
|
+
}
|
|
9839
|
+
case "tool_use": {
|
|
9840
|
+
toolCallContentBlocks[value.index] = {
|
|
9841
|
+
toolCallId: value.content_block.id,
|
|
9842
|
+
toolName: value.content_block.name,
|
|
9843
|
+
jsonText: ""
|
|
9844
|
+
};
|
|
9845
|
+
return;
|
|
9846
|
+
}
|
|
9847
|
+
default: {
|
|
9848
|
+
const _exhaustiveCheck = contentBlockType;
|
|
9849
|
+
throw new Error(`Unsupported content block type: ${_exhaustiveCheck}`);
|
|
9850
|
+
}
|
|
9851
|
+
}
|
|
9852
|
+
}
|
|
9853
|
+
case "content_block_stop": {
|
|
9854
|
+
if (toolCallContentBlocks[value.index] != null) {
|
|
9855
|
+
const contentBlock = toolCallContentBlocks[value.index];
|
|
9856
|
+
controller.enqueue({
|
|
9857
|
+
type: "tool-call",
|
|
9858
|
+
toolCallType: "function",
|
|
9859
|
+
toolCallId: contentBlock.toolCallId,
|
|
9860
|
+
toolName: contentBlock.toolName,
|
|
9861
|
+
args: contentBlock.jsonText
|
|
9862
|
+
});
|
|
9863
|
+
delete toolCallContentBlocks[value.index];
|
|
9864
|
+
}
|
|
9865
|
+
blockType = void 0;
|
|
9866
|
+
return;
|
|
9867
|
+
}
|
|
9868
|
+
case "content_block_delta": {
|
|
9869
|
+
const deltaType = value.delta.type;
|
|
9870
|
+
switch (deltaType) {
|
|
9871
|
+
case "text_delta": {
|
|
9872
|
+
controller.enqueue({
|
|
9873
|
+
type: "text-delta",
|
|
9874
|
+
textDelta: value.delta.text
|
|
9875
|
+
});
|
|
9876
|
+
return;
|
|
9877
|
+
}
|
|
9878
|
+
case "thinking_delta": {
|
|
9879
|
+
controller.enqueue({
|
|
9880
|
+
type: "reasoning",
|
|
9881
|
+
textDelta: value.delta.thinking
|
|
9882
|
+
});
|
|
9883
|
+
return;
|
|
9884
|
+
}
|
|
9885
|
+
case "signature_delta": {
|
|
9886
|
+
if (blockType === "thinking") controller.enqueue({
|
|
9887
|
+
type: "reasoning-signature",
|
|
9888
|
+
signature: value.delta.signature
|
|
9889
|
+
});
|
|
9890
|
+
return;
|
|
9891
|
+
}
|
|
9892
|
+
case "input_json_delta": {
|
|
9893
|
+
const contentBlock = toolCallContentBlocks[value.index];
|
|
9894
|
+
controller.enqueue({
|
|
9895
|
+
type: "tool-call-delta",
|
|
9896
|
+
toolCallType: "function",
|
|
9897
|
+
toolCallId: contentBlock.toolCallId,
|
|
9898
|
+
toolName: contentBlock.toolName,
|
|
9899
|
+
argsTextDelta: value.delta.partial_json
|
|
9900
|
+
});
|
|
9901
|
+
contentBlock.jsonText += value.delta.partial_json;
|
|
9902
|
+
return;
|
|
9903
|
+
}
|
|
9904
|
+
default: {
|
|
9905
|
+
const _exhaustiveCheck = deltaType;
|
|
9906
|
+
throw new Error(`Unsupported delta type: ${_exhaustiveCheck}`);
|
|
9907
|
+
}
|
|
9908
|
+
}
|
|
9909
|
+
}
|
|
9910
|
+
case "message_start": {
|
|
9911
|
+
usage.promptTokens = value.message.usage.input_tokens;
|
|
9912
|
+
usage.completionTokens = value.message.usage.output_tokens;
|
|
9913
|
+
providerMetadata = { anthropic: {
|
|
9914
|
+
cacheCreationInputTokens: (_a$2 = value.message.usage.cache_creation_input_tokens) != null ? _a$2 : null,
|
|
9915
|
+
cacheReadInputTokens: (_b = value.message.usage.cache_read_input_tokens) != null ? _b : null
|
|
9916
|
+
} };
|
|
9917
|
+
controller.enqueue({
|
|
9918
|
+
type: "response-metadata",
|
|
9919
|
+
id: (_c = value.message.id) != null ? _c : void 0,
|
|
9920
|
+
modelId: (_d = value.message.model) != null ? _d : void 0
|
|
9921
|
+
});
|
|
9922
|
+
return;
|
|
9923
|
+
}
|
|
9924
|
+
case "message_delta": {
|
|
9925
|
+
usage.completionTokens = value.usage.output_tokens;
|
|
9926
|
+
finishReason = mapAnthropicStopReason(value.delta.stop_reason);
|
|
9927
|
+
return;
|
|
9928
|
+
}
|
|
9929
|
+
case "message_stop": {
|
|
9930
|
+
controller.enqueue({
|
|
9931
|
+
type: "finish",
|
|
9932
|
+
finishReason,
|
|
9933
|
+
usage,
|
|
9934
|
+
providerMetadata
|
|
9935
|
+
});
|
|
9936
|
+
return;
|
|
9937
|
+
}
|
|
9938
|
+
case "error": {
|
|
9939
|
+
controller.enqueue({
|
|
9940
|
+
type: "error",
|
|
9941
|
+
error: value.error
|
|
9942
|
+
});
|
|
9943
|
+
return;
|
|
9944
|
+
}
|
|
9945
|
+
default: {
|
|
9946
|
+
const _exhaustiveCheck = value;
|
|
9947
|
+
throw new Error(`Unsupported chunk type: ${_exhaustiveCheck}`);
|
|
9948
|
+
}
|
|
9949
|
+
}
|
|
9950
|
+
} })),
|
|
9951
|
+
rawCall: {
|
|
9952
|
+
rawPrompt,
|
|
9953
|
+
rawSettings
|
|
9954
|
+
},
|
|
9955
|
+
rawResponse: { headers: responseHeaders },
|
|
9956
|
+
warnings,
|
|
9957
|
+
request: { body: JSON.stringify(body) }
|
|
9958
|
+
};
|
|
9959
|
+
}
|
|
9960
|
+
};
|
|
9961
|
+
var anthropicMessagesResponseSchema = zod.z.object({
|
|
9962
|
+
type: zod.z.literal("message"),
|
|
9963
|
+
id: zod.z.string().nullish(),
|
|
9964
|
+
model: zod.z.string().nullish(),
|
|
9965
|
+
content: zod.z.array(zod.z.discriminatedUnion("type", [
|
|
9966
|
+
zod.z.object({
|
|
9967
|
+
type: zod.z.literal("text"),
|
|
9968
|
+
text: zod.z.string()
|
|
9969
|
+
}),
|
|
9970
|
+
zod.z.object({
|
|
9971
|
+
type: zod.z.literal("thinking"),
|
|
9972
|
+
thinking: zod.z.string(),
|
|
9973
|
+
signature: zod.z.string()
|
|
9974
|
+
}),
|
|
9975
|
+
zod.z.object({
|
|
9976
|
+
type: zod.z.literal("redacted_thinking"),
|
|
9977
|
+
data: zod.z.string()
|
|
9978
|
+
}),
|
|
9979
|
+
zod.z.object({
|
|
9980
|
+
type: zod.z.literal("tool_use"),
|
|
9981
|
+
id: zod.z.string(),
|
|
9982
|
+
name: zod.z.string(),
|
|
9983
|
+
input: zod.z.unknown()
|
|
9984
|
+
})
|
|
9985
|
+
])),
|
|
9986
|
+
stop_reason: zod.z.string().nullish(),
|
|
9987
|
+
usage: zod.z.object({
|
|
9988
|
+
input_tokens: zod.z.number(),
|
|
9989
|
+
output_tokens: zod.z.number(),
|
|
9990
|
+
cache_creation_input_tokens: zod.z.number().nullish(),
|
|
9991
|
+
cache_read_input_tokens: zod.z.number().nullish()
|
|
9992
|
+
})
|
|
9993
|
+
});
|
|
9994
|
+
var anthropicMessagesChunkSchema = zod.z.discriminatedUnion("type", [
|
|
9995
|
+
zod.z.object({
|
|
9996
|
+
type: zod.z.literal("message_start"),
|
|
9997
|
+
message: zod.z.object({
|
|
9998
|
+
id: zod.z.string().nullish(),
|
|
9999
|
+
model: zod.z.string().nullish(),
|
|
10000
|
+
usage: zod.z.object({
|
|
10001
|
+
input_tokens: zod.z.number(),
|
|
10002
|
+
output_tokens: zod.z.number(),
|
|
10003
|
+
cache_creation_input_tokens: zod.z.number().nullish(),
|
|
10004
|
+
cache_read_input_tokens: zod.z.number().nullish()
|
|
10005
|
+
})
|
|
10006
|
+
})
|
|
10007
|
+
}),
|
|
10008
|
+
zod.z.object({
|
|
10009
|
+
type: zod.z.literal("content_block_start"),
|
|
10010
|
+
index: zod.z.number(),
|
|
10011
|
+
content_block: zod.z.discriminatedUnion("type", [
|
|
10012
|
+
zod.z.object({
|
|
10013
|
+
type: zod.z.literal("text"),
|
|
10014
|
+
text: zod.z.string()
|
|
10015
|
+
}),
|
|
10016
|
+
zod.z.object({
|
|
10017
|
+
type: zod.z.literal("thinking"),
|
|
10018
|
+
thinking: zod.z.string()
|
|
10019
|
+
}),
|
|
10020
|
+
zod.z.object({
|
|
10021
|
+
type: zod.z.literal("tool_use"),
|
|
10022
|
+
id: zod.z.string(),
|
|
10023
|
+
name: zod.z.string()
|
|
10024
|
+
}),
|
|
10025
|
+
zod.z.object({
|
|
10026
|
+
type: zod.z.literal("redacted_thinking"),
|
|
10027
|
+
data: zod.z.string()
|
|
10028
|
+
})
|
|
10029
|
+
])
|
|
10030
|
+
}),
|
|
10031
|
+
zod.z.object({
|
|
10032
|
+
type: zod.z.literal("content_block_delta"),
|
|
10033
|
+
index: zod.z.number(),
|
|
10034
|
+
delta: zod.z.discriminatedUnion("type", [
|
|
10035
|
+
zod.z.object({
|
|
10036
|
+
type: zod.z.literal("input_json_delta"),
|
|
10037
|
+
partial_json: zod.z.string()
|
|
10038
|
+
}),
|
|
10039
|
+
zod.z.object({
|
|
10040
|
+
type: zod.z.literal("text_delta"),
|
|
10041
|
+
text: zod.z.string()
|
|
10042
|
+
}),
|
|
10043
|
+
zod.z.object({
|
|
10044
|
+
type: zod.z.literal("thinking_delta"),
|
|
10045
|
+
thinking: zod.z.string()
|
|
10046
|
+
}),
|
|
10047
|
+
zod.z.object({
|
|
10048
|
+
type: zod.z.literal("signature_delta"),
|
|
10049
|
+
signature: zod.z.string()
|
|
10050
|
+
})
|
|
10051
|
+
])
|
|
10052
|
+
}),
|
|
10053
|
+
zod.z.object({
|
|
10054
|
+
type: zod.z.literal("content_block_stop"),
|
|
10055
|
+
index: zod.z.number()
|
|
10056
|
+
}),
|
|
10057
|
+
zod.z.object({
|
|
10058
|
+
type: zod.z.literal("error"),
|
|
10059
|
+
error: zod.z.object({
|
|
10060
|
+
type: zod.z.string(),
|
|
10061
|
+
message: zod.z.string()
|
|
10062
|
+
})
|
|
10063
|
+
}),
|
|
10064
|
+
zod.z.object({
|
|
10065
|
+
type: zod.z.literal("message_delta"),
|
|
10066
|
+
delta: zod.z.object({ stop_reason: zod.z.string().nullish() }),
|
|
10067
|
+
usage: zod.z.object({ output_tokens: zod.z.number() })
|
|
10068
|
+
}),
|
|
10069
|
+
zod.z.object({ type: zod.z.literal("message_stop") }),
|
|
10070
|
+
zod.z.object({ type: zod.z.literal("ping") })
|
|
10071
|
+
]);
|
|
10072
|
+
var anthropicProviderOptionsSchema = zod.z.object({ thinking: zod.z.object({
|
|
10073
|
+
type: zod.z.union([zod.z.literal("enabled"), zod.z.literal("disabled")]),
|
|
10074
|
+
budgetTokens: zod.z.number().optional()
|
|
10075
|
+
}).optional() });
|
|
10076
|
+
var Bash20241022Parameters = zod.z.object({
|
|
10077
|
+
command: zod.z.string(),
|
|
10078
|
+
restart: zod.z.boolean().optional()
|
|
10079
|
+
});
|
|
10080
|
+
function bashTool_20241022(options = {}) {
|
|
10081
|
+
return {
|
|
10082
|
+
type: "provider-defined",
|
|
10083
|
+
id: "anthropic.bash_20241022",
|
|
10084
|
+
args: {},
|
|
10085
|
+
parameters: Bash20241022Parameters,
|
|
10086
|
+
execute: options.execute,
|
|
10087
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10088
|
+
};
|
|
10089
|
+
}
|
|
10090
|
+
var Bash20250124Parameters = zod.z.object({
|
|
10091
|
+
command: zod.z.string(),
|
|
10092
|
+
restart: zod.z.boolean().optional()
|
|
10093
|
+
});
|
|
10094
|
+
function bashTool_20250124(options = {}) {
|
|
10095
|
+
return {
|
|
10096
|
+
type: "provider-defined",
|
|
10097
|
+
id: "anthropic.bash_20250124",
|
|
10098
|
+
args: {},
|
|
10099
|
+
parameters: Bash20250124Parameters,
|
|
10100
|
+
execute: options.execute,
|
|
10101
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10102
|
+
};
|
|
10103
|
+
}
|
|
10104
|
+
var TextEditor20241022Parameters = zod.z.object({
|
|
10105
|
+
command: zod.z.enum([
|
|
10106
|
+
"view",
|
|
10107
|
+
"create",
|
|
10108
|
+
"str_replace",
|
|
10109
|
+
"insert",
|
|
10110
|
+
"undo_edit"
|
|
10111
|
+
]),
|
|
10112
|
+
path: zod.z.string(),
|
|
10113
|
+
file_text: zod.z.string().optional(),
|
|
10114
|
+
insert_line: zod.z.number().int().optional(),
|
|
10115
|
+
new_str: zod.z.string().optional(),
|
|
10116
|
+
old_str: zod.z.string().optional(),
|
|
10117
|
+
view_range: zod.z.array(zod.z.number().int()).optional()
|
|
10118
|
+
});
|
|
10119
|
+
function textEditorTool_20241022(options = {}) {
|
|
10120
|
+
return {
|
|
10121
|
+
type: "provider-defined",
|
|
10122
|
+
id: "anthropic.text_editor_20241022",
|
|
10123
|
+
args: {},
|
|
10124
|
+
parameters: TextEditor20241022Parameters,
|
|
10125
|
+
execute: options.execute,
|
|
10126
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10127
|
+
};
|
|
10128
|
+
}
|
|
10129
|
+
var TextEditor20250124Parameters = zod.z.object({
|
|
10130
|
+
command: zod.z.enum([
|
|
10131
|
+
"view",
|
|
10132
|
+
"create",
|
|
10133
|
+
"str_replace",
|
|
10134
|
+
"insert",
|
|
10135
|
+
"undo_edit"
|
|
10136
|
+
]),
|
|
10137
|
+
path: zod.z.string(),
|
|
10138
|
+
file_text: zod.z.string().optional(),
|
|
10139
|
+
insert_line: zod.z.number().int().optional(),
|
|
10140
|
+
new_str: zod.z.string().optional(),
|
|
10141
|
+
old_str: zod.z.string().optional(),
|
|
10142
|
+
view_range: zod.z.array(zod.z.number().int()).optional()
|
|
10143
|
+
});
|
|
10144
|
+
function textEditorTool_20250124(options = {}) {
|
|
10145
|
+
return {
|
|
10146
|
+
type: "provider-defined",
|
|
10147
|
+
id: "anthropic.text_editor_20250124",
|
|
10148
|
+
args: {},
|
|
10149
|
+
parameters: TextEditor20250124Parameters,
|
|
10150
|
+
execute: options.execute,
|
|
10151
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10152
|
+
};
|
|
10153
|
+
}
|
|
10154
|
+
var Computer20241022Parameters = zod.z.object({
|
|
10155
|
+
action: zod.z.enum([
|
|
10156
|
+
"key",
|
|
10157
|
+
"type",
|
|
10158
|
+
"mouse_move",
|
|
10159
|
+
"left_click",
|
|
10160
|
+
"left_click_drag",
|
|
10161
|
+
"right_click",
|
|
10162
|
+
"middle_click",
|
|
10163
|
+
"double_click",
|
|
10164
|
+
"screenshot",
|
|
10165
|
+
"cursor_position"
|
|
10166
|
+
]),
|
|
10167
|
+
coordinate: zod.z.array(zod.z.number().int()).optional(),
|
|
10168
|
+
text: zod.z.string().optional()
|
|
10169
|
+
});
|
|
10170
|
+
function computerTool_20241022(options) {
|
|
10171
|
+
return {
|
|
10172
|
+
type: "provider-defined",
|
|
10173
|
+
id: "anthropic.computer_20241022",
|
|
10174
|
+
args: {
|
|
10175
|
+
displayWidthPx: options.displayWidthPx,
|
|
10176
|
+
displayHeightPx: options.displayHeightPx,
|
|
10177
|
+
displayNumber: options.displayNumber
|
|
10178
|
+
},
|
|
10179
|
+
parameters: Computer20241022Parameters,
|
|
10180
|
+
execute: options.execute,
|
|
10181
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10182
|
+
};
|
|
10183
|
+
}
|
|
10184
|
+
var Computer20250124Parameters = zod.z.object({
|
|
10185
|
+
action: zod.z.enum([
|
|
10186
|
+
"key",
|
|
10187
|
+
"hold_key",
|
|
10188
|
+
"type",
|
|
10189
|
+
"cursor_position",
|
|
10190
|
+
"mouse_move",
|
|
10191
|
+
"left_mouse_down",
|
|
10192
|
+
"left_mouse_up",
|
|
10193
|
+
"left_click",
|
|
10194
|
+
"left_click_drag",
|
|
10195
|
+
"right_click",
|
|
10196
|
+
"middle_click",
|
|
10197
|
+
"double_click",
|
|
10198
|
+
"triple_click",
|
|
10199
|
+
"scroll",
|
|
10200
|
+
"wait",
|
|
10201
|
+
"screenshot"
|
|
10202
|
+
]),
|
|
10203
|
+
coordinate: zod.z.tuple([zod.z.number().int(), zod.z.number().int()]).optional(),
|
|
10204
|
+
duration: zod.z.number().optional(),
|
|
10205
|
+
scroll_amount: zod.z.number().optional(),
|
|
10206
|
+
scroll_direction: zod.z.enum([
|
|
10207
|
+
"up",
|
|
10208
|
+
"down",
|
|
10209
|
+
"left",
|
|
10210
|
+
"right"
|
|
10211
|
+
]).optional(),
|
|
10212
|
+
start_coordinate: zod.z.tuple([zod.z.number().int(), zod.z.number().int()]).optional(),
|
|
10213
|
+
text: zod.z.string().optional()
|
|
10214
|
+
});
|
|
10215
|
+
function computerTool_20250124(options) {
|
|
10216
|
+
return {
|
|
10217
|
+
type: "provider-defined",
|
|
10218
|
+
id: "anthropic.computer_20250124",
|
|
10219
|
+
args: {
|
|
10220
|
+
displayWidthPx: options.displayWidthPx,
|
|
10221
|
+
displayHeightPx: options.displayHeightPx,
|
|
10222
|
+
displayNumber: options.displayNumber
|
|
10223
|
+
},
|
|
10224
|
+
parameters: Computer20250124Parameters,
|
|
10225
|
+
execute: options.execute,
|
|
10226
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10227
|
+
};
|
|
10228
|
+
}
|
|
10229
|
+
var anthropicTools = {
|
|
10230
|
+
bash_20241022: bashTool_20241022,
|
|
10231
|
+
bash_20250124: bashTool_20250124,
|
|
10232
|
+
textEditor_20241022: textEditorTool_20241022,
|
|
10233
|
+
textEditor_20250124: textEditorTool_20250124,
|
|
10234
|
+
computer_20241022: computerTool_20241022,
|
|
10235
|
+
computer_20250124: computerTool_20250124
|
|
10236
|
+
};
|
|
10237
|
+
function createAnthropic(options = {}) {
|
|
10238
|
+
var _a$2;
|
|
10239
|
+
const baseURL = (_a$2 = withoutTrailingSlash(options.baseURL)) != null ? _a$2 : "https://api.anthropic.com/v1";
|
|
10240
|
+
const getHeaders = () => ({
|
|
10241
|
+
"anthropic-version": "2023-06-01",
|
|
10242
|
+
"x-api-key": loadApiKey({
|
|
10243
|
+
apiKey: options.apiKey,
|
|
10244
|
+
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
10245
|
+
description: "Anthropic"
|
|
10246
|
+
}),
|
|
10247
|
+
...options.headers
|
|
10248
|
+
});
|
|
10249
|
+
const createChatModel = (modelId, settings = {}) => new AnthropicMessagesLanguageModel(modelId, settings, {
|
|
10250
|
+
provider: "anthropic.messages",
|
|
10251
|
+
baseURL,
|
|
10252
|
+
headers: getHeaders,
|
|
10253
|
+
fetch: options.fetch,
|
|
10254
|
+
supportsImageUrls: true
|
|
10255
|
+
});
|
|
10256
|
+
const provider = function(modelId, settings) {
|
|
10257
|
+
if (new.target) throw new Error("The Anthropic model function cannot be called with the new keyword.");
|
|
10258
|
+
return createChatModel(modelId, settings);
|
|
10259
|
+
};
|
|
10260
|
+
provider.languageModel = createChatModel;
|
|
10261
|
+
provider.chat = createChatModel;
|
|
10262
|
+
provider.messages = createChatModel;
|
|
10263
|
+
provider.textEmbeddingModel = (modelId) => {
|
|
10264
|
+
throw new NoSuchModelError({
|
|
10265
|
+
modelId,
|
|
10266
|
+
modelType: "textEmbeddingModel"
|
|
10267
|
+
});
|
|
10268
|
+
};
|
|
10269
|
+
provider.tools = anthropicTools;
|
|
10270
|
+
return provider;
|
|
10271
|
+
}
|
|
10272
|
+
var anthropic = createAnthropic();
|
|
8950
10273
|
|
|
8951
10274
|
//#endregion
|
|
8952
|
-
//#region ../mcp-core/dist/
|
|
8953
|
-
const
|
|
8954
|
-
const VALID_REASONING_EFFORTS = [
|
|
8955
|
-
"low",
|
|
8956
|
-
"medium",
|
|
8957
|
-
"high"
|
|
8958
|
-
];
|
|
8959
|
-
const DEFAULT_REASONING_EFFORT = "low";
|
|
10275
|
+
//#region ../mcp-core/dist/anthropic-provider-DOE-j9k3.js
|
|
10276
|
+
const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-5";
|
|
8960
10277
|
let configuredBaseUrl;
|
|
8961
10278
|
/**
|
|
8962
|
-
* Configure the
|
|
10279
|
+
* Configure the Anthropic base URL (CLI flag only, not environment variable).
|
|
8963
10280
|
* This must be called explicitly - it cannot be set via environment variables for security.
|
|
8964
10281
|
*/
|
|
8965
|
-
function
|
|
10282
|
+
function setAnthropicBaseUrl(baseUrl) {
|
|
8966
10283
|
configuredBaseUrl = baseUrl;
|
|
8967
10284
|
}
|
|
8968
10285
|
/**
|
|
8969
|
-
* Retrieve an
|
|
10286
|
+
* Retrieve an Anthropic language model configured from environment variables and explicit config.
|
|
8970
10287
|
*
|
|
8971
10288
|
* Configuration:
|
|
8972
|
-
* -
|
|
8973
|
-
* -
|
|
8974
|
-
* - Base URL: Must be set via
|
|
10289
|
+
* - ANTHROPIC_API_KEY: API key for authentication (required)
|
|
10290
|
+
* - ANTHROPIC_MODEL: Model to use (default: "claude-sonnet-4-5") - env var OK
|
|
10291
|
+
* - Base URL: Must be set via setAnthropicBaseUrl() - NOT from env vars (security risk)
|
|
8975
10292
|
*/
|
|
8976
|
-
function
|
|
8977
|
-
const defaultModel = process.env.
|
|
8978
|
-
const
|
|
8979
|
-
let reasoningEffort;
|
|
8980
|
-
if (envReasoningEffort === "") reasoningEffort = void 0;
|
|
8981
|
-
else if (envReasoningEffort === void 0) reasoningEffort = DEFAULT_REASONING_EFFORT;
|
|
8982
|
-
else if (VALID_REASONING_EFFORTS.includes(envReasoningEffort)) reasoningEffort = envReasoningEffort;
|
|
8983
|
-
else {
|
|
8984
|
-
const validValues = VALID_REASONING_EFFORTS.map((v) => `"${v}"`).join(", ");
|
|
8985
|
-
throw new Error(`Invalid OPENAI_REASONING_EFFORT value: "${envReasoningEffort}". Must be one of: ${validValues}, or "" (empty string to disable). Default is "${DEFAULT_REASONING_EFFORT}".`);
|
|
8986
|
-
}
|
|
8987
|
-
const factory = createOpenAI({
|
|
10293
|
+
function getAnthropicModel(model) {
|
|
10294
|
+
const defaultModel = process.env.ANTHROPIC_MODEL || DEFAULT_ANTHROPIC_MODEL;
|
|
10295
|
+
const factory = createAnthropic({
|
|
8988
10296
|
...configuredBaseUrl && { baseURL: configuredBaseUrl },
|
|
8989
10297
|
headers: { "User-Agent": require_stdio.USER_AGENT }
|
|
8990
10298
|
});
|
|
8991
|
-
return factory(model ?? defaultModel
|
|
10299
|
+
return factory(model ?? defaultModel);
|
|
10300
|
+
}
|
|
10301
|
+
|
|
10302
|
+
//#endregion
|
|
10303
|
+
//#region ../mcp-core/dist/provider-factory-BPN0JlR3.js
|
|
10304
|
+
let configuredProvider;
|
|
10305
|
+
/**
|
|
10306
|
+
* Configure the embedded agent provider explicitly.
|
|
10307
|
+
* Call this from CLI to override auto-detection.
|
|
10308
|
+
*/
|
|
10309
|
+
function setAgentProvider(provider) {
|
|
10310
|
+
configuredProvider = provider;
|
|
10311
|
+
}
|
|
10312
|
+
/**
|
|
10313
|
+
* Configure base URLs for providers (called from CLI).
|
|
10314
|
+
*/
|
|
10315
|
+
function setProviderBaseUrls(config) {
|
|
10316
|
+
if (config.openaiBaseUrl) setOpenAIBaseUrl(config.openaiBaseUrl);
|
|
10317
|
+
if (config.anthropicBaseUrl) setAnthropicBaseUrl(config.anthropicBaseUrl);
|
|
10318
|
+
}
|
|
10319
|
+
/**
|
|
10320
|
+
* Check if the API key exists for a given provider type.
|
|
10321
|
+
*/
|
|
10322
|
+
function hasApiKeyForProvider(type) {
|
|
10323
|
+
switch (type) {
|
|
10324
|
+
case "anthropic": return Boolean(process.env.ANTHROPIC_API_KEY);
|
|
10325
|
+
case "openai": return Boolean(process.env.OPENAI_API_KEY);
|
|
10326
|
+
}
|
|
10327
|
+
}
|
|
10328
|
+
/**
|
|
10329
|
+
* Get the expected API key name for a provider type.
|
|
10330
|
+
*/
|
|
10331
|
+
function getApiKeyName(type) {
|
|
10332
|
+
switch (type) {
|
|
10333
|
+
case "anthropic": return "ANTHROPIC_API_KEY";
|
|
10334
|
+
case "openai": return "OPENAI_API_KEY";
|
|
10335
|
+
}
|
|
10336
|
+
}
|
|
10337
|
+
/**
|
|
10338
|
+
* Build a provider instance for the given type.
|
|
10339
|
+
*/
|
|
10340
|
+
function buildProvider(type) {
|
|
10341
|
+
switch (type) {
|
|
10342
|
+
case "anthropic": return {
|
|
10343
|
+
type: "anthropic",
|
|
10344
|
+
getModel: getAnthropicModel,
|
|
10345
|
+
getProviderOptions: () => ({}),
|
|
10346
|
+
getTemperature: () => void 0
|
|
10347
|
+
};
|
|
10348
|
+
case "openai": return {
|
|
10349
|
+
type: "openai",
|
|
10350
|
+
getModel: getOpenAIModel,
|
|
10351
|
+
getProviderOptions: () => ({ openai: {
|
|
10352
|
+
structuredOutputs: false,
|
|
10353
|
+
strictJsonSchema: false
|
|
10354
|
+
} }),
|
|
10355
|
+
getTemperature: () => 1
|
|
10356
|
+
};
|
|
10357
|
+
}
|
|
10358
|
+
}
|
|
10359
|
+
/**
|
|
10360
|
+
* Get the current agent provider based on configuration.
|
|
10361
|
+
*
|
|
10362
|
+
* Resolution order:
|
|
10363
|
+
* 1. Explicit configuration via setAgentProvider()
|
|
10364
|
+
* 2. EMBEDDED_AGENT_PROVIDER environment variable
|
|
10365
|
+
* 3. Auto-detect: check ANTHROPIC_API_KEY, then OPENAI_API_KEY
|
|
10366
|
+
* 4. Throw ConfigurationError if no provider available
|
|
10367
|
+
*/
|
|
10368
|
+
function getAgentProvider() {
|
|
10369
|
+
let providerType = configuredProvider;
|
|
10370
|
+
if (!providerType) {
|
|
10371
|
+
const envProvider = process.env.EMBEDDED_AGENT_PROVIDER?.toLowerCase();
|
|
10372
|
+
if (envProvider === "openai" || envProvider === "anthropic") providerType = envProvider;
|
|
10373
|
+
}
|
|
10374
|
+
if (providerType && !hasApiKeyForProvider(providerType)) throw new ConfigurationError(`Provider "${providerType}" is configured but ${getApiKeyName(providerType)} is not set. Please set the API key environment variable.`);
|
|
10375
|
+
if (!providerType) {
|
|
10376
|
+
if (process.env.ANTHROPIC_API_KEY) providerType = "anthropic";
|
|
10377
|
+
else if (process.env.OPENAI_API_KEY) providerType = "openai";
|
|
10378
|
+
}
|
|
10379
|
+
if (!providerType) throw new ConfigurationError("No embedded agent provider configured. Set OPENAI_API_KEY or ANTHROPIC_API_KEY environment variable, or use --agent-provider flag to specify a provider.");
|
|
10380
|
+
return buildProvider(providerType);
|
|
10381
|
+
}
|
|
10382
|
+
/**
|
|
10383
|
+
* Check if an embedded agent provider is available.
|
|
10384
|
+
* Returns true if getAgentProvider() would succeed.
|
|
10385
|
+
*/
|
|
10386
|
+
function hasAgentProvider() {
|
|
10387
|
+
try {
|
|
10388
|
+
getAgentProvider();
|
|
10389
|
+
return true;
|
|
10390
|
+
} catch {
|
|
10391
|
+
return false;
|
|
10392
|
+
}
|
|
10393
|
+
}
|
|
10394
|
+
/**
|
|
10395
|
+
* Get the resolved provider type without throwing.
|
|
10396
|
+
* Returns undefined if no provider is available or API key is missing.
|
|
10397
|
+
*/
|
|
10398
|
+
function getResolvedProviderType() {
|
|
10399
|
+
if (configuredProvider) return hasApiKeyForProvider(configuredProvider) ? configuredProvider : void 0;
|
|
10400
|
+
const envProvider = process.env.EMBEDDED_AGENT_PROVIDER?.toLowerCase();
|
|
10401
|
+
if (envProvider === "openai" || envProvider === "anthropic") return hasApiKeyForProvider(envProvider) ? envProvider : void 0;
|
|
10402
|
+
if (process.env.ANTHROPIC_API_KEY) return "anthropic";
|
|
10403
|
+
if (process.env.OPENAI_API_KEY) return "openai";
|
|
10404
|
+
return void 0;
|
|
8992
10405
|
}
|
|
8993
10406
|
|
|
8994
10407
|
//#endregion
|
|
@@ -13843,8 +15256,8 @@ var SseMCPTransport = class {
|
|
|
13843
15256
|
this.headers = headers;
|
|
13844
15257
|
}
|
|
13845
15258
|
async start() {
|
|
13846
|
-
return new Promise((resolve, reject) => {
|
|
13847
|
-
if (this.connected) return resolve();
|
|
15259
|
+
return new Promise((resolve$1, reject) => {
|
|
15260
|
+
if (this.connected) return resolve$1();
|
|
13848
15261
|
this.abortController = new AbortController();
|
|
13849
15262
|
const establishConnection = async () => {
|
|
13850
15263
|
var _a17, _b, _c;
|
|
@@ -13879,7 +15292,7 @@ var SseMCPTransport = class {
|
|
|
13879
15292
|
this.endpoint = new URL(data, this.url);
|
|
13880
15293
|
if (this.endpoint.origin !== this.url.origin) throw new MCPClientError({ message: `MCP SSE Transport Error: Endpoint origin does not match connection origin: ${this.endpoint.origin}` });
|
|
13881
15294
|
this.connected = true;
|
|
13882
|
-
resolve();
|
|
15295
|
+
resolve$1();
|
|
13883
15296
|
} else if (event === "message") try {
|
|
13884
15297
|
const message = JSONRPCMessageSchema.parse(JSON.parse(data));
|
|
13885
15298
|
(_a18 = this.onmessage) == null || _a18.call(this, message);
|
|
@@ -14018,7 +15431,7 @@ var MCPClient = class {
|
|
|
14018
15431
|
}
|
|
14019
15432
|
}
|
|
14020
15433
|
async request({ request, resultSchema, options }) {
|
|
14021
|
-
return new Promise((resolve, reject) => {
|
|
15434
|
+
return new Promise((resolve$1, reject) => {
|
|
14022
15435
|
if (this.isClosed) return reject(new MCPClientError({ message: "Attempted to send a request from a closed client" }));
|
|
14023
15436
|
this.assertCapability(request.method);
|
|
14024
15437
|
const signal = options == null ? void 0 : options.signal;
|
|
@@ -14040,7 +15453,7 @@ var MCPClient = class {
|
|
|
14040
15453
|
if (response instanceof Error) return reject(response);
|
|
14041
15454
|
try {
|
|
14042
15455
|
const result = resultSchema.parse(response.result);
|
|
14043
|
-
resolve(result);
|
|
15456
|
+
resolve$1(result);
|
|
14044
15457
|
} catch (error) {
|
|
14045
15458
|
const parseError = new MCPClientError({
|
|
14046
15459
|
message: "Failed to parse server response",
|
|
@@ -14267,7 +15680,7 @@ function trimStartOfStream() {
|
|
|
14267
15680
|
var HANGING_STREAM_WARNING_TIME_MS = 15 * 1e3;
|
|
14268
15681
|
|
|
14269
15682
|
//#endregion
|
|
14270
|
-
//#region ../mcp-core/dist/callEmbeddedAgent-
|
|
15683
|
+
//#region ../mcp-core/dist/callEmbeddedAgent-BoQGUoqc.js
|
|
14271
15684
|
/**
|
|
14272
15685
|
* Call an embedded agent with tool call capture
|
|
14273
15686
|
* This is the standard way to call embedded AI agents within MCP tools
|
|
@@ -14278,22 +15691,20 @@ var HANGING_STREAM_WARNING_TIME_MS = 15 * 1e3;
|
|
|
14278
15691
|
*/
|
|
14279
15692
|
async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
14280
15693
|
const capturedToolCalls = [];
|
|
15694
|
+
const provider = getAgentProvider();
|
|
14281
15695
|
const result = await generateText({
|
|
14282
|
-
model:
|
|
15696
|
+
model: provider.getModel(),
|
|
14283
15697
|
system,
|
|
14284
15698
|
prompt,
|
|
14285
15699
|
tools,
|
|
14286
15700
|
maxSteps: 5,
|
|
14287
|
-
temperature:
|
|
15701
|
+
...provider.getTemperature() !== void 0 && { temperature: provider.getTemperature() },
|
|
14288
15702
|
experimental_output: output_exports.object({ schema }),
|
|
14289
15703
|
experimental_telemetry: {
|
|
14290
15704
|
isEnabled: true,
|
|
14291
15705
|
functionId: "callEmbeddedAgent"
|
|
14292
15706
|
},
|
|
14293
|
-
providerOptions:
|
|
14294
|
-
structuredOutputs: false,
|
|
14295
|
-
strictJsonSchema: false
|
|
14296
|
-
} },
|
|
15707
|
+
providerOptions: provider.getProviderOptions(),
|
|
14297
15708
|
onStepFinish: (event) => {
|
|
14298
15709
|
if (event.toolCalls && event.toolCalls.length > 0) for (const toolCall of event.toolCalls) capturedToolCalls.push({
|
|
14299
15710
|
toolName: toolCall.toolName,
|
|
@@ -14313,7 +15724,7 @@ async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
|
14313
15724
|
}
|
|
14314
15725
|
|
|
14315
15726
|
//#endregion
|
|
14316
|
-
//#region ../mcp-core/dist/utils-
|
|
15727
|
+
//#region ../mcp-core/dist/utils-BhgZ4dUB.js
|
|
14317
15728
|
/**
|
|
14318
15729
|
* Standard response schema for all embedded agent tools.
|
|
14319
15730
|
* Tools return either an error message or the result data, never both.
|
|
@@ -14395,7 +15806,7 @@ function agentTool(config) {
|
|
|
14395
15806
|
}
|
|
14396
15807
|
|
|
14397
15808
|
//#endregion
|
|
14398
|
-
//#region ../mcp-core/dist/otel-semantics-
|
|
15809
|
+
//#region ../mcp-core/dist/otel-semantics-B5qAIqUa.js
|
|
14399
15810
|
var namespace$72 = "android";
|
|
14400
15811
|
var description$72 = "The Android platform on which the Android application is running.\n";
|
|
14401
15812
|
var attributes$72 = {
|
|
@@ -19241,7 +20652,7 @@ function createOtelLookupTool(options) {
|
|
|
19241
20652
|
}
|
|
19242
20653
|
|
|
19243
20654
|
//#endregion
|
|
19244
|
-
//#region ../mcp-core/dist/whoami-
|
|
20655
|
+
//#region ../mcp-core/dist/whoami-CnHpsyv0.js
|
|
19245
20656
|
/**
|
|
19246
20657
|
* Get the current authenticated user's information from Sentry API
|
|
19247
20658
|
*/
|
|
@@ -19270,7 +20681,7 @@ function createWhoamiTool(options) {
|
|
|
19270
20681
|
}
|
|
19271
20682
|
|
|
19272
20683
|
//#endregion
|
|
19273
|
-
//#region ../mcp-core/dist/utils-
|
|
20684
|
+
//#region ../mcp-core/dist/utils-CRDu-UNV.js
|
|
19274
20685
|
function getStringValue(event, key, defaultValue = "") {
|
|
19275
20686
|
const value = event[key];
|
|
19276
20687
|
return typeof value === "string" ? value : defaultValue;
|
|
@@ -19323,7 +20734,7 @@ function createDatasetAttributesTool(options) {
|
|
|
19323
20734
|
"logs"
|
|
19324
20735
|
]).describe("The dataset to query attributes for") }),
|
|
19325
20736
|
execute: async ({ dataset }) => {
|
|
19326
|
-
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await Promise.resolve().then(() => require("./config-
|
|
20737
|
+
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await Promise.resolve().then(() => require("./config-CwE3_vz4.cjs"));
|
|
19327
20738
|
const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId);
|
|
19328
20739
|
const allFields = {
|
|
19329
20740
|
...BASE_COMMON_FIELDS,
|
|
@@ -19358,7 +20769,7 @@ Use these examples as patterns for constructing your query.`;
|
|
|
19358
20769
|
}
|
|
19359
20770
|
|
|
19360
20771
|
//#endregion
|
|
19361
|
-
//#region ../mcp-core/dist/agent-
|
|
20772
|
+
//#region ../mcp-core/dist/agent-ChQa0if8.js
|
|
19362
20773
|
const searchEventsAgentOutputSchema = zod.z.object({
|
|
19363
20774
|
dataset: zod.z.enum([
|
|
19364
20775
|
"spans",
|
|
@@ -19387,7 +20798,6 @@ const searchEventsAgentOutputSchema = zod.z.object({
|
|
|
19387
20798
|
* This returns both the translated query result AND the tool calls made by the agent
|
|
19388
20799
|
*/
|
|
19389
20800
|
async function searchEventsAgent(options) {
|
|
19390
|
-
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for semantic search");
|
|
19391
20801
|
const datasetAttributesTool = createDatasetAttributesTool({
|
|
19392
20802
|
apiService: options.apiService,
|
|
19393
20803
|
organizationSlug: options.organizationSlug,
|
|
@@ -19400,7 +20810,7 @@ async function searchEventsAgent(options) {
|
|
|
19400
20810
|
});
|
|
19401
20811
|
const whoamiTool = createWhoamiTool({ apiService: options.apiService });
|
|
19402
20812
|
return await callEmbeddedAgent({
|
|
19403
|
-
system:
|
|
20813
|
+
system: require_config_CEjP2CYO.systemPrompt,
|
|
19404
20814
|
prompt: options.query,
|
|
19405
20815
|
tools: {
|
|
19406
20816
|
datasetAttributes: datasetAttributesTool,
|
|
@@ -19412,7 +20822,7 @@ async function searchEventsAgent(options) {
|
|
|
19412
20822
|
}
|
|
19413
20823
|
|
|
19414
20824
|
//#endregion
|
|
19415
|
-
//#region ../mcp-core/dist/formatters-
|
|
20825
|
+
//#region ../mcp-core/dist/formatters-CJK-ciCF.js
|
|
19416
20826
|
/**
|
|
19417
20827
|
* Format an explanation for how a natural language query was translated
|
|
19418
20828
|
*/
|
|
@@ -19630,7 +21040,7 @@ function formatSpanResults(params) {
|
|
|
19630
21040
|
}
|
|
19631
21041
|
|
|
19632
21042
|
//#endregion
|
|
19633
|
-
//#region ../mcp-core/dist/handler-
|
|
21043
|
+
//#region ../mcp-core/dist/handler-DdfFan0E.js
|
|
19634
21044
|
var handler_default = defineTool({
|
|
19635
21045
|
name: "search_events",
|
|
19636
21046
|
skills: [
|
|
@@ -19710,7 +21120,7 @@ var handler_default = defineTool({
|
|
|
19710
21120
|
});
|
|
19711
21121
|
const parsed = agentResult.result;
|
|
19712
21122
|
const dataset = parsed.dataset;
|
|
19713
|
-
const recommendedFields =
|
|
21123
|
+
const recommendedFields = require_config_CEjP2CYO.RECOMMENDED_FIELDS[dataset];
|
|
19714
21124
|
if (!parsed.sort) throw new UserInputError(`Search Events Agent response missing required 'sort' parameter. Received: ${JSON.stringify(parsed, null, 2)}. The agent must specify how to sort results (e.g., '-timestamp' for newest first, '-count()' for highest count).`);
|
|
19715
21125
|
const sentryQuery = parsed.query || "";
|
|
19716
21126
|
const requestedFields = parsed.fields || [];
|
|
@@ -19771,7 +21181,7 @@ var handler_default = defineTool({
|
|
|
19771
21181
|
});
|
|
19772
21182
|
|
|
19773
21183
|
//#endregion
|
|
19774
|
-
//#region ../mcp-core/dist/create-team-
|
|
21184
|
+
//#region ../mcp-core/dist/create-team-ybunuUI_.js
|
|
19775
21185
|
var create_team_default = defineTool({
|
|
19776
21186
|
name: "create_team",
|
|
19777
21187
|
skills: ["project-management"],
|
|
@@ -19826,7 +21236,7 @@ var create_team_default = defineTool({
|
|
|
19826
21236
|
});
|
|
19827
21237
|
|
|
19828
21238
|
//#endregion
|
|
19829
|
-
//#region ../mcp-core/dist/create-project-
|
|
21239
|
+
//#region ../mcp-core/dist/create-project-BozSQ6GO.js
|
|
19830
21240
|
var create_project_default = defineTool({
|
|
19831
21241
|
name: "create_project",
|
|
19832
21242
|
skills: ["project-management"],
|
|
@@ -19903,7 +21313,7 @@ var create_project_default = defineTool({
|
|
|
19903
21313
|
});
|
|
19904
21314
|
|
|
19905
21315
|
//#endregion
|
|
19906
|
-
//#region ../mcp-core/dist/update-project-
|
|
21316
|
+
//#region ../mcp-core/dist/update-project-CSbOMuOW.js
|
|
19907
21317
|
var update_project_default = defineTool({
|
|
19908
21318
|
name: "update_project",
|
|
19909
21319
|
skills: ["project-management"],
|
|
@@ -20021,7 +21431,7 @@ var update_project_default = defineTool({
|
|
|
20021
21431
|
});
|
|
20022
21432
|
|
|
20023
21433
|
//#endregion
|
|
20024
|
-
//#region ../mcp-core/dist/create-dsn-
|
|
21434
|
+
//#region ../mcp-core/dist/create-dsn-BymieFiV.js
|
|
20025
21435
|
var create_dsn_default = defineTool({
|
|
20026
21436
|
name: "create_dsn",
|
|
20027
21437
|
skills: ["project-management"],
|
|
@@ -20081,7 +21491,7 @@ var create_dsn_default = defineTool({
|
|
|
20081
21491
|
});
|
|
20082
21492
|
|
|
20083
21493
|
//#endregion
|
|
20084
|
-
//#region ../mcp-core/dist/find-dsns-
|
|
21494
|
+
//#region ../mcp-core/dist/find-dsns-_H3b8I5-.js
|
|
20085
21495
|
var find_dsns_default = defineTool({
|
|
20086
21496
|
name: "find_dsns",
|
|
20087
21497
|
skills: ["project-management"],
|
|
@@ -20132,7 +21542,7 @@ var find_dsns_default = defineTool({
|
|
|
20132
21542
|
});
|
|
20133
21543
|
|
|
20134
21544
|
//#endregion
|
|
20135
|
-
//#region ../mcp-core/dist/fetch-utils-
|
|
21545
|
+
//#region ../mcp-core/dist/fetch-utils-LjUGSOvJ.js
|
|
20136
21546
|
/**
|
|
20137
21547
|
* Fetch with timeout using AbortController
|
|
20138
21548
|
* @param url - The URL to fetch
|
|
@@ -20175,14 +21585,14 @@ async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, should
|
|
|
20175
21585
|
} catch (error) {
|
|
20176
21586
|
lastError = error;
|
|
20177
21587
|
if (attempt === maxRetries || !shouldRetry(error)) throw error;
|
|
20178
|
-
await new Promise((resolve) => setTimeout(resolve, delay$1));
|
|
21588
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, delay$1));
|
|
20179
21589
|
delay$1 = Math.min(delay$1 * 2, 3e4);
|
|
20180
21590
|
}
|
|
20181
21591
|
throw lastError;
|
|
20182
21592
|
}
|
|
20183
21593
|
|
|
20184
21594
|
//#endregion
|
|
20185
|
-
//#region ../mcp-core/dist/analyze-issue-with-seer-
|
|
21595
|
+
//#region ../mcp-core/dist/analyze-issue-with-seer-C6Ke4lsw.js
|
|
20186
21596
|
var analyze_issue_with_seer_default = defineTool({
|
|
20187
21597
|
name: "analyze_issue_with_seer",
|
|
20188
21598
|
skills: ["seer"],
|
|
@@ -20267,7 +21677,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20267
21677
|
instruction: params.instruction
|
|
20268
21678
|
});
|
|
20269
21679
|
output += `Analysis started with Run ID: ${startResult.run_id}\n\n`;
|
|
20270
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
21680
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, 1e3));
|
|
20271
21681
|
autofixState = await retryWithBackoff(() => apiService.getAutofixState({
|
|
20272
21682
|
organizationSlug: orgSlug,
|
|
20273
21683
|
issueId: parsedIssueId
|
|
@@ -20324,7 +21734,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20324
21734
|
if (activeStep) output += `Processing: ${activeStep.title}...\n`;
|
|
20325
21735
|
lastStatus = status;
|
|
20326
21736
|
}
|
|
20327
|
-
await new Promise((resolve) => setTimeout(resolve, SEER_POLLING_INTERVAL));
|
|
21737
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, SEER_POLLING_INTERVAL));
|
|
20328
21738
|
try {
|
|
20329
21739
|
autofixState = await retryWithBackoff(() => apiService.getAutofixState({
|
|
20330
21740
|
organizationSlug: orgSlug,
|
|
@@ -20370,7 +21780,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20370
21780
|
});
|
|
20371
21781
|
|
|
20372
21782
|
//#endregion
|
|
20373
|
-
//#region ../mcp-core/dist/search-docs-
|
|
21783
|
+
//#region ../mcp-core/dist/search-docs-yQc8o0ap.js
|
|
20374
21784
|
var search_docs_default = defineTool({
|
|
20375
21785
|
name: "search_docs",
|
|
20376
21786
|
skills: ["docs"],
|
|
@@ -20453,7 +21863,7 @@ var search_docs_default = defineTool({
|
|
|
20453
21863
|
});
|
|
20454
21864
|
|
|
20455
21865
|
//#endregion
|
|
20456
|
-
//#region ../mcp-core/dist/get-doc-
|
|
21866
|
+
//#region ../mcp-core/dist/get-doc-Ce6QYANY.js
|
|
20457
21867
|
var get_doc_default = defineTool({
|
|
20458
21868
|
name: "get_doc",
|
|
20459
21869
|
skills: ["docs"],
|
|
@@ -20530,7 +21940,7 @@ var get_doc_default = defineTool({
|
|
|
20530
21940
|
});
|
|
20531
21941
|
|
|
20532
21942
|
//#endregion
|
|
20533
|
-
//#region ../mcp-core/dist/dataset-fields-
|
|
21943
|
+
//#region ../mcp-core/dist/dataset-fields-ClLuCTh4.js
|
|
20534
21944
|
/**
|
|
20535
21945
|
* Discover available fields for a dataset by querying Sentry's tags API
|
|
20536
21946
|
*/
|
|
@@ -20680,7 +22090,7 @@ function getCommonPatterns(dataset) {
|
|
|
20680
22090
|
}
|
|
20681
22091
|
|
|
20682
22092
|
//#endregion
|
|
20683
|
-
//#region ../mcp-core/dist/config-
|
|
22093
|
+
//#region ../mcp-core/dist/config-C3fctASk.js
|
|
20684
22094
|
/**
|
|
20685
22095
|
* Configuration for the search-issues agent
|
|
20686
22096
|
*/
|
|
@@ -20698,13 +22108,16 @@ BUILT-IN FIELDS:
|
|
|
20698
22108
|
- level: Severity level (error, warning, info, debug, fatal)
|
|
20699
22109
|
IMPORTANT: Almost NEVER use this field. Terms like "critical", "important", "severe" refer to IMPACT not level.
|
|
20700
22110
|
Only use if user explicitly says "error level", "warning level", etc.
|
|
22111
|
+
- issueCategory: Issue classification (error, performance, metric, feedback)
|
|
22112
|
+
IMPORTANT: User feedback from the User Feedback Widget is stored as issues with issueCategory:feedback
|
|
22113
|
+
Use this field when users ask about "user feedback", "feedback submissions", "user reports", etc.
|
|
20701
22114
|
- environment: Deployment environment (production, staging, development)
|
|
20702
22115
|
- release: Version/release identifier
|
|
20703
22116
|
- firstSeen: When the issue was FIRST encountered (use for "new issues", "started", "began")
|
|
20704
22117
|
WARNING: Excludes ongoing issues that started before the time window
|
|
20705
22118
|
- lastSeen: When the issue was LAST encountered (use for "from the last", "recent", "active")
|
|
20706
22119
|
This includes ALL issues seen during the time window, regardless of when they started
|
|
20707
|
-
- assigned: Issues explicitly assigned to a user (email or "me")
|
|
22120
|
+
- assigned: Issues explicitly assigned to a user (email or "me")
|
|
20708
22121
|
- assignedOrSuggested: Issues assigned to OR suggested for a user (broader match)
|
|
20709
22122
|
- userCount: Number of unique users affected
|
|
20710
22123
|
- eventCount: Total number of events
|
|
@@ -20716,6 +22129,9 @@ COMMON QUERY PATTERNS:
|
|
|
20716
22129
|
- New issues: firstSeen:-7d
|
|
20717
22130
|
- High impact: userCount:>100
|
|
20718
22131
|
- My work: assignedOrSuggested:me
|
|
22132
|
+
- User feedback: issueCategory:feedback
|
|
22133
|
+
- Recent feedback: issueCategory:feedback lastSeen:-7d
|
|
22134
|
+
- Feedback from production: issueCategory:feedback environment:production
|
|
20719
22135
|
|
|
20720
22136
|
SORTING RULES:
|
|
20721
22137
|
1. CRITICAL: Sort MUST go in the separate "sort" field, NEVER in the "query" field
|
|
@@ -20739,6 +22155,8 @@ EXAMPLES:
|
|
|
20739
22155
|
"critical bugs" → query: "level:error is:unresolved", sort: "date"
|
|
20740
22156
|
"worst issues affecting the most users" → query: "is:unresolved", sort: "user"
|
|
20741
22157
|
"assigned to john@example.com" → query: "assignedOrSuggested:john@example.com", sort: "date"
|
|
22158
|
+
"show me user feedback" → query: "issueCategory:feedback", sort: "date"
|
|
22159
|
+
"feedback from the last week" → query: "issueCategory:feedback lastSeen:-7d", sort: "date"
|
|
20742
22160
|
|
|
20743
22161
|
NEVER: query: "is:unresolved sort:user" ← Sort goes in separate field!
|
|
20744
22162
|
|
|
@@ -20752,7 +22170,7 @@ Always use the issueFields tool to discover available fields when needed.
|
|
|
20752
22170
|
Use the whoami tool when you need to resolve 'me' references.`;
|
|
20753
22171
|
|
|
20754
22172
|
//#endregion
|
|
20755
|
-
//#region ../mcp-core/dist/agent-
|
|
22173
|
+
//#region ../mcp-core/dist/agent-qJanDgXA.js
|
|
20756
22174
|
const searchIssuesAgentOutputSchema = zod.z.object({
|
|
20757
22175
|
query: zod.z.string().describe("The Sentry issue search query"),
|
|
20758
22176
|
sort: zod.z.enum([
|
|
@@ -20768,7 +22186,6 @@ const searchIssuesAgentOutputSchema = zod.z.object({
|
|
|
20768
22186
|
* This returns both the translated query result AND the tool calls made by the agent
|
|
20769
22187
|
*/
|
|
20770
22188
|
async function searchIssuesAgent(options) {
|
|
20771
|
-
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for semantic search");
|
|
20772
22189
|
return await callEmbeddedAgent({
|
|
20773
22190
|
system: systemPrompt$3,
|
|
20774
22191
|
prompt: options.query,
|
|
@@ -20786,7 +22203,7 @@ async function searchIssuesAgent(options) {
|
|
|
20786
22203
|
}
|
|
20787
22204
|
|
|
20788
22205
|
//#endregion
|
|
20789
|
-
//#region ../mcp-core/dist/formatters-
|
|
22206
|
+
//#region ../mcp-core/dist/formatters-BcLCXcro.js
|
|
20790
22207
|
/**
|
|
20791
22208
|
* Format an explanation for how a natural language query was translated
|
|
20792
22209
|
*/
|
|
@@ -20829,6 +22246,7 @@ function formatIssueResults(params) {
|
|
|
20829
22246
|
output += `## ${index + 1}. [${issue.shortId}](${issueUrl})\n\n`;
|
|
20830
22247
|
output += `**${issue.title}**\n\n`;
|
|
20831
22248
|
output += `- **Status**: ${issue.status}\n`;
|
|
22249
|
+
if (issue.issueCategory && issue.issueCategory !== "error") output += `- **Category**: ${issue.issueCategory}\n`;
|
|
20832
22250
|
output += `- **Users**: ${issue.userCount || 0}\n`;
|
|
20833
22251
|
output += `- **Events**: ${issue.count || 0}\n`;
|
|
20834
22252
|
if (issue.assignedTo) {
|
|
@@ -20845,6 +22263,8 @@ function formatIssueResults(params) {
|
|
|
20845
22263
|
output += "- Get more details about a specific issue: Use the Issue ID with get_issue_details\n";
|
|
20846
22264
|
output += "- Update issue status: Use update_issue to resolve or assign issues\n";
|
|
20847
22265
|
output += "- View event counts: Use search_events for aggregated statistics\n";
|
|
22266
|
+
const hasFeedback = issues.some((i) => i.issueCategory === "feedback");
|
|
22267
|
+
if (hasFeedback) output += "- View feedback details: Use get_issue_details to see full feedback content and linked error events\n";
|
|
20848
22268
|
return output;
|
|
20849
22269
|
}
|
|
20850
22270
|
/**
|
|
@@ -20863,11 +22283,11 @@ function formatDate(dateString) {
|
|
|
20863
22283
|
if (diffHours < 24) return `${diffHours} hour${diffHours === 1 ? "" : "s"} ago`;
|
|
20864
22284
|
const diffDays = Math.floor(diffHours / 24);
|
|
20865
22285
|
if (diffDays < 30) return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
|
|
20866
|
-
return date.
|
|
22286
|
+
return date.toISOString().split("T")[0];
|
|
20867
22287
|
}
|
|
20868
22288
|
|
|
20869
22289
|
//#endregion
|
|
20870
|
-
//#region ../mcp-core/dist/handler-
|
|
22290
|
+
//#region ../mcp-core/dist/handler-DriMefmS.js
|
|
20871
22291
|
var handler_default$1 = defineTool({
|
|
20872
22292
|
name: "search_issues",
|
|
20873
22293
|
skills: [
|
|
@@ -20887,6 +22307,7 @@ var handler_default$1 = defineTool({
|
|
|
20887
22307
|
"- Filtered issue lists: 'unresolved issues', 'critical bugs'",
|
|
20888
22308
|
"- Issues by impact: 'errors affecting more than 100 users'",
|
|
20889
22309
|
"- Issues by assignment: 'issues assigned to me'",
|
|
22310
|
+
"- User feedback: 'show me user feedback', 'feedback from last week'",
|
|
20890
22311
|
"",
|
|
20891
22312
|
"DO NOT USE FOR COUNTS/AGGREGATIONS:",
|
|
20892
22313
|
"- 'how many errors' → use search_events",
|
|
@@ -20904,6 +22325,7 @@ var handler_default$1 = defineTool({
|
|
|
20904
22325
|
"search_issues(organizationSlug='my-org', naturalLanguageQuery='critical bugs from last week')",
|
|
20905
22326
|
"search_issues(organizationSlug='my-org', naturalLanguageQuery='unhandled errors affecting 100+ users')",
|
|
20906
22327
|
"search_issues(organizationSlug='my-org', naturalLanguageQuery='issues assigned to me')",
|
|
22328
|
+
"search_issues(organizationSlug='my-org', naturalLanguageQuery='user feedback from production')",
|
|
20907
22329
|
"</examples>",
|
|
20908
22330
|
"",
|
|
20909
22331
|
"<hints>",
|
|
@@ -20988,7 +22410,7 @@ var handler_default$1 = defineTool({
|
|
|
20988
22410
|
});
|
|
20989
22411
|
|
|
20990
22412
|
//#endregion
|
|
20991
|
-
//#region ../mcp-core/dist/config-
|
|
22413
|
+
//#region ../mcp-core/dist/config-mlP4H0sA.js
|
|
20992
22414
|
const systemPrompt$2 = `You are a Sentry issue event filter translator. Your job is to:
|
|
20993
22415
|
1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
|
|
20994
22416
|
2. Select appropriate fields to return in the results
|
|
@@ -21323,7 +22745,7 @@ const EXAMPLE_QUERIES = [
|
|
|
21323
22745
|
];
|
|
21324
22746
|
|
|
21325
22747
|
//#endregion
|
|
21326
|
-
//#region ../mcp-core/dist/utils-
|
|
22748
|
+
//#region ../mcp-core/dist/utils-D8xperPO.js
|
|
21327
22749
|
/**
|
|
21328
22750
|
* Create a tool for the agent to query available tags and fields for issue events
|
|
21329
22751
|
* The tool is pre-bound with the API service and organization configured for the appropriate region
|
|
@@ -21400,7 +22822,7 @@ Received: ${params.issueUrl}`);
|
|
|
21400
22822
|
}
|
|
21401
22823
|
|
|
21402
22824
|
//#endregion
|
|
21403
|
-
//#region ../mcp-core/dist/agent-
|
|
22825
|
+
//#region ../mcp-core/dist/agent-BGV8TUGG.js
|
|
21404
22826
|
const searchIssueEventsAgentOutputSchema = zod.z.object({
|
|
21405
22827
|
query: zod.z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
|
|
21406
22828
|
fields: zod.z.array(zod.z.string()).describe("Array of field names to return in results"),
|
|
@@ -21424,7 +22846,6 @@ const searchIssueEventsAgentOutputSchema = zod.z.object({
|
|
|
21424
22846
|
* Returns both the translated query result AND the tool calls made by the agent
|
|
21425
22847
|
*/
|
|
21426
22848
|
async function searchIssueEventsAgent(options) {
|
|
21427
|
-
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for natural language query translation");
|
|
21428
22849
|
const issueEventFieldsTool = createIssueEventFieldsTool({
|
|
21429
22850
|
apiService: options.apiService,
|
|
21430
22851
|
organizationSlug: options.organizationSlug,
|
|
@@ -21443,7 +22864,7 @@ async function searchIssueEventsAgent(options) {
|
|
|
21443
22864
|
}
|
|
21444
22865
|
|
|
21445
22866
|
//#endregion
|
|
21446
|
-
//#region ../mcp-core/dist/handler-
|
|
22867
|
+
//#region ../mcp-core/dist/handler-dNZGGGFd.js
|
|
21447
22868
|
var handler_default$2 = defineTool({
|
|
21448
22869
|
name: "search_issue_events",
|
|
21449
22870
|
skills: ["inspect", "triage"],
|
|
@@ -21545,7 +22966,7 @@ var handler_default$2 = defineTool({
|
|
|
21545
22966
|
});
|
|
21546
22967
|
|
|
21547
22968
|
//#endregion
|
|
21548
|
-
//#region ../mcp-core/dist/config-
|
|
22969
|
+
//#region ../mcp-core/dist/config-BJzhfINu.js
|
|
21549
22970
|
/**
|
|
21550
22971
|
* Configuration for the use_sentry embedded agent.
|
|
21551
22972
|
*
|
|
@@ -21564,7 +22985,7 @@ The user may include various parameters to pass to those tools in their prompt.
|
|
|
21564
22985
|
You MUST return tool results directly without interpreting them.`;
|
|
21565
22986
|
|
|
21566
22987
|
//#endregion
|
|
21567
|
-
//#region ../mcp-core/dist/agent-
|
|
22988
|
+
//#region ../mcp-core/dist/agent-2JRDh9Lm.js
|
|
21568
22989
|
/**
|
|
21569
22990
|
* Output schema for the embedded agent.
|
|
21570
22991
|
* The agent returns the final result string directly from its tool calls.
|
|
@@ -21575,7 +22996,6 @@ const outputSchema = zod.z.object({ result: zod.z.string().describe("The final r
|
|
|
21575
22996
|
* This returns the final result AND the tool calls made by the agent
|
|
21576
22997
|
*/
|
|
21577
22998
|
async function useSentryAgent(options) {
|
|
21578
|
-
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for use_sentry tool");
|
|
21579
22999
|
const prompt = options.request;
|
|
21580
23000
|
return await callEmbeddedAgent({
|
|
21581
23001
|
system: systemPrompt$1,
|
|
@@ -21586,7 +23006,296 @@ async function useSentryAgent(options) {
|
|
|
21586
23006
|
}
|
|
21587
23007
|
|
|
21588
23008
|
//#endregion
|
|
21589
|
-
//#region ../mcp-core/dist/
|
|
23009
|
+
//#region ../mcp-core/dist/list-issues-DpmIWiEG.js
|
|
23010
|
+
var list_issues_default = defineTool({
|
|
23011
|
+
name: "list_issues",
|
|
23012
|
+
skills: [
|
|
23013
|
+
"inspect",
|
|
23014
|
+
"triage",
|
|
23015
|
+
"seer"
|
|
23016
|
+
],
|
|
23017
|
+
requiredScopes: ["event:read"],
|
|
23018
|
+
description: [
|
|
23019
|
+
"List issues using Sentry query syntax directly (no AI/LLM required).",
|
|
23020
|
+
"",
|
|
23021
|
+
"Use this tool when:",
|
|
23022
|
+
"- You know Sentry query syntax already",
|
|
23023
|
+
"- AI-powered search is unavailable (no OPENAI_API_KEY or ANTHROPIC_API_KEY)",
|
|
23024
|
+
"- You want precise control over the query",
|
|
23025
|
+
"",
|
|
23026
|
+
"For natural language queries, use search_issues instead.",
|
|
23027
|
+
"",
|
|
23028
|
+
"Common Query Syntax:",
|
|
23029
|
+
"- is:unresolved - Show unresolved issues only",
|
|
23030
|
+
"- is:unassigned - Show unassigned issues",
|
|
23031
|
+
"- level:error - Filter by error level",
|
|
23032
|
+
"- firstSeen:-24h - First seen in last 24 hours",
|
|
23033
|
+
"- lastSeen:-1h - Last seen in last hour",
|
|
23034
|
+
"- has:user - Issues with user context",
|
|
23035
|
+
"- user.email:user@example.com - Filter by user email",
|
|
23036
|
+
"- environment:production - Filter by environment",
|
|
23037
|
+
"- release:1.0.0 - Filter by release version",
|
|
23038
|
+
"",
|
|
23039
|
+
"Combine queries: is:unresolved is:unassigned level:error",
|
|
23040
|
+
"",
|
|
23041
|
+
"<examples>",
|
|
23042
|
+
"list_issues(organizationSlug='my-org', query='is:unresolved is:unassigned')",
|
|
23043
|
+
"list_issues(organizationSlug='my-org', query='level:error firstSeen:-24h', sort='freq')",
|
|
23044
|
+
"list_issues(organizationSlug='my-org', projectSlugOrId='my-project', query='is:unresolved')",
|
|
23045
|
+
"</examples>",
|
|
23046
|
+
"",
|
|
23047
|
+
"<hints>",
|
|
23048
|
+
"- If the user passes a parameter in the form of name/otherName, it's likely in the format of <organizationSlug>/<projectSlugOrId>.",
|
|
23049
|
+
"- The projectSlugOrId parameter accepts both project slugs (e.g., 'my-project') and numeric IDs (e.g., '123456').",
|
|
23050
|
+
"</hints>"
|
|
23051
|
+
].join("\n"),
|
|
23052
|
+
inputSchema: {
|
|
23053
|
+
organizationSlug: ParamOrganizationSlug,
|
|
23054
|
+
query: zod.z.string().trim().default("is:unresolved").describe("Sentry issue search query syntax"),
|
|
23055
|
+
projectSlugOrId: zod.z.string().toLowerCase().trim().superRefine(validateSlugOrId).nullable().default(null).describe("Filter by project slug or numeric ID (optional)"),
|
|
23056
|
+
sort: zod.z.enum([
|
|
23057
|
+
"date",
|
|
23058
|
+
"freq",
|
|
23059
|
+
"new",
|
|
23060
|
+
"user"
|
|
23061
|
+
]).default("date").describe("Sort order: date (last seen), freq (frequency), new (first seen), user (user count)"),
|
|
23062
|
+
limit: zod.z.number().min(1).max(100).default(10).describe("Maximum number of issues to return (1-100)"),
|
|
23063
|
+
regionUrl: ParamRegionUrl.nullable().default(null)
|
|
23064
|
+
},
|
|
23065
|
+
annotations: {
|
|
23066
|
+
readOnlyHint: true,
|
|
23067
|
+
openWorldHint: true
|
|
23068
|
+
},
|
|
23069
|
+
async handler(params, context$1) {
|
|
23070
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
23071
|
+
(0, __sentry_core.setTag)("organization.slug", params.organizationSlug);
|
|
23072
|
+
if (params.projectSlugOrId) if (isNumericId(params.projectSlugOrId)) (0, __sentry_core.setTag)("project.id", params.projectSlugOrId);
|
|
23073
|
+
else (0, __sentry_core.setTag)("project.slug", params.projectSlugOrId);
|
|
23074
|
+
const issues = await apiService.listIssues({
|
|
23075
|
+
organizationSlug: params.organizationSlug,
|
|
23076
|
+
projectSlug: params.projectSlugOrId ?? void 0,
|
|
23077
|
+
query: params.query,
|
|
23078
|
+
sortBy: params.sort,
|
|
23079
|
+
limit: params.limit
|
|
23080
|
+
});
|
|
23081
|
+
return formatIssueResults({
|
|
23082
|
+
issues,
|
|
23083
|
+
organizationSlug: params.organizationSlug,
|
|
23084
|
+
projectSlugOrId: params.projectSlugOrId ?? void 0,
|
|
23085
|
+
query: params.query,
|
|
23086
|
+
regionUrl: params.regionUrl ?? void 0
|
|
23087
|
+
});
|
|
23088
|
+
}
|
|
23089
|
+
});
|
|
23090
|
+
|
|
23091
|
+
//#endregion
|
|
23092
|
+
//#region ../mcp-core/dist/list-events-BCMaD3UM.js
|
|
23093
|
+
const DEFAULT_FIELDS = {
|
|
23094
|
+
errors: require_config_CEjP2CYO.RECOMMENDED_FIELDS.errors.basic,
|
|
23095
|
+
logs: require_config_CEjP2CYO.RECOMMENDED_FIELDS.logs.basic,
|
|
23096
|
+
spans: require_config_CEjP2CYO.RECOMMENDED_FIELDS.spans.basic
|
|
23097
|
+
};
|
|
23098
|
+
var list_events_default = defineTool({
|
|
23099
|
+
name: "list_events",
|
|
23100
|
+
skills: [
|
|
23101
|
+
"inspect",
|
|
23102
|
+
"triage",
|
|
23103
|
+
"seer"
|
|
23104
|
+
],
|
|
23105
|
+
requiredScopes: ["event:read"],
|
|
23106
|
+
description: [
|
|
23107
|
+
"Search events using Sentry query syntax directly (no AI/LLM required).",
|
|
23108
|
+
"",
|
|
23109
|
+
"Use this tool when:",
|
|
23110
|
+
"- You know Sentry query syntax already",
|
|
23111
|
+
"- AI-powered search is unavailable (no OPENAI_API_KEY or ANTHROPIC_API_KEY)",
|
|
23112
|
+
"- You want precise control over the query",
|
|
23113
|
+
"",
|
|
23114
|
+
"For natural language queries, use search_events instead.",
|
|
23115
|
+
"",
|
|
23116
|
+
"Datasets:",
|
|
23117
|
+
"- errors: Exception/crash events",
|
|
23118
|
+
"- logs: Log entries",
|
|
23119
|
+
"- spans: Performance data, traces, AI/LLM calls",
|
|
23120
|
+
"",
|
|
23121
|
+
"Query Syntax Examples:",
|
|
23122
|
+
"- message:\"connection timeout\"",
|
|
23123
|
+
"- level:error",
|
|
23124
|
+
"- span.op:http.client span.status_code:500",
|
|
23125
|
+
"- log.level:error",
|
|
23126
|
+
"- transaction:/api/users",
|
|
23127
|
+
"",
|
|
23128
|
+
"<examples>",
|
|
23129
|
+
"list_events(organizationSlug='my-org', dataset='errors', query='level:error')",
|
|
23130
|
+
"list_events(organizationSlug='my-org', dataset='spans', query='span.op:db')",
|
|
23131
|
+
"list_events(organizationSlug='my-org', dataset='logs', query='severity:error')",
|
|
23132
|
+
"list_events(organizationSlug='my-org', dataset='errors', fields=['issue', 'count()'], sort='-count()')",
|
|
23133
|
+
"</examples>",
|
|
23134
|
+
"",
|
|
23135
|
+
"<hints>",
|
|
23136
|
+
"- If the user passes a parameter in the form of name/otherName, it's likely in the format of <organizationSlug>/<projectSlug>.",
|
|
23137
|
+
"- Use fields with aggregate functions like count(), avg(), sum() for statistics",
|
|
23138
|
+
"- Sort by -count() for most common, -timestamp for newest",
|
|
23139
|
+
"</hints>"
|
|
23140
|
+
].join("\n"),
|
|
23141
|
+
inputSchema: {
|
|
23142
|
+
organizationSlug: ParamOrganizationSlug,
|
|
23143
|
+
dataset: zod.z.enum([
|
|
23144
|
+
"errors",
|
|
23145
|
+
"logs",
|
|
23146
|
+
"spans"
|
|
23147
|
+
]).default("errors").describe("Dataset to query: errors (exceptions), logs, or spans (traces)"),
|
|
23148
|
+
query: zod.z.string().trim().default("").describe("Sentry event search query syntax (empty for all events)"),
|
|
23149
|
+
fields: zod.z.array(zod.z.string()).nullable().default(null).describe("Fields to return. If not specified, uses sensible defaults. Include aggregate functions like count(), avg() for statistics."),
|
|
23150
|
+
sort: zod.z.string().default("-timestamp").describe("Sort field (prefix with - for descending). Use -count() for aggregations."),
|
|
23151
|
+
projectSlug: ParamProjectSlug.nullable().default(null),
|
|
23152
|
+
statsPeriod: zod.z.string().default("14d").describe("Time period: 1h, 24h, 7d, 14d, 30d, etc."),
|
|
23153
|
+
limit: zod.z.number().min(1).max(100).default(10).describe("Maximum number of results to return (1-100)"),
|
|
23154
|
+
regionUrl: ParamRegionUrl.nullable().default(null)
|
|
23155
|
+
},
|
|
23156
|
+
annotations: {
|
|
23157
|
+
readOnlyHint: true,
|
|
23158
|
+
openWorldHint: true
|
|
23159
|
+
},
|
|
23160
|
+
async handler(params, context$1) {
|
|
23161
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
23162
|
+
(0, __sentry_core.setTag)("organization.slug", params.organizationSlug);
|
|
23163
|
+
if (params.projectSlug) (0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
23164
|
+
let projectId;
|
|
23165
|
+
if (params.projectSlug) {
|
|
23166
|
+
const project = await apiService.getProject({
|
|
23167
|
+
organizationSlug: params.organizationSlug,
|
|
23168
|
+
projectSlugOrId: params.projectSlug
|
|
23169
|
+
});
|
|
23170
|
+
projectId = String(project.id);
|
|
23171
|
+
}
|
|
23172
|
+
const fields = params.fields ?? DEFAULT_FIELDS[params.dataset];
|
|
23173
|
+
const eventsResponse = await apiService.searchEvents({
|
|
23174
|
+
organizationSlug: params.organizationSlug,
|
|
23175
|
+
query: params.query,
|
|
23176
|
+
fields,
|
|
23177
|
+
limit: params.limit,
|
|
23178
|
+
projectId,
|
|
23179
|
+
dataset: params.dataset,
|
|
23180
|
+
sort: params.sort,
|
|
23181
|
+
statsPeriod: params.statsPeriod
|
|
23182
|
+
});
|
|
23183
|
+
function isValidResponse(response) {
|
|
23184
|
+
return typeof response === "object" && response !== null;
|
|
23185
|
+
}
|
|
23186
|
+
function isValidEventArray(data) {
|
|
23187
|
+
return Array.isArray(data) && data.every((item) => typeof item === "object" && item !== null);
|
|
23188
|
+
}
|
|
23189
|
+
if (!isValidResponse(eventsResponse)) throw new Error("Invalid response format from Sentry API");
|
|
23190
|
+
const eventData = eventsResponse.data;
|
|
23191
|
+
if (!isValidEventArray(eventData)) throw new Error("Invalid event data format from Sentry API");
|
|
23192
|
+
const aggregateFunctions = fields.filter((field) => field.includes("(") && field.includes(")"));
|
|
23193
|
+
const groupByFields = fields.filter((field) => !field.includes("(") && !field.includes(")"));
|
|
23194
|
+
const explorerUrl = apiService.getEventsExplorerUrl(params.organizationSlug, params.query, projectId, params.dataset, fields, params.sort, aggregateFunctions, groupByFields, params.statsPeriod);
|
|
23195
|
+
const formatParams = {
|
|
23196
|
+
eventData,
|
|
23197
|
+
naturalLanguageQuery: params.query || `${params.dataset} events`,
|
|
23198
|
+
includeExplanation: false,
|
|
23199
|
+
apiService,
|
|
23200
|
+
organizationSlug: params.organizationSlug,
|
|
23201
|
+
explorerUrl,
|
|
23202
|
+
sentryQuery: params.query,
|
|
23203
|
+
fields
|
|
23204
|
+
};
|
|
23205
|
+
switch (params.dataset) {
|
|
23206
|
+
case "errors": return formatErrorResults(formatParams);
|
|
23207
|
+
case "logs": return formatLogResults(formatParams);
|
|
23208
|
+
case "spans": return formatSpanResults(formatParams);
|
|
23209
|
+
}
|
|
23210
|
+
}
|
|
23211
|
+
});
|
|
23212
|
+
|
|
23213
|
+
//#endregion
|
|
23214
|
+
//#region ../mcp-core/dist/list-issue-events-D2EcLe8P.js
|
|
23215
|
+
var list_issue_events_default = defineTool({
|
|
23216
|
+
name: "list_issue_events",
|
|
23217
|
+
skills: ["inspect", "triage"],
|
|
23218
|
+
requiredScopes: ["event:read"],
|
|
23219
|
+
description: [
|
|
23220
|
+
"List events within a specific issue using Sentry query syntax (no AI/LLM required).",
|
|
23221
|
+
"",
|
|
23222
|
+
"Use this tool when:",
|
|
23223
|
+
"- You know Sentry query syntax already",
|
|
23224
|
+
"- AI-powered search is unavailable (no OPENAI_API_KEY or ANTHROPIC_API_KEY)",
|
|
23225
|
+
"- You want precise control over the query",
|
|
23226
|
+
"",
|
|
23227
|
+
"For natural language queries, use search_issue_events instead.",
|
|
23228
|
+
"",
|
|
23229
|
+
"Common Query Filters:",
|
|
23230
|
+
"- environment:production - Filter by environment",
|
|
23231
|
+
"- release:1.0.0 - Filter by release version",
|
|
23232
|
+
"- user.email:alice@example.com - Filter by user email",
|
|
23233
|
+
"- timestamp:>2024-01-01 - Filter by timestamp",
|
|
23234
|
+
"",
|
|
23235
|
+
"<examples>",
|
|
23236
|
+
"list_issue_events(issueUrl='https://sentry.io/organizations/my-org/issues/123/', query='environment:production')",
|
|
23237
|
+
"list_issue_events(issueId='MCP-41', organizationSlug='my-org', query='release:v1.0.0')",
|
|
23238
|
+
"list_issue_events(issueId='PROJECT-123', organizationSlug='my-org', statsPeriod='1h')",
|
|
23239
|
+
"</examples>",
|
|
23240
|
+
"",
|
|
23241
|
+
"<hints>",
|
|
23242
|
+
"- Use issueUrl for convenience (includes org + issue ID)",
|
|
23243
|
+
"- Or provide both issueId and organizationSlug",
|
|
23244
|
+
"- The query filters events WITHIN the issue, no need for issue: prefix",
|
|
23245
|
+
"</hints>"
|
|
23246
|
+
].join("\n"),
|
|
23247
|
+
inputSchema: {
|
|
23248
|
+
organizationSlug: ParamOrganizationSlug.nullable().default(null).describe("Organization slug. Required when using issueId. Not needed when using issueUrl."),
|
|
23249
|
+
issueId: zod.z.string().optional().describe("Issue ID (e.g., 'MCP-41', 'PROJECT-123'). Requires organizationSlug."),
|
|
23250
|
+
issueUrl: zod.z.string().url().optional().describe("Full Sentry issue URL. Includes both organization and issue ID."),
|
|
23251
|
+
query: zod.z.string().trim().default("").describe("Sentry event search query syntax (empty for all events)"),
|
|
23252
|
+
sort: zod.z.string().default("-timestamp").describe("Sort field (prefix with - for descending). Default: -timestamp"),
|
|
23253
|
+
statsPeriod: zod.z.string().default("14d").describe("Time period: 1h, 24h, 7d, 14d, 30d, etc."),
|
|
23254
|
+
limit: zod.z.number().min(1).max(100).default(50).describe("Maximum number of events to return (1-100)"),
|
|
23255
|
+
regionUrl: ParamRegionUrl.nullable().default(null)
|
|
23256
|
+
},
|
|
23257
|
+
annotations: {
|
|
23258
|
+
readOnlyHint: true,
|
|
23259
|
+
openWorldHint: true
|
|
23260
|
+
},
|
|
23261
|
+
async handler(params, context$1) {
|
|
23262
|
+
const { organizationSlug, issueId } = parseIssueParams({
|
|
23263
|
+
organizationSlug: params.organizationSlug,
|
|
23264
|
+
issueId: params.issueId,
|
|
23265
|
+
issueUrl: params.issueUrl
|
|
23266
|
+
});
|
|
23267
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
23268
|
+
(0, __sentry_core.setTag)("organization.slug", organizationSlug);
|
|
23269
|
+
(0, __sentry_core.setTag)("issue.id", issueId);
|
|
23270
|
+
const eventsResponse = await apiService.listEventsForIssue({
|
|
23271
|
+
organizationSlug,
|
|
23272
|
+
issueId,
|
|
23273
|
+
query: params.query,
|
|
23274
|
+
limit: params.limit,
|
|
23275
|
+
sort: params.sort,
|
|
23276
|
+
statsPeriod: params.statsPeriod
|
|
23277
|
+
});
|
|
23278
|
+
function isValidEventArray(data) {
|
|
23279
|
+
return Array.isArray(data) && data.every((item) => typeof item === "object" && item !== null);
|
|
23280
|
+
}
|
|
23281
|
+
if (!isValidEventArray(eventsResponse)) throw new Error("Invalid event data format from Sentry API: expected array of objects");
|
|
23282
|
+
const explorerQuery = params.query ? `issue:${issueId} ${params.query}` : `issue:${issueId}`;
|
|
23283
|
+
const explorerUrl = apiService.getEventsExplorerUrl(organizationSlug, explorerQuery, void 0, "errors", RECOMMENDED_FIELDS$1, params.sort, [], [], params.statsPeriod);
|
|
23284
|
+
return formatErrorResults({
|
|
23285
|
+
eventData: eventsResponse,
|
|
23286
|
+
naturalLanguageQuery: `Events in issue ${issueId}`,
|
|
23287
|
+
includeExplanation: false,
|
|
23288
|
+
apiService,
|
|
23289
|
+
organizationSlug,
|
|
23290
|
+
explorerUrl,
|
|
23291
|
+
sentryQuery: explorerQuery,
|
|
23292
|
+
fields: RECOMMENDED_FIELDS$1
|
|
23293
|
+
});
|
|
23294
|
+
}
|
|
23295
|
+
});
|
|
23296
|
+
|
|
23297
|
+
//#endregion
|
|
23298
|
+
//#region ../mcp-core/dist/error-handling-DFJ-iOAP.js
|
|
21590
23299
|
/**
|
|
21591
23300
|
* Type guard to identify user input validation errors.
|
|
21592
23301
|
*/
|
|
@@ -21677,7 +23386,7 @@ async function formatErrorForUser(error) {
|
|
|
21677
23386
|
}
|
|
21678
23387
|
|
|
21679
23388
|
//#endregion
|
|
21680
|
-
//#region ../mcp-core/dist/constraint-helpers-
|
|
23389
|
+
//#region ../mcp-core/dist/constraint-helpers-D80X658i.js
|
|
21681
23390
|
/**
|
|
21682
23391
|
* Determines which tool parameter keys should be filtered out of the schema
|
|
21683
23392
|
* because they will be injected from constraints.
|
|
@@ -21739,7 +23448,7 @@ function getConstraintParametersToInject(constraints, toolInputSchema) {
|
|
|
21739
23448
|
}
|
|
21740
23449
|
|
|
21741
23450
|
//#endregion
|
|
21742
|
-
//#region ../mcp-core/dist/server-
|
|
23451
|
+
//#region ../mcp-core/dist/server-CbkVklfg.js
|
|
21743
23452
|
/**
|
|
21744
23453
|
* Format tool calls into a readable trace
|
|
21745
23454
|
*/
|
|
@@ -21801,7 +23510,8 @@ var handler_default$3 = defineTool({
|
|
|
21801
23510
|
},
|
|
21802
23511
|
async handler(params, context$1) {
|
|
21803
23512
|
const [clientTransport, serverTransport] = __modelcontextprotocol_sdk_inMemory_js.InMemoryTransport.createLinkedPair();
|
|
21804
|
-
const
|
|
23513
|
+
const toolsToExclude = new Set(["use_sentry", ...SIMPLE_REPLACEMENT_TOOLS]);
|
|
23514
|
+
const toolsForAgent = Object.fromEntries(Object.entries(tools_default).filter(([key]) => !toolsToExclude.has(key)));
|
|
21805
23515
|
const server$1 = buildServer({
|
|
21806
23516
|
context: context$1,
|
|
21807
23517
|
tools: toolsForAgent
|
|
@@ -21829,6 +23539,25 @@ var handler_default$3 = defineTool({
|
|
|
21829
23539
|
}
|
|
21830
23540
|
}
|
|
21831
23541
|
});
|
|
23542
|
+
/**
|
|
23543
|
+
* Tools that require an embedded agent provider (LLM-powered).
|
|
23544
|
+
* These are excluded when no agent provider is configured.
|
|
23545
|
+
* Note: use_sentry is handled separately via agentMode.
|
|
23546
|
+
*/
|
|
23547
|
+
const AGENT_DEPENDENT_TOOLS = [
|
|
23548
|
+
"search_events",
|
|
23549
|
+
"search_issues",
|
|
23550
|
+
"search_issue_events"
|
|
23551
|
+
];
|
|
23552
|
+
/**
|
|
23553
|
+
* Simple tools that replace agent-dependent tools when no provider is available.
|
|
23554
|
+
* These are excluded when an agent provider IS configured.
|
|
23555
|
+
*/
|
|
23556
|
+
const SIMPLE_REPLACEMENT_TOOLS = [
|
|
23557
|
+
"list_issues",
|
|
23558
|
+
"list_events",
|
|
23559
|
+
"list_issue_events"
|
|
23560
|
+
];
|
|
21832
23561
|
var tools_default = {
|
|
21833
23562
|
whoami: whoami_default,
|
|
21834
23563
|
find_organizations: find_organizations_default,
|
|
@@ -21836,6 +23565,7 @@ var tools_default = {
|
|
|
21836
23565
|
find_projects: find_projects_default,
|
|
21837
23566
|
find_releases: find_releases_default,
|
|
21838
23567
|
get_issue_details: get_issue_details_default,
|
|
23568
|
+
get_issue_tag_values: get_issue_tag_values_default,
|
|
21839
23569
|
get_trace_details: get_trace_details_default,
|
|
21840
23570
|
get_event_attachment: get_event_attachment_default,
|
|
21841
23571
|
update_issue: update_issue_default,
|
|
@@ -21850,7 +23580,10 @@ var tools_default = {
|
|
|
21850
23580
|
get_doc: get_doc_default,
|
|
21851
23581
|
search_issues: handler_default$1,
|
|
21852
23582
|
search_issue_events: handler_default$2,
|
|
21853
|
-
use_sentry: handler_default$3
|
|
23583
|
+
use_sentry: handler_default$3,
|
|
23584
|
+
list_issues: list_issues_default,
|
|
23585
|
+
list_events: list_events_default,
|
|
23586
|
+
list_issue_events: list_issue_events_default
|
|
21854
23587
|
};
|
|
21855
23588
|
/**
|
|
21856
23589
|
* Creates and configures a complete MCP server with Sentry instrumentation.
|
|
@@ -21911,7 +23644,12 @@ function buildServer({ context: context$1, agentMode = false, tools: customTools
|
|
|
21911
23644
|
* In agent mode, only the use_sentry tool is registered, bypassing authorization checks.
|
|
21912
23645
|
*/
|
|
21913
23646
|
function configureServer({ server: server$1, context: context$1, agentMode = false, tools: customTools }) {
|
|
21914
|
-
|
|
23647
|
+
let toolsToRegister = agentMode ? { use_sentry: tools_default.use_sentry } : customTools ?? tools_default;
|
|
23648
|
+
if (!agentMode && !customTools) {
|
|
23649
|
+
const hasAgent = hasAgentProvider();
|
|
23650
|
+
const toolsToExclude = new Set(hasAgent ? SIMPLE_REPLACEMENT_TOOLS : AGENT_DEPENDENT_TOOLS);
|
|
23651
|
+
toolsToRegister = Object.fromEntries(Object.entries(toolsToRegister).filter(([key]) => !toolsToExclude.has(key)));
|
|
23652
|
+
}
|
|
21915
23653
|
const grantedSkills = context$1.grantedSkills ? new Set(context$1.grantedSkills) : void 0;
|
|
21916
23654
|
server$1.server.onerror = (error) => {
|
|
21917
23655
|
const transportLogOptions = {
|
|
@@ -21992,7 +23730,7 @@ function configureServer({ server: server$1, context: context$1, agentMode = fal
|
|
|
21992
23730
|
}
|
|
21993
23731
|
|
|
21994
23732
|
//#endregion
|
|
21995
|
-
//#region ../mcp-core/dist/sentry-
|
|
23733
|
+
//#region ../mcp-core/dist/sentry-CTKJG5Bs.js
|
|
21996
23734
|
const SCRUB_PATTERNS = [
|
|
21997
23735
|
{
|
|
21998
23736
|
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|
|
@@ -22083,8 +23821,11 @@ function scrubValue(value, depth = 0) {
|
|
|
22083
23821
|
}
|
|
22084
23822
|
/**
|
|
22085
23823
|
* Sentry beforeSend hook that scrubs sensitive data from events
|
|
23824
|
+
* and applies custom fingerprinting for specific error types.
|
|
22086
23825
|
*/
|
|
22087
23826
|
function sentryBeforeSend(event, hint) {
|
|
23827
|
+
const firstException = event?.exception?.values?.[0];
|
|
23828
|
+
if (firstException?.type === "AI_APICallError" && firstException.value) event.fingerprint = ["AI_APICallError", firstException.value];
|
|
22088
23829
|
const [scrubbedEvent, didScrub, descriptions] = scrubValue(event);
|
|
22089
23830
|
if (didScrub) {
|
|
22090
23831
|
const uniqueDescriptions = [...new Set(descriptions)];
|
|
@@ -22125,16 +23866,21 @@ const cfg = (() => {
|
|
|
22125
23866
|
die(err instanceof Error ? err.message : String(err));
|
|
22126
23867
|
}
|
|
22127
23868
|
})();
|
|
22128
|
-
if (
|
|
22129
|
-
|
|
23869
|
+
if (cfg.agentProvider) setAgentProvider(cfg.agentProvider);
|
|
23870
|
+
setProviderBaseUrls({
|
|
23871
|
+
openaiBaseUrl: cfg.openaiBaseUrl,
|
|
23872
|
+
anthropicBaseUrl: cfg.anthropicBaseUrl
|
|
23873
|
+
});
|
|
23874
|
+
if (cfg.openaiModel) process.env.OPENAI_MODEL = cfg.openaiModel;
|
|
23875
|
+
if (cfg.anthropicModel) process.env.ANTHROPIC_MODEL = cfg.anthropicModel;
|
|
23876
|
+
const resolvedProvider = getResolvedProviderType();
|
|
23877
|
+
if (!resolvedProvider) {
|
|
23878
|
+
console.warn("Warning: No LLM API key found (OPENAI_API_KEY or ANTHROPIC_API_KEY).");
|
|
22130
23879
|
console.warn("The following AI-powered search tools will be unavailable:");
|
|
22131
|
-
console.warn(" - search_events
|
|
22132
|
-
console.warn("
|
|
22133
|
-
console.warn("All other tools will function normally. To enable AI-powered search, set OPENAI_API_KEY.");
|
|
23880
|
+
console.warn(" - search_events, search_issues, search_issue_events, use_sentry");
|
|
23881
|
+
console.warn("Use list_issues and list_events for direct Sentry query syntax instead.");
|
|
22134
23882
|
console.warn("");
|
|
22135
|
-
}
|
|
22136
|
-
setOpenAIBaseUrl(cfg.openaiBaseUrl);
|
|
22137
|
-
if (cfg.openaiModel) process.env.OPENAI_MODEL = cfg.openaiModel;
|
|
23883
|
+
} else console.warn(`Using ${resolvedProvider} for AI-powered search tools.`);
|
|
22138
23884
|
__sentry_node.init({
|
|
22139
23885
|
dsn: cfg.sentryDsn,
|
|
22140
23886
|
sendDefaultPii: true,
|
|
@@ -22164,6 +23910,25 @@ if (cli.agent) {
|
|
|
22164
23910
|
console.warn("");
|
|
22165
23911
|
}
|
|
22166
23912
|
const SENTRY_TIMEOUT = 5e3;
|
|
23913
|
+
async function shutdown(signal) {
|
|
23914
|
+
console.error(`${signal} received, shutting down...`);
|
|
23915
|
+
await __sentry_node.flush(SENTRY_TIMEOUT);
|
|
23916
|
+
process.exit(0);
|
|
23917
|
+
}
|
|
23918
|
+
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
23919
|
+
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
23920
|
+
process.on("uncaughtException", async (error) => {
|
|
23921
|
+
console.error("Uncaught exception:", error);
|
|
23922
|
+
__sentry_node.captureException(error);
|
|
23923
|
+
await __sentry_node.flush(SENTRY_TIMEOUT);
|
|
23924
|
+
process.exit(1);
|
|
23925
|
+
});
|
|
23926
|
+
process.on("unhandledRejection", async (reason) => {
|
|
23927
|
+
console.error("Unhandled rejection:", reason);
|
|
23928
|
+
__sentry_node.captureException(reason);
|
|
23929
|
+
await __sentry_node.flush(SENTRY_TIMEOUT);
|
|
23930
|
+
process.exit(1);
|
|
23931
|
+
});
|
|
22167
23932
|
const context = {
|
|
22168
23933
|
accessToken: cfg.accessToken,
|
|
22169
23934
|
grantedSkills: cfg.finalSkills,
|
|
@@ -22179,12 +23944,12 @@ const server = buildServer({
|
|
|
22179
23944
|
context,
|
|
22180
23945
|
agentMode: cli.agent
|
|
22181
23946
|
});
|
|
22182
|
-
require_stdio.startStdio(server, context).catch((err) => {
|
|
23947
|
+
require_stdio.startStdio(server, context).catch(async (err) => {
|
|
22183
23948
|
console.error("Server error:", err);
|
|
22184
|
-
__sentry_node.
|
|
23949
|
+
__sentry_node.captureException(err);
|
|
23950
|
+
await __sentry_node.flush(SENTRY_TIMEOUT);
|
|
22185
23951
|
process.exit(1);
|
|
22186
23952
|
});
|
|
22187
|
-
__sentry_node.flush(SENTRY_TIMEOUT);
|
|
22188
23953
|
|
|
22189
23954
|
//#endregion
|
|
22190
23955
|
//# sourceMappingURL=index.cjs.map
|