@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
@@ -190,7 +190,7 @@ const RELAY_CAPTURE_FRAME_SAMPLES = 1024;
190
190
  const RELAY_PLAYBACK_LEAD_SECONDS = 0.02;
191
191
  const MEDIA_DISCONNECT_GRACE_MS = 5e3;
192
192
  const END_BEFORE_RESTART_TIMEOUT_MS = 3e3;
193
- const mintVoiceTextId = () => `voicetext_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 12)}`;
193
+ const mintVoiceId = ({ kind }) => `voice${kind}_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 12)}`;
194
194
  const formatVoiceElapsed = (sinceMs, nowMs = Date.now()) => {
195
195
  const total = Math.max(0, Math.floor((nowMs - sinceMs) / 1e3));
196
196
  const hours = Math.floor(total / 3600);
@@ -308,6 +308,15 @@ const useDeepAgentVoice = (options = {}) => {
308
308
  const livekitRef = react.useRef(null);
309
309
  const livekitAbortRef = react.useRef(null);
310
310
  const attemptRef = react.useRef(0);
311
+ const callAttemptIdRef = react.useRef("");
312
+ const observedAttempt = reactStatewire.useStatewireState((s) => {
313
+ if (!statewireState.isDeepAgentStateHydrated(s)) return void 0;
314
+ const values = statewireState.readDeepAgentStreamValues(s);
315
+ const value = values.voiceStartFence ?? values.voiceAttemptId;
316
+ return typeof value === "string" ? value : null;
317
+ });
318
+ const observedAttemptRef = react.useRef(void 0);
319
+ if (observedAttempt !== void 0) observedAttemptRef.current = observedAttempt ?? void 0;
311
320
  const startingRef = react.useRef(false);
312
321
  const startPromiseRef = react.useRef(null);
313
322
  const autoRestartedRef = react.useRef(false);
@@ -474,6 +483,9 @@ const useDeepAgentVoice = (options = {}) => {
474
483
  const runStartSession = react.useCallback(async () => {
475
484
  var _a, _b, _c;
476
485
  const attempt = attemptRef.current += 1;
486
+ const attemptId = mintVoiceId({ kind: "attempt" });
487
+ const previousAttemptId = observedAttemptRef.current;
488
+ callAttemptIdRef.current = attemptId;
477
489
  startingRef.current = true;
478
490
  attemptStartedAtRef.current = Date.now();
479
491
  setFailure(null);
@@ -533,6 +545,8 @@ const useDeepAgentVoice = (options = {}) => {
533
545
  const sendVoiceStart = (offer2) => sendCommand({
534
546
  type: "voice/start",
535
547
  offer: offer2,
548
+ attemptId,
549
+ ...previousAttemptId !== void 0 && { previousAttemptId },
536
550
  ...model2 !== void 0 && { model: model2 }
537
551
  });
538
552
  const negotiateStart = async (offer2) => {
@@ -540,11 +554,12 @@ const useDeepAgentVoice = (options = {}) => {
540
554
  const negotiationStartedAt = Date.now();
541
555
  const commandPromise = sendVoiceStart(offer2).catch((commandError) => {
542
556
  if (!isRecoveredCommandAuthRejection(commandError)) throw commandError;
557
+ if (attemptRef.current !== attempt) throw commandError;
543
558
  return sendVoiceStart(offer2);
544
559
  });
545
560
  void commandPromise.then(() => {
546
561
  if (attemptRef.current !== attempt)
547
- void sendCommand({ type: "voice/end" }).catch(() => void 0);
562
+ void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
548
563
  }).catch(() => void 0);
549
564
  let answerTimer = null;
550
565
  let result;
@@ -607,12 +622,12 @@ const useDeepAgentVoice = (options = {}) => {
607
622
  report("room-joined", attempt, { roomName: room.roomName });
608
623
  } catch (roomError) {
609
624
  if (attemptRef.current === attempt)
610
- void sendCommand({ type: "voice/end" }).catch(() => void 0);
625
+ void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
611
626
  throw roomError;
612
627
  }
613
628
  report("live", attempt, { transport, ...model2 !== void 0 && { model: model2 } });
614
629
  if (micMutedRef.current) {
615
- void sendCommand({ type: "voice/set-mic", paused: true }).catch(() => void 0);
630
+ void sendCommand({ type: "voice/set-mic", paused: true, attemptId }).catch(() => void 0);
616
631
  }
617
632
  setPhase("live");
618
633
  setLiveSince(Date.now());
@@ -686,7 +701,7 @@ const useDeepAgentVoice = (options = {}) => {
686
701
  });
687
702
  report("live", attempt, { transport });
688
703
  if (micMutedRef.current) {
689
- void sendCommand({ type: "voice/set-mic", paused: true }).catch(() => void 0);
704
+ void sendCommand({ type: "voice/set-mic", paused: true, attemptId }).catch(() => void 0);
690
705
  }
691
706
  setPhase("live");
692
707
  setLiveSince(Date.now());
@@ -706,7 +721,7 @@ const useDeepAgentVoice = (options = {}) => {
706
721
  await ((_a2 = onRemoteStreamRef.current) == null ? void 0 : _a2.call(onRemoteStreamRef, remote));
707
722
  } catch (playError) {
708
723
  if (attemptRef.current !== attempt) return;
709
- void sendCommand({ type: "voice/end" }).catch(() => void 0);
724
+ void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
710
725
  fail({
711
726
  kind: "playback_failed",
712
727
  stage: "playback",
@@ -753,7 +768,7 @@ const useDeepAgentVoice = (options = {}) => {
753
768
  }
754
769
  report("live", attempt, { transport });
755
770
  if (micMutedRef.current) {
756
- void sendCommand({ type: "voice/set-mic", paused: true }).catch(() => void 0);
771
+ void sendCommand({ type: "voice/set-mic", paused: true, attemptId }).catch(() => void 0);
757
772
  }
758
773
  setPhase("live");
759
774
  setLiveSince(Date.now());
@@ -787,7 +802,7 @@ const useDeepAgentVoice = (options = {}) => {
787
802
  restartBudgetLeft: !autoRestartedRef.current
788
803
  });
789
804
  if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
790
- const ending = sendCommand({ type: "voice/end" }).catch(() => void 0);
805
+ const ending = sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
791
806
  teardown();
792
807
  const recovery = attemptRef.current;
793
808
  setPhase("idle");
@@ -841,7 +856,7 @@ const useDeepAgentVoice = (options = {}) => {
841
856
  const end = react.useCallback(() => {
842
857
  if (phase === "connecting" || phase === "live") {
843
858
  report("end", attemptRef.current, { source: "user", phase });
844
- void sendCommand({ type: "voice/end" }).catch(() => void 0);
859
+ void sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
845
860
  if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
846
861
  }
847
862
  teardown();
@@ -863,7 +878,7 @@ const useDeepAgentVoice = (options = {}) => {
863
878
  if (room) releaseSafely(() => room.setMicrophoneEnabled(!value));
864
879
  };
865
880
  applyLocal(muted);
866
- void sendCommand({ type: "voice/set-mic", paused: muted }).catch(() => {
881
+ void sendCommand({ type: "voice/set-mic", paused: muted, attemptId: callAttemptIdRef.current }).catch(() => {
867
882
  if (!muted && attemptRef.current === attempt && micChangeRef.current === change) {
868
883
  applyLocal(true);
869
884
  }
@@ -897,7 +912,7 @@ const useDeepAgentVoice = (options = {}) => {
897
912
  source: "unmount",
898
913
  phase: phaseAtUnmount
899
914
  });
900
- void sendCommand({ type: "voice/end" }).catch(() => void 0);
915
+ void sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
901
916
  }
902
917
  teardown();
903
918
  },
@@ -938,22 +953,22 @@ const useDeepAgentVoice = (options = {}) => {
938
953
  }, [wireModelOptions]);
939
954
  const syncProfile = react.useCallback(() => {
940
955
  if (phase !== "connecting" && phase !== "live") return;
941
- void sendCommand({ type: "voice/profile-sync" }).catch(() => void 0);
956
+ void sendCommand({ type: "voice/profile-sync", attemptId: callAttemptIdRef.current }).catch(() => void 0);
942
957
  }, [phase, sendCommand]);
943
958
  const sendContext = react.useCallback(
944
959
  (text) => {
945
960
  const trimmed = text.trim();
946
961
  if (phase !== "live" || !trimmed) return;
947
- void sendCommand({ type: "voice/context", text: trimmed }).catch(() => void 0);
962
+ void sendCommand({ type: "voice/context", text: trimmed, attemptId: callAttemptIdRef.current }).catch(() => void 0);
948
963
  },
949
964
  [phase, sendCommand]
950
965
  );
951
966
  const sendUserText = react.useCallback(
952
967
  async (text) => {
953
968
  if (phase !== "live" || !text.trim()) return false;
954
- const messageId = mintVoiceTextId();
969
+ const messageId = mintVoiceId({ kind: "text" });
955
970
  try {
956
- await sendCommand({ type: "voice/user-text", text, messageId });
971
+ await sendCommand({ type: "voice/user-text", text, messageId, attemptId: callAttemptIdRef.current });
957
972
  return true;
958
973
  } catch {
959
974
  return false;