@debugbundle/mcp 0.1.3 → 0.1.5
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/main.cjs +77 -30
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -16276,6 +16276,31 @@ var CaptureProbeEventsValues = ["buffer_only", "standalone_when_activated"];
|
|
|
16276
16276
|
var CaptureProbeEventsSchema = external_exports.enum(CaptureProbeEventsValues);
|
|
16277
16277
|
var RequestSignalClassificationValues = ["incident_signal", "context_signal"];
|
|
16278
16278
|
var RequestSignalClassificationSchema = external_exports.enum(RequestSignalClassificationValues);
|
|
16279
|
+
var RECOMMENDED_IMMEDIATE_CLIENT_ERROR_STATUSES = [401, 403, 409, 422];
|
|
16280
|
+
var ImmediateClientErrorStatusSchema = external_exports.number().int().min(400).max(499);
|
|
16281
|
+
function normalizeImmediateClientErrorStatuses(statuses) {
|
|
16282
|
+
return Array.from(new Set(statuses)).sort((left, right) => left - right);
|
|
16283
|
+
}
|
|
16284
|
+
var ImmediateClientErrorStatusesSchema = external_exports.array(ImmediateClientErrorStatusSchema).max(12).transform((statuses) => normalizeImmediateClientErrorStatuses(statuses));
|
|
16285
|
+
var ResolvedCapturePolicySchema = external_exports.object({
|
|
16286
|
+
preset: CapturePresetSchema,
|
|
16287
|
+
capture_logs: CaptureLogsSchema,
|
|
16288
|
+
capture_request_events: CaptureRequestEventsSchema,
|
|
16289
|
+
capture_breadcrumbs: CaptureBreadcrumbsSchema,
|
|
16290
|
+
capture_probe_events: CaptureProbeEventsSchema,
|
|
16291
|
+
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema
|
|
16292
|
+
});
|
|
16293
|
+
var CapturePolicyOverridesSchema = external_exports.object({
|
|
16294
|
+
capture_logs: CaptureLogsSchema.nullable(),
|
|
16295
|
+
capture_request_events: CaptureRequestEventsSchema.nullable(),
|
|
16296
|
+
capture_breadcrumbs: CaptureBreadcrumbsSchema.nullable(),
|
|
16297
|
+
capture_probe_events: CaptureProbeEventsSchema.nullable(),
|
|
16298
|
+
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema.nullable()
|
|
16299
|
+
});
|
|
16300
|
+
var CapturePolicyResponseSchema = external_exports.object({
|
|
16301
|
+
policy: ResolvedCapturePolicySchema,
|
|
16302
|
+
overrides: CapturePolicyOverridesSchema
|
|
16303
|
+
});
|
|
16279
16304
|
var CapturePolicySchema = external_exports.object({
|
|
16280
16305
|
project_id: external_exports.string().uuid(),
|
|
16281
16306
|
preset: CapturePresetSchema,
|
|
@@ -16283,6 +16308,7 @@ var CapturePolicySchema = external_exports.object({
|
|
|
16283
16308
|
capture_request_events: CaptureRequestEventsSchema.nullable(),
|
|
16284
16309
|
capture_breadcrumbs: CaptureBreadcrumbsSchema.nullable(),
|
|
16285
16310
|
capture_probe_events: CaptureProbeEventsSchema.nullable(),
|
|
16311
|
+
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema.nullable(),
|
|
16286
16312
|
updated_at: external_exports.string().datetime()
|
|
16287
16313
|
});
|
|
16288
16314
|
var CapturePolicyUpdateSchema = external_exports.object({
|
|
@@ -16290,21 +16316,48 @@ var CapturePolicyUpdateSchema = external_exports.object({
|
|
|
16290
16316
|
capture_logs: CaptureLogsSchema.nullable().optional(),
|
|
16291
16317
|
capture_request_events: CaptureRequestEventsSchema.nullable().optional(),
|
|
16292
16318
|
capture_breadcrumbs: CaptureBreadcrumbsSchema.nullable().optional(),
|
|
16293
|
-
capture_probe_events: CaptureProbeEventsSchema.nullable().optional()
|
|
16319
|
+
capture_probe_events: CaptureProbeEventsSchema.nullable().optional(),
|
|
16320
|
+
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema.nullable().optional()
|
|
16294
16321
|
});
|
|
16322
|
+
var PRESET_DEFAULTS = {
|
|
16323
|
+
minimal: {
|
|
16324
|
+
capture_logs: "error",
|
|
16325
|
+
capture_request_events: "failures_only",
|
|
16326
|
+
capture_breadcrumbs: "local_only",
|
|
16327
|
+
capture_probe_events: "buffer_only",
|
|
16328
|
+
immediate_client_error_statuses: []
|
|
16329
|
+
},
|
|
16330
|
+
balanced: {
|
|
16331
|
+
capture_logs: "warning",
|
|
16332
|
+
capture_request_events: "failures_only",
|
|
16333
|
+
capture_breadcrumbs: "exception_only",
|
|
16334
|
+
capture_probe_events: "buffer_only",
|
|
16335
|
+
immediate_client_error_statuses: []
|
|
16336
|
+
},
|
|
16337
|
+
investigative: {
|
|
16338
|
+
capture_logs: "info",
|
|
16339
|
+
capture_request_events: "all",
|
|
16340
|
+
capture_breadcrumbs: "standalone",
|
|
16341
|
+
capture_probe_events: "standalone_when_activated",
|
|
16342
|
+
immediate_client_error_statuses: [...RECOMMENDED_IMMEDIATE_CLIENT_ERROR_STATUSES]
|
|
16343
|
+
}
|
|
16344
|
+
};
|
|
16295
16345
|
var BALANCED_IMMEDIATE_REQUEST_STATUSES = /* @__PURE__ */ new Set([408, 423, 424, 425, 429]);
|
|
16296
16346
|
var INVESTIGATIVE_IMMEDIATE_REQUEST_STATUSES = /* @__PURE__ */ new Set([...BALANCED_IMMEDIATE_REQUEST_STATUSES, 409]);
|
|
16297
16347
|
var BALANCED_STANDARD_ANOMALY_STATUSES = /* @__PURE__ */ new Set([401, 403, 404, 409, 422]);
|
|
16298
16348
|
var BALANCED_HIGH_VOLUME_ANOMALY_STATUSES = /* @__PURE__ */ new Set([400, 410]);
|
|
16299
16349
|
var INVESTIGATIVE_ANOMALY_STATUSES = /* @__PURE__ */ new Set([...BALANCED_STANDARD_ANOMALY_STATUSES, ...BALANCED_HIGH_VOLUME_ANOMALY_STATUSES]);
|
|
16300
16350
|
function classifyRequestStatus(input) {
|
|
16301
|
-
const { responseStatus, capturePreset } = input;
|
|
16351
|
+
const { responseStatus, capturePreset, immediateClientErrorStatuses = [] } = input;
|
|
16302
16352
|
if (responseStatus === null || !Number.isFinite(responseStatus)) {
|
|
16303
16353
|
return "context_signal";
|
|
16304
16354
|
}
|
|
16305
16355
|
if (responseStatus >= 500) {
|
|
16306
16356
|
return "incident_signal";
|
|
16307
16357
|
}
|
|
16358
|
+
if (immediateClientErrorStatuses.includes(responseStatus)) {
|
|
16359
|
+
return "incident_signal";
|
|
16360
|
+
}
|
|
16308
16361
|
if (capturePreset === "investigative") {
|
|
16309
16362
|
return INVESTIGATIVE_IMMEDIATE_REQUEST_STATUSES.has(responseStatus) ? "incident_signal" : "context_signal";
|
|
16310
16363
|
}
|
|
@@ -17558,16 +17611,6 @@ function createCliHttpClient(input, dependencies) {
|
|
|
17558
17611
|
}
|
|
17559
17612
|
|
|
17560
17613
|
// ../cli/src/capture-policy-commands.ts
|
|
17561
|
-
var ResolvedCapturePolicySchema = external_exports.object({
|
|
17562
|
-
preset: CapturePresetSchema,
|
|
17563
|
-
capture_logs: CaptureLogsSchema,
|
|
17564
|
-
capture_request_events: CaptureRequestEventsSchema,
|
|
17565
|
-
capture_breadcrumbs: CaptureBreadcrumbsSchema,
|
|
17566
|
-
capture_probe_events: CaptureProbeEventsSchema
|
|
17567
|
-
});
|
|
17568
|
-
var CapturePolicyResponseSchema = external_exports.object({
|
|
17569
|
-
policy: ResolvedCapturePolicySchema
|
|
17570
|
-
});
|
|
17571
17614
|
var CapturePolicyApiError = class extends Error {
|
|
17572
17615
|
status;
|
|
17573
17616
|
constructor(status, message) {
|
|
@@ -17597,7 +17640,7 @@ function createCapturePolicyApi(httpClient) {
|
|
|
17597
17640
|
if (!parsed.success) {
|
|
17598
17641
|
throw new CapturePolicyApiError(500, "Invalid capture policy response.");
|
|
17599
17642
|
}
|
|
17600
|
-
return parsed.data
|
|
17643
|
+
return parsed.data;
|
|
17601
17644
|
},
|
|
17602
17645
|
async updateCapturePolicy(input) {
|
|
17603
17646
|
const response = await httpClient.request({
|
|
@@ -17613,7 +17656,7 @@ function createCapturePolicyApi(httpClient) {
|
|
|
17613
17656
|
if (!parsed.success) {
|
|
17614
17657
|
throw new CapturePolicyApiError(500, "Invalid capture policy response.");
|
|
17615
17658
|
}
|
|
17616
|
-
return parsed.data
|
|
17659
|
+
return parsed.data;
|
|
17617
17660
|
}
|
|
17618
17661
|
};
|
|
17619
17662
|
}
|
|
@@ -18041,7 +18084,7 @@ function getRequestResponseStatus(payload) {
|
|
|
18041
18084
|
const status = payload?.["response_status"];
|
|
18042
18085
|
return typeof status === "number" && Number.isFinite(status) ? status : null;
|
|
18043
18086
|
}
|
|
18044
|
-
function classifyEvent(eventType, logLevel, probeActivationId, payload, capturePreset = "minimal") {
|
|
18087
|
+
function classifyEvent(eventType, logLevel, probeActivationId, payload, capturePreset = "minimal", immediateClientErrorStatuses = []) {
|
|
18045
18088
|
switch (eventType) {
|
|
18046
18089
|
case "backend_exception":
|
|
18047
18090
|
case "frontend_exception":
|
|
@@ -18053,7 +18096,7 @@ function classifyEvent(eventType, logLevel, probeActivationId, payload, captureP
|
|
|
18053
18096
|
return "context_signal";
|
|
18054
18097
|
case "request_event": {
|
|
18055
18098
|
const responseStatus = getRequestResponseStatus(payload);
|
|
18056
|
-
return classifyRequestStatus({ responseStatus, capturePreset });
|
|
18099
|
+
return classifyRequestStatus({ responseStatus, capturePreset, immediateClientErrorStatuses });
|
|
18057
18100
|
}
|
|
18058
18101
|
case "frontend_breadcrumb":
|
|
18059
18102
|
case "deploy_metadata":
|
|
@@ -18978,6 +19021,13 @@ var STORAGE_SCHEMA_MIGRATIONS = [
|
|
|
18978
19021
|
ON slack_destinations (organization_id, is_active, created_at)
|
|
18979
19022
|
`
|
|
18980
19023
|
]
|
|
19024
|
+
}),
|
|
19025
|
+
defineStorageSchemaMigration({
|
|
19026
|
+
id: "202605140001_add_capture_policy_immediate_client_error_statuses",
|
|
19027
|
+
description: "Add nullable immediate client error status overrides to capture policies.",
|
|
19028
|
+
statements: [
|
|
19029
|
+
"ALTER TABLE capture_policies ADD COLUMN IF NOT EXISTS immediate_client_error_statuses jsonb"
|
|
19030
|
+
]
|
|
18981
19031
|
})
|
|
18982
19032
|
];
|
|
18983
19033
|
|
|
@@ -22142,12 +22192,10 @@ function createCapturePolicyMcpTools(api) {
|
|
|
22142
22192
|
return {
|
|
22143
22193
|
async get_capture_policy(input) {
|
|
22144
22194
|
try {
|
|
22145
|
-
return {
|
|
22146
|
-
|
|
22147
|
-
|
|
22148
|
-
|
|
22149
|
-
})
|
|
22150
|
-
};
|
|
22195
|
+
return await api.getCapturePolicy({
|
|
22196
|
+
bearerToken: String(input["bearerToken"]),
|
|
22197
|
+
projectId: String(input["projectId"])
|
|
22198
|
+
});
|
|
22151
22199
|
} catch (error) {
|
|
22152
22200
|
mapMcpError4(error);
|
|
22153
22201
|
}
|
|
@@ -22155,13 +22203,11 @@ function createCapturePolicyMcpTools(api) {
|
|
|
22155
22203
|
async update_capture_policy(input) {
|
|
22156
22204
|
try {
|
|
22157
22205
|
const update = typeof input["update"] === "object" && input["update"] !== null ? input["update"] : {};
|
|
22158
|
-
return {
|
|
22159
|
-
|
|
22160
|
-
|
|
22161
|
-
|
|
22162
|
-
|
|
22163
|
-
})
|
|
22164
|
-
};
|
|
22206
|
+
return await api.updateCapturePolicy({
|
|
22207
|
+
bearerToken: String(input["bearerToken"]),
|
|
22208
|
+
projectId: String(input["projectId"]),
|
|
22209
|
+
update
|
|
22210
|
+
});
|
|
22165
22211
|
} catch (error) {
|
|
22166
22212
|
mapMcpError4(error);
|
|
22167
22213
|
}
|
|
@@ -25533,7 +25579,8 @@ var MCP_TOOL_CATALOG = [
|
|
|
25533
25579
|
capture_logs: external_exports.string().nullable().optional(),
|
|
25534
25580
|
capture_request_events: external_exports.string().nullable().optional(),
|
|
25535
25581
|
capture_breadcrumbs: external_exports.string().nullable().optional(),
|
|
25536
|
-
capture_probe_events: external_exports.string().nullable().optional()
|
|
25582
|
+
capture_probe_events: external_exports.string().nullable().optional(),
|
|
25583
|
+
immediate_client_error_statuses: external_exports.array(external_exports.number().int().min(400).max(499)).nullable().optional()
|
|
25537
25584
|
})
|
|
25538
25585
|
})
|
|
25539
25586
|
},
|