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.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
  );
@@ -2400,7 +2402,7 @@ function AssistSheet({
2400
2402
  textTransform: "uppercase",
2401
2403
  color: t2.accent
2402
2404
  },
2403
- 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"
2404
2406
  }
2405
2407
  ),
2406
2408
  renderKnownIssue({
@@ -3946,6 +3948,8 @@ function ReportDialog({
3946
3948
  const [selfReportPrefill, setSelfReportPrefill] = useState4("");
3947
3949
  const [typeChosen, setTypeChosen] = useState4(false);
3948
3950
  const [duplicateIssueNumber, setDuplicateIssueNumber] = useState4(null);
3951
+ const [duplicateKind, setDuplicateKind] = useState4("duplicate");
3952
+ const [addedAsRelated, setAddedAsRelated] = useState4(false);
3949
3953
  const [similarIssues, setSimilarIssues] = useState4(null);
3950
3954
  const [checkingSimilar, setCheckingSimilar] = useState4(false);
3951
3955
  const [attachingTo, setAttachingTo] = useState4(null);
@@ -4382,6 +4386,7 @@ function ReportDialog({
4382
4386
  setReportType("BUG");
4383
4387
  setTypeChosen(false);
4384
4388
  setDuplicateIssueNumber(null);
4389
+ setDuplicateKind("duplicate");
4385
4390
  setSimilarIssues(null);
4386
4391
  setPickedSimilar(null);
4387
4392
  setCheckingSimilar(false);
@@ -4574,7 +4579,7 @@ function ReportDialog({
4574
4579
  }
4575
4580
  };
4576
4581
  const handleSubmit = async (opts) => {
4577
- var _a2, _b;
4582
+ var _a2, _b, _c;
4578
4583
  try {
4579
4584
  if (isSubmitting) return;
4580
4585
  if (isRating) {
@@ -4612,6 +4617,7 @@ function ReportDialog({
4612
4617
  return;
4613
4618
  }
4614
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;
4615
4621
  if (findSimilarIssues2 && !(opts == null ? void 0 : opts.skipSimilar) && !duplicateOf && !aiConversationId) {
4616
4622
  setIsSubmitting(true);
4617
4623
  setCheckingSimilar(true);
@@ -4647,6 +4653,7 @@ function ReportDialog({
4647
4653
  }
4648
4654
  if (duplicateOf) {
4649
4655
  metadata.duplicateIssueNumber = String(duplicateOf);
4656
+ if (attachKind === "related") metadata.duplicateKind = "related";
4650
4657
  }
4651
4658
  if (aiConversationId) {
4652
4659
  metadata.aiConversationId = aiConversationId;
@@ -4660,14 +4667,16 @@ function ReportDialog({
4660
4667
  );
4661
4668
  if (result) {
4662
4669
  setAddedToIssue(duplicateOf && result.issueNumber === duplicateOf ? duplicateOf : null);
4670
+ setAddedAsRelated(!!duplicateOf && result.issueNumber === duplicateOf && attachKind === "related");
4663
4671
  const queued = result.status === "QUEUED" && !!result.message;
4664
- setQueuedMessage(queued ? (_b = result.message) != null ? _b : null : null);
4672
+ setQueuedMessage(queued ? (_c = result.message) != null ? _c : null : null);
4665
4673
  setSubmitted(true);
4666
4674
  setDescription("");
4667
4675
  setScreenshots([]);
4668
4676
  setAttachments([]);
4669
4677
  setAiConversationId(null);
4670
4678
  setDuplicateIssueNumber(null);
4679
+ setDuplicateKind("duplicate");
4671
4680
  setSimilarIssues(null);
4672
4681
  setPickedSimilar(null);
4673
4682
  setTimeout(() => {
@@ -4995,7 +5004,7 @@ function ReportDialog({
4995
5004
  },
4996
5005
  children: queuedMessage
4997
5006
  }
4998
- ) : addedToIssue ? `Added to #${addedToIssue}. Thank you!` : `${getTypeLabel(reportType)} sent. Thank you!`
5007
+ ) : addedToIssue ? `Added to #${addedToIssue}${addedAsRelated ? " as a related request" : ""}. Thank you!` : `${getTypeLabel(reportType)} sent. Thank you!`
4999
5008
  }
5000
5009
  ) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
5001
5010
  step === 1 && headerSlot ? /* @__PURE__ */ jsx4("div", { style: { marginBottom: "14px" }, children: headerSlot }) : null,
@@ -6240,8 +6249,8 @@ function ReportDialog({
6240
6249
  },
6241
6250
  children: [
6242
6251
  /* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
6243
- /* @__PURE__ */ jsx4("span", { style: { color: t2.text, fontWeight: 600, fontSize: "13px" }, children: "Our team may already have this" }),
6244
- /* @__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." })
6245
6254
  ] }),
6246
6255
  /* @__PURE__ */ jsx4(
6247
6256
  "div",
@@ -6346,7 +6355,8 @@ function ReportDialog({
6346
6355
  if (!pickedSimilar) return;
6347
6356
  setAttachingTo(pickedSimilar);
6348
6357
  setDuplicateIssueNumber(pickedSimilar);
6349
- void handleSubmit({ duplicateOf: pickedSimilar });
6358
+ setDuplicateKind("duplicate");
6359
+ void handleSubmit({ duplicateOf: pickedSimilar, kind: "duplicate" });
6350
6360
  },
6351
6361
  style: {
6352
6362
  width: "100%",
@@ -6361,7 +6371,7 @@ function ReportDialog({
6361
6371
  cursor: isSubmitting || !pickedSimilar ? "not-allowed" : "pointer",
6362
6372
  fontFamily: "inherit"
6363
6373
  },
6364
- children: typeof attachingTo === "number" ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
6374
+ children: typeof attachingTo === "number" && duplicateKind !== "related" ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
6365
6375
  /* @__PURE__ */ jsx4(ButtonSpinner, {}),
6366
6376
  "Adding to #",
6367
6377
  attachingTo,
@@ -6369,6 +6379,39 @@ function ReportDialog({
6369
6379
  ] }) : pickedSimilar ? `Add to #${pickedSimilar}` : "Pick the matching issue"
6370
6380
  }
6371
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
+ ),
6372
6415
  /* @__PURE__ */ jsx4(
6373
6416
  "button",
6374
6417
  {
@@ -6715,7 +6758,10 @@ function ReportDialog({
6715
6758
  setTypeChosen(true);
6716
6759
  setStep(2);
6717
6760
  },
6718
- onDuplicateChange: setDuplicateIssueNumber,
6761
+ onDuplicateChange: (issueNumber, kind) => {
6762
+ setDuplicateIssueNumber(issueNumber);
6763
+ setDuplicateKind(issueNumber && kind === "related" ? "related" : "duplicate");
6764
+ },
6719
6765
  onConversationChange: setAiConversationId,
6720
6766
  onFinish: handleClose,
6721
6767
  rating,