@debugbundle/mcp 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/main.cjs +839 -472
  2. package/package.json +1 -1
  3. package/server.json +2 -2
package/dist/main.cjs CHANGED
@@ -39659,17 +39659,17 @@ var require_dns = __commonJS({
39659
39659
  const timestamp = Date.now();
39660
39660
  const records = { records: { 4: null, 6: null } };
39661
39661
  let minTTL = this.#maxTTL;
39662
- for (const record of addresses) {
39663
- record.timestamp = timestamp;
39664
- if (typeof record.ttl === "number") {
39665
- record.ttl = Math.min(record.ttl, this.#maxTTL);
39666
- minTTL = Math.min(minTTL, record.ttl);
39662
+ for (const record2 of addresses) {
39663
+ record2.timestamp = timestamp;
39664
+ if (typeof record2.ttl === "number") {
39665
+ record2.ttl = Math.min(record2.ttl, this.#maxTTL);
39666
+ minTTL = Math.min(minTTL, record2.ttl);
39667
39667
  } else {
39668
- record.ttl = this.#maxTTL;
39668
+ record2.ttl = this.#maxTTL;
39669
39669
  }
39670
- const familyRecords = records.records[record.family] ?? { ips: [] };
39671
- familyRecords.ips.push(record);
39672
- records.records[record.family] = familyRecords;
39670
+ const familyRecords = records.records[record2.family] ?? { ips: [] };
39671
+ familyRecords.ips.push(record2);
39672
+ records.records[record2.family] = familyRecords;
39673
39673
  }
39674
39674
  this.storage.set(origin.hostname, records, { ttl: minTTL });
39675
39675
  }
@@ -55119,15 +55119,15 @@ var require_util7 = __commonJS({
55119
55119
  exports2.getUniqueHostnamesFromOptions = getUniqueHostnamesFromOptions;
55120
55120
  function groupSrvRecords(records) {
55121
55121
  const recordsByPriority = {};
55122
- for (const record of records) {
55123
- if (!recordsByPriority.hasOwnProperty(record.priority)) {
55124
- recordsByPriority[record.priority] = {
55125
- totalWeight: record.weight,
55126
- records: [record]
55122
+ for (const record2 of records) {
55123
+ if (!recordsByPriority.hasOwnProperty(record2.priority)) {
55124
+ recordsByPriority[record2.priority] = {
55125
+ totalWeight: record2.weight,
55126
+ records: [record2]
55127
55127
  };
55128
55128
  } else {
55129
- recordsByPriority[record.priority].totalWeight += record.weight;
55130
- recordsByPriority[record.priority].records.push(record);
55129
+ recordsByPriority[record2.priority].totalWeight += record2.weight;
55130
+ recordsByPriority[record2.priority].records.push(record2);
55131
55131
  }
55132
55132
  }
55133
55133
  return recordsByPriority;
@@ -55140,12 +55140,12 @@ var require_util7 = __commonJS({
55140
55140
  }
55141
55141
  const random = Math.floor(Math.random() * (recordsGroup.totalWeight + recordsGroup.records.length));
55142
55142
  let total = 0;
55143
- for (const [i, record] of recordsGroup.records.entries()) {
55144
- total += 1 + record.weight;
55143
+ for (const [i, record2] of recordsGroup.records.entries()) {
55144
+ total += 1 + record2.weight;
55145
55145
  if (total > random) {
55146
- recordsGroup.totalWeight -= record.weight;
55146
+ recordsGroup.totalWeight -= record2.weight;
55147
55147
  recordsGroup.records.splice(i, 1);
55148
- return record;
55148
+ return record2;
55149
55149
  }
55150
55150
  }
55151
55151
  }
@@ -57067,13 +57067,13 @@ var require_cluster = __commonJS({
57067
57067
  if (!sortedKeys.length) {
57068
57068
  return reject(err2);
57069
57069
  }
57070
- const key = sortedKeys[0], group = groupedRecords[key], record = (0, util_1.weightSrvRecords)(group);
57070
+ const key = sortedKeys[0], group = groupedRecords[key], record2 = (0, util_1.weightSrvRecords)(group);
57071
57071
  if (!group.records.length) {
57072
57072
  sortedKeys.shift();
57073
57073
  }
57074
- self.dnsLookup(record.name).then((host) => resolve2({
57074
+ self.dnsLookup(record2.name).then((host) => resolve2({
57075
57075
  host,
57076
- port: record.port
57076
+ port: record2.port
57077
57077
  }), tryFirstOne);
57078
57078
  }
57079
57079
  tryFirstOne();
@@ -64420,6 +64420,73 @@ function createEventEnvelope(input2) {
64420
64420
  return EventEnvelopeSchema.parse(candidate);
64421
64421
  }
64422
64422
 
64423
+ // ../../packages/shared-types/src/browser-resource-routes.ts
64424
+ var BrowserResourceRoutesSchema = external_exports.object({
64425
+ items: external_exports.array(external_exports.object({ route: external_exports.string().max(1024), occurrences: external_exports.number().int().positive() })).max(20),
64426
+ recorded_occurrences: external_exports.number().int().nonnegative(),
64427
+ unattributed_occurrences: external_exports.number().int().nonnegative(),
64428
+ omitted_routes: external_exports.number().int().nonnegative(),
64429
+ coverage: external_exports.enum(["occurrence_metadata", "retained_samples"])
64430
+ });
64431
+ function normalizeResourceRoute(value) {
64432
+ if (typeof value !== "string" || !value.startsWith("/") || value.startsWith("//") || value.length > 4096)
64433
+ return null;
64434
+ const path = value.split(/[?#]/, 1)[0];
64435
+ if (/[\u0000-\u0020\u007f\\]/.test(path)) return null;
64436
+ const segments = path.split("/").filter(Boolean).map((segment) => {
64437
+ let decoded;
64438
+ try {
64439
+ decoded = decodeURIComponent(segment);
64440
+ } catch {
64441
+ return "{param}";
64442
+ }
64443
+ if (decoded === "{param}" || /^:[A-Za-z_][A-Za-z_0-9]*$/.test(decoded)) return "{param}";
64444
+ return /^\d+$/.test(decoded) || /^[a-f0-9-]{16,}$/i.test(decoded) || /^[A-Za-z0-9_-]{24,}$/.test(decoded) || decoded.length >= 16 && /[A-Za-z]/.test(decoded) && /\d/.test(decoded) || /[@/\\\u0000-\u0020\u007f]/.test(decoded) ? "{param}" : segment;
64445
+ });
64446
+ const route = `/${segments.join("/")}`;
64447
+ return route.length <= 1024 ? route : null;
64448
+ }
64449
+ function summarizeResourceRoutes(routes, occurrenceCount) {
64450
+ const counts = /* @__PURE__ */ new Map();
64451
+ for (const raw of routes) {
64452
+ const route = normalizeResourceRoute(raw);
64453
+ if (route !== null) counts.set(route, (counts.get(route) ?? 0) + 1);
64454
+ }
64455
+ const items = [...counts].map(([route, occurrences]) => ({ route, occurrences })).sort(
64456
+ (a, b) => b.occurrences - a.occurrences || (a.route < b.route ? -1 : a.route > b.route ? 1 : 0)
64457
+ );
64458
+ const recorded = items.reduce((total, item) => total + item.occurrences, 0);
64459
+ return {
64460
+ items: items.slice(0, 20),
64461
+ recorded_occurrences: recorded,
64462
+ unattributed_occurrences: Math.max(0, occurrenceCount - recorded),
64463
+ omitted_routes: Math.max(0, items.length - 20),
64464
+ coverage: "retained_samples"
64465
+ };
64466
+ }
64467
+
64468
+ // ../../packages/shared-types/src/browser-resource-context.ts
64469
+ var BrowserResourceContextSchema = external_exports.object({
64470
+ version: external_exports.literal(1),
64471
+ host: external_exports.string().max(255).nullable(),
64472
+ path: external_exports.string().max(1024),
64473
+ type: external_exports.string().nullable(),
64474
+ first_party: external_exports.boolean().nullable(),
64475
+ role: external_exports.enum([
64476
+ "analytics",
64477
+ "advertising",
64478
+ "tag_manager",
64479
+ "authentication",
64480
+ "application_asset",
64481
+ "unknown"
64482
+ ]),
64483
+ provider: external_exports.string().nullable(),
64484
+ title: external_exports.string(),
64485
+ optional_candidate: external_exports.boolean(),
64486
+ diagnosis: external_exports.string(),
64487
+ routes: BrowserResourceRoutesSchema
64488
+ });
64489
+
64423
64490
  // ../../packages/shared-types/src/tier-capabilities.ts
64424
64491
  var TIER_CAPABILITIES = {
64425
64492
  free: {
@@ -65254,6 +65321,93 @@ var CaptureRulesFileSchema = external_exports.object({
65254
65321
  rules: external_exports.array(CaptureRuleSchema)
65255
65322
  });
65256
65323
 
65324
+ // ../../packages/shared-types/src/browser-resource.ts
65325
+ function record(value) {
65326
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
65327
+ }
65328
+ function httpUrl(value, base2) {
65329
+ if (typeof value !== "string" || value.length === 0 || value.length > 4096 || /[\u0000-\u0020\u007f]/.test(value))
65330
+ return null;
65331
+ try {
65332
+ const url = base2 === void 0 ? new URL(value) : new URL(value, base2);
65333
+ return url.protocol === "http:" || url.protocol === "https:" ? url : null;
65334
+ } catch {
65335
+ return null;
65336
+ }
65337
+ }
65338
+ function browserResourceLocation(source, page) {
65339
+ if (typeof source !== "string") return null;
65340
+ const pageUrl = httpUrl(page);
65341
+ const url = httpUrl(source, pageUrl ?? void 0);
65342
+ if (url !== null) {
65343
+ if (url.pathname.length > 1024 || url.hostname.length > 255) return null;
65344
+ return {
65345
+ host: url.hostname.toLowerCase(),
65346
+ path: url.pathname || "/",
65347
+ first_party: pageUrl === null ? null : url.origin === pageUrl.origin
65348
+ };
65349
+ }
65350
+ if (source.startsWith("/") && !source.startsWith("//") && !source.includes("\\") && !/[\u0000-\u0020\u007f]/.test(source)) {
65351
+ const path = source.split(/[?#]/, 1)[0];
65352
+ if (path.length <= 1024) return { host: null, path, first_party: true };
65353
+ }
65354
+ return null;
65355
+ }
65356
+ function describeBrowserResource(value) {
65357
+ const event = record(value);
65358
+ if (event?.["kind"] !== "resource_error") return null;
65359
+ const target = record(event["target"]);
65360
+ const page = record(event["page"]);
65361
+ const location = browserResourceLocation(
65362
+ target?.["source_url"] ?? event["file_name"],
65363
+ page?.["url"]
65364
+ );
65365
+ if (location === null) return null;
65366
+ const tag2 = typeof target?.["tag_name"] === "string" ? target["tag_name"].toLowerCase() : null;
65367
+ const type = tag2 !== null && [
65368
+ "script",
65369
+ "link",
65370
+ "img",
65371
+ "audio",
65372
+ "video",
65373
+ "source",
65374
+ "iframe",
65375
+ "object",
65376
+ "embed",
65377
+ "input"
65378
+ ].includes(tag2) ? tag2 : null;
65379
+ let role = location.first_party === true ? "application_asset" : "unknown";
65380
+ let provider = null;
65381
+ if (type === "script") {
65382
+ if (location.host === "www.googletagmanager.com" && location.path === "/gtm.js") {
65383
+ provider = "Google Tag Manager";
65384
+ role = "tag_manager";
65385
+ } else if (location.host === "connect.facebook.net" && /^\/[a-z]{2}_[A-Z]{2}\/fbevents\.js$/.test(location.path)) {
65386
+ provider = "Meta Pixel";
65387
+ role = "advertising";
65388
+ } else if (location.host === "www.clarity.ms" && /^\/tag\/[A-Za-z0-9]+$/.test(location.path)) {
65389
+ provider = "Microsoft Clarity";
65390
+ role = "analytics";
65391
+ } else if (location.host === "accounts.google.com" && location.path === "/gsi/client") {
65392
+ provider = "Google sign-in";
65393
+ role = "authentication";
65394
+ }
65395
+ }
65396
+ const file = location.path.split("/").filter(Boolean).at(-1) ?? location.path;
65397
+ const kind = type === "img" ? "Image" : type === "script" || /\.m?js$/i.test(file) ? "JavaScript asset" : "Resource";
65398
+ return {
65399
+ ...location,
65400
+ type,
65401
+ role,
65402
+ provider,
65403
+ title: provider !== null ? `${provider} script failed to load` : `${kind} failed to load: ${file}${location.host === null ? "" : ` (${location.host})`}`,
65404
+ optional_candidate: event["opaque"] === true && location.first_party !== true && ["analytics", "advertising", "tag_manager"].includes(role)
65405
+ };
65406
+ }
65407
+ function browserResourceDiagnosis(resource) {
65408
+ return resource?.optional_candidate === true ? "The browser reported that this script failed to load. Possibly blocked by privacy tools; network, CSP or provider failures are also possible. The captured event does not identify the cause." : "The browser reported that this resource failed to load. The captured event does not identify the cause or establish whether application functionality was affected.";
65409
+ }
65410
+
65257
65411
  // ../../packages/shared-types/src/capture-rule-evaluation.ts
65258
65412
  var CaptureRuleEvaluationUrlSchema = external_exports.object({
65259
65413
  host: external_exports.string().min(1).transform((value) => value.toLowerCase()).optional(),
@@ -65276,7 +65430,9 @@ var CaptureRuleEvaluationContextSchema = external_exports.object({
65276
65430
  resource_url: CaptureRuleEvaluationUrlSchema.optional(),
65277
65431
  request_url: CaptureRuleEvaluationUrlSchema.optional(),
65278
65432
  status_code: external_exports.number().int().min(0).max(599).optional(),
65279
- fingerprint: CaptureRuleFingerprintSchema.optional()
65433
+ fingerprint: CaptureRuleFingerprintSchema.optional(),
65434
+ // Server-derived prior versions keep installed exact-match rules effective.
65435
+ fingerprint_aliases: external_exports.array(CaptureRuleFingerprintSchema).max(2).optional()
65280
65436
  });
65281
65437
  function classifyCaptureRuleClientFromUserAgent(userAgent) {
65282
65438
  if (userAgent === null || userAgent === void 0) {
@@ -65319,6 +65475,7 @@ var CaptureRuleSuggestionSchema = external_exports.object({
65319
65475
  rule: CaptureRuleCreateSchema
65320
65476
  });
65321
65477
  var CaptureRuleSuggestionsResponseSchema = external_exports.object({
65478
+ access_mode: external_exports.enum(["manage", "preview"]).optional(),
65322
65479
  suggestions: external_exports.array(CaptureRuleSuggestionSchema),
65323
65480
  bundle_status: external_exports.enum(["ready", "pending", "failed"]).optional(),
65324
65481
  bundle_reason: external_exports.string().nullable().optional()
@@ -65814,6 +65971,14 @@ function looksSensitiveCustomDimensionValue(value) {
65814
65971
  return /https?:\/\//i.test(value) || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) || /\bBearer\s+[A-Za-z0-9._~+/=-]+/i.test(value) || /\b(?:token|password|secret|api_key)=/i.test(value);
65815
65972
  }
65816
65973
 
65974
+ // ../../packages/shared-types/src/frontend-severity.ts
65975
+ function inferFrontendExceptionSeverity(event) {
65976
+ const browserEvent = event.payload.browser_event;
65977
+ if (browserEvent?.opaque === true)
65978
+ return browserEvent.kind === "resource_error" ? "medium" : "low";
65979
+ return "high";
65980
+ }
65981
+
65817
65982
  // ../../packages/shared-types/src/analytics-product.ts
65818
65983
  var AnalyticsOpportunityStatusValues = ["open", "resolved", "snoozed"];
65819
65984
  var AnalyticsOpportunityStatusSchema = external_exports.enum(AnalyticsOpportunityStatusValues);
@@ -66388,6 +66553,7 @@ var ContextDeviceSchema = external_exports.object({
66388
66553
  color_scheme_preference: external_exports.enum(["light", "dark", "no-preference"]).nullable()
66389
66554
  });
66390
66555
  var BundleContextSchema = external_exports.object({
66556
+ resource_failure: BrowserResourceContextSchema.optional(),
66391
66557
  error: ContextErrorSchema.nullable().optional(),
66392
66558
  request: ContextRequestSchema.nullable().optional(),
66393
66559
  response: ContextResponseSchema.nullable().optional(),
@@ -68070,6 +68236,15 @@ function buildSkill() {
68070
68236
  "- Scope frontend noise by structured evidence such as service, environment, `browser_event_kind`, `browser_event_opaque`, `client_kind`, `bot_family`, and message fields. Do not broadly demote generic `Unhandled promise rejection` incidents without bot-scoped or otherwise narrow evidence.",
68071
68237
  "- For expected or intentionally promoted 4xx responses on known routes, use capture-policy client-error path rules instead of promoting all client errors: `debugbundle capture-policy set --client-error-path-rule <status=/path/*@GET>`.",
68072
68238
  "",
68239
+ "### Browser resource failures",
68240
+ "",
68241
+ "- Inspect the primary failure and routes: one resource can span pages, route coverage may be incomplete, and historical incidents stay separate. Related tracker evidence does not explain an application exception.",
68242
+ '- If the cause is unknown, say "possibly blocked by privacy tools." Network/CSP/provider failures remain possible; provider recognition proves neither Pi-hole blocking nor optionality.',
68243
+ "- Review exact host/path, service, environment and opaque resource-error scope; never widen to a whole host. Google sign-in, app assets and unknown dependencies have no automatic resource noise recommendation.",
68244
+ "- For confirmed optional dependencies, context (demote) retains diagnostics without new incidents/alerts/automation and may remain billable. Drop discards future matches; choose it only when evidence has no diagnostic value. Explain the tradeoff; neither deletes history. Use the returned suggestion ID.",
68245
+ "- Check existing/disabled rules. Empty suggestions or pending/failed bundles do not justify broader rules. Applying requires user authorization and owner/admin access; preview is read-only. Verify subsequent matching and protected captures before claiming improvement; live tests need authorization.",
68246
+ "- The official OpenAI connection cannot suggest or apply rules. When it is the only connection, review returned evidence and hand off through a returned safe dashboard URL; never invent tools or switch credentials.",
68247
+ "",
68073
68248
  "## Notification Delivery",
68074
68249
  "",
68075
68250
  "When notification or automation delivery is the reported failure, inspect configuration and delivery records before changing incident logic.",
@@ -68177,6 +68352,7 @@ function buildCliReference() {
68177
68352
  "- `debugbundle capture-policy set [--project <id>] --client-error-path-rule <404=/path/*@GET,POST> [--json]`",
68178
68353
  "",
68179
68354
  "Use capture-rule suggestions for repeated operational noise after inspecting an incident bundle. Use capture-policy client-error path rules for route-scoped 4xx incidents instead of promoting all client errors.",
68355
+ "For browser resource failures, follow the skill's Browser resource failures guidance. Use the current response's suggestion ID, inspect `bundle_status`, `access_mode` and existing-rule state, and review the complete matcher before applying.",
68180
68356
  "",
68181
68357
  "## Probes",
68182
68358
  "",
@@ -68325,6 +68501,7 @@ function buildMcpReference() {
68325
68501
  "- `get_capture_policy`, `update_capture_policy` \u2014 review or update capture policy, including path-scoped client-error incident rules.",
68326
68502
  "",
68327
68503
  "Use these tools for repeated low-value operational noise only after inspecting incident evidence. Keep frontend suppression scoped by structured browser and client signals, and use path-scoped capture policy for known 4xx routes.",
68504
+ "For browser resource failures, follow the skill's Browser resource failures guidance and use the suggestion ID returned by the server. These management tools belong to the member-authenticated MCP surface; the official OpenAI connection is read-only and cannot suggest or apply capture rules.",
68328
68505
  "",
68329
68506
  "## Product Analytics Tools",
68330
68507
  "",
@@ -68520,6 +68697,43 @@ function buildSkillEvals() {
68520
68697
  "Use capture-policy path rules for known route-scoped 4xx incidents."
68521
68698
  ]
68522
68699
  },
68700
+ {
68701
+ name: "browser_resource_noise_review",
68702
+ prompt: "GTM failed on four routes. The owner says analytics is optional and asks to keep useful diagnostics without repeated alerts. The suggestion response offers resource_context and resource_drop with exact host/path/service/environment matchers. Explain and apply the appropriate authorized choice.",
68703
+ expected_behavior: [
68704
+ "Inspect the primary failure and bounded route coverage; do not count each route as a separate application defect.",
68705
+ "Describe privacy blocking as possible, not proven; do not diagnose Pi-hole.",
68706
+ "Review the exact matcher and use the returned context suggestion ID; explain retained evidence and possible paid usage.",
68707
+ "Verify the returned rule without claiming historical incidents were removed or live noise reduction was already observed."
68708
+ ]
68709
+ },
68710
+ {
68711
+ name: "protected_resource_noise_review",
68712
+ prompt: "A checkout TypeError has related GTM evidence. Separate incidents show Google sign-in and an unknown script failing. The user asks whether ignoring all Google or third-party hosts would clean this up.",
68713
+ expected_behavior: [
68714
+ "Keep the primary checkout exception separate from related tracker evidence.",
68715
+ "Do not broaden rules to whole hosts or infer that sign-in, app assets or unknown dependencies are optional.",
68716
+ "Inspect evidence and available suggestions before proposing any narrowly scoped change."
68717
+ ]
68718
+ },
68719
+ {
68720
+ name: "unavailable_resource_noise_suggestions",
68721
+ prompt: "Resource suggestions are pending or empty, the current member has preview access, and a matching rule is disabled. The user asks why the resource still opens incidents.",
68722
+ expected_behavior: [
68723
+ "Explain the missing evidence and access limits without inventing a rule or bypassing authorization.",
68724
+ "Inspect the disabled rule; do not assume it is active, create a duplicate or silently enable it.",
68725
+ "Do not claim noise was reduced or resolve historical incidents based solely on a policy proposal."
68726
+ ]
68727
+ },
68728
+ {
68729
+ name: "readonly_resource_noise_handoff",
68730
+ prompt: "Only the official read-only OpenAI connection is available. The user asks to ignore recurring tracker failures.",
68731
+ expected_behavior: [
68732
+ "Inspect only available incident evidence; distinguish possible privacy blocking from a proven cause.",
68733
+ "Explain that this connection cannot fetch capture-rule suggestions or apply rules; do not invent a management tool or switch credentials.",
68734
+ "Use a returned safe dashboard URL for a reviewed handoff when available, and never claim a rule was applied."
68735
+ ]
68736
+ },
68523
68737
  {
68524
68738
  name: "operational_controls_guidance",
68525
68739
  prompt: "The user reports missing webhook deliveries and asks whether probes or alerts are available. Confirm the skill points the agent to the relevant operational controls and docs.",
@@ -70060,8 +70274,57 @@ function createHealthCheckApi(httpClient) {
70060
70274
  var import_promises4 = require("node:fs/promises");
70061
70275
  var import_node_path4 = require("node:path");
70062
70276
 
70063
- // ../../packages/event-normalizer/src/index.ts
70064
- var import_node_crypto2 = require("node:crypto");
70277
+ // ../../packages/event-normalizer/src/fingerprints.ts
70278
+ var import_node_crypto = require("node:crypto");
70279
+ var FINGERPRINT_VERSION = "v2";
70280
+ var RESOURCE_FINGERPRINT_VERSION = "v3";
70281
+ function fingerprintVersion(event) {
70282
+ return event.resource_type != null ? RESOURCE_FINGERPRINT_VERSION : FINGERPRINT_VERSION;
70283
+ }
70284
+ function stableJson(value) {
70285
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
70286
+ if (Array.isArray(value)) return `[${value.map(stableJson).join(",")}]`;
70287
+ const object = value;
70288
+ return `{${Object.keys(object).sort().map((key) => `${JSON.stringify(key)}:${stableJson(object[key])}`).join(",")}}`;
70289
+ }
70290
+ function fingerprint(event) {
70291
+ const canonical = event.resource_type != null ? {
70292
+ // A concrete resource is the grouping unit, not proof of a common underlying cause.
70293
+ browser_event_kind: "resource_error",
70294
+ resource_host: event.resource_host,
70295
+ resource_path: event.resource_path,
70296
+ resource_type: event.resource_type,
70297
+ environment: event.environment,
70298
+ fingerprint_version: RESOURCE_FINGERPRINT_VERSION
70299
+ } : {
70300
+ // Preserve exact historical bytes for every non-resource event and explicit legacy normalization.
70301
+ error_type: event.error_type,
70302
+ normalized_message: event.normalized_message,
70303
+ top_frames: event.top_frames,
70304
+ route_template: event.route_template,
70305
+ browser_event_kind: event.browser_event_kind,
70306
+ resource_host: event.resource_host,
70307
+ resource_path: event.resource_path,
70308
+ http_method: event.http_method,
70309
+ http_status: event.http_status,
70310
+ environment: event.environment
70311
+ };
70312
+ return (0, import_node_crypto.createHash)("sha256").update(stableJson(canonical)).digest("hex");
70313
+ }
70314
+ function inferMatchedFields(event) {
70315
+ if (event.resource_type != null)
70316
+ return ["environment", "browser_event_kind", "resource_host", "resource_path", "resource_type"];
70317
+ const fields = ["environment", "normalized_message"];
70318
+ if (event.error_type !== null) fields.push("error_type");
70319
+ if (event.route_template !== null) fields.push("route_template");
70320
+ if (event.top_frames.length > 0) fields.push("top_frames");
70321
+ if (event.browser_event_kind != null) fields.push("browser_event_kind");
70322
+ if (event.resource_host != null) fields.push("resource_host");
70323
+ if (event.resource_path != null) fields.push("resource_path");
70324
+ if (event.http_method !== null) fields.push("http_method");
70325
+ if (event.http_status !== null) fields.push("http_status");
70326
+ return fields;
70327
+ }
70065
70328
 
70066
70329
  // ../../packages/redaction/src/index.ts
70067
70330
  var DEFAULT_SENSITIVE_KEYS = [
@@ -70160,7 +70423,7 @@ function redact(payload2, options) {
70160
70423
  }
70161
70424
 
70162
70425
  // ../../packages/event-normalizer/src/mobile-event-compatibility.ts
70163
- var import_node_crypto = require("node:crypto");
70426
+ var import_node_crypto2 = require("node:crypto");
70164
70427
  var MOBILE_SDKS = /* @__PURE__ */ new Set(["@debugbundle/sdk-android", "@debugbundle/sdk-swift"]);
70165
70428
  function isRecord(candidate) {
70166
70429
  return typeof candidate === "object" && candidate !== null && !Array.isArray(candidate);
@@ -70187,8 +70450,8 @@ function readInteger(candidate) {
70187
70450
  function readBoolean(candidate) {
70188
70451
  return typeof candidate === "boolean" ? candidate : null;
70189
70452
  }
70190
- function readField(record, snakeCase, camelCase) {
70191
- return record[snakeCase] ?? record[camelCase];
70453
+ function readField(record2, snakeCase, camelCase) {
70454
+ return record2[snakeCase] ?? record2[camelCase];
70192
70455
  }
70193
70456
  function stableValue(candidate) {
70194
70457
  if (Array.isArray(candidate)) {
@@ -70202,7 +70465,7 @@ function stableValue(candidate) {
70202
70465
  );
70203
70466
  }
70204
70467
  function deterministicEventId(candidate) {
70205
- const digest2 = (0, import_node_crypto.createHash)("sha256").update(JSON.stringify(stableValue(candidate))).digest("hex");
70468
+ const digest2 = (0, import_node_crypto2.createHash)("sha256").update(JSON.stringify(stableValue(candidate))).digest("hex");
70206
70469
  const chars = digest2.slice(0, 32).split("");
70207
70470
  chars[12] = "5";
70208
70471
  chars[16] = ["8", "9", "a", "b"][Number.parseInt(chars[16] ?? "0", 16) % 4] ?? "8";
@@ -70560,8 +70823,14 @@ function normalizeInstalledJavaEvent(candidate) {
70560
70823
  };
70561
70824
  }
70562
70825
 
70826
+ // ../../packages/event-normalizer/src/java-timer-message.ts
70827
+ var TIMER_DIAGNOSTIC = /^WFLYEJB002(?:0|2):[^\n]*\[id=[^\]\n]*\btimedObjectId=/;
70828
+ var JAVA_TIMER_DATE = /\b(previousRun|initialExpiration|nextExpiration)=((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{1,2}\s+\d{2}:\d{2}:\d{2}\s+[A-Za-z][A-Za-z0-9:+-]{0,15}\s+\d{4})\b/g;
70829
+ function normalizeJavaTimerMessage(message3) {
70830
+ return TIMER_DIAGNOSTIC.test(message3) ? message3.replace(JAVA_TIMER_DATE, "$1={dynamic}") : message3;
70831
+ }
70832
+
70563
70833
  // ../../packages/event-normalizer/src/index.ts
70564
- var FINGERPRINT_VERSION = "v1";
70565
70834
  var PAYLOAD_ALLOWED_KEYS = {
70566
70835
  backend_exception: /* @__PURE__ */ new Set([
70567
70836
  "name",
@@ -70744,34 +71013,6 @@ function normalizeCompatibleEventCandidate(candidate) {
70744
71013
  }
70745
71014
  return event;
70746
71015
  }
70747
- function inferMatchedFields(event) {
70748
- const matchedFields = ["environment", "normalized_message"];
70749
- if (event.error_type !== null) {
70750
- matchedFields.push("error_type");
70751
- }
70752
- if (event.route_template !== null) {
70753
- matchedFields.push("route_template");
70754
- }
70755
- if (event.top_frames.length > 0) {
70756
- matchedFields.push("top_frames");
70757
- }
70758
- if (event.browser_event_kind != null) {
70759
- matchedFields.push("browser_event_kind");
70760
- }
70761
- if (event.resource_host != null) {
70762
- matchedFields.push("resource_host");
70763
- }
70764
- if (event.resource_path != null) {
70765
- matchedFields.push("resource_path");
70766
- }
70767
- if (event.http_method !== null) {
70768
- matchedFields.push("http_method");
70769
- }
70770
- if (event.http_status !== null) {
70771
- matchedFields.push("http_status");
70772
- }
70773
- return matchedFields;
70774
- }
70775
71016
  var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\b/gi;
70776
71017
  var EMAIL_PATTERN = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi;
70777
71018
  var ISO_TIMESTAMP_PATTERN = /\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z\b/g;
@@ -70895,12 +71136,12 @@ function normalizeKnownDatabaseMessage(message3) {
70895
71136
  }
70896
71137
  return null;
70897
71138
  }
70898
- function normalizeMessage(message3) {
71139
+ function normalizeMessage(message3, version2) {
70899
71140
  const knownDatabaseMessage = normalizeKnownDatabaseMessage(message3);
70900
71141
  if (knownDatabaseMessage !== null) {
70901
71142
  return knownDatabaseMessage;
70902
71143
  }
70903
- return collapseWhitespace(normalizeScalarTokens(message3));
71144
+ return collapseWhitespace(normalizeScalarTokens(version2 === "v1" ? message3 : normalizeJavaTimerMessage(message3)));
70904
71145
  }
70905
71146
  function normalizeRoute(path) {
70906
71147
  if (path === null || path.length === 0) {
@@ -70975,29 +71216,17 @@ function normalizeResourceIdentity(value) {
70975
71216
  };
70976
71217
  }
70977
71218
  }
70978
- function stableJson(value) {
70979
- if (value === null || typeof value !== "object") {
70980
- return JSON.stringify(value);
70981
- }
70982
- if (Array.isArray(value)) {
70983
- return `[${value.map((entry) => stableJson(entry)).join(",")}]`;
70984
- }
70985
- const record = value;
70986
- const keys2 = Object.keys(record).sort();
70987
- const pairs = keys2.map((key) => `${JSON.stringify(key)}:${stableJson(record[key])}`);
70988
- return `{${pairs.join(",")}}`;
70989
- }
70990
71219
  function validateEvent(candidate) {
70991
71220
  return EventEnvelopeSchema.safeParse(normalizeCompatibleEventCandidate(candidate));
70992
71221
  }
70993
- function normalizeEvent(event) {
71222
+ function normalizeEvent(event, version2 = RESOURCE_FINGERPRINT_VERSION) {
70994
71223
  const redactedPayload = redact(event.payload).redacted;
70995
71224
  if (event.event_type === "backend_exception") {
70996
71225
  return {
70997
71226
  event_type: event.event_type,
70998
71227
  environment: event.service.environment,
70999
71228
  error_type: event.payload.name,
71000
- normalized_message: normalizeMessage(event.payload.message),
71229
+ normalized_message: normalizeMessage(event.payload.message, version2),
71001
71230
  route_template: normalizeRoute(event.payload.request.path),
71002
71231
  http_method: event.payload.request.method,
71003
71232
  http_status: event.payload.response.status_code,
@@ -71029,7 +71258,7 @@ function normalizeEvent(event) {
71029
71258
  event_type: event.event_type,
71030
71259
  environment: event.service.environment,
71031
71260
  error_type: null,
71032
- normalized_message: normalizeMessage(event.payload.message),
71261
+ normalized_message: normalizeMessage(event.payload.message, version2),
71033
71262
  route_template: null,
71034
71263
  http_method: null,
71035
71264
  http_status: null,
@@ -71044,18 +71273,22 @@ function normalizeEvent(event) {
71044
71273
  const browserEvent = event.payload.browser_event;
71045
71274
  const resourceIdentity = browserEvent?.kind === "resource_error" ? normalizeResourceIdentity(browserEvent.target?.source_url ?? browserEvent.file_name) : { host: null, path: null };
71046
71275
  const topFrames = browserEvent?.opaque === true ? [] : selectTopFrames(event.payload.stack);
71276
+ const resource = describeBrowserResource(browserEvent);
71277
+ const concreteResource = version2 === RESOURCE_FINGERPRINT_VERSION && browserEvent?.opaque === true && resource?.host != null && resource.type !== null;
71047
71278
  return {
71048
71279
  event_type: event.event_type,
71049
71280
  environment: event.service.environment,
71050
71281
  error_type: event.payload.name,
71051
- normalized_message: normalizeMessage(event.payload.message),
71282
+ normalized_message: normalizeMessage(event.payload.message, version2),
71052
71283
  route_template: normalizeRoute(event.payload.route ?? null),
71053
71284
  http_method: null,
71054
71285
  http_status: null,
71055
71286
  top_frames: topFrames,
71056
71287
  browser_event_kind: browserEvent?.kind ?? null,
71057
- resource_host: resourceIdentity.host,
71058
- resource_path: resourceIdentity.path,
71288
+ resource_host: concreteResource ? resource.host : resourceIdentity.host,
71289
+ resource_path: concreteResource ? resource.path : resourceIdentity.path,
71290
+ ...concreteResource ? { resource_type: resource.type } : {},
71291
+ ...resource === null ? {} : { incident_title: resource.title },
71059
71292
  payload: redactedPayload
71060
71293
  };
71061
71294
  }
@@ -71074,21 +71307,6 @@ function normalizeEvent(event) {
71074
71307
  payload: redactedPayload
71075
71308
  };
71076
71309
  }
71077
- function fingerprint(event) {
71078
- const canonical = {
71079
- error_type: event.error_type,
71080
- normalized_message: event.normalized_message,
71081
- top_frames: event.top_frames,
71082
- route_template: event.route_template,
71083
- browser_event_kind: event.browser_event_kind,
71084
- resource_host: event.resource_host,
71085
- resource_path: event.resource_path,
71086
- http_method: event.http_method,
71087
- http_status: event.http_status,
71088
- environment: event.environment
71089
- };
71090
- return (0, import_node_crypto2.createHash)("sha256").update(stableJson(canonical)).digest("hex");
71091
- }
71092
71310
  var INCIDENT_LOG_LEVELS = /* @__PURE__ */ new Set(["error", "fatal", "critical"]);
71093
71311
  function getRequestResponseStatus(payload2) {
71094
71312
  const status = payload2?.["response_status"];
@@ -89169,6 +89387,54 @@ var ANALYTICS_BOOTSTRAP_STATEMENTS = [
89169
89387
  `
89170
89388
  ];
89171
89389
 
89390
+ // ../../packages/storage/src/schema-migration-definition.ts
89391
+ var import_node_crypto7 = require("node:crypto");
89392
+ function defineStorageSchemaMigration(input2) {
89393
+ return {
89394
+ ...input2,
89395
+ checksum: (0, import_node_crypto7.createHash)("sha256").update(JSON.stringify(input2)).digest("hex")
89396
+ };
89397
+ }
89398
+
89399
+ // ../../packages/storage/src/worker-job-schema.ts
89400
+ var WORKER_JOB_SCHEMA_STATEMENTS = [
89401
+ `CREATE TABLE IF NOT EXISTS worker_jobs (
89402
+ id text PRIMARY KEY,
89403
+ job_name text NOT NULL,
89404
+ project_id uuid REFERENCES projects(id) ON DELETE CASCADE,
89405
+ payload jsonb,
89406
+ depends_on text REFERENCES worker_jobs(id) ON DELETE RESTRICT,
89407
+ status text NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'running', 'completed', 'failed', 'skipped')),
89408
+ attempts integer NOT NULL DEFAULT 0 CHECK (attempts >= 0),
89409
+ operator_retries integer NOT NULL DEFAULT 0 CHECK (operator_retries >= 0),
89410
+ available_at timestamptz NOT NULL DEFAULT now(),
89411
+ lease_token uuid,
89412
+ lease_expires_at timestamptz,
89413
+ last_error_code text,
89414
+ created_at timestamptz NOT NULL DEFAULT now(),
89415
+ updated_at timestamptz NOT NULL DEFAULT now(),
89416
+ expires_at timestamptz NOT NULL DEFAULT now() + interval '7 days',
89417
+ CHECK ((status = 'running') = (lease_token IS NOT NULL AND lease_expires_at IS NOT NULL)),
89418
+ CHECK (payload IS NULL OR jsonb_typeof(payload) = 'object')
89419
+ )`,
89420
+ `CREATE INDEX IF NOT EXISTS worker_jobs_pending_idx ON worker_jobs(job_name, available_at, created_at, id) WHERE status = 'pending'`,
89421
+ `CREATE INDEX IF NOT EXISTS worker_jobs_running_idx ON worker_jobs(lease_expires_at) WHERE status = 'running'`,
89422
+ `CREATE INDEX IF NOT EXISTS worker_jobs_expiry_idx ON worker_jobs(expires_at)`,
89423
+ `CREATE INDEX IF NOT EXISTS worker_jobs_project_idx ON worker_jobs(project_id)`,
89424
+ `CREATE INDEX IF NOT EXISTS worker_jobs_dependency_idx ON worker_jobs(depends_on) WHERE depends_on IS NOT NULL`,
89425
+ `CREATE INDEX IF NOT EXISTS worker_jobs_status_idx ON worker_jobs(status, created_at) WHERE status IN ('pending', 'running', 'failed')`
89426
+ ];
89427
+ var WORKER_JOB_SCHEMA_MIGRATIONS = [
89428
+ defineStorageSchemaMigration({
89429
+ id: "202609130001_add_durable_worker_jobs",
89430
+ description: "Persist worker handoffs, bounded retries, and fenced processing leases",
89431
+ statements: WORKER_JOB_SCHEMA_STATEMENTS
89432
+ })
89433
+ ];
89434
+ var WORKER_JOB_BOOTSTRAP_STATEMENTS = WORKER_JOB_SCHEMA_STATEMENTS.map(
89435
+ (statement) => statement.replaceAll(" IF NOT EXISTS", "")
89436
+ );
89437
+
89172
89438
  // ../../packages/storage/src/openai-oauth-bootstrap-statements.ts
89173
89439
  var OPENAI_OAUTH_BOOTSTRAP_STATEMENTS = [
89174
89440
  `
@@ -89255,6 +89521,192 @@ var OPENAI_OAUTH_BOOTSTRAP_STATEMENTS = [
89255
89521
  `CREATE INDEX oauth_provider_artifacts_expires_idx ON oauth_provider_artifacts (expires_at, model, provider_id_hash)`
89256
89522
  ];
89257
89523
 
89524
+ // ../../packages/storage/src/storage-bootstrap-incident-statements.ts
89525
+ var STORAGE_BOOTSTRAP_INCIDENT_STATEMENTS = [
89526
+ `
89527
+ CREATE TABLE incidents (
89528
+ id uuid PRIMARY KEY,
89529
+ project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
89530
+ service_id uuid REFERENCES services(id) ON DELETE SET NULL,
89531
+ environment text NOT NULL DEFAULT 'production',
89532
+ fingerprint text NOT NULL,
89533
+ fingerprint_version text NOT NULL DEFAULT 'v1',
89534
+ title text NOT NULL,
89535
+ severity text NOT NULL,
89536
+ status text NOT NULL DEFAULT 'open',
89537
+ first_seen_at timestamptz NOT NULL,
89538
+ last_seen_at timestamptz NOT NULL,
89539
+ occurrence_count integer NOT NULL DEFAULT 1,
89540
+ matched_fields text[],
89541
+ created_at timestamptz NOT NULL DEFAULT now(),
89542
+ updated_at timestamptz NOT NULL DEFAULT now(),
89543
+ regressed_at timestamptz,
89544
+ spike_detected_at timestamptz,
89545
+ frequency_occurrences_1m integer,
89546
+ frequency_occurrences_5m integer,
89547
+ frequency_occurrences_1h integer,
89548
+ frequency_occurrences_24h integer,
89549
+ frequency_baseline_1h_per_5m double precision,
89550
+ frequency_spike_ratio_5m_to_1h double precision,
89551
+ frequency_has_sufficient_baseline boolean,
89552
+ frequency_is_spiking boolean,
89553
+ frequency_snapshot_at timestamptz,
89554
+ latest_deployment_id uuid REFERENCES deployments(id) ON DELETE SET NULL,
89555
+ bundle_generation_number integer NOT NULL DEFAULT 0,
89556
+ bundle_created_at timestamptz,
89557
+ bundle_updated_at timestamptz,
89558
+ bundle_source_event_id uuid,
89559
+ bundle_source_occurred_at timestamptz,
89560
+ bundle_trigger text,
89561
+ bundle_failure_reason text,
89562
+ resolved_at timestamptz,
89563
+ resolved_by_member_id uuid REFERENCES users(id) ON DELETE SET NULL,
89564
+ UNIQUE (project_id, environment, service_id, fingerprint)
89565
+ )
89566
+ `,
89567
+ `
89568
+ CREATE TABLE processed_events (
89569
+ event_id uuid PRIMARY KEY,
89570
+ project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
89571
+ event_type text NOT NULL,
89572
+ fingerprint text NOT NULL,
89573
+ normalized_message text NOT NULL,
89574
+ processed_at timestamptz NOT NULL DEFAULT now()
89575
+ )
89576
+ `,
89577
+ `
89578
+ CREATE TABLE improvement_opportunities (
89579
+ id uuid PRIMARY KEY,
89580
+ project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
89581
+ service_id uuid REFERENCES services(id) ON DELETE SET NULL,
89582
+ service_name text NOT NULL,
89583
+ environment text NOT NULL DEFAULT 'production',
89584
+ kind text NOT NULL,
89585
+ status text NOT NULL DEFAULT 'open',
89586
+ severity text NOT NULL,
89587
+ confidence numeric NOT NULL,
89588
+ fingerprint text NOT NULL,
89589
+ title text NOT NULL,
89590
+ summary text NOT NULL,
89591
+ occurrence_count integer NOT NULL DEFAULT 1,
89592
+ evidence jsonb NOT NULL,
89593
+ first_detected_at timestamptz NOT NULL,
89594
+ last_detected_at timestamptz NOT NULL,
89595
+ last_source_event_id uuid,
89596
+ related_incident_ids uuid[] NOT NULL DEFAULT '{}',
89597
+ bundle_generation_number integer NOT NULL DEFAULT 0,
89598
+ bundle_created_at timestamptz,
89599
+ bundle_updated_at timestamptz,
89600
+ bundle_source_event_id uuid,
89601
+ bundle_failure_reason text,
89602
+ resolved_at timestamptz,
89603
+ resolved_by_user_id uuid REFERENCES users(id) ON DELETE SET NULL,
89604
+ snoozed_until timestamptz,
89605
+ created_at timestamptz NOT NULL DEFAULT now(),
89606
+ updated_at timestamptz NOT NULL DEFAULT now(),
89607
+ UNIQUE (project_id, fingerprint)
89608
+ )
89609
+ `,
89610
+ `
89611
+ CREATE INDEX improvement_opportunities_project_status_detected_idx
89612
+ ON improvement_opportunities (project_id, status, last_detected_at DESC)
89613
+ `,
89614
+ `
89615
+ CREATE INDEX improvement_opportunities_project_kind_detected_idx
89616
+ ON improvement_opportunities (project_id, kind, last_detected_at DESC)
89617
+ `,
89618
+ `
89619
+ CREATE INDEX improvement_opportunities_project_service_env_idx
89620
+ ON improvement_opportunities (project_id, service_id, environment)
89621
+ `,
89622
+ `
89623
+ CREATE TABLE improvement_opportunity_events (
89624
+ improvement_opportunity_id uuid NOT NULL REFERENCES improvement_opportunities(id) ON DELETE CASCADE,
89625
+ event_id uuid NOT NULL,
89626
+ event_type text NOT NULL,
89627
+ occurred_at timestamptz NOT NULL,
89628
+ PRIMARY KEY (improvement_opportunity_id, event_id)
89629
+ )
89630
+ `,
89631
+ `
89632
+ CREATE INDEX improvement_opportunity_events_detected_idx
89633
+ ON improvement_opportunity_events (improvement_opportunity_id, occurred_at DESC, event_id DESC)
89634
+ `,
89635
+ `
89636
+ CREATE TABLE bundle_generations (
89637
+ id uuid PRIMARY KEY,
89638
+ project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
89639
+ incident_id uuid REFERENCES incidents(id) ON DELETE CASCADE,
89640
+ improvement_opportunity_id uuid REFERENCES improvement_opportunities(id) ON DELETE CASCADE,
89641
+ bundle_type text NOT NULL,
89642
+ generation_number integer NOT NULL,
89643
+ source_event_id uuid NOT NULL,
89644
+ source_occurred_at timestamptz NOT NULL,
89645
+ trigger text NOT NULL,
89646
+ created_at timestamptz NOT NULL,
89647
+ updated_at timestamptz NOT NULL,
89648
+ CHECK (
89649
+ (incident_id IS NOT NULL AND improvement_opportunity_id IS NULL AND bundle_type = 'failure')
89650
+ OR (incident_id IS NULL AND improvement_opportunity_id IS NOT NULL AND bundle_type = 'improvement')
89651
+ )
89652
+ )
89653
+ `,
89654
+ `
89655
+ CREATE UNIQUE INDEX bundle_generations_incident_source_idx
89656
+ ON bundle_generations (incident_id, source_event_id)
89657
+ WHERE incident_id IS NOT NULL
89658
+ `,
89659
+ `
89660
+ CREATE UNIQUE INDEX bundle_generations_improvement_source_idx
89661
+ ON bundle_generations (improvement_opportunity_id, source_event_id)
89662
+ WHERE improvement_opportunity_id IS NOT NULL
89663
+ `,
89664
+ `
89665
+ CREATE INDEX bundle_generations_project_created_idx
89666
+ ON bundle_generations (project_id, created_at DESC, bundle_type)
89667
+ `,
89668
+ `
89669
+ CREATE INDEX bundle_generations_incident_generation_idx
89670
+ ON bundle_generations (incident_id, generation_number DESC)
89671
+ `,
89672
+ `
89673
+ CREATE INDEX bundle_generations_improvement_generation_idx
89674
+ ON bundle_generations (improvement_opportunity_id, generation_number DESC)
89675
+ WHERE improvement_opportunity_id IS NOT NULL
89676
+ `,
89677
+ `
89678
+ CREATE TABLE incident_events (
89679
+ incident_id uuid NOT NULL REFERENCES incidents(id) ON DELETE CASCADE,
89680
+ event_id uuid NOT NULL,
89681
+ event_type text NOT NULL,
89682
+ event_class text NOT NULL DEFAULT 'context_signal',
89683
+ occurred_at timestamptz NOT NULL,
89684
+ is_sampled boolean NOT NULL DEFAULT false,
89685
+ level text,
89686
+ resource_route text,
89687
+ retain_first boolean NOT NULL DEFAULT false,
89688
+ retain_latest boolean NOT NULL DEFAULT false,
89689
+ retain_after_deploy boolean NOT NULL DEFAULT false,
89690
+ retain_highest_severity boolean NOT NULL DEFAULT false,
89691
+ retain_deploy_metadata boolean NOT NULL DEFAULT false,
89692
+ severity_rank integer NOT NULL DEFAULT 0,
89693
+ PRIMARY KEY (incident_id, event_id)
89694
+ )
89695
+ `,
89696
+ `
89697
+ CREATE INDEX incident_events_incident_occurred_event_idx
89698
+ ON incident_events (incident_id, occurred_at DESC, event_id DESC)
89699
+ `,
89700
+ `
89701
+ CREATE INDEX incident_events_incident_level_occurred_event_idx
89702
+ ON incident_events (incident_id, level, occurred_at DESC, event_id DESC)
89703
+ `,
89704
+ `
89705
+ CREATE INDEX incident_events_incident_sampled_idx
89706
+ ON incident_events (incident_id, is_sampled, occurred_at ASC, event_id ASC)
89707
+ `
89708
+ ];
89709
+
89258
89710
  // ../../packages/storage/src/storage-bootstrap-account-analytics-statements.ts
89259
89711
  var STORAGE_BOOTSTRAP_ACCOUNT_ANALYTICS_STATEMENTS = [
89260
89712
  `
@@ -89775,187 +90227,7 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
89775
90227
  CREATE INDEX deployments_project_service_env_deployed_idx
89776
90228
  ON deployments (project_id, service_id, environment, deployed_at DESC)
89777
90229
  `,
89778
- `
89779
- CREATE TABLE incidents (
89780
- id uuid PRIMARY KEY,
89781
- project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
89782
- service_id uuid REFERENCES services(id) ON DELETE SET NULL,
89783
- environment text NOT NULL DEFAULT 'production',
89784
- fingerprint text NOT NULL,
89785
- fingerprint_version text NOT NULL DEFAULT 'v1',
89786
- title text NOT NULL,
89787
- severity text NOT NULL,
89788
- status text NOT NULL DEFAULT 'open',
89789
- first_seen_at timestamptz NOT NULL,
89790
- last_seen_at timestamptz NOT NULL,
89791
- occurrence_count integer NOT NULL DEFAULT 1,
89792
- matched_fields text[],
89793
- created_at timestamptz NOT NULL DEFAULT now(),
89794
- updated_at timestamptz NOT NULL DEFAULT now(),
89795
- regressed_at timestamptz,
89796
- spike_detected_at timestamptz,
89797
- frequency_occurrences_1m integer,
89798
- frequency_occurrences_5m integer,
89799
- frequency_occurrences_1h integer,
89800
- frequency_occurrences_24h integer,
89801
- frequency_baseline_1h_per_5m double precision,
89802
- frequency_spike_ratio_5m_to_1h double precision,
89803
- frequency_has_sufficient_baseline boolean,
89804
- frequency_is_spiking boolean,
89805
- frequency_snapshot_at timestamptz,
89806
- latest_deployment_id uuid REFERENCES deployments(id) ON DELETE SET NULL,
89807
- bundle_generation_number integer NOT NULL DEFAULT 0,
89808
- bundle_created_at timestamptz,
89809
- bundle_updated_at timestamptz,
89810
- bundle_source_event_id uuid,
89811
- bundle_source_occurred_at timestamptz,
89812
- bundle_trigger text,
89813
- bundle_failure_reason text,
89814
- resolved_at timestamptz,
89815
- resolved_by_member_id uuid REFERENCES users(id) ON DELETE SET NULL,
89816
- UNIQUE (project_id, environment, service_id, fingerprint)
89817
- )
89818
- `,
89819
- `
89820
- CREATE TABLE processed_events (
89821
- event_id uuid PRIMARY KEY,
89822
- project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
89823
- event_type text NOT NULL,
89824
- fingerprint text NOT NULL,
89825
- normalized_message text NOT NULL,
89826
- processed_at timestamptz NOT NULL DEFAULT now()
89827
- )
89828
- `,
89829
- `
89830
- CREATE TABLE improvement_opportunities (
89831
- id uuid PRIMARY KEY,
89832
- project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
89833
- service_id uuid REFERENCES services(id) ON DELETE SET NULL,
89834
- service_name text NOT NULL,
89835
- environment text NOT NULL DEFAULT 'production',
89836
- kind text NOT NULL,
89837
- status text NOT NULL DEFAULT 'open',
89838
- severity text NOT NULL,
89839
- confidence numeric NOT NULL,
89840
- fingerprint text NOT NULL,
89841
- title text NOT NULL,
89842
- summary text NOT NULL,
89843
- occurrence_count integer NOT NULL DEFAULT 1,
89844
- evidence jsonb NOT NULL,
89845
- first_detected_at timestamptz NOT NULL,
89846
- last_detected_at timestamptz NOT NULL,
89847
- last_source_event_id uuid,
89848
- related_incident_ids uuid[] NOT NULL DEFAULT '{}',
89849
- bundle_generation_number integer NOT NULL DEFAULT 0,
89850
- bundle_created_at timestamptz,
89851
- bundle_updated_at timestamptz,
89852
- bundle_source_event_id uuid,
89853
- bundle_failure_reason text,
89854
- resolved_at timestamptz,
89855
- resolved_by_user_id uuid REFERENCES users(id) ON DELETE SET NULL,
89856
- snoozed_until timestamptz,
89857
- created_at timestamptz NOT NULL DEFAULT now(),
89858
- updated_at timestamptz NOT NULL DEFAULT now(),
89859
- UNIQUE (project_id, fingerprint)
89860
- )
89861
- `,
89862
- `
89863
- CREATE INDEX improvement_opportunities_project_status_detected_idx
89864
- ON improvement_opportunities (project_id, status, last_detected_at DESC)
89865
- `,
89866
- `
89867
- CREATE INDEX improvement_opportunities_project_kind_detected_idx
89868
- ON improvement_opportunities (project_id, kind, last_detected_at DESC)
89869
- `,
89870
- `
89871
- CREATE INDEX improvement_opportunities_project_service_env_idx
89872
- ON improvement_opportunities (project_id, service_id, environment)
89873
- `,
89874
- `
89875
- CREATE TABLE improvement_opportunity_events (
89876
- improvement_opportunity_id uuid NOT NULL REFERENCES improvement_opportunities(id) ON DELETE CASCADE,
89877
- event_id uuid NOT NULL,
89878
- event_type text NOT NULL,
89879
- occurred_at timestamptz NOT NULL,
89880
- PRIMARY KEY (improvement_opportunity_id, event_id)
89881
- )
89882
- `,
89883
- `
89884
- CREATE INDEX improvement_opportunity_events_detected_idx
89885
- ON improvement_opportunity_events (improvement_opportunity_id, occurred_at DESC, event_id DESC)
89886
- `,
89887
- `
89888
- CREATE TABLE bundle_generations (
89889
- id uuid PRIMARY KEY,
89890
- project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
89891
- incident_id uuid REFERENCES incidents(id) ON DELETE CASCADE,
89892
- improvement_opportunity_id uuid REFERENCES improvement_opportunities(id) ON DELETE CASCADE,
89893
- bundle_type text NOT NULL,
89894
- generation_number integer NOT NULL,
89895
- source_event_id uuid NOT NULL,
89896
- source_occurred_at timestamptz NOT NULL,
89897
- trigger text NOT NULL,
89898
- created_at timestamptz NOT NULL,
89899
- updated_at timestamptz NOT NULL,
89900
- CHECK (
89901
- (incident_id IS NOT NULL AND improvement_opportunity_id IS NULL AND bundle_type = 'failure')
89902
- OR (incident_id IS NULL AND improvement_opportunity_id IS NOT NULL AND bundle_type = 'improvement')
89903
- )
89904
- )
89905
- `,
89906
- `
89907
- CREATE UNIQUE INDEX bundle_generations_incident_source_idx
89908
- ON bundle_generations (incident_id, source_event_id)
89909
- WHERE incident_id IS NOT NULL
89910
- `,
89911
- `
89912
- CREATE UNIQUE INDEX bundle_generations_improvement_source_idx
89913
- ON bundle_generations (improvement_opportunity_id, source_event_id)
89914
- WHERE improvement_opportunity_id IS NOT NULL
89915
- `,
89916
- `
89917
- CREATE INDEX bundle_generations_project_created_idx
89918
- ON bundle_generations (project_id, created_at DESC, bundle_type)
89919
- `,
89920
- `
89921
- CREATE INDEX bundle_generations_incident_generation_idx
89922
- ON bundle_generations (incident_id, generation_number DESC)
89923
- `,
89924
- `
89925
- CREATE INDEX bundle_generations_improvement_generation_idx
89926
- ON bundle_generations (improvement_opportunity_id, generation_number DESC)
89927
- WHERE improvement_opportunity_id IS NOT NULL
89928
- `,
89929
- `
89930
- CREATE TABLE incident_events (
89931
- incident_id uuid NOT NULL REFERENCES incidents(id) ON DELETE CASCADE,
89932
- event_id uuid NOT NULL,
89933
- event_type text NOT NULL,
89934
- event_class text NOT NULL DEFAULT 'context_signal',
89935
- occurred_at timestamptz NOT NULL,
89936
- is_sampled boolean NOT NULL DEFAULT false,
89937
- level text,
89938
- retain_first boolean NOT NULL DEFAULT false,
89939
- retain_latest boolean NOT NULL DEFAULT false,
89940
- retain_after_deploy boolean NOT NULL DEFAULT false,
89941
- retain_highest_severity boolean NOT NULL DEFAULT false,
89942
- retain_deploy_metadata boolean NOT NULL DEFAULT false,
89943
- severity_rank integer NOT NULL DEFAULT 0,
89944
- PRIMARY KEY (incident_id, event_id)
89945
- )
89946
- `,
89947
- `
89948
- CREATE INDEX incident_events_incident_occurred_event_idx
89949
- ON incident_events (incident_id, occurred_at DESC, event_id DESC)
89950
- `,
89951
- `
89952
- CREATE INDEX incident_events_incident_level_occurred_event_idx
89953
- ON incident_events (incident_id, level, occurred_at DESC, event_id DESC)
89954
- `,
89955
- `
89956
- CREATE INDEX incident_events_incident_sampled_idx
89957
- ON incident_events (incident_id, is_sampled, occurred_at ASC, event_id ASC)
89958
- `,
90230
+ ...STORAGE_BOOTSTRAP_INCIDENT_STATEMENTS,
89959
90231
  `
89960
90232
  CREATE TABLE weekly_report_channels (
89961
90233
  id uuid PRIMARY KEY,
@@ -90409,18 +90681,19 @@ var STORAGE_BOOTSTRAP_STATEMENTS2 = [
90409
90681
  ...STORAGE_BOOTSTRAP_STATEMENTS,
90410
90682
  ...OPENAI_OAUTH_BOOTSTRAP_STATEMENTS,
90411
90683
  ...AVAILABILITY_CHECK_BOOTSTRAP_STATEMENTS,
90412
- ...ANALYTICS_BOOTSTRAP_STATEMENTS
90684
+ ...ANALYTICS_BOOTSTRAP_STATEMENTS,
90685
+ ...WORKER_JOB_BOOTSTRAP_STATEMENTS
90413
90686
  ];
90414
90687
 
90415
90688
  // ../../packages/storage/src/migrations.ts
90416
90689
  var STORAGE_BOOTSTRAP_SQL = STORAGE_BOOTSTRAP_STATEMENTS2.join(";\n\n");
90417
90690
 
90418
90691
  // ../../packages/storage/src/availability-check-schema-migrations.ts
90419
- var import_node_crypto7 = require("node:crypto");
90692
+ var import_node_crypto8 = require("node:crypto");
90420
90693
  function defineAvailabilityCheckStorageSchemaMigration(input2) {
90421
90694
  return {
90422
90695
  ...input2,
90423
- checksum: (0, import_node_crypto7.createHash)("sha256").update(JSON.stringify(input2)).digest("hex")
90696
+ checksum: (0, import_node_crypto8.createHash)("sha256").update(JSON.stringify(input2)).digest("hex")
90424
90697
  };
90425
90698
  }
90426
90699
  var AVAILABILITY_CHECK_STORAGE_SCHEMA_MIGRATIONS = [
@@ -90664,11 +90937,11 @@ var AVAILABILITY_CHECK_STORAGE_SCHEMA_MIGRATIONS = [
90664
90937
  ];
90665
90938
 
90666
90939
  // ../../packages/storage/src/analytics-schema-migrations.ts
90667
- var import_node_crypto8 = require("node:crypto");
90940
+ var import_node_crypto9 = require("node:crypto");
90668
90941
  function defineAnalyticsStorageSchemaMigration(input2) {
90669
90942
  return {
90670
90943
  ...input2,
90671
- checksum: (0, import_node_crypto8.createHash)("sha256").update(JSON.stringify(input2)).digest("hex")
90944
+ checksum: (0, import_node_crypto9.createHash)("sha256").update(JSON.stringify(input2)).digest("hex")
90672
90945
  };
90673
90946
  }
90674
90947
  var analyticsAnalysisKindCheck2 = "('usage_summary', 'route_health', 'funnel_dropoff', 'journey_friction', 'feature_usage', 'incident_impact', 'deploy_comparison', 'conversion_path')";
@@ -91456,15 +91729,6 @@ var ANALYTICS_STORAGE_SCHEMA_MIGRATIONS = [
91456
91729
  })
91457
91730
  ];
91458
91731
 
91459
- // ../../packages/storage/src/schema-migration-definition.ts
91460
- var import_node_crypto9 = require("node:crypto");
91461
- function defineStorageSchemaMigration(input2) {
91462
- return {
91463
- ...input2,
91464
- checksum: (0, import_node_crypto9.createHash)("sha256").update(JSON.stringify(input2)).digest("hex")
91465
- };
91466
- }
91467
-
91468
91732
  // ../../packages/storage/src/openai-oauth-schema-migrations.ts
91469
91733
  var OPENAI_OAUTH_STORAGE_SCHEMA_MIGRATIONS = [
91470
91734
  defineStorageSchemaMigration({
@@ -92552,7 +92816,12 @@ var LATE_STORAGE_SCHEMA_MIGRATIONS = [
92552
92816
  // ../../packages/storage/src/schema-migrations-catalog.ts
92553
92817
  var STORAGE_SCHEMA_MIGRATIONS = [
92554
92818
  ...EARLY_STORAGE_SCHEMA_MIGRATIONS,
92555
- ...LATE_STORAGE_SCHEMA_MIGRATIONS
92819
+ ...LATE_STORAGE_SCHEMA_MIGRATIONS,
92820
+ defineStorageSchemaMigration({
92821
+ id: "202609160001_add_browser_resource_routes",
92822
+ description: "Retain sanitized browser resource routes independently of raw event sampling.",
92823
+ statements: ["ALTER TABLE incident_events ADD COLUMN IF NOT EXISTS resource_route text"]
92824
+ })
92556
92825
  ];
92557
92826
 
92558
92827
  // ../../packages/storage/src/schema-migrations.ts
@@ -92560,7 +92829,8 @@ var STORAGE_SCHEMA_MIGRATIONS2 = [
92560
92829
  ...STORAGE_SCHEMA_MIGRATIONS,
92561
92830
  ...AVAILABILITY_CHECK_STORAGE_SCHEMA_MIGRATIONS,
92562
92831
  ...ANALYTICS_STORAGE_SCHEMA_MIGRATIONS,
92563
- ...OPENAI_OAUTH_STORAGE_SCHEMA_MIGRATIONS
92832
+ ...OPENAI_OAUTH_STORAGE_SCHEMA_MIGRATIONS,
92833
+ ...WORKER_JOB_SCHEMA_MIGRATIONS
92564
92834
  ].sort((left, right) => left.id.localeCompare(right.id));
92565
92835
 
92566
92836
  // ../cli/src/ingest-command.ts
@@ -92572,6 +92842,39 @@ var import_node_crypto10 = require("node:crypto");
92572
92842
  var import_promises5 = require("node:fs/promises");
92573
92843
  var import_node_path6 = require("node:path");
92574
92844
 
92845
+ // ../../packages/bundle-engine/src/browser-resource-context.ts
92846
+ function buildBrowserResourceContext(browserEvent, incident, events2) {
92847
+ const resource = describeBrowserResource(browserEvent);
92848
+ if (resource === null) return void 0;
92849
+ const routes = [];
92850
+ for (const event of events2) {
92851
+ if (event.event_type !== "frontend_exception" || event.service.name !== incident.service_name || event.service.environment !== incident.environment)
92852
+ continue;
92853
+ const candidate = describeBrowserResource(event.payload.browser_event);
92854
+ if (candidate !== null && candidate.host === resource.host && candidate.path === resource.path && candidate.type === resource.type) {
92855
+ routes.push(event.payload.route ?? null);
92856
+ }
92857
+ }
92858
+ return {
92859
+ version: 1,
92860
+ ...resource,
92861
+ diagnosis: browserResourceDiagnosis(resource),
92862
+ routes: incident.resource_routes ?? summarizeResourceRoutes(routes, incident.occurrence_count)
92863
+ };
92864
+ }
92865
+
92866
+ // ../../packages/bundle-engine/src/deployment-context.ts
92867
+ function selectScopedDeployments(input2) {
92868
+ const cutoff = Date.parse(input2.occurredAt);
92869
+ const configuredAt = Date.parse(input2.configuredDeployedAt ?? "");
92870
+ return input2.envelopes.filter(
92871
+ (event) => event.event_type === "deploy_metadata" && event.service.name === input2.service && event.service.environment === input2.environment && event.payload.environment === input2.environment && Date.parse(event.payload.deployed_at) <= cutoff && // A caller-provided workload history row can be newer than the raw window.
92872
+ (!(configuredAt <= cutoff) || Date.parse(event.payload.deployed_at) >= configuredAt)
92873
+ ).sort(
92874
+ (left, right) => Date.parse(left.payload.deployed_at) - Date.parse(right.payload.deployed_at) || left.event_id.localeCompare(right.event_id)
92875
+ );
92876
+ }
92877
+
92575
92878
  // ../../packages/bundle-engine/src/frontend-context.ts
92576
92879
  function toIsoTimestamp(value) {
92577
92880
  return new Date(value).toISOString();
@@ -92645,9 +92948,9 @@ function stableJson2(value) {
92645
92948
  if (Array.isArray(value)) {
92646
92949
  return `[${value.map((entry) => stableJson2(entry)).join(",")}]`;
92647
92950
  }
92648
- const record = value;
92649
- const keys2 = Object.keys(record).sort();
92650
- return `{${keys2.map((key) => `${JSON.stringify(key)}:${stableJson2(record[key])}`).join(",")}}`;
92951
+ const record2 = value;
92952
+ const keys2 = Object.keys(record2).sort();
92953
+ return `{${keys2.map((key) => `${JSON.stringify(key)}:${stableJson2(record2[key])}`).join(",")}}`;
92651
92954
  }
92652
92955
  function buildFrontendBreadcrumbKey(input2) {
92653
92956
  return `${input2.breadcrumb_type}:${input2.ts}:${input2.route ?? ""}:${stableJson2(input2.data)}`;
@@ -92957,6 +93260,7 @@ function buildRequestContext(envelopes) {
92957
93260
  if (exceptionEvent === null) {
92958
93261
  return null;
92959
93262
  }
93263
+ if (exceptionEvent.payload.request.method.toUpperCase() === "UNKNOWN") return null;
92960
93264
  return {
92961
93265
  version: 1,
92962
93266
  method: exceptionEvent.payload.request.method,
@@ -93020,10 +93324,11 @@ function buildSummaryGuidance(input2) {
93020
93324
  }
93021
93325
  if (input2.opaqueBrowserError) {
93022
93326
  if (input2.browserEvent?.kind === "resource_error") {
93327
+ const resource = describeBrowserResource(input2.browserEvent);
93023
93328
  return {
93024
- likely_cause: "The browser reported a resource load error without a usable application stack.",
93329
+ likely_cause: browserResourceDiagnosis(resource),
93025
93330
  confidence: 0.35,
93026
- recommended_action: "Inspect the captured resource target, browser network failures, CSP rules, and cross-origin asset configuration."
93331
+ recommended_action: "Check the affected resource and routes, browser network failures, CSP and provider availability." + (resource?.optional_candidate === true ? " If the dependency is optional for your app, review a resource-scoped noise rule." : " Verify whether application functionality is affected.")
93027
93332
  };
93028
93333
  }
93029
93334
  return {
@@ -93277,21 +93582,30 @@ function buildBundle(input2) {
93277
93582
  const responseContext = buildResponseContext(sourceEnvelopes);
93278
93583
  const logsContext = buildLogsContext(sourceEnvelopes);
93279
93584
  const frontendContext = buildFrontendContext(sourceEnvelopes);
93585
+ const deploymentEnvelopes = selectScopedDeployments({
93586
+ envelopes: sourceEnvelopes,
93587
+ service: input2.incident.service_name,
93588
+ environment: input2.incident.environment,
93589
+ occurredAt: input2.bundleMetadata.source_occurred_at,
93590
+ configuredDeployedAt: input2.configuredDeploy?.deployed_at ?? null
93591
+ });
93280
93592
  const deployContext = buildDeployContext(
93281
- sourceEnvelopes,
93593
+ deploymentEnvelopes,
93282
93594
  input2.job.trigger,
93283
93595
  input2.configuredDeploy
93284
93596
  );
93285
93597
  const runtimeContext = buildRuntimeContext(sourceEnvelopes);
93286
- const gitContext = buildGitContext(sourceEnvelopes, input2.configuredDeploy);
93598
+ const gitContext = buildGitContext(deploymentEnvelopes, input2.configuredDeploy);
93287
93599
  const deviceContext = buildDeviceContext(sourceEnvelopes);
93288
93600
  const dependenciesContext = buildDependenciesContext(
93289
93601
  input2.incident,
93290
93602
  errorContext,
93291
93603
  requestContext
93292
93604
  );
93293
- const browserEvent = getPrimaryBrowserExceptionEvent(sourceEnvelopes, primarySignalEnvelope);
93605
+ const browserEventCandidate = getPrimaryBrowserExceptionEvent(sourceEnvelopes, primarySignalEnvelope);
93606
+ const browserEvent = browserEventCandidate?.kind === "resource_error" && primarySignalEnvelope !== null && !isFrontendExceptionEnvelope(primarySignalEnvelope) ? null : browserEventCandidate;
93294
93607
  const opaqueBrowserError = isOpaqueBrowserError(errorContext, browserEvent);
93608
+ const resourceContext = buildBrowserResourceContext(browserEvent, input2.incident, sourceEnvelopes);
93295
93609
  const primarySignalType = primarySignalEnvelope !== null ? mapSignalType(primarySignalEnvelope.event_type) : inferSignalTypeFromSourceEventTypes(sourceEventTypes);
93296
93610
  const primarySourceEvent = errorContext?.name ?? sourceEventTypes[0] ?? "backend_exception";
93297
93611
  const firstSeenAt = new Date(input2.incident.first_seen_at).toISOString();
@@ -93365,6 +93679,7 @@ function buildBundle(input2) {
93365
93679
  regression_suspected: input2.job.trigger === "regression_reopen"
93366
93680
  },
93367
93681
  context: {
93682
+ ...resourceContext === void 0 ? {} : { resource_failure: resourceContext },
93368
93683
  error: errorContext,
93369
93684
  request: requestContext,
93370
93685
  response: responseContext,
@@ -93418,7 +93733,9 @@ function stableStringify(value) {
93418
93733
  return `[${value.map((item) => stableStringify(item)).join(",")}]`;
93419
93734
  }
93420
93735
  if (value !== null && typeof value === "object") {
93421
- const entries = Object.entries(value).sort(([left], [right]) => left.localeCompare(right));
93736
+ const entries = Object.entries(value).sort(
93737
+ ([left], [right]) => left.localeCompare(right)
93738
+ );
93422
93739
  return `{${entries.map(([key, entryValue]) => `${JSON.stringify(key)}:${stableStringify(entryValue)}`).join(",")}}`;
93423
93740
  }
93424
93741
  return JSON.stringify(value);
@@ -93426,8 +93743,8 @@ function stableStringify(value) {
93426
93743
  function shellQuote(value) {
93427
93744
  return `'${value.replaceAll("'", `'\\''`)}'`;
93428
93745
  }
93429
- function sortRecordEntries(record) {
93430
- return Object.entries(record).sort(([left], [right]) => left.localeCompare(right));
93746
+ function sortRecordEntries(record2) {
93747
+ return Object.entries(record2).sort(([left], [right]) => left.localeCompare(right));
93431
93748
  }
93432
93749
  var REPLAY_HEADER_PRIORITY = [
93433
93750
  "authorization",
@@ -93497,7 +93814,10 @@ function normalizeReplayJsonValue(value) {
93497
93814
  }
93498
93815
  if (value !== null && typeof value === "object") {
93499
93816
  return Object.fromEntries(
93500
- Object.entries(value).map(([key, entryValue]) => [key, normalizeReplayJsonValue(entryValue)])
93817
+ Object.entries(value).map(([key, entryValue]) => [
93818
+ key,
93819
+ normalizeReplayJsonValue(entryValue)
93820
+ ])
93501
93821
  );
93502
93822
  }
93503
93823
  return value;
@@ -93518,7 +93838,10 @@ function normalizeReplayQueryValue(value) {
93518
93838
  }
93519
93839
  if (value !== null && typeof value === "object") {
93520
93840
  return Object.fromEntries(
93521
- sortRecordEntries(value).map(([key, entryValue]) => [key, normalizeReplayQueryValue(entryValue)])
93841
+ sortRecordEntries(value).map(([key, entryValue]) => [
93842
+ key,
93843
+ normalizeReplayQueryValue(entryValue)
93844
+ ])
93522
93845
  );
93523
93846
  }
93524
93847
  return value;
@@ -93534,7 +93857,9 @@ function hasStructuredQueryAmbiguity(value) {
93534
93857
  return value.some((item) => hasStructuredQueryAmbiguity(item));
93535
93858
  }
93536
93859
  if (value !== null && typeof value === "object") {
93537
- return Object.values(value).some((item) => hasStructuredQueryAmbiguity(item));
93860
+ return Object.values(value).some(
93861
+ (item) => hasStructuredQueryAmbiguity(item)
93862
+ );
93538
93863
  }
93539
93864
  return false;
93540
93865
  }
@@ -93545,7 +93870,9 @@ function buildStructuredReplayQuery(query) {
93545
93870
  return hasStructuredQueryAmbiguity(normalizedQuery) ? normalizedQuery : void 0;
93546
93871
  }
93547
93872
  function buildReplayHeaders(headers) {
93548
- const entries = sortRecordEntries(headers).filter(([headerName]) => !DROPPED_REPLAY_HEADERS.has(headerName.toLowerCase())).map(([headerName, headerValue]) => [headerName, normalizeHeaderValue(headerValue)]);
93873
+ const entries = sortRecordEntries(headers).filter(([headerName]) => !DROPPED_REPLAY_HEADERS.has(headerName.toLowerCase())).map(
93874
+ ([headerName, headerValue]) => [headerName, normalizeHeaderValue(headerValue)]
93875
+ );
93549
93876
  entries.sort(([left], [right]) => {
93550
93877
  const leftPriority = REPLAY_HEADER_PRIORITY.indexOf(left.toLowerCase());
93551
93878
  const rightPriority = REPLAY_HEADER_PRIORITY.indexOf(right.toLowerCase());
@@ -93571,7 +93898,9 @@ function expandHeaderValues(headers) {
93571
93898
  });
93572
93899
  }
93573
93900
  function getHeaderValues(headers, headerName) {
93574
- const matchedEntry = sortRecordEntries(headers).find(([candidateName]) => candidateName.toLowerCase() === headerName.toLowerCase());
93901
+ const matchedEntry = sortRecordEntries(headers).find(
93902
+ ([candidateName]) => candidateName.toLowerCase() === headerName.toLowerCase()
93903
+ );
93575
93904
  if (matchedEntry === void 0) {
93576
93905
  return [];
93577
93906
  }
@@ -93633,6 +93962,9 @@ function buildDeterministicRequestUrl(request) {
93633
93962
  const protocol = typeof protoHeader === "string" && protoHeader.length > 0 ? protoHeader : "https";
93634
93963
  const host = typeof forwardedHostHeader === "string" && forwardedHostHeader.length > 0 ? forwardedHostHeader : typeof hostHeader === "string" && hostHeader.length > 0 ? hostHeader : "example.invalid";
93635
93964
  const url = new URL(request.path, `${protocol}://${host}`);
93965
+ if (!["http:", "https:"].includes(url.protocol) || url.username || url.password) {
93966
+ throw new Error("request_url_invalid");
93967
+ }
93636
93968
  for (const [key, rawValue] of sortRecordEntries(request.query)) {
93637
93969
  if (Array.isArray(rawValue)) {
93638
93970
  for (const item of rawValue) {
@@ -93656,22 +93988,52 @@ function buildReproduction(bundle) {
93656
93988
  };
93657
93989
  }
93658
93990
  const method = request.method.toUpperCase();
93659
- const url = buildDeterministicRequestUrl(request);
93991
+ if (!/^[A-Z][A-Z0-9_-]{0,31}$/.test(method) || method === "UNKNOWN") {
93992
+ return {
93993
+ possible: false,
93994
+ confidence: 0.1,
93995
+ reason: "request_method_unavailable",
93996
+ artifacts: null,
93997
+ feasibility_reference: null
93998
+ };
93999
+ }
94000
+ let url;
94001
+ try {
94002
+ url = buildDeterministicRequestUrl(request);
94003
+ } catch {
94004
+ return {
94005
+ possible: false,
94006
+ confidence: 0.1,
94007
+ reason: "request_url_invalid",
94008
+ artifacts: null,
94009
+ feasibility_reference: null
94010
+ };
94011
+ }
93660
94012
  const replayHeaders = buildReplayHeaders(request.headers);
93661
94013
  const contentType = getPrimaryContentType(replayHeaders);
93662
94014
  const structuredReplayQuery = buildStructuredReplayQuery(request.query);
93663
- const headerParts = expandHeaderValues(replayHeaders).map(([headerName, headerValue]) => `${headerName}:${headerValue}`);
93664
- const curlHeaderParts = headerParts.map((header2) => `-H ${shellQuote(header2.replace(":", ": "))}`);
94015
+ const headerParts = expandHeaderValues(replayHeaders).map(
94016
+ ([headerName, headerValue]) => `${headerName}:${headerValue}`
94017
+ );
94018
+ const curlHeaderParts = headerParts.map(
94019
+ (header2) => `-H ${shellQuote(header2.replace(":", ": "))}`
94020
+ );
93665
94021
  const requestBody = buildReplayBody(request.body, replayHeaders);
93666
94022
  const jsonSpecBody = contentType === "application/json" ? request.body === void 0 ? null : normalizeReplayJsonValue(request.body) : typeof request.body === "string" ? requestBody : request.body === null || request.body === void 0 ? null : request.body;
93667
94023
  const curlBodyPart = requestBody === null ? [] : [`--data-raw ${shellQuote(requestBody)}`];
93668
- const curl = [`curl -X ${method} ${shellQuote(url)}`, ...curlHeaderParts, ...curlBodyPart].join(" ");
93669
- const httpieBase = [`http ${method} ${shellQuote(url)}`, ...headerParts.map((header2) => shellQuote(header2))].join(" ");
94024
+ const curl = [`curl -X ${method} ${shellQuote(url)}`, ...curlHeaderParts, ...curlBodyPart].join(
94025
+ " "
94026
+ );
94027
+ const httpieBase = [
94028
+ `http ${method} ${shellQuote(url)}`,
94029
+ ...headerParts.map((header2) => shellQuote(header2))
94030
+ ].join(" ");
93670
94031
  const httpie = requestBody === null ? httpieBase : `printf '%s' ${shellQuote(requestBody)} | ${httpieBase}`;
94032
+ const hasRequestTarget = new URL(url).hostname !== "example.invalid";
93671
94033
  return {
93672
- possible: true,
93673
- confidence: 0.8,
93674
- reason: "request_context_available",
94034
+ possible: hasRequestTarget,
94035
+ confidence: hasRequestTarget ? 0.8 : 0.1,
94036
+ reason: hasRequestTarget ? "request_context_available" : "request_target_unavailable",
93675
94037
  artifacts: {
93676
94038
  curl,
93677
94039
  httpie,
@@ -93699,6 +94061,159 @@ function resolveWorkspacePath(rootDirectory, targetPath) {
93699
94061
  return (0, import_node_path5.isAbsolute)(targetPath) ? targetPath : (0, import_node_path5.join)(rootDirectory, targetPath);
93700
94062
  }
93701
94063
 
94064
+ // ../cli/src/local-processing-state.ts
94065
+ var EVENT_TYPE_SET = new Set(EventTypeValues);
94066
+ function isEventType(value) {
94067
+ return typeof value === "string" && EVENT_TYPE_SET.has(value);
94068
+ }
94069
+ function parseIncidentState(candidate) {
94070
+ if (!isRecord5(candidate)) {
94071
+ return null;
94072
+ }
94073
+ if (candidate["source"] !== "local" || candidate["status"] !== "open" && candidate["status"] !== "resolved") {
94074
+ return null;
94075
+ }
94076
+ const sourceEvents = candidate["source_events"];
94077
+ if (!Array.isArray(sourceEvents)) {
94078
+ return null;
94079
+ }
94080
+ const validatedSourceEvents = [];
94081
+ for (const sourceEvent of sourceEvents) {
94082
+ const validated = validateEvent(sourceEvent);
94083
+ if (!validated.success) {
94084
+ return null;
94085
+ }
94086
+ validatedSourceEvents.push(validated.data);
94087
+ }
94088
+ const matchedFields = candidate["matched_fields"];
94089
+ const sourceEventTypes = candidate["source_event_types"];
94090
+ if (!Array.isArray(matchedFields) || !matchedFields.every((value) => typeof value === "string")) {
94091
+ return null;
94092
+ }
94093
+ if (!Array.isArray(sourceEventTypes) || !sourceEventTypes.every(isEventType)) {
94094
+ return null;
94095
+ }
94096
+ const severity = candidate["severity"];
94097
+ if (severity !== "low" && severity !== "medium" && severity !== "high" && severity !== "critical") {
94098
+ return null;
94099
+ }
94100
+ const status = candidate["status"];
94101
+ if (status !== "open" && status !== "resolved") {
94102
+ return null;
94103
+ }
94104
+ const requiredStringKeys = [
94105
+ "incident_id",
94106
+ "project_id",
94107
+ "service_id",
94108
+ "service_name",
94109
+ "environment",
94110
+ "fingerprint",
94111
+ "fingerprint_version",
94112
+ "title",
94113
+ "first_seen_at",
94114
+ "last_seen_at",
94115
+ "source_event_id",
94116
+ "source_occurred_at",
94117
+ "bundle_path",
94118
+ "reproduction_path"
94119
+ ];
94120
+ for (const key of requiredStringKeys) {
94121
+ if (typeof candidate[key] !== "string") {
94122
+ return null;
94123
+ }
94124
+ }
94125
+ if (typeof candidate["occurrence_count"] !== "number" || typeof candidate["generation_number"] !== "number") {
94126
+ return null;
94127
+ }
94128
+ const serviceRuntime = candidate["service_runtime"];
94129
+ const serviceFramework = candidate["service_framework"];
94130
+ if (serviceRuntime !== null && typeof serviceRuntime !== "string") {
94131
+ return null;
94132
+ }
94133
+ if (serviceFramework !== null && typeof serviceFramework !== "string") {
94134
+ return null;
94135
+ }
94136
+ const incidentId = candidate["incident_id"];
94137
+ const projectId = candidate["project_id"];
94138
+ const serviceId = candidate["service_id"];
94139
+ const serviceName = candidate["service_name"];
94140
+ const environment = candidate["environment"];
94141
+ const incidentFingerprint = candidate["fingerprint"];
94142
+ const fingerprintVersion2 = candidate["fingerprint_version"];
94143
+ const title = candidate["title"];
94144
+ const firstSeenAt = candidate["first_seen_at"];
94145
+ const lastSeenAt = candidate["last_seen_at"];
94146
+ const occurrenceCount = candidate["occurrence_count"];
94147
+ const sourceEventId = candidate["source_event_id"];
94148
+ const sourceOccurredAt = candidate["source_occurred_at"];
94149
+ const bundlePath = candidate["bundle_path"];
94150
+ const reproductionPath = candidate["reproduction_path"];
94151
+ const generationNumber = candidate["generation_number"];
94152
+ const normalizedSourceEventTypes = [...sourceEventTypes].sort();
94153
+ return {
94154
+ incident_id: incidentId,
94155
+ source: "local",
94156
+ project_id: projectId,
94157
+ service_id: serviceId,
94158
+ service_name: serviceName,
94159
+ service_runtime: serviceRuntime,
94160
+ service_framework: serviceFramework,
94161
+ environment,
94162
+ fingerprint: incidentFingerprint,
94163
+ fingerprint_version: fingerprintVersion2,
94164
+ title,
94165
+ severity,
94166
+ status,
94167
+ first_seen_at: firstSeenAt,
94168
+ last_seen_at: lastSeenAt,
94169
+ occurrence_count: occurrenceCount,
94170
+ source_event_id: sourceEventId,
94171
+ source_occurred_at: sourceOccurredAt,
94172
+ source_event_types: normalizedSourceEventTypes,
94173
+ matched_fields: [...matchedFields].sort(),
94174
+ bundle_path: bundlePath,
94175
+ reproduction_path: reproductionPath,
94176
+ generation_number: generationNumber,
94177
+ source_events: validatedSourceEvents.sort(compareEventEnvelopes)
94178
+ };
94179
+ }
94180
+ function parseState(rawState) {
94181
+ const parsed = JSON.parse(rawState);
94182
+ if (!isRecord5(parsed) || parsed["version"] !== 1) {
94183
+ return null;
94184
+ }
94185
+ const lastProcessedEventFile = parsed["last_processed_event_file"];
94186
+ if (lastProcessedEventFile !== null && typeof lastProcessedEventFile !== "string") {
94187
+ return null;
94188
+ }
94189
+ const incidents = parsed["incidents"];
94190
+ if (!isRecord5(incidents)) {
94191
+ return null;
94192
+ }
94193
+ const parsedIncidents = {};
94194
+ for (const [incidentId, incidentValue] of Object.entries(incidents).sort(
94195
+ ([left], [right]) => left.localeCompare(right)
94196
+ )) {
94197
+ const incident = parseIncidentState(incidentValue);
94198
+ if (incident === null || incident.incident_id !== incidentId) {
94199
+ return null;
94200
+ }
94201
+ parsedIncidents[incidentId] = incident;
94202
+ }
94203
+ return {
94204
+ version: 1,
94205
+ last_processed_event_file: lastProcessedEventFile,
94206
+ incidents: parsedIncidents
94207
+ };
94208
+ }
94209
+ function compareEventEnvelopes(left, right) {
94210
+ const occurredAtComparison = left.occurred_at.localeCompare(right.occurred_at);
94211
+ if (occurredAtComparison !== 0) {
94212
+ return occurredAtComparison;
94213
+ }
94214
+ return left.event_id.localeCompare(right.event_id);
94215
+ }
94216
+
93702
94217
  // ../cli/src/process-command.ts
93703
94218
  var LOCAL_EVENTS_DIRECTORY_PATH = ".debugbundle/local/events";
93704
94219
  var LOCAL_STATE_FILE_PATH = ".debugbundle/local/state.json";
@@ -93709,10 +94224,6 @@ var CLI_SDK = {
93709
94224
  name: "debugbundle-cli",
93710
94225
  version: "0.1.0"
93711
94226
  };
93712
- var EVENT_TYPE_SET = new Set(EventTypeValues);
93713
- function isEventType(value) {
93714
- return typeof value === "string" && EVENT_TYPE_SET.has(value);
93715
- }
93716
94227
  function inferSeverity2(event, capturePreset, incidentKind = "immediate") {
93717
94228
  if (incidentKind === "request_anomaly") {
93718
94229
  return "medium";
@@ -93720,7 +94231,8 @@ function inferSeverity2(event, capturePreset, incidentKind = "immediate") {
93720
94231
  if (event.event_type === "request_event") {
93721
94232
  return classifyRequestStatus({ responseStatus: event.payload.response_status, capturePreset }) === "incident_signal" ? "high" : "low";
93722
94233
  }
93723
- if (event.event_type === "backend_exception" || event.event_type === "frontend_exception") {
94234
+ if (event.event_type === "frontend_exception") return inferFrontendExceptionSeverity(event);
94235
+ if (event.event_type === "backend_exception") {
93724
94236
  return "high";
93725
94237
  }
93726
94238
  if (event.event_type === "error_suppressed") {
@@ -93740,13 +94252,6 @@ function severityRank(severity) {
93740
94252
  return 1;
93741
94253
  }
93742
94254
  }
93743
- function compareEventEnvelopes(left, right) {
93744
- const occurredAtComparison = left.occurred_at.localeCompare(right.occurred_at);
93745
- if (occurredAtComparison !== 0) {
93746
- return occurredAtComparison;
93747
- }
93748
- return left.event_id.localeCompare(right.event_id);
93749
- }
93750
94255
  function classifyEnvelope(envelope, capturePreset) {
93751
94256
  return classifyEvent(
93752
94257
  envelope.event_type,
@@ -93838,9 +94343,9 @@ function stableJson3(value) {
93838
94343
  if (Array.isArray(value)) {
93839
94344
  return `[${value.map((entry) => stableJson3(entry)).join(",")}]`;
93840
94345
  }
93841
- const record = value;
93842
- const keys2 = Object.keys(record).sort();
93843
- return `{${keys2.map((key) => `${JSON.stringify(key)}:${stableJson3(record[key])}`).join(",")}}`;
94346
+ const record2 = value;
94347
+ const keys2 = Object.keys(record2).sort();
94348
+ return `{${keys2.map((key) => `${JSON.stringify(key)}:${stableJson3(record2[key])}`).join(",")}}`;
93844
94349
  }
93845
94350
  function buildRequestAnomalyFingerprint(input2) {
93846
94351
  return (0, import_node_crypto10.createHash)("sha256").update(
@@ -93993,144 +94498,6 @@ async function pathExists4(path, stat) {
93993
94498
  throw error;
93994
94499
  }
93995
94500
  }
93996
- function parseIncidentState(candidate) {
93997
- if (!isRecord5(candidate)) {
93998
- return null;
93999
- }
94000
- if (candidate["source"] !== "local" || candidate["status"] !== "open" && candidate["status"] !== "resolved") {
94001
- return null;
94002
- }
94003
- const sourceEvents = candidate["source_events"];
94004
- if (!Array.isArray(sourceEvents)) {
94005
- return null;
94006
- }
94007
- const validatedSourceEvents = [];
94008
- for (const sourceEvent of sourceEvents) {
94009
- const validated = validateEvent(sourceEvent);
94010
- if (!validated.success) {
94011
- return null;
94012
- }
94013
- validatedSourceEvents.push(validated.data);
94014
- }
94015
- const matchedFields = candidate["matched_fields"];
94016
- const sourceEventTypes = candidate["source_event_types"];
94017
- if (!Array.isArray(matchedFields) || !matchedFields.every((value) => typeof value === "string")) {
94018
- return null;
94019
- }
94020
- if (!Array.isArray(sourceEventTypes) || !sourceEventTypes.every(isEventType)) {
94021
- return null;
94022
- }
94023
- const severity = candidate["severity"];
94024
- if (severity !== "low" && severity !== "medium" && severity !== "high" && severity !== "critical") {
94025
- return null;
94026
- }
94027
- const status = candidate["status"];
94028
- if (status !== "open" && status !== "resolved") {
94029
- return null;
94030
- }
94031
- const requiredStringKeys = [
94032
- "incident_id",
94033
- "project_id",
94034
- "service_id",
94035
- "service_name",
94036
- "environment",
94037
- "fingerprint",
94038
- "fingerprint_version",
94039
- "title",
94040
- "first_seen_at",
94041
- "last_seen_at",
94042
- "source_event_id",
94043
- "source_occurred_at",
94044
- "bundle_path",
94045
- "reproduction_path"
94046
- ];
94047
- for (const key of requiredStringKeys) {
94048
- if (typeof candidate[key] !== "string") {
94049
- return null;
94050
- }
94051
- }
94052
- if (typeof candidate["occurrence_count"] !== "number" || typeof candidate["generation_number"] !== "number") {
94053
- return null;
94054
- }
94055
- const serviceRuntime = candidate["service_runtime"];
94056
- const serviceFramework = candidate["service_framework"];
94057
- if (serviceRuntime !== null && typeof serviceRuntime !== "string") {
94058
- return null;
94059
- }
94060
- if (serviceFramework !== null && typeof serviceFramework !== "string") {
94061
- return null;
94062
- }
94063
- const incidentId = candidate["incident_id"];
94064
- const projectId = candidate["project_id"];
94065
- const serviceId = candidate["service_id"];
94066
- const serviceName = candidate["service_name"];
94067
- const environment = candidate["environment"];
94068
- const incidentFingerprint = candidate["fingerprint"];
94069
- const fingerprintVersion = candidate["fingerprint_version"];
94070
- const title = candidate["title"];
94071
- const firstSeenAt = candidate["first_seen_at"];
94072
- const lastSeenAt = candidate["last_seen_at"];
94073
- const occurrenceCount = candidate["occurrence_count"];
94074
- const sourceEventId = candidate["source_event_id"];
94075
- const sourceOccurredAt = candidate["source_occurred_at"];
94076
- const bundlePath = candidate["bundle_path"];
94077
- const reproductionPath = candidate["reproduction_path"];
94078
- const generationNumber = candidate["generation_number"];
94079
- const normalizedSourceEventTypes = [...sourceEventTypes].sort();
94080
- return {
94081
- incident_id: incidentId,
94082
- source: "local",
94083
- project_id: projectId,
94084
- service_id: serviceId,
94085
- service_name: serviceName,
94086
- service_runtime: serviceRuntime,
94087
- service_framework: serviceFramework,
94088
- environment,
94089
- fingerprint: incidentFingerprint,
94090
- fingerprint_version: fingerprintVersion,
94091
- title,
94092
- severity,
94093
- status,
94094
- first_seen_at: firstSeenAt,
94095
- last_seen_at: lastSeenAt,
94096
- occurrence_count: occurrenceCount,
94097
- source_event_id: sourceEventId,
94098
- source_occurred_at: sourceOccurredAt,
94099
- source_event_types: normalizedSourceEventTypes,
94100
- matched_fields: [...matchedFields].sort(),
94101
- bundle_path: bundlePath,
94102
- reproduction_path: reproductionPath,
94103
- generation_number: generationNumber,
94104
- source_events: validatedSourceEvents.sort(compareEventEnvelopes)
94105
- };
94106
- }
94107
- function parseState(rawState) {
94108
- const parsed = JSON.parse(rawState);
94109
- if (!isRecord5(parsed) || parsed["version"] !== 1) {
94110
- return null;
94111
- }
94112
- const lastProcessedEventFile = parsed["last_processed_event_file"];
94113
- if (lastProcessedEventFile !== null && typeof lastProcessedEventFile !== "string") {
94114
- return null;
94115
- }
94116
- const incidents = parsed["incidents"];
94117
- if (!isRecord5(incidents)) {
94118
- return null;
94119
- }
94120
- const parsedIncidents = {};
94121
- for (const [incidentId, incidentValue] of Object.entries(incidents).sort(([left], [right]) => left.localeCompare(right))) {
94122
- const incident = parseIncidentState(incidentValue);
94123
- if (incident === null || incident.incident_id !== incidentId) {
94124
- return null;
94125
- }
94126
- parsedIncidents[incidentId] = incident;
94127
- }
94128
- return {
94129
- version: 1,
94130
- last_processed_event_file: lastProcessedEventFile,
94131
- incidents: parsedIncidents
94132
- };
94133
- }
94134
94501
  async function readState(statePath, readFile, stat) {
94135
94502
  if (!await pathExists4(statePath, stat)) {
94136
94503
  return null;
@@ -94264,7 +94631,7 @@ async function processCommand(input2, dependencies = {}) {
94264
94631
  mergedIncidentIds: /* @__PURE__ */ new Set([incidentId]),
94265
94632
  signalEventTypes: /* @__PURE__ */ new Set(),
94266
94633
  traceIds: /* @__PURE__ */ new Set(),
94267
- title: normalizedEvent.normalized_message,
94634
+ title: normalizedEvent.incident_title ?? normalizedEvent.normalized_message,
94268
94635
  kind: "immediate",
94269
94636
  severity: inferSeverity2(event, capturePreset)
94270
94637
  };
@@ -94274,7 +94641,7 @@ async function processCommand(input2, dependencies = {}) {
94274
94641
  aggregate.newEvents.push(event);
94275
94642
  aggregate.signalEventTypes.add(event.event_type);
94276
94643
  const traceId = getTraceId(event);
94277
- if (traceId !== null) {
94644
+ if (traceId !== null && normalizedEvent.resource_type === void 0) {
94278
94645
  aggregate.traceIds.add(traceId);
94279
94646
  const traceCorrelationGroup = traceCorrelationGroups.get(traceId) ?? {
94280
94647
  incidentIds: /* @__PURE__ */ new Set(),
@@ -94366,7 +94733,7 @@ async function processCommand(input2, dependencies = {}) {
94366
94733
  service_framework: latestSignalEvent.service.framework ?? existing?.service_framework ?? null,
94367
94734
  environment: aggregate.environment,
94368
94735
  fingerprint: aggregate.fingerprint,
94369
- fingerprint_version: FINGERPRINT_VERSION,
94736
+ fingerprint_version: aggregate.kind === "request_anomaly" ? FINGERPRINT_VERSION : fingerprintVersion(normalizeEvent(latestSignalEvent)),
94370
94737
  title: aggregate.title,
94371
94738
  severity,
94372
94739
  status: existingIncidents.some((incidentState) => incidentState.status === "resolved") ? "open" : existing?.status ?? "open",
@@ -99915,7 +100282,7 @@ var zodToJsonSchema = (schema, options) => {
99915
100282
  var package_default = {
99916
100283
  name: "@debugbundle/mcp",
99917
100284
  mcpName: "com.debugbundle/mcp",
99918
- version: "1.8.0",
100285
+ version: "1.8.2",
99919
100286
  private: false,
99920
100287
  description: "MCP server for runtime error reporting, incident response, health checks, debug bundles, and product analytics",
99921
100288
  license: "Apache-2.0",