@dtelecom/agents-js 0.1.5 → 0.1.6

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 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-DWdkYmW8.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-DWdkYmW8.mjs';
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-Bfz5YQwd.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-Bfz5YQwd.mjs';
6
6
 
7
7
  declare class VoiceAgent extends EventEmitter {
8
8
  private readonly config;
@@ -103,6 +103,8 @@ declare class Pipeline extends EventEmitter {
103
103
  private readonly nameVariants;
104
104
  private readonly beforeRespond?;
105
105
  private readonly memory?;
106
+ /** Strip provider-specific markup (e.g. SSML lang tags) for display. */
107
+ private cleanText;
106
108
  /** Active STT streams, keyed by participant identity */
107
109
  private sttStreams;
108
110
  private _processing;
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-DWdkYmW8.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-DWdkYmW8.js';
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-Bfz5YQwd.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-Bfz5YQwd.js';
6
6
 
7
7
  declare class VoiceAgent extends EventEmitter {
8
8
  private readonly config;
@@ -103,6 +103,8 @@ declare class Pipeline extends EventEmitter {
103
103
  private readonly nameVariants;
104
104
  private readonly beforeRespond?;
105
105
  private readonly memory?;
106
+ /** Strip provider-specific markup (e.g. SSML lang tags) for display. */
107
+ private cleanText;
106
108
  /** Active STT streams, keyed by participant identity */
107
109
  private sttStreams;
108
110
  private _processing;
package/dist/index.js CHANGED
@@ -1156,6 +1156,10 @@ var Pipeline = class extends import_events.EventEmitter {
1156
1156
  nameVariants;
1157
1157
  beforeRespond;
1158
1158
  memory;
1159
+ /** Strip provider-specific markup (e.g. SSML lang tags) for display. */
1160
+ cleanText(text) {
1161
+ return this.tts?.cleanText ? this.tts.cleanText(text) : text;
1162
+ }
1159
1163
  /** Active STT streams, keyed by participant identity */
1160
1164
  sttStreams = /* @__PURE__ */ new Map();
1161
1165
  _processing = false;
@@ -1409,7 +1413,7 @@ var Pipeline = class extends import_events.EventEmitter {
1409
1413
  tFirstAudioPlayed = t;
1410
1414
  this.setAgentState("speaking");
1411
1415
  }
1412
- this.emit("sentence", sentence);
1416
+ this.emit("sentence", this.cleanText(sentence));
1413
1417
  });
1414
1418
  continue;
1415
1419
  }
@@ -1437,7 +1441,7 @@ var Pipeline = class extends import_events.EventEmitter {
1437
1441
  if (fullResponse.trim()) {
1438
1442
  this.context.addAgentTurn(fullResponse.trim());
1439
1443
  this.memory?.storeTurn("assistant", fullResponse.trim(), true);
1440
- this.emit("response", fullResponse.trim());
1444
+ this.emit("response", this.cleanText(fullResponse.trim()));
1441
1445
  }
1442
1446
  await sleep2(AUDIO_DRAIN_MS);
1443
1447
  this.setAgentState("idle");
@@ -1478,13 +1482,13 @@ var Pipeline = class extends import_events.EventEmitter {
1478
1482
  this.setAgentState("thinking");
1479
1483
  await this.synthesizeAndPlay(text, signal, () => {
1480
1484
  this.setAgentState("speaking");
1481
- this.emit("sentence", text);
1485
+ this.emit("sentence", this.cleanText(text));
1482
1486
  });
1483
1487
  if (!signal.aborted) {
1484
1488
  await this.audioOutput.writeSilence(40);
1485
1489
  this.context.addAgentTurn(text);
1486
1490
  this.memory?.storeTurn("assistant", text, true);
1487
- this.emit("response", text);
1491
+ this.emit("response", this.cleanText(text));
1488
1492
  }
1489
1493
  await sleep2(AUDIO_DRAIN_MS);
1490
1494
  this.setAgentState("idle");