@hamsa-ai/voice-agents-sdk 0.4.6-beta.1 → 0.5.0-beta.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 +77 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/types/main.d.ts +49 -3
package/package.json
CHANGED
package/types/main.d.ts
CHANGED
|
@@ -130,6 +130,13 @@ type JobDetails = {
|
|
|
130
130
|
/** Additional job properties that may be returned by the API */
|
|
131
131
|
[key: string]: unknown;
|
|
132
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* Data object passed to callStarted event handlers
|
|
135
|
+
*/
|
|
136
|
+
type CallStartedData = {
|
|
137
|
+
/** Unique job/call ID for this conversation session */
|
|
138
|
+
jobId: string;
|
|
139
|
+
};
|
|
133
140
|
/**
|
|
134
141
|
* Event handler signatures for HamsaVoiceAgent
|
|
135
142
|
*
|
|
@@ -149,13 +156,18 @@ type JobDetails = {
|
|
|
149
156
|
* showNetworkWarning(metrics);
|
|
150
157
|
* }
|
|
151
158
|
* });
|
|
159
|
+
*
|
|
160
|
+
* agent.on('callStarted', ({ jobId }) => {
|
|
161
|
+
* console.log('Call started with ID:', jobId);
|
|
162
|
+
* analytics.trackCall(jobId);
|
|
163
|
+
* });
|
|
152
164
|
* ```
|
|
153
165
|
*/
|
|
154
166
|
type HamsaVoiceAgentEvents = {
|
|
155
167
|
/** Emitted when connection is established (before call fully starts) */
|
|
156
168
|
start: () => void;
|
|
157
|
-
/** Emitted when call is fully started and ready */
|
|
158
|
-
callStarted: () => void;
|
|
169
|
+
/** Emitted when call is fully started and ready with conversation details */
|
|
170
|
+
callStarted: (data: CallStartedData) => void;
|
|
159
171
|
/** Emitted when call ends (user or agent initiated) */
|
|
160
172
|
callEnded: () => void;
|
|
161
173
|
/** Emitted when call is paused */
|
|
@@ -408,6 +420,40 @@ declare class HamsaVoiceAgent extends EventEmitter {
|
|
|
408
420
|
* ```
|
|
409
421
|
*/
|
|
410
422
|
getOutputVolume(): number;
|
|
423
|
+
/**
|
|
424
|
+
* Gets the current job/call ID for this conversation
|
|
425
|
+
*
|
|
426
|
+
* The job ID uniquely identifies this conversation session and can be used
|
|
427
|
+
* to track the conversation, retrieve analytics, or poll for completion status
|
|
428
|
+
* using the getJobDetails() method.
|
|
429
|
+
*
|
|
430
|
+
* @returns The job/call ID, or null if conversation hasn't started yet
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```typescript
|
|
434
|
+
* // Get job ID when call starts
|
|
435
|
+
* agent.on('callStarted', () => {
|
|
436
|
+
* const callId = agent.getJobId();
|
|
437
|
+
* console.log('Call ID:', callId);
|
|
438
|
+
*
|
|
439
|
+
* // Send to analytics service
|
|
440
|
+
* analytics.trackCall(callId);
|
|
441
|
+
*
|
|
442
|
+
* // Store for later reference
|
|
443
|
+
* localStorage.setItem('lastCallId', callId);
|
|
444
|
+
* });
|
|
445
|
+
*
|
|
446
|
+
* // Use job ID to check completion status
|
|
447
|
+
* agent.on('callEnded', async () => {
|
|
448
|
+
* const jobId = agent.getJobId();
|
|
449
|
+
* if (jobId) {
|
|
450
|
+
* const details = await agent.getJobDetails();
|
|
451
|
+
* console.log('Call completed:', details);
|
|
452
|
+
* }
|
|
453
|
+
* });
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
getJobId(): string | null;
|
|
411
457
|
/**
|
|
412
458
|
* Gets the current input volume level from the user's microphone
|
|
413
459
|
*
|
|
@@ -1110,4 +1156,4 @@ export { HamsaVoiceAgent, HamsaApiError };
|
|
|
1110
1156
|
export default HamsaVoiceAgent;
|
|
1111
1157
|
export type { LocalTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, Room, } from 'livekit-client';
|
|
1112
1158
|
export type { AudioLevelsResult, CallAnalyticsResult, ConnectionStatsResult, ParticipantData, PerformanceMetricsResult, TrackStatsResult, } from './classes/livekit-manager';
|
|
1113
|
-
export type { HamsaVoiceAgentEvents, StartOptions, Tool, JobDetails };
|
|
1159
|
+
export type { CallStartedData, HamsaVoiceAgentEvents, StartOptions, Tool, JobDetails, };
|