glitchgrab 1.45.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.mjs CHANGED
@@ -688,7 +688,7 @@ async function findSimilarIssues(description, token, baseUrl, identity) {
688
688
  }
689
689
  }
690
690
  async function assistTurn(params, token, baseUrl) {
691
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
691
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
692
692
  const offline = {
693
693
  conversationId: null,
694
694
  question: null,
@@ -722,8 +722,9 @@ async function assistTurn(params, token, baseUrl) {
722
722
  options: (_g = (_f = envelope.data) == null ? void 0 : _f.options) != null ? _g : [],
723
723
  report: (_i = (_h = envelope.data) == null ? void 0 : _h.report) != null ? _i : null,
724
724
  duplicate: (_k = (_j = envelope.data) == null ? void 0 : _j.duplicate) != null ? _k : null,
725
- solved: (_m = (_l = envelope.data) == null ? void 0 : _l.solved) != null ? _m : null,
726
- aboutGlitchgrab: ((_n = envelope.data) == null ? void 0 : _n.aboutGlitchgrab) === true,
725
+ related: (_m = (_l = envelope.data) == null ? void 0 : _l.related) != null ? _m : null,
726
+ solved: (_o = (_n = envelope.data) == null ? void 0 : _n.solved) != null ? _o : null,
727
+ aboutGlitchgrab: ((_p = envelope.data) == null ? void 0 : _p.aboutGlitchgrab) === true,
727
728
  degraded: null
728
729
  };
729
730
  } catch (e) {
@@ -1585,7 +1586,7 @@ function AssistSheet({
1585
1586
  onDegrade(message, retryable);
1586
1587
  }
1587
1588
  async function runTurn(history2) {
1588
- var _a, _b, _c, _d;
1589
+ var _a, _b;
1589
1590
  setBusy(true);
1590
1591
  let result;
1591
1592
  const events = takeEvents();
@@ -1629,8 +1630,9 @@ function AssistSheet({
1629
1630
  setConversationId(result.conversationId);
1630
1631
  onConversationChange == null ? void 0 : onConversationChange(result.conversationId);
1631
1632
  }
1632
- setDuplicate((_a = result.duplicate) != null ? _a : null);
1633
- onDuplicateChange == null ? void 0 : onDuplicateChange((_c = (_b = result.duplicate) == null ? void 0 : _b.number) != null ? _c : null);
1633
+ const attach = result.duplicate ? { ...result.duplicate, kind: "duplicate" } : result.related ? { ...result.related, kind: "related" } : null;
1634
+ setDuplicate(attach);
1635
+ onDuplicateChange == null ? void 0 : onDuplicateChange((_a = attach == null ? void 0 : attach.number) != null ? _a : null, attach == null ? void 0 : attach.kind);
1634
1636
  setGlitchgrabOffer(!!result.aboutGlitchgrab && !!onReportGlitchgrabProblem && !!result.question);
1635
1637
  if (result.solved) {
1636
1638
  setSolved(result.solved);
@@ -1649,7 +1651,7 @@ function AssistSheet({
1649
1651
  }
1650
1652
  if (result.question) {
1651
1653
  setMessages([...history2, { role: "assistant", content: result.question }]);
1652
- setOptions((_d = result.options) != null ? _d : []);
1654
+ setOptions((_b = result.options) != null ? _b : []);
1653
1655
  return;
1654
1656
  }
1655
1657
  onDegrade("The assistant had nothing to add \u2014 write your report below and send it as normal.");
@@ -1722,15 +1724,15 @@ function AssistSheet({
1722
1724
  minWidth: 0
1723
1725
  },
1724
1726
  children: [
1725
- /* @__PURE__ */ jsx2("span", { style: { color: t2.text, fontWeight: 600 }, children: title ? "Our team is already on this" : `Our team is already on #${duplicate.number}` }),
1727
+ /* @__PURE__ */ jsx2("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}` }),
1726
1728
  title && /* @__PURE__ */ jsxs2("span", { style: { color: t2.textMuted, wordBreak: "break-word" }, children: [
1727
1729
  "#",
1728
1730
  duplicate.number,
1729
1731
  " ",
1730
1732
  duplicate.title
1731
1733
  ] }),
1732
- duplicate.status && /* @__PURE__ */ jsx2("span", { style: { color: t2.text, fontWeight: 600 }, children: duplicate.status }),
1733
- footer && /* @__PURE__ */ jsx2("span", { style: { color: t2.textMuted }, children: footer })
1734
+ duplicate.status && duplicate.kind !== "related" && /* @__PURE__ */ jsx2("span", { style: { color: t2.text, fontWeight: 600 }, children: duplicate.status }),
1735
+ footer && /* @__PURE__ */ jsx2("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 })
1734
1736
  ]
1735
1737
  }
1736
1738
  );
@@ -1805,6 +1807,7 @@ function AssistSheet({
1805
1807
  /* @__PURE__ */ jsxs2(
1806
1808
  "div",
1807
1809
  {
1810
+ "data-gg-sheet-header": "",
1808
1811
  style: {
1809
1812
  flexShrink: 0,
1810
1813
  padding: "14px 16px",
@@ -1816,7 +1819,7 @@ function AssistSheet({
1816
1819
  minWidth: 0
1817
1820
  },
1818
1821
  children: [
1819
- /* @__PURE__ */ jsxs2("div", { style: { minWidth: 0, overflow: "hidden" }, children: [
1822
+ /* @__PURE__ */ jsxs2("div", { style: { minWidth: 0 }, children: [
1820
1823
  /* @__PURE__ */ jsxs2(
1821
1824
  "div",
1822
1825
  {
@@ -2399,7 +2402,7 @@ function AssistSheet({
2399
2402
  textTransform: "uppercase",
2400
2403
  color: t2.accent
2401
2404
  },
2402
- children: duplicate ? `What we'll add to #${duplicate.number} \xB7 edit anything` : "Your report \xB7 edit anything"
2405
+ children: duplicate ? `What we'll add to #${duplicate.number}${duplicate.kind === "related" ? " as a related request" : ""} \xB7 edit anything` : "Your report \xB7 edit anything"
2403
2406
  }
2404
2407
  ),
2405
2408
  renderKnownIssue({
@@ -3945,6 +3948,8 @@ function ReportDialog({
3945
3948
  const [selfReportPrefill, setSelfReportPrefill] = useState4("");
3946
3949
  const [typeChosen, setTypeChosen] = useState4(false);
3947
3950
  const [duplicateIssueNumber, setDuplicateIssueNumber] = useState4(null);
3951
+ const [duplicateKind, setDuplicateKind] = useState4("duplicate");
3952
+ const [addedAsRelated, setAddedAsRelated] = useState4(false);
3948
3953
  const [similarIssues, setSimilarIssues] = useState4(null);
3949
3954
  const [checkingSimilar, setCheckingSimilar] = useState4(false);
3950
3955
  const [attachingTo, setAttachingTo] = useState4(null);
@@ -3967,6 +3972,7 @@ function ReportDialog({
3967
3972
  const [description, setDescription] = useState4("");
3968
3973
  const [isSubmitting, setIsSubmitting] = useState4(false);
3969
3974
  const [submitted, setSubmitted] = useState4(false);
3975
+ const [queuedMessage, setQueuedMessage] = useState4(null);
3970
3976
  const [screenshots, setScreenshots] = useState4([]);
3971
3977
  const [pageShot, setPageShot] = useState4(null);
3972
3978
  const [shotPending, setShotPending] = useState4(false);
@@ -4380,6 +4386,7 @@ function ReportDialog({
4380
4386
  setReportType("BUG");
4381
4387
  setTypeChosen(false);
4382
4388
  setDuplicateIssueNumber(null);
4389
+ setDuplicateKind("duplicate");
4383
4390
  setSimilarIssues(null);
4384
4391
  setPickedSimilar(null);
4385
4392
  setCheckingSimilar(false);
@@ -4572,7 +4579,7 @@ function ReportDialog({
4572
4579
  }
4573
4580
  };
4574
4581
  const handleSubmit = async (opts) => {
4575
- var _a2;
4582
+ var _a2, _b, _c;
4576
4583
  try {
4577
4584
  if (isSubmitting) return;
4578
4585
  if (isRating) {
@@ -4610,6 +4617,7 @@ function ReportDialog({
4610
4617
  return;
4611
4618
  }
4612
4619
  const duplicateOf = (_a2 = opts == null ? void 0 : opts.duplicateOf) != null ? _a2 : duplicateIssueNumber;
4620
+ const attachKind = (opts == null ? void 0 : opts.duplicateOf) ? (_b = opts.kind) != null ? _b : "duplicate" : duplicateKind;
4613
4621
  if (findSimilarIssues2 && !(opts == null ? void 0 : opts.skipSimilar) && !duplicateOf && !aiConversationId) {
4614
4622
  setIsSubmitting(true);
4615
4623
  setCheckingSimilar(true);
@@ -4645,6 +4653,7 @@ function ReportDialog({
4645
4653
  }
4646
4654
  if (duplicateOf) {
4647
4655
  metadata.duplicateIssueNumber = String(duplicateOf);
4656
+ if (attachKind === "related") metadata.duplicateKind = "related";
4648
4657
  }
4649
4658
  if (aiConversationId) {
4650
4659
  metadata.aiConversationId = aiConversationId;
@@ -4658,18 +4667,23 @@ function ReportDialog({
4658
4667
  );
4659
4668
  if (result) {
4660
4669
  setAddedToIssue(duplicateOf && result.issueNumber === duplicateOf ? duplicateOf : null);
4670
+ setAddedAsRelated(!!duplicateOf && result.issueNumber === duplicateOf && attachKind === "related");
4671
+ const queued = result.status === "QUEUED" && !!result.message;
4672
+ setQueuedMessage(queued ? (_c = result.message) != null ? _c : null : null);
4661
4673
  setSubmitted(true);
4662
4674
  setDescription("");
4663
4675
  setScreenshots([]);
4664
4676
  setAttachments([]);
4665
4677
  setAiConversationId(null);
4666
4678
  setDuplicateIssueNumber(null);
4679
+ setDuplicateKind("duplicate");
4667
4680
  setSimilarIssues(null);
4668
4681
  setPickedSimilar(null);
4669
4682
  setTimeout(() => {
4670
4683
  setSubmitted(false);
4684
+ setQueuedMessage(null);
4671
4685
  handleClose();
4672
- }, 2e3);
4686
+ }, queued ? 6e3 : 2e3);
4673
4687
  }
4674
4688
  setIsSubmitting(false);
4675
4689
  setAttachingTo(null);
@@ -4979,7 +4993,18 @@ function ReportDialog({
4979
4993
  fontSize: "14px",
4980
4994
  fontWeight: 500
4981
4995
  },
4982
- children: addedToIssue ? `Added to #${addedToIssue}. Thank you!` : `${getTypeLabel(reportType)} sent. Thank you!`
4996
+ children: queuedMessage ? /* @__PURE__ */ jsx4(
4997
+ "span",
4998
+ {
4999
+ style: {
5000
+ // amber-500 reads on the dark panel, amber-700 on the light one
5001
+ color: isDark ? "#f59e0b" : "#b45309",
5002
+ fontWeight: 400,
5003
+ lineHeight: 1.5
5004
+ },
5005
+ children: queuedMessage
5006
+ }
5007
+ ) : addedToIssue ? `Added to #${addedToIssue}${addedAsRelated ? " as a related request" : ""}. Thank you!` : `${getTypeLabel(reportType)} sent. Thank you!`
4983
5008
  }
4984
5009
  ) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
4985
5010
  step === 1 && headerSlot ? /* @__PURE__ */ jsx4("div", { style: { marginBottom: "14px" }, children: headerSlot }) : null,
@@ -6224,8 +6249,8 @@ function ReportDialog({
6224
6249
  },
6225
6250
  children: [
6226
6251
  /* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
6227
- /* @__PURE__ */ jsx4("span", { style: { color: t2.text, fontWeight: 600, fontSize: "13px" }, children: "Our team may already have this" }),
6228
- /* @__PURE__ */ jsx4("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." })
6252
+ /* @__PURE__ */ jsx4("span", { style: { color: t2.text, fontWeight: 600, fontSize: "13px" }, children: "Our team may already have this, or something close" }),
6253
+ /* @__PURE__ */ jsx4("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." })
6229
6254
  ] }),
6230
6255
  /* @__PURE__ */ jsx4(
6231
6256
  "div",
@@ -6330,7 +6355,8 @@ function ReportDialog({
6330
6355
  if (!pickedSimilar) return;
6331
6356
  setAttachingTo(pickedSimilar);
6332
6357
  setDuplicateIssueNumber(pickedSimilar);
6333
- void handleSubmit({ duplicateOf: pickedSimilar });
6358
+ setDuplicateKind("duplicate");
6359
+ void handleSubmit({ duplicateOf: pickedSimilar, kind: "duplicate" });
6334
6360
  },
6335
6361
  style: {
6336
6362
  width: "100%",
@@ -6345,7 +6371,7 @@ function ReportDialog({
6345
6371
  cursor: isSubmitting || !pickedSimilar ? "not-allowed" : "pointer",
6346
6372
  fontFamily: "inherit"
6347
6373
  },
6348
- children: typeof attachingTo === "number" ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
6374
+ children: typeof attachingTo === "number" && duplicateKind !== "related" ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
6349
6375
  /* @__PURE__ */ jsx4(ButtonSpinner, {}),
6350
6376
  "Adding to #",
6351
6377
  attachingTo,
@@ -6353,6 +6379,39 @@ function ReportDialog({
6353
6379
  ] }) : pickedSimilar ? `Add to #${pickedSimilar}` : "Pick the matching issue"
6354
6380
  }
6355
6381
  ),
6382
+ pickedSimilar && /* @__PURE__ */ jsx4(
6383
+ "button",
6384
+ {
6385
+ type: "button",
6386
+ disabled: isSubmitting,
6387
+ onClick: () => {
6388
+ setAttachingTo(pickedSimilar);
6389
+ setDuplicateIssueNumber(pickedSimilar);
6390
+ setDuplicateKind("related");
6391
+ void handleSubmit({ duplicateOf: pickedSimilar, kind: "related" });
6392
+ },
6393
+ style: {
6394
+ width: "100%",
6395
+ minHeight: "40px",
6396
+ marginTop: "-4px",
6397
+ padding: "9px 10px",
6398
+ borderRadius: "8px",
6399
+ border: "1px solid rgba(245,158,11,0.4)",
6400
+ backgroundColor: "transparent",
6401
+ color: isSubmitting ? t2.textMuted : t2.text,
6402
+ fontSize: "13px",
6403
+ fontWeight: 600,
6404
+ cursor: isSubmitting ? "not-allowed" : "pointer",
6405
+ fontFamily: "inherit"
6406
+ },
6407
+ children: typeof attachingTo === "number" && duplicateKind === "related" ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
6408
+ /* @__PURE__ */ jsx4(ButtonSpinner, {}),
6409
+ "Adding to #",
6410
+ attachingTo,
6411
+ "\u2026"
6412
+ ] }) : `Related request \u2014 add to #${pickedSimilar}`
6413
+ }
6414
+ ),
6356
6415
  /* @__PURE__ */ jsx4(
6357
6416
  "button",
6358
6417
  {
@@ -6699,7 +6758,10 @@ function ReportDialog({
6699
6758
  setTypeChosen(true);
6700
6759
  setStep(2);
6701
6760
  },
6702
- onDuplicateChange: setDuplicateIssueNumber,
6761
+ onDuplicateChange: (issueNumber, kind) => {
6762
+ setDuplicateIssueNumber(issueNumber);
6763
+ setDuplicateKind(issueNumber && kind === "related" ? "related" : "duplicate");
6764
+ },
6703
6765
  onConversationChange: setAiConversationId,
6704
6766
  onFinish: handleClose,
6705
6767
  rating,