feat(internal-plugin-task): support task management#4453
Conversation
| import WebexCore from '@webex/webex-core'; | ||
|
|
||
| const webex = new WebexCore(); | ||
| webex.internal.task.WHATEVER; |
There was a problem hiding this comment.
add more info on the usage
There was a problem hiding this comment.
OK, I will add more usage to README.
| @@ -0,0 +1 @@ | |||
| module.exports = {browser: true}; | |||
There was a problem hiding this comment.
why would we need this , it should also be able to run on node env , i see lot of use cases for this
There was a problem hiding this comment.
I just followed other internal plugin's way to introduce this file, I am not sure if there are any potential issues if missing it.
| @@ -0,0 +1,50 @@ | |||
| const _decryptTextProp = (ctx, name, key, object) => { | |||
There was a problem hiding this comment.
the mercury already decrypts text you dont need this
There was a problem hiding this comment.
i am not sure about that @arun3528 . i think each plugin still needs to manage decrypting mercury events
There was a problem hiding this comment.
@arun3528 It is not for mercury event, it is for decrypting API response.
There was a problem hiding this comment.
@robstax i was looking throguh it the reason is because the each plugin can have there own intercepter they dont have to keep adding the encrypt and decrypy logic in all the place , they just have to add it in once place
they just have to do this
@vskygk i would add a comments saying not a standard way and use intercepter , so that others dont copy the same
| @@ -0,0 +1,45 @@ | |||
| import {isArray} from 'lodash'; | |||
There was a problem hiding this comment.
lets check on this as well , i think the SDk also does encrypt the text check how the conversaion plugin is setup , that would help
its all done via intercepters
There was a problem hiding this comment.
@arun3528 the decrypt/encrypt flow in the SDK plugins is pretty convoluted and pretty unfriendly to dev. different plugins seem to have adapted other ways of doing it. this task plugin seems to be heavily copying calendar plugin (see: packages/@webex/internal-plugin-calendar/src/calendar.decrypt.helper.js). also ai-assistant plugin did decryption different and just called await this.webex.internal.encryption.decryptText(encryptionKeyUrl, value) wherever it was needed rather than the payload transformer flow.
|
|
||
| registerInternalPlugin('task', Task, { | ||
| config, | ||
| payloadTransformer: { |
There was a problem hiding this comment.
Here is where the logic for encryption and decryption will go
There was a problem hiding this comment.
I ever meet a issue before, the encrypt/decrypt rules configured in one plugin's payloadTransformer will affect another plugin, or conflict with each other, there is a example:
{
name: 'transformMeetingParticipants',
direction: 'inbound',
test(ctx, response) {
return Promise.resolve(
has(response, 'body.encryptedParticipants') &&
!(
response.options &&
response.options.service === 'calendar' &&
response.options.method === 'GET' &&
response.options.resource === 'schedulerData'
)
);
},
We have to add such codes to resolve conflict.
| // operation. | ||
| this.listenToOnce(this.webex, 'ready', () => { | ||
| // Pre-fetch a KMS encryption key url to improve performance | ||
| this.webex.internal.encryption.kms.createUnboundKeys({count: 1}).then((keys) => { |
There was a problem hiding this comment.
OK, I will make it more promise:)
|
|
||
| if (this.registered) { | ||
| this.logger.info('Task->register#INFO, Calendar plugin already registered'); | ||
|
|
There was a problem hiding this comment.
should you trigger raindrop register event here as well , if its already registred
There was a problem hiding this comment.
No need here, if this.registered is true, it should have triggered the register event here:
return this.webex.internal.device
.register()
.then(() => this.webex.internal.mercury.connect())
.then(() => {
this.listenForEvents();
this.trigger(RAINDROP_REGISTERED);
this.registered = true;
})
|
|
||
| this.stopListeningForEvents(); | ||
|
|
||
| return this.webex.internal.mercury |
There was a problem hiding this comment.
why do you want to un register socket when you un register for task
There was a problem hiding this comment.
this seems to be a pattern that has emerged. i am not totally sure of it's consequences, but it's done in meetings, ai-assistant, dss, device, and calendar plugins. all of them disconnect from mercury on unregister
There was a problem hiding this comment.
As I know, the calendar plugin calls unregister() on beforeunload to release connections when running in site web pages, likely as a protection mechanism.
There was a problem hiding this comment.
This is going to cause issues @robstax , if someone does a un register on task but they need meetings or other the socket would get disconnected
webex.logout whould dergister device and socket
can we check once , all the other plugin might have un register but might not be calling it , launch the web app , in console do task.unregister and see what happens
There was a problem hiding this comment.
@arun3528 you are right, it is not safe to disconnect the socket, I have removed related logic and only stop listening the events.
|
|
||
| this.stopListeningForEvents(); | ||
|
|
||
| return this.webex.internal.mercury |
There was a problem hiding this comment.
this seems to be a pattern that has emerged. i am not totally sure of it's consequences, but it's done in meetings, ai-assistant, dss, device, and calendar plugins. all of them disconnect from mercury on unregister
| // operation. | ||
| this.listenToOnce(this.webex, 'ready', () => { | ||
| // Pre-fetch a KMS encryption key url to improve performance | ||
| this.webex.internal.encryption.kms.createUnboundKeys({count: 1}).then((keys) => { |
There was a problem hiding this comment.
i don't think we should do this. we only do it in calendar plugin and i am not sure why. seems strange
There was a problem hiding this comment.
@robstax Caching an encryption key URL here was intended to improve performance. However, after reviewing the createUnboundKeys implementation, I found it simply connects to Mercury to fetch a key, which should be very fast. I’ll remove this part of the code and run some tests.
| }, | ||
|
|
||
| /** | ||
| * Explicitly tears down the calendar plugin by de-registering |
There was a problem hiding this comment.
are these bad copy/pastes in the comments? i see lots of references to calendar plugin in this file in the comments. i don't think that's correct?
There was a problem hiding this comment.
Yes, I will correct them.
| @@ -0,0 +1,50 @@ | |||
| const _decryptTextProp = (ctx, name, key, object) => { | |||
There was a problem hiding this comment.
i am not sure about that @arun3528 . i think each plugin still needs to manage decrypting mercury events
| @@ -0,0 +1,45 @@ | |||
| import {isArray} from 'lodash'; | |||
There was a problem hiding this comment.
@arun3528 the decrypt/encrypt flow in the SDK plugins is pretty convoluted and pretty unfriendly to dev. different plugins seem to have adapted other ways of doing it. this task plugin seems to be heavily copying calendar plugin (see: packages/@webex/internal-plugin-calendar/src/calendar.decrypt.helper.js). also ai-assistant plugin did decryption different and just called await this.webex.internal.encryption.decryptText(encryptionKeyUrl, value) wherever it was needed rather than the payload transformer flow.
| import '@webex/internal-plugin-conversation'; | ||
| import testUsers from '@webex/test-helper-test-users'; | ||
|
|
||
| describe.skip('plugin-task', function () { |
There was a problem hiding this comment.
I will enable it to check if it can pass, because when running locally, it always returning error:
WARN: 'http POST to https://cig-service-intb.ciscospark.com/cig-service/api/v1/users/test_users_s result: 403'
ERROR: '###Test error: Forbidden: Forbidden. Retrying test in 1000 seconds'
There was a problem hiding this comment.
After I enable this integration test, it is still blocked by following error:
Google Chrome is not currently installed; installing it
Preparing Chrome installation for Debian-based systems
https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_114.0.5735.90-1_amd64.deb:
2025-10-14 03:20:41 ERROR 404: Not Found.
/bin/bash: line 129: google-chrome-stable: command not found
Google Chrome v114.0.5735.90 (stable) failed to install.
Exited with code exit status 1
|
@vskygk can you change the target branch to |
COMPLETES #< https://jira-eng-gpk2.cisco.com/jira/browse/WEBEX-436262 >
This pull request addresses
Refer to above Epic, we need to implement a new plugin to support new task management feature
by making the following changes
Add a new plugin internal-plugin-task
Change Type
The following scenarios were tested
The GAI Coding Policy And Copyright Annotation Best Practices
I certified that
Make sure to have followed the contributing guidelines before submitting.