Valora
API Reference@valora-ai/reactindexInterfaces

VoiceAgent

Defined in: packages/react/src/agent.ts:71

The store contract. subscribe + getSnapshot are useSyncExternalStore- compatible: getSnapshot MUST return a stable reference until something changes (return a cached object, mutate-then-replace), or React will loop.

Methods

subscribe()

subscribe(onStoreChange): () => void;

Defined in: packages/react/src/agent.ts:73

Register a change listener; returns an unsubscribe fn.

Parameters

ParameterType
onStoreChange() => void

Returns

() => void


getSnapshot()

getSnapshot(): VoiceSnapshot;

Defined in: packages/react/src/agent.ts:75

Current immutable snapshot (stable ref until a change).

Returns

VoiceSnapshot


mute()

mute(muted): void;

Defined in: packages/react/src/agent.ts:78

Set the local mic muted flag.

Parameters

ParameterType
mutedboolean

Returns

void


sendText()

sendText(text): void;

Defined in: packages/react/src/agent.ts:80

Inject user text → agent reply.

Parameters

ParameterType
textstring

Returns

void


interrupt()

interrupt(): void;

Defined in: packages/react/src/agent.ts:82

Cancel the current turn, return to idle.

Returns

void


reset()?

optional reset(): void;

Defined in: packages/react/src/agent.ts:84

Clear the transcript + abandon any in-flight turn (chat reset). Optional.

Returns

void


speak()?

optional speak(text): void | Promise<void>;

Defined in: packages/react/src/agent.ts:91

Make the agent speak arbitrary text now, outside a turn (e.g. a spoken welcome on call start). May return a promise that resolves when playback ends — callers should not assume completion if the implementation returns void. No-op if the agent can't speak.

Parameters

ParameterType
textstring

Returns

void | Promise<void>


start()?

optional start(): void | Promise<void>;

Defined in: packages/react/src/agent.ts:94

Begin the session (optional; called by VoiceRoom on mount).

Returns

void | Promise<void>


stop()?

optional stop(): void | Promise<void>;

Defined in: packages/react/src/agent.ts:96

End the session (optional; called by VoiceRoom on unmount).

Returns

void | Promise<void>


unlock()?

optional unlock(): void;

Defined in: packages/react/src/agent.ts:98

Resume the Web Audio context after a user gesture (autoplay policy).

Returns

void

On this page

Valora is local-first

No API key, no server — everything in this doc runs on-device.

Star on GitHub