glitchgrab 1.68.0 → 1.68.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.
package/dist/index.js CHANGED
@@ -224,9 +224,11 @@ var SENSITIVE_KEY_RE = /(pass|pwd|secret|token|auth|session|cookie|credential|ap
224
224
  var EMAIL_RE = /[\w.+-]+@[\w-]+\.[\w.-]+/g;
225
225
  var JWT_RE = /\beyJ[\w-]{8,}\.[\w-]{8,}\.[\w-]{8,}\b/g;
226
226
  var BEARER_RE = /\b(bearer\s+)[\w-.~+/]{12,}=*/gi;
227
+ var KEY_PREFIX_RE = /\b(?:(?:sk|rk|pk)_(?:live|test)_[A-Za-z0-9]{10,}|sk-[A-Za-z0-9_-]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|AKIA[0-9A-Z]{16}|xox[abposr]-[A-Za-z0-9-]{10,}|gg[cswi]?_[A-Za-z0-9]{20,})\b/g;
227
228
  var MAX_BODY_LENGTH = 500;
229
+ var URL_CREDENTIALS_RE = /\b([a-z][a-z0-9+.-]*:\/\/[^\s:@/]+):[^\s@/]+@/gi;
228
230
  function redactString(value) {
229
- return value.replace(JWT_RE, "[REDACTED]").replace(BEARER_RE, "$1[REDACTED]").replace(EMAIL_RE, "[REDACTED_EMAIL]");
231
+ return value.replace(URL_CREDENTIALS_RE, "$1:[REDACTED]@").replace(KEY_PREFIX_RE, "[REDACTED]").replace(JWT_RE, "[REDACTED]").replace(BEARER_RE, "$1[REDACTED]").replace(EMAIL_RE, "[REDACTED_EMAIL]");
230
232
  }
231
233
  function redactValue(value, depth) {
232
234
  if (depth > 4) return "[DEPTH]";
@@ -275,6 +277,29 @@ function mayCaptureBody(url) {
275
277
  return false;
276
278
  }
277
279
  }
280
+ var consoleObserver = null;
281
+ var requestObserver = null;
282
+ function setConsoleObserver(observer2) {
283
+ consoleObserver = observer2;
284
+ }
285
+ function setRequestObserver(observer2) {
286
+ requestObserver = observer2;
287
+ }
288
+ function isOwnOrigin(url) {
289
+ return mayCaptureBody(url);
290
+ }
291
+ function notifyConsole(level, args) {
292
+ try {
293
+ consoleObserver == null ? void 0 : consoleObserver(level, args);
294
+ } catch (e) {
295
+ }
296
+ }
297
+ function notifyRequest(request) {
298
+ try {
299
+ requestObserver == null ? void 0 : requestObserver(request);
300
+ } catch (e) {
301
+ }
302
+ }
278
303
  function initBreadcrumbs(max, options) {
279
304
  var _a;
280
305
  if ((_a = options == null ? void 0 : options.responseBodyOrigins) == null ? void 0 : _a.length) {
@@ -326,10 +351,12 @@ function interceptConsole() {
326
351
  console.warn = function(...args) {
327
352
  addBreadcrumb("console", `[warn] ${argsToString(args)}`);
328
353
  origWarn.apply(console, args);
354
+ notifyConsole("warn", args);
329
355
  };
330
356
  console.error = function(...args) {
331
357
  addBreadcrumb("console", `[error] ${argsToString(args)}`);
332
358
  origError.apply(console, args);
359
+ notifyConsole("error", args);
333
360
  };
334
361
  }
335
362
  var CONSOLE_TEXT_MAX = 200;
@@ -425,7 +452,7 @@ function interceptFetch() {
425
452
  window.fetch = async function(input, init) {
426
453
  var _a;
427
454
  const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input instanceof Request ? input.url : String(input);
428
- const method = (_a = init == null ? void 0 : init.method) != null ? _a : "GET";
455
+ const method = ((_a = init == null ? void 0 : init.method) != null ? _a : input instanceof Request ? input.method : "GET").toUpperCase();
429
456
  const start = Date.now();
430
457
  try {
431
458
  const response = await origFetch(
@@ -439,6 +466,7 @@ function interceptFetch() {
439
466
  duration: `${Date.now() - start}ms`,
440
467
  ...body ? { responseBody: body } : {}
441
468
  });
469
+ notifyRequest({ method, url, status: response.status, durationMs: Date.now() - start });
442
470
  return response;
443
471
  } catch (err) {
444
472
  addBreadcrumb("api", `${method} ${url.slice(0, 100)} \u2192 FAILED`, {
@@ -459,7 +487,7 @@ function interceptXhr() {
459
487
  this.__ggMethod = method;
460
488
  this.__ggUrl = typeof url === "string" ? url : url.toString();
461
489
  const record = () => {
462
- var _a, _b, _c, _d;
490
+ var _a, _b, _c, _d, _e, _f;
463
491
  try {
464
492
  const recordedMethod = (_a = this.__ggMethod) != null ? _a : "GET";
465
493
  const recordedUrl = ((_b = this.__ggUrl) != null ? _b : "").slice(0, 100);
@@ -471,8 +499,14 @@ function interceptXhr() {
471
499
  });
472
500
  return;
473
501
  }
502
+ notifyRequest({
503
+ method: recordedMethod,
504
+ url: (_d = this.__ggUrl) != null ? _d : "",
505
+ status: this.status,
506
+ durationMs: Date.now() - ((_e = this.__ggStart) != null ? _e : Date.now())
507
+ });
474
508
  const failed = this.status < 200 || this.status >= 300;
475
- const body = failed && mayCaptureBody((_d = this.__ggUrl) != null ? _d : "") ? readXhrBody(this) : "";
509
+ const body = failed && mayCaptureBody((_f = this.__ggUrl) != null ? _f : "") ? readXhrBody(this) : "";
476
510
  addBreadcrumb("api", `${recordedMethod} ${recordedUrl} \u2192 ${this.status}`, {
477
511
  method: recordedMethod,
478
512
  status: String(this.status),
@@ -1370,6 +1404,23 @@ var config = null;
1370
1404
  function registerCaptureConfig(next) {
1371
1405
  config = next;
1372
1406
  }
1407
+ function getCaptureConfig() {
1408
+ return config;
1409
+ }
1410
+ var reportedErrors = /* @__PURE__ */ new WeakSet();
1411
+ function markErrorReported(error) {
1412
+ try {
1413
+ if (error && typeof error === "object") reportedErrors.add(error);
1414
+ } catch (e) {
1415
+ }
1416
+ }
1417
+ function wasErrorReported(error) {
1418
+ try {
1419
+ return !!error && typeof error === "object" && reportedErrors.has(error);
1420
+ } catch (e) {
1421
+ return false;
1422
+ }
1423
+ }
1373
1424
  function matchesIgnorePatterns(message, patterns) {
1374
1425
  if (!patterns || patterns.length === 0) return false;
1375
1426
  return patterns.some(
@@ -1390,6 +1441,7 @@ function buildCapturedErrorPayload(error, options, cfg, capturedBy = "captureErr
1390
1441
  const errorMessage = err ? err.message : String(error);
1391
1442
  if (!errorMessage) return null;
1392
1443
  if (matchesIgnorePatterns(errorMessage, cfg.ignoreErrors)) return null;
1444
+ markErrorReported(error);
1393
1445
  incrementErrorCount();
1394
1446
  const context = captureContext(cfg.getVisitedPages());
1395
1447
  const digest = (_a = options == null ? void 0 : options.digest) != null ? _a : typeof (error == null ? void 0 : error.digest) === "string" ? error.digest : void 0;
@@ -2044,18 +2096,6 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
2044
2096
  }
2045
2097
  );
2046
2098
  }
2047
- var SEVERITY_LEVELS = [
2048
- "low",
2049
- "medium",
2050
- "high",
2051
- "critical"
2052
- ];
2053
- var SEVERITY_LABELS = {
2054
- low: "Low",
2055
- medium: "Medium",
2056
- high: "High",
2057
- critical: "Critical"
2058
- };
2059
2099
  var MAX_ASSIST_IMAGES = 3;
2060
2100
  var MAX_ASSIST_IMAGE_CHARS = 35e5;
2061
2101
  var MAX_ASSIST_FILES = 3;
@@ -2832,11 +2872,7 @@ function AssistSheet({
2832
2872
  onDescriptionChange,
2833
2873
  issueTitle,
2834
2874
  onIssueTitleChange,
2835
- severity,
2836
- onSeverityChange,
2837
- showSeverity,
2838
2875
  validationError,
2839
- severityRefused = false,
2840
2876
  onDuplicateChange,
2841
2877
  onConversationChange,
2842
2878
  isSubmitting,
@@ -2852,7 +2888,6 @@ function AssistSheet({
2852
2888
  }) {
2853
2889
  var _a;
2854
2890
  const narrow = useIsNarrow();
2855
- const severityAsked = showSeverity && currentTile === "BUG";
2856
2891
  const [messages, setMessages] = (0, import_react3.useState)([]);
2857
2892
  const [input, setInput] = (0, import_react3.useState)("");
2858
2893
  const [busy, setBusy] = (0, import_react3.useState)(false);
@@ -2878,15 +2913,13 @@ function AssistSheet({
2878
2913
  const [duplicate, setDuplicate] = (0, import_react3.useState)(null);
2879
2914
  const [glitchgrabOffer, setGlitchgrabOffer] = (0, import_react3.useState)(false);
2880
2915
  const [solved, setSolved] = (0, import_react3.useState)(null);
2881
- const needsSeverity = (tile) => showSeverity && tile === "BUG" && !severity;
2882
2916
  const [phase, setPhase] = (0, import_react3.useState)(
2883
- () => !typePicked ? "type" : currentTile === "RATING" ? "rating" : needsSeverity(currentTile) ? "severity" : "chat"
2917
+ () => !typePicked ? "type" : currentTile === "RATING" ? "rating" : "chat"
2884
2918
  );
2885
2919
  const scrollRef = (0, import_react3.useRef)(null);
2886
2920
  const draftRef = (0, import_react3.useRef)(null);
2887
2921
  const composerRef = (0, import_react3.useRef)(null);
2888
2922
  const seededRef = (0, import_react3.useRef)(false);
2889
- const seedPendingRef = (0, import_react3.useRef)(false);
2890
2923
  const resumeAskRef = (0, import_react3.useRef)(false);
2891
2924
  const eventsRef = (0, import_react3.useRef)([]);
2892
2925
  const inferredTypeRef = (0, import_react3.useRef)(false);
@@ -3154,10 +3187,6 @@ function AssistSheet({
3154
3187
  }
3155
3188
  return;
3156
3189
  }
3157
- if (phase === "severity") {
3158
- seedPendingRef.current = true;
3159
- return;
3160
- }
3161
3190
  seedFromDescription();
3162
3191
  }, []);
3163
3192
  function seedFromDescription() {
@@ -3167,15 +3196,7 @@ function AssistSheet({
3167
3196
  setMessages(history2);
3168
3197
  void runTurn(history2);
3169
3198
  }
3170
- function answerSeverity(value) {
3171
- onSeverityChange(value);
3172
- setPhase("chat");
3173
- if (seedPendingRef.current) {
3174
- seedPendingRef.current = false;
3175
- seedFromDescription();
3176
- }
3177
- }
3178
- function send(text) {
3199
+ function send2(text) {
3179
3200
  const value = text.trim();
3180
3201
  if (!value || busy) return;
3181
3202
  setStalled(null);
@@ -3267,7 +3288,6 @@ function AssistSheet({
3267
3288
  setShowChats(false);
3268
3289
  setViewingChat(null);
3269
3290
  resumeAskRef.current = (last == null ? void 0 : last.role) === "user";
3270
- seedPendingRef.current = false;
3271
3291
  }
3272
3292
  (0, import_react3.useEffect)(() => {
3273
3293
  if (!resumeAskRef.current) return;
@@ -3655,7 +3675,6 @@ function AssistSheet({
3655
3675
  ),
3656
3676
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { fontSize: "11.5px", color: t.textMuted, marginTop: "3px" }, children: [
3657
3677
  phase === "type" || !typePicked || inferredTypeRef.current && phase !== "draft" ? null : reportTypeLabel,
3658
- phase !== "type" && severityAsked && severity ? ` \xB7 ${SEVERITY_LABELS[severity]}` : null,
3659
3678
  projectSlot ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { marginLeft: "6px" }, children: projectSlot }) : null
3660
3679
  ] })
3661
3680
  ] }),
@@ -3766,63 +3785,6 @@ function AssistSheet({
3766
3785
  minWidth: 0
3767
3786
  },
3768
3787
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: showChats ? "none" : "contents" }, children: [
3769
- phase === "severity" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
3770
- resumeCard,
3771
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3772
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Avatar, { who: "assistant", theme: t }),
3773
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3774
- "div",
3775
- {
3776
- style: {
3777
- padding: "9px 12px",
3778
- borderRadius: "12px 12px 12px 4px",
3779
- backgroundColor: t.bgSecondary,
3780
- fontSize: "13px",
3781
- lineHeight: 1.55,
3782
- maxWidth: "88%"
3783
- },
3784
- children: "How bad is it?"
3785
- }
3786
- )
3787
- ] }),
3788
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3789
- "div",
3790
- {
3791
- role: "radiogroup",
3792
- "aria-label": "Severity",
3793
- style: {
3794
- display: "flex",
3795
- flexWrap: "wrap",
3796
- gap: "6px",
3797
- paddingLeft: "32px"
3798
- },
3799
- children: SEVERITY_LEVELS.map((s) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3800
- "button",
3801
- {
3802
- type: "button",
3803
- role: "radio",
3804
- "aria-checked": severity === s,
3805
- "data-gg-chip": "",
3806
- "data-gg-severity": s,
3807
- onClick: () => answerSeverity(s),
3808
- style: {
3809
- border: `1px solid ${t.inputBorder}`,
3810
- background: "transparent",
3811
- color: t.textMuted,
3812
- borderRadius: "999px",
3813
- // Same as the picker and option chips — one chip size.
3814
- padding: "8px 12px",
3815
- fontSize: "12px",
3816
- fontFamily: "inherit",
3817
- cursor: "pointer"
3818
- },
3819
- children: SEVERITY_LABELS[s]
3820
- },
3821
- s
3822
- ))
3823
- }
3824
- )
3825
- ] }),
3826
3788
  phase === "rating" && !submitted && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
3827
3789
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3828
3790
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Avatar, { who: "assistant", theme: t }),
@@ -3979,7 +3941,7 @@ function AssistSheet({
3979
3941
  "data-gg-chip": "",
3980
3942
  onClick: () => {
3981
3943
  logEvent("starter_tap", s);
3982
- send(s);
3944
+ send2(s);
3983
3945
  },
3984
3946
  style: {
3985
3947
  border: `1px solid ${t.inputBorder}`,
@@ -4146,7 +4108,7 @@ function AssistSheet({
4146
4108
  "data-gg-glitchgrab-offer-no": "",
4147
4109
  onClick: () => {
4148
4110
  logEvent("glitchgrab_offer_declined");
4149
- send("No \u2014 it's about this app, not the reporting tool");
4111
+ send2("No \u2014 it's about this app, not the reporting tool");
4150
4112
  },
4151
4113
  style: {
4152
4114
  padding: "8px 12px",
@@ -4191,7 +4153,7 @@ function AssistSheet({
4191
4153
  "data-gg-option": "",
4192
4154
  onClick: () => {
4193
4155
  logEvent("option_tap", option);
4194
- send(option);
4156
+ send2(option);
4195
4157
  },
4196
4158
  style: {
4197
4159
  border: primary ? "1px solid transparent" : `1px solid ${t.inputBorder}`,
@@ -4425,71 +4387,6 @@ function AssistSheet({
4425
4387
  }
4426
4388
  }
4427
4389
  ),
4428
- severityAsked && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
4429
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4430
- "span",
4431
- {
4432
- style: {
4433
- fontSize: "11.5px",
4434
- color: t.textMuted,
4435
- display: "block",
4436
- marginBottom: "6px"
4437
- },
4438
- children: [
4439
- "How bad is it?",
4440
- !severity && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4441
- "span",
4442
- {
4443
- style: {
4444
- marginLeft: "6px",
4445
- fontSize: "11px",
4446
- color: severityRefused ? "#ef4444" : t.textMuted
4447
- },
4448
- children: "\xB7 required"
4449
- }
4450
- )
4451
- ]
4452
- }
4453
- ),
4454
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4455
- "div",
4456
- {
4457
- role: "radiogroup",
4458
- "aria-label": "Severity",
4459
- style: { display: "flex", gap: "6px" },
4460
- children: SEVERITY_LEVELS.map((s) => {
4461
- const on = severity === s;
4462
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4463
- "button",
4464
- {
4465
- type: "button",
4466
- onClick: () => onSeverityChange(s),
4467
- role: "radio",
4468
- "aria-checked": on,
4469
- style: {
4470
- flex: 1,
4471
- minWidth: 0,
4472
- padding: "8px 2px",
4473
- borderRadius: "8px",
4474
- border: `1px solid ${on ? t.accent : severityRefused ? "#ef4444" : t.inputBorder}`,
4475
- backgroundColor: on ? t.accent : "transparent",
4476
- color: on ? t.accentText : t.textMuted,
4477
- fontSize: "12px",
4478
- fontWeight: 600,
4479
- fontFamily: "inherit",
4480
- whiteSpace: "nowrap",
4481
- overflow: "hidden",
4482
- textOverflow: "ellipsis",
4483
- cursor: "pointer"
4484
- },
4485
- children: SEVERITY_LABELS[s]
4486
- },
4487
- s
4488
- );
4489
- })
4490
- }
4491
- )
4492
- ] }),
4493
4390
  attachmentCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { fontSize: "11.5px", color: t.textMuted }, children: [
4494
4391
  attachmentCount,
4495
4392
  " ",
@@ -4545,7 +4442,7 @@ function AssistSheet({
4545
4442
  ]
4546
4443
  }
4547
4444
  ),
4548
- !submitted && !showChats && phase !== "severity" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4445
+ !submitted && !showChats && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4549
4446
  "div",
4550
4447
  {
4551
4448
  style: {
@@ -4959,7 +4856,7 @@ function AssistSheet({
4959
4856
  onKeyDown: (e) => {
4960
4857
  if (e.key === "Enter" && !e.shiftKey) {
4961
4858
  e.preventDefault();
4962
- send(input);
4859
+ send2(input);
4963
4860
  }
4964
4861
  },
4965
4862
  placeholder: phase === "draft" ? "Anything to change? Tell me here\u2026" : phase === "type" ? "What went wrong, or what would you like? Type it here\u2026" : "Type your answer\u2026",
@@ -4989,7 +4886,7 @@ function AssistSheet({
4989
4886
  {
4990
4887
  type: "button",
4991
4888
  "data-gg-sheet-send": "",
4992
- onClick: () => send(input),
4889
+ onClick: () => send2(input),
4993
4890
  disabled: busy || !input.trim(),
4994
4891
  "aria-label": "Send message",
4995
4892
  "data-gg-send-message": "",
@@ -5124,7 +5021,7 @@ function describeSentAlong(hasChat, screenshotCount) {
5124
5021
  return `${parts.slice(0, -1).join(", ")} and ${parts[parts.length - 1]}`;
5125
5022
  }
5126
5023
  function GlitchgrabProblemPanel({
5127
- send,
5024
+ send: send2,
5128
5025
  theme: t,
5129
5026
  surface,
5130
5027
  conversationId,
@@ -5195,7 +5092,7 @@ function GlitchgrabProblemPanel({
5195
5092
  setBusy(true);
5196
5093
  setError(null);
5197
5094
  try {
5198
- const result = await send({
5095
+ const result = await send2({
5199
5096
  description,
5200
5097
  surface,
5201
5098
  conversationId,
@@ -5806,7 +5703,6 @@ function detectHostAccent() {
5806
5703
  return null;
5807
5704
  }
5808
5705
  }
5809
- var SEVERITY_REQUIRED = "Pick how bad it is before sending.";
5810
5706
  var SHOT_WAIT_MS = 3e3;
5811
5707
  var SIMILAR_WAIT_MS = 2500;
5812
5708
  var MAX_SIMILAR_SHOWN = 3;
@@ -6037,7 +5933,6 @@ function ReportDialog({
6037
5933
  assistContext = null,
6038
5934
  transcribeAudio: transcribeAudio2,
6039
5935
  types,
6040
- showSeverity = true,
6041
5936
  captureScreenshot = captureDefaultScreenshot,
6042
5937
  reporter: reporter2,
6043
5938
  onClose,
@@ -6164,14 +6059,12 @@ function ReportDialog({
6164
6059
  }, [isOpen]);
6165
6060
  const [step, setStep] = (0, import_react.useState)(1);
6166
6061
  const [reportType, setReportType] = (0, import_react.useState)("BUG");
6167
- const [severity, setSeverity] = (0, import_react.useState)(null);
6168
6062
  const [validationError, setValidationError] = (0, import_react.useState)(null);
6169
6063
  const [placeholderIdx, setPlaceholderIdx] = (0, import_react.useState)(0);
6170
6064
  const [rating, setRating] = (0, import_react.useState)(0);
6171
6065
  const [hoveredStar, setHoveredStar] = (0, import_react.useState)(0);
6172
6066
  const isRating = reportType === "RATING";
6173
6067
  const submitDisabled = isSubmitting || (isRating ? rating < 1 : !description.trim());
6174
- const needsSeverity = validationError === SEVERITY_REQUIRED && showSeverity && reportType === "BUG" && !severity;
6175
6068
  const availableTypes = types != null ? types : [
6176
6069
  "BUG",
6177
6070
  "FEATURE_REQUEST",
@@ -6516,7 +6409,6 @@ function ReportDialog({
6516
6409
  setPickedSimilar(null);
6517
6410
  setCheckingSimilar(false);
6518
6411
  setAttachingTo(null);
6519
- setSeverity(null);
6520
6412
  setValidationError(null);
6521
6413
  setSelfReportFrom(null);
6522
6414
  setVoiceError(null);
@@ -6742,11 +6634,6 @@ function ReportDialog({
6742
6634
  setStep(2);
6743
6635
  return;
6744
6636
  }
6745
- if (showSeverity && reportType === "BUG" && !severity) {
6746
- setValidationError(SEVERITY_REQUIRED);
6747
- setStep(2);
6748
- return;
6749
- }
6750
6637
  const duplicateOf = (_a2 = opts == null ? void 0 : opts.duplicateOf) != null ? _a2 : duplicateIssueNumber;
6751
6638
  const attachKind = (opts == null ? void 0 : opts.duplicateOf) ? (_b = opts.kind) != null ? _b : "duplicate" : duplicateKind;
6752
6639
  if (findSimilarIssues2 && !(opts == null ? void 0 : opts.skipSimilar) && !duplicateOf) {
@@ -6787,9 +6674,6 @@ function ReportDialog({
6787
6674
  const metadata = {};
6788
6675
  if (shots.length > 0) metadata.screenshots = JSON.stringify(shots);
6789
6676
  if (attachments.length > 0) metadata.attachments = JSON.stringify(attachments);
6790
- if (showSeverity && reportType === "BUG" && severity) {
6791
- metadata.severity = severity;
6792
- }
6793
6677
  if (duplicateOf) {
6794
6678
  metadata.duplicateIssueNumber = String(duplicateOf);
6795
6679
  if (attachKind === "related") metadata.duplicateKind = "related";
@@ -8555,82 +8439,6 @@ function ReportDialog({
8555
8439
  }
8556
8440
  )
8557
8441
  ] }),
8558
- showSeverity && reportType === "BUG" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginTop: "10px" }, children: [
8559
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
8560
- "span",
8561
- {
8562
- style: {
8563
- fontSize: "12px",
8564
- color: t.textMuted,
8565
- marginBottom: "6px",
8566
- display: "flex",
8567
- alignItems: "center",
8568
- gap: "6px"
8569
- },
8570
- children: [
8571
- "How bad is it?",
8572
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
8573
- "span",
8574
- {
8575
- style: {
8576
- color: severity ? t.textMuted : needsSeverity ? "#ef4444" : t.textMuted,
8577
- fontSize: "11px"
8578
- },
8579
- children: severity ? "" : "\xB7 required"
8580
- }
8581
- )
8582
- ]
8583
- }
8584
- ),
8585
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
8586
- "div",
8587
- {
8588
- role: "radiogroup",
8589
- "aria-label": "Severity",
8590
- style: { display: "flex", gap: "6px" },
8591
- children: SEVERITY_LEVELS.map((s) => {
8592
- const on = severity === s;
8593
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
8594
- "button",
8595
- {
8596
- type: "button",
8597
- role: "radio",
8598
- "aria-checked": on,
8599
- onClick: () => {
8600
- setSeverity(s);
8601
- if (validationError)
8602
- setValidationError(null);
8603
- },
8604
- style: {
8605
- flex: 1,
8606
- minWidth: 0,
8607
- // 9px + 12px line + borders clears a 36px
8608
- // tap target; 6px left it at ~29px.
8609
- padding: "9px 2px",
8610
- borderRadius: "6px",
8611
- border: `1px solid ${on ? t.accent : needsSeverity ? "#ef4444" : t.inputBorder}`,
8612
- background: on ? t.accent : "transparent",
8613
- color: on ? t.accentText : t.text,
8614
- fontSize: "12px",
8615
- fontWeight: 600,
8616
- cursor: "pointer",
8617
- fontFamily: "inherit",
8618
- whiteSpace: "nowrap",
8619
- // Four labels where there were three: clip
8620
- // rather than spill if a host squeezes the
8621
- // dialog below ~260px.
8622
- overflow: "hidden",
8623
- textOverflow: "ellipsis",
8624
- transition: "all 0.15s ease"
8625
- },
8626
- children: SEVERITY_LABELS[s]
8627
- },
8628
- s
8629
- );
8630
- })
8631
- }
8632
- )
8633
- ] }),
8634
8442
  validationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
8635
8443
  "p",
8636
8444
  {
@@ -8981,14 +8789,6 @@ function ReportDialog({
8981
8789
  },
8982
8790
  issueTitle,
8983
8791
  onIssueTitleChange: setIssueTitle,
8984
- severity,
8985
- onSeverityChange: (value) => {
8986
- setSeverity(value);
8987
- if (validationError) setValidationError(null);
8988
- },
8989
- showSeverity,
8990
- validationError,
8991
- severityRefused: needsSeverity,
8992
8792
  isSubmitting,
8993
8793
  submitted,
8994
8794
  onSend: () => void handleSubmit(),
@@ -10821,6 +10621,174 @@ function describeRejection(reason) {
10821
10621
  }
10822
10622
  }
10823
10623
 
10624
+ // src/auto-signals.ts
10625
+ var DEFAULT_CAPTURE_CONSOLE = ["error", "warn"];
10626
+ var DEFAULT_SLOW_REQUEST_MS = 1e4;
10627
+ var CONSOLE_MESSAGE_MAX = 500;
10628
+ var ERROR_ARG_DELAY_MS = 1e3;
10629
+ var CONSOLE_NOISE = [
10630
+ /^\[glitchgrab\]/i,
10631
+ /ResizeObserver loop/i,
10632
+ /\b(?:chrome|safari|moz)-extension:\/\//,
10633
+ /Download the React DevTools/i
10634
+ ];
10635
+ var filing = false;
10636
+ var MAX_SIGNALS_PER_PAGE = 10;
10637
+ var sentThisPage = 0;
10638
+ function firstError(args) {
10639
+ return args.find((a) => a instanceof Error);
10640
+ }
10641
+ function routeOf(url) {
10642
+ var _a;
10643
+ try {
10644
+ const base = typeof window !== "undefined" ? window.location.href : "http://localhost";
10645
+ const { pathname } = new URL(url, base);
10646
+ return pathname.split("/").map(
10647
+ (part) => /^\d+$/.test(part) || /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(part) || /^c[a-z0-9]{20,}$/.test(part) || /^[0-9a-f]{24}$/i.test(part) ? "[id]" : part
10648
+ ).join("/") || "/";
10649
+ } catch (e) {
10650
+ return (_a = url.split("?")[0]) != null ? _a : url;
10651
+ }
10652
+ }
10653
+ function send(payload, baseUrl) {
10654
+ const cfg = getCaptureConfig();
10655
+ if (sentThisPage >= MAX_SIGNALS_PER_PAGE) return;
10656
+ sentThisPage += 1;
10657
+ filing = true;
10658
+ try {
10659
+ void sendReport(payload, baseUrl).then((result) => {
10660
+ if (result && (cfg == null ? void 0 : cfg.onReportSent)) cfg.onReportSent(result);
10661
+ });
10662
+ } finally {
10663
+ filing = false;
10664
+ }
10665
+ }
10666
+ function fileConsole(level, args) {
10667
+ var _a;
10668
+ try {
10669
+ const cfg = getCaptureConfig();
10670
+ if (!(cfg == null ? void 0 : cfg.token)) return;
10671
+ const err = firstError(args);
10672
+ if (err && wasErrorReported(err)) return;
10673
+ const text = redactString(
10674
+ (err && args.length === 1 ? err.message : argsToString(args)).slice(0, CONSOLE_MESSAGE_MAX)
10675
+ );
10676
+ if (!text.trim()) return;
10677
+ if (CONSOLE_NOISE.some((re) => re.test(text))) return;
10678
+ if (matchesIgnorePatterns(text, cfg.ignoreErrors)) return;
10679
+ const errorMessage = `console.${level}: ${text}`;
10680
+ const errorStack = (err == null ? void 0 : err.stack) ? redactString(err.stack) : void 0;
10681
+ const context = captureContext(cfg.getVisitedPages());
10682
+ const sig = computeSignature({ errorMessage, pageUrl: context.url, errorStack });
10683
+ if (shouldSkipDuplicate(sig)) return;
10684
+ send(
10685
+ {
10686
+ token: cfg.token,
10687
+ source: "SDK_AUTO",
10688
+ type: "BUG",
10689
+ errorMessage,
10690
+ errorStack,
10691
+ pageUrl: context.url,
10692
+ userAgent: context.userAgent,
10693
+ breadcrumbs: context.breadcrumbs,
10694
+ deviceInfo: (_a = context.deviceInfo) != null ? _a : void 0,
10695
+ metadata: {
10696
+ timestamp: context.timestamp,
10697
+ visitedPages: JSON.stringify(context.visitedPages),
10698
+ capturedBy: `console.${level}`,
10699
+ autoKind: "console",
10700
+ consoleLevel: level,
10701
+ ...contextMetadata(context),
10702
+ ...originMetadata(err == null ? void 0 : err.stack),
10703
+ ...sessionMetadata2(cfg.session)
10704
+ }
10705
+ },
10706
+ cfg.baseUrl
10707
+ );
10708
+ } catch (e) {
10709
+ }
10710
+ }
10711
+ function fileSlowRequest(request, thresholdMs) {
10712
+ var _a, _b;
10713
+ try {
10714
+ const cfg = getCaptureConfig();
10715
+ if (!(cfg == null ? void 0 : cfg.token)) return;
10716
+ if (request.durationMs < thresholdMs) return;
10717
+ if (!isOwnOrigin(request.url)) return;
10718
+ const own = (_a = cfg.baseUrl) != null ? _a : DEFAULT_BASE_URL;
10719
+ if (request.url.startsWith(own) || request.url.includes("/api/v1/sdk/")) return;
10720
+ const method = request.method.toUpperCase();
10721
+ const route = routeOf(request.url);
10722
+ const errorMessage = `Slow request: ${method} ${route}`;
10723
+ if (matchesIgnorePatterns(errorMessage, cfg.ignoreErrors)) return;
10724
+ const context = captureContext(cfg.getVisitedPages());
10725
+ const sig = computeSignature({ errorMessage, pageUrl: context.url });
10726
+ if (shouldSkipDuplicate(sig)) return;
10727
+ const seconds = (request.durationMs / 1e3).toFixed(1);
10728
+ send(
10729
+ {
10730
+ token: cfg.token,
10731
+ source: "SDK_AUTO",
10732
+ type: "PERFORMANCE",
10733
+ errorMessage,
10734
+ description: `${method} ${route} took ${seconds}s (threshold ${(thresholdMs / 1e3).toFixed(1)}s)${request.status ? `, answered ${request.status}` : ", never completed"}.`,
10735
+ pageUrl: context.url,
10736
+ userAgent: context.userAgent,
10737
+ breadcrumbs: context.breadcrumbs,
10738
+ deviceInfo: (_b = context.deviceInfo) != null ? _b : void 0,
10739
+ metadata: {
10740
+ timestamp: context.timestamp,
10741
+ visitedPages: JSON.stringify(context.visitedPages),
10742
+ capturedBy: "slowRequestMs",
10743
+ autoKind: "slow-request",
10744
+ requestMethod: method,
10745
+ requestRoute: route,
10746
+ durationMs: String(request.durationMs),
10747
+ thresholdMs: String(thresholdMs),
10748
+ ...request.status ? { status: String(request.status) } : {},
10749
+ ...contextMetadata(context),
10750
+ ...sessionMetadata2(cfg.session)
10751
+ }
10752
+ },
10753
+ cfg.baseUrl
10754
+ );
10755
+ } catch (e) {
10756
+ }
10757
+ }
10758
+ function sessionMetadata2(session) {
10759
+ return {
10760
+ ...(session == null ? void 0 : session.userId) ? { sessionUserId: session.userId } : {},
10761
+ ...(session == null ? void 0 : session.name) ? { sessionUserName: String(session.name) } : {},
10762
+ ...(session == null ? void 0 : session.email) ? { sessionUserEmail: String(session.email) } : {},
10763
+ ...(session == null ? void 0 : session.phone) ? { sessionUserPhone: String(session.phone) } : {}
10764
+ };
10765
+ }
10766
+ function installAutoSignals(options) {
10767
+ var _a;
10768
+ try {
10769
+ const levels = new Set((_a = options.captureConsole) != null ? _a : []);
10770
+ const slowMs = options.slowRequestMs && options.slowRequestMs > 0 ? options.slowRequestMs : 0;
10771
+ setConsoleObserver(
10772
+ levels.size ? (level, args) => {
10773
+ if (filing || !levels.has(level)) return;
10774
+ if (firstError(args)) {
10775
+ setTimeout(() => fileConsole(level, args), ERROR_ARG_DELAY_MS);
10776
+ } else {
10777
+ fileConsole(level, args);
10778
+ }
10779
+ } : null
10780
+ );
10781
+ setRequestObserver(slowMs ? (request) => fileSlowRequest(request, slowMs) : null);
10782
+ return () => {
10783
+ setConsoleObserver(null);
10784
+ setRequestObserver(null);
10785
+ };
10786
+ } catch (e) {
10787
+ return () => {
10788
+ };
10789
+ }
10790
+ }
10791
+
10824
10792
  // src/shortcut.ts
10825
10793
  var GLITCHGRAB_SHORTCUT2 = "Ctrl+Shift+G";
10826
10794
  var GLITCHGRAB_SHORTCUT_MAC2 = "\u2318\u21E7G";
@@ -10861,11 +10829,12 @@ function GlitchgrabProviderInner({
10861
10829
  children,
10862
10830
  fallback,
10863
10831
  types,
10864
- showSeverity,
10865
10832
  ignoreErrors,
10866
10833
  release: release2,
10867
10834
  context: appContext2,
10868
- responseBodyOrigins: responseBodyOrigins2
10835
+ responseBodyOrigins: responseBodyOrigins2,
10836
+ captureConsole = DEFAULT_CAPTURE_CONSOLE,
10837
+ slowRequestMs = DEFAULT_SLOW_REQUEST_MS
10869
10838
  }) {
10870
10839
  const visitedPagesRef = (0, import_react6.useRef)([]);
10871
10840
  const sessionKey = sessionProp ? [
@@ -10896,6 +10865,16 @@ function GlitchgrabProviderInner({
10896
10865
  initBreadcrumbs(maxBreadcrumbs2, { responseBodyOrigins: responseBodyOrigins2 });
10897
10866
  }
10898
10867
  }, [enableBreadcrumbs, maxBreadcrumbs2, responseBodyOrigins2 == null ? void 0 : responseBodyOrigins2.join(",")]);
10868
+ const captureConsoleKey = captureConsole ? captureConsole.join(",") : "";
10869
+ (0, import_react6.useEffect)(() => {
10870
+ if (!enableBreadcrumbs) return;
10871
+ if (process.env.NODE_ENV === "development") return;
10872
+ if (!captureConsoleKey && !slowRequestMs) return;
10873
+ return installAutoSignals({
10874
+ captureConsole: captureConsoleKey ? captureConsoleKey.split(",") : [],
10875
+ slowRequestMs
10876
+ });
10877
+ }, [enableBreadcrumbs, captureConsoleKey, slowRequestMs]);
10899
10878
  (0, import_react6.useEffect)(() => {
10900
10879
  try {
10901
10880
  if (typeof window === "undefined") return;
@@ -10962,6 +10941,7 @@ function GlitchgrabProviderInner({
10962
10941
  return;
10963
10942
  }
10964
10943
  if (isHandledHydrationError(event.error)) return;
10944
+ markErrorReported(event.error);
10965
10945
  incrementErrorCount();
10966
10946
  const context = captureContext(visitedPagesRef.current);
10967
10947
  const sig = computeSignature({
@@ -11019,6 +10999,7 @@ function GlitchgrabProviderInner({
11019
10999
  }
11020
11000
  if (errStack && EXTENSION_ORIGIN_RE.test(errStack)) return;
11021
11001
  if (isUnactionableRejection(description)) return;
11002
+ markErrorReported(reason);
11022
11003
  incrementErrorCount();
11023
11004
  const context = captureContext(visitedPagesRef.current);
11024
11005
  const sig = computeSignature({
@@ -11422,7 +11403,6 @@ function GlitchgrabProviderInner({
11422
11403
  reportGlitchgrabProblem: glitchgrabReport ? reportGlitchgrabProblem : void 0,
11423
11404
  transcribeAudio: aiBlockedUnsigned ? void 0 : transcribe,
11424
11405
  types,
11425
- showSeverity,
11426
11406
  reporter: reporter2,
11427
11407
  chatHistoryKey: chatHistoryKey("sdk", token, session == null ? void 0 : session.userId),
11428
11408
  headerSlot: projectName ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { fontSize: 11, color: "#9aa0a6" }, children: [