@athenaintel/react 0.48.0 → 0.52.1
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 +68 -10
- package/dist/agent-runtime/src/call-recap.cjs +319 -0
- package/dist/agent-runtime/src/call-recap.cjs.map +1 -0
- package/dist/agent-runtime/src/call-recap.d.ts +142 -0
- package/dist/agent-runtime/src/call-recap.js +319 -0
- package/dist/agent-runtime/src/call-recap.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.cjs +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-store.d.ts +7 -0
- package/dist/agent-runtime/src/chat-outbox-store.js +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.cjs +46 -5
- package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.d.ts +29 -0
- package/dist/agent-runtime/src/chat-outbox.js +46 -5
- package/dist/agent-runtime/src/chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/conversation-index.cjs.map +1 -1
- package/dist/agent-runtime/src/conversation-index.d.ts +7 -0
- package/dist/agent-runtime/src/conversation-index.js.map +1 -1
- package/dist/agent-runtime/src/conversation-list.cjs +2 -1
- package/dist/agent-runtime/src/conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/conversation-list.d.ts +19 -3
- package/dist/agent-runtime/src/conversation-list.js +2 -1
- package/dist/agent-runtime/src/conversation-list.js.map +1 -1
- package/dist/agent-runtime/src/desktop-handoff.d.ts +10 -0
- package/dist/agent-runtime/src/edit-command.cjs +21 -0
- package/dist/agent-runtime/src/edit-command.cjs.map +1 -1
- package/dist/agent-runtime/src/edit-command.d.ts +8 -0
- package/dist/agent-runtime/src/edit-command.js +21 -0
- package/dist/agent-runtime/src/edit-command.js.map +1 -1
- package/dist/agent-runtime/src/handoff-arrival.cjs +19 -0
- package/dist/agent-runtime/src/handoff-arrival.cjs.map +1 -1
- package/dist/agent-runtime/src/handoff-arrival.d.ts +18 -3
- package/dist/agent-runtime/src/handoff-arrival.js +20 -1
- package/dist/agent-runtime/src/handoff-arrival.js.map +1 -1
- package/dist/agent-runtime/src/handoff-cursor-id.cjs +6 -0
- package/dist/agent-runtime/src/handoff-cursor-id.cjs.map +1 -0
- package/dist/agent-runtime/src/handoff-cursor-id.d.ts +12 -0
- package/dist/agent-runtime/src/handoff-cursor-id.js +6 -0
- package/dist/agent-runtime/src/handoff-cursor-id.js.map +1 -0
- package/dist/agent-runtime/src/handoff-cursor.cjs +88 -0
- package/dist/agent-runtime/src/handoff-cursor.cjs.map +1 -0
- package/dist/agent-runtime/src/handoff-cursor.d.ts +120 -0
- package/dist/agent-runtime/src/handoff-cursor.js +88 -0
- package/dist/agent-runtime/src/handoff-cursor.js.map +1 -0
- package/dist/agent-runtime/src/index.d.ts +9 -7
- package/dist/agent-runtime/src/interrupts.cjs +28 -1
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/agent-runtime/src/interrupts.d.ts +21 -1
- package/dist/agent-runtime/src/interrupts.js +28 -1
- package/dist/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/agent-runtime/src/model-context.cjs +3 -2
- package/dist/agent-runtime/src/model-context.cjs.map +1 -1
- package/dist/agent-runtime/src/model-context.d.ts +6 -1
- package/dist/agent-runtime/src/model-context.js +3 -2
- package/dist/agent-runtime/src/model-context.js.map +1 -1
- package/dist/agent-runtime/src/runtime.d.ts +3 -2
- package/dist/agent-runtime/src/send-recovery.cjs +37 -3
- package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
- package/dist/agent-runtime/src/send-recovery.d.ts +19 -0
- package/dist/agent-runtime/src/send-recovery.js +37 -3
- package/dist/agent-runtime/src/send-recovery.js.map +1 -1
- package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +14 -8
- package/dist/agent-runtime/src/thread-handoff-protocol.d.ts +227 -5
- package/dist/agent-runtime/src/thread-handoff.d.ts +1 -1
- package/dist/agent-runtime/src/use-conversation-list.cjs +3 -2
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/use-conversation-list.d.ts +6 -0
- package/dist/agent-runtime/src/use-conversation-list.js +3 -2
- package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +21 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +8 -2
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +21 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +24 -6
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +17 -0
- package/dist/agent-runtime/src/use-deep-agent-runtime.js +24 -6
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +44 -9
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +34 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.js +44 -9
- package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs +8 -3
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +7 -0
- package/dist/agent-runtime/src/use-deep-agent-window-sync.js +9 -4
- package/dist/agent-runtime/src/use-deep-agent-window-sync.js.map +1 -1
- package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +13 -2
- package/dist/agent-runtime/src/voice-earcon.cjs +139 -0
- package/dist/agent-runtime/src/voice-earcon.cjs.map +1 -0
- package/dist/agent-runtime/src/voice-earcon.d.ts +38 -0
- package/dist/agent-runtime/src/voice-earcon.js +139 -0
- package/dist/agent-runtime/src/voice-earcon.js.map +1 -0
- package/dist/agent-runtime/src/voice-media.cjs.map +1 -1
- package/dist/agent-runtime/src/voice-media.d.ts +14 -0
- package/dist/agent-runtime/src/voice-media.js.map +1 -1
- package/dist/agent-runtime/src/voice-presentation.cjs +2 -0
- package/dist/agent-runtime/src/voice-presentation.cjs.map +1 -1
- package/dist/agent-runtime/src/voice-presentation.js +2 -0
- package/dist/agent-runtime/src/voice-presentation.js.map +1 -1
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +11 -5
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/use-asset-embed.cjs.map +1 -1
- package/dist/assets/use-asset-embed.d.ts +12 -5
- package/dist/assets/use-asset-embed.js.map +1 -1
- package/dist/chat/AthenaChat.cjs +27 -12
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +13 -0
- package/dist/chat/AthenaChat.js +27 -12
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/AthenaPlanStrip.cjs +97 -0
- package/dist/chat/AthenaPlanStrip.cjs.map +1 -0
- package/dist/chat/AthenaPlanStrip.d.ts +15 -0
- package/dist/chat/AthenaPlanStrip.js +97 -0
- package/dist/chat/AthenaPlanStrip.js.map +1 -0
- package/dist/chat/StatewireApprovalCard.cjs +41 -6
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +18 -1
- package/dist/chat/StatewireApprovalCard.js +42 -7
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +56 -6
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +14 -0
- package/dist/chat/StatewireQueuedMessages.js +58 -8
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/WaitingOnYouBanner.cjs +6 -2
- package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
- package/dist/chat/WaitingOnYouBanner.js +7 -3
- package/dist/chat/WaitingOnYouBanner.js.map +1 -1
- package/dist/chat/chat-voice-controls.cjs +3 -1
- package/dist/chat/chat-voice-controls.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.d.ts +6 -1
- package/dist/chat/chat-voice-controls.js +3 -1
- package/dist/chat/chat-voice-controls.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +4 -2
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.js +4 -2
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +4 -2
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.js +4 -2
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +6 -4
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +9 -1
- package/dist/chat/super-grouping/activity-timeline.js +6 -4
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/super-grouping/index.d.ts +1 -1
- package/dist/chat/super-grouping/use-earlier-steps-unloaded.cjs +17 -0
- package/dist/chat/super-grouping/use-earlier-steps-unloaded.cjs.map +1 -0
- package/dist/chat/super-grouping/use-earlier-steps-unloaded.d.ts +8 -0
- package/dist/chat/super-grouping/use-earlier-steps-unloaded.js +17 -0
- package/dist/chat/super-grouping/use-earlier-steps-unloaded.js.map +1 -0
- package/dist/chat-ui/index.cjs +11 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +3 -1
- package/dist/chat-ui/index.js +12 -1
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/messages/from-the-call-card.cjs +124 -0
- package/dist/chat-ui/messages/from-the-call-card.cjs.map +1 -0
- package/dist/chat-ui/messages/from-the-call-card.d.ts +17 -0
- package/dist/chat-ui/messages/from-the-call-card.js +124 -0
- package/dist/chat-ui/messages/from-the-call-card.js.map +1 -0
- package/dist/chat-ui/rich-text/chat-link.cjs +1 -0
- package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-link.d.ts +4 -0
- package/dist/chat-ui/rich-text/chat-link.js +4 -3
- package/dist/chat-ui/rich-text/chat-link.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.cjs +1 -0
- package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.d.ts +12 -0
- package/dist/chat-ui/rich-text/chat-message-body.js +2 -1
- package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.cjs +4 -0
- package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.d.ts +4 -0
- package/dist/chat-ui/thread/chat-thread-shell.js +4 -0
- package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -1
- package/dist/chat-ui/thread/handoff-cursor.cjs +216 -0
- package/dist/chat-ui/thread/handoff-cursor.cjs.map +1 -0
- package/dist/chat-ui/thread/handoff-cursor.d.ts +57 -0
- package/dist/chat-ui/thread/handoff-cursor.js +216 -0
- package/dist/chat-ui/thread/handoff-cursor.js.map +1 -0
- package/dist/chat-ui/thread/statewire-history-edge.cjs +2 -0
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.d.ts +2 -0
- package/dist/chat-ui/thread/statewire-history-edge.js +3 -1
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/collab/client.cjs +15 -3
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +4 -2
- package/dist/collab/client.js +16 -4
- package/dist/collab/client.js.map +1 -1
- package/dist/composer/index.d.ts +1 -1
- package/dist/composer/useReadComposerDraft.cjs +26 -7
- package/dist/composer/useReadComposerDraft.cjs.map +1 -1
- package/dist/composer/useReadComposerDraft.d.ts +23 -1
- package/dist/composer/useReadComposerDraft.js +27 -8
- package/dist/composer/useReadComposerDraft.js.map +1 -1
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/keryx-http/src/unconfirmed-update-attributions.cjs +207 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.cjs.map +1 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.d.ts +141 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.js +207 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.js.map +1 -0
- package/dist/keryx-http/src/update-attributions.cjs +34 -4
- package/dist/keryx-http/src/update-attributions.cjs.map +1 -1
- package/dist/keryx-http/src/update-attributions.d.ts +36 -4
- package/dist/keryx-http/src/update-attributions.js +35 -5
- package/dist/keryx-http/src/update-attributions.js.map +1 -1
- package/dist/provider/AthenaProvider.cjs +4 -0
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +11 -1
- package/dist/provider/AthenaProvider.js +4 -0
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/threads/api.cjs.map +1 -1
- package/dist/threads/api.d.ts +15 -0
- package/dist/threads/api.js.map +1 -1
- package/dist/threads/conversation-list-fetcher.cjs +13 -5
- package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
- package/dist/threads/conversation-list-fetcher.d.ts +4 -1
- package/dist/threads/conversation-list-fetcher.js +13 -5
- package/dist/threads/conversation-list-fetcher.js.map +1 -1
- package/dist/threads/statewire-thread-list.cjs +28 -6
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +20 -8
- package/dist/threads/statewire-thread-list.js +28 -6
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/use-athena-sessions.cjs +27 -5
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.d.ts +10 -5
- package/dist/threads/use-athena-sessions.js +28 -6
- package/dist/threads/use-athena-sessions.js.map +1 -1
- package/dist/threads/use-rest-conversation-history.d.ts +1 -0
- package/dist/tools/write-todos-tool-ui.cjs +8 -0
- package/dist/tools/write-todos-tool-ui.cjs.map +1 -1
- package/dist/tools/write-todos-tool-ui.d.ts +2 -0
- package/dist/tools/write-todos-tool-ui.js +8 -0
- package/dist/tools/write-todos-tool-ui.js.map +1 -1
- package/dist/workbench/session-workbench-panes.cjs +1 -8
- package/dist/workbench/session-workbench-panes.cjs.map +1 -1
- package/dist/workbench/session-workbench-panes.js +2 -9
- package/dist/workbench/session-workbench-panes.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { VoiceMediaEvent } from './voice-media';
|
|
1
2
|
import type { DeepAgentVoiceOwnerWireState, DeepAgentVoiceSurface, DeepAgentVoiceWireError } from './voice-wire-types';
|
|
2
3
|
export type { DeepAgentVoiceOwnerWireState, DeepAgentVoiceSurface, DeepAgentVoiceTransferWireState, } from './voice-wire-types';
|
|
4
|
+
export { playVoiceMoveEarcon, VOICE_MOVE_EARCON_MS, VOICE_MOVE_EARCON_PEAK, VOICE_MOVE_EARCON_SAMPLE_RATE, voiceMoveEarconDataUri, voiceMoveEarconSamples, voiceMoveEarconWav, } from './voice-earcon';
|
|
3
5
|
declare module '@assistant-ui/core' {
|
|
4
6
|
namespace Assistant {
|
|
5
7
|
interface Commands {
|
|
@@ -180,7 +182,13 @@ export interface DeepAgentVoiceFailure {
|
|
|
180
182
|
*/
|
|
181
183
|
export type DeepAgentVoiceDiagnosticEvent = 'start-requested' | 'audio-session-ready' | 'microphone-captured' | 'offer-ready' | 'ice-gathering-timeout' | 'answer-received' | 'room-joined' | 'live' | 'media-state' | 'media-loss' | 'auto-restart' | 'server-ended' | 'end' | 'error' | 'stale-attempt'
|
|
182
184
|
/** The live call moved to another of the person's devices; this client let go of it. */
|
|
183
|
-
| 'moved'
|
|
185
|
+
| 'moved'
|
|
186
|
+
/**
|
|
187
|
+
* The platform's room reported something about the call's media (the
|
|
188
|
+
* adapter's `onEvent`): `data.type` names it — a reconnect, the agent
|
|
189
|
+
* leaving, connection quality, an audio-quality sample or summary.
|
|
190
|
+
*/
|
|
191
|
+
| 'media-event';
|
|
184
192
|
export interface DeepAgentVoiceDiagnostic {
|
|
185
193
|
event: DeepAgentVoiceDiagnosticEvent;
|
|
186
194
|
attempt: number;
|
|
@@ -277,6 +285,11 @@ export interface DeepAgentVoiceLiveKitAdapter {
|
|
|
277
285
|
/** Abort a pending join and release media when this attempt ends. */
|
|
278
286
|
signal?: AbortSignal;
|
|
279
287
|
onDisconnected: (reason: string) => void;
|
|
288
|
+
/**
|
|
289
|
+
* Media telemetry while the room lasts (reconnects, the agent leaving,
|
|
290
|
+
* audio quality); reported as `media-event` diagnostics. Optional.
|
|
291
|
+
*/
|
|
292
|
+
onEvent?: (event: VoiceMediaEvent) => void;
|
|
280
293
|
}): Promise<DeepAgentVoiceLiveKitSession>;
|
|
281
294
|
}
|
|
282
295
|
/** One realtime model the host offers for voice sessions (`state.voiceModelOptions`). */
|
|
@@ -355,6 +368,13 @@ export declare const voiceRelayUrl: (relayUrl: string, ticket: string) => string
|
|
|
355
368
|
export declare const pcm16FromFloat32: (samples: Float32Array) => Int16Array;
|
|
356
369
|
/** PCM16 → Float32 samples in [-1, 1] for Web Audio playback. */
|
|
357
370
|
export declare const float32FromPcm16: (pcm: Int16Array) => Float32Array;
|
|
371
|
+
/** A call this device held or took moving between the person's own devices; see `onCallMoved`. */
|
|
372
|
+
export interface DeepAgentVoiceCallMove {
|
|
373
|
+
/** `here`: this device now holds the call. `away`: the call left this device. */
|
|
374
|
+
direction: 'here' | 'away';
|
|
375
|
+
/** The other device: where the call came from (`here`) or went (`away`). */
|
|
376
|
+
surface: DeepAgentVoiceSurface;
|
|
377
|
+
}
|
|
358
378
|
export interface UseDeepAgentVoiceOptions {
|
|
359
379
|
/**
|
|
360
380
|
* Remote-audio sink: called with the remote stream when the session answers
|
|
@@ -405,6 +425,19 @@ export interface UseDeepAgentVoiceOptions {
|
|
|
405
425
|
* fresh closure never restarts anything. Must not throw.
|
|
406
426
|
*/
|
|
407
427
|
onDiagnostic?: (entry: DeepAgentVoiceDiagnostic) => void;
|
|
428
|
+
/**
|
|
429
|
+
* Called when this device's call moves between the person's own devices:
|
|
430
|
+
* `here` once {@link UseDeepAgentVoiceReturn.transferHere} took the call
|
|
431
|
+
* (it is live here), `away` when the host moved it to another device
|
|
432
|
+
* (alongside `movedTo`). Hosts play the move earcon from it
|
|
433
|
+
* ({@link playVoiceMoveEarcon} on the web). For `away` it runs before the
|
|
434
|
+
* hook lets go of the call's platform audio session, which it then releases
|
|
435
|
+
* at once (`audioSession.stop`): a host that plays the cue inside that
|
|
436
|
+
* session holds the session's stop itself, in its shared session queue, so
|
|
437
|
+
* a chat started meanwhile waits rather than finds the session taken. Read
|
|
438
|
+
* through a per-render ref; a throw or a rejected promise is ignored.
|
|
439
|
+
*/
|
|
440
|
+
onCallMoved?: (move: DeepAgentVoiceCallMove) => void | Promise<void>;
|
|
408
441
|
/** Per-surface overrides of the negotiation deadlines (ms). */
|
|
409
442
|
timeouts?: {
|
|
410
443
|
/** How long to wait for ICE gathering to complete before sending the offer with the candidates so far. */
|
|
@@ -419,6 +419,8 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
419
419
|
modelRef.current = options.model;
|
|
420
420
|
const onDiagnosticRef = useRef(options.onDiagnostic);
|
|
421
421
|
onDiagnosticRef.current = options.onDiagnostic;
|
|
422
|
+
const onCallMovedRef = useRef(options.onCallMoved);
|
|
423
|
+
onCallMovedRef.current = options.onCallMoved;
|
|
422
424
|
const timeoutsRef = useRef(options.timeouts);
|
|
423
425
|
timeoutsRef.current = options.timeouts;
|
|
424
426
|
const phaseRef = useRef("idle");
|
|
@@ -495,7 +497,15 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
495
497
|
activeAudioSessionRef.current = null;
|
|
496
498
|
audioSessionIdleRef.current = audioSessionIdleRef.current.then(() => session.stop()).catch(() => void 0);
|
|
497
499
|
}, []);
|
|
498
|
-
const
|
|
500
|
+
const notifyCallMoved = useCallback((move) => {
|
|
501
|
+
const observer = onCallMovedRef.current;
|
|
502
|
+
if (!observer) return;
|
|
503
|
+
try {
|
|
504
|
+
void Promise.resolve(observer(move)).catch(() => void 0);
|
|
505
|
+
} catch {
|
|
506
|
+
}
|
|
507
|
+
}, []);
|
|
508
|
+
const teardown = useCallback((options2) => {
|
|
499
509
|
attemptRef.current += 1;
|
|
500
510
|
const livekitAbort = livekitAbortRef.current;
|
|
501
511
|
livekitAbortRef.current = null;
|
|
@@ -504,7 +514,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
504
514
|
var _a, _b;
|
|
505
515
|
return (_b = (_a = startingAudioSessionRef.current) == null ? void 0 : _a.cancelStart) == null ? void 0 : _b.call(_a);
|
|
506
516
|
});
|
|
507
|
-
releaseAudioSession();
|
|
517
|
+
if ((options2 == null ? void 0 : options2.keepAudioSession) !== true) releaseAudioSession();
|
|
508
518
|
const releasePeerListeners = releasePeerListenersRef.current;
|
|
509
519
|
releasePeerListenersRef.current = null;
|
|
510
520
|
releaseSafely(() => releasePeerListeners == null ? void 0 : releasePeerListeners());
|
|
@@ -556,6 +566,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
556
566
|
var _a;
|
|
557
567
|
const surface = ((_a = voiceOwnerRef.current) == null ? void 0 : _a.surface) ?? "web";
|
|
558
568
|
report("moved", attemptRef.current, { toSurface: surface });
|
|
569
|
+
notifyCallMoved({ direction: "away", surface });
|
|
559
570
|
teardown();
|
|
560
571
|
ownClientIdRef.current = null;
|
|
561
572
|
micMutedRef.current = false;
|
|
@@ -564,7 +575,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
564
575
|
setFailure(null);
|
|
565
576
|
setPhase("idle");
|
|
566
577
|
setMovedTo({ surface });
|
|
567
|
-
}, [report, teardown]);
|
|
578
|
+
}, [notifyCallMoved, report, teardown]);
|
|
568
579
|
const ownerMovedAway = useCallback(() => {
|
|
569
580
|
const own = ownClientIdRef.current;
|
|
570
581
|
const current = wireOwnerIdRef.current;
|
|
@@ -575,11 +586,17 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
575
586
|
attempt,
|
|
576
587
|
audioSession
|
|
577
588
|
}) => {
|
|
589
|
+
const held = activeAudioSessionRef.current;
|
|
590
|
+
if (held !== null && held !== audioSession) releaseAudioSession();
|
|
578
591
|
await audioSessionIdleRef.current;
|
|
579
592
|
if (attemptRef.current !== attempt) {
|
|
580
593
|
report("stale-attempt", attempt, { stage: "audio-session" });
|
|
581
594
|
return false;
|
|
582
595
|
}
|
|
596
|
+
if (activeAudioSessionRef.current === audioSession) {
|
|
597
|
+
report("audio-session-ready", attempt, { reused: true });
|
|
598
|
+
return true;
|
|
599
|
+
}
|
|
583
600
|
startingAudioSessionRef.current = audioSession;
|
|
584
601
|
try {
|
|
585
602
|
await audioSession.start();
|
|
@@ -618,6 +635,11 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
618
635
|
return;
|
|
619
636
|
}
|
|
620
637
|
onDisconnectedAfterJoin(reason);
|
|
638
|
+
},
|
|
639
|
+
// Telemetry about this attempt's room stays this attempt's even after
|
|
640
|
+
// it ended: the room's closing summary arrives after teardown.
|
|
641
|
+
onEvent: (event) => {
|
|
642
|
+
report("media-event", attempt, { ...event.data, type: event.type });
|
|
621
643
|
}
|
|
622
644
|
});
|
|
623
645
|
if (attemptRef.current !== attempt) {
|
|
@@ -995,13 +1017,14 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
995
1017
|
handleMovedAway();
|
|
996
1018
|
return;
|
|
997
1019
|
}
|
|
1020
|
+
const restarting = !autoRestartedRef.current;
|
|
998
1021
|
report("media-loss", attempt, {
|
|
999
1022
|
reason,
|
|
1000
|
-
restartBudgetLeft:
|
|
1023
|
+
restartBudgetLeft: restarting
|
|
1001
1024
|
});
|
|
1002
1025
|
if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
|
|
1003
1026
|
const ending = sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
|
|
1004
|
-
teardown();
|
|
1027
|
+
teardown({ keepAudioSession: restarting });
|
|
1005
1028
|
const recovery = attemptRef.current;
|
|
1006
1029
|
setPhase("idle");
|
|
1007
1030
|
let endTimer;
|
|
@@ -1057,6 +1080,8 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
1057
1080
|
await startSession((options2 == null ? void 0 : options2.opening) === "recap" ? { opening: "recap" } : {});
|
|
1058
1081
|
}, [startSession]);
|
|
1059
1082
|
const runTransferHere = useCallback(async () => {
|
|
1083
|
+
var _a;
|
|
1084
|
+
const fromSurface = ((_a = liveElsewhereRef.current) == null ? void 0 : _a.surface) ?? "web";
|
|
1060
1085
|
const attempt = attemptRef.current += 1;
|
|
1061
1086
|
const attemptId = mintVoiceId({ kind: "attempt" });
|
|
1062
1087
|
callAttemptIdRef.current = attemptId;
|
|
@@ -1183,6 +1208,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
1183
1208
|
report("live", attempt, { transport: "livekit", transfer: true });
|
|
1184
1209
|
setPhase("live");
|
|
1185
1210
|
setLiveSince(Date.now());
|
|
1211
|
+
notifyCallMoved({ direction: "here", surface: fromSurface });
|
|
1186
1212
|
} catch (transferError) {
|
|
1187
1213
|
if (attemptRef.current !== attempt) {
|
|
1188
1214
|
stale();
|
|
@@ -1197,7 +1223,15 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
1197
1223
|
} finally {
|
|
1198
1224
|
startingRef.current = false;
|
|
1199
1225
|
}
|
|
1200
|
-
}, [
|
|
1226
|
+
}, [
|
|
1227
|
+
acquireAudioSession,
|
|
1228
|
+
fail,
|
|
1229
|
+
joinVoiceRoom,
|
|
1230
|
+
notifyCallMoved,
|
|
1231
|
+
releaseAudioSession,
|
|
1232
|
+
report,
|
|
1233
|
+
sendCommand
|
|
1234
|
+
]);
|
|
1201
1235
|
const transferHere = useCallback(async () => {
|
|
1202
1236
|
if (pcRef.current || wsRef.current || livekitRef.current || startingRef.current) return;
|
|
1203
1237
|
if (liveElsewhereRef.current === null) return;
|
|
@@ -1285,13 +1319,14 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
1285
1319
|
useEffect(() => {
|
|
1286
1320
|
var _a;
|
|
1287
1321
|
if (phase !== "live" || !sessionGone) return;
|
|
1322
|
+
const restarting = !autoRestartedRef.current;
|
|
1288
1323
|
report("server-ended", attemptRef.current, {
|
|
1289
|
-
restartBudgetLeft:
|
|
1324
|
+
restartBudgetLeft: restarting
|
|
1290
1325
|
});
|
|
1291
1326
|
if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
|
|
1292
|
-
teardown();
|
|
1327
|
+
teardown({ keepAudioSession: restarting });
|
|
1293
1328
|
setPhase("idle");
|
|
1294
|
-
if (
|
|
1329
|
+
if (restarting) {
|
|
1295
1330
|
autoRestartedRef.current = true;
|
|
1296
1331
|
report("auto-restart", attemptRef.current, { trigger: "server-ended" });
|
|
1297
1332
|
void ((_a = startRef.current) == null ? void 0 : _a.call(startRef));
|