@livekit/components-react
Advanced tools
Comparing version 2.5.4 to 2.6.0
@@ -8,2 +8,3 @@ export * from './controls/ClearPinButton'; | ||
export * from './controls/StartAudio'; | ||
export * from './controls/StartMediaButton'; | ||
export * from './controls/TrackToggle'; | ||
@@ -10,0 +11,0 @@ export * from './layout'; |
@@ -1,3 +0,3 @@ | ||
import type { VoiceAssistantState } from '../../../hooks'; | ||
export declare const useBarAnimator: (state: VoiceAssistantState | undefined, columns: number, interval: number) => number[]; | ||
import type { AgentState } from '../../../hooks'; | ||
export declare const useBarAnimator: (state: AgentState | undefined, columns: number, interval: number) => number[]; | ||
//# sourceMappingURL=useBarAnimator.d.ts.map |
import * as React from 'react'; | ||
import { type VoiceAssistantState } from '../../hooks'; | ||
import { type AgentState } from '../../hooks'; | ||
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core'; | ||
@@ -18,3 +18,3 @@ /** | ||
/** If set, the visualizer will transition between different voice assistant states */ | ||
state?: VoiceAssistantState; | ||
state?: AgentState; | ||
/** Number of bars that show up in the visualizer */ | ||
@@ -21,0 +21,0 @@ barCount?: number; |
@@ -9,3 +9,2 @@ export {} from './chat-context'; | ||
export { FeatureFlags, useFeatureContext, LKFeatureContext } from './feature-context'; | ||
export { VoiceAssistantContext } from './voice-assistant-context'; | ||
//# sourceMappingURL=index.d.ts.map |
import type { RemoteParticipant } from 'livekit-client'; | ||
import type { ReceivedTranscriptionSegment, TrackReference } from '@livekit/components-core'; | ||
/** | ||
* @alpha | ||
* @beta | ||
*/ | ||
export type VoiceAssistantState = 'disconnected' | 'connecting' | 'initializing' | 'listening' | 'thinking' | 'speaking'; | ||
export type AgentState = 'disconnected' | 'connecting' | 'initializing' | 'listening' | 'thinking' | 'speaking'; | ||
/** | ||
* @alpha | ||
* @beta | ||
*/ | ||
export interface VoiceAssistant { | ||
agent: RemoteParticipant | undefined; | ||
state: VoiceAssistantState; | ||
state: AgentState; | ||
audioTrack: TrackReference | undefined; | ||
@@ -18,10 +18,11 @@ agentTranscriptions: ReceivedTranscriptionSegment[]; | ||
/** | ||
* @alpha | ||
* | ||
* This hook looks for the first agent-participant in the room. | ||
* It assumes that the agent participant is based on the LiveKit VoiceAssistant API and | ||
* returns the most commonly used state vars when interacting with a VoiceAssistant. | ||
* @remarks This hook requires a voice assistant agent running with livekit-agents \>= 0.8.11 | ||
* @remarks This hook requires an agent running with livekit-agents \>= 0.8.11 | ||
* @example | ||
* ```tsx | ||
* const { state, audioTrack, agentTranscriptions, agentAttributes } = useVoiceAssistant(); | ||
* ``` | ||
* @beta | ||
*/ | ||
export declare function useVoiceAssistant(): VoiceAssistant; | ||
//# sourceMappingURL=useVoiceAssistant.d.ts.map |
@@ -7,3 +7,3 @@ export { Chat, type ChatProps } from './Chat'; | ||
export { AudioConference, type AudioConferenceProps } from './AudioConference'; | ||
export * from './VoiceAssistantControlBar'; | ||
export { VoiceAssistantControlBar, type VoiceAssistantControlBarProps, type VoiceAssistantControlBarControls, } from './VoiceAssistantControlBar'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -19,3 +19,2 @@ import { Track } from 'livekit-client'; | ||
* @defaultValue true | ||
* @alpha | ||
*/ | ||
@@ -25,2 +24,8 @@ saveUserChoices?: boolean; | ||
/** | ||
* @example | ||
* ```tsx | ||
* <LiveKitRoom ... > | ||
* <VoiceAssistantControlBar /> | ||
* </LiveKitRoom> | ||
* ``` | ||
* @beta | ||
@@ -27,0 +32,0 @@ */ |
{ | ||
"name": "@livekit/components-react", | ||
"version": "2.5.4", | ||
"version": "2.6.0", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "author": "LiveKit", |
@@ -8,2 +8,3 @@ export * from './controls/ClearPinButton'; | ||
export * from './controls/StartAudio'; | ||
export * from './controls/StartMediaButton'; | ||
export * from './controls/TrackToggle'; | ||
@@ -10,0 +11,0 @@ export * from './layout'; |
import { useEffect, useRef, useState } from 'react'; | ||
import { generateConnectingSequenceBar } from '../animationSequences/connectingSequence'; | ||
import { generateListeningSequenceBar } from '../animationSequences/listeningSequence'; | ||
import type { VoiceAssistantState } from '../../../hooks'; | ||
import type { AgentState } from '../../../hooks'; | ||
export const useBarAnimator = ( | ||
state: VoiceAssistantState | undefined, | ||
state: AgentState | undefined, | ||
columns: number, | ||
@@ -9,0 +9,0 @@ interval: number, |
@@ -27,2 +27,1 @@ export {} from './chat-context'; | ||
export { FeatureFlags, useFeatureContext, LKFeatureContext } from './feature-context'; | ||
export { VoiceAssistantContext } from './voice-assistant-context'; |
@@ -12,5 +12,5 @@ import * as React from 'react'; | ||
/** | ||
* @alpha | ||
* @beta | ||
*/ | ||
export type VoiceAssistantState = | ||
export type AgentState = | ||
| 'disconnected' | ||
@@ -24,7 +24,7 @@ | 'connecting' | ||
/** | ||
* @alpha | ||
* @beta | ||
*/ | ||
export interface VoiceAssistant { | ||
agent: RemoteParticipant | undefined; | ||
state: VoiceAssistantState; | ||
state: AgentState; | ||
audioTrack: TrackReference | undefined; | ||
@@ -35,11 +35,12 @@ agentTranscriptions: ReceivedTranscriptionSegment[]; | ||
const state_attribute = 'voice_assistant.state'; | ||
const state_attribute = 'lk.agent.state'; | ||
/** | ||
* @alpha | ||
* | ||
* This hook looks for the first agent-participant in the room. | ||
* It assumes that the agent participant is based on the LiveKit VoiceAssistant API and | ||
* returns the most commonly used state vars when interacting with a VoiceAssistant. | ||
* @remarks This hook requires a voice assistant agent running with livekit-agents \>= 0.8.11 | ||
* @remarks This hook requires an agent running with livekit-agents \>= 0.8.11 | ||
* @example | ||
* ```tsx | ||
* const { state, audioTrack, agentTranscriptions, agentAttributes } = useVoiceAssistant(); | ||
* ``` | ||
* @beta | ||
*/ | ||
@@ -53,3 +54,3 @@ export function useVoiceAssistant(): VoiceAssistant { | ||
const state: VoiceAssistantState = React.useMemo(() => { | ||
const state: AgentState = React.useMemo(() => { | ||
if (connectionState === ConnectionState.Disconnected) { | ||
@@ -64,3 +65,3 @@ return 'disconnected'; | ||
} else { | ||
return attributes[state_attribute] as VoiceAssistantState; | ||
return attributes[state_attribute] as AgentState; | ||
} | ||
@@ -67,0 +68,0 @@ }, [attributes, agent, connectionState]); |
@@ -7,2 +7,6 @@ export { Chat, type ChatProps } from './Chat'; | ||
export { AudioConference, type AudioConferenceProps } from './AudioConference'; | ||
export * from './VoiceAssistantControlBar'; | ||
export { | ||
VoiceAssistantControlBar, | ||
type VoiceAssistantControlBarProps, | ||
type VoiceAssistantControlBarControls, | ||
} from './VoiceAssistantControlBar'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30336
2861311
438