@athenaintel/react 0.42.2 → 0.43.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.
Files changed (60) hide show
  1. package/README.md +10 -0
  2. package/dist/agent-runtime/src/conversation-list-groups.d.ts +74 -0
  3. package/dist/agent-runtime/src/index.d.ts +1 -0
  4. package/dist/agent-runtime/src/tool-metadata.cjs +0 -8
  5. package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
  6. package/dist/agent-runtime/src/tool-metadata.js +0 -8
  7. package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
  8. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +30 -15
  9. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
  10. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +8 -0
  11. package/dist/agent-runtime/src/use-deep-agent-voice.js +30 -15
  12. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
  13. package/dist/chat/super-grouping/SuperGroupingCard.cjs +8 -2
  14. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  15. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +6 -1
  16. package/dist/chat/super-grouping/SuperGroupingCard.js +8 -2
  17. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  18. package/dist/chat/super-grouping/ToolTimeline.cjs +27 -0
  19. package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
  20. package/dist/chat/super-grouping/ToolTimeline.d.ts +5 -1
  21. package/dist/chat/super-grouping/ToolTimeline.js +27 -0
  22. package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
  23. package/dist/chat/super-grouping/index.d.ts +1 -0
  24. package/dist/chat/super-grouping/timeline-step.cjs +61 -2
  25. package/dist/chat/super-grouping/timeline-step.cjs.map +1 -1
  26. package/dist/chat/super-grouping/timeline-step.d.ts +13 -1
  27. package/dist/chat/super-grouping/timeline-step.js +61 -2
  28. package/dist/chat/super-grouping/timeline-step.js.map +1 -1
  29. package/dist/chat-ui/mentions/mention-chip.cjs +144 -35
  30. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  31. package/dist/chat-ui/mentions/mention-chip.d.ts +17 -1
  32. package/dist/chat-ui/mentions/mention-chip.js +146 -37
  33. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  34. package/dist/chat-ui/mentions/use-mention-asset.cjs +140 -0
  35. package/dist/chat-ui/mentions/use-mention-asset.cjs.map +1 -0
  36. package/dist/chat-ui/mentions/use-mention-asset.d.ts +16 -0
  37. package/dist/chat-ui/mentions/use-mention-asset.js +140 -0
  38. package/dist/chat-ui/mentions/use-mention-asset.js.map +1 -0
  39. package/dist/chat-ui/rich-text/chat-link.cjs +5 -4
  40. package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
  41. package/dist/chat-ui/rich-text/chat-link.d.ts +2 -3
  42. package/dist/chat-ui/rich-text/chat-link.js +6 -5
  43. package/dist/chat-ui/rich-text/chat-link.js.map +1 -1
  44. package/dist/chat-ui/rich-text/chat-node-views.cjs +1 -0
  45. package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
  46. package/dist/chat-ui/rich-text/chat-node-views.js +1 -0
  47. package/dist/chat-ui/rich-text/chat-node-views.js.map +1 -1
  48. package/dist/react/package.json.cjs +1 -1
  49. package/dist/react/package.json.js +1 -1
  50. package/dist/references/src/tool-option-schemas.d.ts +0 -34
  51. package/dist/styles.css +1 -1
  52. package/dist/threads/statewire-thread-list.cjs +6 -2
  53. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  54. package/dist/threads/statewire-thread-list.js +6 -2
  55. package/dist/threads/statewire-thread-list.js.map +1 -1
  56. package/dist/tools/tool-summary.cjs +0 -2
  57. package/dist/tools/tool-summary.cjs.map +1 -1
  58. package/dist/tools/tool-summary.js +0 -2
  59. package/dist/tools/tool-summary.js.map +1 -1
  60. package/package.json +1 -1
@@ -188,7 +188,7 @@ const RELAY_CAPTURE_FRAME_SAMPLES = 1024;
188
188
  const RELAY_PLAYBACK_LEAD_SECONDS = 0.02;
189
189
  const MEDIA_DISCONNECT_GRACE_MS = 5e3;
190
190
  const END_BEFORE_RESTART_TIMEOUT_MS = 3e3;
191
- const mintVoiceTextId = () => `voicetext_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 12)}`;
191
+ const mintVoiceId = ({ kind }) => `voice${kind}_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 12)}`;
192
192
  const formatVoiceElapsed = (sinceMs, nowMs = Date.now()) => {
193
193
  const total = Math.max(0, Math.floor((nowMs - sinceMs) / 1e3));
194
194
  const hours = Math.floor(total / 3600);
@@ -306,6 +306,15 @@ const useDeepAgentVoice = (options = {}) => {
306
306
  const livekitRef = useRef(null);
307
307
  const livekitAbortRef = useRef(null);
308
308
  const attemptRef = useRef(0);
309
+ const callAttemptIdRef = useRef("");
310
+ const observedAttempt = useStatewireState((s) => {
311
+ if (!isDeepAgentStateHydrated(s)) return void 0;
312
+ const values = readDeepAgentStreamValues(s);
313
+ const value = values.voiceStartFence ?? values.voiceAttemptId;
314
+ return typeof value === "string" ? value : null;
315
+ });
316
+ const observedAttemptRef = useRef(void 0);
317
+ if (observedAttempt !== void 0) observedAttemptRef.current = observedAttempt ?? void 0;
309
318
  const startingRef = useRef(false);
310
319
  const startPromiseRef = useRef(null);
311
320
  const autoRestartedRef = useRef(false);
@@ -472,6 +481,9 @@ const useDeepAgentVoice = (options = {}) => {
472
481
  const runStartSession = useCallback(async () => {
473
482
  var _a, _b, _c;
474
483
  const attempt = attemptRef.current += 1;
484
+ const attemptId = mintVoiceId({ kind: "attempt" });
485
+ const previousAttemptId = observedAttemptRef.current;
486
+ callAttemptIdRef.current = attemptId;
475
487
  startingRef.current = true;
476
488
  attemptStartedAtRef.current = Date.now();
477
489
  setFailure(null);
@@ -531,6 +543,8 @@ const useDeepAgentVoice = (options = {}) => {
531
543
  const sendVoiceStart = (offer2) => sendCommand({
532
544
  type: "voice/start",
533
545
  offer: offer2,
546
+ attemptId,
547
+ ...previousAttemptId !== void 0 && { previousAttemptId },
534
548
  ...model2 !== void 0 && { model: model2 }
535
549
  });
536
550
  const negotiateStart = async (offer2) => {
@@ -538,11 +552,12 @@ const useDeepAgentVoice = (options = {}) => {
538
552
  const negotiationStartedAt = Date.now();
539
553
  const commandPromise = sendVoiceStart(offer2).catch((commandError) => {
540
554
  if (!isRecoveredCommandAuthRejection(commandError)) throw commandError;
555
+ if (attemptRef.current !== attempt) throw commandError;
541
556
  return sendVoiceStart(offer2);
542
557
  });
543
558
  void commandPromise.then(() => {
544
559
  if (attemptRef.current !== attempt)
545
- void sendCommand({ type: "voice/end" }).catch(() => void 0);
560
+ void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
546
561
  }).catch(() => void 0);
547
562
  let answerTimer = null;
548
563
  let result;
@@ -605,12 +620,12 @@ const useDeepAgentVoice = (options = {}) => {
605
620
  report("room-joined", attempt, { roomName: room.roomName });
606
621
  } catch (roomError) {
607
622
  if (attemptRef.current === attempt)
608
- void sendCommand({ type: "voice/end" }).catch(() => void 0);
623
+ void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
609
624
  throw roomError;
610
625
  }
611
626
  report("live", attempt, { transport, ...model2 !== void 0 && { model: model2 } });
612
627
  if (micMutedRef.current) {
613
- void sendCommand({ type: "voice/set-mic", paused: true }).catch(() => void 0);
628
+ void sendCommand({ type: "voice/set-mic", paused: true, attemptId }).catch(() => void 0);
614
629
  }
615
630
  setPhase("live");
616
631
  setLiveSince(Date.now());
@@ -684,7 +699,7 @@ const useDeepAgentVoice = (options = {}) => {
684
699
  });
685
700
  report("live", attempt, { transport });
686
701
  if (micMutedRef.current) {
687
- void sendCommand({ type: "voice/set-mic", paused: true }).catch(() => void 0);
702
+ void sendCommand({ type: "voice/set-mic", paused: true, attemptId }).catch(() => void 0);
688
703
  }
689
704
  setPhase("live");
690
705
  setLiveSince(Date.now());
@@ -704,7 +719,7 @@ const useDeepAgentVoice = (options = {}) => {
704
719
  await ((_a2 = onRemoteStreamRef.current) == null ? void 0 : _a2.call(onRemoteStreamRef, remote));
705
720
  } catch (playError) {
706
721
  if (attemptRef.current !== attempt) return;
707
- void sendCommand({ type: "voice/end" }).catch(() => void 0);
722
+ void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
708
723
  fail({
709
724
  kind: "playback_failed",
710
725
  stage: "playback",
@@ -751,7 +766,7 @@ const useDeepAgentVoice = (options = {}) => {
751
766
  }
752
767
  report("live", attempt, { transport });
753
768
  if (micMutedRef.current) {
754
- void sendCommand({ type: "voice/set-mic", paused: true }).catch(() => void 0);
769
+ void sendCommand({ type: "voice/set-mic", paused: true, attemptId }).catch(() => void 0);
755
770
  }
756
771
  setPhase("live");
757
772
  setLiveSince(Date.now());
@@ -785,7 +800,7 @@ const useDeepAgentVoice = (options = {}) => {
785
800
  restartBudgetLeft: !autoRestartedRef.current
786
801
  });
787
802
  if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
788
- const ending = sendCommand({ type: "voice/end" }).catch(() => void 0);
803
+ const ending = sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
789
804
  teardown();
790
805
  const recovery = attemptRef.current;
791
806
  setPhase("idle");
@@ -839,7 +854,7 @@ const useDeepAgentVoice = (options = {}) => {
839
854
  const end = useCallback(() => {
840
855
  if (phase === "connecting" || phase === "live") {
841
856
  report("end", attemptRef.current, { source: "user", phase });
842
- void sendCommand({ type: "voice/end" }).catch(() => void 0);
857
+ void sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
843
858
  if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
844
859
  }
845
860
  teardown();
@@ -861,7 +876,7 @@ const useDeepAgentVoice = (options = {}) => {
861
876
  if (room) releaseSafely(() => room.setMicrophoneEnabled(!value));
862
877
  };
863
878
  applyLocal(muted);
864
- void sendCommand({ type: "voice/set-mic", paused: muted }).catch(() => {
879
+ void sendCommand({ type: "voice/set-mic", paused: muted, attemptId: callAttemptIdRef.current }).catch(() => {
865
880
  if (!muted && attemptRef.current === attempt && micChangeRef.current === change) {
866
881
  applyLocal(true);
867
882
  }
@@ -895,7 +910,7 @@ const useDeepAgentVoice = (options = {}) => {
895
910
  source: "unmount",
896
911
  phase: phaseAtUnmount
897
912
  });
898
- void sendCommand({ type: "voice/end" }).catch(() => void 0);
913
+ void sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
899
914
  }
900
915
  teardown();
901
916
  },
@@ -936,22 +951,22 @@ const useDeepAgentVoice = (options = {}) => {
936
951
  }, [wireModelOptions]);
937
952
  const syncProfile = useCallback(() => {
938
953
  if (phase !== "connecting" && phase !== "live") return;
939
- void sendCommand({ type: "voice/profile-sync" }).catch(() => void 0);
954
+ void sendCommand({ type: "voice/profile-sync", attemptId: callAttemptIdRef.current }).catch(() => void 0);
940
955
  }, [phase, sendCommand]);
941
956
  const sendContext = useCallback(
942
957
  (text) => {
943
958
  const trimmed = text.trim();
944
959
  if (phase !== "live" || !trimmed) return;
945
- void sendCommand({ type: "voice/context", text: trimmed }).catch(() => void 0);
960
+ void sendCommand({ type: "voice/context", text: trimmed, attemptId: callAttemptIdRef.current }).catch(() => void 0);
946
961
  },
947
962
  [phase, sendCommand]
948
963
  );
949
964
  const sendUserText = useCallback(
950
965
  async (text) => {
951
966
  if (phase !== "live" || !text.trim()) return false;
952
- const messageId = mintVoiceTextId();
967
+ const messageId = mintVoiceId({ kind: "text" });
953
968
  try {
954
- await sendCommand({ type: "voice/user-text", text, messageId });
969
+ await sendCommand({ type: "voice/user-text", text, messageId, attemptId: callAttemptIdRef.current });
955
970
  return true;
956
971
  } catch {
957
972
  return false;