@webex/internal-plugin-ai-assistant 3.11.0-next.6 → 3.11.0-next.7
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/ai-assistant.js +15 -6
- package/dist/ai-assistant.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/ai-assistant.ts +10 -1
- package/src/types.ts +2 -0
- package/test/unit/spec/ai-assistant.ts +59 -0
package/dist/ai-assistant.js
CHANGED
|
@@ -196,7 +196,8 @@ var AIAssistant = _webexCore.WebexPlugin.extend({
|
|
|
196
196
|
_request: function _request(options) {
|
|
197
197
|
var _this4 = this;
|
|
198
198
|
var resource = options.resource,
|
|
199
|
-
params = options.params
|
|
199
|
+
params = options.params,
|
|
200
|
+
headers = options.headers;
|
|
200
201
|
var timeout = this.config.requestTimeout;
|
|
201
202
|
var requestId = options.requestId || _uuid.default.v4();
|
|
202
203
|
var eventName = this._getResultEventName(requestId);
|
|
@@ -267,7 +268,8 @@ var AIAssistant = _webexCore.WebexPlugin.extend({
|
|
|
267
268
|
contentType: 'application/json',
|
|
268
269
|
body: _objectSpread({
|
|
269
270
|
clientRequestId: requestId
|
|
270
|
-
}, params)
|
|
271
|
+
}, params),
|
|
272
|
+
headers: headers
|
|
271
273
|
}).then(function (_ref2) {
|
|
272
274
|
var body = _ref2.body;
|
|
273
275
|
resolve(_objectSpread(_objectSpread({}, body), {}, {
|
|
@@ -293,6 +295,7 @@ var AIAssistant = _webexCore.WebexPlugin.extend({
|
|
|
293
295
|
* @param {Object} options.locale optional locale to use for the request, defaults to 'en_US'
|
|
294
296
|
* @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated
|
|
295
297
|
* @param {string} options.entryPoint optional entryPoint to use for this request
|
|
298
|
+
* @param {string} options.renderProtocolVersion optional render protocol version to use for this request
|
|
296
299
|
* @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName
|
|
297
300
|
* @public
|
|
298
301
|
* @memberof AIAssistant
|
|
@@ -300,7 +303,7 @@ var AIAssistant = _webexCore.WebexPlugin.extend({
|
|
|
300
303
|
makeAiAssistantRequest: function makeAiAssistantRequest(options) {
|
|
301
304
|
var _this5 = this;
|
|
302
305
|
return (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
303
|
-
var value, content;
|
|
306
|
+
var value, content, headers;
|
|
304
307
|
return _regenerator.default.wrap(function (_context3) {
|
|
305
308
|
while (1) switch (_context3.prev = _context3.next) {
|
|
306
309
|
case 0:
|
|
@@ -328,7 +331,11 @@ var AIAssistant = _webexCore.WebexPlugin.extend({
|
|
|
328
331
|
if (options.parameters) {
|
|
329
332
|
content.parameters = options.parameters;
|
|
330
333
|
}
|
|
331
|
-
|
|
334
|
+
headers = {};
|
|
335
|
+
if (options.renderProtocolVersion) {
|
|
336
|
+
headers['AI-Assistant-Render-Protocol'] = options.renderProtocolVersion;
|
|
337
|
+
}
|
|
338
|
+
return _context3.abrupt("return", _this5._request(_objectSpread(_objectSpread({
|
|
332
339
|
resource: options.sessionId ? "sessions/".concat(options.sessionId, "/messages") : 'sessions/messages',
|
|
333
340
|
params: _objectSpread(_objectSpread({
|
|
334
341
|
async: 'chunked',
|
|
@@ -341,7 +348,9 @@ var AIAssistant = _webexCore.WebexPlugin.extend({
|
|
|
341
348
|
} : {})
|
|
342
349
|
}, options.requestId ? {
|
|
343
350
|
requestId: options.requestId
|
|
344
|
-
} : {})
|
|
351
|
+
} : {}), {}, {
|
|
352
|
+
headers: headers
|
|
353
|
+
})));
|
|
345
354
|
case 3:
|
|
346
355
|
case "end":
|
|
347
356
|
return _context3.stop();
|
|
@@ -466,7 +475,7 @@ var AIAssistant = _webexCore.WebexPlugin.extend({
|
|
|
466
475
|
contentValue: options.question
|
|
467
476
|
}));
|
|
468
477
|
},
|
|
469
|
-
version: "3.11.0-next.
|
|
478
|
+
version: "3.11.0-next.7"
|
|
470
479
|
});
|
|
471
480
|
var _default = exports.default = AIAssistant;
|
|
472
481
|
//# sourceMappingURL=ai-assistant.js.map
|
package/dist/ai-assistant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_uuid","_interopRequireDefault","require","_webexCore","_lodash","_commonTimers","_constants","_utils","ownKeys","e","r","t","_Object$keys","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","AIAssistant","WebexPlugin","extend","namespace","registered","initialize","_len","args","Array","_key","_apply","prototype","register","_this","webex","canAuthorize","logger","error","_promise","reject","Error","info","resolve","internal","mercury","connect","then","listenForEvents","trigger","AI_ASSISTANT_REGISTERED","catch","concat","message","unregister","stopListeningForEvents","AI_ASSISTANT_UNREGISTERED","_this2","on","ASSISTANT_API_RESPONSE_EVENT","envelope","_handleEvent","data","off","_getResultEventName","requestId","AI_ASSISTANT_RESULT","_getStreamEventName","AI_ASSISTANT_STREAM","clientRequestId","_decryptContent","responseContent","_this3","_asyncToGenerator2","_regenerator","mark","_callee","_t","wrap","_context","prev","next","name","RESPONSE_NAMES","MESSAGE","CITED_ANSWER","SCHEDULE_MEETING","TOOL_RESULT","TOOL_USE","WORKSPACE","decryptMessage","abrupt","decryptCitedAnswer","decryptScheduleMeeting","decryptToolUse","decryptWorkspace","stop","_request","options","_this4","resource","params","timeout","config","requestTimeout","uuid","v4","eventName","streamEventName","timer","Timer","stopListening","finished","errorMessage","AI_ASSISTANT_ERRORS","AI_ASSISTANT_TIMEOUT","errorCode","AI_ASSISTANT_ERROR_CODES","listenTo","_ref","_callee2","resultData","responseType","decryptErrorMessage","_t2","_context2","reset","get","cancel","merge","response","_x","request","service","AI_ASSISTANT_SERVICE_NAME","method","contentType","body","_ref2","start","makeAiAssistantRequest","_this5","_callee3","value","content","_context3","contentValue","_encryptData","text","encryptionKeyUrl","sent","context","resources","contextResources","type","parameters","sessionId","async","locale","entryPoint","assistant","summarizeMeeting","CONTENT_TYPES","ACTION","ACTION_TYPES","SUMMARIZE_FOR_ME","id","meetingInstanceId","CONTEXT_RESOURCE_TYPES","MEETING","url","meetingSite","lastMinutes","wasMyNameMentioned","WAS_MY_NAME_MENTIONED","showAllActionItems","SHOW_ALL_ACTION_ITEMS","_ref3","_this6","_callee4","result","_context4","encryption","encryptText","askMeAnything","question","version","_default","exports"],"sources":["ai-assistant.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2022 Cisco Systems, Inc. See LICENSE file.\n */\nimport uuid from 'uuid';\nimport {WebexPlugin} from '@webex/webex-core';\nimport '@webex/internal-plugin-mercury';\nimport {get, merge} from 'lodash';\nimport {Timer} from '@webex/common-timers';\n\nimport {\n AiAssistantRequestOptions,\n RequestOptions,\n RequestResponse,\n SummarizeMeetingOptions,\n} from './types';\nimport {\n AI_ASSISTANT_ERROR_CODES,\n AI_ASSISTANT_ERRORS,\n AI_ASSISTANT_REGISTERED,\n AI_ASSISTANT_RESULT,\n AI_ASSISTANT_STREAM,\n AI_ASSISTANT_UNREGISTERED,\n AI_ASSISTANT_SERVICE_NAME,\n ASSISTANT_API_RESPONSE_EVENT,\n ACTION_TYPES,\n CONTENT_TYPES,\n CONTEXT_RESOURCE_TYPES,\n RESPONSE_NAMES,\n} from './constants';\nimport {\n decryptCitedAnswer,\n decryptMessage,\n decryptScheduleMeeting,\n decryptToolUse,\n decryptWorkspace,\n} from './utils';\n\nconst AIAssistant = WebexPlugin.extend({\n namespace: 'AIAssistant',\n\n /**\n * registered value indicating events registration is successful\n * @instance\n * @type {Boolean}\n * @memberof AIAssistant\n */\n registered: false,\n\n /**\n * Initializer\n * @private\n * @param {Object} attrs\n * @param {Object} options\n * @returns {undefined}\n */\n initialize(...args) {\n Reflect.apply(WebexPlugin.prototype.initialize, this, args);\n },\n\n /**\n * Explicitly sets up the AI assistant plugin by connecting to mercury, and listening for AI assistant events.\n * @returns {Promise}\n * @public\n * @memberof AIAssistant\n */\n register() {\n if (!this.webex.canAuthorize) {\n this.logger.error('AI assistant->register#ERROR, Unable to register, SDK cannot authorize');\n\n return Promise.reject(new Error('SDK cannot authorize'));\n }\n\n if (this.registered) {\n this.logger.info('AI assistant->register#INFO, AI assistant plugin already registered');\n\n return Promise.resolve();\n }\n\n return this.webex.internal.mercury\n .connect()\n .then(() => {\n this.listenForEvents();\n this.trigger(AI_ASSISTANT_REGISTERED);\n this.registered = true;\n })\n .catch((error) => {\n this.logger.error(`AI assistant->register#ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Explicitly tears down the AI assistant plugin by disconnecting from mercury, and stops listening to AI assistant events\n * @returns {Promise}\n * @public\n * @memberof AIAssistant\n */\n unregister() {\n if (!this.registered) {\n this.logger.info('AI assistant->unregister#INFO, AI assistant plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n this.trigger(AI_ASSISTANT_UNREGISTERED);\n this.registered = false;\n\n return Promise.resolve();\n },\n\n /**\n * registers for Assistant API events through mercury\n * @returns {undefined}\n * @private\n */\n listenForEvents() {\n this.webex.internal.mercury.on(ASSISTANT_API_RESPONSE_EVENT, (envelope) => {\n this._handleEvent(envelope.data);\n });\n },\n\n /**\n * unregisteres all the Assistant API events from mercury\n * @returns {undefined}\n * @private\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off(ASSISTANT_API_RESPONSE_EVENT);\n },\n\n /**\n * constructs the event name based on request id\n * This is used by the plugin to listen for the result of a particular request\n * @param {UUID} requestId the id of the request\n * @returns {string}\n */\n _getResultEventName(requestId: string) {\n return `${AI_ASSISTANT_RESULT}:${requestId}`;\n },\n\n /**\n * constructs the stream event name based on request id\n * This is used by the consumer to listen for the stream (i.e. the data) of a particular request\n * @param {UUID} requestId the id of the request\n * @returns {string}\n */\n _getStreamEventName(requestId: string) {\n return `${AI_ASSISTANT_STREAM}:${requestId}`;\n },\n\n /**\n * Takes incoming data and triggers correct events\n * @param {Object} data the event data\n * @returns {undefined}\n */\n _handleEvent(data) {\n this.trigger(this._getResultEventName(data.clientRequestId), data);\n },\n\n /**\n * Decrypts the response content in place\n * @param {any} responseContent the content object from the assistant-api response\n * @returns {Promise} resolves once decryption is complete\n */\n async _decryptContent(responseContent) {\n switch (responseContent.name) {\n case RESPONSE_NAMES.MESSAGE: {\n await decryptMessage(responseContent, this.webex);\n break;\n }\n case RESPONSE_NAMES.CITED_ANSWER: {\n await decryptCitedAnswer(responseContent, this.webex);\n break;\n }\n case RESPONSE_NAMES.SCHEDULE_MEETING: {\n await decryptScheduleMeeting(responseContent, this.webex);\n break;\n }\n case RESPONSE_NAMES.TOOL_RESULT: {\n // No encrypted content in tool_result\n break;\n }\n case RESPONSE_NAMES.TOOL_USE: {\n await decryptToolUse(responseContent, this.webex);\n break;\n }\n case RESPONSE_NAMES.WORKSPACE: {\n await decryptWorkspace(responseContent, this.webex);\n break;\n }\n default:\n this.logger.error(\n `AI assistant->_decryptContent#ERROR, Unknown response content name: ${responseContent.name}`\n );\n }\n },\n\n /**\n * Makes the request to the AI assistant service\n * @param {Object} options\n * @param {string} options.resource the URL to query\n * @param {Mixed} options.params additional params for the body of the request\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n */\n _request(options: RequestOptions): Promise<RequestResponse> {\n const {resource, params} = options;\n\n const timeout = this.config.requestTimeout;\n const requestId = options.requestId || uuid.v4();\n const eventName = this._getResultEventName(requestId);\n const streamEventName = this._getStreamEventName(requestId);\n\n // eslint-disable-next-line no-async-promise-executor\n return new Promise((resolve, reject) => {\n const timer = new Timer(() => {\n this.stopListening(this, eventName);\n this.trigger(streamEventName, {\n requestId,\n finished: true,\n errorMessage: AI_ASSISTANT_ERRORS.AI_ASSISTANT_TIMEOUT,\n errorCode: AI_ASSISTANT_ERROR_CODES.AI_ASSISTANT_TIMEOUT,\n });\n }, timeout);\n\n this.listenTo(this, eventName, async (data) => {\n timer.reset();\n const resultData = get(data, 'response.content', {});\n const errorMessage = get(data, 'response.errorMessage');\n const errorCode = get(data, 'response.errorCode');\n const responseType = get(data, 'responseType');\n\n if (data.finished) {\n timer.cancel();\n this.stopListening(this, eventName);\n }\n\n let decryptErrorMessage;\n\n try {\n if (!errorCode) {\n await this._decryptContent(resultData);\n }\n } catch (decryptError) {\n decryptErrorMessage = decryptError.message;\n }\n\n this.trigger(\n streamEventName,\n merge({}, data.response, {\n responseType,\n requestId,\n finished: data.finished,\n errorMessage: errorMessage || decryptErrorMessage,\n errorCode,\n })\n );\n });\n\n this.webex\n .request({\n service: AI_ASSISTANT_SERVICE_NAME,\n resource,\n method: 'POST',\n contentType: 'application/json',\n body: {clientRequestId: requestId, ...params},\n })\n .then(({body}) => {\n resolve({...body, requestId, streamEventName});\n })\n .catch((error) => {\n reject(error);\n });\n\n timer.start();\n });\n },\n\n /**\n * Common method to make AI assistant requests for meeting analysis\n * @param {Object} options\n * @param {string} options.contextResources array of context resources to include in the request\n * @param {string} options.sessionId the session ID for subsequent requests, not required for the first request\n * @param {string} options.encryptionKeyUrl the encryption key URL for this meeting summary\n * @param {string} options.contentType the type of content ('action' or 'message')\n * @param {string} options.contentValue the value to use (action name or message text)\n * @param {Object} options.parameters optional parameters to include in the request (for action type only)\n * @param {Object} options.assistant optional parameter to specify the assistant to use\n * @param {Object} options.locale optional locale to use for the request, defaults to 'en_US'\n * @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated\n * @param {string} options.entryPoint optional entryPoint to use for this request\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n * @public\n * @memberof AIAssistant\n */\n async makeAiAssistantRequest(options: AiAssistantRequestOptions): Promise<RequestResponse> {\n let value = options.contentValue;\n\n if (options.contentType === 'message') {\n value = await this._encryptData({\n text: options.contentValue,\n encryptionKeyUrl: options.encryptionKeyUrl,\n });\n }\n\n const content: any = {\n context: {\n resources: options.contextResources,\n },\n encryptionKeyUrl: options.encryptionKeyUrl,\n type: options.contentType,\n value,\n };\n\n if (options.parameters) {\n content.parameters = options.parameters;\n }\n\n return this._request({\n resource: options.sessionId ? `sessions/${options.sessionId}/messages` : 'sessions/messages',\n params: {\n async: 'chunked',\n locale: options.locale || 'en_US',\n content,\n ...(options.entryPoint ? {entryPoint: options.entryPoint} : {}),\n ...(options.assistant ? {assistant: options.assistant} : {}),\n },\n ...(options.requestId ? {requestId: options.requestId} : {}),\n });\n },\n\n /**\n * Returns the summary of a meeting\n * @param {Object} options\n * @param {string} options.meetingInstanceId the meeting instance ID for the meeting from locus\n * @param {string} options.meetingSite the name.webex.com site for the meeting\n * @param {string} options.sessionId the session ID for subsequent requests, not required for the first request\n * @param {string} options.encryptionKeyUrl the encryption key URL for this meeting summary\n * @param {number} options.lastMinutes Optional number of minutes to summarize from the end of the meeting. If not included, summarizes from the start.\n * @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n */\n summarizeMeeting(options: SummarizeMeetingOptions): Promise<RequestResponse> {\n return this.makeAiAssistantRequest({\n ...options,\n contentType: CONTENT_TYPES.ACTION,\n contentValue: ACTION_TYPES.SUMMARIZE_FOR_ME,\n contextResources: [\n {\n id: options.meetingInstanceId,\n type: CONTEXT_RESOURCE_TYPES.MEETING,\n url: options.meetingSite,\n },\n ],\n ...(options.lastMinutes ? {parameters: {lastMinutes: options.lastMinutes}} : {}),\n });\n },\n\n /**\n * Checks if the user's name was mentioned in a meeting\n * @param {Object} options\n * @param {string} options.meetingInstanceId the meeting instance ID for the meeting from locus\n * @param {string} options.meetingSite the name.webex.com site for the meeting\n * @param {string} options.sessionId the session ID for subsequent requests, not required for the first request\n * @param {string} options.encryptionKeyUrl the encryption key URL for this meeting summary\n * @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n */\n wasMyNameMentioned(options: SummarizeMeetingOptions): Promise<RequestResponse> {\n return this.makeAiAssistantRequest({\n ...options,\n contextResources: [\n {\n id: options.meetingInstanceId,\n type: CONTEXT_RESOURCE_TYPES.MEETING,\n url: options.meetingSite,\n },\n ],\n contentType: CONTENT_TYPES.ACTION,\n contentValue: ACTION_TYPES.WAS_MY_NAME_MENTIONED,\n });\n },\n\n /**\n * Returns all action items from a meeting\n * @param {Object} options\n * @param {string} options.meetingInstanceId the meeting instance ID for the meeting from locus\n * @param {string} options.meetingSite the name.webex.com site for the meeting\n * @param {string} options.sessionId the session ID for subsequent requests, not required for the first request\n * @param {string} options.encryptionKeyUrl the encryption key URL for this meeting summary\n * @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n */\n showAllActionItems(options: SummarizeMeetingOptions): Promise<RequestResponse> {\n return this.makeAiAssistantRequest({\n ...options,\n contextResources: [\n {\n id: options.meetingInstanceId,\n type: CONTEXT_RESOURCE_TYPES.MEETING,\n url: options.meetingSite,\n },\n ],\n contentType: CONTENT_TYPES.ACTION,\n contentValue: ACTION_TYPES.SHOW_ALL_ACTION_ITEMS,\n });\n },\n\n /**\n * Helper method to encrypt text using the encryption key URL\n * @param {Object} options\n * @param {string} options.text the text to encrypt\n * @param {string} options.encryptionKeyUrl the encryption key URL to use for encryption\n * @returns {Promise<string>} returns a promise that resolves with the encrypted text\n */\n async _encryptData({text, encryptionKeyUrl}) {\n const result = await this.webex.internal.encryption.encryptText(encryptionKeyUrl, text);\n\n return result;\n },\n\n /**\n * Ask any question about the meeting content\n * @param {Object} options\n * @param {string} options.meetingInstanceId the meeting instance ID for the meeting from locus\n * @param {string} options.meetingSite the name.webex.com site for the meeting\n * @param {string} options.sessionId the session ID for subsequent requests, not required for the first request\n * @param {string} options.encryptionKeyUrl the encryption key URL for this meeting summary\n * @param {string} options.question the question to ask about the meeting content\n * @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n */\n askMeAnything(options: SummarizeMeetingOptions & {question: string}): Promise<RequestResponse> {\n return this.makeAiAssistantRequest({\n ...options,\n contextResources: [\n {\n id: options.meetingInstanceId,\n type: CONTEXT_RESOURCE_TYPES.MEETING,\n url: options.meetingSite,\n },\n ],\n contentType: CONTENT_TYPES.MESSAGE,\n contentValue: options.question,\n });\n },\n});\n\nexport default AIAssistant;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACAA,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAQA,IAAAI,UAAA,GAAAJ,OAAA;AAcA,IAAAK,MAAA,GAAAL,OAAA;AAMiB,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAH,CAAA,OAAAI,6BAAA,QAAAC,CAAA,GAAAD,6BAAA,CAAAJ,CAAA,GAAAC,CAAA,KAAAI,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAL,CAAA,WAAAM,gCAAA,CAAAP,CAAA,EAAAC,CAAA,EAAAO,UAAA,OAAAN,CAAA,CAAAO,IAAA,CAAAC,KAAA,CAAAR,CAAA,EAAAG,CAAA,YAAAH,CAAA;AAAA,SAAAS,cAAAX,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAW,SAAA,CAAAC,MAAA,EAAAZ,CAAA,UAAAC,CAAA,WAAAU,SAAA,CAAAX,CAAA,IAAAW,SAAA,CAAAX,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAe,MAAA,CAAAZ,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,CAAAC,OAAA,EAAAjB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAiB,iCAAA,GAAAC,wBAAA,CAAAnB,CAAA,EAAAkB,iC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OAAO;MAClC8D,YAAY,EAAEhD,OAAO,CAACuF;IAAQ,EAC/B,CAAC;EACJ,CAAC;EAAAC,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3K,OAAA,GAEYI,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_uuid","_interopRequireDefault","require","_webexCore","_lodash","_commonTimers","_constants","_utils","ownKeys","e","r","t","_Object$keys","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","AIAssistant","WebexPlugin","extend","namespace","registered","initialize","_len","args","Array","_key","_apply","prototype","register","_this","webex","canAuthorize","logger","error","_promise","reject","Error","info","resolve","internal","mercury","connect","then","listenForEvents","trigger","AI_ASSISTANT_REGISTERED","catch","concat","message","unregister","stopListeningForEvents","AI_ASSISTANT_UNREGISTERED","_this2","on","ASSISTANT_API_RESPONSE_EVENT","envelope","_handleEvent","data","off","_getResultEventName","requestId","AI_ASSISTANT_RESULT","_getStreamEventName","AI_ASSISTANT_STREAM","clientRequestId","_decryptContent","responseContent","_this3","_asyncToGenerator2","_regenerator","mark","_callee","_t","wrap","_context","prev","next","name","RESPONSE_NAMES","MESSAGE","CITED_ANSWER","SCHEDULE_MEETING","TOOL_RESULT","TOOL_USE","WORKSPACE","decryptMessage","abrupt","decryptCitedAnswer","decryptScheduleMeeting","decryptToolUse","decryptWorkspace","stop","_request","options","_this4","resource","params","headers","timeout","config","requestTimeout","uuid","v4","eventName","streamEventName","timer","Timer","stopListening","finished","errorMessage","AI_ASSISTANT_ERRORS","AI_ASSISTANT_TIMEOUT","errorCode","AI_ASSISTANT_ERROR_CODES","listenTo","_ref","_callee2","resultData","responseType","decryptErrorMessage","_t2","_context2","reset","get","cancel","merge","response","_x","request","service","AI_ASSISTANT_SERVICE_NAME","method","contentType","body","_ref2","start","makeAiAssistantRequest","_this5","_callee3","value","content","_context3","contentValue","_encryptData","text","encryptionKeyUrl","sent","context","resources","contextResources","type","parameters","renderProtocolVersion","sessionId","async","locale","entryPoint","assistant","summarizeMeeting","CONTENT_TYPES","ACTION","ACTION_TYPES","SUMMARIZE_FOR_ME","id","meetingInstanceId","CONTEXT_RESOURCE_TYPES","MEETING","url","meetingSite","lastMinutes","wasMyNameMentioned","WAS_MY_NAME_MENTIONED","showAllActionItems","SHOW_ALL_ACTION_ITEMS","_ref3","_this6","_callee4","result","_context4","encryption","encryptText","askMeAnything","question","version","_default","exports"],"sources":["ai-assistant.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2022 Cisco Systems, Inc. See LICENSE file.\n */\nimport uuid from 'uuid';\nimport {WebexPlugin} from '@webex/webex-core';\nimport '@webex/internal-plugin-mercury';\nimport {get, merge} from 'lodash';\nimport {Timer} from '@webex/common-timers';\n\nimport {\n AiAssistantRequestOptions,\n RequestOptions,\n RequestResponse,\n SummarizeMeetingOptions,\n} from './types';\nimport {\n AI_ASSISTANT_ERROR_CODES,\n AI_ASSISTANT_ERRORS,\n AI_ASSISTANT_REGISTERED,\n AI_ASSISTANT_RESULT,\n AI_ASSISTANT_STREAM,\n AI_ASSISTANT_UNREGISTERED,\n AI_ASSISTANT_SERVICE_NAME,\n ASSISTANT_API_RESPONSE_EVENT,\n ACTION_TYPES,\n CONTENT_TYPES,\n CONTEXT_RESOURCE_TYPES,\n RESPONSE_NAMES,\n} from './constants';\nimport {\n decryptCitedAnswer,\n decryptMessage,\n decryptScheduleMeeting,\n decryptToolUse,\n decryptWorkspace,\n} from './utils';\n\nconst AIAssistant = WebexPlugin.extend({\n namespace: 'AIAssistant',\n\n /**\n * registered value indicating events registration is successful\n * @instance\n * @type {Boolean}\n * @memberof AIAssistant\n */\n registered: false,\n\n /**\n * Initializer\n * @private\n * @param {Object} attrs\n * @param {Object} options\n * @returns {undefined}\n */\n initialize(...args) {\n Reflect.apply(WebexPlugin.prototype.initialize, this, args);\n },\n\n /**\n * Explicitly sets up the AI assistant plugin by connecting to mercury, and listening for AI assistant events.\n * @returns {Promise}\n * @public\n * @memberof AIAssistant\n */\n register() {\n if (!this.webex.canAuthorize) {\n this.logger.error('AI assistant->register#ERROR, Unable to register, SDK cannot authorize');\n\n return Promise.reject(new Error('SDK cannot authorize'));\n }\n\n if (this.registered) {\n this.logger.info('AI assistant->register#INFO, AI assistant plugin already registered');\n\n return Promise.resolve();\n }\n\n return this.webex.internal.mercury\n .connect()\n .then(() => {\n this.listenForEvents();\n this.trigger(AI_ASSISTANT_REGISTERED);\n this.registered = true;\n })\n .catch((error) => {\n this.logger.error(`AI assistant->register#ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Explicitly tears down the AI assistant plugin by disconnecting from mercury, and stops listening to AI assistant events\n * @returns {Promise}\n * @public\n * @memberof AIAssistant\n */\n unregister() {\n if (!this.registered) {\n this.logger.info('AI assistant->unregister#INFO, AI assistant plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n this.trigger(AI_ASSISTANT_UNREGISTERED);\n this.registered = false;\n\n return Promise.resolve();\n },\n\n /**\n * registers for Assistant API events through mercury\n * @returns {undefined}\n * @private\n */\n listenForEvents() {\n this.webex.internal.mercury.on(ASSISTANT_API_RESPONSE_EVENT, (envelope) => {\n this._handleEvent(envelope.data);\n });\n },\n\n /**\n * unregisteres all the Assistant API events from mercury\n * @returns {undefined}\n * @private\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off(ASSISTANT_API_RESPONSE_EVENT);\n },\n\n /**\n * constructs the event name based on request id\n * This is used by the plugin to listen for the result of a particular request\n * @param {UUID} requestId the id of the request\n * @returns {string}\n */\n _getResultEventName(requestId: string) {\n return `${AI_ASSISTANT_RESULT}:${requestId}`;\n },\n\n /**\n * constructs the stream event name based on request id\n * This is used by the consumer to listen for the stream (i.e. the data) of a particular request\n * @param {UUID} requestId the id of the request\n * @returns {string}\n */\n _getStreamEventName(requestId: string) {\n return `${AI_ASSISTANT_STREAM}:${requestId}`;\n },\n\n /**\n * Takes incoming data and triggers correct events\n * @param {Object} data the event data\n * @returns {undefined}\n */\n _handleEvent(data) {\n this.trigger(this._getResultEventName(data.clientRequestId), data);\n },\n\n /**\n * Decrypts the response content in place\n * @param {any} responseContent the content object from the assistant-api response\n * @returns {Promise} resolves once decryption is complete\n */\n async _decryptContent(responseContent) {\n switch (responseContent.name) {\n case RESPONSE_NAMES.MESSAGE: {\n await decryptMessage(responseContent, this.webex);\n break;\n }\n case RESPONSE_NAMES.CITED_ANSWER: {\n await decryptCitedAnswer(responseContent, this.webex);\n break;\n }\n case RESPONSE_NAMES.SCHEDULE_MEETING: {\n await decryptScheduleMeeting(responseContent, this.webex);\n break;\n }\n case RESPONSE_NAMES.TOOL_RESULT: {\n // No encrypted content in tool_result\n break;\n }\n case RESPONSE_NAMES.TOOL_USE: {\n await decryptToolUse(responseContent, this.webex);\n break;\n }\n case RESPONSE_NAMES.WORKSPACE: {\n await decryptWorkspace(responseContent, this.webex);\n break;\n }\n default:\n this.logger.error(\n `AI assistant->_decryptContent#ERROR, Unknown response content name: ${responseContent.name}`\n );\n }\n },\n\n /**\n * Makes the request to the AI assistant service\n * @param {Object} options\n * @param {string} options.resource the URL to query\n * @param {Mixed} options.params additional params for the body of the request\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n */\n _request(options: RequestOptions): Promise<RequestResponse> {\n const {resource, params, headers} = options;\n\n const timeout = this.config.requestTimeout;\n const requestId = options.requestId || uuid.v4();\n const eventName = this._getResultEventName(requestId);\n const streamEventName = this._getStreamEventName(requestId);\n\n // eslint-disable-next-line no-async-promise-executor\n return new Promise((resolve, reject) => {\n const timer = new Timer(() => {\n this.stopListening(this, eventName);\n this.trigger(streamEventName, {\n requestId,\n finished: true,\n errorMessage: AI_ASSISTANT_ERRORS.AI_ASSISTANT_TIMEOUT,\n errorCode: AI_ASSISTANT_ERROR_CODES.AI_ASSISTANT_TIMEOUT,\n });\n }, timeout);\n\n this.listenTo(this, eventName, async (data) => {\n timer.reset();\n const resultData = get(data, 'response.content', {});\n const errorMessage = get(data, 'response.errorMessage');\n const errorCode = get(data, 'response.errorCode');\n const responseType = get(data, 'responseType');\n\n if (data.finished) {\n timer.cancel();\n this.stopListening(this, eventName);\n }\n\n let decryptErrorMessage;\n\n try {\n if (!errorCode) {\n await this._decryptContent(resultData);\n }\n } catch (decryptError) {\n decryptErrorMessage = decryptError.message;\n }\n\n this.trigger(\n streamEventName,\n merge({}, data.response, {\n responseType,\n requestId,\n finished: data.finished,\n errorMessage: errorMessage || decryptErrorMessage,\n errorCode,\n })\n );\n });\n\n this.webex\n .request({\n service: AI_ASSISTANT_SERVICE_NAME,\n resource,\n method: 'POST',\n contentType: 'application/json',\n body: {clientRequestId: requestId, ...params},\n headers,\n })\n .then(({body}) => {\n resolve({...body, requestId, streamEventName});\n })\n .catch((error) => {\n reject(error);\n });\n\n timer.start();\n });\n },\n\n /**\n * Common method to make AI assistant requests for meeting analysis\n * @param {Object} options\n * @param {string} options.contextResources array of context resources to include in the request\n * @param {string} options.sessionId the session ID for subsequent requests, not required for the first request\n * @param {string} options.encryptionKeyUrl the encryption key URL for this meeting summary\n * @param {string} options.contentType the type of content ('action' or 'message')\n * @param {string} options.contentValue the value to use (action name or message text)\n * @param {Object} options.parameters optional parameters to include in the request (for action type only)\n * @param {Object} options.assistant optional parameter to specify the assistant to use\n * @param {Object} options.locale optional locale to use for the request, defaults to 'en_US'\n * @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated\n * @param {string} options.entryPoint optional entryPoint to use for this request\n * @param {string} options.renderProtocolVersion optional render protocol version to use for this request\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n * @public\n * @memberof AIAssistant\n */\n async makeAiAssistantRequest(options: AiAssistantRequestOptions): Promise<RequestResponse> {\n let value = options.contentValue;\n\n if (options.contentType === 'message') {\n value = await this._encryptData({\n text: options.contentValue,\n encryptionKeyUrl: options.encryptionKeyUrl,\n });\n }\n\n const content: any = {\n context: {\n resources: options.contextResources,\n },\n encryptionKeyUrl: options.encryptionKeyUrl,\n type: options.contentType,\n value,\n };\n\n if (options.parameters) {\n content.parameters = options.parameters;\n }\n\n const headers = {};\n\n if (options.renderProtocolVersion) {\n headers['AI-Assistant-Render-Protocol'] = options.renderProtocolVersion;\n }\n\n return this._request({\n resource: options.sessionId ? `sessions/${options.sessionId}/messages` : 'sessions/messages',\n params: {\n async: 'chunked',\n locale: options.locale || 'en_US',\n content,\n ...(options.entryPoint ? {entryPoint: options.entryPoint} : {}),\n ...(options.assistant ? {assistant: options.assistant} : {}),\n },\n ...(options.requestId ? {requestId: options.requestId} : {}),\n headers,\n });\n },\n\n /**\n * Returns the summary of a meeting\n * @param {Object} options\n * @param {string} options.meetingInstanceId the meeting instance ID for the meeting from locus\n * @param {string} options.meetingSite the name.webex.com site for the meeting\n * @param {string} options.sessionId the session ID for subsequent requests, not required for the first request\n * @param {string} options.encryptionKeyUrl the encryption key URL for this meeting summary\n * @param {number} options.lastMinutes Optional number of minutes to summarize from the end of the meeting. If not included, summarizes from the start.\n * @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n */\n summarizeMeeting(options: SummarizeMeetingOptions): Promise<RequestResponse> {\n return this.makeAiAssistantRequest({\n ...options,\n contentType: CONTENT_TYPES.ACTION,\n contentValue: ACTION_TYPES.SUMMARIZE_FOR_ME,\n contextResources: [\n {\n id: options.meetingInstanceId,\n type: CONTEXT_RESOURCE_TYPES.MEETING,\n url: options.meetingSite,\n },\n ],\n ...(options.lastMinutes ? {parameters: {lastMinutes: options.lastMinutes}} : {}),\n });\n },\n\n /**\n * Checks if the user's name was mentioned in a meeting\n * @param {Object} options\n * @param {string} options.meetingInstanceId the meeting instance ID for the meeting from locus\n * @param {string} options.meetingSite the name.webex.com site for the meeting\n * @param {string} options.sessionId the session ID for subsequent requests, not required for the first request\n * @param {string} options.encryptionKeyUrl the encryption key URL for this meeting summary\n * @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n */\n wasMyNameMentioned(options: SummarizeMeetingOptions): Promise<RequestResponse> {\n return this.makeAiAssistantRequest({\n ...options,\n contextResources: [\n {\n id: options.meetingInstanceId,\n type: CONTEXT_RESOURCE_TYPES.MEETING,\n url: options.meetingSite,\n },\n ],\n contentType: CONTENT_TYPES.ACTION,\n contentValue: ACTION_TYPES.WAS_MY_NAME_MENTIONED,\n });\n },\n\n /**\n * Returns all action items from a meeting\n * @param {Object} options\n * @param {string} options.meetingInstanceId the meeting instance ID for the meeting from locus\n * @param {string} options.meetingSite the name.webex.com site for the meeting\n * @param {string} options.sessionId the session ID for subsequent requests, not required for the first request\n * @param {string} options.encryptionKeyUrl the encryption key URL for this meeting summary\n * @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n */\n showAllActionItems(options: SummarizeMeetingOptions): Promise<RequestResponse> {\n return this.makeAiAssistantRequest({\n ...options,\n contextResources: [\n {\n id: options.meetingInstanceId,\n type: CONTEXT_RESOURCE_TYPES.MEETING,\n url: options.meetingSite,\n },\n ],\n contentType: CONTENT_TYPES.ACTION,\n contentValue: ACTION_TYPES.SHOW_ALL_ACTION_ITEMS,\n });\n },\n\n /**\n * Helper method to encrypt text using the encryption key URL\n * @param {Object} options\n * @param {string} options.text the text to encrypt\n * @param {string} options.encryptionKeyUrl the encryption key URL to use for encryption\n * @returns {Promise<string>} returns a promise that resolves with the encrypted text\n */\n async _encryptData({text, encryptionKeyUrl}) {\n const result = await this.webex.internal.encryption.encryptText(encryptionKeyUrl, text);\n\n return result;\n },\n\n /**\n * Ask any question about the meeting content\n * @param {Object} options\n * @param {string} options.meetingInstanceId the meeting instance ID for the meeting from locus\n * @param {string} options.meetingSite the name.webex.com site for the meeting\n * @param {string} options.sessionId the session ID for subsequent requests, not required for the first request\n * @param {string} options.encryptionKeyUrl the encryption key URL for this meeting summary\n * @param {string} options.question the question to ask about the meeting content\n * @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated\n * @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName\n */\n askMeAnything(options: SummarizeMeetingOptions & {question: string}): Promise<RequestResponse> {\n return this.makeAiAssistantRequest({\n ...options,\n contextResources: [\n {\n id: options.meetingInstanceId,\n type: CONTEXT_RESOURCE_TYPES.MEETING,\n url: options.meetingSite,\n },\n ],\n contentType: CONTENT_TYPES.MESSAGE,\n contentValue: options.question,\n });\n },\n});\n\nexport default AIAssistant;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACAA,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAQA,IAAAI,UAAA,GAAAJ,OAAA;AAcA,IAAAK,MAAA,GAAAL,OAAA;AAMiB,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAH,CAAA,OAAAI,6BAAA,QAAAC,CAAA,GAAAD,6BAAA,CAAAJ,CAAA,GAAAC,CAAA,KAAAI,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAL,CAAA,WAAAM,gCAAA,CAAAP,CAAA,EAAAC,CAAA,EAAAO,UAAA,OAAAN,CAAA,CAAAO,IAAA,CAAAC,KAAA,CAAAR,CAAA,EAAAG,CAAA,YAAAH,CAAA;AAAA,SAAAS,cAAAX,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAW,SAAA,CAAAC,MAAA,EAAAZ,CAAA,UAAAC,CAAA,WAAAU,SAAA,CAAAX,CAAA,IAAAW,SAAA,CAAAX,CA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C,SAAA,CAAA5F,MAAA,WAEL2F,MAAM;UAAA;UAAA;YAAA,OAAAC,SAAA,CAAAvF,IAAA;QAAA;MAAA,GAAAqF,QAAA;IAAA;EACf,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,aAAa,WAAbA,aAAaA,CAACxF,OAAqD,EAA4B;IAC7F,OAAO,IAAI,CAAC2C,sBAAsB,CAAAlI,aAAA,CAAAA,aAAA,KAC7BuF,OAAO;MACVwD,gBAAgB,EAAE,CAChB;QACEc,EAAE,EAAEtE,OAAO,CAACuE,iBAAiB;QAC7Bd,IAAI,EAAEe,iCAAsB,CAACC,OAAO;QACpCC,GAAG,EAAE1E,OAAO,CAAC2E;MACf,CAAC,CACF;MACDpC,WAAW,EAAE2B,wBAAa,CAAChF,OAAO;MAClC+D,YAAY,EAAEjD,OAAO,CAACyF;IAAQ,EAC/B,CAAC;EACJ,CAAC;EAAAC,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7K,OAAA,GAEYI,WAAW","ignoreList":[]}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export interface RequestResponse {\n sessionId: string;\n requestId: string;\n streamEventName: string;\n id: string;\n url: string;\n sessionUrl: string;\n creatorId: string;\n createdAt: string;\n}\n\nexport interface StreamEvent {\n message: string;\n requestId: string;\n finished: boolean;\n error: string | null;\n}\n\nexport interface RequestOptions {\n resource: string;\n dataPath: string;\n foundPath?: string;\n notFoundPath?: string;\n params?: Record<string, unknown>;\n requestId?: string;\n}\n\nexport interface ContextResource {\n id: string;\n type: string;\n url: string;\n}\n\nexport interface SummarizeMeetingOptions {\n assistant?: string;\n meetingInstanceId: string;\n meetingSite: string;\n sessionId: string;\n encryptionKeyUrl: string;\n lastMinutes?: number;\n requestId?: string;\n}\n\nexport interface AiAssistantRequestOptions {\n sessionId: string;\n encryptionKeyUrl: string;\n contextResources: ContextResource[];\n contentType: 'action' | 'message';\n contentValue: string;\n parameters?: any;\n assistant?: string;\n locale?: string;\n requestId?: string;\n entryPoint?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export interface RequestResponse {\n sessionId: string;\n requestId: string;\n streamEventName: string;\n id: string;\n url: string;\n sessionUrl: string;\n creatorId: string;\n createdAt: string;\n}\n\nexport interface StreamEvent {\n message: string;\n requestId: string;\n finished: boolean;\n error: string | null;\n}\n\nexport interface RequestOptions {\n resource: string;\n dataPath: string;\n foundPath?: string;\n notFoundPath?: string;\n params?: Record<string, unknown>;\n requestId?: string;\n headers?: Record<string, string>;\n}\n\nexport interface ContextResource {\n id: string;\n type: string;\n url: string;\n}\n\nexport interface SummarizeMeetingOptions {\n assistant?: string;\n meetingInstanceId: string;\n meetingSite: string;\n sessionId: string;\n encryptionKeyUrl: string;\n lastMinutes?: number;\n requestId?: string;\n}\n\nexport interface AiAssistantRequestOptions {\n sessionId: string;\n encryptionKeyUrl: string;\n contextResources: ContextResource[];\n contentType: 'action' | 'message';\n contentValue: string;\n parameters?: any;\n assistant?: string;\n locale?: string;\n requestId?: string;\n entryPoint?: string;\n renderProtocolVersion?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
package/package.json
CHANGED
package/src/ai-assistant.ts
CHANGED
|
@@ -206,7 +206,7 @@ const AIAssistant = WebexPlugin.extend({
|
|
|
206
206
|
* @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName
|
|
207
207
|
*/
|
|
208
208
|
_request(options: RequestOptions): Promise<RequestResponse> {
|
|
209
|
-
const {resource, params} = options;
|
|
209
|
+
const {resource, params, headers} = options;
|
|
210
210
|
|
|
211
211
|
const timeout = this.config.requestTimeout;
|
|
212
212
|
const requestId = options.requestId || uuid.v4();
|
|
@@ -266,6 +266,7 @@ const AIAssistant = WebexPlugin.extend({
|
|
|
266
266
|
method: 'POST',
|
|
267
267
|
contentType: 'application/json',
|
|
268
268
|
body: {clientRequestId: requestId, ...params},
|
|
269
|
+
headers,
|
|
269
270
|
})
|
|
270
271
|
.then(({body}) => {
|
|
271
272
|
resolve({...body, requestId, streamEventName});
|
|
@@ -291,6 +292,7 @@ const AIAssistant = WebexPlugin.extend({
|
|
|
291
292
|
* @param {Object} options.locale optional locale to use for the request, defaults to 'en_US'
|
|
292
293
|
* @param {string} options.requestId optional request ID to use for this request, if not provided a new UUID will be generated
|
|
293
294
|
* @param {string} options.entryPoint optional entryPoint to use for this request
|
|
295
|
+
* @param {string} options.renderProtocolVersion optional render protocol version to use for this request
|
|
294
296
|
* @returns {Promise<Object>} Resolves with an object containing the requestId, sessionId and streamEventName
|
|
295
297
|
* @public
|
|
296
298
|
* @memberof AIAssistant
|
|
@@ -318,6 +320,12 @@ const AIAssistant = WebexPlugin.extend({
|
|
|
318
320
|
content.parameters = options.parameters;
|
|
319
321
|
}
|
|
320
322
|
|
|
323
|
+
const headers = {};
|
|
324
|
+
|
|
325
|
+
if (options.renderProtocolVersion) {
|
|
326
|
+
headers['AI-Assistant-Render-Protocol'] = options.renderProtocolVersion;
|
|
327
|
+
}
|
|
328
|
+
|
|
321
329
|
return this._request({
|
|
322
330
|
resource: options.sessionId ? `sessions/${options.sessionId}/messages` : 'sessions/messages',
|
|
323
331
|
params: {
|
|
@@ -328,6 +336,7 @@ const AIAssistant = WebexPlugin.extend({
|
|
|
328
336
|
...(options.assistant ? {assistant: options.assistant} : {}),
|
|
329
337
|
},
|
|
330
338
|
...(options.requestId ? {requestId: options.requestId} : {}),
|
|
339
|
+
headers,
|
|
331
340
|
});
|
|
332
341
|
},
|
|
333
342
|
|
package/src/types.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface RequestOptions {
|
|
|
23
23
|
notFoundPath?: string;
|
|
24
24
|
params?: Record<string, unknown>;
|
|
25
25
|
requestId?: string;
|
|
26
|
+
headers?: Record<string, string>;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export interface ContextResource {
|
|
@@ -52,4 +53,5 @@ export interface AiAssistantRequestOptions {
|
|
|
52
53
|
locale?: string;
|
|
53
54
|
requestId?: string;
|
|
54
55
|
entryPoint?: string;
|
|
56
|
+
renderProtocolVersion?: string;
|
|
55
57
|
}
|
|
@@ -229,6 +229,47 @@ describe('plugin-ai-assistant', () => {
|
|
|
229
229
|
clientRequestId: 'test-request-id',
|
|
230
230
|
param1: 'value1',
|
|
231
231
|
},
|
|
232
|
+
headers: undefined,
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
const result = await requestPromise;
|
|
236
|
+
|
|
237
|
+
expect(result).to.deep.equal({
|
|
238
|
+
id: 'test-message-id',
|
|
239
|
+
url: 'https://assistant-api-a.wbx2.com:443/assistant-api/api/v1/sessions/test-session-id/messages/test-message-id',
|
|
240
|
+
sessionId: 'test-session-id',
|
|
241
|
+
sessionUrl:
|
|
242
|
+
'https://assistant-api-a.wbx2.com:443/assistant-api/api/v1/sessions/test-session-id',
|
|
243
|
+
creatorId: 'test-creator-id',
|
|
244
|
+
createdAt: '2025-08-05T02:11:12.361Z',
|
|
245
|
+
requestId: 'test-request-id',
|
|
246
|
+
streamEventName: 'aiassistant:stream:test-request-id',
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it('makes a request with additional headers', async () => {
|
|
251
|
+
const requestPromise = webex.internal.aiAssistant._request({
|
|
252
|
+
resource: 'test-resource',
|
|
253
|
+
params: {param1: 'value1'},
|
|
254
|
+
headers: {
|
|
255
|
+
'X-Custom-Header': 'foo',
|
|
256
|
+
'X-Another-Header': 'bar',
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
expect(webex.request.getCall(0).args[0]).to.deep.equal({
|
|
261
|
+
service: 'assistant-api',
|
|
262
|
+
resource: 'test-resource',
|
|
263
|
+
method: 'POST',
|
|
264
|
+
contentType: 'application/json',
|
|
265
|
+
body: {
|
|
266
|
+
clientRequestId: 'test-request-id',
|
|
267
|
+
param1: 'value1',
|
|
268
|
+
},
|
|
269
|
+
headers: {
|
|
270
|
+
'X-Custom-Header': 'foo',
|
|
271
|
+
'X-Another-Header': 'bar',
|
|
272
|
+
},
|
|
232
273
|
});
|
|
233
274
|
|
|
234
275
|
const result = await requestPromise;
|
|
@@ -1055,6 +1096,24 @@ describe('plugin-ai-assistant', () => {
|
|
|
1055
1096
|
expect(requestArgs.body.entryPoint).to.be.undefined;
|
|
1056
1097
|
});
|
|
1057
1098
|
|
|
1099
|
+
it('includes AI-Assistant-Render-Protocol in the request header when renderProtocolVersion is provided', async () => {
|
|
1100
|
+
const options = {
|
|
1101
|
+
sessionId: 'test-session-id',
|
|
1102
|
+
encryptionKeyUrl: 'test-key-url',
|
|
1103
|
+
contextResources: [],
|
|
1104
|
+
contentType: 'action' as const,
|
|
1105
|
+
contentValue: 'test_action',
|
|
1106
|
+
renderProtocolVersion: '1.0',
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
await webex.internal.aiAssistant.makeAiAssistantRequest(options);
|
|
1110
|
+
|
|
1111
|
+
const requestArgs = webex.request.getCall(0).args[0];
|
|
1112
|
+
expect(requestArgs.headers).to.deep.equal({
|
|
1113
|
+
'AI-Assistant-Render-Protocol': '1.0',
|
|
1114
|
+
});
|
|
1115
|
+
});
|
|
1116
|
+
|
|
1058
1117
|
it('handles request rejection', async () => {
|
|
1059
1118
|
webex.request.rejects(new Error('Network error'));
|
|
1060
1119
|
|