@tangle-network/agent-app 0.46.24 → 0.46.26
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/assistant/index.js +1 -1
- package/dist/chat-react/index.js +1 -1
- package/dist/{chunk-P2EC5VHG.js → chunk-MWEX2M6M.js} +61 -118
- package/dist/chunk-MWEX2M6M.js.map +1 -0
- package/dist/{mention-editor-WW7UVZMR.js → mention-editor-NDJAEMRP.js} +3 -1
- package/dist/mention-editor-NDJAEMRP.js.map +1 -0
- package/dist/web-react/index.js +1 -1
- package/dist/web-react/mention-editor.d.ts +3 -1
- package/package.json +1 -1
- package/dist/chunk-P2EC5VHG.js.map +0 -1
- package/dist/mention-editor-WW7UVZMR.js.map +0 -1
package/dist/assistant/index.js
CHANGED
package/dist/chat-react/index.js
CHANGED
|
@@ -272,53 +272,26 @@ import {
|
|
|
272
272
|
} from "react";
|
|
273
273
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
274
274
|
function createLazyMentionEditor() {
|
|
275
|
-
return lazy(() => import("./mention-editor-
|
|
275
|
+
return lazy(() => import("./mention-editor-NDJAEMRP.js").then((m) => m.loadMentionEditor()));
|
|
276
276
|
}
|
|
277
277
|
var MentionEditorBoundary = class extends Component {
|
|
278
|
-
state = {
|
|
279
|
-
static getDerivedStateFromError(
|
|
280
|
-
return {
|
|
281
|
-
}
|
|
282
|
-
componentDidCatch() {
|
|
283
|
-
this.props.onFailed();
|
|
278
|
+
state = { failed: false };
|
|
279
|
+
static getDerivedStateFromError() {
|
|
280
|
+
return { failed: true };
|
|
284
281
|
}
|
|
285
282
|
render() {
|
|
286
|
-
if (this.state.
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
message
|
|
299
|
-
] }),
|
|
300
|
-
/* @__PURE__ */ jsx(
|
|
301
|
-
"button",
|
|
302
|
-
{
|
|
303
|
-
type: "button",
|
|
304
|
-
"aria-label": "Retry loading the mention input",
|
|
305
|
-
onClick: this.props.onRetry,
|
|
306
|
-
className: "shrink-0 font-medium underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-destructive/50",
|
|
307
|
-
children: "Retry"
|
|
308
|
-
}
|
|
309
|
-
)
|
|
310
|
-
] }),
|
|
311
|
-
this.props.draft.trim() !== "" && /* @__PURE__ */ jsx(
|
|
312
|
-
"p",
|
|
313
|
-
{
|
|
314
|
-
"data-testid": "composer-error-held-draft",
|
|
315
|
-
className: "mt-1.5 max-h-20 overflow-y-auto whitespace-pre-wrap rounded-lg border border-destructive/30 bg-card px-2 py-1 text-foreground",
|
|
316
|
-
children: this.props.draft
|
|
317
|
-
}
|
|
318
|
-
)
|
|
319
|
-
]
|
|
320
|
-
}
|
|
321
|
-
);
|
|
283
|
+
if (!this.state.failed) return this.props.children;
|
|
284
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
285
|
+
this.props.fallback,
|
|
286
|
+
/* @__PURE__ */ jsx(
|
|
287
|
+
"div",
|
|
288
|
+
{
|
|
289
|
+
role: "alert",
|
|
290
|
+
className: "rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",
|
|
291
|
+
children: "Mentions are unavailable. You can still send."
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
] });
|
|
322
295
|
}
|
|
323
296
|
};
|
|
324
297
|
var IS_APPLE_PLATFORM = typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform);
|
|
@@ -425,6 +398,7 @@ function ChatComposer({
|
|
|
425
398
|
const isControlled = value !== void 0;
|
|
426
399
|
const [internal, setInternal] = useState2(initialValue ?? "");
|
|
427
400
|
const text = isControlled ? value : internal;
|
|
401
|
+
const MentionEditor = useMemo(createLazyMentionEditor, []);
|
|
428
402
|
const textRef = useRef2(text);
|
|
429
403
|
textRef.current = text;
|
|
430
404
|
const textareaRef = useRef2(null);
|
|
@@ -432,9 +406,6 @@ function ChatComposer({
|
|
|
432
406
|
const registerRichFocus = useCallback2((focus) => {
|
|
433
407
|
richFocusRef.current = focus;
|
|
434
408
|
}, []);
|
|
435
|
-
const [editorEpoch, setEditorEpoch] = useState2(0);
|
|
436
|
-
const MentionEditor = useMemo(createLazyMentionEditor, [editorEpoch]);
|
|
437
|
-
const [editorFailed, setEditorFailed] = useState2(false);
|
|
438
409
|
const fileInputRef = useRef2(null);
|
|
439
410
|
const folderInputRef = useRef2(null);
|
|
440
411
|
const [dragOver, setDragOver] = useState2(false);
|
|
@@ -513,9 +484,9 @@ function ChatComposer({
|
|
|
513
484
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "l") {
|
|
514
485
|
if (mentionEnabled) {
|
|
515
486
|
const focus = richFocusRef.current;
|
|
516
|
-
if (!focus) return;
|
|
517
487
|
e.preventDefault();
|
|
518
|
-
focus();
|
|
488
|
+
if (focus) focus();
|
|
489
|
+
else textareaRef.current?.focus();
|
|
519
490
|
} else {
|
|
520
491
|
e.preventDefault();
|
|
521
492
|
textareaRef.current?.focus();
|
|
@@ -528,8 +499,7 @@ function ChatComposer({
|
|
|
528
499
|
const sendableFiles = canSubmitAttachmentsOnly ? pendingFiles : pendingFiles.filter((f) => f.status === "ready");
|
|
529
500
|
const hasSendable = text.trim().length > 0 || sendableFiles.length > 0;
|
|
530
501
|
const sendBlockedByStream = isStreaming && !canSubmitWhileBusy;
|
|
531
|
-
const
|
|
532
|
-
const canSend = hasSendable && !sendBlockedByStream && !disabled && !editorInputLost;
|
|
502
|
+
const canSend = hasSendable && !sendBlockedByStream && !disabled;
|
|
533
503
|
const [failedSend, setFailedSend] = useState2(null);
|
|
534
504
|
const failSend = useCallback2(
|
|
535
505
|
(error, draft, trimmed, parts, caret) => {
|
|
@@ -574,7 +544,7 @@ function ChatComposer({
|
|
|
574
544
|
);
|
|
575
545
|
const send = useCallback2(() => {
|
|
576
546
|
const trimmed = text.trim();
|
|
577
|
-
if (sendBlockedByStream || disabled
|
|
547
|
+
if (sendBlockedByStream || disabled) return;
|
|
578
548
|
const readyFiles = pendingFiles.filter((f) => f.status === "ready");
|
|
579
549
|
const sendable = canSubmitAttachmentsOnly ? pendingFiles : readyFiles;
|
|
580
550
|
if (!trimmed && sendable.length === 0) return;
|
|
@@ -594,7 +564,6 @@ function ChatComposer({
|
|
|
594
564
|
text,
|
|
595
565
|
sendBlockedByStream,
|
|
596
566
|
disabled,
|
|
597
|
-
editorInputLost,
|
|
598
567
|
canSubmitAttachmentsOnly,
|
|
599
568
|
attachmentsNotReadyMessage,
|
|
600
569
|
onSendParts,
|
|
@@ -768,6 +737,23 @@ function ChatComposer({
|
|
|
768
737
|
const showAbove = controls != null && controlsPlacement === "above";
|
|
769
738
|
const showInline = controls != null && !showAbove;
|
|
770
739
|
const inputMinHeight = minRows * LINE_HEIGHT + TEXTAREA_PADDING_Y;
|
|
740
|
+
const textareaInput = /* @__PURE__ */ jsx(
|
|
741
|
+
"textarea",
|
|
742
|
+
{
|
|
743
|
+
ref: textareaRef,
|
|
744
|
+
value: text,
|
|
745
|
+
onChange: (e) => setText(e.target.value),
|
|
746
|
+
onKeyDown: handleKeyDown,
|
|
747
|
+
onPaste: onAttach ? handlePaste : void 0,
|
|
748
|
+
placeholder,
|
|
749
|
+
disabled,
|
|
750
|
+
autoFocus,
|
|
751
|
+
rows: minRows,
|
|
752
|
+
style: { minHeight: inputMinHeight, maxHeight },
|
|
753
|
+
"aria-label": "Message input",
|
|
754
|
+
className: "w-full resize-none bg-transparent px-1.5 py-1 text-base leading-6 text-foreground outline-none placeholder:text-muted-foreground disabled:opacity-50"
|
|
755
|
+
}
|
|
756
|
+
);
|
|
771
757
|
return /* @__PURE__ */ jsxs(
|
|
772
758
|
"div",
|
|
773
759
|
{
|
|
@@ -919,78 +905,35 @@ function ChatComposer({
|
|
|
919
905
|
className: `flex flex-col gap-1.5 rounded-2xl border border-card-edge bg-card px-3 py-2.5 transition focus-within:border-primary/40 focus-within:ring-2 focus-within:ring-primary/15 ${floating ? "shadow-raised" : ""}`,
|
|
920
906
|
children: [
|
|
921
907
|
mention ? (
|
|
922
|
-
// The
|
|
923
|
-
//
|
|
924
|
-
// doesn't jump. The boundary contains a failed load (e.g. the
|
|
925
|
-
// missing-peer error) to the input area instead of unmounting the
|
|
926
|
-
// host's region.
|
|
908
|
+
// The basic textarea stays usable through download, initialization,
|
|
909
|
+
// and failure.
|
|
927
910
|
/* @__PURE__ */ jsx(
|
|
928
911
|
MentionEditorBoundary,
|
|
929
912
|
{
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
},
|
|
934
|
-
onFailed: () => setEditorFailed(true),
|
|
935
|
-
draft: text,
|
|
936
|
-
children: /* @__PURE__ */ jsx(
|
|
937
|
-
Suspense,
|
|
913
|
+
fallback: textareaInput,
|
|
914
|
+
children: /* @__PURE__ */ jsx(Suspense, { fallback: textareaInput, children: /* @__PURE__ */ jsx(
|
|
915
|
+
MentionEditor,
|
|
938
916
|
{
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
),
|
|
952
|
-
children: /* @__PURE__ */ jsx(
|
|
953
|
-
MentionEditor,
|
|
954
|
-
{
|
|
955
|
-
value: text,
|
|
956
|
-
onChange: setText,
|
|
957
|
-
onSubmit: send,
|
|
958
|
-
placeholder,
|
|
959
|
-
disabled,
|
|
960
|
-
autoFocus,
|
|
961
|
-
minHeight: inputMinHeight,
|
|
962
|
-
maxHeight,
|
|
963
|
-
mention,
|
|
964
|
-
registerFocus: registerRichFocus,
|
|
965
|
-
onPasteFiles: onAttach ? ingestPastedFiles : void 0
|
|
966
|
-
}
|
|
967
|
-
)
|
|
917
|
+
value: text,
|
|
918
|
+
onChange: setText,
|
|
919
|
+
onSubmit: send,
|
|
920
|
+
placeholder,
|
|
921
|
+
disabled,
|
|
922
|
+
autoFocus,
|
|
923
|
+
minHeight: inputMinHeight,
|
|
924
|
+
maxHeight,
|
|
925
|
+
mention,
|
|
926
|
+
fallback: textareaInput,
|
|
927
|
+
registerFocus: registerRichFocus,
|
|
928
|
+
onPasteFiles: onAttach ? ingestPastedFiles : void 0
|
|
968
929
|
}
|
|
969
|
-
)
|
|
970
|
-
},
|
|
971
|
-
editorEpoch
|
|
972
|
-
)
|
|
973
|
-
) : (
|
|
974
|
-
// Focus: `outline-none` is safe because the card above draws the
|
|
975
|
-
// keyboard indicator through `focus-within:` — one ring for
|
|
976
|
-
// whichever input mode is mounted.
|
|
977
|
-
/* @__PURE__ */ jsx(
|
|
978
|
-
"textarea",
|
|
979
|
-
{
|
|
980
|
-
ref: textareaRef,
|
|
981
|
-
value: text,
|
|
982
|
-
onChange: (e) => setText(e.target.value),
|
|
983
|
-
onKeyDown: handleKeyDown,
|
|
984
|
-
onPaste: onAttach ? handlePaste : void 0,
|
|
985
|
-
placeholder,
|
|
986
|
-
disabled,
|
|
987
|
-
autoFocus,
|
|
988
|
-
rows: minRows,
|
|
989
|
-
style: { minHeight: inputMinHeight, maxHeight },
|
|
990
|
-
"aria-label": "Message input",
|
|
991
|
-
className: "w-full resize-none bg-transparent px-1.5 py-1 text-base leading-6 text-foreground outline-none placeholder:text-muted-foreground disabled:opacity-50"
|
|
930
|
+
) })
|
|
992
931
|
}
|
|
993
932
|
)
|
|
933
|
+
) : (
|
|
934
|
+
// The card draws the keyboard indicator through `focus-within:`, so
|
|
935
|
+
// the input does not need a second outline.
|
|
936
|
+
textareaInput
|
|
994
937
|
),
|
|
995
938
|
/* @__PURE__ */ jsxs("div", { className: "flex items-end gap-2", children: [
|
|
996
939
|
onAttach && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1894,4 +1837,4 @@ export {
|
|
|
1894
1837
|
ComposerModeControls,
|
|
1895
1838
|
EntryComposer
|
|
1896
1839
|
};
|
|
1897
|
-
//# sourceMappingURL=chunk-
|
|
1840
|
+
//# sourceMappingURL=chunk-MWEX2M6M.js.map
|