@webex/internal-plugin-llm 3.12.0-webex-services-ready.4 → 3.13.0-next.1
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/.repo-context.json +416 -0
- package/.sdd/manifest.json +355 -0
- package/AGENTS.md +198 -0
- package/README.md +45 -65
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/dist/llm-plugin.js +199 -0
- package/dist/llm-plugin.js.map +1 -0
- package/dist/llm.js +193 -411
- package/dist/llm.js.map +1 -1
- package/dist/llm.types.js +8 -0
- package/dist/llm.types.js.map +1 -1
- package/docs/adr/0001-retain-product-readme.md +94 -0
- package/docs/adr/index.md +22 -0
- package/docs/architecture.md +279 -0
- package/docs/getting-started.md +104 -0
- package/docs/index.md +47 -0
- package/docs/specs/README.md +73 -0
- package/package.json +6 -6
- package/schemas/repo-context.schema.json +796 -0
- package/src/docs/README.md +522 -0
- package/src/index.ts +7 -2
- package/src/llm-plugin.ts +115 -0
- package/src/llm.ts +156 -443
- package/src/llm.types.ts +68 -50
- package/test/unit/spec/llm-plugin.js +391 -0
- package/test/unit/spec/llm.js +440 -567
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 1,
|
|
3
|
+
"repository": {
|
|
4
|
+
"name": "@webex/internal-plugin-llm",
|
|
5
|
+
"purpose": "Internal Webex JS SDK plugin that manages LLM data-channel connections for meetings. It registers webex.internal.llm, a Mercury subclass that registers each session with the data-channel service over HTTP, connects the returned WebSocket through Mercury, and keeps per-session URLs, binding, owner meeting, and token-refresh handler, plus a session-keyed data-channel token cache guarded by owner-meeting checks.",
|
|
6
|
+
"category": "cat2-legacy",
|
|
7
|
+
"primary_languages": [
|
|
8
|
+
"typescript"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"topology": "Single-repo",
|
|
12
|
+
"commands": {
|
|
13
|
+
"install": {
|
|
14
|
+
"command": "yarn install",
|
|
15
|
+
"source_file": "package.json",
|
|
16
|
+
"role": "install"
|
|
17
|
+
},
|
|
18
|
+
"compile": {
|
|
19
|
+
"command": "yarn workspace @webex/internal-plugin-llm build:src",
|
|
20
|
+
"source_file": "package.json",
|
|
21
|
+
"role": "compile"
|
|
22
|
+
},
|
|
23
|
+
"build": {
|
|
24
|
+
"command": "yarn workspace @webex/internal-plugin-llm build",
|
|
25
|
+
"source_file": "package.json",
|
|
26
|
+
"role": "package"
|
|
27
|
+
},
|
|
28
|
+
"unit-test": {
|
|
29
|
+
"command": "yarn workspace @webex/internal-plugin-llm test:unit",
|
|
30
|
+
"source_file": "package.json",
|
|
31
|
+
"role": "unit-test"
|
|
32
|
+
},
|
|
33
|
+
"browser-test": {
|
|
34
|
+
"command": "yarn workspace @webex/internal-plugin-llm test:browser",
|
|
35
|
+
"source_file": "package.json",
|
|
36
|
+
"role": "other"
|
|
37
|
+
},
|
|
38
|
+
"lint": {
|
|
39
|
+
"command": "yarn workspace @webex/internal-plugin-llm test:style",
|
|
40
|
+
"source_file": "package.json",
|
|
41
|
+
"role": "lint"
|
|
42
|
+
},
|
|
43
|
+
"deploy": {
|
|
44
|
+
"command": "yarn workspace @webex/internal-plugin-llm deploy:npm",
|
|
45
|
+
"source_file": "package.json",
|
|
46
|
+
"role": "deploy"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"toolchain": [
|
|
50
|
+
{
|
|
51
|
+
"name": "node",
|
|
52
|
+
"version": ">=18",
|
|
53
|
+
"origin": "repo-config",
|
|
54
|
+
"source_file": "package.json"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "babel",
|
|
58
|
+
"version": "^7.17.10",
|
|
59
|
+
"origin": "repo-config",
|
|
60
|
+
"source_file": "package.json"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "eslint",
|
|
64
|
+
"version": "^8.24.0",
|
|
65
|
+
"origin": "repo-config",
|
|
66
|
+
"source_file": "package.json"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "prettier",
|
|
70
|
+
"version": "^2.7.1",
|
|
71
|
+
"origin": "repo-config",
|
|
72
|
+
"source_file": "package.json"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "sinon",
|
|
76
|
+
"version": "^9.2.4",
|
|
77
|
+
"origin": "repo-config",
|
|
78
|
+
"source_file": "package.json"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"tests": {
|
|
82
|
+
"unit": {
|
|
83
|
+
"command_ref": "unit-test",
|
|
84
|
+
"dir": "test/unit/spec",
|
|
85
|
+
"framework": "jest"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"quality_gates": {
|
|
89
|
+
"code_coverage": {
|
|
90
|
+
"origin": "none",
|
|
91
|
+
"declared_by": "akulakum@cisco.com via bootstrap questionnaire (generator check: test:unit runs webex-legacy-tools with --runner jest; jest.config.js re-exports @webex/jest-config-legacy, which sets collectCoverage false and no coverageThreshold; package.json defines no coverage script)"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"coverage_status_definitions": {
|
|
95
|
+
"specced": ">=80% public surface specced, drift <5% - spec is authoritative",
|
|
96
|
+
"partial": "40-80% specced - spec is a hint, cross-check code",
|
|
97
|
+
"untracked": "<40% specced - code is the source of truth"
|
|
98
|
+
},
|
|
99
|
+
"spec_source_policy": {
|
|
100
|
+
"mode": "keep-separate",
|
|
101
|
+
"migrated_source_disposition": "retain",
|
|
102
|
+
"disposition_decided_by": "akulakum@cisco.com",
|
|
103
|
+
"disposition_decided_at": "2026-10-07T06:33:15Z",
|
|
104
|
+
"decided_by": "akulakum@cisco.com",
|
|
105
|
+
"decided_at": "2026-10-07T06:33:15Z",
|
|
106
|
+
"decision_record": "docs/adr/0001-retain-product-readme.md"
|
|
107
|
+
},
|
|
108
|
+
"spec_sources": [],
|
|
109
|
+
"modules": [
|
|
110
|
+
{
|
|
111
|
+
"path": "src",
|
|
112
|
+
"canonical_spec": "src/docs/README.md",
|
|
113
|
+
"coverage_status": "Partial",
|
|
114
|
+
"coverage_evidence": "Field coverage 93.3% (14/15) assessed 2026-10-07 by the generator; critical field coverage 8/8. The one WEAK field is test strategy: test/unit/spec/llm.js covers register and connect, timing, accessors, owner setters, refresh handlers, multi-session disconnect, and URL lookup, but the plugin registration, clearDatachannelToken, refused-owner token and refresh-handler calls, INV-003 (tokens survive disconnect), INV-005 (config defaults), and suffixed event names have no test, two disconnectLLM cases exercise a stand-in object instead of LLMChannel, test:browser collects no files, and no characterization baseline exists. Independent validation round 3 passed with warnings on 2026-10-08. Held at Partial: no characterization baseline and no spec-drift record exist yet.",
|
|
115
|
+
"last_assessed": "2026-10-07",
|
|
116
|
+
"contracts": {
|
|
117
|
+
"provides": [
|
|
118
|
+
"llm-sdk",
|
|
119
|
+
"llm-plugin-events",
|
|
120
|
+
"llm-datachannel-protocol"
|
|
121
|
+
],
|
|
122
|
+
"requires": [
|
|
123
|
+
"mercury-plugin-base",
|
|
124
|
+
"webex-core-plugin-host",
|
|
125
|
+
"webex-device-registration",
|
|
126
|
+
"webex-feature-toggles"
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
"section_profile": {
|
|
130
|
+
"has_tiers": false,
|
|
131
|
+
"has_ui": false,
|
|
132
|
+
"crosses_service_boundaries": true,
|
|
133
|
+
"holds_client_state": true,
|
|
134
|
+
"enforces_domain_rules": true,
|
|
135
|
+
"is_concurrent_async": true,
|
|
136
|
+
"owns_persistence": false,
|
|
137
|
+
"stateful_transitions": true,
|
|
138
|
+
"exposes_wire_protocol": true,
|
|
139
|
+
"ui_multi_screen": false,
|
|
140
|
+
"large_data_model": false,
|
|
141
|
+
"returns_caller_errors": true,
|
|
142
|
+
"module_specific_conventions": true,
|
|
143
|
+
"published_package": true,
|
|
144
|
+
"embedded_in_host": false,
|
|
145
|
+
"has_design_tradeoff": true,
|
|
146
|
+
"resolved_by": "claude-cowork (code evidence; bootstrap questionnaire)",
|
|
147
|
+
"resolved_at": "2026-10-07T06:33:15Z",
|
|
148
|
+
"has_submodules": false,
|
|
149
|
+
"has_submodules_computed_by": "scripts/module_tree.py",
|
|
150
|
+
"has_submodules_computed_at": "2026-10-07T06:40:11Z"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"contract_catalog": {
|
|
155
|
+
"index_path": "docs/architecture.md",
|
|
156
|
+
"definitions": {
|
|
157
|
+
"llm-sdk": {
|
|
158
|
+
"kind": "sdk",
|
|
159
|
+
"publication": "published",
|
|
160
|
+
"source_kind": "repository-path",
|
|
161
|
+
"source": "package.json",
|
|
162
|
+
"summary": "Published npm package. main is dist/index.js and devMain is src/index.ts. Importing the package registers LLMChannel as internal plugin 'llm' with the config object from src/llm.ts. The barrel exports LLMChannel as default, DataChannelTokenType, LLM_DEFAULT_SESSION, LLM_PRACTICE_SESSION, and the RegisterAndConnectTiming type. Per-method behavior is in src/docs/README.md."
|
|
163
|
+
},
|
|
164
|
+
"llm-plugin-events": {
|
|
165
|
+
"kind": "event",
|
|
166
|
+
"publication": "published",
|
|
167
|
+
"source_kind": "repository-path",
|
|
168
|
+
"source": "src/llm.ts",
|
|
169
|
+
"summary": "Events triggered on webex.internal.llm. LLMChannel inherits event emission from Mercury and sets the default session id to llm-default-session, so default-session events keep plain names (online, offline, event, event:<namespace>, event:<eventType>) and other sessions add a :<sessionId> suffix."
|
|
170
|
+
},
|
|
171
|
+
"llm-datachannel-protocol": {
|
|
172
|
+
"kind": "rpc",
|
|
173
|
+
"publication": "internal",
|
|
174
|
+
"source_kind": "repository-path",
|
|
175
|
+
"source": "src/llm.ts",
|
|
176
|
+
"summary": "Registration POST to the caller-supplied data-channel URL with body deviceUrl and, behind the data-channel-with-jwt-token toggle, the Data-Channel-Auth-Token header; response fields webSocketUrl and binding; and the subscriptionAwareSubchannels query added to the WebSocket URL behind the same toggle."
|
|
177
|
+
},
|
|
178
|
+
"mercury-plugin-base": {
|
|
179
|
+
"kind": "sdk",
|
|
180
|
+
"publication": "published",
|
|
181
|
+
"source_kind": "external",
|
|
182
|
+
"source": "@webex/internal-plugin-mercury (packages/@webex/internal-plugin-mercury/src/mercury.js)",
|
|
183
|
+
"summary": "Superclass of LLMChannel. Supplies connect, disconnect, disconnectAll, getSocket, session-suffixed event emission, retries, keepalive config consumption, and close-code handling. Owned by @webex/internal-plugin-mercury."
|
|
184
|
+
},
|
|
185
|
+
"webex-core-plugin-host": {
|
|
186
|
+
"kind": "rpc",
|
|
187
|
+
"publication": "internal",
|
|
188
|
+
"source_kind": "external",
|
|
189
|
+
"source": "@webex/webex-core (registerInternalPlugin, WebexPlugin request, logger, config)",
|
|
190
|
+
"summary": "registerInternalPlugin installs the plugin; the plugin base supplies this.request for the registration POST, this.logger, and this.config resolved from webex.config.llm."
|
|
191
|
+
},
|
|
192
|
+
"webex-device-registration": {
|
|
193
|
+
"kind": "sdk",
|
|
194
|
+
"publication": "internal",
|
|
195
|
+
"source_kind": "external",
|
|
196
|
+
"source": "@webex/internal-plugin-device (webex.internal.device)",
|
|
197
|
+
"summary": "LLMChannel sends webex.internal.device.url as deviceUrl in the registration body. Mercury connect also registers the device when needed."
|
|
198
|
+
},
|
|
199
|
+
"webex-feature-toggles": {
|
|
200
|
+
"kind": "sdk",
|
|
201
|
+
"publication": "internal",
|
|
202
|
+
"source_kind": "external",
|
|
203
|
+
"source": "@webex/internal-plugin-feature (webex.internal.feature)",
|
|
204
|
+
"summary": "LLMChannel calls getFeature('developer', 'data-channel-with-jwt-token') before registration and again before connect."
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"spec_policy": {
|
|
209
|
+
"require_what_and_why": true,
|
|
210
|
+
"require_provenance": true,
|
|
211
|
+
"protected_specs": [
|
|
212
|
+
"src/docs/README.md"
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
"validation": {
|
|
216
|
+
"generator_runtime": "claude-cowork",
|
|
217
|
+
"generator_model": "claude-opus-5-5",
|
|
218
|
+
"generator_runtime_source": "host-metadata",
|
|
219
|
+
"generator_run_id": "spark-853121-llm-sdd-stage0-2026-10-07",
|
|
220
|
+
"validator_runtime": "current-session",
|
|
221
|
+
"validator_runtime_source": "invocation-input",
|
|
222
|
+
"runtime_fallback_tier": "different-runtime",
|
|
223
|
+
"source_commit": "a402eb85a62d77ae2489a135741c97617cf2a611",
|
|
224
|
+
"minimum_independence": "different-runtime",
|
|
225
|
+
"blocking_severities": [
|
|
226
|
+
"Blocking"
|
|
227
|
+
],
|
|
228
|
+
"base_ref": "next",
|
|
229
|
+
"head_ref": "LLM_WEBEX_INTERNAL_PLUGIN_SDD"
|
|
230
|
+
},
|
|
231
|
+
"layout": {
|
|
232
|
+
"sdd_root": ".sdd",
|
|
233
|
+
"docs_root": "docs",
|
|
234
|
+
"agent_entry_path": "AGENTS.md",
|
|
235
|
+
"standing_docs_root": "docs",
|
|
236
|
+
"spec_index_path": "docs/specs/README.md",
|
|
237
|
+
"module_docs_strategy": "source-local",
|
|
238
|
+
"module_docs_relative_path": "docs/README.md",
|
|
239
|
+
"module_docs_decision": {
|
|
240
|
+
"basis": "repo-standards-default",
|
|
241
|
+
"reason": "No module-local documentation existed. The source-local default gives src/docs/README.md. test:style runs eslint ./src/**/*.* and build:src processes -js -ts only, so Markdown under src/ does not enter the lint or build output.",
|
|
242
|
+
"decided_by": "akulakum@cisco.com (bootstrap questionnaire)",
|
|
243
|
+
"decided_at": "2026-10-07T06:33:15Z"
|
|
244
|
+
},
|
|
245
|
+
"repo_context_decision": {
|
|
246
|
+
"path": ".repo-context.json",
|
|
247
|
+
"schema_path": "schemas/repo-context.schema.json",
|
|
248
|
+
"action": "create",
|
|
249
|
+
"schema_action": "create",
|
|
250
|
+
"reason": "Neither the operational context nor its schema existed in this package. The context is created from package evidence and the schema is copied from packages/@webex/common/schemas/repo-context.schema.json (Repo Standards 0.3.0).",
|
|
251
|
+
"decided_by": "akulakum@cisco.com (bootstrap questionnaire)",
|
|
252
|
+
"decided_at": "2026-10-07T06:33:15Z"
|
|
253
|
+
},
|
|
254
|
+
"artifact_decisions": [
|
|
255
|
+
{
|
|
256
|
+
"path": "docs/service.md",
|
|
257
|
+
"action": "omit",
|
|
258
|
+
"reason": "Library package, not a deployable service. package.json has no start script, container, or deployment descriptor.",
|
|
259
|
+
"decided_by": "claude-cowork (code evidence)",
|
|
260
|
+
"decided_at": "2026-10-07T06:33:15Z"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"path": "mkdocs.yml",
|
|
264
|
+
"action": "omit",
|
|
265
|
+
"reason": "No package-level documentation site exists. Documentation publishing stays with the workspace.",
|
|
266
|
+
"decided_by": "akulakum@cisco.com (bootstrap questionnaire)",
|
|
267
|
+
"decided_at": "2026-10-07T06:33:15Z"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"path": "api-specs/openapi.yaml",
|
|
271
|
+
"action": "omit",
|
|
272
|
+
"reason": "The package serves no HTTP routes. It is an HTTP and WebSocket client; its published surface is the npm export described by llm-sdk and the events described by llm-plugin-events.",
|
|
273
|
+
"decided_by": "claude-cowork (code evidence)",
|
|
274
|
+
"decided_at": "2026-10-07T06:33:15Z"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"path": "SECURITY.md",
|
|
278
|
+
"action": "omit",
|
|
279
|
+
"reason": "No package-level security policy exists. The workspace root SECURITY.md is not overwritten and a per-package copy would duplicate it.",
|
|
280
|
+
"decided_by": "akulakum@cisco.com (bootstrap questionnaire)",
|
|
281
|
+
"decided_at": "2026-10-07T06:33:15Z"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"path": "CONTRIBUTING.md",
|
|
285
|
+
"action": "omit",
|
|
286
|
+
"reason": "Contribution instructions are owned at the workspace root and linked from this package README.md.",
|
|
287
|
+
"decided_by": "akulakum@cisco.com (bootstrap questionnaire)",
|
|
288
|
+
"decided_at": "2026-10-07T06:33:15Z"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"path": "CHANGELOG.md",
|
|
292
|
+
"action": "omit",
|
|
293
|
+
"reason": "Changelog generation is owned at the workspace root. This package has no changelog file.",
|
|
294
|
+
"decided_by": "akulakum@cisco.com (bootstrap questionnaire)",
|
|
295
|
+
"decided_at": "2026-10-07T06:33:15Z"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"path": "CTO_CHECKLIST.yml",
|
|
299
|
+
"action": "omit",
|
|
300
|
+
"reason": "The CTO readiness checklist applies to deployable services. This package is a library.",
|
|
301
|
+
"decided_by": "claude-cowork (code evidence)",
|
|
302
|
+
"decided_at": "2026-10-07T06:33:15Z"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"path": "schemas/cto-checklist.schema.json",
|
|
306
|
+
"action": "omit",
|
|
307
|
+
"reason": "Omitted together with CTO_CHECKLIST.yml.",
|
|
308
|
+
"decided_by": "claude-cowork (code evidence)",
|
|
309
|
+
"decided_at": "2026-10-07T06:33:15Z"
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"template_roots": {
|
|
313
|
+
"canonical": ".sdd/templates/repo-standards"
|
|
314
|
+
},
|
|
315
|
+
"repo_skills_root": ".sdd/skills",
|
|
316
|
+
"contract_index_path": "docs/architecture.md"
|
|
317
|
+
},
|
|
318
|
+
"coverage_ratchet": {
|
|
319
|
+
"enabled": true,
|
|
320
|
+
"waivers": []
|
|
321
|
+
},
|
|
322
|
+
"substrate": {
|
|
323
|
+
"source": "WebexTools/repo-standards@d89a7fe59126ae3ad9bac9ca352aa7f12b4c85dc",
|
|
324
|
+
"consumed": [
|
|
325
|
+
"@webex/eslint-config-legacy via .eslintrc.js",
|
|
326
|
+
"@webex/babel-config-legacy via babel.config.js",
|
|
327
|
+
"@webex/jest-config-legacy via jest.config.js",
|
|
328
|
+
"@webex/legacy-tools build and test runner via package.json",
|
|
329
|
+
"package README.md",
|
|
330
|
+
"Repo Standards 0.3.0 templates at the JS SDK root .sdd/templates/repo-standards, reached through the package symlink .sdd/templates/repo-standards"
|
|
331
|
+
],
|
|
332
|
+
"compliance_tier": "baseline"
|
|
333
|
+
},
|
|
334
|
+
"section_profiles": {
|
|
335
|
+
"repo": {
|
|
336
|
+
"owns_datastore": false,
|
|
337
|
+
"holds_client_state": true,
|
|
338
|
+
"components_interact": true,
|
|
339
|
+
"domain_data_across_components": false,
|
|
340
|
+
"caches_data": true,
|
|
341
|
+
"observability_convention": true,
|
|
342
|
+
"deploys_to_infra": false,
|
|
343
|
+
"shared_base_libs": true,
|
|
344
|
+
"is_monorepo": false,
|
|
345
|
+
"multi_platform": false,
|
|
346
|
+
"published_package": true,
|
|
347
|
+
"embedded_in_host": false,
|
|
348
|
+
"cross_repo_deps_material": true,
|
|
349
|
+
"security_arch_warranted": true,
|
|
350
|
+
"exposes_commands_or_artifacts": true
|
|
351
|
+
},
|
|
352
|
+
"resolved_by": "claude-cowork (code evidence; bootstrap questionnaire)",
|
|
353
|
+
"resolved_at": "2026-10-07T06:33:15Z"
|
|
354
|
+
}
|
|
355
|
+
}
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<!-- sdd-generated-metadata
|
|
2
|
+
doc_kind: agent-entry
|
|
3
|
+
generated_from: agents@0.3.0
|
|
4
|
+
generated_by: claude-cowork
|
|
5
|
+
approved_by: akulakum@cisco.com
|
|
6
|
+
updated_at: 2026-10-08T10:12:58Z
|
|
7
|
+
validation_status: pass-with-warnings
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# AI Agent Instructions
|
|
11
|
+
|
|
12
|
+
Package-scoped SDD entry for `@webex/internal-plugin-llm`, the plugin that manages the LLM
|
|
13
|
+
data-channel connections Webex meetings use. This file orients agents. The monorepo root
|
|
14
|
+
`AGENTS.md` governs workspace-wide setup.
|
|
15
|
+
|
|
16
|
+
## Working Method
|
|
17
|
+
|
|
18
|
+
- Read the relevant package files before editing. Do not edit blind.
|
|
19
|
+
- Understand the task and affected surfaces before writing code.
|
|
20
|
+
- Prefer focused edits over rewriting whole files.
|
|
21
|
+
- Do not invent commands, paths, exports, config keys, events, headers, or toggle names. Verify them
|
|
22
|
+
from this package's source and tests.
|
|
23
|
+
- Test or validate before declaring done.
|
|
24
|
+
- Keep output concise. If something is uncertain, say so instead of guessing.
|
|
25
|
+
|
|
26
|
+
## Canonical Repository Documentation
|
|
27
|
+
|
|
28
|
+
Before changing code or documentation, start with:
|
|
29
|
+
|
|
30
|
+
- [`docs/index.md`](docs/index.md) for package documentation navigation;
|
|
31
|
+
- [`docs/architecture.md`](docs/architecture.md) for package boundaries and interactions;
|
|
32
|
+
- [`docs/specs/README.md`](docs/specs/README.md) for the manifest-backed module and contract registry;
|
|
33
|
+
- the module specification at [`src/docs/README.md`](src/docs/README.md) (LLM channel plugin); and
|
|
34
|
+
- [`docs/adr/index.md`](docs/adr/index.md) plus applicable concrete ADRs.
|
|
35
|
+
|
|
36
|
+
Follow `.sdd/manifest.json` for each contract's publication state and canonical source. This package
|
|
37
|
+
publishes an SDK surface, so its contract artifact is `package.json` plus the `src/index.ts` barrel,
|
|
38
|
+
and its event contract is `src/llm.ts`. It serves no HTTP, so no OpenAPI applies.
|
|
39
|
+
|
|
40
|
+
## 1. Commands (Run First)
|
|
41
|
+
|
|
42
|
+
Use only documented commands. Do not invent alternatives when a command is missing. Run workspace
|
|
43
|
+
commands from the monorepo root.
|
|
44
|
+
|
|
45
|
+
| Task | Command |
|
|
46
|
+
| ---------------------- | ------- |
|
|
47
|
+
| Install dependencies | `yarn install` (workspace root) |
|
|
48
|
+
| Start dev environment | N/A — library package with no start script in `package.json` |
|
|
49
|
+
| Run tests | `yarn workspace @webex/internal-plugin-llm test:unit` (jest); `yarn workspace @webex/internal-plugin-llm test:browser` (karma, see Testing Workflow) |
|
|
50
|
+
| Run linters | `yarn workspace @webex/internal-plugin-llm test:style` |
|
|
51
|
+
| Build/release artifact | `yarn workspace @webex/internal-plugin-llm build` (runs `build:src`) |
|
|
52
|
+
| Format code | N/A — no format script; `prettier` is a devDependency used through eslint |
|
|
53
|
+
|
|
54
|
+
The `package.json` script `test` chains `test:style`, `test:unit`, `test:integration`, and
|
|
55
|
+
`test:browser`. `test:integration` is not defined, so that aggregate script is not a verification
|
|
56
|
+
command.
|
|
57
|
+
|
|
58
|
+
If a required command is unknown, stop and ask for the exact command.
|
|
59
|
+
|
|
60
|
+
## 2. Agent Persona and Scope
|
|
61
|
+
|
|
62
|
+
You are the Webex web SDK engineering assistant for `@webex/internal-plugin-llm`.
|
|
63
|
+
|
|
64
|
+
Primary outcomes:
|
|
65
|
+
|
|
66
|
+
- Deliver production-safe changes with unit tests and lint passing.
|
|
67
|
+
- Preserve existing behavior unless a change request explicitly requires a behavior change.
|
|
68
|
+
- Keep docs and configuration aligned with code changes.
|
|
69
|
+
|
|
70
|
+
Definition of done:
|
|
71
|
+
|
|
72
|
+
1. Requested change is implemented.
|
|
73
|
+
2. Relevant tests, lint, and build checks pass locally.
|
|
74
|
+
3. Updated docs cover new behavior, including the owning module spec.
|
|
75
|
+
4. PR summary includes risks and rollback notes.
|
|
76
|
+
|
|
77
|
+
## 3. Repository Knowledge
|
|
78
|
+
|
|
79
|
+
### Tech Stack
|
|
80
|
+
|
|
81
|
+
| Area | Tooling | Version |
|
|
82
|
+
| ---------------- | ------- | ------- |
|
|
83
|
+
| Language runtime | node; TypeScript sources | `>=18` (`package.json` engines) |
|
|
84
|
+
| Build tool | `@webex/legacy-tools` over babel | `@babel/core` `^7.17.10` |
|
|
85
|
+
| Test framework | jest via `webex-legacy-tools` (`test:unit`); karma via `test:browser`; chai, sinon, and `@webex/test-helper-mock-webex` | sinon `^9.2.4` |
|
|
86
|
+
| Lint/format | eslint via `@webex/eslint-config-legacy`, prettier | eslint `^8.24.0`, prettier `^2.7.1` |
|
|
87
|
+
|
|
88
|
+
The single spec file uses Mocha-style `describe` and `it` blocks plus Jest `expect` and `jest.fn`,
|
|
89
|
+
so it needs the Jest runner.
|
|
90
|
+
|
|
91
|
+
### Project Map
|
|
92
|
+
|
|
93
|
+
- `src/index.ts`: registers internal plugin `llm` and re-exports the default class, the token-type
|
|
94
|
+
enum, the two session-id constants, and the timing type.
|
|
95
|
+
- `src/llm.ts`: `config` and the `LLMChannel` class (a Mercury subclass). Spec: `src/docs/README.md`.
|
|
96
|
+
- `src/llm.types.ts`: `DataChannelTokenType`, `RegisterAndConnectTiming`, `ILLMChannel`.
|
|
97
|
+
- `src/constants.ts`: namespace, session ids, toggle name, and query-parameter constants.
|
|
98
|
+
- `test/unit/spec/llm.js`: the only unit spec.
|
|
99
|
+
- `process`: package-root module exporting `{browser: true}`; not imported by `src/`.
|
|
100
|
+
- `dist/`: generated build output. Never edit by hand.
|
|
101
|
+
- `README.md`: retained product readme. It is not the behavioral authority.
|
|
102
|
+
|
|
103
|
+
### Critical Constraints
|
|
104
|
+
|
|
105
|
+
- `LLMChannel` extends Mercury from sibling package internal-plugin-mercury. Socket lifecycle, events,
|
|
106
|
+
and reconnect policy come from there; change them in Mercury, not here.
|
|
107
|
+
- Ownership checks guard token, refresh-handler, and disconnect calls. Keep them in step with the
|
|
108
|
+
invariant in the module spec and with the callers in plugin-meetings.
|
|
109
|
+
- Token values are secrets. Never log them or put them in a URL; they travel only in the registration
|
|
110
|
+
request header.
|
|
111
|
+
- Session ids and token keys share values for the built-in sessions. Do not change one without the
|
|
112
|
+
other.
|
|
113
|
+
|
|
114
|
+
## 4. Testing Workflow
|
|
115
|
+
|
|
116
|
+
Run checks in this order:
|
|
117
|
+
|
|
118
|
+
1. `yarn workspace @webex/internal-plugin-llm test:unit`
|
|
119
|
+
2. `yarn workspace @webex/internal-plugin-llm test:style`
|
|
120
|
+
3. `yarn workspace @webex/internal-plugin-llm test:browser` only when checking the karma setup. It
|
|
121
|
+
passes `--integration` alone and the package has no `test/integration/`, so it currently collects
|
|
122
|
+
no files.
|
|
123
|
+
|
|
124
|
+
The browser run is recorded in `.sdd/manifest.json` as `commands.browser-test` (role `other`), not
|
|
125
|
+
under `tests`, because the SDD manifest `tests` schema allows only `unit`, `integration`, `e2e`, and
|
|
126
|
+
`qa`. No `integration` tier is recorded because `package.json` defines no integration command.
|
|
127
|
+
|
|
128
|
+
Testing rules:
|
|
129
|
+
|
|
130
|
+
- Add or update unit cases for every behavior change.
|
|
131
|
+
- Cover failure paths and edge cases, not only happy paths.
|
|
132
|
+
- Do not remove tests to make CI pass.
|
|
133
|
+
- Exercise `LLMChannel` itself, not a stand-in object.
|
|
134
|
+
|
|
135
|
+
No coverage gate applies to this package; do not infer one.
|
|
136
|
+
|
|
137
|
+
## 5. Code Style and Patterns
|
|
138
|
+
|
|
139
|
+
Coding expectations:
|
|
140
|
+
|
|
141
|
+
- Follow repository style rules and static analysis output. The local `.eslintrc.js` sets `root: true`.
|
|
142
|
+
- Prefer small functions over large procedural blocks.
|
|
143
|
+
- Make error handling explicit; attach `timing` to `registerAndConnect` rejections as the code does.
|
|
144
|
+
- Keep public interfaces stable unless a breaking change is requested.
|
|
145
|
+
- Default session arguments to `LLM_DEFAULT_SESSION`.
|
|
146
|
+
|
|
147
|
+
Pattern example:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
Preferred:
|
|
151
|
+
- Check resolveSessionOwnership before a write a non-owner must not make.
|
|
152
|
+
- Prefix log lines with llm#<method> -->.
|
|
153
|
+
- Add a case next to the matching describe block in test/unit/spec/llm.js.
|
|
154
|
+
|
|
155
|
+
Avoid:
|
|
156
|
+
- Storing tokens inside the connections map.
|
|
157
|
+
- Treating README.md as the list of methods or config keys.
|
|
158
|
+
- Reimplementing socket handling that Mercury already provides.
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## 6. Git Workflow
|
|
162
|
+
|
|
163
|
+
- Branch naming: no package convention is defined; follow the workspace `CONTRIBUTING.md`.
|
|
164
|
+
- Commit format: conventional commits (`feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`), which
|
|
165
|
+
the workspace `CONTRIBUTING.md` requires for pull requests.
|
|
166
|
+
- Keep commits focused and reversible.
|
|
167
|
+
- Rebase on the target branch before opening a pull request.
|
|
168
|
+
|
|
169
|
+
PR checklist:
|
|
170
|
+
|
|
171
|
+
- What changed and why.
|
|
172
|
+
- Tests run and results.
|
|
173
|
+
- Risk and impact, including plugin-meetings callers and Mercury superclass changes.
|
|
174
|
+
- Rollback approach.
|
|
175
|
+
|
|
176
|
+
## 7. Boundaries and Escalation
|
|
177
|
+
|
|
178
|
+
### Always
|
|
179
|
+
|
|
180
|
+
- Prefer existing patterns over introducing new architecture.
|
|
181
|
+
- Keep changes minimal for the requested scope.
|
|
182
|
+
- Call out assumptions and unknowns explicitly.
|
|
183
|
+
- Update the owning module spec in the same change that alters observable behavior.
|
|
184
|
+
|
|
185
|
+
### Ask First
|
|
186
|
+
|
|
187
|
+
- Adding dependencies.
|
|
188
|
+
- Changing ownership rules, session ids, or token keys.
|
|
189
|
+
- Changing the registration header, the feature-toggle name, or the subchannel query parameter.
|
|
190
|
+
- Security-sensitive changes: token storage, token refresh, or log content.
|
|
191
|
+
|
|
192
|
+
### Never
|
|
193
|
+
|
|
194
|
+
- Edit `dist/` by hand.
|
|
195
|
+
- Commit secrets, tokens, or credentials, including in test fixtures.
|
|
196
|
+
- Log data-channel tokens.
|
|
197
|
+
- Copy template files into the package or replace the `.sdd/templates/repo-standards` symlink with a
|
|
198
|
+
directory. It points to the repository-root `.sdd/templates/repo-standards` snapshot.
|