@webex/internal-plugin-llm 3.0.0-bnr.4 → 3.0.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.
- package/.eslintrc.js +6 -0
- package/babel.config.js +3 -0
- package/dist/constants.js +1 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/llm.js +40 -31
- package/dist/llm.js.map +1 -1
- package/jest.config.js +3 -0
- package/package.json +24 -7
- package/process +1 -0
- package/src/llm.ts +5 -21
- package/test/unit/spec/llm.js +3 -1
- package/dist/internal-plugin-llm.d.ts +0 -68
- package/dist/tsdoc-metadata.json +0 -11
- package/dist/types/constants.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/llm.d.ts +0 -88
- package/dist/types/llm.types.d.ts +0 -8
package/.eslintrc.js
ADDED
package/babel.config.js
ADDED
package/dist/constants.js
CHANGED
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LLM"],"sources":["constants.ts"],"sourcesContent":["// eslint-disable-next-line import/prefer-default-export\nexport const LLM = 'llm';\n"],"mappings":";;;;;;;AAAA;AACO,IAAMA,GAAG,GAAG,KAAK
|
|
1
|
+
{"version":3,"names":["LLM","exports"],"sources":["constants.ts"],"sourcesContent":["// eslint-disable-next-line import/prefer-default-export\nexport const LLM = 'llm';\n"],"mappings":";;;;;;;AAAA;AACO,IAAMA,GAAG,GAAAC,OAAA,CAAAD,GAAA,GAAG,KAAK"}
|
package/dist/index.js
CHANGED
|
@@ -15,8 +15,8 @@ _Object$defineProperty(exports, "default", {
|
|
|
15
15
|
});
|
|
16
16
|
var WebexCore = _interopRequireWildcard(require("@webex/webex-core"));
|
|
17
17
|
var _llm = _interopRequireWildcard(require("./llm"));
|
|
18
|
-
function _getRequireWildcardCache(
|
|
19
|
-
function _interopRequireWildcard(
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
20
|
WebexCore.registerInternalPlugin('llm', _llm.default, {
|
|
21
21
|
config: _llm.config
|
|
22
22
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WebexCore","registerInternalPlugin","LLMChannel","config"],"sources":["index.ts"],"sourcesContent":["import * as WebexCore from '@webex/webex-core';\nimport LLMChannel, {config} from './llm';\n\nWebexCore.registerInternalPlugin('llm', LLMChannel, {\n config,\n});\n\nexport {default} from './llm';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AAAyC;AAAA;
|
|
1
|
+
{"version":3,"names":["WebexCore","_interopRequireWildcard","require","_llm","_getRequireWildcardCache","e","_WeakMap","r","t","__esModule","_typeof","default","has","get","n","__proto__","a","_Object$defineProperty","_Object$getOwnPropertyDescriptor","u","Object","prototype","hasOwnProperty","call","i","set","registerInternalPlugin","LLMChannel","config"],"sources":["index.ts"],"sourcesContent":["import * as WebexCore from '@webex/webex-core';\nimport LLMChannel, {config} from './llm';\n\nWebexCore.registerInternalPlugin('llm', LLMChannel, {\n config,\n});\n\nexport {default} from './llm';\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,G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@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/he
|
|
|
17
17
|
var _internalPluginMercury = _interopRequireDefault(require("@webex/internal-plugin-mercury"));
|
|
18
18
|
var _constants = require("./constants");
|
|
19
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); }; }
|
|
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; } }
|
|
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; } } /* eslint-disable consistent-return */
|
|
21
|
+
// eslint-disable-next-line no-unused-vars
|
|
22
|
+
|
|
23
|
+
var config = exports.config = {
|
|
22
24
|
llm: {
|
|
23
25
|
/**
|
|
24
26
|
* Milliseconds between pings sent up the socket
|
|
@@ -52,35 +54,31 @@ var config = {
|
|
|
52
54
|
/**
|
|
53
55
|
* LLMChannel to provide socket connections
|
|
54
56
|
*/
|
|
55
|
-
exports.
|
|
56
|
-
var LLMChannel = /*#__PURE__*/function (_ref) {
|
|
57
|
+
var LLMChannel = exports.default = /*#__PURE__*/function (_ref) {
|
|
57
58
|
(0, _inherits2.default)(LLMChannel, _ref);
|
|
58
59
|
var _super = _createSuper(LLMChannel);
|
|
59
|
-
/**
|
|
60
|
-
* If the LLM plugin has been registered and listening
|
|
61
|
-
* @instance
|
|
62
|
-
* @type {Boolean}
|
|
63
|
-
* @public
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Initializes the LLM Plugin
|
|
68
|
-
* @constructor
|
|
69
|
-
* @public
|
|
70
|
-
*/
|
|
71
60
|
function LLMChannel() {
|
|
72
61
|
var _this;
|
|
73
62
|
(0, _classCallCheck2.default)(this, LLMChannel);
|
|
74
63
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
75
64
|
args[_key] = arguments[_key];
|
|
76
65
|
}
|
|
77
|
-
// eslint-disable-next-line constructor-super
|
|
78
66
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
79
67
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "namespace", _constants.LLM);
|
|
80
|
-
|
|
68
|
+
/**
|
|
69
|
+
* If the LLM plugin has been registered and listening
|
|
70
|
+
* @instance
|
|
71
|
+
* @type {Boolean}
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
81
74
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webSocketUrl", void 0);
|
|
82
75
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "binding", void 0);
|
|
83
76
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "locusUrl", void 0);
|
|
77
|
+
/**
|
|
78
|
+
* Register to the websocket
|
|
79
|
+
* @param {string} llmSocketUrl
|
|
80
|
+
* @returns {Promise<void>}
|
|
81
|
+
*/
|
|
84
82
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "register", function (llmSocketUrl) {
|
|
85
83
|
return _this.request({
|
|
86
84
|
method: 'POST',
|
|
@@ -96,42 +94,53 @@ var LLMChannel = /*#__PURE__*/function (_ref) {
|
|
|
96
94
|
throw error;
|
|
97
95
|
});
|
|
98
96
|
});
|
|
97
|
+
/**
|
|
98
|
+
* Register and connect to the websocket
|
|
99
|
+
* @param {string} locusUrl
|
|
100
|
+
* @param {string} datachannelUrl
|
|
101
|
+
* @returns {Promise<void>}
|
|
102
|
+
*/
|
|
99
103
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "registerAndConnect", function (locusUrl, datachannelUrl) {
|
|
100
104
|
return _this.register(datachannelUrl).then(function () {
|
|
101
105
|
if (!locusUrl || !datachannelUrl) return undefined;
|
|
102
106
|
_this.locusUrl = locusUrl;
|
|
103
|
-
_this.connect(_this.webSocketUrl)
|
|
104
|
-
_this.registered = true;
|
|
105
|
-
});
|
|
107
|
+
_this.connect(_this.webSocketUrl);
|
|
106
108
|
});
|
|
107
109
|
});
|
|
110
|
+
/**
|
|
111
|
+
* Tells if LLM socket is connected
|
|
112
|
+
* @returns {boolean} connected
|
|
113
|
+
*/
|
|
108
114
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isConnected", function () {
|
|
109
|
-
return _this.
|
|
115
|
+
return _this.connected;
|
|
110
116
|
});
|
|
117
|
+
/**
|
|
118
|
+
* Tells if LLM socket is binding
|
|
119
|
+
* @returns {string} binding
|
|
120
|
+
*/
|
|
111
121
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getBinding", function () {
|
|
112
122
|
return _this.binding;
|
|
113
123
|
});
|
|
124
|
+
/**
|
|
125
|
+
* Get Locus URL for the connection
|
|
126
|
+
* @returns {string} locus Url
|
|
127
|
+
*/
|
|
114
128
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLocusUrl", function () {
|
|
115
129
|
return _this.locusUrl;
|
|
116
130
|
});
|
|
131
|
+
/**
|
|
132
|
+
* Disconnects websocket connection
|
|
133
|
+
* @returns {Promise<void>}
|
|
134
|
+
*/
|
|
117
135
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "disconnectLLM", function () {
|
|
118
136
|
return _this.disconnect().then(function () {
|
|
119
|
-
_this.registered = false;
|
|
120
137
|
_this.locusUrl = undefined;
|
|
121
138
|
_this.binding = undefined;
|
|
122
139
|
_this.webSocketUrl = undefined;
|
|
123
140
|
});
|
|
124
141
|
});
|
|
125
|
-
_this.registered = false;
|
|
126
142
|
return _this;
|
|
127
143
|
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Register to the websocket
|
|
131
|
-
* @param {string} llmSocketUrl
|
|
132
|
-
* @returns {Promise<void>}
|
|
133
|
-
*/
|
|
134
144
|
return (0, _createClass2.default)(LLMChannel);
|
|
135
145
|
}(_internalPluginMercury.default);
|
|
136
|
-
exports.default = LLMChannel;
|
|
137
146
|
//# sourceMappingURL=llm.js.map
|
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","args","LLM","llmSocketUrl","request","method","url","body","deviceUrl","webex","internal","device","then","res","webSocketUrl","binding","catch","error","logger","locusUrl","datachannelUrl","register","undefined","connect","
|
|
1
|
+
{"version":3,"names":["_internalPluginMercury","_interopRequireDefault","require","_constants","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","config","exports","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","_ref","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","LLM","llmSocketUrl","request","method","url","body","deviceUrl","webex","internal","device","then","res","webSocketUrl","binding","catch","error","logger","locusUrl","datachannelUrl","register","undefined","connect","connected","disconnect","_createClass2","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,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAAgC,SAAAE,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAH,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAP,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAY,OAAA,qBAAAJ,kBAAA,oBAAAA,kBAAA,CAAAK,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,kBAAA,CAAAO,OAAA,8CAAAI,CAAA,sBAJhC;AAKA;;AAGO,IAAMC,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KAAA,CAAK+B,OAAO,CAAC/B,KAAA,CAAKsB,YAAY,CAAC;MACjC,CAAC,CAAC;IAAA;IAEJ;AACF;AACA;AACA;IAHE,IAAAd,gBAAA,CAAA3C,OAAA,MAAA4C,uBAAA,CAAA5C,OAAA,EAAAmC,KAAA,kBAIqB;MAAA,OAAeA,KAAA,CAAKgC,SAAS;IAAA;IAElD;AACF;AACA;AACA;IAHE,IAAAxB,gBAAA,CAAA3C,OAAA,MAAA4C,uBAAA,CAAA5C,OAAA,EAAAmC,KAAA,iBAIoB;MAAA,OAAcA,KAAA,CAAKuB,OAAO;IAAA;IAE9C;AACF;AACA;AACA;IAHE,IAAAf,gBAAA,CAAA3C,OAAA,MAAA4C,uBAAA,CAAA5C,OAAA,EAAAmC,KAAA,kBAIqB;MAAA,OAAcA,KAAA,CAAK2B,QAAQ;IAAA;IAEhD;AACF;AACA;AACA;IAHE,IAAAnB,gBAAA,CAAA3C,OAAA,MAAA4C,uBAAA,CAAA5C,OAAA,EAAAmC,KAAA,oBAIuB;MAAA,OACrBA,KAAA,CAAKiC,UAAU,CAAC,CAAC,CAACb,IAAI,CAAC,YAAM;QAC3BpB,KAAA,CAAK2B,QAAQ,GAAGG,SAAS;QACzB9B,KAAA,CAAKuB,OAAO,GAAGO,SAAS;QACxB9B,KAAA,CAAKsB,YAAY,GAAGQ,SAAS;MAC/B,CAAC,CAAC;IAAA;IAAA,OAAA9B,KAAA;EAAA;EAAA,WAAAkC,aAAA,CAAArE,OAAA,EAAA+B,UAAA;AAAA,EA5EmCuC,8BAAO"}
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/internal-plugin-llm",
|
|
3
|
-
"version": "3.0.0-bnr.4",
|
|
4
3
|
"description": "",
|
|
5
4
|
"license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
|
|
6
5
|
"main": "dist/index.js",
|
|
@@ -14,8 +13,7 @@
|
|
|
14
13
|
"node": ">=16"
|
|
15
14
|
},
|
|
16
15
|
"dependencies": {
|
|
17
|
-
"@webex/internal-plugin-
|
|
18
|
-
"@webex/internal-plugin-mercury": "workspace:^"
|
|
16
|
+
"@webex/internal-plugin-mercury": "3.0.0"
|
|
19
17
|
},
|
|
20
18
|
"browserify": {
|
|
21
19
|
"transform": [
|
|
@@ -24,8 +22,27 @@
|
|
|
24
22
|
]
|
|
25
23
|
},
|
|
26
24
|
"devDependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@webex/
|
|
25
|
+
"@babel/core": "^7.17.10",
|
|
26
|
+
"@webex/babel-config-legacy": "0.0.0",
|
|
27
|
+
"@webex/eslint-config-legacy": "0.0.0",
|
|
28
|
+
"@webex/jest-config-legacy": "0.0.0",
|
|
29
|
+
"@webex/legacy-tools": "0.0.0",
|
|
30
|
+
"@webex/test-helper-chai": "3.0.0",
|
|
31
|
+
"@webex/test-helper-mocha": "3.0.0",
|
|
32
|
+
"@webex/test-helper-mock-webex": "3.0.0",
|
|
33
|
+
"@webex/test-helper-test-users": "3.0.0",
|
|
34
|
+
"eslint": "^8.24.0",
|
|
35
|
+
"prettier": "^2.7.1",
|
|
29
36
|
"sinon": "^9.2.4"
|
|
30
|
-
}
|
|
31
|
-
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "yarn build:src",
|
|
40
|
+
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
|
|
41
|
+
"deploy:npm": "yarn npm publish",
|
|
42
|
+
"test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
|
|
43
|
+
"test:browser": "webex-legacy-tools test --integration --runner karma",
|
|
44
|
+
"test:style": "eslint ./src/**/*.*",
|
|
45
|
+
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
46
|
+
},
|
|
47
|
+
"version": "3.0.0"
|
|
48
|
+
}
|
package/process
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {browser: true};
|
package/src/llm.ts
CHANGED
|
@@ -49,7 +49,6 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
49
49
|
* @type {Boolean}
|
|
50
50
|
* @public
|
|
51
51
|
*/
|
|
52
|
-
private registered = false;
|
|
53
52
|
|
|
54
53
|
private webSocketUrl?: string;
|
|
55
54
|
|
|
@@ -57,18 +56,6 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
57
56
|
|
|
58
57
|
private locusUrl?: string;
|
|
59
58
|
|
|
60
|
-
/**
|
|
61
|
-
* Initializes the LLM Plugin
|
|
62
|
-
* @constructor
|
|
63
|
-
* @public
|
|
64
|
-
*/
|
|
65
|
-
constructor(...args) {
|
|
66
|
-
// eslint-disable-next-line constructor-super
|
|
67
|
-
super(...args);
|
|
68
|
-
|
|
69
|
-
this.registered = false;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
59
|
/**
|
|
73
60
|
* Register to the websocket
|
|
74
61
|
* @param {string} llmSocketUrl
|
|
@@ -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/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: {},
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
declare interface ILLMChannel {
|
|
2
|
-
registerAndConnect: (locusUrl: string, datachannelUrl: string) => Promise<void>;
|
|
3
|
-
isConnected: () => boolean;
|
|
4
|
-
getBinding: () => string;
|
|
5
|
-
getLocusUrl: () => string;
|
|
6
|
-
disconnectLLM: () => Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* LLMChannel to provide socket connections
|
|
11
|
-
*/
|
|
12
|
-
declare class LLMChannel extends LLMChannel_base implements ILLMChannel {
|
|
13
|
-
namespace: string;
|
|
14
|
-
/**
|
|
15
|
-
* If the LLM plugin has been registered and listening
|
|
16
|
-
* @instance
|
|
17
|
-
* @type {Boolean}
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
private registered;
|
|
21
|
-
private webSocketUrl?;
|
|
22
|
-
private binding?;
|
|
23
|
-
private locusUrl?;
|
|
24
|
-
/**
|
|
25
|
-
* Initializes the LLM Plugin
|
|
26
|
-
* @constructor
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
constructor(...args: any[]);
|
|
30
|
-
/**
|
|
31
|
-
* Register to the websocket
|
|
32
|
-
* @param {string} llmSocketUrl
|
|
33
|
-
* @returns {Promise<void>}
|
|
34
|
-
*/
|
|
35
|
-
private register;
|
|
36
|
-
/**
|
|
37
|
-
* Register and connect to the websocket
|
|
38
|
-
* @param {string} locusUrl
|
|
39
|
-
* @param {string} datachannelUrl
|
|
40
|
-
* @returns {Promise<void>}
|
|
41
|
-
*/
|
|
42
|
-
registerAndConnect: (locusUrl: string, datachannelUrl: string) => Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Tells if LLM socket is connected
|
|
45
|
-
* @returns {boolean} isRegistered
|
|
46
|
-
*/
|
|
47
|
-
isConnected: () => boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Tells if LLM socket is connected
|
|
50
|
-
* @returns {bool} isRegistered
|
|
51
|
-
*/
|
|
52
|
-
getBinding: () => string;
|
|
53
|
-
/**
|
|
54
|
-
* Get Locus URL for the connection
|
|
55
|
-
* @returns {string} locus Url
|
|
56
|
-
*/
|
|
57
|
-
getLocusUrl: () => string;
|
|
58
|
-
/**
|
|
59
|
-
* Disconnects websocket connection
|
|
60
|
-
* @returns {Promise<void>}
|
|
61
|
-
*/
|
|
62
|
-
disconnectLLM: () => Promise<void>;
|
|
63
|
-
}
|
|
64
|
-
export default LLMChannel;
|
|
65
|
-
|
|
66
|
-
declare const LLMChannel_base: any;
|
|
67
|
-
|
|
68
|
-
export { }
|
package/dist/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.34.4"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const LLM = "llm";
|
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './llm';
|
package/dist/types/llm.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { ILLMChannel } from './llm.types';
|
|
2
|
-
export declare const config: {
|
|
3
|
-
llm: {
|
|
4
|
-
/**
|
|
5
|
-
* Milliseconds between pings sent up the socket
|
|
6
|
-
* @type {number}
|
|
7
|
-
*/
|
|
8
|
-
pingInterval: string | number;
|
|
9
|
-
/**
|
|
10
|
-
* Milliseconds to wait for a pong before declaring the connection dead
|
|
11
|
-
* @type {number}
|
|
12
|
-
*/
|
|
13
|
-
pongTimeout: string | number;
|
|
14
|
-
/**
|
|
15
|
-
* Maximum milliseconds between connection attempts
|
|
16
|
-
* @type {Number}
|
|
17
|
-
*/
|
|
18
|
-
backoffTimeMax: string | number;
|
|
19
|
-
/**
|
|
20
|
-
* Initial milliseconds between connection attempts
|
|
21
|
-
* @type {Number}
|
|
22
|
-
*/
|
|
23
|
-
backoffTimeReset: string | number;
|
|
24
|
-
/**
|
|
25
|
-
* Milliseconds to wait for a close frame before declaring the socket dead and
|
|
26
|
-
* discarding it
|
|
27
|
-
* @type {[type]}
|
|
28
|
-
*/
|
|
29
|
-
forceCloseDelay: string | number;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
declare const LLMChannel_base: any;
|
|
33
|
-
/**
|
|
34
|
-
* LLMChannel to provide socket connections
|
|
35
|
-
*/
|
|
36
|
-
export default class LLMChannel extends LLMChannel_base implements ILLMChannel {
|
|
37
|
-
namespace: string;
|
|
38
|
-
/**
|
|
39
|
-
* If the LLM plugin has been registered and listening
|
|
40
|
-
* @instance
|
|
41
|
-
* @type {Boolean}
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
private registered;
|
|
45
|
-
private webSocketUrl?;
|
|
46
|
-
private binding?;
|
|
47
|
-
private locusUrl?;
|
|
48
|
-
/**
|
|
49
|
-
* Initializes the LLM Plugin
|
|
50
|
-
* @constructor
|
|
51
|
-
* @public
|
|
52
|
-
*/
|
|
53
|
-
constructor(...args: any[]);
|
|
54
|
-
/**
|
|
55
|
-
* Register to the websocket
|
|
56
|
-
* @param {string} llmSocketUrl
|
|
57
|
-
* @returns {Promise<void>}
|
|
58
|
-
*/
|
|
59
|
-
private register;
|
|
60
|
-
/**
|
|
61
|
-
* Register and connect to the websocket
|
|
62
|
-
* @param {string} locusUrl
|
|
63
|
-
* @param {string} datachannelUrl
|
|
64
|
-
* @returns {Promise<void>}
|
|
65
|
-
*/
|
|
66
|
-
registerAndConnect: (locusUrl: string, datachannelUrl: string) => Promise<void>;
|
|
67
|
-
/**
|
|
68
|
-
* Tells if LLM socket is connected
|
|
69
|
-
* @returns {boolean} isRegistered
|
|
70
|
-
*/
|
|
71
|
-
isConnected: () => boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Tells if LLM socket is connected
|
|
74
|
-
* @returns {bool} isRegistered
|
|
75
|
-
*/
|
|
76
|
-
getBinding: () => string;
|
|
77
|
-
/**
|
|
78
|
-
* Get Locus URL for the connection
|
|
79
|
-
* @returns {string} locus Url
|
|
80
|
-
*/
|
|
81
|
-
getLocusUrl: () => string;
|
|
82
|
-
/**
|
|
83
|
-
* Disconnects websocket connection
|
|
84
|
-
* @returns {Promise<void>}
|
|
85
|
-
*/
|
|
86
|
-
disconnectLLM: () => Promise<void>;
|
|
87
|
-
}
|
|
88
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
interface ILLMChannel {
|
|
2
|
-
registerAndConnect: (locusUrl: string, datachannelUrl: string) => Promise<void>;
|
|
3
|
-
isConnected: () => boolean;
|
|
4
|
-
getBinding: () => string;
|
|
5
|
-
getLocusUrl: () => string;
|
|
6
|
-
disconnectLLM: () => Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
export type { ILLMChannel };
|