@trillet-ai/web-sdk 1.5.3 → 1.5.5

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.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
- import { Transcript } from './TranscriptManager';
2
+ import { Transcript } from './TranscriptManager.js';
3
3
  export interface TrilletAgentConfig {
4
4
  apiKey?: string;
5
5
  workspaceId?: string;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
- import { TrilletWebSDK } from './TrilletWebSDK';
3
- import { TranscriptManager } from './TranscriptManager';
2
+ import { TrilletWebSDK } from './TrilletWebSDK.js';
3
+ import { TranscriptManager } from './TranscriptManager.js';
4
4
  const TRILLET_API_URL = {
5
5
  CONNECT: 'https://api.trillet.ai/v1/api/web-call',
6
6
  PUBLIC_CONNECT: 'https://api.trillet.ai/v1/api/web-call/public',
@@ -289,15 +289,18 @@ export class TrilletAgent extends EventEmitter {
289
289
  // Add user message to transcripts immediately
290
290
  this.transcriptManager.addMessage('user', text, room.localParticipant.identity);
291
291
  this.emit('transcriptUpdate', this.getTranscripts());
292
- // Send message via RPC
293
- const history = this.getTranscripts();
294
- this.sendRpcMessage('send_user_message', { text, history })
295
- .then(() => {
296
- console.log('Text message sent to agent via RPC:', text);
297
- })
298
- .catch((error) => {
299
- console.error('Failed to send text message via RPC:', error);
292
+ // Send the raw text string over the data channel. The LiveKit agent framework
293
+ // is designed to receive this and process it as user input.
294
+ try {
295
+ const encoder = new TextEncoder();
296
+ const data = encoder.encode(text);
297
+ // We use publishData directly, which is what `sendText` wraps.
298
+ room.localParticipant.publishData(data, { reliable: true });
299
+ console.log('Text message sent to agent:', text);
300
+ }
301
+ catch (error) {
302
+ console.error('Failed to send text message:', error);
300
303
  this.emit('error', new Error(`Failed to send message: ${error instanceof Error ? error.message : String(error)}`));
301
- });
304
+ }
302
305
  }
303
306
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trillet-ai/web-sdk",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "Trillet Web SDK for real-time audio communication with AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",