glitchgrab 1.62.4 → 1.62.5
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/README.md +5 -1
- package/dist/index.js +11 -150
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -150
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +20 -2
- package/dist/server.d.ts +20 -2
- package/dist/server.js +15 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +14 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2652,16 +2652,6 @@ var STARTERS = [
|
|
|
2652
2652
|
"I wish it could\u2026"
|
|
2653
2653
|
];
|
|
2654
2654
|
var CONFIRM_OPTION = "Yes, that's it";
|
|
2655
|
-
function isCheckBackQuestion(text) {
|
|
2656
|
-
const t = text.trim();
|
|
2657
|
-
return /^so,? you['’]?re saying\b/i.test(t) || /\b(is that right|is that correct|did i get (that|it) right|have i got (that|it) right)\s*\??\s*$/i.test(t);
|
|
2658
|
-
}
|
|
2659
|
-
function isAffirmativeReply(text) {
|
|
2660
|
-
return /^(y|ya|yah|yes|yess|yeah|yep|yup|ok|okay|sure|correct|right|exactly|confirm(ed)?|that['’]?s (it|right|correct)|yes,? that['’]?s (it|right)|haan|han|ha|ho|hmm yes|👍)[\s.!👍]*$/i.test(
|
|
2661
|
-
text.trim()
|
|
2662
|
-
);
|
|
2663
|
-
}
|
|
2664
|
-
var AUTO_FILE_SECONDS = 3;
|
|
2665
2655
|
var NARROW_QUERY = "(max-width: 640px)";
|
|
2666
2656
|
function useIsNarrow() {
|
|
2667
2657
|
const [narrow, setNarrow] = useState2(false);
|
|
@@ -2829,7 +2819,6 @@ function AssistSheet({
|
|
|
2829
2819
|
const [phase, setPhase] = useState2(
|
|
2830
2820
|
() => !typePicked ? "type" : currentTile === "RATING" ? "rating" : needsSeverity(currentTile) ? "severity" : "chat"
|
|
2831
2821
|
);
|
|
2832
|
-
const [autoFileLeft, setAutoFileLeft] = useState2(null);
|
|
2833
2822
|
const scrollRef = useRef2(null);
|
|
2834
2823
|
const draftRef = useRef2(null);
|
|
2835
2824
|
const composerRef = useRef2(null);
|
|
@@ -2902,30 +2891,11 @@ function AssistSheet({
|
|
|
2902
2891
|
el.style.height = "auto";
|
|
2903
2892
|
el.style.height = `${el.scrollHeight + 2}px`;
|
|
2904
2893
|
}, [input]);
|
|
2905
|
-
useEffect2(() => {
|
|
2906
|
-
if (autoFileLeft === null) return;
|
|
2907
|
-
if (isSubmitting || submitted || phase !== "draft") {
|
|
2908
|
-
setAutoFileLeft(null);
|
|
2909
|
-
return;
|
|
2910
|
-
}
|
|
2911
|
-
if (autoFileLeft <= 0) {
|
|
2912
|
-
sendDraft(true);
|
|
2913
|
-
return;
|
|
2914
|
-
}
|
|
2915
|
-
const id = setTimeout(() => setAutoFileLeft((n) => n === null ? null : n - 1), 1e3);
|
|
2916
|
-
return () => clearTimeout(id);
|
|
2917
|
-
}, [autoFileLeft, isSubmitting, submitted, phase]);
|
|
2918
2894
|
function markUp(index, shot) {
|
|
2919
2895
|
if (!onAnnotateImage) return;
|
|
2920
|
-
stopAutoFile("marked up an image");
|
|
2921
2896
|
logEvent("image_markup", pageShot && shot === pageShot ? "page capture" : "attached");
|
|
2922
2897
|
onAnnotateImage(index);
|
|
2923
2898
|
}
|
|
2924
|
-
function stopAutoFile(reason) {
|
|
2925
|
-
if (autoFileLeft === null) return;
|
|
2926
|
-
setAutoFileLeft(null);
|
|
2927
|
-
logEvent("auto_file_stopped", reason);
|
|
2928
|
-
}
|
|
2929
2899
|
function degradeKeepingEvents(events, message, retryable) {
|
|
2930
2900
|
if (events) eventsRef.current = [...events, ...eventsRef.current];
|
|
2931
2901
|
flushEvents();
|
|
@@ -2945,11 +2915,10 @@ function AssistSheet({
|
|
|
2945
2915
|
}
|
|
2946
2916
|
onDescriptionChange(typed);
|
|
2947
2917
|
}
|
|
2948
|
-
async function runTurn(history2
|
|
2918
|
+
async function runTurn(history2) {
|
|
2949
2919
|
var _a2, _b, _c;
|
|
2950
2920
|
const turnChat = chatIdRef.current;
|
|
2951
2921
|
setBusy(true);
|
|
2952
|
-
setAutoFileLeft(null);
|
|
2953
2922
|
let result;
|
|
2954
2923
|
const events = takeEvents();
|
|
2955
2924
|
try {
|
|
@@ -3030,12 +2999,10 @@ function AssistSheet({
|
|
|
3030
2999
|
return;
|
|
3031
3000
|
}
|
|
3032
3001
|
if (result.report) {
|
|
3033
|
-
let tile = currentTile;
|
|
3034
3002
|
if (!typePicked || inferredTypeRef.current) {
|
|
3035
3003
|
const fallback = defaultTile();
|
|
3036
3004
|
const inferred = result.reportType && tiles.includes(result.reportType) ? result.reportType : fallback;
|
|
3037
3005
|
if (inferred) {
|
|
3038
|
-
tile = inferred;
|
|
3039
3006
|
inferredTypeRef.current = true;
|
|
3040
3007
|
onPickType(inferred);
|
|
3041
3008
|
}
|
|
@@ -3047,9 +3014,6 @@ function AssistSheet({
|
|
|
3047
3014
|
setMessages([...history2, { role: "assistant", content: result.report, kind: "report" }]);
|
|
3048
3015
|
setOptions([]);
|
|
3049
3016
|
setPhase("draft");
|
|
3050
|
-
if (autoFile && !attach && !(showSeverity && tile === "BUG" && !severity)) {
|
|
3051
|
-
setAutoFileLeft(AUTO_FILE_SECONDS);
|
|
3052
|
-
}
|
|
3053
3017
|
return;
|
|
3054
3018
|
}
|
|
3055
3019
|
if (result.question) {
|
|
@@ -3092,13 +3056,7 @@ function AssistSheet({
|
|
|
3092
3056
|
seedFromDescription();
|
|
3093
3057
|
}
|
|
3094
3058
|
}
|
|
3095
|
-
function
|
|
3096
|
-
var _a2;
|
|
3097
|
-
const lastAssistant = [...messages].reverse().find((m) => m.role === "assistant");
|
|
3098
|
-
const checkingBack = options.includes(CONFIRM_OPTION) || (lastAssistant == null ? void 0 : lastAssistant.kind) !== "report" && isCheckBackQuestion((_a2 = lastAssistant == null ? void 0 : lastAssistant.content) != null ? _a2 : "");
|
|
3099
|
-
send(text, checkingBack && isAffirmativeReply(text));
|
|
3100
|
-
}
|
|
3101
|
-
function send(text, autoFile = false) {
|
|
3059
|
+
function send(text) {
|
|
3102
3060
|
const value = text.trim();
|
|
3103
3061
|
if (!value || busy) return;
|
|
3104
3062
|
setOptions([]);
|
|
@@ -3114,7 +3072,7 @@ function AssistSheet({
|
|
|
3114
3072
|
const history2 = [...base, { role: "user", content: value }];
|
|
3115
3073
|
setMessages(history2);
|
|
3116
3074
|
setInput("");
|
|
3117
|
-
void runTurn(history2
|
|
3075
|
+
void runTurn(history2);
|
|
3118
3076
|
}
|
|
3119
3077
|
function withCurrentDraft(history2) {
|
|
3120
3078
|
const current = description.trim();
|
|
@@ -3127,10 +3085,9 @@ function AssistSheet({
|
|
|
3127
3085
|
}
|
|
3128
3086
|
return next;
|
|
3129
3087
|
}
|
|
3130
|
-
function sendDraft(
|
|
3131
|
-
setAutoFileLeft(null);
|
|
3088
|
+
function sendDraft() {
|
|
3132
3089
|
const edited = aiDraftRef.current !== null && description.trim() !== aiDraftRef.current.trim();
|
|
3133
|
-
logEvent("draft_sent",
|
|
3090
|
+
logEvent("draft_sent", edited ? "edited" : "as drafted");
|
|
3134
3091
|
flushEvents();
|
|
3135
3092
|
onSend();
|
|
3136
3093
|
}
|
|
@@ -3173,7 +3130,6 @@ function AssistSheet({
|
|
|
3173
3130
|
setDuplicate(null);
|
|
3174
3131
|
onDuplicateChange == null ? void 0 : onDuplicateChange(null);
|
|
3175
3132
|
setGlitchgrabOffer(false);
|
|
3176
|
-
setAutoFileLeft(null);
|
|
3177
3133
|
setInput("");
|
|
3178
3134
|
if (chat.tile !== currentTile && tiles.includes(chat.tile)) {
|
|
3179
3135
|
onPickType(chat.tile);
|
|
@@ -3206,7 +3162,6 @@ function AssistSheet({
|
|
|
3206
3162
|
setDuplicate(null);
|
|
3207
3163
|
onDuplicateChange == null ? void 0 : onDuplicateChange(null);
|
|
3208
3164
|
setGlitchgrabOffer(false);
|
|
3209
|
-
setAutoFileLeft(null);
|
|
3210
3165
|
setInput("");
|
|
3211
3166
|
onDescriptionChange("");
|
|
3212
3167
|
onIssueTitleChange("");
|
|
@@ -3404,7 +3359,6 @@ function AssistSheet({
|
|
|
3404
3359
|
@keyframes gg-sheet-in{from{transform:translateX(24px);opacity:0}to{transform:translateX(0);opacity:1}}
|
|
3405
3360
|
@keyframes gg-sheet-up{from{transform:translateY(24px);opacity:0}to{transform:translateY(0);opacity:1}}
|
|
3406
3361
|
@keyframes gg-sheet-fade{from{opacity:0}to{opacity:1}}
|
|
3407
|
-
@keyframes gg-autofile{from{transform:scaleX(0)}to{transform:scaleX(1)}}
|
|
3408
3362
|
@keyframes gg-spin{to{transform:rotate(360deg)}}
|
|
3409
3363
|
@keyframes gg-dot{0%,80%,100%{transform:translateY(0);opacity:.4}40%{transform:translateY(-3px);opacity:1}}
|
|
3410
3364
|
[data-gg-sheet-send]:focus-visible,[data-gg-chip]:focus-visible,[data-gg-assist-remove]:focus-visible,[data-gg-assist-annotate]:focus-visible,[data-gg-stop-auto-file]:focus-visible{outline:2px solid currentColor;outline-offset:2px}
|
|
@@ -3941,11 +3895,7 @@ function AssistSheet({
|
|
|
3941
3895
|
color: t.text,
|
|
3942
3896
|
border: live ? "none" : `1px solid ${t.accent}66`
|
|
3943
3897
|
},
|
|
3944
|
-
children: live ? (
|
|
3945
|
-
// #402: "have a read" beside a countdown reads as a
|
|
3946
|
-
// contradiction. Say what is about to happen instead.
|
|
3947
|
-
autoFileLeft !== null ? "Here's your report \u2014 I'll file it unless you want to change something." : "Here's your report \u2014 have a read."
|
|
3948
|
-
) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
3898
|
+
children: live ? "Here's your report \u2014 have a read. Nothing is sent until you send it." : /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
3949
3899
|
/* @__PURE__ */ jsx3(
|
|
3950
3900
|
"span",
|
|
3951
3901
|
{
|
|
@@ -4116,7 +4066,7 @@ function AssistSheet({
|
|
|
4116
4066
|
"data-gg-option": "",
|
|
4117
4067
|
onClick: () => {
|
|
4118
4068
|
logEvent("option_tap", option);
|
|
4119
|
-
send(option
|
|
4069
|
+
send(option);
|
|
4120
4070
|
},
|
|
4121
4071
|
style: {
|
|
4122
4072
|
border: primary ? "1px solid transparent" : `1px solid ${t.inputBorder}`,
|
|
@@ -4237,7 +4187,6 @@ function AssistSheet({
|
|
|
4237
4187
|
if (e.key === "Enter") e.preventDefault();
|
|
4238
4188
|
},
|
|
4239
4189
|
onChange: (e) => {
|
|
4240
|
-
stopAutoFile("edited the title");
|
|
4241
4190
|
onIssueTitleChange(e.target.value.replace(/[\r\n]+/g, " "));
|
|
4242
4191
|
},
|
|
4243
4192
|
style: {
|
|
@@ -4263,7 +4212,6 @@ function AssistSheet({
|
|
|
4263
4212
|
ref: draftRef,
|
|
4264
4213
|
value: description,
|
|
4265
4214
|
onChange: (e) => {
|
|
4266
|
-
stopAutoFile("edited the draft");
|
|
4267
4215
|
onDescriptionChange(e.target.value);
|
|
4268
4216
|
},
|
|
4269
4217
|
rows: 6,
|
|
@@ -4284,7 +4232,7 @@ function AssistSheet({
|
|
|
4284
4232
|
}
|
|
4285
4233
|
}
|
|
4286
4234
|
),
|
|
4287
|
-
severityAsked &&
|
|
4235
|
+
severityAsked && /* @__PURE__ */ jsxs3("div", { children: [
|
|
4288
4236
|
/* @__PURE__ */ jsxs3(
|
|
4289
4237
|
"span",
|
|
4290
4238
|
{
|
|
@@ -4572,7 +4520,6 @@ function AssistSheet({
|
|
|
4572
4520
|
"aria-label": `Remove image ${i + 1}`,
|
|
4573
4521
|
title: "Remove this image",
|
|
4574
4522
|
onClick: () => {
|
|
4575
|
-
stopAutoFile("changed attachments");
|
|
4576
4523
|
logEvent(
|
|
4577
4524
|
"image_removed",
|
|
4578
4525
|
pageShot && shot === pageShot ? "page capture" : "attached"
|
|
@@ -4701,7 +4648,6 @@ function AssistSheet({
|
|
|
4701
4648
|
"aria-label": `Remove file ${file.name}`,
|
|
4702
4649
|
title: "Remove this file",
|
|
4703
4650
|
onClick: () => {
|
|
4704
|
-
stopAutoFile("changed attachments");
|
|
4705
4651
|
logEvent("file_removed", read ? "read" : "not read");
|
|
4706
4652
|
onRemoveFile(i);
|
|
4707
4653
|
},
|
|
@@ -4784,7 +4730,6 @@ function AssistSheet({
|
|
|
4784
4730
|
var _a2;
|
|
4785
4731
|
const picked = Array.from((_a2 = e.target.files) != null ? _a2 : []);
|
|
4786
4732
|
if (picked.length) {
|
|
4787
|
-
stopAutoFile("changed attachments");
|
|
4788
4733
|
const images = picked.filter((f) => f.type.startsWith("image/")).length;
|
|
4789
4734
|
if (images) logEvent("image_added", String(images));
|
|
4790
4735
|
if (picked.length > images) {
|
|
@@ -4816,13 +4761,12 @@ function AssistSheet({
|
|
|
4816
4761
|
ref: composerRef,
|
|
4817
4762
|
value: input,
|
|
4818
4763
|
onChange: (e) => {
|
|
4819
|
-
stopAutoFile("typing a change");
|
|
4820
4764
|
setInput(e.target.value);
|
|
4821
4765
|
},
|
|
4822
4766
|
onKeyDown: (e) => {
|
|
4823
4767
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
4824
4768
|
e.preventDefault();
|
|
4825
|
-
|
|
4769
|
+
send(input);
|
|
4826
4770
|
}
|
|
4827
4771
|
},
|
|
4828
4772
|
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",
|
|
@@ -4852,7 +4796,7 @@ function AssistSheet({
|
|
|
4852
4796
|
{
|
|
4853
4797
|
type: "button",
|
|
4854
4798
|
"data-gg-sheet-send": "",
|
|
4855
|
-
onClick: () =>
|
|
4799
|
+
onClick: () => send(input),
|
|
4856
4800
|
disabled: busy || !input.trim(),
|
|
4857
4801
|
"aria-label": "Send message",
|
|
4858
4802
|
"data-gg-send-message": "",
|
|
@@ -4892,90 +4836,7 @@ function AssistSheet({
|
|
|
4892
4836
|
children: validationError
|
|
4893
4837
|
}
|
|
4894
4838
|
),
|
|
4895
|
-
similarSlot ? similarSlot :
|
|
4896
|
-
// #402: "Yes, that's it" was the confirmation. The draft
|
|
4897
|
-
// files itself unless they stop it — the bar shows how
|
|
4898
|
-
// long is left, the button sends now, the × on its right
|
|
4899
|
-
// stops it (#406). Stopping keeps the draft: Send Report
|
|
4900
|
-
// comes back, and closing the sheet drops it.
|
|
4901
|
-
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "8px", marginTop: "8px" }, children: [
|
|
4902
|
-
/* @__PURE__ */ jsxs3(
|
|
4903
|
-
"button",
|
|
4904
|
-
{
|
|
4905
|
-
type: "button",
|
|
4906
|
-
"data-gg-sheet-send": "",
|
|
4907
|
-
"data-gg-auto-file": "",
|
|
4908
|
-
onClick: () => sendDraft(),
|
|
4909
|
-
style: {
|
|
4910
|
-
flex: 1,
|
|
4911
|
-
minWidth: 0,
|
|
4912
|
-
position: "relative",
|
|
4913
|
-
overflow: "hidden",
|
|
4914
|
-
padding: "12px",
|
|
4915
|
-
borderRadius: "10px",
|
|
4916
|
-
border: "none",
|
|
4917
|
-
backgroundColor: t.accent,
|
|
4918
|
-
color: t.accentText,
|
|
4919
|
-
fontSize: "14px",
|
|
4920
|
-
fontWeight: 700,
|
|
4921
|
-
fontFamily: "inherit",
|
|
4922
|
-
cursor: "pointer"
|
|
4923
|
-
},
|
|
4924
|
-
children: [
|
|
4925
|
-
/* @__PURE__ */ jsx3(
|
|
4926
|
-
"span",
|
|
4927
|
-
{
|
|
4928
|
-
"aria-hidden": "true",
|
|
4929
|
-
style: {
|
|
4930
|
-
position: "absolute",
|
|
4931
|
-
inset: 0,
|
|
4932
|
-
backgroundColor: "rgba(255,255,255,0.22)",
|
|
4933
|
-
transformOrigin: "left",
|
|
4934
|
-
animation: `gg-autofile ${AUTO_FILE_SECONDS}s linear forwards`
|
|
4935
|
-
}
|
|
4936
|
-
}
|
|
4937
|
-
),
|
|
4938
|
-
/* @__PURE__ */ jsxs3("span", { style: { position: "relative" }, children: [
|
|
4939
|
-
"Filing in ",
|
|
4940
|
-
autoFileLeft,
|
|
4941
|
-
"s\u2026"
|
|
4942
|
-
] })
|
|
4943
|
-
]
|
|
4944
|
-
}
|
|
4945
|
-
),
|
|
4946
|
-
/* @__PURE__ */ jsx3(
|
|
4947
|
-
"button",
|
|
4948
|
-
{
|
|
4949
|
-
type: "button",
|
|
4950
|
-
"data-gg-stop-auto-file": "",
|
|
4951
|
-
onClick: () => stopAutoFile("pressed stop"),
|
|
4952
|
-
"aria-label": "Stop \u2014 don't send",
|
|
4953
|
-
title: "Stop \u2014 don't send",
|
|
4954
|
-
style: {
|
|
4955
|
-
flexShrink: 0,
|
|
4956
|
-
width: "44px",
|
|
4957
|
-
borderRadius: "10px",
|
|
4958
|
-
border: `1px solid ${t.inputBorder}`,
|
|
4959
|
-
background: "transparent",
|
|
4960
|
-
color: t.text,
|
|
4961
|
-
display: "inline-flex",
|
|
4962
|
-
alignItems: "center",
|
|
4963
|
-
justifyContent: "center",
|
|
4964
|
-
cursor: "pointer"
|
|
4965
|
-
},
|
|
4966
|
-
children: /* @__PURE__ */ jsx3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(
|
|
4967
|
-
"path",
|
|
4968
|
-
{
|
|
4969
|
-
d: "M6 6l12 12M18 6L6 18",
|
|
4970
|
-
stroke: "currentColor",
|
|
4971
|
-
strokeWidth: "2.25",
|
|
4972
|
-
strokeLinecap: "round"
|
|
4973
|
-
}
|
|
4974
|
-
) })
|
|
4975
|
-
}
|
|
4976
|
-
)
|
|
4977
|
-
] })
|
|
4978
|
-
) : /* @__PURE__ */ jsx3(
|
|
4839
|
+
similarSlot ? similarSlot : /* @__PURE__ */ jsx3(
|
|
4979
4840
|
"button",
|
|
4980
4841
|
{
|
|
4981
4842
|
type: "button",
|