@trillet-ai/web-sdk 1.1.5 → 1.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.
Files changed (2) hide show
  1. package/dist/index.js +7 -7
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { EventEmitter } from "eventemitter3";
2
2
  import { RemoteAudioTrack, Room, RoomEvent, Track, createAudioAnalyser, } from "livekit-client";
3
- const TRILLET_API_URL = "https://api.trillet.ai/v1/api/web-call";
3
+ const TRILLET_API_URL = "https://api.trillet.ai/v1/api/calls/web/connect";
4
+ const TRILLET_LIVEKIT_WS_URL = "wss://trilletai-ek0j3un1.livekit.cloud";
4
5
  const decoder = new TextDecoder();
5
6
  // Browser compatibility check
6
7
  const isBrowser = typeof window !== 'undefined';
@@ -38,7 +39,6 @@ export class TrilletAgent extends EventEmitter {
38
39
  this.sdk.on('audioData', (data) => this.emit('audioData', data));
39
40
  }
40
41
  async startCall() {
41
- var _a;
42
42
  try {
43
43
  // 1. Get LiveKit token from Trillet API
44
44
  const response = await fetch(TRILLET_API_URL, {
@@ -50,7 +50,7 @@ export class TrilletAgent extends EventEmitter {
50
50
  'x-api-key': this.config.apiKey
51
51
  },
52
52
  body: JSON.stringify({
53
- call_agent_id: this.config.agentId,
53
+ agentId: this.config.agentId,
54
54
  dynamic_variables: this.config.variables || {}
55
55
  })
56
56
  });
@@ -60,19 +60,19 @@ export class TrilletAgent extends EventEmitter {
60
60
  const errorData = await response.json();
61
61
  errorMessage = errorData.message || errorData.error || 'Unknown error';
62
62
  }
63
- catch (_b) {
63
+ catch (_a) {
64
64
  errorMessage = await response.text();
65
65
  }
66
66
  throw new Error(`API Error: ${errorMessage}`);
67
67
  }
68
68
  const data = await response.json();
69
- if (!data.token || !((_a = data.connection) === null || _a === void 0 ? void 0 : _a.url)) {
70
- throw new Error('Invalid response from server: missing token or connection details');
69
+ if (!data.token) {
70
+ throw new Error('Invalid response from server: missing token');
71
71
  }
72
72
  // 2. Initialize call with LiveKit token
73
73
  await this.sdk.initializeCall({
74
74
  token: data.token,
75
- wsUrl: data.connection.url,
75
+ wsUrl: TRILLET_LIVEKIT_WS_URL,
76
76
  audioSettings: {
77
77
  sampleRate: 48000
78
78
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trillet-ai/web-sdk",
3
- "version": "1.1.5",
3
+ "version": "1.2.0",
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",
@@ -32,6 +32,7 @@
32
32
  "author": "Trillet AI",
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
+ "@trillet-ai/web-sdk": "file:",
35
36
  "eventemitter3": "^5.0.1",
36
37
  "livekit-client": "^1.15.5"
37
38
  },