@dtelecom/agents-js 0.1.17 → 0.2.0
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/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +26 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -15
- package/dist/index.mjs.map +1 -1
- package/dist/memory/index.d.mts +1 -1
- package/dist/memory/index.d.ts +1 -1
- package/dist/providers/index.d.mts +8 -3
- package/dist/providers/index.d.ts +8 -3
- package/dist/providers/index.js +32 -12
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +32 -12
- package/dist/providers/index.mjs.map +1 -1
- package/dist/{types-AWgTLEQ-.d.mts → types-BBKtiPvm.d.mts} +4 -2
- package/dist/{types-AWgTLEQ-.d.ts → types-BBKtiPvm.d.ts} +4 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _dtelecom_server_sdk_node from '@dtelecom/server-sdk-node';
|
|
2
2
|
import { Room, AudioSource, RemoteAudioTrack, AudioFrame } from '@dtelecom/server-sdk-node';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
|
-
import { A as AgentConfig, a as AgentStartOptions, M as Message, L as LLMPlugin, P as PipelineOptions, b as AgentState, S as STTStream, T as TranscriptionResult } from './types-
|
|
5
|
-
export { c as AgentEvents, d as AudioOutput, D as DataMessageHandler, e as LLMChatOptions, f as LLMChunk, g as MemoryConfig, h as PipelineEvents, R as RespondMode, i as STTPlugin, j as STTStreamOptions, k as TTSPlugin } from './types-
|
|
4
|
+
import { A as AgentConfig, a as AgentStartOptions, M as Message, L as LLMPlugin, P as PipelineOptions, b as AgentState, S as STTStream, T as TranscriptionResult } from './types-BBKtiPvm.mjs';
|
|
5
|
+
export { c as AgentEvents, d as AudioOutput, D as DataMessageHandler, e as LLMChatOptions, f as LLMChunk, g as MemoryConfig, h as PipelineEvents, R as RespondMode, i as STTPlugin, j as STTStreamOptions, k as TTSPlugin } from './types-BBKtiPvm.mjs';
|
|
6
6
|
|
|
7
7
|
declare class VoiceAgent extends EventEmitter {
|
|
8
8
|
private readonly config;
|
|
@@ -233,10 +233,12 @@ declare abstract class BaseSTTStream extends EventEmitter implements STTStream {
|
|
|
233
233
|
|
|
234
234
|
interface RoomConnectionOptions {
|
|
235
235
|
room: string;
|
|
236
|
-
apiKey: string;
|
|
237
|
-
apiSecret: string;
|
|
238
236
|
identity?: string;
|
|
239
237
|
name?: string;
|
|
238
|
+
apiKey?: string;
|
|
239
|
+
apiSecret?: string;
|
|
240
|
+
token?: string;
|
|
241
|
+
wsUrl?: string;
|
|
240
242
|
}
|
|
241
243
|
declare class RoomConnection {
|
|
242
244
|
readonly room: Room;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _dtelecom_server_sdk_node from '@dtelecom/server-sdk-node';
|
|
2
2
|
import { Room, AudioSource, RemoteAudioTrack, AudioFrame } from '@dtelecom/server-sdk-node';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
|
-
import { A as AgentConfig, a as AgentStartOptions, M as Message, L as LLMPlugin, P as PipelineOptions, b as AgentState, S as STTStream, T as TranscriptionResult } from './types-
|
|
5
|
-
export { c as AgentEvents, d as AudioOutput, D as DataMessageHandler, e as LLMChatOptions, f as LLMChunk, g as MemoryConfig, h as PipelineEvents, R as RespondMode, i as STTPlugin, j as STTStreamOptions, k as TTSPlugin } from './types-
|
|
4
|
+
import { A as AgentConfig, a as AgentStartOptions, M as Message, L as LLMPlugin, P as PipelineOptions, b as AgentState, S as STTStream, T as TranscriptionResult } from './types-BBKtiPvm.js';
|
|
5
|
+
export { c as AgentEvents, d as AudioOutput, D as DataMessageHandler, e as LLMChatOptions, f as LLMChunk, g as MemoryConfig, h as PipelineEvents, R as RespondMode, i as STTPlugin, j as STTStreamOptions, k as TTSPlugin } from './types-BBKtiPvm.js';
|
|
6
6
|
|
|
7
7
|
declare class VoiceAgent extends EventEmitter {
|
|
8
8
|
private readonly config;
|
|
@@ -233,10 +233,12 @@ declare abstract class BaseSTTStream extends EventEmitter implements STTStream {
|
|
|
233
233
|
|
|
234
234
|
interface RoomConnectionOptions {
|
|
235
235
|
room: string;
|
|
236
|
-
apiKey: string;
|
|
237
|
-
apiSecret: string;
|
|
238
236
|
identity?: string;
|
|
239
237
|
name?: string;
|
|
238
|
+
apiKey?: string;
|
|
239
|
+
apiSecret?: string;
|
|
240
|
+
token?: string;
|
|
241
|
+
wsUrl?: string;
|
|
240
242
|
}
|
|
241
243
|
declare class RoomConnection {
|
|
242
244
|
readonly room: Room;
|
package/dist/index.js
CHANGED
|
@@ -557,22 +557,31 @@ var RoomConnection = class {
|
|
|
557
557
|
* 4. Publish an audio track for the agent to speak through
|
|
558
558
|
*/
|
|
559
559
|
async connect(options) {
|
|
560
|
-
const { room: roomName,
|
|
560
|
+
const { room: roomName, identity = "agent", name } = options;
|
|
561
561
|
log.info(`Connecting to room "${roomName}" as "${identity}"...`);
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
562
|
+
let jwt;
|
|
563
|
+
let wsUrl;
|
|
564
|
+
if (options.token && options.wsUrl) {
|
|
565
|
+
jwt = options.token;
|
|
566
|
+
wsUrl = options.wsUrl;
|
|
567
|
+
} else if (options.apiKey && options.apiSecret) {
|
|
568
|
+
const { AccessToken } = await import("@dtelecom/server-sdk-js");
|
|
569
|
+
const token = new AccessToken(options.apiKey, options.apiSecret, {
|
|
570
|
+
identity,
|
|
571
|
+
name: name ?? identity
|
|
572
|
+
});
|
|
573
|
+
token.addGrant({
|
|
574
|
+
roomJoin: true,
|
|
575
|
+
room: roomName,
|
|
576
|
+
canPublish: true,
|
|
577
|
+
canSubscribe: true,
|
|
578
|
+
canPublishData: true
|
|
579
|
+
});
|
|
580
|
+
wsUrl = await token.getWsUrl();
|
|
581
|
+
jwt = token.toJwt();
|
|
582
|
+
} else {
|
|
583
|
+
throw new Error("Either (apiKey + apiSecret) or (token + wsUrl) must be provided");
|
|
584
|
+
}
|
|
576
585
|
log.info(`SFU URL: ${wsUrl}`);
|
|
577
586
|
await this.room.connect(wsUrl, jwt, { autoSubscribe: true });
|
|
578
587
|
this._connected = true;
|
|
@@ -1653,6 +1662,8 @@ var VoiceAgent = class extends import_events2.EventEmitter {
|
|
|
1653
1662
|
room: options.room,
|
|
1654
1663
|
apiKey: options.apiKey,
|
|
1655
1664
|
apiSecret: options.apiSecret,
|
|
1665
|
+
token: options.token,
|
|
1666
|
+
wsUrl: options.wsUrl,
|
|
1656
1667
|
identity: options.identity ?? "agent",
|
|
1657
1668
|
name: options.name ?? options.identity ?? "AI Agent"
|
|
1658
1669
|
});
|