@webex/internal-plugin-llm 3.0.0-beta.17 → 3.0.0-beta.170
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/llm.js +7 -29
- package/dist/llm.js.map +1 -1
- package/dist/llm.types.js.map +1 -1
- package/package.json +5 -5
- package/src/llm.ts +7 -23
- package/src/llm.types.ts +1 -1
- package/test/unit/spec/llm.js +4 -1
package/dist/llm.js
CHANGED
|
@@ -15,7 +15,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
15
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
17
17
|
var _internalPluginMercury = _interopRequireDefault(require("@webex/internal-plugin-mercury"));
|
|
18
|
-
var _pluginMeetings = require("@webex/plugin-meetings");
|
|
19
18
|
var _constants = require("./constants");
|
|
20
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
21
20
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -57,40 +56,29 @@ exports.config = config;
|
|
|
57
56
|
var LLMChannel = /*#__PURE__*/function (_ref) {
|
|
58
57
|
(0, _inherits2.default)(LLMChannel, _ref);
|
|
59
58
|
var _super = _createSuper(LLMChannel);
|
|
60
|
-
/**
|
|
61
|
-
* If the LLM plugin has been registered and listening
|
|
62
|
-
* @instance
|
|
63
|
-
* @type {Boolean}
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Initializes the LLM Plugin
|
|
69
|
-
* @constructor
|
|
70
|
-
* @public
|
|
71
|
-
*/
|
|
72
59
|
function LLMChannel() {
|
|
73
60
|
var _this;
|
|
74
61
|
(0, _classCallCheck2.default)(this, LLMChannel);
|
|
75
62
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
76
63
|
args[_key] = arguments[_key];
|
|
77
64
|
}
|
|
78
|
-
// eslint-disable-next-line constructor-super
|
|
79
65
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
80
66
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "namespace", _constants.LLM);
|
|
81
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "registered", false);
|
|
82
67
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webSocketUrl", void 0);
|
|
83
68
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "binding", void 0);
|
|
84
69
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "locusUrl", void 0);
|
|
85
70
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "register", function (llmSocketUrl) {
|
|
86
71
|
return _this.request({
|
|
87
72
|
method: 'POST',
|
|
88
|
-
url: llmSocketUrl
|
|
73
|
+
url: llmSocketUrl,
|
|
74
|
+
body: {
|
|
75
|
+
deviceUrl: _this.webex.internal.device.url
|
|
76
|
+
}
|
|
89
77
|
}).then(function (res) {
|
|
90
78
|
_this.webSocketUrl = res.body.webSocketUrl;
|
|
91
79
|
_this.binding = res.body.binding;
|
|
92
80
|
}).catch(function (error) {
|
|
93
|
-
|
|
81
|
+
_this.logger.error("Error connecting to websocket: ".concat(error));
|
|
94
82
|
throw error;
|
|
95
83
|
});
|
|
96
84
|
});
|
|
@@ -98,13 +86,11 @@ var LLMChannel = /*#__PURE__*/function (_ref) {
|
|
|
98
86
|
return _this.register(datachannelUrl).then(function () {
|
|
99
87
|
if (!locusUrl || !datachannelUrl) return undefined;
|
|
100
88
|
_this.locusUrl = locusUrl;
|
|
101
|
-
_this.connect(_this.webSocketUrl)
|
|
102
|
-
_this.registered = true;
|
|
103
|
-
});
|
|
89
|
+
_this.connect(_this.webSocketUrl);
|
|
104
90
|
});
|
|
105
91
|
});
|
|
106
92
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isConnected", function () {
|
|
107
|
-
return _this.
|
|
93
|
+
return _this.connected;
|
|
108
94
|
});
|
|
109
95
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getBinding", function () {
|
|
110
96
|
return _this.binding;
|
|
@@ -114,21 +100,13 @@ var LLMChannel = /*#__PURE__*/function (_ref) {
|
|
|
114
100
|
});
|
|
115
101
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "disconnectLLM", function () {
|
|
116
102
|
return _this.disconnect().then(function () {
|
|
117
|
-
_this.registered = false;
|
|
118
103
|
_this.locusUrl = undefined;
|
|
119
104
|
_this.binding = undefined;
|
|
120
105
|
_this.webSocketUrl = undefined;
|
|
121
106
|
});
|
|
122
107
|
});
|
|
123
|
-
_this.registered = false;
|
|
124
108
|
return _this;
|
|
125
109
|
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Register to the websocket
|
|
129
|
-
* @param {string} llmSocketUrl
|
|
130
|
-
* @returns {Promise<void>}
|
|
131
|
-
*/
|
|
132
110
|
return (0, _createClass2.default)(LLMChannel);
|
|
133
111
|
}(_internalPluginMercury.default);
|
|
134
112
|
exports.default = LLMChannel;
|
package/dist/llm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["config","llm","pingInterval","process","env","MERCURY_PING_INTERVAL","pongTimeout","MERCURY_PONG_TIMEOUT","backoffTimeMax","MERCURY_BACKOFF_TIME_MAX","backoffTimeReset","MERCURY_BACKOFF_TIME_RESET","forceCloseDelay","MERCURY_FORCE_CLOSE_DELAY","LLMChannel","
|
|
1
|
+
{"version":3,"names":["config","llm","pingInterval","process","env","MERCURY_PING_INTERVAL","pongTimeout","MERCURY_PONG_TIMEOUT","backoffTimeMax","MERCURY_BACKOFF_TIME_MAX","backoffTimeReset","MERCURY_BACKOFF_TIME_RESET","forceCloseDelay","MERCURY_FORCE_CLOSE_DELAY","LLMChannel","LLM","llmSocketUrl","request","method","url","body","deviceUrl","webex","internal","device","then","res","webSocketUrl","binding","catch","error","logger","locusUrl","datachannelUrl","register","undefined","connect","connected","disconnect","Mercury"],"sources":["llm.ts"],"sourcesContent":["/* eslint-disable consistent-return */\n\nimport Mercury from '@webex/internal-plugin-mercury';\n\nimport {LLM} from './constants';\n// eslint-disable-next-line no-unused-vars\nimport {ILLMChannel} from './llm.types';\n\nexport const config = {\n llm: {\n /**\n * Milliseconds between pings sent up the socket\n * @type {number}\n */\n pingInterval: process.env.MERCURY_PING_INTERVAL || 15000,\n /**\n * Milliseconds to wait for a pong before declaring the connection dead\n * @type {number}\n */\n pongTimeout: process.env.MERCURY_PONG_TIMEOUT || 14000,\n /**\n * Maximum milliseconds between connection attempts\n * @type {Number}\n */\n backoffTimeMax: process.env.MERCURY_BACKOFF_TIME_MAX || 32000,\n /**\n * Initial milliseconds between connection attempts\n * @type {Number}\n */\n backoffTimeReset: process.env.MERCURY_BACKOFF_TIME_RESET || 1000,\n /**\n * Milliseconds to wait for a close frame before declaring the socket dead and\n * discarding it\n * @type {[type]}\n */\n forceCloseDelay: process.env.MERCURY_FORCE_CLOSE_DELAY || 2000,\n },\n};\n\n/**\n * LLMChannel to provide socket connections\n */\nexport default class LLMChannel extends (Mercury as any) implements ILLMChannel {\n namespace = LLM;\n\n /**\n * If the LLM plugin has been registered and listening\n * @instance\n * @type {Boolean}\n * @public\n */\n\n private webSocketUrl?: string;\n\n private binding?: string;\n\n private locusUrl?: string;\n\n /**\n * Register to the websocket\n * @param {string} llmSocketUrl\n * @returns {Promise<void>}\n */\n private register = (llmSocketUrl: string): Promise<void> =>\n this.request({\n method: 'POST',\n url: llmSocketUrl,\n body: {deviceUrl: this.webex.internal.device.url},\n })\n .then((res: {body: {webSocketUrl: string; binding: string}}) => {\n this.webSocketUrl = res.body.webSocketUrl;\n this.binding = res.body.binding;\n })\n .catch((error: any) => {\n this.logger.error(`Error connecting to websocket: ${error}`);\n throw error;\n });\n\n /**\n * Register and connect to the websocket\n * @param {string} locusUrl\n * @param {string} datachannelUrl\n * @returns {Promise<void>}\n */\n public registerAndConnect = (locusUrl: string, datachannelUrl: string): Promise<void> =>\n this.register(datachannelUrl).then(() => {\n if (!locusUrl || !datachannelUrl) return undefined;\n this.locusUrl = locusUrl;\n this.connect(this.webSocketUrl);\n });\n\n /**\n * Tells if LLM socket is connected\n * @returns {boolean} connected\n */\n public isConnected = (): boolean => this.connected;\n\n /**\n * Tells if LLM socket is binding\n * @returns {string} binding\n */\n public getBinding = (): string => this.binding;\n\n /**\n * Get Locus URL for the connection\n * @returns {string} locus Url\n */\n public getLocusUrl = (): string => this.locusUrl;\n\n /**\n * Disconnects websocket connection\n * @returns {Promise<void>}\n */\n public disconnectLLM = (): Promise<void> =>\n this.disconnect().then(() => {\n this.locusUrl = undefined;\n this.binding = undefined;\n this.webSocketUrl = undefined;\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAEA;AAEA;AAAgC;AAAA;AAIzB,IAAMA,MAAM,GAAG;EACpBC,GAAG,EAAE;IACH;AACJ;AACA;AACA;IACIC,YAAY,EAAEC,OAAO,CAACC,GAAG,CAACC,qBAAqB,IAAI,KAAK;IACxD;AACJ;AACA;AACA;IACIC,WAAW,EAAEH,OAAO,CAACC,GAAG,CAACG,oBAAoB,IAAI,KAAK;IACtD;AACJ;AACA;AACA;IACIC,cAAc,EAAEL,OAAO,CAACC,GAAG,CAACK,wBAAwB,IAAI,K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AA,OAAc,MAAKI,QAAQ;IAAA;IAAA,4FAMzB;MAAA,OACrB,MAAKM,UAAU,EAAE,CAACb,IAAI,CAAC,YAAM;QAC3B,MAAKO,QAAQ,GAAGG,SAAS;QACzB,MAAKP,OAAO,GAAGO,SAAS;QACxB,MAAKR,YAAY,GAAGQ,SAAS;MAC/B,CAAC,CAAC;IAAA;IAAA;EAAA;EAAA;AAAA,EA5EmCI,8BAAO;AAAA"}
|
package/dist/llm.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["llm.types.ts"],"sourcesContent":["interface ILLMChannel {\n registerAndConnect: (locusUrl: string, datachannelUrl: string) => Promise<void>;\n isConnected: () => boolean;\n getBinding: () => string;\n getLocusUrl: () => string;\n disconnectLLM: () => Promise<void>;\n}\n// eslint-disable-next-line import/prefer-default-export\nexport {ILLMChannel};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["llm.types.ts"],"sourcesContent":["interface ILLMChannel {\n registerAndConnect: (locusUrl: string, datachannelUrl: string) => Promise<void>;\n isConnected: () => boolean;\n getBinding: () => string;\n getLocusUrl: () => string;\n disconnectLLM: () => Promise<void>;\n}\n// eslint-disable-next-line import/prefer-default-export\nexport type {ILLMChannel};\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/internal-plugin-llm",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.170",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"node": ">=16"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@webex/internal-plugin-llm": "3.0.0-beta.
|
|
18
|
-
"@webex/internal-plugin-mercury": "3.0.0-beta.
|
|
17
|
+
"@webex/internal-plugin-llm": "3.0.0-beta.170",
|
|
18
|
+
"@webex/internal-plugin-mercury": "3.0.0-beta.170"
|
|
19
19
|
},
|
|
20
20
|
"browserify": {
|
|
21
21
|
"transform": [
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@webex/test-helper-chai": "3.0.0-beta.
|
|
28
|
-
"@webex/test-helper-mock-webex": "3.0.0-beta.
|
|
27
|
+
"@webex/test-helper-chai": "3.0.0-beta.170",
|
|
28
|
+
"@webex/test-helper-mock-webex": "3.0.0-beta.170",
|
|
29
29
|
"sinon": "^9.2.4"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/llm.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable consistent-return */
|
|
2
2
|
|
|
3
3
|
import Mercury from '@webex/internal-plugin-mercury';
|
|
4
|
-
import {LoggerProxy} from '@webex/plugin-meetings';
|
|
5
4
|
|
|
6
5
|
import {LLM} from './constants';
|
|
7
6
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -50,7 +49,6 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
50
49
|
* @type {Boolean}
|
|
51
50
|
* @public
|
|
52
51
|
*/
|
|
53
|
-
private registered = false;
|
|
54
52
|
|
|
55
53
|
private webSocketUrl?: string;
|
|
56
54
|
|
|
@@ -58,18 +56,6 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
58
56
|
|
|
59
57
|
private locusUrl?: string;
|
|
60
58
|
|
|
61
|
-
/**
|
|
62
|
-
* Initializes the LLM Plugin
|
|
63
|
-
* @constructor
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
constructor(...args) {
|
|
67
|
-
// eslint-disable-next-line constructor-super
|
|
68
|
-
super(...args);
|
|
69
|
-
|
|
70
|
-
this.registered = false;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
59
|
/**
|
|
74
60
|
* Register to the websocket
|
|
75
61
|
* @param {string} llmSocketUrl
|
|
@@ -79,13 +65,14 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
79
65
|
this.request({
|
|
80
66
|
method: 'POST',
|
|
81
67
|
url: llmSocketUrl,
|
|
68
|
+
body: {deviceUrl: this.webex.internal.device.url},
|
|
82
69
|
})
|
|
83
70
|
.then((res: {body: {webSocketUrl: string; binding: string}}) => {
|
|
84
71
|
this.webSocketUrl = res.body.webSocketUrl;
|
|
85
72
|
this.binding = res.body.binding;
|
|
86
73
|
})
|
|
87
74
|
.catch((error: any) => {
|
|
88
|
-
|
|
75
|
+
this.logger.error(`Error connecting to websocket: ${error}`);
|
|
89
76
|
throw error;
|
|
90
77
|
});
|
|
91
78
|
|
|
@@ -99,20 +86,18 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
99
86
|
this.register(datachannelUrl).then(() => {
|
|
100
87
|
if (!locusUrl || !datachannelUrl) return undefined;
|
|
101
88
|
this.locusUrl = locusUrl;
|
|
102
|
-
this.connect(this.webSocketUrl)
|
|
103
|
-
this.registered = true;
|
|
104
|
-
});
|
|
89
|
+
this.connect(this.webSocketUrl);
|
|
105
90
|
});
|
|
106
91
|
|
|
107
92
|
/**
|
|
108
93
|
* Tells if LLM socket is connected
|
|
109
|
-
* @returns {boolean}
|
|
94
|
+
* @returns {boolean} connected
|
|
110
95
|
*/
|
|
111
|
-
public isConnected = (): boolean => this.
|
|
96
|
+
public isConnected = (): boolean => this.connected;
|
|
112
97
|
|
|
113
98
|
/**
|
|
114
|
-
* Tells if LLM socket is
|
|
115
|
-
* @returns {
|
|
99
|
+
* Tells if LLM socket is binding
|
|
100
|
+
* @returns {string} binding
|
|
116
101
|
*/
|
|
117
102
|
public getBinding = (): string => this.binding;
|
|
118
103
|
|
|
@@ -128,7 +113,6 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
128
113
|
*/
|
|
129
114
|
public disconnectLLM = (): Promise<void> =>
|
|
130
115
|
this.disconnect().then(() => {
|
|
131
|
-
this.registered = false;
|
|
132
116
|
this.locusUrl = undefined;
|
|
133
117
|
this.binding = undefined;
|
|
134
118
|
this.webSocketUrl = undefined;
|
package/src/llm.types.ts
CHANGED
package/test/unit/spec/llm.js
CHANGED
|
@@ -20,7 +20,9 @@ describe('plugin-llm', () => {
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
llmService = webex.internal.llm;
|
|
23
|
-
llmService.connect = sinon.stub().
|
|
23
|
+
llmService.connect = sinon.stub().callsFake(() => {
|
|
24
|
+
llmService.connected = true;
|
|
25
|
+
});
|
|
24
26
|
llmService.disconnect = sinon.stub().resolves(true);
|
|
25
27
|
llmService.request = sinon.stub().resolves({
|
|
26
28
|
headers: {},
|
|
@@ -65,6 +67,7 @@ describe('plugin-llm', () => {
|
|
|
65
67
|
sinon.match({
|
|
66
68
|
method: 'POST',
|
|
67
69
|
url: `${datachannelUrl}`,
|
|
70
|
+
body: {deviceUrl: webex.internal.device.url},
|
|
68
71
|
})
|
|
69
72
|
);
|
|
70
73
|
|