@tencent-rtc/trtc-agent-skills 0.1.0

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.
Files changed (205) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +172 -0
  3. package/README.zh.md +173 -0
  4. package/bin/cli.js +434 -0
  5. package/knowledge-base/index.yaml +454 -0
  6. package/knowledge-base/platform-slice-template.md +233 -0
  7. package/knowledge-base/scenario-spec.md +350 -0
  8. package/knowledge-base/scenarios/conference/base/general-conference.md +365 -0
  9. package/knowledge-base/scenarios/conference/base/webinar-conference.md +130 -0
  10. package/knowledge-base/scenarios/conference/medical/1v1-video-consultation.md +145 -0
  11. package/knowledge-base/scenarios/conference/medical/medical-multidoctor-consultation.md +113 -0
  12. package/knowledge-base/scenarios/live/entertainment-live-room.md +118 -0
  13. package/knowledge-base/slice-spec.md +546 -0
  14. package/knowledge-base/slices/conference/web/ai-tools.md +225 -0
  15. package/knowledge-base/slices/conference/web/beauty-effects.md +188 -0
  16. package/knowledge-base/slices/conference/web/device-control.md +338 -0
  17. package/knowledge-base/slices/conference/web/login-auth.md +261 -0
  18. package/knowledge-base/slices/conference/web/network-quality.md +190 -0
  19. package/knowledge-base/slices/conference/web/official-roomkit-api.md +298 -0
  20. package/knowledge-base/slices/conference/web/official-roomkit-login-ui.md +246 -0
  21. package/knowledge-base/slices/conference/web/participant-list.md +238 -0
  22. package/knowledge-base/slices/conference/web/participant-management.md +718 -0
  23. package/knowledge-base/slices/conference/web/prejoin-check.md +293 -0
  24. package/knowledge-base/slices/conference/web/room-call.md +213 -0
  25. package/knowledge-base/slices/conference/web/room-chat.md +426 -0
  26. package/knowledge-base/slices/conference/web/room-lifecycle.md +534 -0
  27. package/knowledge-base/slices/conference/web/room-schedule.md +281 -0
  28. package/knowledge-base/slices/conference/web/screen-share.md +211 -0
  29. package/knowledge-base/slices/conference/web/video-layout.md +675 -0
  30. package/knowledge-base/slices/conference/web/virtual-background.md +197 -0
  31. package/knowledge-base/slices/conference/web/webinar-interaction.md +206 -0
  32. package/knowledge-base/slices/live/anchor-lifecycle.md +122 -0
  33. package/knowledge-base/slices/live/anchor-preview.md +90 -0
  34. package/knowledge-base/slices/live/anchor-room-config.md +104 -0
  35. package/knowledge-base/slices/live/audience-list.md +86 -0
  36. package/knowledge-base/slices/live/audience-manage.md +92 -0
  37. package/knowledge-base/slices/live/audience-watch.md +85 -0
  38. package/knowledge-base/slices/live/audio.md +116 -0
  39. package/knowledge-base/slices/live/barrage.md +88 -0
  40. package/knowledge-base/slices/live/beauty.md +99 -0
  41. package/knowledge-base/slices/live/coguest-apply.md +105 -0
  42. package/knowledge-base/slices/live/device-control.md +91 -0
  43. package/knowledge-base/slices/live/error-codes.md +167 -0
  44. package/knowledge-base/slices/live/gift.md +84 -0
  45. package/knowledge-base/slices/live/ios/.gitkeep +0 -0
  46. package/knowledge-base/slices/live/ios/anchor-lifecycle.md +313 -0
  47. package/knowledge-base/slices/live/ios/anchor-preview.md +228 -0
  48. package/knowledge-base/slices/live/ios/anchor-room-config.md +257 -0
  49. package/knowledge-base/slices/live/ios/audience-list.md +353 -0
  50. package/knowledge-base/slices/live/ios/audience-manage.md +381 -0
  51. package/knowledge-base/slices/live/ios/audience-watch.md +286 -0
  52. package/knowledge-base/slices/live/ios/audio.md +373 -0
  53. package/knowledge-base/slices/live/ios/barrage.md +285 -0
  54. package/knowledge-base/slices/live/ios/beauty.md +323 -0
  55. package/knowledge-base/slices/live/ios/coguest-apply.md +506 -0
  56. package/knowledge-base/slices/live/ios/device-control.md +286 -0
  57. package/knowledge-base/slices/live/ios/error-codes.md +270 -0
  58. package/knowledge-base/slices/live/ios/gift.md +315 -0
  59. package/knowledge-base/slices/live/ios/live-list.md +269 -0
  60. package/knowledge-base/slices/live/ios/login-auth.md +247 -0
  61. package/knowledge-base/slices/live/live-list.md +82 -0
  62. package/knowledge-base/slices/live/login-auth.md +78 -0
  63. package/package.json +34 -0
  64. package/skills/trtc/SKILL.md +326 -0
  65. package/skills/trtc/room-builder/SKILL.md +138 -0
  66. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/README.md +108 -0
  67. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/docs/backend-contract.zh-CN.md +162 -0
  68. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/docs/integration.zh-CN.md +154 -0
  69. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/docs/theme.zh-CN.md +78 -0
  70. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/index.html +12 -0
  71. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/package.json +28 -0
  72. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/postcss.config.js +5 -0
  73. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/App.vue +25 -0
  74. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/components/ConsultationManagePanel.vue +838 -0
  75. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/components/LanguageSwitch.vue +102 -0
  76. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/components/LoadingSpinner.vue +6 -0
  77. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/components/MedicalAlert.vue +34 -0
  78. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/components/MedicalBusinessPanel.vue +148 -0
  79. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/components/MedicalButton.vue +49 -0
  80. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/components/MedicalConfirmDialog.vue +68 -0
  81. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/components/MedicalDataPanel.vue +196 -0
  82. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/components/MedicalRecordPanel.vue +270 -0
  83. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/components/PrescriptionPanel.vue +363 -0
  84. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/config/basic-info-config.ts +29 -0
  85. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/config/lib-generate-test-usersig-es.min.d.ts +4 -0
  86. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/config/lib-generate-test-usersig-es.min.js +2 -0
  87. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/config/runtime-config.ts +12 -0
  88. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/env.d.ts +32 -0
  89. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/components/ConsultationChatPanel.vue +123 -0
  90. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/components/ConsultationMembersPanel.vue +230 -0
  91. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/components/ConsultationTranscriptionPanel.vue +135 -0
  92. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/components/ConsultationVideoStage.vue +113 -0
  93. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/components/InviteDoctorDialog.vue +132 -0
  94. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/components/KickMemberConfirmDialog.vue +50 -0
  95. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/types.ts +77 -0
  96. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/useConsultationChat.ts +97 -0
  97. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/useConsultationDevices.ts +48 -0
  98. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/useConsultationParticipants.ts +121 -0
  99. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/useConsultationPermissions.ts +25 -0
  100. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/features/consultation/utils.ts +70 -0
  101. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/i18n/en-US/index.ts +553 -0
  102. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/i18n/index.ts +25 -0
  103. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/i18n/medicalTranslate.ts +85 -0
  104. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/i18n/state.ts +49 -0
  105. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/i18n/zh-CN/index.ts +463 -0
  106. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/main.ts +12 -0
  107. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/mock/appointments.ts +96 -0
  108. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/mock/users.ts +79 -0
  109. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/router/index.ts +63 -0
  110. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/services/adapters/index.ts +25 -0
  111. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/services/adapters/integration/appointmentService.ts +77 -0
  112. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/services/adapters/integration/authService.ts +38 -0
  113. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/services/adapters/integration/launchContext.ts +31 -0
  114. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/services/adapters/integration/userService.ts +35 -0
  115. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/services/adapters/mock/appointmentService.ts +43 -0
  116. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/services/adapters/mock/authService.ts +33 -0
  117. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/services/adapters/mock/userService.ts +43 -0
  118. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/services/adapters/types.ts +135 -0
  119. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/shared/icons.ts +53 -0
  120. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/styles/index.css +106 -0
  121. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/styles/tailwind.css +3 -0
  122. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/styles/theme.css +209 -0
  123. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/utils/auth.ts +50 -0
  124. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/utils/format.ts +24 -0
  125. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/utils/navigation.ts +12 -0
  126. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/utils/session.ts +28 -0
  127. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/views/DoctorConsultationView.vue +777 -0
  128. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/views/DoctorDashboardView.vue +678 -0
  129. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/views/LoginView.vue +441 -0
  130. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/views/PatientConsultationFinishedView.vue +185 -0
  131. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/views/PatientConsultationView.vue +1003 -0
  132. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/views/PatientSelectDoctorView.vue +317 -0
  133. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/src/views/PatientWaitingView.vue +454 -0
  134. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/tsconfig.json +21 -0
  135. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/tsconfig.node.json +8 -0
  136. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/vite.config.ts +17 -0
  137. package/skills/trtc/room-builder/templates/scenarios/medical-consultation//346/216/245/345/205/245/350/257/264/346/230/216.md +6 -0
  138. package/skills/trtc/room-builder/tools/render_ai_instructions.py +226 -0
  139. package/skills/trtc-apply/SKILL.md +97 -0
  140. package/skills/trtc-apply/guardrails/apply_lib/__init__.py +0 -0
  141. package/skills/trtc-apply/guardrails/apply_lib/__pycache__/__init__.cpython-313.pyc +0 -0
  142. package/skills/trtc-apply/guardrails/apply_lib/__pycache__/rule_parser.cpython-313.pyc +0 -0
  143. package/skills/trtc-apply/guardrails/apply_lib/rule_parser.py +268 -0
  144. package/skills/trtc-docs/SKILL.md +207 -0
  145. package/skills/trtc-onboarding/SKILL.md +839 -0
  146. package/skills/trtc-onboarding/reference/path-a1-demo.md +103 -0
  147. package/skills/trtc-onboarding/reference/path-a2-integrate.md +693 -0
  148. package/skills/trtc-onboarding/reference/path-b-troubleshoot.md +115 -0
  149. package/skills/trtc-onboarding/reference/path-c-expand.md +43 -0
  150. package/skills/trtc-onboarding/reference/reporting-protocol.md +174 -0
  151. package/skills/trtc-onboarding/reference/supported-matrix.md +100 -0
  152. package/skills/trtc-onboarding/reference/usersig-handling.md +140 -0
  153. package/skills/trtc-search/SKILL.md +221 -0
  154. package/skills/trtc-topic/SKILL.md +638 -0
  155. package/skills/trtc-topic/guardrails/__pycache__/gate_slice_read.cpython-313.pyc +0 -0
  156. package/skills/trtc-topic/guardrails/__pycache__/gate_slice_write.cpython-313.pyc +0 -0
  157. package/skills/trtc-topic/guardrails/__pycache__/stop_require_apply_evidence.cpython-313.pyc +0 -0
  158. package/skills/trtc-topic/guardrails/gate_slice_read.py +133 -0
  159. package/skills/trtc-topic/guardrails/gate_slice_write.py +169 -0
  160. package/skills/trtc-topic/guardrails/stop_require_apply_evidence.py +97 -0
  161. package/skills/trtc-topic/references/execution-units.yaml +58 -0
  162. package/skills/trtc-topic/runtime/README.md +50 -0
  163. package/skills/trtc-topic/runtime/RUNTIME.md +128 -0
  164. package/skills/trtc-topic/runtime/lib/__init__.py +0 -0
  165. package/skills/trtc-topic/runtime/lib/platforms.py +194 -0
  166. package/skills/trtc-topic/runtime/package-lock.json +1211 -0
  167. package/skills/trtc-topic/runtime/package.json +13 -0
  168. package/skills/trtc-topic/runtime/telemetry-bridge.mjs +339 -0
  169. package/skills/trtc-topic/runtime/telemetry_collector.py +293 -0
  170. package/skills/trtc-topic/scripts/STATE-MACHINE-GUIDE.md +186 -0
  171. package/skills/trtc-topic/scripts/__pycache__/apply.cpython-313.pyc +0 -0
  172. package/skills/trtc-topic/scripts/apply.py +581 -0
  173. package/skills/trtc-topic/scripts/finalize_session.py +113 -0
  174. package/skills/trtc-topic/scripts/init_slice_queue.py +96 -0
  175. package/skills/trtc-topic/scripts/lib/__pycache__/state_machine.cpython-313.pyc +0 -0
  176. package/skills/trtc-topic/scripts/lib/state_machine.py +328 -0
  177. package/skills/trtc-topic/scripts/next_slice.py +137 -0
  178. package/skills/trtc-topic/tests/README.md +70 -0
  179. package/skills/trtc-topic/tests/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc +0 -0
  180. package/skills/trtc-topic/tests/__pycache__/conftest.cpython-313-pytest-9.0.3.pyc +0 -0
  181. package/skills/trtc-topic/tests/__pycache__/test_apply_cli.cpython-313-pytest-9.0.2.pyc +0 -0
  182. package/skills/trtc-topic/tests/__pycache__/test_apply_cli.cpython-313-pytest-9.0.3.pyc +0 -0
  183. package/skills/trtc-topic/tests/__pycache__/test_end_to_end.cpython-313-pytest-9.0.2.pyc +0 -0
  184. package/skills/trtc-topic/tests/__pycache__/test_end_to_end.cpython-313-pytest-9.0.3.pyc +0 -0
  185. package/skills/trtc-topic/tests/__pycache__/test_finalize_session.cpython-313-pytest-9.0.2.pyc +0 -0
  186. package/skills/trtc-topic/tests/__pycache__/test_finalize_session.cpython-313-pytest-9.0.3.pyc +0 -0
  187. package/skills/trtc-topic/tests/__pycache__/test_gates.cpython-313-pytest-9.0.2.pyc +0 -0
  188. package/skills/trtc-topic/tests/__pycache__/test_gates.cpython-313-pytest-9.0.3.pyc +0 -0
  189. package/skills/trtc-topic/tests/__pycache__/test_session_resolver.cpython-313-pytest-9.0.2.pyc +0 -0
  190. package/skills/trtc-topic/tests/__pycache__/test_session_resolver.cpython-313-pytest-9.0.3.pyc +0 -0
  191. package/skills/trtc-topic/tests/__pycache__/test_state_machine.cpython-313-pytest-9.0.2.pyc +0 -0
  192. package/skills/trtc-topic/tests/__pycache__/test_state_machine.cpython-313-pytest-9.0.3.pyc +0 -0
  193. package/skills/trtc-topic/tests/__pycache__/test_stop_require_apply.cpython-313-pytest-9.0.2.pyc +0 -0
  194. package/skills/trtc-topic/tests/__pycache__/test_stop_require_apply.cpython-313-pytest-9.0.3.pyc +0 -0
  195. package/skills/trtc-topic/tests/__pycache__/test_topic_skill_invariants.cpython-313-pytest-9.0.2.pyc +0 -0
  196. package/skills/trtc-topic/tests/__pycache__/test_topic_skill_invariants.cpython-313-pytest-9.0.3.pyc +0 -0
  197. package/skills/trtc-topic/tests/conftest.py +72 -0
  198. package/skills/trtc-topic/tests/test_apply_cli.py +480 -0
  199. package/skills/trtc-topic/tests/test_end_to_end.py +305 -0
  200. package/skills/trtc-topic/tests/test_finalize_session.py +51 -0
  201. package/skills/trtc-topic/tests/test_gates.py +316 -0
  202. package/skills/trtc-topic/tests/test_session_resolver.py +260 -0
  203. package/skills/trtc-topic/tests/test_state_machine.py +414 -0
  204. package/skills/trtc-topic/tests/test_stop_require_apply.py +99 -0
  205. package/skills/trtc-topic/tests/test_topic_skill_invariants.py +130 -0
@@ -0,0 +1,221 @@
1
+ ---
2
+ name: trtc-search
3
+ description: >
4
+ Discovers matching slices from the TRTC knowledge base given a natural-language
5
+ query. Use when onboarding or docs needs to find slice IDs for a feature
6
+ description, symptom, error code, or pattern query. Accepts (product, platform,
7
+ query, intent) and returns matched slices with confidence and source attribution.
8
+ Not user-facing — callers compose the final answer from returned results.
9
+ ---
10
+
11
+ # TRTC Knowledge Base Search
12
+
13
+ You search the TRTC knowledge base to find relevant atomic capabilities (slices) and integration scenarios. You handle multi-product, cross-platform searches with a structured strategy chain and return a machine-readable response.
14
+
15
+ ---
16
+
17
+ ## Response Contract (read this first)
18
+
19
+ Every call returns exactly this shape. The calling skill (`docs` / `onboarding`) reads fields by name — do NOT improvise the format, do NOT collapse fields into prose.
20
+
21
+ ```yaml
22
+ response:
23
+ status: matched | no_match | no_slice | ambiguous_product | status_planned
24
+ matches: # populated when status ∈ {matched, status_planned}; empty otherwise
25
+ - slice_id: <product/ability> # e.g. live/barrage
26
+ confidence: high | medium | low
27
+ match_strategy: exact | tag | product-keyword | cross-related | fuzzy
28
+ content_loaded: full | summary | index-only
29
+ file_paths_read: [...] # actual file paths opened this turn (relative to repo root)
30
+ related: [...] # one-hop related slice_ids NOT already in matches
31
+ ambiguous_candidates: [...] # populated ONLY when status = ambiguous_product, e.g. [live, chat]
32
+ reason: "..." # populated ONLY when status ≠ matched; one-sentence cause
33
+ ```
34
+
35
+ ### status semantics
36
+
37
+ | status | Meaning | matches | ambiguous_candidates | reason |
38
+ |--------|---------|---------|----------------------|--------|
39
+ | `matched` | ≥ 1 slice found with usable content | non-empty | — | — |
40
+ | `status_planned` | slice exists in index but content not yet written | non-empty, `content_loaded: index-only` | — | "slice `<id>` is status: planned" |
41
+ | `no_slice` | product exists but has zero slices in KB (e.g., Call, Conference at early stage) | empty | — | "product `<id>` has no slices in KB" |
42
+ | `no_match` | search ran to exhaustion without finding relevant slices | empty | — | one-line cause (e.g., "error code 99999 not in any slice.error_codes or body text") |
43
+ | `ambiguous_product` | product was null AND fuzzy-only hits span multiple products | empty | non-empty (e.g., `[live, chat]`) | "query plausibly matches multiple products; ask user" |
44
+
45
+ ### confidence → match_strategy mapping
46
+
47
+ Confidence is derived from match_strategy, not judged separately:
48
+
49
+ - `high` ← `exact` or `tag`
50
+ - `medium` ← `product-keyword` or `cross-related`
51
+ - `low` ← `fuzzy`
52
+
53
+ Callers should use `confidence` for quick guards (e.g., `if response.matches[0].confidence == 'high': answer from slice, skip llms.txt`) and `match_strategy` for traceability when debugging.
54
+
55
+ ### What callers do with each status
56
+
57
+ - `matched` → read `matches[].file_paths_read`, compose answer from slice contents.
58
+ - `status_planned` → show the slice's index-level description; fall through to caller's fallback (docs → llms.txt).
59
+ - `no_slice` / `no_match` → caller falls back to its own escape route (docs: llms.txt lookup; onboarding: ask user / degrade).
60
+ - `ambiguous_product` → caller asks the user which of `ambiguous_candidates` they mean, then re-calls search with the confirmed product.
61
+
62
+ ---
63
+
64
+ ## Inputs (from calling skill: `docs` or `onboarding`)
65
+
66
+ - **product**: Identified product (chat/call/rtc-engine/live/conference), or `null` if ambiguous
67
+ - **platform**: Identified platform (web/android/ios/flutter/electron), or `null`
68
+ - **query**: The user's original question / keywords
69
+ - **intent**: one of the values listed below.
70
+
71
+ > **Authoritative enum**: this file is the canonical source for the set of `intent` values search accepts. Callers (`docs`, `onboarding`) MUST only pass a value from this list and MUST map their own domain intent (e.g. docs' `slice-lookup`, onboarding's Path B free-text symptom) to one of these four. When this list changes, callers update their mapping tables. The list:
72
+
73
+ - `error-code` — from `docs`: query contains a numeric error code. Prioritize `exact`; on miss, run full-text digit search before other strategies.
74
+ - `pattern` — from `docs`: user asks for the official pattern of X, or compares X vs Y. Prioritize `tag`.
75
+ - `feature` — from `docs` (implementation method lookup) or `onboarding` (user described a feature in natural language): need to find the corresponding slice ID. Prioritize `tag` / `product-keyword`. When multiple slices match, return summaries (`content_loaded: summary`) for the caller to present as a selection list.
76
+ - `troubleshoot` — from `onboarding` Path B: user described a symptom in free text, need to find the slice(s) with relevant troubleshooting content. Match against slice troubleshooting sections and in-file `error_codes` sections.
77
+
78
+ ---
79
+
80
+ ## Search Workflow
81
+
82
+ ### Step 1: Read the index
83
+
84
+ Read `${CLAUDE_PLUGIN_ROOT}/knowledge-base/index.yaml` to get the catalog. Fields present at the index level:
85
+
86
+ - **products**: `id`, `name`, `description`, `llms_file` (`llms_file` is used by the `docs` skill, not by search)
87
+ - **cross_product_relations**: `id`, `products`, `slices`, `description`
88
+ - **slices**: `id`, `name`, `tags`, `platforms`, `file`, `description`, `status`
89
+ - **scenarios**: `id`, `name`, `slices`, `file`, `description`, `status`
90
+
91
+ > **Fields NOT in index.yaml** (common misconception — don't assume them on the index):
92
+ > - `error_codes` — lives inside the slice file body as an `## 错误码` / `## error_codes` section. To check it, the `file` path must be read.
93
+ > - `related` — same: lives inside slice file frontmatter/body, not in index.
94
+ > - `platform_files[platform]` — there is no such index field. Platform-specific content lives at `slices/{product}/{platform}/{ability}.md` on disk. To check availability, try reading that path; if it doesn't exist, there is no platform-specific slice for that pairing.
95
+
96
+ > **Out of scope**: do NOT read llms files, do NOT fetch official doc URLs. If the caller needs a doc URL (e.g., fallback when no slice matches an error code), return `status: no_match` and let the calling skill (`docs`) do the llms.txt lookup.
97
+
98
+ ### Step 2: Five-Strategy Matching (by priority)
99
+
100
+ Try strategies in order; collect matches. Earlier strategies have higher priority. Higher priority wins on rank; ties broken by tag-intersection count.
101
+
102
+ | # | match_strategy | Triggers on | How to match |
103
+ |---|---------------|-------------|--------------|
104
+ | 1 | `exact` | query contains a numeric error code, a known slice_id like `chat/multi-instance`, or a scenario_id | (a) If an error code: look inside each slice's `file` for its `## 错误码` / `## error_codes` section and match the code. On `intent=error-code` miss, additionally grep all slice file bodies for the digit sequence (covers codes mentioned in troubleshooting prose). (b) If a slice_id or scenario_id: direct lookup in index arrays. |
105
+ | 2 | `tag` | after exact (or alongside when no error code) | Extract keywords from the query (LLM does Chinese↔English bidirectionally on its own; consult the "Keyword Hints" table below only for non-intuitive SDK naming). Intersect with each slice's `tags`. Rank by intersection count. |
106
+ | 3 | `product-keyword` | `product` is set AND tag didn't produce a high-confidence hit | Within that product's slices, fuzzy-match against `name` (higher weight) and `description`. Both Chinese and English terms. |
107
+ | 4 | `cross-related` | `tag` or `product-keyword` produced a partial hit AND either (a) query contains signals of a second product, or (b) the initial hit set feels incomplete | Expand via `cross_product_relations` entries whose `products` overlap, OR follow the already-matched slice's `related` list (read from slice file) for one hop. Fold those into matches at medium confidence. |
108
+ | 5 | `fuzzy` | no strategy 1-4 produced anything | Last-resort: use Keyword Hints for bidirectional expansion, match against scenario `name` + `description`, or match slice `description` without tag overlap. All hits are `confidence: low`. |
109
+
110
+ #### Intent-driven priority adjustments
111
+
112
+ | intent | Priority hint |
113
+ |--------|---------------|
114
+ | `error-code` | `exact` runs first; on miss AND `intent=error-code`, run full-text digit grep before strategy 2. Return immediately on strategy-1 hit. |
115
+ | `pattern` | Run all strategies, but rank `tag` hits above `product-keyword`. |
116
+ | `feature` | `tag` and `product-keyword` prioritized. If ≥ 4 matches total, downgrade all `content_loaded` to `summary` so the caller can present a selection. |
117
+ | `troubleshoot` | Prefer slices whose body has a troubleshooting section relevant to the described symptom. Check in-file `error_codes` and 排障 sections when reading for rank. |
118
+
119
+ #### product=null degradation
120
+
121
+ When `product` is `null`:
122
+
123
+ - Strategies `exact` and `tag` run normally (they don't need product). If either yields a `confidence: high` hit, return `status: matched` — do NOT trigger ambiguity.
124
+ - `product-keyword` is skipped (it requires product).
125
+ - `cross-related` and `fuzzy` run as full-catalog searches, capped at **5** matches, ranked by tag-intersection count (ties: `name` match > `description` match).
126
+ - If all remaining results are `confidence: low` (fuzzy only) AND they span ≥ 2 products, return `status: ambiguous_product` with `ambiguous_candidates` listing the distinct products seen. DO NOT return low-confidence results — force the caller to disambiguate first.
127
+ - If fuzzy hits stay within one product, return them normally as `matched`.
128
+
129
+ ### Step 3: Platform Filtering
130
+
131
+ If `platform` is specified:
132
+
133
+ - Filter results to slices whose `platforms` array contains the requested platform.
134
+ - Keep cross-platform overviews (slices present at `slices/{product}/{ability}.md` with no platform subpath) as secondary results — they're generally useful.
135
+ - Framework-to-platform mapping (applied at the caller's layer but repeated here as reference):
136
+ - React / Vue → Web
137
+ - Kotlin → Android
138
+ - Swift / Objective-C → iOS
139
+ - Dart → Flutter
140
+
141
+ If the user needs code but hasn't specified a platform, surface that fact via `reason` (`"platform required for code example"`) — the caller asks.
142
+
143
+ ### Step 4: Progressive Content Loading
144
+
145
+ Set `content_loaded` per match based on result-set size:
146
+
147
+ - **Top 1-3 matches in `matches[]`** → read the full slice file at `${CLAUDE_PLUGIN_ROOT}/${CLAUDE_PLUGIN_ROOT}/knowledge-base/{slice.file}`; if a platform-specific file exists at `${CLAUDE_PLUGIN_ROOT}/knowledge-base/slices/{product}/{platform}/{ability}.md`, read that too. Set `content_loaded: full`.
148
+ - **4+ matches** (typical on `intent=feature` ambiguity) → do NOT read each file; return index-level fields only (name, description, tags). Set `content_loaded: summary`. Let the caller present a selection.
149
+ - **Slice with `status: planned`** → do NOT try to open its `file` (it likely doesn't exist yet). Use the index description. Set `content_loaded: index-only` and set top-level `status: status_planned` on the response.
150
+
151
+ Record every file actually read in `matches[].file_paths_read`. This is the caller's canonical source for "which files grounded the answer".
152
+
153
+ ### Step 5: Build the response
154
+
155
+ Fill the Response Contract based on Step 2-4 results:
156
+
157
+ | Situation | response.status | matches | extras |
158
+ |-----------|----------------|---------|--------|
159
+ | Strategies 1-5 produced content-loadable hits | `matched` | populated; confidence derived from match_strategy | — |
160
+ | Hits all pointed at planned slices | `status_planned` | populated with `content_loaded: index-only` | `reason: "slice <id> is status: planned"` |
161
+ | product exists in index but has zero slices | `no_slice` | empty | `reason: "product <id> has no slices in KB"` |
162
+ | product=null AND only fuzzy hits spanning ≥ 2 products | `ambiguous_product` | empty | `ambiguous_candidates: [...]`, `reason: "..."` |
163
+ | Strategies exhausted, nothing relevant at any confidence | `no_match` | empty | `reason: "..."` (be specific — error code not found / no tag overlap / etc.) |
164
+
165
+ > **Display rules live with the caller**, not with search. search only reports `file_paths_read`; it does not dictate how the caller quotes code, when to include snippets, or how to render confidence. See `../trtc-docs/SKILL.md` Step 3 and `onboarding/reference/path-a2-integrate.md` slice-loading block for those rules.
166
+
167
+ ---
168
+
169
+ ## Keyword Hints (non-intuitive mappings only)
170
+
171
+ Bidirectional Chinese↔English translation for common vocabulary is delegated to the LLM — it already understands that "弹幕" ≈ barrage/danmu, "美颜" ≈ beauty, "进房" ≈ enter-room. This table lists **only mappings that are NOT obvious from translation alone** — cases where the user's colloquial term differs from the SDK's internal naming.
172
+
173
+ | User phrasing | SDK tag / keyword | Why it needs a hint |
174
+ |---------------|--------------------|---------------------|
175
+ | 互踢 | `kick-offline`, `multi-instance` | Not an SDK term; the root capability is multi-instance login conflict |
176
+ | PK | `battle`, `BattleStore` | "PK" is colloquial; SDK names it battle |
177
+ | 黑屏 | `setLiveID`, `black-screen` | The usual root cause is a missed `setLiveID` call, not obvious from "black screen" |
178
+ | 跨房连线 | `co-host`, `CoHostStore` | SDK-proprietary term |
179
+ | 连麦 | `co-guest`, `seat`, `CoGuestStore` | SDK uses `co-guest`, not the more literal `co-mic` |
180
+ | 踢人 | `kick`, `kickUserOutOfRoom` | Exact method name is non-intuitive |
181
+ | 音效 | `audio-effect`, `changer`, `reverb`, `ear-monitor` | Multiple sub-capabilities under one colloquial term |
182
+ | 观众 | `audience`, `LiveAudienceStore` | Associated Store name is not what a user would guess |
183
+
184
+ For any phrasing NOT listed: let the LLM do its own Chinese↔English bridging, then match against `tags` / `name` / `description` directly. Do NOT expand this table defensively with obvious translations — it only pays for its maintenance cost on the non-obvious ones.
185
+
186
+ ---
187
+
188
+ ## Edge Cases
189
+
190
+ ### Missing content
191
+
192
+ | Scenario | status | Handling |
193
+ |----------|--------|----------|
194
+ | Product exists in index but has no slices (e.g., call, conference at early phase) | `no_slice` | `matches: []`, `reason: "product <id> has no slices in KB"` — caller (docs) falls back to llms.txt |
195
+ | Matched slice has `status: planned` in index | `status_planned` | `matches[].content_loaded: index-only`, use index description; caller decides fallback |
196
+ | Platform requested but no platform-specific file at `slices/{product}/{platform}/{ability}.md` | `matched` | Return product-level overview with `content_loaded: full`, `reason: "no platform-specific file for <platform>"` — caller tells the user in their own language that the platform-specific code example isn't yet in the KB; do NOT synthesize code |
197
+
198
+ ### Cross-product questions
199
+
200
+ | Scenario | Handling |
201
+ |----------|---------|
202
+ | "直播+弹幕" (Live+Chat) | `tag` hits live/* + query contains chat signal → `cross-related` expands via `cross_product_relations` → matches include slices from both products |
203
+ | "视频通话+聊天" (Call+Chat) | Same pattern: `tag`/`product-keyword` initial hits + `cross-related` expansion |
204
+ | "该用哪个产品?" | Out of scope — return `no_match` with `reason: "product-selection question, not a slice lookup"`; caller (root / onboarding) handles product identification |
205
+
206
+ ### Search ambiguity
207
+
208
+ | Scenario | Handling |
209
+ |----------|---------|
210
+ | Vague single-term query like "消息" with product=null | `tag` returns many chat/* hits → `matched` with `content_loaded: summary` for the top 3-5; caller presents selection |
211
+ | Mixed Chinese-English "怎么 kick offline" | LLM bridges "kick offline" → Keyword Hints row for 互踢 → `tag` match |
212
+ | Only an error code like "6208" | `exact` (strategy 1) → `matched`, confidence `high` |
213
+ | Error code not in any slice | `no_match`, `reason: "error code <code> not in any slice.error_codes or body text"` — caller (docs) falls back to llms.txt |
214
+
215
+ ### Platform edge cases
216
+
217
+ | Scenario | Handling |
218
+ |----------|---------|
219
+ | Conceptual question, no platform needed | Return product-level overview only; `platform` argument can be null |
220
+ | Needs code but no platform specified | Return `matched` with whatever was found; set `reason: "platform required for code example"` — caller asks |
221
+ | React/Vue → Web, Kotlin → Android, Swift/ObjC → iOS, Dart → Flutter | Caller normalizes; search accepts the normalized platform |