@tangle-network/agent-app 0.43.32 → 0.43.34

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.
@@ -557,6 +557,8 @@ function ChatComposer({
557
557
  value,
558
558
  onValueChange,
559
559
  initialValue,
560
+ seed,
561
+ onSeedApplied,
560
562
  controls,
561
563
  controlsPlacement = "above",
562
564
  onAttach,
@@ -591,6 +593,31 @@ function ChatComposer({
591
593
  el.style.height = "auto";
592
594
  el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
593
595
  }, [text]);
596
+ const prevSeedRef = useRef3(null);
597
+ const pendingCaretRef = useRef3(null);
598
+ useEffect3(() => {
599
+ const prev = prevSeedRef.current;
600
+ prevSeedRef.current = seed ?? null;
601
+ if (seed == null || seed === prev || isControlled) return;
602
+ setText(seed);
603
+ onSeedApplied?.();
604
+ const el = textareaRef.current;
605
+ if (el && el.value === seed) {
606
+ el.focus();
607
+ el.setSelectionRange(seed.length, seed.length);
608
+ } else {
609
+ pendingCaretRef.current = seed;
610
+ }
611
+ }, [seed, setText, onSeedApplied, isControlled]);
612
+ useEffect3(() => {
613
+ if (pendingCaretRef.current == null || pendingCaretRef.current !== text)
614
+ return;
615
+ pendingCaretRef.current = null;
616
+ const el = textareaRef.current;
617
+ if (!el) return;
618
+ el.focus();
619
+ el.setSelectionRange(text.length, text.length);
620
+ }, [text]);
594
621
  useEffect3(() => {
595
622
  if (!focusShortcut || disabled) return;
596
623
  function onKeyDown(e) {
@@ -2606,4 +2633,4 @@ export {
2606
2633
  useThinkingSeconds,
2607
2634
  ChatMessages
2608
2635
  };
2609
- //# sourceMappingURL=chunk-FCQP75JT.js.map
2636
+ //# sourceMappingURL=chunk-4M6NUHKU.js.map