@dtelecom/agents-js 0.1.6 → 0.1.8
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -5
- 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 +13 -2
- package/dist/providers/index.d.ts +13 -2
- package/dist/providers/index.js +81 -4
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +81 -4
- package/dist/providers/index.mjs.map +1 -1
- package/dist/{types-Bfz5YQwd.d.mts → types-f6SAlHpW.d.mts} +2 -0
- package/dist/{types-Bfz5YQwd.d.ts → types-f6SAlHpW.d.ts} +2 -0
- 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 LLMChunk, f as MemoryConfig, g as PipelineEvents, R as RespondMode, h as STTPlugin, i as STTStreamOptions, j 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-f6SAlHpW.mjs';
|
|
5
|
+
export { c as AgentEvents, d as AudioOutput, D as DataMessageHandler, e as LLMChunk, f as MemoryConfig, g as PipelineEvents, R as RespondMode, h as STTPlugin, i as STTStreamOptions, j as TTSPlugin } from './types-f6SAlHpW.mjs';
|
|
6
6
|
|
|
7
7
|
declare class VoiceAgent extends EventEmitter {
|
|
8
8
|
private readonly config;
|
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 LLMChunk, f as MemoryConfig, g as PipelineEvents, R as RespondMode, h as STTPlugin, i as STTStreamOptions, j 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-f6SAlHpW.js';
|
|
5
|
+
export { c as AgentEvents, d as AudioOutput, D as DataMessageHandler, e as LLMChunk, f as MemoryConfig, g as PipelineEvents, R as RespondMode, h as STTPlugin, i as STTStreamOptions, j as TTSPlugin } from './types-f6SAlHpW.js';
|
|
6
6
|
|
|
7
7
|
declare class VoiceAgent extends EventEmitter {
|
|
8
8
|
private readonly config;
|
package/dist/index.js
CHANGED
|
@@ -1408,12 +1408,16 @@ var Pipeline = class extends import_events.EventEmitter {
|
|
|
1408
1408
|
log7.debug(`Skipping non-word sentence: "${sentence}"`);
|
|
1409
1409
|
continue;
|
|
1410
1410
|
}
|
|
1411
|
-
|
|
1411
|
+
let processed = sentence;
|
|
1412
|
+
if (this.tts?.preprocessText) {
|
|
1413
|
+
processed = await this.tts.preprocessText(sentence, signal);
|
|
1414
|
+
}
|
|
1415
|
+
await this.synthesizeAndPlay(processed, signal, (t) => {
|
|
1412
1416
|
if (!tFirstAudioPlayed) {
|
|
1413
1417
|
tFirstAudioPlayed = t;
|
|
1414
1418
|
this.setAgentState("speaking");
|
|
1415
1419
|
}
|
|
1416
|
-
this.emit("sentence", this.cleanText(
|
|
1420
|
+
this.emit("sentence", this.cleanText(processed));
|
|
1417
1421
|
});
|
|
1418
1422
|
continue;
|
|
1419
1423
|
}
|
|
@@ -1480,15 +1484,19 @@ var Pipeline = class extends import_events.EventEmitter {
|
|
|
1480
1484
|
const signal = this.bargeIn.startCycle();
|
|
1481
1485
|
this.audioOutput.beginResponse();
|
|
1482
1486
|
this.setAgentState("thinking");
|
|
1483
|
-
|
|
1487
|
+
let processed = text;
|
|
1488
|
+
if (this.tts?.preprocessText) {
|
|
1489
|
+
processed = await this.tts.preprocessText(text, signal);
|
|
1490
|
+
}
|
|
1491
|
+
await this.synthesizeAndPlay(processed, signal, () => {
|
|
1484
1492
|
this.setAgentState("speaking");
|
|
1485
|
-
this.emit("sentence", this.cleanText(
|
|
1493
|
+
this.emit("sentence", this.cleanText(processed));
|
|
1486
1494
|
});
|
|
1487
1495
|
if (!signal.aborted) {
|
|
1488
1496
|
await this.audioOutput.writeSilence(40);
|
|
1489
1497
|
this.context.addAgentTurn(text);
|
|
1490
1498
|
this.memory?.storeTurn("assistant", text, true);
|
|
1491
|
-
this.emit("response", this.cleanText(
|
|
1499
|
+
this.emit("response", this.cleanText(processed));
|
|
1492
1500
|
}
|
|
1493
1501
|
await sleep2(AUDIO_DRAIN_MS);
|
|
1494
1502
|
this.setAgentState("idle");
|