Skip to content

Conversation

@Shreyas281299
Copy link
Contributor

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

  • Added packages/contact-center/store/ai-docs/AGENTS.md - Usage documentation and API reference
  • Added packages/contact-center/store/ai-docs/ARCHITECTURE.md - Technical implementation details and data flows

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

  • The testing is done with the amplify link

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify: Cursor AI
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

Checklist before merging

  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the testing document
  • I have tested the functionality with amplify link

Make sure to have followed the contributing guidelines before submitting.

@aws-amplify-us-east-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-592.d1b38q61t1z947.amplifyapp.com


## 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.
Copy link
Contributor

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 ?

Copy link
Contributor Author

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 */},
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`@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

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added


---

## Key API (Selected)
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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 ?

Copy link
Contributor Author

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)
Copy link
Contributor

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 ?

Copy link
Contributor Author

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

  1. App pass webexInstance, here we just setup eventListeners and call registerCC
  2. 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

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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

@Shreyas281299 Shreyas281299 added the validated Indicates that the PR is ready for actions label Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated Indicates that the PR is ready for actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants