-
Notifications
You must be signed in to change notification settings - Fork 64
docs(store): add AI documentation - AGENTS.md and ARCHITECTURE.md #592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
|
|
||
| ## Overview | ||
|
|
||
| `@webex/cc-store` is the shared, singleton MobX store for all Contact Center widgets. It holds global agent,session and task state, proxies SDK events, and exposes convenience APIs for fetching lists (queues, entry points, address book), task lifecycle handling, and common mutations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it understand what SDK here is and how SDK is consumed in the Contact Center widgets ? We should add that as well before directly mentioning that it proxies SDK events.
With this text: exposes convenience APIs for fetching lists (queues, entry points, address book), are we talking about what APIs we expose from widgtes or the APIs we are using from SDK ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed with Priya, we will be creating a knowledgbase that will provide all this information to the agent.
|
|
||
| // Option B: Let the store initialize Webex for you, best for new apps | ||
| await store.init({ | ||
| webexConfig: {/* sdk config */}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of saying sdk config here in bracket, can we not provide reference to dev portal documentation where it talks about what webex config looks like ? Can it read from the links attached ? And if not that then maybe we should add that information locally either here or in separate .md file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config would be provided in the knowledge base so Im not changing anything here. If we find that agent is unable to use this then we will re-visit this and make changes
|
|
||
| // Option A: If you already have a Webex instance, best for existing webex enabled apps | ||
| await store.init({ | ||
| webex: someWebexInstance, // must include cc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here, how will it understand what 'must include cc' means ? There should be a reference for what webex instance looks like
|
|
||
| ## Overview | ||
|
|
||
| `@webex/cc-store` is the shared, singleton MobX store for all Contact Center widgets. It holds global agent,session and task state, proxies SDK events, and exposes convenience APIs for fetching lists (queues, entry points, address book), task lifecycle handling, and common mutations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `@webex/cc-store` is the shared, singleton MobX store for all Contact Center widgets. It holds global agent,session and task state, proxies SDK events, and exposes convenience APIs for fetching lists (queues, entry points, address book), task lifecycle handling, and common mutations. | |
| `agent, session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| - **Singleton** state via MobX observables | ||
| - **Event wiring** to SDK (TASK_EVENTS and CC_EVENTS) | ||
| - **Task list management** and current task tracking | ||
| - **Helpers** for buddy agents, queues, entry points, address book |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have helper functions only for these 4: buddy agents, queues, entry points, address book ? What is different between these helper functions and other functions in storeEventsWrapper file. We should add more clear description to say what these helper functions are for and in e.g we can talk about like buddy agents, queues etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the text, we have helper for more actions but Ive updated the text to be a little broader and not to specific
| ### Fetching Lists | ||
|
|
||
| ```typescript | ||
| // Buddy agents for current task media type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a statement to help it link and understand where these helper methods are required would be clearer. With this, I don't get the answer of why these helper methods are needed in store file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
|
|
||
| --- | ||
|
|
||
| ## Key API (Selected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This heading is not very accurate as properties are not APIs and wht do we have Selected in bracket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
| end | ||
| Store->>SDK: register() | ||
| SDK-->>Store: Profile | ||
| Store->>Store: populate observables, feature flags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we mean by populate observable here ? I have seen the same text even in above tables. What observables are these from SDK ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The observable are from the mobx store which are proxied in storeEventsWrapper
| Store->>SDK: Webex.init() | ||
| SDK-->>Store: ready | ||
| Store->>Store: setupEventListeners(webex.cc) | ||
| Store->>Store: registerCC(webex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there multiple invocations of registerCC and register in initialization flow ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we have talked about two cases here
- App pass webexInstance, here we just setup eventListeners and call registerCC
- App passes access_token, here we do webex.init, wait for ready then setup eventListeners and call registerCC.
After calling register CC, we get the agentProfile and we resolve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was 1 extra 'register' that ive removed
| store.refreshTaskList(); | ||
| ``` | ||
|
|
||
| ### Address Book Empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this put as an example for one of the errors or if we are putting specific errors then complete list should be given else general guidelines for troubleshooting would be better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its just an example, the whole list is supposed to be provided by the SDK so it will live in the knowledge base
COMPLETES N/A - Documentation Enhancement
This pull request addresses
Adding AI-optimized documentation for the MobX store package to help AI assistants understand the centralized state management patterns.
by making the following changes
packages/contact-center/store/ai-docs/AGENTS.md- Usage documentation and API referencepackages/contact-center/store/ai-docs/ARCHITECTURE.md- Technical implementation details and data flowsChange Type
The following scenarios were tested
The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging
Make sure to have followed the contributing guidelines before submitting.