@exotel-npm-dev/exotel-ai-assist 1.1.3 → 1.1.4
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/README.md +9 -11
- package/dist/controller/index.js +6 -17
- package/dist/index.js +6 -17
- package/dist/react/index.js +6 -17
- package/dist/types/index.d.ts +0 -7
- package/dist/utils/index.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,7 +171,6 @@ const ctrl = new ExotelAIAssistController({
|
|
|
171
171
|
authToken: "your-auth-token",
|
|
172
172
|
call_sid: "CALL-SID-001",
|
|
173
173
|
accountId: "your-account-id",
|
|
174
|
-
env: "production", // defaults to PRODUCTION if omitted
|
|
175
174
|
});
|
|
176
175
|
|
|
177
176
|
ctrl.on("onReady", (ready) => {
|
|
@@ -222,16 +221,15 @@ Extends `EventEmitter`.
|
|
|
222
221
|
|
|
223
222
|
#### Constructor options (`ExotelAIAssistParams`)
|
|
224
223
|
|
|
225
|
-
| Field | Type
|
|
226
|
-
| ---------------------- |
|
|
227
|
-
| `authToken` | `string`
|
|
228
|
-
| `call_sid` | `string`
|
|
229
|
-
| `accountId` | `string`
|
|
230
|
-
| `
|
|
231
|
-
| `
|
|
232
|
-
| `
|
|
233
|
-
| `
|
|
234
|
-
| `[customParam]` | `string` | — | — | Extra query params forwarded to the server (max 3) |
|
|
224
|
+
| Field | Type | Required | Default | Description |
|
|
225
|
+
| ---------------------- | -------- | -------- | ------------------------ | -------------------------------------------------------- |
|
|
226
|
+
| `authToken` | `string` | ✓ | — | Bearer token |
|
|
227
|
+
| `call_sid` | `string` | ✓ | — | Active call SID |
|
|
228
|
+
| `accountId` | `string` | ✓ | — | Exotel account identifier |
|
|
229
|
+
| `wssBaseUrl` | `string` | — | Exotel AI Assist backend | Override only when pointing at a non-production endpoint |
|
|
230
|
+
| `reconnectInterval` | `number` | — | `3000` | Base reconnect delay in ms |
|
|
231
|
+
| `maxReconnectAttempts` | `number` | — | `5` | Max retries before error |
|
|
232
|
+
| `[customParam]` | `string` | — | — | Max 3 params you can send |
|
|
235
233
|
|
|
236
234
|
#### Methods
|
|
237
235
|
|
package/dist/controller/index.js
CHANGED
|
@@ -1506,18 +1506,6 @@ function requireObject_hash() {
|
|
|
1506
1506
|
var object_hashExports = requireObject_hash();
|
|
1507
1507
|
var objectHash = /*@__PURE__*/getDefaultExportFromCjs(object_hashExports);
|
|
1508
1508
|
|
|
1509
|
-
var Environment;
|
|
1510
|
-
(function (Environment) {
|
|
1511
|
-
Environment["PRODUCTION"] = "production";
|
|
1512
|
-
Environment["UAT"] = "uat";
|
|
1513
|
-
Environment["DEVELOPMENT"] = "development";
|
|
1514
|
-
})(Environment || (Environment = {}));
|
|
1515
|
-
const WssBaseUrl = {
|
|
1516
|
-
[Environment.PRODUCTION]: "wss://ai-assist.in.exotel.com",
|
|
1517
|
-
[Environment.UAT]: "wss://aiassist-uat.in.exotel.com",
|
|
1518
|
-
[Environment.DEVELOPMENT]: "ws://localhost:8081"
|
|
1519
|
-
};
|
|
1520
|
-
|
|
1521
1509
|
class Utils {
|
|
1522
1510
|
/**
|
|
1523
1511
|
* Returns a deterministic SHA-1 hex digest for any plain object.
|
|
@@ -1549,8 +1537,10 @@ class Utils {
|
|
|
1549
1537
|
* @param accountId - The account ID to get the base WebSocket URL for.
|
|
1550
1538
|
* @returns The base WebSocket URL.
|
|
1551
1539
|
*/
|
|
1552
|
-
static getWssBaseUrl(accountId
|
|
1553
|
-
return
|
|
1540
|
+
static getWssBaseUrl(accountId) {
|
|
1541
|
+
// return `wss://ai-assist.in.exotel.com/ai-assist/accounts/${accountId}/one-assistant-event-publisher`;
|
|
1542
|
+
// return `wss://oneassist-uat.in.exotel.com/ai-assist/one-assistant-event-publisher/${accountId}`;
|
|
1543
|
+
return `wss://oneassist-uat.in.exotel.com/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
1554
1544
|
}
|
|
1555
1545
|
/**
|
|
1556
1546
|
* Builds a WebSocket URL from the given parameters.
|
|
@@ -1558,18 +1548,17 @@ class Utils {
|
|
|
1558
1548
|
* @returns The WebSocket URL.
|
|
1559
1549
|
*/
|
|
1560
1550
|
static buildWsUrl(params) {
|
|
1561
|
-
var _a;
|
|
1562
1551
|
const {
|
|
1563
1552
|
wssBaseUrl
|
|
1564
1553
|
} = params;
|
|
1565
|
-
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId
|
|
1554
|
+
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId);
|
|
1566
1555
|
const base = resolved.endsWith("/") ? resolved.slice(0, -1) : resolved;
|
|
1567
1556
|
const query = Utils.constructQueryParams(params);
|
|
1568
1557
|
return `${base}?${query}`;
|
|
1569
1558
|
}
|
|
1570
1559
|
static constructQueryParams(params) {
|
|
1571
1560
|
// Keys consumed by the library — never forwarded to the server.
|
|
1572
|
-
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"
|
|
1561
|
+
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"]);
|
|
1573
1562
|
// Mandatory server params remapped to the names the API expects.
|
|
1574
1563
|
// accountId is embedded in the URL path — never sent as a query param.
|
|
1575
1564
|
const pairs = [];
|
package/dist/index.js
CHANGED
|
@@ -20924,18 +20924,6 @@ function requireObject_hash() {
|
|
|
20924
20924
|
var object_hashExports = requireObject_hash();
|
|
20925
20925
|
var objectHash = /*@__PURE__*/getDefaultExportFromCjs(object_hashExports);
|
|
20926
20926
|
|
|
20927
|
-
var Environment;
|
|
20928
|
-
(function (Environment) {
|
|
20929
|
-
Environment["PRODUCTION"] = "production";
|
|
20930
|
-
Environment["UAT"] = "uat";
|
|
20931
|
-
Environment["DEVELOPMENT"] = "development";
|
|
20932
|
-
})(Environment || (Environment = {}));
|
|
20933
|
-
const WssBaseUrl = {
|
|
20934
|
-
[Environment.PRODUCTION]: "wss://ai-assist.in.exotel.com",
|
|
20935
|
-
[Environment.UAT]: "wss://aiassist-uat.in.exotel.com",
|
|
20936
|
-
[Environment.DEVELOPMENT]: "ws://localhost:8081"
|
|
20937
|
-
};
|
|
20938
|
-
|
|
20939
20927
|
class Utils {
|
|
20940
20928
|
/**
|
|
20941
20929
|
* Returns a deterministic SHA-1 hex digest for any plain object.
|
|
@@ -20967,8 +20955,10 @@ class Utils {
|
|
|
20967
20955
|
* @param accountId - The account ID to get the base WebSocket URL for.
|
|
20968
20956
|
* @returns The base WebSocket URL.
|
|
20969
20957
|
*/
|
|
20970
|
-
static getWssBaseUrl(accountId
|
|
20971
|
-
return
|
|
20958
|
+
static getWssBaseUrl(accountId) {
|
|
20959
|
+
// return `wss://ai-assist.in.exotel.com/ai-assist/accounts/${accountId}/one-assistant-event-publisher`;
|
|
20960
|
+
// return `wss://oneassist-uat.in.exotel.com/ai-assist/one-assistant-event-publisher/${accountId}`;
|
|
20961
|
+
return `wss://oneassist-uat.in.exotel.com/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
20972
20962
|
}
|
|
20973
20963
|
/**
|
|
20974
20964
|
* Builds a WebSocket URL from the given parameters.
|
|
@@ -20976,18 +20966,17 @@ class Utils {
|
|
|
20976
20966
|
* @returns The WebSocket URL.
|
|
20977
20967
|
*/
|
|
20978
20968
|
static buildWsUrl(params) {
|
|
20979
|
-
var _a;
|
|
20980
20969
|
const {
|
|
20981
20970
|
wssBaseUrl
|
|
20982
20971
|
} = params;
|
|
20983
|
-
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId
|
|
20972
|
+
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId);
|
|
20984
20973
|
const base = resolved.endsWith("/") ? resolved.slice(0, -1) : resolved;
|
|
20985
20974
|
const query = Utils.constructQueryParams(params);
|
|
20986
20975
|
return `${base}?${query}`;
|
|
20987
20976
|
}
|
|
20988
20977
|
static constructQueryParams(params) {
|
|
20989
20978
|
// Keys consumed by the library — never forwarded to the server.
|
|
20990
|
-
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"
|
|
20979
|
+
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"]);
|
|
20991
20980
|
// Mandatory server params remapped to the names the API expects.
|
|
20992
20981
|
// accountId is embedded in the URL path — never sent as a query param.
|
|
20993
20982
|
const pairs = [];
|
package/dist/react/index.js
CHANGED
|
@@ -6210,18 +6210,6 @@ function requireObject_hash() {
|
|
|
6210
6210
|
var object_hashExports = requireObject_hash();
|
|
6211
6211
|
var objectHash = /*@__PURE__*/getDefaultExportFromCjs(object_hashExports);
|
|
6212
6212
|
|
|
6213
|
-
var Environment;
|
|
6214
|
-
(function (Environment) {
|
|
6215
|
-
Environment["PRODUCTION"] = "production";
|
|
6216
|
-
Environment["UAT"] = "uat";
|
|
6217
|
-
Environment["DEVELOPMENT"] = "development";
|
|
6218
|
-
})(Environment || (Environment = {}));
|
|
6219
|
-
const WssBaseUrl = {
|
|
6220
|
-
[Environment.PRODUCTION]: "wss://ai-assist.in.exotel.com",
|
|
6221
|
-
[Environment.UAT]: "wss://aiassist-uat.in.exotel.com",
|
|
6222
|
-
[Environment.DEVELOPMENT]: "ws://localhost:8081"
|
|
6223
|
-
};
|
|
6224
|
-
|
|
6225
6213
|
class Utils {
|
|
6226
6214
|
/**
|
|
6227
6215
|
* Returns a deterministic SHA-1 hex digest for any plain object.
|
|
@@ -6253,8 +6241,10 @@ class Utils {
|
|
|
6253
6241
|
* @param accountId - The account ID to get the base WebSocket URL for.
|
|
6254
6242
|
* @returns The base WebSocket URL.
|
|
6255
6243
|
*/
|
|
6256
|
-
static getWssBaseUrl(accountId
|
|
6257
|
-
return
|
|
6244
|
+
static getWssBaseUrl(accountId) {
|
|
6245
|
+
// return `wss://ai-assist.in.exotel.com/ai-assist/accounts/${accountId}/one-assistant-event-publisher`;
|
|
6246
|
+
// return `wss://oneassist-uat.in.exotel.com/ai-assist/one-assistant-event-publisher/${accountId}`;
|
|
6247
|
+
return `wss://oneassist-uat.in.exotel.com/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
6258
6248
|
}
|
|
6259
6249
|
/**
|
|
6260
6250
|
* Builds a WebSocket URL from the given parameters.
|
|
@@ -6262,18 +6252,17 @@ class Utils {
|
|
|
6262
6252
|
* @returns The WebSocket URL.
|
|
6263
6253
|
*/
|
|
6264
6254
|
static buildWsUrl(params) {
|
|
6265
|
-
var _a;
|
|
6266
6255
|
const {
|
|
6267
6256
|
wssBaseUrl
|
|
6268
6257
|
} = params;
|
|
6269
|
-
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId
|
|
6258
|
+
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId);
|
|
6270
6259
|
const base = resolved.endsWith("/") ? resolved.slice(0, -1) : resolved;
|
|
6271
6260
|
const query = Utils.constructQueryParams(params);
|
|
6272
6261
|
return `${base}?${query}`;
|
|
6273
6262
|
}
|
|
6274
6263
|
static constructQueryParams(params) {
|
|
6275
6264
|
// Keys consumed by the library — never forwarded to the server.
|
|
6276
|
-
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"
|
|
6265
|
+
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"]);
|
|
6277
6266
|
// Mandatory server params remapped to the names the API expects.
|
|
6278
6267
|
// accountId is embedded in the URL path — never sent as a query param.
|
|
6279
6268
|
const pairs = [];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export declare enum Environment {
|
|
2
|
-
PRODUCTION = "production",
|
|
3
|
-
UAT = "uat",
|
|
4
|
-
DEVELOPMENT = "development"
|
|
5
|
-
}
|
|
6
|
-
export declare const WssBaseUrl: Record<Environment, string>;
|
|
7
1
|
export interface ExotelAIAssistParams {
|
|
8
2
|
authToken: string;
|
|
9
3
|
call_sid: string;
|
|
@@ -13,7 +7,6 @@ export interface ExotelAIAssistParams {
|
|
|
13
7
|
wssBaseUrl?: string;
|
|
14
8
|
reconnectInterval?: number;
|
|
15
9
|
maxReconnectAttempts?: number;
|
|
16
|
-
env?: Environment;
|
|
17
10
|
[key: string]: unknown;
|
|
18
11
|
}
|
|
19
12
|
/** A single AI-generated suggestion for the agent. */
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExotelAIAssistParams } from "../types";
|
|
2
2
|
export declare class Utils {
|
|
3
3
|
static MAX_EXTRA_QUERY_PARAMS: number;
|
|
4
4
|
/**
|
|
@@ -20,7 +20,7 @@ export declare class Utils {
|
|
|
20
20
|
* @param accountId - The account ID to get the base WebSocket URL for.
|
|
21
21
|
* @returns The base WebSocket URL.
|
|
22
22
|
*/
|
|
23
|
-
static getWssBaseUrl(accountId: string
|
|
23
|
+
static getWssBaseUrl(accountId: string): string;
|
|
24
24
|
/**
|
|
25
25
|
* Builds a WebSocket URL from the given parameters.
|
|
26
26
|
* @param params - The parameters to build the WebSocket URL from.
|
package/package.json
CHANGED