@webex/contact-center 3.12.0-next.83 → 3.12.0-next.85
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/.sdd/manifest.json +876 -0
- package/AGENTS.md +65 -409
- package/ai-docs/ARCHITECTURE.md +168 -0
- package/ai-docs/CONTRACTS.md +46 -0
- package/ai-docs/GETTING_STARTED.md +168 -0
- package/ai-docs/GLOSSARY.md +43 -0
- package/ai-docs/README.md +25 -18
- package/ai-docs/REVIEW_CHECKLIST.md +41 -0
- package/ai-docs/RULES.md +187 -198
- package/ai-docs/SECURITY.md +52 -0
- package/ai-docs/SERVICE_STATE.md +48 -0
- package/ai-docs/SPEC_INDEX.md +65 -0
- package/ai-docs/adr/0001-spec-source-policy.md +55 -0
- package/ai-docs/adr/README.md +8 -0
- package/ai-docs/adr/_adr-template.md +31 -0
- package/ai-docs/contact-center-spec.md +341 -0
- package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
- package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
- package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
- package/ai-docs/templates/README.md +1 -1
- package/ai-docs/templates/new-method/04-validation.md +1 -1
- package/ai-docs/templates/new-service/05-validation.md +1 -1
- package/dist/webex.js +1 -1
- package/package.json +8 -8
- package/src/metrics/ai-docs/AGENTS.md +2 -0
- package/src/metrics/ai-docs/ARCHITECTURE.md +2 -0
- package/src/metrics/ai-docs/metrics-spec.md +854 -0
- package/src/services/agent/ai-docs/AGENTS.md +3 -1
- package/src/services/agent/ai-docs/ARCHITECTURE.md +2 -0
- package/src/services/agent/ai-docs/agent-spec.md +504 -0
- package/src/services/ai-docs/AGENTS.md +4 -2
- package/src/services/ai-docs/services-spec.md +492 -0
- package/src/services/config/ai-docs/AGENTS.md +3 -1
- package/src/services/config/ai-docs/ARCHITECTURE.md +2 -0
- package/src/services/config/ai-docs/config-spec.md +669 -0
- package/src/services/core/ai-docs/AGENTS.md +4 -2
- package/src/services/core/ai-docs/ARCHITECTURE.md +2 -0
- package/src/services/core/ai-docs/core-spec.md +783 -0
- package/src/services/task/ai-docs/AGENTS.md +2 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +11 -2
- package/src/services/task/ai-docs/task-spec.md +1319 -0
- package/src/services/task/state-machine/ai-docs/AGENTS.md +38 -75
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +6 -4
- package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2115 -0
- package/src/utils/AGENTS.md +3 -1
- package/src/utils/ai-docs/utils-spec.md +381 -0
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
package/AGENTS.md
CHANGED
|
@@ -1,438 +1,94 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AGENTS.md — @webex/contact-center
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Read first. Next: [`SPEC_INDEX.md`](ai-docs/SPEC_INDEX.md) · [`ARCHITECTURE.md`](ai-docs/ARCHITECTURE.md). Load the target module spec on demand.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Repo Overview
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`@webex/contact-center` is a published Webex SDK plugin for agent registration, configuration, realtime events, task/call control, data lookup, and telemetry.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
When a developer provides a task, follow this workflow **in order**:
|
|
14
|
-
|
|
15
|
-
1. **Classify the task** - Use the Task Classification Decision Tree below to identify the task type (A-F). If you cannot confidently classify, ask the developer.
|
|
16
|
-
2. **STOP — Ask the developer questions** - Open the routed template's pre-questions file. Present every MANDATORY question to the developer. Wait for their answers. **Do NOT proceed until all MANDATORY fields have explicit answers from the developer.** Do not infer, assume, or fill in answers yourself.
|
|
17
|
-
3. **Present Spec Summary for approval** - After gathering answers, present a structured summary of what you will build (see Spec Summary Gate below). Wait for the developer to confirm.
|
|
18
|
-
4. **Load context** - Use the [Service Routing Table](#service-routing-table) to find and read the target service's `AGENTS.md` and `ARCHITECTURE.md`, then load relevant patterns.
|
|
19
|
-
5. **Break down large or multi-part tasks** - If the prompt mixes multiple tasks (for example, "add a method" and "fix a bug"), split into smaller scoped subtasks and execute them one by one — each subtask goes through steps 1-3 independently.
|
|
20
|
-
6. **Generate/fix code** - Follow established package patterns and the routed template's implementation steps.
|
|
21
|
-
7. **Validate functionality and quality** - Verify behavior, tests, lint, and type checks.
|
|
22
|
-
8. **Update documentation** - Keep ai-docs aligned with code changes.
|
|
23
|
-
9. **Ask for review** - Confirm completion and offer adjustments.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Task Classification Decision Tree
|
|
28
|
-
|
|
29
|
-
Use these questions **in order** to classify the developer's request. Follow the first matching path.
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
Q1: Is the task read-only (understanding, explaining, or analyzing code)?
|
|
33
|
-
├── YES → Type E: Understand Architecture
|
|
34
|
-
│
|
|
35
|
-
└── NO → Q2: Is something broken or behaving incorrectly?
|
|
36
|
-
├── YES → Is this a UI/UX improvement or a code-level defect?
|
|
37
|
-
│ ├── UI/UX fix (visual, layout, interaction) → Type D: Add Feature / Enhance Existing Service
|
|
38
|
-
│ └── Code-level defect (wrong behavior, crash, data issue) → Type C: Fix Bug
|
|
39
|
-
│
|
|
40
|
-
└── NO → Q3: Does this involve creating a new file, class, or module?
|
|
41
|
-
├── YES → Type A: Create New Service
|
|
42
|
-
│
|
|
43
|
-
└── NO → Q4: Does this involve adding a brand-new method that does not exist yet?
|
|
44
|
-
│ NOTE: If the developer describes a "capability" or "feature" that
|
|
45
|
-
│ happens to require a new method, check signal keywords — if the
|
|
46
|
-
│ request matches Type D signals ("add capability", "enhance", "enable"),
|
|
47
|
-
│ use the Disambiguation Rule to confirm with the developer.
|
|
48
|
-
├── YES → Type B: Add New Method
|
|
49
|
-
│
|
|
50
|
-
└── NO → Q5: Does this involve changing an existing method's signature, behavior, parameters, or return type?
|
|
51
|
-
├── YES → Type F: Modify Existing Method
|
|
52
|
-
│
|
|
53
|
-
└── NO → Type D: Add Feature / Enhance Existing Service
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Signal Keywords by Task Type
|
|
57
|
-
|
|
58
|
-
Use these keyword patterns to help confirm your classification:
|
|
59
|
-
|
|
60
|
-
| Task Type | Signal Keywords in Developer Request |
|
|
61
|
-
|---|---|
|
|
62
|
-
| **A. Create New Service** | "new service", "new module", "new class", "create a service for", "add a new [ServiceName]", "like AddressBook/Queue/EntryPoint" |
|
|
63
|
-
| **B. Add New Method** | "add a method", "add an API", "new method", "expose a new function", "add [methodName] to" |
|
|
64
|
-
| **C. Fix Bug** | "bug", "broken", "not working", "regression", "incorrect", "error", "crash", "unexpected behavior", "fix" |
|
|
65
|
-
| **D. Add Feature** | "enhance", "add feature", "add capability", "improve", "extend", "support for", "enable" |
|
|
66
|
-
| **E. Understand Architecture** | "explain", "how does", "understand", "architecture", "what is", "walk me through", "show me" |
|
|
67
|
-
| **F. Modify Existing Method** | "change", "modify", "update", "add parameter to", "change return type", "rename", "refactor [methodName]" |
|
|
68
|
-
|
|
69
|
-
### Disambiguation Rule
|
|
70
|
-
|
|
71
|
-
**If you cannot confidently classify the task after using the decision tree and signal keywords, ask the developer:**
|
|
72
|
-
|
|
73
|
-
> "I want to make sure I follow the right workflow. Which of these best describes your task?"
|
|
74
|
-
> - A. Create a new service/module (new file/class)
|
|
75
|
-
> - B. Add a new method to an existing service
|
|
76
|
-
> - C. Fix a bug or incorrect behavior
|
|
77
|
-
> - D. Add a feature or enhance an existing service
|
|
78
|
-
> - E. Understand/explain the architecture (no code changes)
|
|
79
|
-
> - F. Modify an existing method (change signature, behavior, parameters)
|
|
80
|
-
|
|
81
|
-
**Do not guess. Do not default to the most common type. Ask.**
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## Task Type Routing
|
|
86
|
-
|
|
87
|
-
**A. Create New Service**
|
|
88
|
-
- Use when adding a new service module (for example, a new service to support real-time transcripts, similar to existing services like AddressBook, Queue, or EntryPoint).
|
|
89
|
-
- **Route to:** [`ai-docs/templates/new-service/00-master.md`](ai-docs/templates/new-service/00-master.md)
|
|
90
|
-
- **Pre-questions:** [`ai-docs/templates/new-service/01-pre-questions.md`](ai-docs/templates/new-service/01-pre-questions.md) — STOP and ask these first.
|
|
91
|
-
- **Follow:** Full new-service workflow including validation and docs updates.
|
|
92
|
-
|
|
93
|
-
**B. Add New Method**
|
|
94
|
-
- Use when extending an existing service with a new method/API.
|
|
95
|
-
- **Route to:** [`ai-docs/templates/new-method/00-master.md`](ai-docs/templates/new-method/00-master.md)
|
|
96
|
-
- **Pre-questions:** [`ai-docs/templates/new-method/01-requirements.md`](ai-docs/templates/new-method/01-requirements.md) — STOP and ask these first.
|
|
97
|
-
- **Follow:** Method signature, implementation, tests, and validation checklist.
|
|
98
|
-
|
|
99
|
-
**C. Fix Bug**
|
|
100
|
-
- Use when behavior is incorrect or regressions are reported.
|
|
101
|
-
- **Route to:** [`ai-docs/templates/existing-service/bug-fix.md`](ai-docs/templates/existing-service/bug-fix.md)
|
|
102
|
-
- **Pre-questions:** Bug-fix template Section A (Questions for the Developer) — STOP and ask these first.
|
|
103
|
-
- **Follow:** Gather info from developer -> Investigate -> Root cause -> Fix -> Regression validation.
|
|
104
|
-
|
|
105
|
-
**D. Add Feature**
|
|
106
|
-
- Use when enhancing capabilities, then decide placement via triage:
|
|
107
|
-
- existing service/module enhancement, or
|
|
108
|
-
- new standalone service/module creation.
|
|
109
|
-
- **Route to:** [`ai-docs/templates/existing-service/feature-enhancement.md`](ai-docs/templates/existing-service/feature-enhancement.md)
|
|
110
|
-
- **Pre-questions:** Feature-enhancement template Step 0 (Placement Triage) + Pre-Enhancement Questions — STOP and ask these first.
|
|
111
|
-
- **Follow:** Run mandatory feature placement triage. If triage indicates a new service/module, reroute to [`ai-docs/templates/new-service/00-master.md`](ai-docs/templates/new-service/00-master.md).
|
|
112
|
-
|
|
113
|
-
**E. Understand Architecture**
|
|
114
|
-
- Use when the task is analysis/explanation and no immediate code generation is required.
|
|
115
|
-
- **Route to:** Use the [Service Routing Table](#service-routing-table) to identify the relevant service, then load its `AGENTS.md` and `ARCHITECTURE.md`:
|
|
116
|
-
- Agent: [`src/services/agent/ai-docs/`](src/services/agent/ai-docs/AGENTS.md)
|
|
117
|
-
- Task: [`src/services/task/ai-docs/`](src/services/task/ai-docs/AGENTS.md)
|
|
118
|
-
- Config: [`src/services/config/ai-docs/`](src/services/config/ai-docs/AGENTS.md)
|
|
119
|
-
- Core: [`src/services/core/ai-docs/`](src/services/core/ai-docs/AGENTS.md)
|
|
120
|
-
- **Follow:** Read-only architecture exploration with clear explanation.
|
|
121
|
-
- No pre-questions required (read-only task).
|
|
122
|
-
|
|
123
|
-
**F. Modify Existing Method**
|
|
124
|
-
- Use when changing an existing method's signature, behavior, parameters, or return type.
|
|
125
|
-
- **Route to:** [`ai-docs/templates/existing-service/feature-enhancement.md`](ai-docs/templates/existing-service/feature-enhancement.md) (follow the same workflow, but skip placement triage — the method already exists).
|
|
126
|
-
- **Pre-questions:** Feature-enhancement template Pre-Enhancement Questions (skip Step 0 triage) — STOP and ask these first.
|
|
127
|
-
- **Follow:** Gather requirements -> Design change -> Implement -> Test -> Validate backward compatibility.
|
|
9
|
+
**What it is:**
|
|
10
|
+
- A TypeScript SDK package embedded in the Webex SDK host.
|
|
11
|
+
- A client of Webex Contact Center REST, WebSocket, calling, and metrics services.
|
|
128
12
|
|
|
129
|
-
|
|
13
|
+
**What it is NOT:**
|
|
14
|
+
- It is not a standalone backend and owns no durable datastore.
|
|
15
|
+
- It does not render a UI; it exposes state and UI-control contracts to host applications.
|
|
130
16
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
## Spec Summary Gate (MANDATORY before code generation)
|
|
17
|
+
## Tech Stack
|
|
134
18
|
|
|
135
|
-
|
|
19
|
+
- TypeScript 5.4, Node.js 22.14 for workspace development (published package engine floor: Node >=20.x), Yarn 3.4.1, WebexPlugin, EventEmitter, XState 5, WebSocket/WebRTC.
|
|
20
|
+
- Jest 27 with 85% global branch/function/line/statement thresholds.
|
|
136
21
|
|
|
137
|
-
|
|
22
|
+
## Architecture
|
|
138
23
|
|
|
24
|
+
```text
|
|
25
|
+
Host Webex SDK → ContactCenter plugin → Services/Task/Metrics → REST + WebSocket + WebRTC backends
|
|
139
26
|
```
|
|
140
|
-
## Spec Summary — [Task Type]
|
|
141
|
-
|
|
142
|
-
**Task**: [One-sentence description of what will be done]
|
|
143
|
-
**Target file(s)**: [File paths that will be created or modified]
|
|
144
|
-
**Task type**: [A/B/C/D/E/F from classification]
|
|
145
|
-
|
|
146
|
-
### What will be built/changed:
|
|
147
|
-
- [Bullet 1: key change]
|
|
148
|
-
- [Bullet 2: key change]
|
|
149
|
-
- [Bullet N: key change]
|
|
150
|
-
|
|
151
|
-
### API Contract (if applicable):
|
|
152
|
-
- Method: `methodName(params: ParamType): Promise<ReturnType>`
|
|
153
|
-
- HTTP: [METHOD] [endpoint]
|
|
154
|
-
- Request payload: [structure]
|
|
155
|
-
- Response payload: [structure]
|
|
156
|
-
|
|
157
|
-
### Events (if applicable):
|
|
158
|
-
| Event | Direction | Object | Payload | Trigger |
|
|
159
|
-
|---|---|---|---|---|
|
|
160
|
-
| [event name] | [emitted / listened] | [cc, task, taskManager, or service] | [payload type] | [what causes it] |
|
|
161
|
-
(or "No events")
|
|
162
|
-
|
|
163
|
-
### Metrics (if applicable):
|
|
164
|
-
- Success: [metric name]
|
|
165
|
-
- Failure: [metric name]
|
|
166
27
|
|
|
167
|
-
|
|
28
|
+
→ Full architecture: **[ai-docs/ARCHITECTURE.md](./ai-docs/ARCHITECTURE.md)**
|
|
168
29
|
|
|
169
|
-
|
|
170
|
-
1. [file path] — [what changes]
|
|
171
|
-
2. [file path] — [what changes]
|
|
30
|
+
## Module / Package Structure
|
|
172
31
|
|
|
173
|
-
|
|
174
|
-
|
|
32
|
+
```text
|
|
33
|
+
src/ public plugin/API orchestration
|
|
34
|
+
src/metrics/ telemetry
|
|
35
|
+
src/services/ service composition and integrations
|
|
36
|
+
src/services/{agent,config,core}/ agent, profile, and transport capabilities
|
|
37
|
+
src/services/task/ task/call lifecycle
|
|
38
|
+
src/services/task/state-machine/ typed XState lifecycle engine
|
|
39
|
+
src/utils/ pagination/page cache contracts
|
|
175
40
|
```
|
|
176
41
|
|
|
177
|
-
**
|
|
178
|
-
- Do NOT begin implementation until the developer confirms.
|
|
179
|
-
- If the developer says "Adjust", gather the corrections and re-present the summary.
|
|
180
|
-
- If the developer says "Skip" or "Just do it", you may proceed without the summary — but this must be an explicit developer choice.
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## CRITICAL RULES (Always Apply)
|
|
185
|
-
|
|
186
|
-
### 1. STOP and Ask Before Coding (MANDATORY — HIGHEST PRIORITY)
|
|
187
|
-
|
|
188
|
-
**This is the most important rule in this guide.**
|
|
189
|
-
|
|
190
|
-
Before writing, generating, or modifying any code:
|
|
191
|
-
1. Classify the task using the decision tree.
|
|
192
|
-
2. Present the template's pre-questions to the developer.
|
|
193
|
-
3. Wait for answers. Do not infer or assume.
|
|
194
|
-
4. Present the Spec Summary. Wait for approval.
|
|
42
|
+
→ Router: **[ai-docs/SPEC_INDEX.md](./ai-docs/SPEC_INDEX.md)**
|
|
195
43
|
|
|
196
|
-
|
|
197
|
-
- Reading code to "understand the context" before asking the developer questions
|
|
198
|
-
- Filling in pre-question answers yourself based on the developer's initial request
|
|
199
|
-
- Skipping the Spec Summary because the task "seems straightforward"
|
|
200
|
-
- Starting implementation while pre-questions have unanswered MANDATORY fields
|
|
44
|
+
## Critical Rules
|
|
201
45
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
### 3. MetricsManager Usage (MANDATORY)
|
|
213
|
-
|
|
214
|
-
All operations must track metrics using `timeEvent` + `trackEvent`. See full pattern in [`ai-docs/RULES.md`](ai-docs/RULES.md).
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
### 4. Error Handling Pattern (MANDATORY)
|
|
219
|
-
|
|
220
|
-
Always use `getErrorDetails` from `services/core/Utils` for consistent error handling. See full pattern in [`ai-docs/RULES.md`](ai-docs/RULES.md) and [`ai-docs/patterns/typescript-patterns.md`](ai-docs/patterns/typescript-patterns.md).
|
|
221
|
-
|
|
222
|
-
---
|
|
46
|
+
1. Code and tests are the behavioral referee; never invent APIs, paths, events, flags, or states.
|
|
47
|
+
2. Ask before coding: present the affected files/contracts and wait for confirmation.
|
|
48
|
+
3. Use LoggerProxy with module/method context; never use console logging in package implementation.
|
|
49
|
+
4. Use MetricsManager timing/tracking patterns without blocking product behavior.
|
|
50
|
+
5. Use typed event constants; preserve `trigger` versus `emit` ownership.
|
|
51
|
+
6. Preserve AQM HTTP-plus-WebSocket correlation, timeout, and recovery semantics.
|
|
52
|
+
7. Update the owning module spec and contract catalog in the same change as behavior.
|
|
53
|
+
8. Run an independent validator runtime for generated or materially changed specs.
|
|
223
54
|
|
|
224
|
-
|
|
55
|
+
## Essential Commands
|
|
225
56
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
Follow the established `cc.ts` plugin class pattern with JSDoc (`@public`, `@param`, `@returns`, `@example`). Refer to `src/cc.ts` directly for the canonical implementation.
|
|
233
|
-
|
|
234
|
-
---
|
|
235
|
-
|
|
236
|
-
### 7. Scope ai-docs Are Authoritative (MANDATORY)
|
|
237
|
-
|
|
238
|
-
When working inside a service scope, use the [Service Routing Table](#service-routing-table) to locate and load that service's `AGENTS.md` and `ARCHITECTURE.md`. Treat them as implementation authority for that scope.
|
|
239
|
-
|
|
240
|
-
- This root `AGENTS.md` is the orchestrator — it routes tasks and enforces rules.
|
|
241
|
-
- Service-level `ai-docs` define scope-specific behavior, architecture, and patterns.
|
|
242
|
-
- If there is any conflict between root and service docs, prefer the service docs for that scope.
|
|
243
|
-
|
|
244
|
-
---
|
|
245
|
-
|
|
246
|
-
### 8. Context Guardrail (APPLIES EVERYWHERE)
|
|
247
|
-
|
|
248
|
-
For **every** task type (new service, new method, bug fix, feature enhancement, architecture), gather context in this order:
|
|
249
|
-
|
|
250
|
-
1. Same package code under `@webex/contact-center`
|
|
251
|
-
2. Same package ai-docs (`AGENTS.md`, `ARCHITECTURE.md`, templates, patterns)
|
|
252
|
-
3. Same package tests
|
|
253
|
-
|
|
254
|
-
Only use references from other plugins/modules/packages when the developer explicitly requests it.
|
|
255
|
-
|
|
256
|
-
Mandatory behavior:
|
|
257
|
-
- Prefer local package implementations/patterns before external references.
|
|
258
|
-
- If required context is missing, ask targeted clarification questions instead of guessing.
|
|
259
|
-
- Document what local references were used before implementation.
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
## Context Loading by Task Type
|
|
264
|
-
|
|
265
|
-
**First:** Identify the affected service using the [Service Routing Table](#service-routing-table). Load that service's `AGENTS.md` and `ARCHITECTURE.md` via the direct links in the table.
|
|
266
|
-
|
|
267
|
-
### For New Service/Method:
|
|
268
|
-
1. Load the affected service's docs via [Service Routing Table](#service-routing-table)
|
|
269
|
-
2. Read [`ai-docs/patterns/typescript-patterns.md`](ai-docs/patterns/typescript-patterns.md)
|
|
270
|
-
3. Read [`ai-docs/patterns/event-driven-patterns.md`](ai-docs/patterns/event-driven-patterns.md)
|
|
271
|
-
4. Read [`ai-docs/patterns/testing-patterns.md`](ai-docs/patterns/testing-patterns.md)
|
|
272
|
-
5. Read existing service in same category (e.g., `AddressBook.ts` for new data service)
|
|
273
|
-
|
|
274
|
-
### For Bug Fix:
|
|
275
|
-
1. Load the affected service's docs via [Service Routing Table](#service-routing-table) — prioritize `ARCHITECTURE.md`
|
|
276
|
-
2. Read [`ai-docs/patterns/testing-patterns.md`](ai-docs/patterns/testing-patterns.md)
|
|
277
|
-
3. Read related test files
|
|
278
|
-
|
|
279
|
-
### For Feature Enhancement / Modify Existing Method:
|
|
280
|
-
1. Load the affected service's docs via [Service Routing Table](#service-routing-table) — prioritize `AGENTS.md`
|
|
281
|
-
2. Read [`ai-docs/patterns/typescript-patterns.md`](ai-docs/patterns/typescript-patterns.md)
|
|
282
|
-
3. Read related existing implementation
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
## Repository Structure
|
|
287
|
-
|
|
288
|
-
```
|
|
289
|
-
packages/@webex/contact-center/
|
|
290
|
-
├── src/
|
|
291
|
-
│ ├── cc.ts # Main plugin class (WebexPlugin)
|
|
292
|
-
│ ├── types.ts # Public types and interfaces
|
|
293
|
-
│ ├── constants.ts # Package constants
|
|
294
|
-
│ ├── logger-proxy.ts # LoggerProxy implementation
|
|
295
|
-
│ ├── metrics/
|
|
296
|
-
│ │ ├── MetricsManager.ts # Singleton metrics manager
|
|
297
|
-
│ │ ├── behavioral-events.ts # Behavioral event taxonomy
|
|
298
|
-
│ │ └── constants.ts # METRIC_EVENT_NAMES
|
|
299
|
-
│ └── services/
|
|
300
|
-
│ ├── index.ts # Services singleton
|
|
301
|
-
│ ├── AddressBook.ts # Address book service
|
|
302
|
-
│ ├── EntryPoint.ts # Entry point service
|
|
303
|
-
│ ├── Queue.ts # Queue service
|
|
304
|
-
│ ├── WebCallingService.ts # WebRTC calling service
|
|
305
|
-
│ ├── agent/ # Agent operations
|
|
306
|
-
│ │ ├── index.ts # Agent service factory
|
|
307
|
-
│ │ ├── types.ts # Agent types and events
|
|
308
|
-
│ │ └── ai-docs/ # Agent-specific AI documentation
|
|
309
|
-
│ │ ├── AGENTS.md # Agent usage guide
|
|
310
|
-
│ │ └── ARCHITECTURE.md # Agent technical deep-dive
|
|
311
|
-
│ ├── task/ # Task management
|
|
312
|
-
│ │ ├── TaskManager.ts # Task lifecycle manager
|
|
313
|
-
│ │ ├── contact.ts # Contact operations
|
|
314
|
-
│ │ ├── dialer.ts # Outbound dialing
|
|
315
|
-
│ │ ├── AutoWrapup.ts # Auto wrapup handler
|
|
316
|
-
│ │ ├── types.ts # Task types and events
|
|
317
|
-
│ │ └── ai-docs/ # Task-specific AI documentation
|
|
318
|
-
│ │ ├── AGENTS.md # Task usage guide
|
|
319
|
-
│ │ └── ARCHITECTURE.md # Task technical deep-dive
|
|
320
|
-
│ ├── config/ # Configuration
|
|
321
|
-
│ │ ├── index.ts # Config service
|
|
322
|
-
│ │ ├── types.ts # CC_EVENTS, Profile, etc.
|
|
323
|
-
│ │ ├── constants.ts # Config constants
|
|
324
|
-
│ │ └── ai-docs/ # Config-specific AI documentation
|
|
325
|
-
│ │ ├── AGENTS.md # Config usage guide
|
|
326
|
-
│ │ └── ARCHITECTURE.md # Config technical deep-dive
|
|
327
|
-
│ └── core/ # Core utilities
|
|
328
|
-
│ ├── WebexRequest.ts # HTTP request handler
|
|
329
|
-
│ ├── Utils.ts # Utility functions
|
|
330
|
-
│ ├── Err.ts # Error classes
|
|
331
|
-
│ ├── GlobalTypes.ts # Failure, AugmentedError
|
|
332
|
-
│ ├── aqm-reqs.ts # AQM request handler
|
|
333
|
-
│ ├── websocket/
|
|
334
|
-
│ │ ├── WebSocketManager.ts # WebSocket handler
|
|
335
|
-
│ │ └── connection-service.ts
|
|
336
|
-
│ └── ai-docs/ # Core-specific AI documentation
|
|
337
|
-
│ ├── AGENTS.md # Core usage guide
|
|
338
|
-
│ └── ARCHITECTURE.md # Core technical deep-dive
|
|
339
|
-
├── test/
|
|
340
|
-
│ └── unit/
|
|
341
|
-
│ └── spec/
|
|
342
|
-
│ └── cc.ts # Main test file (reference)
|
|
343
|
-
└── ai-docs/ # AI documentation
|
|
344
|
-
├── README.md # AI-docs overview
|
|
345
|
-
├── RULES.md # Coding standards
|
|
346
|
-
├── patterns/ # Pattern documentation
|
|
347
|
-
└── templates/ # Code generation templates
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
---
|
|
351
|
-
|
|
352
|
-
## Key Type Patterns
|
|
353
|
-
|
|
354
|
-
For enum patterns (const object + type), response type patterns, and failure type patterns, see [`ai-docs/patterns/typescript-patterns.md`](ai-docs/patterns/typescript-patterns.md).
|
|
355
|
-
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
## Validation Checklist (After Code Generation)
|
|
359
|
-
|
|
360
|
-
- [ ] **LoggerProxy**: All methods use LoggerProxy with `module` and `method` context
|
|
361
|
-
- [ ] **Metrics**: Operations track success/failure with `timeEvent` + `trackEvent`
|
|
362
|
-
- [ ] **Error Handling**: Uses `getErrorDetails` pattern
|
|
363
|
-
- [ ] **Types**: All public types have JSDoc with `@public` tag
|
|
364
|
-
- [ ] **Events**: Uses event constants (CC_EVENTS, AGENT_EVENTS, TASK_EVENTS)
|
|
365
|
-
- [ ] **Tests**: Added/updated unit tests with MockWebex
|
|
366
|
-
- [ ] **Exports**: New types exported from `types.ts`
|
|
367
|
-
- [ ] **No console.log**: Zero instances of console.log/warn/error
|
|
368
|
-
|
|
369
|
-
---
|
|
370
|
-
|
|
371
|
-
## Functionality Validation Gate (CRITICAL)
|
|
372
|
-
|
|
373
|
-
Before marking any coding task complete, verify:
|
|
374
|
-
|
|
375
|
-
1. **API/Type correctness**
|
|
376
|
-
- method signatures and payload types align with existing contracts
|
|
377
|
-
- no accidental breaking API changes
|
|
378
|
-
2. **Pattern compliance**
|
|
379
|
-
- `LoggerProxy`, `MetricsManager`, `getErrorDetails`, event constants
|
|
380
|
-
3. **Behavior correctness**
|
|
381
|
-
- success/failure paths covered
|
|
382
|
-
- state/event flow is correct for affected service
|
|
383
|
-
4. **Quality checks**
|
|
384
|
-
- relevant unit tests pass
|
|
385
|
-
- lint/type checks pass
|
|
386
|
-
|
|
387
|
-
If any gate fails, fix before completion.
|
|
388
|
-
|
|
389
|
-
---
|
|
390
|
-
|
|
391
|
-
## Documentation Update Gate
|
|
392
|
-
|
|
393
|
-
After code changes, verify whether docs must be updated:
|
|
394
|
-
|
|
395
|
-
- Service-level docs (use [Service Routing Table](#service-routing-table) to locate):
|
|
396
|
-
- Service `AGENTS.md` — if usage/workflow changed
|
|
397
|
-
- Service `ARCHITECTURE.md` — if data flow/architecture changed
|
|
398
|
-
- Root-level docs:
|
|
399
|
-
- This file ([`AGENTS.md`](AGENTS.md)) — if task routing or rules changed
|
|
400
|
-
- [`ai-docs/templates/`](ai-docs/templates/) — if a new reusable template is needed
|
|
401
|
-
- [`ai-docs/patterns/`](ai-docs/patterns/) — if a new reusable pattern is introduced
|
|
402
|
-
|
|
403
|
-
---
|
|
404
|
-
|
|
405
|
-
## Success Criteria
|
|
57
|
+
| Task | Command |
|
|
58
|
+
|---|---|
|
|
59
|
+
| Install | `yarn install` |
|
|
60
|
+
| Build | `yarn workspace @webex/contact-center build:src` |
|
|
61
|
+
| Test | `yarn workspace @webex/contact-center test:unit` |
|
|
62
|
+
| Lint/format | `yarn workspace @webex/contact-center test:style` |
|
|
406
63
|
|
|
407
|
-
|
|
408
|
-
- Implements intended behavior without regressions
|
|
409
|
-
- Includes/updates tests where needed
|
|
410
|
-
- Passes lint/type/test checks
|
|
411
|
-
- Updates docs when behavior or architecture changes
|
|
64
|
+
## Developer Workflow
|
|
412
65
|
|
|
413
|
-
|
|
66
|
+
1. Read this file for package rules, then use `ai-docs/SPEC_INDEX.md` to select the owning canonical module `*-spec.md`.
|
|
67
|
+
2. Check the module spec's requirements, public surface, source paths, test evidence, and documented gaps against the relevant code/tests.
|
|
68
|
+
3. Before coding, present the affected files and contracts and wait for confirmation.
|
|
69
|
+
4. Implement the smallest approved change; update the owning module spec, `ai-docs/CONTRACTS.md`, and `.sdd/manifest.json` when public behavior or routing changes.
|
|
70
|
+
5. Run the package commands above plus manifest/conformance checks; materially changed generated specs require validation on the configured independent runtime.
|
|
71
|
+
6. Review the final diff for source/test fidelity, compatibility, secrets, and unrelated files before staging.
|
|
414
72
|
|
|
415
|
-
##
|
|
73
|
+
## Common Gotchas
|
|
416
74
|
|
|
417
|
-
|
|
75
|
+
1. AQM completion may arrive over WebSocket after an HTTP acknowledgement; do not treat the acknowledgement as completion.
|
|
76
|
+
2. Listener cleanup requires the same function reference used at registration.
|
|
77
|
+
3. Config aggregation is all-or-nothing; returning a partial profile creates inconsistent runtime behavior.
|
|
78
|
+
4. Task transitions must go through typed TaskEvent mapping and guards.
|
|
79
|
+
5. PageCache bypasses search/filter/attributes/sort queries to avoid stale or incorrect reuse.
|
|
418
80
|
|
|
419
|
-
|
|
81
|
+
## Pre-Commit Checklist
|
|
420
82
|
|
|
421
|
-
|
|
83
|
+
- [ ] Unit tests and lint pass; the 85% coverage bar remains satisfied.
|
|
84
|
+
- [ ] Public types/events/methods remain compatible or include a migration plan.
|
|
85
|
+
- [ ] State, error, timeout, and cleanup paths are covered.
|
|
86
|
+
- [ ] Spec/docs and `.sdd/manifest.json` are updated with code changes.
|
|
87
|
+
- [ ] No secrets or sensitive data are committed or logged.
|
|
422
88
|
|
|
423
|
-
|
|
424
|
-
|---------|-----------------|-----------|-----------------|
|
|
425
|
-
| **Agent** | login, logout, state change, buddy agents, station | [`src/services/agent/ai-docs/AGENTS.md`](src/services/agent/ai-docs/AGENTS.md) | [`src/services/agent/ai-docs/ARCHITECTURE.md`](src/services/agent/ai-docs/ARCHITECTURE.md) |
|
|
426
|
-
| **Task** | task, hold, transfer, conference, wrapup, outdial, consult | [`src/services/task/ai-docs/AGENTS.md`](src/services/task/ai-docs/AGENTS.md) | [`src/services/task/ai-docs/ARCHITECTURE.md`](src/services/task/ai-docs/ARCHITECTURE.md) |
|
|
427
|
-
| **Config** | profile, register, teams, aux codes, desktop profile, settings | [`src/services/config/ai-docs/AGENTS.md`](src/services/config/ai-docs/AGENTS.md) | [`src/services/config/ai-docs/ARCHITECTURE.md`](src/services/config/ai-docs/ARCHITECTURE.md) |
|
|
428
|
-
| **Core** | websocket, HTTP, connection, reconnect, aqm, utils, errors | [`src/services/core/ai-docs/AGENTS.md`](src/services/core/ai-docs/AGENTS.md) | [`src/services/core/ai-docs/ARCHITECTURE.md`](src/services/core/ai-docs/ARCHITECTURE.md) |
|
|
89
|
+
## Strict Compliance Mode (automation)
|
|
429
90
|
|
|
430
|
-
|
|
91
|
+
- Load this file, the router, and only the affected module specs; stop on a blocking contract, security, source-fidelity, or validation finding.
|
|
431
92
|
|
|
432
93
|
---
|
|
433
|
-
|
|
434
|
-
## Need More Context?
|
|
435
|
-
|
|
436
|
-
- **TypeScript patterns**: [`ai-docs/patterns/typescript-patterns.md`](ai-docs/patterns/typescript-patterns.md)
|
|
437
|
-
- **Testing patterns**: [`ai-docs/patterns/testing-patterns.md`](ai-docs/patterns/testing-patterns.md)
|
|
438
|
-
- **Event patterns**: [`ai-docs/patterns/event-driven-patterns.md`](ai-docs/patterns/event-driven-patterns.md)
|
|
94
|
+
**SDD coverage:** `.sdd/manifest.json` is authoritative; `ai-docs/SPEC_INDEX.md` mirrors it.
|