glitchgrab 1.46.0 → 1.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -747,7 +747,7 @@ async function findSimilarIssues(description, token, baseUrl, identity) {
747
747
  }
748
748
  }
749
749
  async function assistTurn(params, token, baseUrl) {
750
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
750
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
751
751
  const offline = {
752
752
  conversationId: null,
753
753
  question: null,
@@ -781,8 +781,9 @@ async function assistTurn(params, token, baseUrl) {
781
781
  options: (_g = (_f = envelope.data) == null ? void 0 : _f.options) != null ? _g : [],
782
782
  report: (_i = (_h = envelope.data) == null ? void 0 : _h.report) != null ? _i : null,
783
783
  duplicate: (_k = (_j = envelope.data) == null ? void 0 : _j.duplicate) != null ? _k : null,
784
- solved: (_m = (_l = envelope.data) == null ? void 0 : _l.solved) != null ? _m : null,
785
- aboutGlitchgrab: ((_n = envelope.data) == null ? void 0 : _n.aboutGlitchgrab) === true,
784
+ related: (_m = (_l = envelope.data) == null ? void 0 : _l.related) != null ? _m : null,
785
+ solved: (_o = (_n = envelope.data) == null ? void 0 : _n.solved) != null ? _o : null,
786
+ aboutGlitchgrab: ((_p = envelope.data) == null ? void 0 : _p.aboutGlitchgrab) === true,
786
787
  degraded: null
787
788
  };
788
789
  } catch (e) {
@@ -1639,7 +1640,7 @@ function AssistSheet({
1639
1640
  onDegrade(message, retryable);
1640
1641
  }
1641
1642
  async function runTurn(history2) {
1642
- var _a, _b, _c, _d;
1643
+ var _a, _b;
1643
1644
  setBusy(true);
1644
1645
  let result;
1645
1646
  const events = takeEvents();
@@ -1683,8 +1684,9 @@ function AssistSheet({
1683
1684
  setConversationId(result.conversationId);
1684
1685
  onConversationChange == null ? void 0 : onConversationChange(result.conversationId);
1685
1686
  }
1686
- setDuplicate((_a = result.duplicate) != null ? _a : null);
1687
- onDuplicateChange == null ? void 0 : onDuplicateChange((_c = (_b = result.duplicate) == null ? void 0 : _b.number) != null ? _c : null);
1687
+ const attach = result.duplicate ? { ...result.duplicate, kind: "duplicate" } : result.related ? { ...result.related, kind: "related" } : null;
1688
+ setDuplicate(attach);
1689
+ onDuplicateChange == null ? void 0 : onDuplicateChange((_a = attach == null ? void 0 : attach.number) != null ? _a : null, attach == null ? void 0 : attach.kind);
1688
1690
  setGlitchgrabOffer(!!result.aboutGlitchgrab && !!onReportGlitchgrabProblem && !!result.question);
1689
1691
  if (result.solved) {
1690
1692
  setSolved(result.solved);
@@ -1703,7 +1705,7 @@ function AssistSheet({
1703
1705
  }
1704
1706
  if (result.question) {
1705
1707
  setMessages([...history2, { role: "assistant", content: result.question }]);
1706
- setOptions((_d = result.options) != null ? _d : []);
1708
+ setOptions((_b = result.options) != null ? _b : []);
1707
1709
  return;
1708
1710
  }
1709
1711
  onDegrade("The assistant had nothing to add \u2014 write your report below and send it as normal.");
@@ -1776,15 +1778,15 @@ function AssistSheet({
1776
1778
  minWidth: 0
1777
1779
  },
1778
1780
  children: [
1779
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: t2.text, fontWeight: 600 }, children: title ? "Our team is already on this" : `Our team is already on #${duplicate.number}` }),
1781
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: t2.text, fontWeight: 600 }, children: duplicate.kind === "related" ? title ? "Your request goes onto this issue" : `Connected to #${duplicate.number}` : title ? "Our team is already on this" : `Our team is already on #${duplicate.number}` }),
1780
1782
  title && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { color: t2.textMuted, wordBreak: "break-word" }, children: [
1781
1783
  "#",
1782
1784
  duplicate.number,
1783
1785
  " ",
1784
1786
  duplicate.title
1785
1787
  ] }),
1786
- duplicate.status && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: t2.text, fontWeight: 600 }, children: duplicate.status }),
1787
- footer && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: t2.textMuted }, children: footer })
1788
+ duplicate.status && duplicate.kind !== "related" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: t2.text, fontWeight: 600 }, children: duplicate.status }),
1789
+ footer && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: t2.textMuted }, children: duplicate.kind === "related" ? "Added as a separate request on it, not a repeat \u2014 the team sees both." : footer })
1788
1790
  ]
1789
1791
  }
1790
1792
  );
@@ -2454,7 +2456,7 @@ function AssistSheet({
2454
2456
  textTransform: "uppercase",
2455
2457
  color: t2.accent
2456
2458
  },
2457
- children: duplicate ? `What we'll add to #${duplicate.number} \xB7 edit anything` : "Your report \xB7 edit anything"
2459
+ children: duplicate ? `What we'll add to #${duplicate.number}${duplicate.kind === "related" ? " as a related request" : ""} \xB7 edit anything` : "Your report \xB7 edit anything"
2458
2460
  }
2459
2461
  ),
2460
2462
  renderKnownIssue({
@@ -4000,6 +4002,8 @@ function ReportDialog({
4000
4002
  const [selfReportPrefill, setSelfReportPrefill] = (0, import_react.useState)("");
4001
4003
  const [typeChosen, setTypeChosen] = (0, import_react.useState)(false);
4002
4004
  const [duplicateIssueNumber, setDuplicateIssueNumber] = (0, import_react.useState)(null);
4005
+ const [duplicateKind, setDuplicateKind] = (0, import_react.useState)("duplicate");
4006
+ const [addedAsRelated, setAddedAsRelated] = (0, import_react.useState)(false);
4003
4007
  const [similarIssues, setSimilarIssues] = (0, import_react.useState)(null);
4004
4008
  const [checkingSimilar, setCheckingSimilar] = (0, import_react.useState)(false);
4005
4009
  const [attachingTo, setAttachingTo] = (0, import_react.useState)(null);
@@ -4436,6 +4440,7 @@ function ReportDialog({
4436
4440
  setReportType("BUG");
4437
4441
  setTypeChosen(false);
4438
4442
  setDuplicateIssueNumber(null);
4443
+ setDuplicateKind("duplicate");
4439
4444
  setSimilarIssues(null);
4440
4445
  setPickedSimilar(null);
4441
4446
  setCheckingSimilar(false);
@@ -4628,7 +4633,7 @@ function ReportDialog({
4628
4633
  }
4629
4634
  };
4630
4635
  const handleSubmit = async (opts) => {
4631
- var _a2, _b;
4636
+ var _a2, _b, _c;
4632
4637
  try {
4633
4638
  if (isSubmitting) return;
4634
4639
  if (isRating) {
@@ -4666,6 +4671,7 @@ function ReportDialog({
4666
4671
  return;
4667
4672
  }
4668
4673
  const duplicateOf = (_a2 = opts == null ? void 0 : opts.duplicateOf) != null ? _a2 : duplicateIssueNumber;
4674
+ const attachKind = (opts == null ? void 0 : opts.duplicateOf) ? (_b = opts.kind) != null ? _b : "duplicate" : duplicateKind;
4669
4675
  if (findSimilarIssues2 && !(opts == null ? void 0 : opts.skipSimilar) && !duplicateOf && !aiConversationId) {
4670
4676
  setIsSubmitting(true);
4671
4677
  setCheckingSimilar(true);
@@ -4701,6 +4707,7 @@ function ReportDialog({
4701
4707
  }
4702
4708
  if (duplicateOf) {
4703
4709
  metadata.duplicateIssueNumber = String(duplicateOf);
4710
+ if (attachKind === "related") metadata.duplicateKind = "related";
4704
4711
  }
4705
4712
  if (aiConversationId) {
4706
4713
  metadata.aiConversationId = aiConversationId;
@@ -4714,14 +4721,16 @@ function ReportDialog({
4714
4721
  );
4715
4722
  if (result) {
4716
4723
  setAddedToIssue(duplicateOf && result.issueNumber === duplicateOf ? duplicateOf : null);
4724
+ setAddedAsRelated(!!duplicateOf && result.issueNumber === duplicateOf && attachKind === "related");
4717
4725
  const queued = result.status === "QUEUED" && !!result.message;
4718
- setQueuedMessage(queued ? (_b = result.message) != null ? _b : null : null);
4726
+ setQueuedMessage(queued ? (_c = result.message) != null ? _c : null : null);
4719
4727
  setSubmitted(true);
4720
4728
  setDescription("");
4721
4729
  setScreenshots([]);
4722
4730
  setAttachments([]);
4723
4731
  setAiConversationId(null);
4724
4732
  setDuplicateIssueNumber(null);
4733
+ setDuplicateKind("duplicate");
4725
4734
  setSimilarIssues(null);
4726
4735
  setPickedSimilar(null);
4727
4736
  setTimeout(() => {
@@ -5049,7 +5058,7 @@ function ReportDialog({
5049
5058
  },
5050
5059
  children: queuedMessage
5051
5060
  }
5052
- ) : addedToIssue ? `Added to #${addedToIssue}. Thank you!` : `${getTypeLabel(reportType)} sent. Thank you!`
5061
+ ) : addedToIssue ? `Added to #${addedToIssue}${addedAsRelated ? " as a related request" : ""}. Thank you!` : `${getTypeLabel(reportType)} sent. Thank you!`
5053
5062
  }
5054
5063
  ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
5055
5064
  step === 1 && headerSlot ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { marginBottom: "14px" }, children: headerSlot }) : null,
@@ -6294,8 +6303,8 @@ function ReportDialog({
6294
6303
  },
6295
6304
  children: [
6296
6305
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
6297
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: t2.text, fontWeight: 600, fontSize: "13px" }, children: "Our team may already have this" }),
6298
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: t2.textMuted, fontSize: "12px", lineHeight: 1.5 }, children: similarIssues.length > 1 ? "Pick the one that matches \u2014 your report is added to it, so the team sees everyone hitting it in one place." : "If it's the same problem, pick it \u2014 your report is added to it, so the team sees everyone hitting it in one place." })
6306
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: t2.text, fontWeight: 600, fontSize: "13px" }, children: "Our team may already have this, or something close" }),
6307
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: t2.textMuted, fontSize: "12px", lineHeight: 1.5 }, children: similarIssues.length > 1 ? "Pick the one that matches. Same problem, or a different request for the same feature \u2014 it's added to that issue, so the team has it in one place." : "Same problem, or a different request for the same feature? Pick it \u2014 it's added to that issue, so the team has it in one place." })
6299
6308
  ] }),
6300
6309
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
6301
6310
  "div",
@@ -6400,7 +6409,8 @@ function ReportDialog({
6400
6409
  if (!pickedSimilar) return;
6401
6410
  setAttachingTo(pickedSimilar);
6402
6411
  setDuplicateIssueNumber(pickedSimilar);
6403
- void handleSubmit({ duplicateOf: pickedSimilar });
6412
+ setDuplicateKind("duplicate");
6413
+ void handleSubmit({ duplicateOf: pickedSimilar, kind: "duplicate" });
6404
6414
  },
6405
6415
  style: {
6406
6416
  width: "100%",
@@ -6415,7 +6425,7 @@ function ReportDialog({
6415
6425
  cursor: isSubmitting || !pickedSimilar ? "not-allowed" : "pointer",
6416
6426
  fontFamily: "inherit"
6417
6427
  },
6418
- children: typeof attachingTo === "number" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
6428
+ children: typeof attachingTo === "number" && duplicateKind !== "related" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
6419
6429
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ButtonSpinner, {}),
6420
6430
  "Adding to #",
6421
6431
  attachingTo,
@@ -6423,6 +6433,39 @@ function ReportDialog({
6423
6433
  ] }) : pickedSimilar ? `Add to #${pickedSimilar}` : "Pick the matching issue"
6424
6434
  }
6425
6435
  ),
6436
+ pickedSimilar && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
6437
+ "button",
6438
+ {
6439
+ type: "button",
6440
+ disabled: isSubmitting,
6441
+ onClick: () => {
6442
+ setAttachingTo(pickedSimilar);
6443
+ setDuplicateIssueNumber(pickedSimilar);
6444
+ setDuplicateKind("related");
6445
+ void handleSubmit({ duplicateOf: pickedSimilar, kind: "related" });
6446
+ },
6447
+ style: {
6448
+ width: "100%",
6449
+ minHeight: "40px",
6450
+ marginTop: "-4px",
6451
+ padding: "9px 10px",
6452
+ borderRadius: "8px",
6453
+ border: "1px solid rgba(245,158,11,0.4)",
6454
+ backgroundColor: "transparent",
6455
+ color: isSubmitting ? t2.textMuted : t2.text,
6456
+ fontSize: "13px",
6457
+ fontWeight: 600,
6458
+ cursor: isSubmitting ? "not-allowed" : "pointer",
6459
+ fontFamily: "inherit"
6460
+ },
6461
+ children: typeof attachingTo === "number" && duplicateKind === "related" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
6462
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ButtonSpinner, {}),
6463
+ "Adding to #",
6464
+ attachingTo,
6465
+ "\u2026"
6466
+ ] }) : `Related request \u2014 add to #${pickedSimilar}`
6467
+ }
6468
+ ),
6426
6469
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
6427
6470
  "button",
6428
6471
  {
@@ -6769,7 +6812,10 @@ function ReportDialog({
6769
6812
  setTypeChosen(true);
6770
6813
  setStep(2);
6771
6814
  },
6772
- onDuplicateChange: setDuplicateIssueNumber,
6815
+ onDuplicateChange: (issueNumber, kind) => {
6816
+ setDuplicateIssueNumber(issueNumber);
6817
+ setDuplicateKind(issueNumber && kind === "related" ? "related" : "duplicate");
6818
+ },
6773
6819
  onConversationChange: setAiConversationId,
6774
6820
  onFinish: handleClose,
6775
6821
  rating,