Skip to content

@vowel.to/client v0.1.2-393


@vowel.to/client / index / SessionManager

Class: SessionManager

Defined in: lib/vowel/managers/SessionManager.ts:123

Session Manager class Manages realtime voice session lifecycle (multi-provider)

Constructors

Constructor

ts
new SessionManager(config): SessionManager;

Defined in: lib/vowel/managers/SessionManager.ts:158

Parameters

ParameterType
configSessionConfig

Returns

SessionManager

Methods

isActive()

ts
isActive(): boolean;

Defined in: lib/vowel/managers/SessionManager.ts:289

Check if session is active

Returns

boolean


getProvider()

ts
getProvider(): RealtimeProvider | null;

Defined in: lib/vowel/managers/SessionManager.ts:296

Get the underlying provider

Returns

RealtimeProvider | null


connect()

ts
connect(toolContext, restoreState?): Promise<void>;

Defined in: lib/vowel/managers/SessionManager.ts:909

Connect to Gemini Live session

Parameters

ParameterTypeDescription
toolContextToolContextTool execution context
restoreState?Partial<VoiceSessionState>Optional state to restore (injects conversation history into system prompt)

Returns

Promise<void>


disconnect()

ts
disconnect(): Promise<void>;

Defined in: lib/vowel/managers/SessionManager.ts:1181

Disconnect from session and reset state

Returns

Promise<void>


pauseVAD()

ts
pauseVAD(): void;

Defined in: lib/vowel/managers/SessionManager.ts:1219

Pause VAD (for session pause)

Returns

void


resumeVAD()

ts
resumeVAD(): void;

Defined in: lib/vowel/managers/SessionManager.ts:1229

Resume VAD (for session resume)

Returns

void


updateConfig()

ts
updateConfig(updates): void;

Defined in: lib/vowel/managers/SessionManager.ts:1239

Update configuration (for dynamic updates)

Parameters

ParameterType
updatesPartial<SessionConfig>

Returns

void


notifyEvent()

ts
notifyEvent(eventDetails, context?): Promise<void>;

Defined in: lib/vowel/managers/SessionManager.ts:1262

Send a text notification to the AI without user speech input This allows programmatic triggering of AI responses for app events

Parameters

ParameterTypeDescription
eventDetailsanyDescription of the event that occurred, or abstract JSON payload
context?Record<string, any>Optional context object to provide additional information

Returns

Promise<void>

Example

ts
// Notify AI about a timer expiry
await sessionManager.notifyEvent('Timer expired - 5 minutes are up!');

// Notify with additional context
await sessionManager.notifyEvent(
  'New message received', 
  { from: 'John', preview: 'Hello!' }
);

sendText()

ts
sendText(text): Promise<void>;

Defined in: lib/vowel/managers/SessionManager.ts:1310

Send raw text input to the AI Lower-level method for custom text-based interactions

Parameters

ParameterTypeDescription
textstringText to send to the AI

Returns

Promise<void>

Example

ts
await sessionManager.sendText('What products are on sale?');

sendImage()

ts
sendImage(imageUrl): Promise<void>;

Defined in: lib/vowel/managers/SessionManager.ts:1346

Send an image to the AI for processing Enables multimodal interactions where the AI can see and respond to images

Parameters

ParameterTypeDescription
imageUrlstringURL or data URI of the image to send

Returns

Promise<void>

Example

ts
// Send an image URL
await sessionManager.sendImage('https://example.com/product.jpg');

// Send a data URI
await sessionManager.sendImage('data:image/png;base64,iVBORw0KGgo...');