@debugbundle/mcp 1.5.2 → 1.5.4
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 +267 -77
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/main.cjs
CHANGED
|
@@ -16031,11 +16031,16 @@ var ServiceSchema = external_exports.object({
|
|
|
16031
16031
|
environment: external_exports.string().min(1)
|
|
16032
16032
|
});
|
|
16033
16033
|
var CorrelationSchema = external_exports.object({
|
|
16034
|
-
request_id: external_exports.string().nullable(),
|
|
16035
|
-
trace_id: external_exports.string().nullable(),
|
|
16036
|
-
session_id: external_exports.string().nullable(),
|
|
16037
|
-
user_id_hash: external_exports.string().nullable()
|
|
16038
|
-
}).strict()
|
|
16034
|
+
request_id: external_exports.string().nullable().optional(),
|
|
16035
|
+
trace_id: external_exports.string().nullable().optional(),
|
|
16036
|
+
session_id: external_exports.string().nullable().optional(),
|
|
16037
|
+
user_id_hash: external_exports.string().nullable().optional()
|
|
16038
|
+
}).strict().transform((value) => ({
|
|
16039
|
+
request_id: value.request_id ?? null,
|
|
16040
|
+
trace_id: value.trace_id ?? null,
|
|
16041
|
+
session_id: value.session_id ?? null,
|
|
16042
|
+
user_id_hash: value.user_id_hash ?? null
|
|
16043
|
+
}));
|
|
16039
16044
|
var InlineProbeDataItemSchema = external_exports.object({
|
|
16040
16045
|
label: external_exports.string().min(1),
|
|
16041
16046
|
data: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
@@ -16215,7 +16220,8 @@ var EnvelopeBaseSchema = external_exports.object({
|
|
|
16215
16220
|
sdk_version: external_exports.string().min(1),
|
|
16216
16221
|
service: ServiceSchema,
|
|
16217
16222
|
occurred_at: external_exports.string().datetime(),
|
|
16218
|
-
correlation: CorrelationSchema.optional()
|
|
16223
|
+
correlation: CorrelationSchema.optional(),
|
|
16224
|
+
context: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
16219
16225
|
}).strict();
|
|
16220
16226
|
var EventEnvelopeSchema = external_exports.discriminatedUnion("event_type", [
|
|
16221
16227
|
EnvelopeBaseSchema.extend({ event_type: external_exports.literal("backend_exception"), payload: BackendExceptionPayloadSchema }),
|
|
@@ -16244,6 +16250,7 @@ function createEventEnvelope(input) {
|
|
|
16244
16250
|
session_id: null,
|
|
16245
16251
|
user_id_hash: null
|
|
16246
16252
|
},
|
|
16253
|
+
context: input.context,
|
|
16247
16254
|
payload: input.payload
|
|
16248
16255
|
};
|
|
16249
16256
|
return EventEnvelopeSchema.parse(candidate);
|
|
@@ -17022,6 +17029,9 @@ function createRetrievalApi(client) {
|
|
|
17022
17029
|
if (input.firstSeenAfter !== void 0) {
|
|
17023
17030
|
query.set("first_seen_after", input.firstSeenAfter);
|
|
17024
17031
|
}
|
|
17032
|
+
if (input.attentionAfter !== void 0) {
|
|
17033
|
+
query.set("attention_after", input.attentionAfter);
|
|
17034
|
+
}
|
|
17025
17035
|
if (input.cursor !== void 0) {
|
|
17026
17036
|
query.set("cursor", input.cursor);
|
|
17027
17037
|
}
|
|
@@ -19680,6 +19690,167 @@ function redact(payload, options) {
|
|
|
19680
19690
|
|
|
19681
19691
|
// ../../packages/event-normalizer/src/index.ts
|
|
19682
19692
|
var FINGERPRINT_VERSION = "v1";
|
|
19693
|
+
var PAYLOAD_ALLOWED_KEYS = {
|
|
19694
|
+
backend_exception: /* @__PURE__ */ new Set(["name", "message", "stack", "handled", "request", "response", "runtime", "probe_data"]),
|
|
19695
|
+
request_event: /* @__PURE__ */ new Set([
|
|
19696
|
+
"method",
|
|
19697
|
+
"path",
|
|
19698
|
+
"query",
|
|
19699
|
+
"headers",
|
|
19700
|
+
"body",
|
|
19701
|
+
"response_status",
|
|
19702
|
+
"duration_ms",
|
|
19703
|
+
"route_template",
|
|
19704
|
+
"response_headers",
|
|
19705
|
+
"response_body"
|
|
19706
|
+
]),
|
|
19707
|
+
log_event: /* @__PURE__ */ new Set(["level", "message", "attributes"]),
|
|
19708
|
+
frontend_breadcrumb: /* @__PURE__ */ new Set(["breadcrumb_type", "route", "data"]),
|
|
19709
|
+
frontend_exception: /* @__PURE__ */ new Set([
|
|
19710
|
+
"name",
|
|
19711
|
+
"message",
|
|
19712
|
+
"stack",
|
|
19713
|
+
"route",
|
|
19714
|
+
"browser",
|
|
19715
|
+
"breadcrumbs",
|
|
19716
|
+
"device",
|
|
19717
|
+
"browser_event",
|
|
19718
|
+
"rejection_reason",
|
|
19719
|
+
"dom_context",
|
|
19720
|
+
"probe_data"
|
|
19721
|
+
]),
|
|
19722
|
+
deploy_metadata: /* @__PURE__ */ new Set(["commit_sha", "version", "branch", "environment", "deployed_at"]),
|
|
19723
|
+
error_suppressed: /* @__PURE__ */ new Set(["fingerprint", "suppressed_count", "window_seconds", "first_seen", "last_seen"]),
|
|
19724
|
+
probe_event: /* @__PURE__ */ new Set(["label", "data", "activation_id", "probe_label_pattern"])
|
|
19725
|
+
};
|
|
19726
|
+
function isRecord(candidate) {
|
|
19727
|
+
return typeof candidate === "object" && candidate !== null && !Array.isArray(candidate);
|
|
19728
|
+
}
|
|
19729
|
+
function cloneRecord(candidate) {
|
|
19730
|
+
return { ...candidate };
|
|
19731
|
+
}
|
|
19732
|
+
function readString(candidate) {
|
|
19733
|
+
if (typeof candidate === "string") {
|
|
19734
|
+
return candidate;
|
|
19735
|
+
}
|
|
19736
|
+
if (typeof candidate === "number" || typeof candidate === "boolean") {
|
|
19737
|
+
return String(candidate);
|
|
19738
|
+
}
|
|
19739
|
+
return null;
|
|
19740
|
+
}
|
|
19741
|
+
function readNonNegativeNumber(candidate, fallback) {
|
|
19742
|
+
if (typeof candidate === "number" && Number.isFinite(candidate) && candidate >= 0) {
|
|
19743
|
+
return candidate;
|
|
19744
|
+
}
|
|
19745
|
+
if (typeof candidate === "string" && candidate.trim().length > 0) {
|
|
19746
|
+
const parsed = Number(candidate);
|
|
19747
|
+
if (Number.isFinite(parsed) && parsed >= 0) {
|
|
19748
|
+
return parsed;
|
|
19749
|
+
}
|
|
19750
|
+
}
|
|
19751
|
+
return fallback;
|
|
19752
|
+
}
|
|
19753
|
+
function normalizeMap(candidate) {
|
|
19754
|
+
return isRecord(candidate) ? cloneRecord(candidate) : {};
|
|
19755
|
+
}
|
|
19756
|
+
function mergeContext(baseContext, incomingContext) {
|
|
19757
|
+
if (!isRecord(incomingContext)) {
|
|
19758
|
+
return baseContext;
|
|
19759
|
+
}
|
|
19760
|
+
return {
|
|
19761
|
+
...baseContext,
|
|
19762
|
+
...incomingContext
|
|
19763
|
+
};
|
|
19764
|
+
}
|
|
19765
|
+
function normalizeCorrelation(candidate) {
|
|
19766
|
+
if (!isRecord(candidate)) {
|
|
19767
|
+
return void 0;
|
|
19768
|
+
}
|
|
19769
|
+
return {
|
|
19770
|
+
request_id: readString(candidate["request_id"]),
|
|
19771
|
+
trace_id: readString(candidate["trace_id"]),
|
|
19772
|
+
session_id: readString(candidate["session_id"]),
|
|
19773
|
+
user_id_hash: readString(candidate["user_id_hash"])
|
|
19774
|
+
};
|
|
19775
|
+
}
|
|
19776
|
+
function normalizeBackendExceptionPayload(payload) {
|
|
19777
|
+
const request = normalizeMap(payload["request"]);
|
|
19778
|
+
payload["request"] = {
|
|
19779
|
+
method: readString(request["method"]) ?? "UNKNOWN",
|
|
19780
|
+
path: readString(request["path"]) ?? "/",
|
|
19781
|
+
query: normalizeMap(request["query"]),
|
|
19782
|
+
headers: normalizeMap(request["headers"]),
|
|
19783
|
+
..."body" in request ? { body: request["body"] ?? null } : {}
|
|
19784
|
+
};
|
|
19785
|
+
const response = normalizeMap(payload["response"]);
|
|
19786
|
+
payload["response"] = {
|
|
19787
|
+
status_code: readNonNegativeNumber(response["status_code"], 0),
|
|
19788
|
+
..."headers" in response ? { headers: normalizeMap(response["headers"]) } : {},
|
|
19789
|
+
..."body" in response ? { body: response["body"] } : {}
|
|
19790
|
+
};
|
|
19791
|
+
}
|
|
19792
|
+
function normalizeRequestEventPayload(payload) {
|
|
19793
|
+
payload["query"] = normalizeMap(payload["query"]);
|
|
19794
|
+
payload["headers"] = normalizeMap(payload["headers"]);
|
|
19795
|
+
payload["response_status"] = readNonNegativeNumber(payload["response_status"], 0);
|
|
19796
|
+
payload["duration_ms"] = readNonNegativeNumber(payload["duration_ms"], 0);
|
|
19797
|
+
}
|
|
19798
|
+
function normalizePayloadExtras(input) {
|
|
19799
|
+
const allowedKeys = PAYLOAD_ALLOWED_KEYS[input.eventType];
|
|
19800
|
+
if (allowedKeys === void 0) {
|
|
19801
|
+
return input.context;
|
|
19802
|
+
}
|
|
19803
|
+
let context = input.context;
|
|
19804
|
+
for (const key of Object.keys(input.payload)) {
|
|
19805
|
+
if (allowedKeys.has(key)) {
|
|
19806
|
+
continue;
|
|
19807
|
+
}
|
|
19808
|
+
context = mergeContext(context, { [key]: input.payload[key] });
|
|
19809
|
+
delete input.payload[key];
|
|
19810
|
+
}
|
|
19811
|
+
return context;
|
|
19812
|
+
}
|
|
19813
|
+
function normalizeCompatibleEventCandidate(candidate) {
|
|
19814
|
+
if (!isRecord(candidate)) {
|
|
19815
|
+
return candidate;
|
|
19816
|
+
}
|
|
19817
|
+
const event = cloneRecord(candidate);
|
|
19818
|
+
const eventType = typeof event["event_type"] === "string" ? event["event_type"] : "";
|
|
19819
|
+
let context = normalizeMap(event["context"]);
|
|
19820
|
+
if (typeof event["sdk_language"] === "string") {
|
|
19821
|
+
context = mergeContext(context, { sdk_language: event["sdk_language"] });
|
|
19822
|
+
delete event["sdk_language"];
|
|
19823
|
+
}
|
|
19824
|
+
const correlation = normalizeCorrelation(event["correlation"]);
|
|
19825
|
+
if (correlation !== void 0) {
|
|
19826
|
+
event["correlation"] = correlation;
|
|
19827
|
+
}
|
|
19828
|
+
if (isRecord(event["payload"])) {
|
|
19829
|
+
const payload = cloneRecord(event["payload"]);
|
|
19830
|
+
context = mergeContext(context, payload["context"]);
|
|
19831
|
+
delete payload["context"];
|
|
19832
|
+
if (eventType === "backend_exception") {
|
|
19833
|
+
normalizeBackendExceptionPayload(payload);
|
|
19834
|
+
}
|
|
19835
|
+
if (eventType === "request_event") {
|
|
19836
|
+
const attributes = isRecord(payload["attributes"]) ? payload["attributes"] : null;
|
|
19837
|
+
if (typeof payload["route_template"] !== "string" && typeof attributes?.["route_template"] === "string") {
|
|
19838
|
+
payload["route_template"] = attributes["route_template"];
|
|
19839
|
+
}
|
|
19840
|
+
context = mergeContext(context, attributes);
|
|
19841
|
+
delete payload["attributes"];
|
|
19842
|
+
normalizeRequestEventPayload(payload);
|
|
19843
|
+
}
|
|
19844
|
+
context = normalizePayloadExtras({ eventType, payload, context });
|
|
19845
|
+
event["payload"] = payload;
|
|
19846
|
+
}
|
|
19847
|
+
if (Object.keys(context).length > 0) {
|
|
19848
|
+
event["context"] = context;
|
|
19849
|
+
} else {
|
|
19850
|
+
delete event["context"];
|
|
19851
|
+
}
|
|
19852
|
+
return event;
|
|
19853
|
+
}
|
|
19683
19854
|
function inferMatchedFields(event) {
|
|
19684
19855
|
const matchedFields = ["environment", "normalized_message"];
|
|
19685
19856
|
if (event.error_type !== null) {
|
|
@@ -19924,7 +20095,7 @@ function stableJson(value) {
|
|
|
19924
20095
|
return `{${pairs.join(",")}}`;
|
|
19925
20096
|
}
|
|
19926
20097
|
function validateEvent(candidate) {
|
|
19927
|
-
return EventEnvelopeSchema.safeParse(candidate);
|
|
20098
|
+
return EventEnvelopeSchema.safeParse(normalizeCompatibleEventCandidate(candidate));
|
|
19928
20099
|
}
|
|
19929
20100
|
function normalizeEvent(event) {
|
|
19930
20101
|
const redactedPayload = redact(event.payload).redacted;
|
|
@@ -20743,10 +20914,10 @@ var ACCOUNT_METRIC_KEYS = [
|
|
|
20743
20914
|
var AccountMetricKeySchema = external_exports.enum(ACCOUNT_METRIC_KEYS);
|
|
20744
20915
|
|
|
20745
20916
|
// ../../packages/storage/src/incident-context.ts
|
|
20746
|
-
function
|
|
20917
|
+
function isRecord2(value) {
|
|
20747
20918
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20748
20919
|
}
|
|
20749
|
-
function
|
|
20920
|
+
function readString2(value) {
|
|
20750
20921
|
return typeof value === "string" ? value : null;
|
|
20751
20922
|
}
|
|
20752
20923
|
function readNumber(value) {
|
|
@@ -20759,32 +20930,32 @@ function readStringArray(value) {
|
|
|
20759
20930
|
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
20760
20931
|
}
|
|
20761
20932
|
function buildPrimarySignal(incident, incidentReason, bundleBody) {
|
|
20762
|
-
const bundle =
|
|
20763
|
-
const summary =
|
|
20764
|
-
const signal =
|
|
20765
|
-
const context =
|
|
20766
|
-
const errorContext =
|
|
20767
|
-
const requestContext =
|
|
20768
|
-
const responseContext =
|
|
20769
|
-
const firstApplicationFrame =
|
|
20933
|
+
const bundle = isRecord2(bundleBody) ? bundleBody : {};
|
|
20934
|
+
const summary = isRecord2(bundle["summary"]) ? bundle["summary"] : {};
|
|
20935
|
+
const signal = isRecord2(bundle["signal"]) ? bundle["signal"] : {};
|
|
20936
|
+
const context = isRecord2(bundle["context"]) ? bundle["context"] : {};
|
|
20937
|
+
const errorContext = isRecord2(context["error"]) ? context["error"] : {};
|
|
20938
|
+
const requestContext = isRecord2(context["request"]) ? context["request"] : {};
|
|
20939
|
+
const responseContext = isRecord2(context["response"]) ? context["response"] : {};
|
|
20940
|
+
const firstApplicationFrame = isRecord2(summary["first_application_frame"]) ? summary["first_application_frame"] : null;
|
|
20770
20941
|
return {
|
|
20771
20942
|
kind: incidentReason?.kind ?? null,
|
|
20772
|
-
event_type: incidentReason?.event_type ??
|
|
20943
|
+
event_type: incidentReason?.event_type ?? readString2(summary["primary_signal"]),
|
|
20773
20944
|
event_class: incidentReason?.event_class ?? null,
|
|
20774
20945
|
description: incidentReason?.description ?? `Primary signal for incident ${incident.incident_id}`,
|
|
20775
|
-
severity:
|
|
20946
|
+
severity: readString2(signal["severity"]) ?? incident.severity,
|
|
20776
20947
|
service_name: incident.service_name,
|
|
20777
20948
|
environment: incident.environment,
|
|
20778
|
-
error_type:
|
|
20779
|
-
error_message:
|
|
20780
|
-
request_method:
|
|
20781
|
-
request_path:
|
|
20782
|
-
route_template:
|
|
20949
|
+
error_type: readString2(summary["error_type"]) ?? readString2(errorContext["name"]),
|
|
20950
|
+
error_message: readString2(summary["error_message"]) ?? readString2(errorContext["message"]),
|
|
20951
|
+
request_method: readString2(requestContext["method"]),
|
|
20952
|
+
request_path: readString2(requestContext["path"]),
|
|
20953
|
+
route_template: readString2(requestContext["route_template"]),
|
|
20783
20954
|
response_status: readNumber(responseContext["status_code"]),
|
|
20784
20955
|
first_application_frame: firstApplicationFrame === null ? null : {
|
|
20785
|
-
file:
|
|
20956
|
+
file: readString2(firstApplicationFrame["file"]),
|
|
20786
20957
|
line: readNumber(firstApplicationFrame["line"]),
|
|
20787
|
-
function:
|
|
20958
|
+
function: readString2(firstApplicationFrame["function"])
|
|
20788
20959
|
}
|
|
20789
20960
|
};
|
|
20790
20961
|
}
|
|
@@ -20796,9 +20967,9 @@ function buildLogsRecord(bundleBody, logsInput) {
|
|
|
20796
20967
|
next_cursor: logsInput.next_cursor
|
|
20797
20968
|
};
|
|
20798
20969
|
}
|
|
20799
|
-
const bundle =
|
|
20800
|
-
const context =
|
|
20801
|
-
const logsContext =
|
|
20970
|
+
const bundle = isRecord2(bundleBody) ? bundleBody : {};
|
|
20971
|
+
const context = isRecord2(bundle["context"]) ? bundle["context"] : {};
|
|
20972
|
+
const logsContext = isRecord2(context["logs"]) ? context["logs"] : {};
|
|
20802
20973
|
const items = Array.isArray(logsContext["items"]) ? logsContext["items"] : [];
|
|
20803
20974
|
if (items.length > 0) {
|
|
20804
20975
|
return {
|
|
@@ -20814,53 +20985,53 @@ function buildLogsRecord(bundleBody, logsInput) {
|
|
|
20814
20985
|
};
|
|
20815
20986
|
}
|
|
20816
20987
|
function buildDeployRecord(incident, bundleBody) {
|
|
20817
|
-
const bundle =
|
|
20818
|
-
const context =
|
|
20819
|
-
const deployContext =
|
|
20988
|
+
const bundle = isRecord2(bundleBody) ? bundleBody : {};
|
|
20989
|
+
const context = isRecord2(bundle["context"]) ? bundle["context"] : {};
|
|
20990
|
+
const deployContext = isRecord2(context["deploy"]) ? context["deploy"] : {};
|
|
20820
20991
|
return {
|
|
20821
20992
|
latest_deployment_id: incident.latest_deployment_id ?? null,
|
|
20822
|
-
commit_sha:
|
|
20823
|
-
deploy_version:
|
|
20824
|
-
branch:
|
|
20825
|
-
deployed_at:
|
|
20993
|
+
commit_sha: readString2(deployContext["commit_sha"]),
|
|
20994
|
+
deploy_version: readString2(deployContext["deploy_version"]),
|
|
20995
|
+
branch: readString2(deployContext["branch"]),
|
|
20996
|
+
deployed_at: readString2(deployContext["deployed_at"]),
|
|
20826
20997
|
regression_window: readBoolean(deployContext["regression_window"])
|
|
20827
20998
|
};
|
|
20828
20999
|
}
|
|
20829
21000
|
function buildRedactionRecord(bundleBody) {
|
|
20830
|
-
const bundle =
|
|
20831
|
-
const redaction =
|
|
21001
|
+
const bundle = isRecord2(bundleBody) ? bundleBody : {};
|
|
21002
|
+
const redaction = isRecord2(bundle["redaction"]) ? bundle["redaction"] : null;
|
|
20832
21003
|
if (redaction === null) {
|
|
20833
21004
|
return null;
|
|
20834
21005
|
}
|
|
20835
21006
|
return {
|
|
20836
21007
|
redacted: readBoolean(redaction["redacted"]) ?? false,
|
|
20837
21008
|
fields: readStringArray(redaction["fields"]),
|
|
20838
|
-
notes:
|
|
21009
|
+
notes: readString2(redaction["notes"])
|
|
20839
21010
|
};
|
|
20840
21011
|
}
|
|
20841
21012
|
function buildBrowserSignalRecord(bundleBody) {
|
|
20842
|
-
const bundle =
|
|
20843
|
-
const context =
|
|
20844
|
-
const frontend =
|
|
21013
|
+
const bundle = isRecord2(bundleBody) ? bundleBody : {};
|
|
21014
|
+
const context = isRecord2(bundle["context"]) ? bundle["context"] : {};
|
|
21015
|
+
const frontend = isRecord2(context["frontend"]) ? context["frontend"] : {};
|
|
20845
21016
|
const exceptions = Array.isArray(frontend["exceptions"]) ? frontend["exceptions"] : [];
|
|
20846
21017
|
let exception;
|
|
20847
21018
|
for (let index = exceptions.length - 1; index >= 0; index -= 1) {
|
|
20848
21019
|
const candidate = exceptions[index];
|
|
20849
|
-
if (
|
|
21020
|
+
if (isRecord2(candidate) && isRecord2(candidate["browser_event"])) {
|
|
20850
21021
|
exception = candidate;
|
|
20851
21022
|
break;
|
|
20852
21023
|
}
|
|
20853
21024
|
}
|
|
20854
|
-
const browserEvent =
|
|
20855
|
-
const device =
|
|
20856
|
-
const client = classifyCaptureRuleClientFromUserAgent(
|
|
21025
|
+
const browserEvent = isRecord2(exception) && isRecord2(exception["browser_event"]) ? exception["browser_event"] : null;
|
|
21026
|
+
const device = isRecord2(context["device"]) ? context["device"] : {};
|
|
21027
|
+
const client = classifyCaptureRuleClientFromUserAgent(readString2(device["user_agent"]) ?? void 0);
|
|
20857
21028
|
if (browserEvent === null && client.client_kind === "unknown") {
|
|
20858
21029
|
return null;
|
|
20859
21030
|
}
|
|
20860
21031
|
return {
|
|
20861
|
-
browser_event_kind:
|
|
21032
|
+
browser_event_kind: readString2(browserEvent?.["kind"]),
|
|
20862
21033
|
browser_event_opaque: readBoolean(browserEvent?.["opaque"]),
|
|
20863
|
-
browser_event_message:
|
|
21034
|
+
browser_event_message: readString2(browserEvent?.["message"]),
|
|
20864
21035
|
client_kind: client.client_kind,
|
|
20865
21036
|
bot_family: client.bot_family ?? null
|
|
20866
21037
|
};
|
|
@@ -24588,7 +24759,7 @@ function buildReproduction(bundle) {
|
|
|
24588
24759
|
|
|
24589
24760
|
// ../cli/src/cli-fs-helpers.ts
|
|
24590
24761
|
var import_node_path5 = require("node:path");
|
|
24591
|
-
function
|
|
24762
|
+
function isRecord3(value) {
|
|
24592
24763
|
return typeof value === "object" && value !== null;
|
|
24593
24764
|
}
|
|
24594
24765
|
function isMissingPathError(error) {
|
|
@@ -24886,14 +25057,14 @@ async function pathExists4(path, stat) {
|
|
|
24886
25057
|
await stat(path);
|
|
24887
25058
|
return true;
|
|
24888
25059
|
} catch (error) {
|
|
24889
|
-
if (
|
|
25060
|
+
if (isRecord3(error) && error["code"] === "ENOENT") {
|
|
24890
25061
|
return false;
|
|
24891
25062
|
}
|
|
24892
25063
|
throw error;
|
|
24893
25064
|
}
|
|
24894
25065
|
}
|
|
24895
25066
|
function parseIncidentState(candidate) {
|
|
24896
|
-
if (!
|
|
25067
|
+
if (!isRecord3(candidate)) {
|
|
24897
25068
|
return null;
|
|
24898
25069
|
}
|
|
24899
25070
|
if (candidate["source"] !== "local" || candidate["status"] !== "open" && candidate["status"] !== "resolved") {
|
|
@@ -25005,7 +25176,7 @@ function parseIncidentState(candidate) {
|
|
|
25005
25176
|
}
|
|
25006
25177
|
function parseState(rawState) {
|
|
25007
25178
|
const parsed = JSON.parse(rawState);
|
|
25008
|
-
if (!
|
|
25179
|
+
if (!isRecord3(parsed) || parsed["version"] !== 1) {
|
|
25009
25180
|
return null;
|
|
25010
25181
|
}
|
|
25011
25182
|
const lastProcessedEventFile = parsed["last_processed_event_file"];
|
|
@@ -25013,7 +25184,7 @@ function parseState(rawState) {
|
|
|
25013
25184
|
return null;
|
|
25014
25185
|
}
|
|
25015
25186
|
const incidents = parsed["incidents"];
|
|
25016
|
-
if (!
|
|
25187
|
+
if (!isRecord3(incidents)) {
|
|
25017
25188
|
return null;
|
|
25018
25189
|
}
|
|
25019
25190
|
const parsedIncidents = {};
|
|
@@ -25400,14 +25571,14 @@ async function readJsonFile(path, dependencies) {
|
|
|
25400
25571
|
try {
|
|
25401
25572
|
return JSON.parse(await readFile(path, "utf8"));
|
|
25402
25573
|
} catch (error) {
|
|
25403
|
-
if (
|
|
25574
|
+
if (isRecord3(error) && error["code"] === "ENOENT") {
|
|
25404
25575
|
throw error;
|
|
25405
25576
|
}
|
|
25406
25577
|
throw createReadError(400, "invalid_local_json");
|
|
25407
25578
|
}
|
|
25408
25579
|
}
|
|
25409
25580
|
function parseLocalConnection(candidate) {
|
|
25410
|
-
if (!
|
|
25581
|
+
if (!isRecord3(candidate) || candidate["mode"] !== "local-only" && candidate["mode"] !== "connected") {
|
|
25411
25582
|
throw createReadError(400, "invalid_local_connection_config");
|
|
25412
25583
|
}
|
|
25413
25584
|
return {
|
|
@@ -25415,7 +25586,7 @@ function parseLocalConnection(candidate) {
|
|
|
25415
25586
|
};
|
|
25416
25587
|
}
|
|
25417
25588
|
function parseLocalIncident(candidate) {
|
|
25418
|
-
if (!
|
|
25589
|
+
if (!isRecord3(candidate)) {
|
|
25419
25590
|
throw createReadError(400, "invalid_local_state");
|
|
25420
25591
|
}
|
|
25421
25592
|
const requiredStringFields = [
|
|
@@ -25447,9 +25618,13 @@ function parseLocalIncident(candidate) {
|
|
|
25447
25618
|
throw createReadError(400, "invalid_local_state");
|
|
25448
25619
|
}
|
|
25449
25620
|
const resolvedAt = candidate["resolved_at"];
|
|
25621
|
+
const regressedAt = candidate["regressed_at"];
|
|
25450
25622
|
if (resolvedAt !== void 0 && resolvedAt !== null && typeof resolvedAt !== "string") {
|
|
25451
25623
|
throw createReadError(400, "invalid_local_state");
|
|
25452
25624
|
}
|
|
25625
|
+
if (regressedAt !== void 0 && regressedAt !== null && typeof regressedAt !== "string") {
|
|
25626
|
+
throw createReadError(400, "invalid_local_state");
|
|
25627
|
+
}
|
|
25453
25628
|
if (typeof candidate["occurrence_count"] !== "number" || typeof candidate["generation_number"] !== "number") {
|
|
25454
25629
|
throw createReadError(400, "invalid_local_state");
|
|
25455
25630
|
}
|
|
@@ -25484,6 +25659,7 @@ function parseLocalIncident(candidate) {
|
|
|
25484
25659
|
severity: candidate["severity"],
|
|
25485
25660
|
status: candidate["status"],
|
|
25486
25661
|
...resolvedAt === void 0 ? {} : { resolved_at: resolvedAt },
|
|
25662
|
+
...regressedAt === void 0 ? {} : { regressed_at: regressedAt },
|
|
25487
25663
|
first_seen_at: candidate["first_seen_at"],
|
|
25488
25664
|
last_seen_at: candidate["last_seen_at"],
|
|
25489
25665
|
occurrence_count: candidate["occurrence_count"],
|
|
@@ -25498,7 +25674,7 @@ function parseLocalIncident(candidate) {
|
|
|
25498
25674
|
};
|
|
25499
25675
|
}
|
|
25500
25676
|
function parseLocalState(candidate) {
|
|
25501
|
-
if (!
|
|
25677
|
+
if (!isRecord3(candidate) || candidate["version"] !== 1 || !isRecord3(candidate["incidents"])) {
|
|
25502
25678
|
throw createReadError(400, "invalid_local_state");
|
|
25503
25679
|
}
|
|
25504
25680
|
const incidents = Object.fromEntries(
|
|
@@ -25535,7 +25711,7 @@ async function readLocalConnectionConfig(dependencies) {
|
|
|
25535
25711
|
try {
|
|
25536
25712
|
return parseLocalConnection(await readJsonFile((0, import_node_path8.join)(rootDirectory, CONNECTION_FILE_PATH2), dependencies));
|
|
25537
25713
|
} catch (error) {
|
|
25538
|
-
if (
|
|
25714
|
+
if (isRecord3(error) && error["code"] === "ENOENT") {
|
|
25539
25715
|
return null;
|
|
25540
25716
|
}
|
|
25541
25717
|
throw error;
|
|
@@ -25546,7 +25722,7 @@ async function readLocalState(dependencies) {
|
|
|
25546
25722
|
try {
|
|
25547
25723
|
return parseLocalState(await readJsonFile(getStateFilePath(rootDirectory), dependencies));
|
|
25548
25724
|
} catch (error) {
|
|
25549
|
-
if (
|
|
25725
|
+
if (isRecord3(error) && error["code"] === "ENOENT") {
|
|
25550
25726
|
return {
|
|
25551
25727
|
version: 1,
|
|
25552
25728
|
last_processed_event_file: null,
|
|
@@ -25589,7 +25765,12 @@ async function listLocalIncidents(input, dependencies) {
|
|
|
25589
25765
|
return incident.status === "open";
|
|
25590
25766
|
}
|
|
25591
25767
|
return incident.status === input.status;
|
|
25592
|
-
}).filter((incident) => input.severity === void 0 ? true : incident.severity === input.severity).filter((incident) => input.firstSeenAfter === void 0 ? true : incident.first_seen_at >= input.firstSeenAfter).
|
|
25768
|
+
}).filter((incident) => input.severity === void 0 ? true : incident.severity === input.severity).filter((incident) => input.firstSeenAfter === void 0 ? true : incident.first_seen_at >= input.firstSeenAfter).filter((incident) => {
|
|
25769
|
+
if (input.attentionAfter === void 0) {
|
|
25770
|
+
return true;
|
|
25771
|
+
}
|
|
25772
|
+
return incident.first_seen_at >= input.attentionAfter || incident.regressed_at != null && incident.regressed_at >= input.attentionAfter;
|
|
25773
|
+
}).sort(sortIncidentsDescending);
|
|
25593
25774
|
const startIndex = input.cursor === void 0 ? 0 : incidents.findIndex((incident) => buildCursor(incident) === input.cursor) + 1;
|
|
25594
25775
|
const pagedIncidents = input.limit === void 0 ? incidents.slice(startIndex) : incidents.slice(startIndex, startIndex + input.limit);
|
|
25595
25776
|
const hasMore = input.limit !== void 0 && startIndex + input.limit < incidents.length;
|
|
@@ -25611,7 +25792,7 @@ async function getLocalBundle(input, dependencies) {
|
|
|
25611
25792
|
try {
|
|
25612
25793
|
return await readJsonFile(resolveWorkspacePath(rootDirectory, incident.bundle_path), dependencies);
|
|
25613
25794
|
} catch (error) {
|
|
25614
|
-
if (
|
|
25795
|
+
if (isRecord3(error) && error["code"] === "ENOENT") {
|
|
25615
25796
|
throw createReadError(404, "bundle_not_found");
|
|
25616
25797
|
}
|
|
25617
25798
|
if (error instanceof RetrievalApiError && error.code === "invalid_local_json") {
|
|
@@ -25626,7 +25807,7 @@ async function getLocalReproduction(input, dependencies) {
|
|
|
25626
25807
|
try {
|
|
25627
25808
|
return await readJsonFile(resolveWorkspacePath(rootDirectory, incident.reproduction_path), dependencies);
|
|
25628
25809
|
} catch (error) {
|
|
25629
|
-
if (
|
|
25810
|
+
if (isRecord3(error) && error["code"] === "ENOENT") {
|
|
25630
25811
|
throw createReadError(404, "reproduction_not_found");
|
|
25631
25812
|
}
|
|
25632
25813
|
if (error instanceof RetrievalApiError && error.code === "invalid_local_json") {
|
|
@@ -27312,7 +27493,7 @@ function requireBearerToken(input) {
|
|
|
27312
27493
|
}
|
|
27313
27494
|
return bearerToken;
|
|
27314
27495
|
}
|
|
27315
|
-
function
|
|
27496
|
+
function readString3(input, key) {
|
|
27316
27497
|
const value = input[key];
|
|
27317
27498
|
return typeof value === "string" ? value : "";
|
|
27318
27499
|
}
|
|
@@ -27339,7 +27520,7 @@ function createImprovementMcpTools(api) {
|
|
|
27339
27520
|
try {
|
|
27340
27521
|
return await api.getImprovement({
|
|
27341
27522
|
bearerToken: requireBearerToken(input),
|
|
27342
|
-
improvementId:
|
|
27523
|
+
improvementId: readString3(input, "improvementId")
|
|
27343
27524
|
});
|
|
27344
27525
|
} catch (error) {
|
|
27345
27526
|
mapMcpError7(error);
|
|
@@ -27349,8 +27530,8 @@ function createImprovementMcpTools(api) {
|
|
|
27349
27530
|
try {
|
|
27350
27531
|
return await api.getImprovementBundle({
|
|
27351
27532
|
bearerToken: requireBearerToken(input),
|
|
27352
|
-
projectId:
|
|
27353
|
-
improvementId:
|
|
27533
|
+
projectId: readString3(input, "projectId"),
|
|
27534
|
+
improvementId: readString3(input, "improvementId")
|
|
27354
27535
|
});
|
|
27355
27536
|
} catch (error) {
|
|
27356
27537
|
mapMcpError7(error);
|
|
@@ -27360,7 +27541,7 @@ function createImprovementMcpTools(api) {
|
|
|
27360
27541
|
try {
|
|
27361
27542
|
return await api.resolveImprovement({
|
|
27362
27543
|
bearerToken: requireBearerToken(input),
|
|
27363
|
-
improvementId:
|
|
27544
|
+
improvementId: readString3(input, "improvementId")
|
|
27364
27545
|
});
|
|
27365
27546
|
} catch (error) {
|
|
27366
27547
|
mapMcpError7(error);
|
|
@@ -27370,7 +27551,7 @@ function createImprovementMcpTools(api) {
|
|
|
27370
27551
|
try {
|
|
27371
27552
|
return await api.reopenImprovement({
|
|
27372
27553
|
bearerToken: requireBearerToken(input),
|
|
27373
|
-
improvementId:
|
|
27554
|
+
improvementId: readString3(input, "improvementId")
|
|
27374
27555
|
});
|
|
27375
27556
|
} catch (error) {
|
|
27376
27557
|
mapMcpError7(error);
|
|
@@ -27380,8 +27561,8 @@ function createImprovementMcpTools(api) {
|
|
|
27380
27561
|
try {
|
|
27381
27562
|
return await api.snoozeImprovement({
|
|
27382
27563
|
bearerToken: requireBearerToken(input),
|
|
27383
|
-
improvementId:
|
|
27384
|
-
snoozedUntil:
|
|
27564
|
+
improvementId: readString3(input, "improvementId"),
|
|
27565
|
+
snoozedUntil: readString3(input, "snoozedUntil")
|
|
27385
27566
|
});
|
|
27386
27567
|
} catch (error) {
|
|
27387
27568
|
mapMcpError7(error);
|
|
@@ -27991,7 +28172,7 @@ async function updateCachedArtifactStatus(filePath, input, dependencies) {
|
|
|
27991
28172
|
`, "utf8");
|
|
27992
28173
|
}
|
|
27993
28174
|
function applyIncidentStatusToPayload(payload, incidentId, incident) {
|
|
27994
|
-
if (!
|
|
28175
|
+
if (!isRecord3(payload)) {
|
|
27995
28176
|
return payload;
|
|
27996
28177
|
}
|
|
27997
28178
|
const nextPayload = { ...payload };
|
|
@@ -28002,7 +28183,7 @@ function applyIncidentStatusToPayload(payload, incidentId, incident) {
|
|
|
28002
28183
|
if (matchesIncident && (Object.hasOwn(payload, "resolved_at") || incident.resolved_at !== void 0)) {
|
|
28003
28184
|
nextPayload["resolved_at"] = incident.resolved_at ?? null;
|
|
28004
28185
|
}
|
|
28005
|
-
if (
|
|
28186
|
+
if (isRecord3(payload["incident"])) {
|
|
28006
28187
|
nextPayload["incident"] = applyIncidentStatusToPayload(payload["incident"], incidentId, incident);
|
|
28007
28188
|
}
|
|
28008
28189
|
return nextPayload;
|
|
@@ -28084,6 +28265,9 @@ function readIncidentListFilters(input) {
|
|
|
28084
28265
|
if (typeof input["firstSeenAfter"] === "string") {
|
|
28085
28266
|
requestInput.firstSeenAfter = input["firstSeenAfter"];
|
|
28086
28267
|
}
|
|
28268
|
+
if (typeof input["attentionAfter"] === "string") {
|
|
28269
|
+
requestInput.attentionAfter = input["attentionAfter"];
|
|
28270
|
+
}
|
|
28087
28271
|
if (typeof input["cursor"] === "string") {
|
|
28088
28272
|
requestInput.cursor = input["cursor"];
|
|
28089
28273
|
}
|
|
@@ -28105,6 +28289,7 @@ async function listAllCloudIncidents(input, api) {
|
|
|
28105
28289
|
...filters.status === void 0 ? {} : { status: filters.status },
|
|
28106
28290
|
...filters.severity === void 0 ? {} : { severity: filters.severity },
|
|
28107
28291
|
...filters.firstSeenAfter === void 0 ? {} : { firstSeenAfter: filters.firstSeenAfter },
|
|
28292
|
+
...filters.attentionAfter === void 0 ? {} : { attentionAfter: filters.attentionAfter },
|
|
28108
28293
|
...cursor === void 0 ? {} : { cursor }
|
|
28109
28294
|
});
|
|
28110
28295
|
incidents.push(...response.incidents.map((incident) => attachSourceToRecord(incident, "cloud")));
|
|
@@ -28167,7 +28352,8 @@ function createRetrievalMcpTools(api) {
|
|
|
28167
28352
|
...incidentFilters.service === void 0 ? {} : { service: incidentFilters.service },
|
|
28168
28353
|
...incidentFilters.status === void 0 ? {} : { status: incidentFilters.status },
|
|
28169
28354
|
...incidentFilters.severity === void 0 ? {} : { severity: incidentFilters.severity },
|
|
28170
|
-
...incidentFilters.firstSeenAfter === void 0 ? {} : { firstSeenAfter: incidentFilters.firstSeenAfter }
|
|
28355
|
+
...incidentFilters.firstSeenAfter === void 0 ? {} : { firstSeenAfter: incidentFilters.firstSeenAfter },
|
|
28356
|
+
...incidentFilters.attentionAfter === void 0 ? {} : { attentionAfter: incidentFilters.attentionAfter }
|
|
28171
28357
|
});
|
|
28172
28358
|
const cloudIncidents = await listAllCloudIncidents(input, {
|
|
28173
28359
|
listIncidents: (requestInput2) => api.listIncidents(requestInput2)
|
|
@@ -28201,6 +28387,9 @@ function createRetrievalMcpTools(api) {
|
|
|
28201
28387
|
if (incidentFilters.firstSeenAfter !== void 0) {
|
|
28202
28388
|
requestInput.firstSeenAfter = incidentFilters.firstSeenAfter;
|
|
28203
28389
|
}
|
|
28390
|
+
if (incidentFilters.attentionAfter !== void 0) {
|
|
28391
|
+
requestInput.attentionAfter = incidentFilters.attentionAfter;
|
|
28392
|
+
}
|
|
28204
28393
|
if (incidentFilters.cursor !== void 0) {
|
|
28205
28394
|
requestInput.cursor = incidentFilters.cursor;
|
|
28206
28395
|
}
|
|
@@ -30402,7 +30591,7 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
30402
30591
|
var package_default = {
|
|
30403
30592
|
name: "@debugbundle/mcp",
|
|
30404
30593
|
mcpName: "com.debugbundle/mcp",
|
|
30405
|
-
version: "1.5.
|
|
30594
|
+
version: "1.5.4",
|
|
30406
30595
|
private: false,
|
|
30407
30596
|
description: "Model Context Protocol server for DebugBundle",
|
|
30408
30597
|
license: "AGPL-3.0-only",
|
|
@@ -30607,6 +30796,7 @@ var listIncidentsInputSchema = external_exports.object({
|
|
|
30607
30796
|
status: external_exports.string().optional(),
|
|
30608
30797
|
severity: external_exports.string().optional(),
|
|
30609
30798
|
firstSeenAfter: external_exports.string().optional(),
|
|
30799
|
+
attentionAfter: external_exports.string().optional(),
|
|
30610
30800
|
cursor: external_exports.string().optional(),
|
|
30611
30801
|
limit: external_exports.number().optional()
|
|
30612
30802
|
});
|
|
@@ -31476,7 +31666,7 @@ var MCP_TOOL_NAMES = MCP_TOOL_CATALOG.map((tool) => tool.name);
|
|
|
31476
31666
|
|
|
31477
31667
|
// src/server.ts
|
|
31478
31668
|
var MCP_SERVER_VERSION = package_default.version;
|
|
31479
|
-
function
|
|
31669
|
+
function isRecord4(value) {
|
|
31480
31670
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31481
31671
|
}
|
|
31482
31672
|
function readRequestId(id) {
|
|
@@ -31496,13 +31686,13 @@ function buildError(id, code, message) {
|
|
|
31496
31686
|
};
|
|
31497
31687
|
}
|
|
31498
31688
|
function parseToolCallParams(params) {
|
|
31499
|
-
if (!
|
|
31689
|
+
if (!isRecord4(params) || typeof params["name"] !== "string") {
|
|
31500
31690
|
return null;
|
|
31501
31691
|
}
|
|
31502
31692
|
const rawArguments = params["arguments"];
|
|
31503
31693
|
return {
|
|
31504
31694
|
name: params["name"],
|
|
31505
|
-
arguments:
|
|
31695
|
+
arguments: isRecord4(rawArguments) ? rawArguments : {}
|
|
31506
31696
|
};
|
|
31507
31697
|
}
|
|
31508
31698
|
function toToolResponse(payload) {
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"source": "github",
|
|
9
9
|
"subfolder": "apps/mcp"
|
|
10
10
|
},
|
|
11
|
-
"version": "1.5.
|
|
11
|
+
"version": "1.5.4",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
16
16
|
"identifier": "@debugbundle/mcp",
|
|
17
|
-
"version": "1.5.
|
|
17
|
+
"version": "1.5.4",
|
|
18
18
|
"transport": {
|
|
19
19
|
"type": "stdio"
|
|
20
20
|
},
|