@tencent-rtc/trtc-agent-skills 0.1.3 → 0.1.4

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 (360) hide show
  1. package/.cursor/rules/main.mdc +12 -0
  2. package/AGENTS.md +14 -104
  3. package/CLAUDE.md +15 -127
  4. package/CODEBUDDY.md +32 -118
  5. package/README.md +7 -5
  6. package/README.zh.md +7 -5
  7. package/bin/cli.js +133 -41
  8. package/hooks/__pycache__/cursor-adapter.cpython-313.pyc +0 -0
  9. package/hooks/cursor-adapter.py +45 -18
  10. package/hooks/hooks-cursor.json +5 -18
  11. package/hooks/hooks.json +6 -31
  12. package/knowledge-base/conference/web/index.yaml +143 -0
  13. package/knowledge-base/platform-slice-template.md +1041 -133
  14. package/knowledge-base/products.yaml +76 -0
  15. package/knowledge-base/scenario-spec.md +1316 -115
  16. package/knowledge-base/scenarios/conference/base/general-conference.md +22 -2
  17. package/knowledge-base/scenarios/conference/base/webinar-conference.md +14 -0
  18. package/knowledge-base/scenarios/conference/medical/1v1-video-consultation.md +19 -0
  19. package/knowledge-base/scenarios/conference/medical/medical-multidoctor-consultation.md +13 -0
  20. package/knowledge-base/scenarios/live/entertainment-live-room.md +12 -0
  21. package/knowledge-base/slice-spec.md +2377 -299
  22. package/knowledge-base/slices/conference/web/integration-audit.md +1 -1
  23. package/knowledge-base/slices/conference/web/login-auth.md +14 -1
  24. package/knowledge-base/tooling/aliases.yaml +92 -0
  25. package/knowledge-base/tooling/intent-signals.yaml +181 -0
  26. package/knowledge-base/tooling/symptom-keywords.yaml +21 -0
  27. package/package.json +1 -1
  28. package/skills/trtc/SKILL.md +202 -245
  29. package/skills/trtc/hooks/__pycache__/report_prompt.cpython-313.pyc +0 -0
  30. package/skills/{trtc-topic/guardrails → trtc/hooks}/gate_slice_read.py +12 -8
  31. package/skills/{trtc-topic/guardrails → trtc/hooks}/gate_slice_write.py +16 -12
  32. package/skills/{trtc-topic/guardrails → trtc/hooks}/stop_require_apply_evidence.py +22 -14
  33. package/skills/trtc/hooks/topic_phase_gate.py +161 -0
  34. package/skills/{trtc-topic → trtc}/runtime/README.md +2 -2
  35. package/skills/{trtc-onboarding/reference/reporting-protocol.md → trtc/runtime/REPORTING.md} +5 -5
  36. package/skills/{trtc-topic → trtc}/runtime/RUNTIME.md +5 -5
  37. package/skills/trtc/runtime/lib/__init__.py +0 -0
  38. package/skills/{trtc-topic → trtc}/runtime/package-lock.json +2 -2
  39. package/skills/{trtc-topic → trtc}/runtime/package.json +2 -2
  40. package/skills/{trtc-topic → trtc}/runtime/telemetry-bridge.mjs +1 -1
  41. package/skills/{trtc-topic/scripts → trtc/tools}/STATE-MACHINE-GUIDE.md +23 -23
  42. package/skills/trtc/tools/__init__.py +2 -0
  43. package/skills/trtc/tools/__pycache__/__init__.cpython-313.pyc +0 -0
  44. package/skills/trtc/tools/__pycache__/query_classifier.cpython-313.pyc +0 -0
  45. package/skills/trtc/tools/__pycache__/reporting.cpython-313.pyc +0 -0
  46. package/skills/trtc/tools/__pycache__/search.cpython-313.pyc +0 -0
  47. package/skills/trtc/tools/__pycache__/session.cpython-313.pyc +0 -0
  48. package/skills/trtc/tools/apply.py +540 -0
  49. package/skills/trtc/tools/docs.py +712 -0
  50. package/skills/trtc/tools/docsbot.py +182 -0
  51. package/skills/trtc/tools/entry/render_ai_instructions.py +92 -0
  52. package/skills/trtc/tools/flow.py +1089 -0
  53. package/skills/{trtc-topic/scripts → trtc/tools}/init_slice_queue.py +5 -4
  54. package/skills/{trtc-topic/scripts → trtc/tools}/next_slice.py +5 -4
  55. package/skills/trtc/tools/query_classifier.py +301 -0
  56. package/skills/trtc/tools/reporting.py +447 -0
  57. package/skills/trtc/tools/search.py +817 -0
  58. package/skills/trtc/tools/session.py +1261 -0
  59. package/skills/trtc/tools/state_machine.py +690 -0
  60. package/skills/trtc-ai-service/README.md +195 -0
  61. package/skills/trtc-ai-service/README.zh-CN.md +193 -0
  62. package/skills/trtc-ai-service/SKILL.md +945 -0
  63. package/skills/trtc-ai-service/auto_adapters/README.md +40 -0
  64. package/skills/trtc-ai-service/auto_adapters/frontend-spa/README.md +27 -0
  65. package/skills/trtc-ai-service/auto_adapters/frontend-spa/angular/voice-agent.component.ts.tpl +131 -0
  66. package/skills/trtc-ai-service/auto_adapters/frontend-spa/manifest.yaml +57 -0
  67. package/skills/trtc-ai-service/auto_adapters/frontend-spa/react/VoiceAgent.tsx.tpl +142 -0
  68. package/skills/trtc-ai-service/auto_adapters/frontend-spa/vue/VoiceAgent.vue.tpl +121 -0
  69. package/skills/trtc-ai-service/auto_adapters/integration_templates/generic-backend.md +45 -0
  70. package/skills/trtc-ai-service/auto_adapters/integration_templates/generic-frontend.md +51 -0
  71. package/skills/trtc-ai-service/auto_adapters/integration_templates/generic-rest-api.md +93 -0
  72. package/skills/trtc-ai-service/auto_adapters/java-backend/README.md +25 -0
  73. package/skills/trtc-ai-service/auto_adapters/java-backend/manifest.yaml +30 -0
  74. package/skills/trtc-ai-service/auto_adapters/java-backend/quarkus/VoiceAgentFilter.java.tpl +64 -0
  75. package/skills/trtc-ai-service/auto_adapters/java-backend/springboot/VoiceAgentFilter.java.tpl +91 -0
  76. package/skills/trtc-ai-service/auto_adapters/manifest.yaml +43 -0
  77. package/skills/trtc-ai-service/auto_adapters/node-backend/README.md +25 -0
  78. package/skills/trtc-ai-service/auto_adapters/node-backend/express.js.tpl +40 -0
  79. package/skills/trtc-ai-service/auto_adapters/node-backend/fastify.js.tpl +27 -0
  80. package/skills/trtc-ai-service/auto_adapters/node-backend/koa.js.tpl +31 -0
  81. package/skills/trtc-ai-service/auto_adapters/node-backend/manifest.yaml +47 -0
  82. package/skills/trtc-ai-service/auto_adapters/python-backend/README.md +22 -0
  83. package/skills/trtc-ai-service/auto_adapters/python-backend/django.py.tpl +32 -0
  84. package/skills/trtc-ai-service/auto_adapters/python-backend/fastapi.py.tpl +35 -0
  85. package/skills/trtc-ai-service/auto_adapters/python-backend/flask.py.tpl +31 -0
  86. package/skills/trtc-ai-service/auto_adapters/python-backend/manifest.yaml +45 -0
  87. package/skills/trtc-ai-service/capabilities/__init__.py +43 -0
  88. package/skills/trtc-ai-service/capabilities/conversation-core/.env.example +29 -0
  89. package/skills/trtc-ai-service/capabilities/conversation-core/INTEGRATION.md +134 -0
  90. package/skills/trtc-ai-service/capabilities/conversation-core/INTERFACE_ADAPT.md +111 -0
  91. package/skills/trtc-ai-service/capabilities/conversation-core/QUICK_START.md +62 -0
  92. package/skills/trtc-ai-service/capabilities/conversation-core/manifest.yaml +250 -0
  93. package/skills/trtc-ai-service/capabilities/conversation-core/requirements.txt +6 -0
  94. package/skills/trtc-ai-service/capabilities/conversation-core/src/__init__.py +10 -0
  95. package/skills/trtc-ai-service/capabilities/conversation-core/src/_capability_loader.py +218 -0
  96. package/skills/trtc-ai-service/capabilities/conversation-core/src/agent.py +231 -0
  97. package/skills/trtc-ai-service/capabilities/conversation-core/src/credentials.py +132 -0
  98. package/skills/trtc-ai-service/capabilities/conversation-core/src/health.py +355 -0
  99. package/skills/trtc-ai-service/capabilities/conversation-core/src/log_filter.py +76 -0
  100. package/skills/trtc-ai-service/capabilities/conversation-core/src/modality.py +109 -0
  101. package/skills/trtc-ai-service/capabilities/conversation-core/src/server.py +312 -0
  102. package/skills/trtc-ai-service/capabilities/conversation-core/src/trtc_client.py +315 -0
  103. package/skills/trtc-ai-service/capabilities/conversation-core/src/usersig.py +90 -0
  104. package/skills/trtc-ai-service/capabilities/conversation-core/tests/test_skeleton.py +216 -0
  105. package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/README.md +48 -0
  106. package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/app.js +415 -0
  107. package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/index.html +68 -0
  108. package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/styles.css +136 -0
  109. package/skills/trtc-ai-service/capabilities/digital-human/README.md +31 -0
  110. package/skills/trtc-ai-service/capabilities/digital-human/manifest.yaml +64 -0
  111. package/skills/trtc-ai-service/capabilities/digital-human/src/__init__.py +2 -0
  112. package/skills/trtc-ai-service/capabilities/digital-human/src/router.py +43 -0
  113. package/skills/trtc-ai-service/capabilities/human-handoff/INTERFACE_ADAPT.md +353 -0
  114. package/skills/trtc-ai-service/capabilities/human-handoff/README.md +44 -0
  115. package/skills/trtc-ai-service/capabilities/human-handoff/manifest.yaml +227 -0
  116. package/skills/trtc-ai-service/capabilities/human-handoff/src/__init__.py +2 -0
  117. package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/__init__.py +9 -0
  118. package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/default_rest.py +242 -0
  119. package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/factory.py +89 -0
  120. package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/local_queue.py +258 -0
  121. package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/mock.py +132 -0
  122. package/skills/trtc-ai-service/capabilities/human-handoff/src/core/__init__.py +25 -0
  123. package/skills/trtc-ai-service/capabilities/human-handoff/src/core/intent_detector.py +75 -0
  124. package/skills/trtc-ai-service/capabilities/human-handoff/src/core/models.py +163 -0
  125. package/skills/trtc-ai-service/capabilities/human-handoff/src/core/service.py +192 -0
  126. package/skills/trtc-ai-service/capabilities/human-handoff/src/feedback_store.py +54 -0
  127. package/skills/trtc-ai-service/capabilities/human-handoff/src/ports/__init__.py +4 -0
  128. package/skills/trtc-ai-service/capabilities/human-handoff/src/ports/handoff_client.py +86 -0
  129. package/skills/trtc-ai-service/capabilities/human-handoff/src/queue.py +62 -0
  130. package/skills/trtc-ai-service/capabilities/human-handoff/src/router.py +201 -0
  131. package/skills/trtc-ai-service/capabilities/human-handoff/src/summary_link.py +77 -0
  132. package/skills/trtc-ai-service/capabilities/human-handoff/src/trigger.py +25 -0
  133. package/skills/trtc-ai-service/capabilities/knowledge-base/INTERFACE_ADAPT.md +297 -0
  134. package/skills/trtc-ai-service/capabilities/knowledge-base/README.md +51 -0
  135. package/skills/trtc-ai-service/capabilities/knowledge-base/data/faq.json +20 -0
  136. package/skills/trtc-ai-service/capabilities/knowledge-base/manifest.yaml +211 -0
  137. package/skills/trtc-ai-service/capabilities/knowledge-base/src/__init__.py +8 -0
  138. package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/__init__.py +9 -0
  139. package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/default_rest.py +209 -0
  140. package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/factory.py +86 -0
  141. package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/local_json.py +172 -0
  142. package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/mock.py +91 -0
  143. package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/__init__.py +12 -0
  144. package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/models.py +77 -0
  145. package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/scoring.py +73 -0
  146. package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/service.py +78 -0
  147. package/skills/trtc-ai-service/capabilities/knowledge-base/src/ports/__init__.py +4 -0
  148. package/skills/trtc-ai-service/capabilities/knowledge-base/src/ports/kb_client.py +61 -0
  149. package/skills/trtc-ai-service/capabilities/knowledge-base/src/retriever.py +56 -0
  150. package/skills/trtc-ai-service/capabilities/knowledge-base/src/router.py +85 -0
  151. package/skills/trtc-ai-service/capabilities/session-summary/INTERFACE_ADAPT.md +99 -0
  152. package/skills/trtc-ai-service/capabilities/session-summary/README.md +47 -0
  153. package/skills/trtc-ai-service/capabilities/session-summary/data/test_session.json +18 -0
  154. package/skills/trtc-ai-service/capabilities/session-summary/manifest.yaml +165 -0
  155. package/skills/trtc-ai-service/capabilities/session-summary/src/__init__.py +2 -0
  156. package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/__init__.py +5 -0
  157. package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/base.py +31 -0
  158. package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/default_rest.py +67 -0
  159. package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/factory.py +51 -0
  160. package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/local_json.py +42 -0
  161. package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/mock.py +22 -0
  162. package/skills/trtc-ai-service/capabilities/session-summary/src/recorder.py +210 -0
  163. package/skills/trtc-ai-service/capabilities/session-summary/src/router.py +93 -0
  164. package/skills/trtc-ai-service/capabilities/session-summary/src/summarizer.py +163 -0
  165. package/skills/trtc-ai-service/capabilities/tool-calling/INTERFACE_ADAPT.md +158 -0
  166. package/skills/trtc-ai-service/capabilities/tool-calling/README.md +50 -0
  167. package/skills/trtc-ai-service/capabilities/tool-calling/data/tools.yaml +58 -0
  168. package/skills/trtc-ai-service/capabilities/tool-calling/examples/__init__.py +1 -0
  169. package/skills/trtc-ai-service/capabilities/tool-calling/examples/local_tools.py +101 -0
  170. package/skills/trtc-ai-service/capabilities/tool-calling/manifest.yaml +146 -0
  171. package/skills/trtc-ai-service/capabilities/tool-calling/src/__init__.py +8 -0
  172. package/skills/trtc-ai-service/capabilities/tool-calling/src/dispatcher.py +54 -0
  173. package/skills/trtc-ai-service/capabilities/tool-calling/src/registry.py +219 -0
  174. package/skills/trtc-ai-service/capabilities/tool-calling/src/router.py +50 -0
  175. package/skills/trtc-ai-service/references/business-contract-spec.md +263 -0
  176. package/skills/trtc-ai-service/scenarios/custom-builder/README.md +86 -0
  177. package/skills/trtc-ai-service/scenarios/custom-builder/output-templates/recipe.yaml.j2 +194 -0
  178. package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q1-business-scenario.md +43 -0
  179. package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q2-io-modality.md +57 -0
  180. package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q3-ui-form.md +55 -0
  181. package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q4-capabilities.md +78 -0
  182. package/skills/trtc-ai-service/scenarios/customer-service/README.md +114 -0
  183. package/skills/trtc-ai-service/scenarios/customer-service/recipe.yaml +154 -0
  184. package/skills/trtc-ai-service/scenarios/customer-service/sample-data/README.md +32 -0
  185. package/skills/trtc-ai-service/scenarios/customer-service/sample-data/faq-sample.json +37 -0
  186. package/skills/trtc-ai-service/scenarios/customer-service/system-prompt.template.md +94 -0
  187. package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/app.js +347 -0
  188. package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/index.html +125 -0
  189. package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/styles.css +487 -0
  190. package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/tokens.css +71 -0
  191. package/skills/trtc-ai-service/scenarios/customer-service/ui/design-system/DESIGN_GUIDELINES.md +370 -0
  192. package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/README.md +68 -0
  193. package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/app.js +1307 -0
  194. package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/data.js +40 -0
  195. package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/index.html +233 -0
  196. package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/mock-shop.json +21 -0
  197. package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/styles.css +603 -0
  198. package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/tokens.css +71 -0
  199. package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/agent-link.js +323 -0
  200. package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/app.js +458 -0
  201. package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/index.html +109 -0
  202. package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/styles.css +489 -0
  203. package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/tokens.css +59 -0
  204. package/skills/trtc-ai-service/scripts/add-capability.py +364 -0
  205. package/skills/trtc-ai-service/scripts/contract-adapt.py +334 -0
  206. package/skills/trtc-ai-service/scripts/detect-stack.py +40 -0
  207. package/skills/trtc-ai-service/scripts/lib/__init__.py +20 -0
  208. package/skills/trtc-ai-service/scripts/lib/adapter_codegen.py +509 -0
  209. package/skills/trtc-ai-service/scripts/lib/arbitrator.py +152 -0
  210. package/skills/trtc-ai-service/scripts/lib/contract_resolver.py +519 -0
  211. package/skills/trtc-ai-service/scripts/lib/credential_validators.py +253 -0
  212. package/skills/trtc-ai-service/scripts/lib/curl_parser.py +303 -0
  213. package/skills/trtc-ai-service/scripts/lib/degrader.py +140 -0
  214. package/skills/trtc-ai-service/scripts/lib/injector.py +347 -0
  215. package/skills/trtc-ai-service/scripts/lib/manifest_resolver.py +288 -0
  216. package/skills/trtc-ai-service/scripts/lib/openapi_parser.py +289 -0
  217. package/skills/trtc-ai-service/scripts/lib/stack_detector.py +159 -0
  218. package/skills/trtc-ai-service/scripts/lib/tokens_compile.py +204 -0
  219. package/skills/trtc-ai-service/scripts/post-install-patch.py +225 -0
  220. package/skills/trtc-ai-service/scripts/setup-credentials.py +393 -0
  221. package/skills/trtc-ai-service/scripts/verify-credentials.py +108 -0
  222. package/skills/trtc-ai-service/start.sh +111 -0
  223. package/skills/trtc-ai-service/tests/__init__.py +1 -0
  224. package/skills/trtc-ai-service/tests/test_arbitrator.py +64 -0
  225. package/skills/trtc-ai-service/tests/test_capability_overlay.py +85 -0
  226. package/skills/trtc-ai-service/tests/test_contract_resolver.py +190 -0
  227. package/skills/trtc-ai-service/tests/test_handoff_ports.py +195 -0
  228. package/skills/trtc-ai-service/tests/test_kb_ports.py +195 -0
  229. package/skills/trtc-ai-service/tests/test_manifest_resolver.py +95 -0
  230. package/skills/trtc-ai-service/tests/test_recipe_assembly.py +175 -0
  231. package/skills/trtc-ai-service/tests/test_stack_and_degrader.py +101 -0
  232. package/skills/trtc-ai-service/tests/test_verify_credentials.py +285 -0
  233. package/skills/trtc-ai-service/triggers.yaml +29 -0
  234. package/skills/trtc-conference/SKILL.md +324 -0
  235. package/skills/trtc-conference/flows/onboarding.md +205 -0
  236. package/skills/trtc-conference/flows/topic.md +474 -0
  237. package/skills/trtc-conference/flows/troubleshoot.md +85 -0
  238. package/skills/trtc-conference/hooks/pretooluse_require_business_decisions.py +213 -0
  239. package/skills/trtc-conference/playbooks/medical-quickstart.md +84 -0
  240. package/skills/trtc-conference/playbooks/official-roomkit.md +97 -0
  241. package/skills/trtc-conference/references/local-usersig/basic-info-config.ts +39 -0
  242. package/skills/trtc-conference/references/usersig-handling.md +134 -0
  243. package/skills/trtc-conference/templates/medical-consultation/src/config/lib-generate-test-usersig-es.min.d.ts +4 -0
  244. package/skills/trtc-conference/templates/medical-consultation/src/config/lib-generate-test-usersig-es.min.js +2 -0
  245. package/skills/trtc-conference/tests/__pycache__/test_conference_onboarding_contract.cpython-313-pytest-9.0.2.pyc +0 -0
  246. package/skills/trtc-conference/tests/__pycache__/test_conference_topic_flow_contract.cpython-313-pytest-9.0.2.pyc +0 -0
  247. package/skills/trtc-conference/tests/test_conference_index_contract.py +43 -0
  248. package/skills/trtc-conference/tests/test_conference_onboarding_contract.py +103 -0
  249. package/skills/trtc-conference/tests/test_conference_template_contract.py +25 -0
  250. package/skills/trtc-conference/tests/test_conference_topic_flow_contract.py +132 -0
  251. package/skills/trtc-conference/tools/apply_checks.py +328 -0
  252. package/skills/trtc-conference/verify_lib/__init__.py +0 -0
  253. package/skills/{trtc-apply/guardrails/apply_lib → trtc-conference/verify_lib}/rule_parser.py +1 -1
  254. package/skills/trtc-docs/SKILL.md +91 -119
  255. package/.cursor/rules/ui-mode.mdc +0 -99
  256. package/ai-instructions/base.md +0 -13
  257. package/ai-instructions/ui-mode.md +0 -93
  258. package/knowledge-base/index.yaml +0 -462
  259. package/skills/trtc/room-builder/SKILL.md +0 -133
  260. package/skills/trtc/room-builder/templates/scenarios/medical-consultation/README.md +0 -108
  261. package/skills/trtc/room-builder/tools/render_ai_instructions.py +0 -226
  262. package/skills/trtc-apply/SKILL.md +0 -97
  263. package/skills/trtc-onboarding/SKILL.md +0 -841
  264. package/skills/trtc-onboarding/reference/path-a1-demo.md +0 -103
  265. package/skills/trtc-onboarding/reference/path-a2-integrate.md +0 -737
  266. package/skills/trtc-onboarding/reference/path-b-troubleshoot.md +0 -186
  267. package/skills/trtc-onboarding/reference/path-c-expand.md +0 -43
  268. package/skills/trtc-onboarding/reference/supported-matrix.md +0 -100
  269. package/skills/trtc-search/SKILL.md +0 -228
  270. package/skills/trtc-topic/SKILL.md +0 -622
  271. package/skills/trtc-topic/scripts/apply.py +0 -581
  272. package/skills/trtc-topic/scripts/lib/state_machine.py +0 -328
  273. package/skills/trtc-topic/tests/README.md +0 -70
  274. package/skills/trtc-topic/tests/conftest.py +0 -72
  275. package/skills/trtc-topic/tests/test_apply_cli.py +0 -480
  276. package/skills/trtc-topic/tests/test_end_to_end.py +0 -305
  277. package/skills/trtc-topic/tests/test_finalize_session.py +0 -51
  278. package/skills/trtc-topic/tests/test_gates.py +0 -316
  279. package/skills/trtc-topic/tests/test_session_resolver.py +0 -260
  280. package/skills/trtc-topic/tests/test_state_machine.py +0 -414
  281. package/skills/trtc-topic/tests/test_stop_require_apply.py +0 -99
  282. package/skills/trtc-topic/tests/test_topic_skill_invariants.py +0 -130
  283. /package/skills/{trtc-topic → trtc}/runtime/lib/platforms.py +0 -0
  284. /package/skills/{trtc-topic → trtc}/runtime/telemetry_collector.py +0 -0
  285. /package/skills/{trtc-onboarding/reference → trtc/runtime}/usersig-handling.md +0 -0
  286. /package/skills/{trtc-topic/scripts → trtc/tools}/finalize_session.py +0 -0
  287. /package/skills/{trtc-apply/guardrails/apply_lib → trtc-ai-service/capabilities/conversation-core/tests}/__init__.py +0 -0
  288. /package/skills/{trtc-topic → trtc-conference}/references/execution-units.yaml +0 -0
  289. /package/skills/{trtc/room-builder/templates/scenarios/medical-consultation/src/config → trtc-conference/references/local-usersig}/lib-generate-test-usersig-es.min.d.ts +0 -0
  290. /package/skills/{trtc/room-builder/templates/scenarios/medical-consultation/src/config → trtc-conference/references/local-usersig}/lib-generate-test-usersig-es.min.js +0 -0
  291. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/docs/backend-contract.zh-CN.md +0 -0
  292. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/docs/integration.zh-CN.md +0 -0
  293. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/docs/theme.zh-CN.md +0 -0
  294. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/index.html +0 -0
  295. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/package.json +0 -0
  296. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/postcss.config.js +0 -0
  297. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/App.vue +0 -0
  298. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/ConsultationManagePanel.vue +0 -0
  299. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/LanguageSwitch.vue +0 -0
  300. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/LoadingSpinner.vue +0 -0
  301. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalAlert.vue +0 -0
  302. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalBusinessPanel.vue +0 -0
  303. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalButton.vue +0 -0
  304. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalConfirmDialog.vue +0 -0
  305. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalDataPanel.vue +0 -0
  306. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalRecordPanel.vue +0 -0
  307. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/PrescriptionPanel.vue +0 -0
  308. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/config/basic-info-config.ts +0 -0
  309. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/config/runtime-config.ts +0 -0
  310. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/env.d.ts +0 -0
  311. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/ConsultationChatPanel.vue +0 -0
  312. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/ConsultationMembersPanel.vue +0 -0
  313. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/ConsultationTranscriptionPanel.vue +0 -0
  314. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/ConsultationVideoStage.vue +0 -0
  315. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/InviteDoctorDialog.vue +0 -0
  316. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/KickMemberConfirmDialog.vue +0 -0
  317. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/types.ts +0 -0
  318. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/useConsultationChat.ts +0 -0
  319. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/useConsultationDevices.ts +0 -0
  320. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/useConsultationParticipants.ts +0 -0
  321. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/useConsultationPermissions.ts +0 -0
  322. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/utils.ts +0 -0
  323. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/i18n/en-US/index.ts +0 -0
  324. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/i18n/index.ts +0 -0
  325. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/i18n/medicalTranslate.ts +0 -0
  326. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/i18n/state.ts +0 -0
  327. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/i18n/zh-CN/index.ts +0 -0
  328. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/main.ts +0 -0
  329. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/mock/appointments.ts +0 -0
  330. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/mock/users.ts +0 -0
  331. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/router/index.ts +0 -0
  332. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/index.ts +0 -0
  333. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/integration/appointmentService.ts +0 -0
  334. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/integration/authService.ts +0 -0
  335. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/integration/launchContext.ts +0 -0
  336. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/integration/userService.ts +0 -0
  337. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/mock/appointmentService.ts +0 -0
  338. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/mock/authService.ts +0 -0
  339. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/mock/userService.ts +0 -0
  340. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/types.ts +0 -0
  341. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/shared/icons.ts +0 -0
  342. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/styles/index.css +0 -0
  343. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/styles/tailwind.css +0 -0
  344. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/styles/theme.css +0 -0
  345. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/utils/auth.ts +0 -0
  346. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/utils/format.ts +0 -0
  347. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/utils/navigation.ts +0 -0
  348. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/utils/session.ts +0 -0
  349. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/DoctorConsultationView.vue +0 -0
  350. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/DoctorDashboardView.vue +0 -0
  351. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/LoginView.vue +0 -0
  352. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/PatientConsultationFinishedView.vue +0 -0
  353. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/PatientConsultationView.vue +0 -0
  354. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/PatientSelectDoctorView.vue +0 -0
  355. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/PatientWaitingView.vue +0 -0
  356. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/tsconfig.json +0 -0
  357. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/tsconfig.node.json +0 -0
  358. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/vite.config.ts +0 -0
  359. /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation//346/216/245/345/205/245/350/257/264/346/230/216.md" +0 -0
  360. /package/skills/{trtc-topic/runtime/lib → trtc-conference/tools}/__init__.py +0 -0
@@ -0,0 +1,45 @@
1
+ name: "python-backend"
2
+ version: "1.0.0"
3
+ target_role: "backend"
4
+ tech_stack: ["flask", "fastapi", "django"]
5
+ description: "Python backend reverse proxy: decorator / sub-router form to connect to skeleton"
6
+
7
+ templates:
8
+ flask:
9
+ file: "flask.py.tpl"
10
+ target_path: "voice_agent_proxy.py"
11
+ install_hint: |
12
+ In main app:
13
+ from voice_agent_proxy import bp
14
+ app.register_blueprint(bp, url_prefix='${ROUTE_PREFIX}')
15
+ package_dependencies:
16
+ - "Flask>=3.0"
17
+ - "requests>=2.31"
18
+ fastapi:
19
+ file: "fastapi.py.tpl"
20
+ target_path: "voice_agent_proxy.py"
21
+ install_hint: |
22
+ In main app:
23
+ from voice_agent_proxy import router
24
+ app.include_router(router, prefix='${ROUTE_PREFIX}')
25
+ package_dependencies:
26
+ - "fastapi>=0.110"
27
+ - "httpx>=0.27"
28
+ django:
29
+ file: "django.py.tpl"
30
+ target_path: "voice_agent_proxy/views.py"
31
+ install_hint: |
32
+ In urls.py:
33
+ from voice_agent_proxy.views import proxy_view
34
+ urlpatterns += [path('${ROUTE_PREFIX}/<path:rest>', proxy_view)]
35
+ package_dependencies:
36
+ - "Django>=4.2"
37
+ - "requests>=2.31"
38
+
39
+ defaults:
40
+ SKELETON_BASE_URL: "http://localhost:3000"
41
+ API_PREFIX: "/api/v1"
42
+ ROUTE_PREFIX: "/voice-agent"
43
+
44
+ security:
45
+ https_required: true
@@ -0,0 +1,43 @@
1
+ """capabilities namespace root.
2
+
3
+ Subdirectories use hyphenated names (manifest style), but Python modules require underscore names.
4
+ This file creates aliases on import as needed (only when the corresponding directory exists).
5
+
6
+ Example:
7
+ capabilities.knowledge-base/ → import capabilities.knowledge_base
8
+ """
9
+ from __future__ import annotations
10
+
11
+ import importlib
12
+ import sys
13
+ from pathlib import Path
14
+
15
+ _ROOT = Path(__file__).resolve().parent
16
+
17
+ # Hyphenated directory → underscore module alias
18
+ _ALIASES = {
19
+ "knowledge-base": "knowledge_base",
20
+ "tool-calling": "tool_calling",
21
+ "human-handoff": "human_handoff",
22
+ "session-summary": "session_summary",
23
+ "digital-human": "digital_human",
24
+ }
25
+
26
+
27
+ def _install_alias(dirname: str, modname: str) -> None:
28
+ full_dir = _ROOT / dirname
29
+ if not full_dir.exists():
30
+ return
31
+ full_name = f"{__name__}.{modname}"
32
+ if full_name in sys.modules:
33
+ return
34
+ # Register a namespace package that sub-modules can continue importing
35
+ import types
36
+
37
+ pkg = types.ModuleType(full_name)
38
+ pkg.__path__ = [str(full_dir)] # type: ignore[attr-defined]
39
+ sys.modules[full_name] = pkg
40
+
41
+
42
+ for _d, _m in _ALIASES.items():
43
+ _install_alias(_d, _m)
@@ -0,0 +1,29 @@
1
+ # conversation-core · 三把 Key 环境变量模板
2
+ # ----------------------------------------------------------
3
+ # 用法:
4
+ # 1. 优先通过 `python scripts/setup-credentials.py` 交互式引导生成 .env
5
+ # 2. 如需手动配置,复制本文件为 .env 并填入实际值
6
+ # 注意:所有凭证仅来自环境变量(env-only),切勿在代码中明文写入
7
+
8
+ # [1/3] 腾讯云 API 密钥
9
+ TENCENT_CLOUD_SECRET_ID=
10
+ TENCENT_CLOUD_SECRET_KEY=
11
+ TENCENT_CLOUD_REGION=ap-guangzhou
12
+
13
+ # [2/3] TRTC Conversational AI 应用凭据
14
+ # 默认从 https://console.trtc.io 申请的国际站应用(trtc.intl.tencentcloudapi.com)
15
+ TRTC_SDK_APP_ID=
16
+ TRTC_SDK_SECRET_KEY=
17
+ # (高级)若你的应用在国内站 console.cloud.tencent.com/trtc 申请,去掉下行注释:
18
+ # TRTC_REGION=cn
19
+
20
+ # [3/3] 外部 LLM 接入(OpenAI 兼容协议)
21
+ LLM_API_KEY=
22
+ LLM_API_URL=https://api.openai.com/v1/chat/completions
23
+ LLM_MODEL=gpt-4o-mini
24
+ LLM_TYPE=openai
25
+
26
+ # 服务监听
27
+ HOST=0.0.0.0
28
+ PORT=3000
29
+ LOG_LEVEL=INFO
@@ -0,0 +1,134 @@
1
+ # conversation-core · Integration Guide (Agent-readable)
2
+
3
+ > This document is for **AI coding assistants / integration agents** to automatically
4
+ > merge the conversation-core skeleton into user projects. All instructions are designed for programmatic parsing and execution.
5
+
6
+ ---
7
+
8
+ ## Section 1 · Tech Stack Detection
9
+
10
+ At the integration entry point, the Agent detects user project characteristics in the following order, outputting a `tech_stack` label:
11
+
12
+ | Signal File | Key Field | Inferred Tech Stack |
13
+ |:---|:---|:---|
14
+ | `package.json` | `dependencies.react` | `react` |
15
+ | `package.json` | `dependencies.vue` | `vue` |
16
+ | `package.json` | `dependencies['@angular/core']` | `angular` |
17
+ | `package.json` | `dependencies.express` / `koa` / `fastify` | `express` / `koa` / `fastify` |
18
+ | `package.json` | `dependencies.next` | `next` |
19
+ | `pom.xml` | `<artifactId>spring-boot-starter</artifactId>` | `spring-boot` |
20
+ | `build.gradle` | `org.springframework.boot` | `spring-boot` |
21
+ | `pom.xml` | `quarkus-core` | `quarkus` |
22
+ | `requirements.txt` / `pyproject.toml` | `flask` / `fastapi` / `django` | `flask` / `fastapi` / `django` |
23
+
24
+ If multiple tech stack candidates are detected, the most specific one takes priority:
25
+ `next > react/vue/angular > express/koa/fastify > spring-boot/quarkus > flask/fastapi/django`.
26
+
27
+ ---
28
+
29
+ ## Section 2 · Adapter Rule Matching
30
+
31
+ Read the `integration.auto_adapters` list from this capability's `manifest.yaml`; the first entry whose `tech_stack` matches becomes the target adapter:
32
+
33
+ ```text
34
+ match(tech_stack_detected, manifest.integration.auto_adapters[*].tech_stack)
35
+ → adapter_name (e.g. "frontend-spa")
36
+ ```
37
+
38
+ The mapping from adapter name to actual generator is provided by Phase 2; this skeleton only declares the interface contract.
39
+
40
+ ---
41
+
42
+ ## Section 3 · Code Generation and Merging
43
+
44
+ Phase 1 skeleton only exposes REST APIs (default port `3000`). How integrators call the skeleton from their own projects:
45
+
46
+ ### 3.1 Frontend (any SPA)
47
+
48
+ ```js
49
+ // 1) Health check (top status bar)
50
+ const health = await fetch('http://localhost:3000/api/v1/health').then(r => r.json());
51
+
52
+ // 2) Request room credentials
53
+ const cfg = await fetch('http://localhost:3000/api/v1/get_config', {
54
+ method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}'
55
+ }).then(r => r.json());
56
+ const { session_id, sdk_app_id, room_id, user_id, user_sig } = cfg.data;
57
+
58
+ // 3) Join room via TRTC Web SDK using sdk_app_id / user_sig (encapsulated by frontend capability package)
59
+
60
+ // 4) Start AI channel bot
61
+ await fetch('http://localhost:3000/api/v1/agent/start', {
62
+ method: 'POST', headers: { 'Content-Type': 'application/json' },
63
+ body: JSON.stringify({ session_id, language: 'zh' })
64
+ });
65
+ ```
66
+
67
+ ### 3.2 Backend (any runtime)
68
+
69
+ | Runtime | Injection Point | Generator Output |
70
+ |:---|:---|:---|
71
+ | Express / Koa / Fastify | Router layer | Middleware code (reverse proxy `/api/v1/*` to skeleton process) |
72
+ | Spring Boot / Quarkus | Filter Chain | Filter code + `@Value("${trtc.voice-agent.endpoint}")` injection |
73
+ | Flask / FastAPI / Django | Route handler | Decorators + sub-router mounting |
74
+
75
+ ### 3.3 Injection Points (declarative)
76
+
77
+ `manifest.yaml.injection_points` declares 5 standard injection points. Phase 2 capability packages reference them by `id`, e.g.:
78
+
79
+ ```yaml
80
+ # knowledge-base capability manifest.yaml snippet
81
+ extensions:
82
+ - inject_at: "agent.before_start"
83
+ code_template: "templates/inject_kb_to_instructions.py.tpl"
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Section 4 · Three-Level Degradation Path
89
+
90
+ | Level | Trigger Condition | Agent Behavior |
91
+ |:---:|:---|:---|
92
+ | **L1 Full Auto-Merge** | Tech stack detected successfully and code generation has no conflicts | Write directly into user project and auto-run `npm install` / `pip install` |
93
+ | **L2 Semi-Auto Guide** | Tech stack detected successfully but code generation fails (syntax / path conflicts) | Output `INTEGRATION_GUIDE.md` with template code + manual injection steps |
94
+ | **L3 Manual API Fallback** | Tech stack cannot be identified | Output REST API docs (base path `/api/v1`) + SDK package install commands |
95
+
96
+ L2 / L3 output templates are located in `integration-templates/` (provided by Phase 2).
97
+
98
+ ---
99
+
100
+ ## Section 5 · Verification Checks
101
+
102
+ After integration, the Agent must execute these checks in order:
103
+
104
+ 1. **Process alive** — `curl -s http://localhost:3000/api/v1/health | jq .status`, expected `"ok"`.
105
+ 2. **Three LEDs** — `health.checks.{tencent_cloud,trtc,llm}.status == "ok"`.
106
+ 3. **Session handshake** — `POST /api/v1/get_config` → returns non-empty `session_id` and `user_sig`.
107
+ 4. **Text injection** — After starting AI, call `POST /api/v1/agent/control { text: "ping" }` expecting `delivered: true`.
108
+ 5. **Graceful stop** — `POST /api/v1/agent/stop` returns `status: "stopped"`.
109
+
110
+ On any step failure, the Agent must output a diagnostic JSON:
111
+
112
+ ```json
113
+ { "step": "get_config", "error": "...", "remediation": "Check that TRTC_SDK_APP_ID in .env is an integer" }
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Appendix A · Error Code Dictionary
119
+
120
+ | Error Code | Meaning | Remediation |
121
+ |:---|:---|:---|
122
+ | E001 | Tencent Cloud SecretId/SecretKey invalid | Re-run `python scripts/setup-credentials.py` |
123
+ | E002 | TRTC SDKAppID/SDKSecretKey invalid or UserSig generation failed | Verify SDKAppID is an integer; SecretKey is complete |
124
+ | E003 | LLM API Key invalid | Check that `LLM_API_URL` is an OpenAI-compatible endpoint |
125
+ | E004 | Network unreachable | Check egress IP whitelist / proxy |
126
+ | E005 | Service not activated | Enable Conversational AI in TRTC Console |
127
+
128
+ ## Appendix B · Security Compliance
129
+
130
+ - Credentials only from environment variables (`security.credential_storage.source = env-only`)
131
+ - Credential cache and `.env` file enforced to permission `0600`
132
+ - End-to-end HTTPS (`security.network.enforce_https = true`)
133
+ - Log redaction filter installed at process startup (see `src/log_filter.py`)
134
+ - XSS / Prompt Injection protection switches declared in `security.injection_protection`
@@ -0,0 +1,111 @@
1
+ # conversation-core Interface Adaptation SOP
2
+
3
+ > Skeleton-layer interface adaptation guide. In this release, conversation-core has **not been refactored to ports/adapters/core** (Phase 1 compromise, deferred to Phase 4),
4
+ > so this document only explains "which interfaces can be replaced and how", without providing automated generation entry points.
5
+
6
+ ---
7
+
8
+ ## 1. Default Contract Overview
9
+
10
+ | Contract | Method | Path | Adaptable? |
11
+ |---|---|---|---|
12
+ | `llm.chat_completions` | POST | `/v1/chat/completions` (OpenAI-compatible) | **Adaptable** |
13
+ | `trtc.start_ai_conversation` | POST | Tencent Cloud TencentCloudAPI | **Not adaptable** (tightly bound to Tencent Cloud) |
14
+
15
+ Full field definitions in `manifest.yaml.business_contract.external_apis`.
16
+
17
+ ---
18
+
19
+ ## 2. LLM Interface Replacement (most common)
20
+
21
+ The skeleton calls LLM using the OpenAI Chat Completions protocol by default:
22
+ - Default `LLM_API_URL = https://api.openai.com/v1/chat/completions`
23
+ - Supports any OpenAI-compatible proxy (DeepSeek / Qwen / Tencent Hunyuan OpenAPI / vLLM etc.)
24
+
25
+ ### 2.1 OpenAI-Compatible Protocol (recommended path)
26
+
27
+ Only need to switch environment variables — **no code changes required**:
28
+
29
+ ```bash
30
+ # Switch to DeepSeek
31
+ export LLM_API_URL=https://api.deepseek.com/v1/chat/completions
32
+ export LLM_API_KEY=sk-xxx
33
+ export LLM_MODEL=deepseek-chat
34
+
35
+ # Switch to Qwen (DashScope OpenAI-compatible endpoint)
36
+ export LLM_API_URL=https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
37
+ export LLM_API_KEY=sk-xxx
38
+ export LLM_MODEL=qwen-turbo
39
+
40
+ # Switch to self-hosted vLLM
41
+ export LLM_API_URL=http://your-vllm:8000/v1/chat/completions
42
+ export LLM_API_KEY=any-string
43
+ export LLM_MODEL=Qwen2.5-7B-Instruct
44
+ ```
45
+
46
+ > Security: Self-hosted LLM must use https://; http only allowed for localhost. See `security_rules`.
47
+
48
+ ### 2.2 Non-OpenAI Protocols (e.g. Claude Anthropic Messages API)
49
+
50
+ Requires introducing an "LLM protocol adapter" at the skeleton layer. This mechanism is not delivered in this release; temporary workaround:
51
+
52
+ 1. Deploy an OpenAI ↔ Anthropic protocol translation gateway (e.g. LiteLLM) in the user project
53
+ 2. Point the skeleton's `LLM_API_URL` to the gateway
54
+ 3. The gateway handles protocol translation
55
+
56
+ ```bash
57
+ # Launch LiteLLM gateway (see https://docs.litellm.ai/)
58
+ litellm --model anthropic/claude-3-5-sonnet --port 4000
59
+
60
+ # Skeleton configuration
61
+ export LLM_API_URL=http://localhost:4000/v1/chat/completions
62
+ export LLM_API_KEY=sk-anthropic-xxx
63
+ export LLM_MODEL=anthropic/claude-3-5-sonnet
64
+ ```
65
+
66
+ ### 2.3 Phase 4 Plan: LLM Adapter Abstraction
67
+
68
+ The skeleton will introduce a `LlmClient` abstraction (same pattern as human-handoff / knowledge-base):
69
+
70
+ ```
71
+ capabilities/conversation-core/src/
72
+ ├── ports/
73
+ │ └── llm_client.py # ABC: chat / stream_chat / count_tokens
74
+ └── adapters/
75
+ ├── openai_compat.py # Current default implementation
76
+ ├── claude_anthropic.py # Native Anthropic Messages API
77
+ ├── tencent_hunyuan.py # Tencent Hunyuan native OpenAPI
78
+ └── user_custom.py # User integration wizard generator
79
+ ```
80
+
81
+ This document will be supplemented with automated adaptation workflows at that time.
82
+
83
+ ---
84
+
85
+ ## 3. TRTC Conversational AI Control Plane (Not Adaptable)
86
+
87
+ `trtc.start_ai_conversation` / `StopAIConversation` / `ControlAIConversation` /
88
+ `ServerPushText` and other control plane interfaces are **tightly bound to the Tencent Cloud protocol**. If the user's business does not use TRTC,
89
+ they should not continue using this capability package; suggest switching to a text-only conversation approach (using conversation-core's
90
+ `text_input` / `text_output` channels, bypassing the TRTC control plane).
91
+
92
+ ---
93
+
94
+ ## 4. ASR / TTS Service Replacement
95
+
96
+ The skeleton uses TRTC's built-in ASR/TTS by default (declared via `STTConfig` / `TTSConfig` in StartAIConversation
97
+ requests). To switch to your own ASR/TTS, replace the provider name in the manifest's
98
+ `config.io_modality.voice_input.provider` / `voice_output.provider` fields and implement
99
+ a custom provider extension in the user project per the TRTC ConversationAI documentation.
100
+
101
+ Custom provider scaffolding is not provided in this release.
102
+
103
+ ---
104
+
105
+ ## 5. Security Checklist
106
+
107
+ - [ ] All 3 keys come from environment variables only — **no hardcoding**
108
+ - [ ] `LLM_API_URL` must use https:// or http://localhost
109
+ - [ ] Reject private network addresses for self-hosted LLM (except localhost)
110
+ - [ ] `LLM_API_KEY` / `Authorization` headers auto-redacted in logs (handled by skeleton `log_redaction`)
111
+ - [ ] Credential cache file permissions enforced to 600
@@ -0,0 +1,62 @@
1
+ # conversation-core · Quick Start
2
+
3
+ > Configure → Run → Verify, done in three steps.
4
+
5
+ ## 0. Prerequisites
6
+
7
+ - Python ≥ 3.9
8
+ - Activated: Tencent Cloud account + TRTC Conversational AI application + any OpenAI-compatible LLM service
9
+
10
+ ## 1. Install
11
+
12
+ ```bash
13
+ # From repo root
14
+ pip install -r capabilities/conversation-core/requirements.txt
15
+ ```
16
+
17
+ ## 2. Configure the 3 Keys
18
+
19
+ ```bash
20
+ python scripts/setup-credentials.py
21
+ ```
22
+
23
+ The script interactively guides you through `[1/3] Tencent Cloud → [2/3] TRTC → [3/3] LLM` in order,
24
+ running a self-check immediately after each key is entered. On failure, it won't proceed to the next key;
25
+ if interrupted mid-way, re-running it will auto-skip keys that already passed (checkpoint resume).
26
+
27
+ Output artifacts on success:
28
+
29
+ | Path | Contents | Permissions |
30
+ |:---|:---|:---:|
31
+ | `.env` | Environment variable declarations for the 3 keys | 600 |
32
+ | `.credentials_cache` | SHA256 hashes of verified keys | 600 |
33
+ | `config-report.json` | Verification timestamp / latency / status for each key | 644 |
34
+
35
+ ## 3. Launch Web Demo
36
+
37
+ ```bash
38
+ bash start.sh
39
+ # Equivalent to:
40
+ # cd capabilities/conversation-core && python -m src.server
41
+ ```
42
+
43
+ Open <http://localhost:3000> in your browser.
44
+
45
+ ## 4. Acceptance Criteria
46
+
47
+ - [x] ASR/LLM/TTS pipeline has no hard-coded business logic (protocol passthrough only)
48
+ - [x] `setup-credentials.py` supports real-time connectivity self-check and checkpoint resume
49
+ - [x] Web Demo top status bar: all three indicator LEDs green
50
+ - [x] manifest.yaml includes skeleton type / injection points / modality / security declarations
51
+ - [x] INTEGRATION.md provides Agent-readable detection logic and three-level degradation path
52
+ - [x] `.credentials_cache` / `.env` permissions 600; no plain-text keys in logs
53
+
54
+ ## 5. Next Steps
55
+
56
+ Overlay business capability packages at the 5 injection points declared in `manifest.yaml.injection_points`:
57
+
58
+ ```bash
59
+ voice-agent add knowledge-base
60
+ voice-agent add tool-calling
61
+ voice-agent add human-handoff
62
+ ```
@@ -0,0 +1,250 @@
1
+ # conversation-core capability self-describing manifest
2
+ # Type: skeleton (always installed by default; no built-in business scenarios)
3
+
4
+ name: "conversation-core"
5
+ version: "1.0.0"
6
+ type: "skeleton"
7
+ description: "Generic Voice Agent skeleton providing ASR/LLM/TTS/session management core capabilities without any built-in business logic"
8
+
9
+ # ---------------------------------------------------------------------------
10
+ # Dependency declaration
11
+ # ---------------------------------------------------------------------------
12
+ dependencies: [] # Skeleton layer has no dependencies
13
+
14
+ # ---------------------------------------------------------------------------
15
+ # Injection points (for Phase 2 capability overlay)
16
+ # Convention: position field uses before:function_name / after:function_name / replace:function_name
17
+ # ---------------------------------------------------------------------------
18
+ injection_points:
19
+ - id: "agent.before_start"
20
+ target: "src/agent.py"
21
+ position: "before:_ext_before_start_"
22
+ description: "Inject code inside the start_agent method body (e.g. prepend KB search results to instructions); anchor is inside start_agent method body to ensure access to local variables like config/info"
23
+
24
+ - id: "agent.after_start"
25
+ target: "src/agent.py"
26
+ position: "before:_ext_after_start_"
27
+ description: "Inject session-level hooks after the AI task is successfully launched (e.g. initialize human handoff state machine); anchor is inside start_agent method body"
28
+
29
+ - id: "agent.before_push_text"
30
+ target: "src/agent.py"
31
+ position: "before:_ext_before_push_text_"
32
+ description: "Intercept before text injection is sent (e.g. keyword-triggered handoff / tool calling); anchor is inside push_text method body"
33
+
34
+ - id: "server.router_extension"
35
+ target: "src/server.py"
36
+ position: "after:app.include_router"
37
+ description: "Append business capability FastAPI sub-routers"
38
+
39
+ - id: "modality.channel_resolver"
40
+ target: "src/modality.py"
41
+ position: "replace:resolve_input_channel"
42
+ description: "Override default channel selection strategy, e.g. disable voice input in e-commerce scenarios"
43
+
44
+ # ---------------------------------------------------------------------------
45
+ # Configuration interface
46
+ # ---------------------------------------------------------------------------
47
+ config:
48
+ credentials:
49
+ - key: "TENCENT_CLOUD_SECRET_ID"
50
+ required: true
51
+ description: "Tencent Cloud API SecretId (Key 1)"
52
+ - key: "TENCENT_CLOUD_SECRET_KEY"
53
+ required: true
54
+ description: "Tencent Cloud API SecretKey (Key 1)"
55
+ - key: "TENCENT_CLOUD_REGION"
56
+ required: false
57
+ default: "ap-guangzhou"
58
+ description: "Tencent Cloud API region"
59
+ - key: "TRTC_SDK_APP_ID"
60
+ required: true
61
+ description: "TRTC Conversational AI application SDKAppID (Key 2)"
62
+ - key: "TRTC_SDK_SECRET_KEY"
63
+ required: true
64
+ description: "TRTC Conversational AI application SDKSecretKey (Key 2)"
65
+ - key: "LLM_API_KEY"
66
+ required: true
67
+ description: "External LLM access key (Key 3)"
68
+ - key: "LLM_API_URL"
69
+ required: false
70
+ default: "https://api.openai.com/v1/chat/completions"
71
+ description: "OpenAI-compatible protocol endpoint"
72
+ - key: "LLM_MODEL"
73
+ required: false
74
+ default: "gpt-4o-mini"
75
+ description: "Default LLM model name"
76
+
77
+ io_modality:
78
+ voice_input:
79
+ enabled: true
80
+ provider: "trtc-asr"
81
+ fallback: "text_input"
82
+ timeout_ms: 5000
83
+ text_input:
84
+ enabled: true
85
+ provider: null
86
+ fallback: null
87
+ timeout_ms: 0
88
+ voice_output:
89
+ enabled: true
90
+ provider: "trtc-tts"
91
+ fallback: "text_output"
92
+ timeout_ms: 3000
93
+ text_output:
94
+ enabled: true
95
+ provider: null
96
+ fallback: null
97
+ timeout_ms: 0
98
+
99
+ # ---------------------------------------------------------------------------
100
+ # Exposed API endpoints
101
+ # ---------------------------------------------------------------------------
102
+ endpoints:
103
+ - method: GET
104
+ path: /api/v1/health
105
+ description: Real-time connectivity self-check for 3 keys (Web Demo status bar data source)
106
+ - method: POST
107
+ path: /api/v1/get_config
108
+ description: Issue room number / UserSig / modality configuration
109
+ - method: POST
110
+ path: /api/v1/agent/start
111
+ description: Start AI channel bot (StartAIConversation)
112
+ - method: POST
113
+ path: /api/v1/agent/stop
114
+ description: Stop AI channel bot (StopAIConversation)
115
+ - method: POST
116
+ path: /api/v1/agent/control
117
+ description: Text injection / interruption (ControlAIConversation/ServerPushText)
118
+ - method: GET
119
+ path: /api/v1/sessions
120
+ description: In-memory session list (debugging only)
121
+
122
+ # ---------------------------------------------------------------------------
123
+ # Tech stack integration rules
124
+ # ---------------------------------------------------------------------------
125
+ integration:
126
+ mode: "auto"
127
+ auto_adapters:
128
+ - tech_stack: ["react", "vue", "angular"]
129
+ adapter: "frontend-spa"
130
+ description: "Frontend SPA adapter, generates join-room component and embeds web-demo to call skeleton API"
131
+ - tech_stack: ["express", "koa", "fastify", "next"]
132
+ adapter: "node-backend"
133
+ description: "Node.js backend adapter, generates proxy routes forwarding to skeleton /api/v1/*"
134
+ - tech_stack: ["spring-boot", "quarkus"]
135
+ adapter: "java-backend"
136
+ description: "Java backend adapter, generates Filter forwarding to skeleton"
137
+ - tech_stack: ["flask", "fastapi", "django"]
138
+ adapter: "python-backend"
139
+ description: "Python backend adapter, generates decorators or sub-app mounting"
140
+ fallback:
141
+ guided_templates:
142
+ - "integration-templates/generic-frontend.md"
143
+ - "integration-templates/generic-backend.md"
144
+ manual_api:
145
+ rest_endpoint: "/api/v1"
146
+ sdk_packages:
147
+ - npm: "@trtc/voice-agent-sdk"
148
+ - maven: "com.tencent.trtc:voice-agent-sdk"
149
+ - pypi: "trtc-voice-agent"
150
+
151
+ # ---------------------------------------------------------------------------
152
+ # Business contract (Phase 3; follows references/business-contract-spec.md v1.0)
153
+ # Note: This is a skeleton capability; source code is not refactored in this phase;
154
+ # only declares the external contract for contract-adapt.py consumption.
155
+ # port_class / default_adapter fields remain null, to be filled in Phase 4 refactor.
156
+ # ---------------------------------------------------------------------------
157
+ business_contract:
158
+ port_class: null
159
+ default_adapter: null
160
+ mock_adapter: null
161
+ customization_sop: "INTERFACE_ADAPT.md"
162
+ external_apis:
163
+ # LLM: OpenAI-compatible protocol is the default contract; can be replaced with Claude / Qwen / DeepSeek etc.
164
+ - name: llm.chat_completions
165
+ direction: outbound
166
+ method: POST
167
+ path: /v1/chat/completions
168
+ description: "Call external LLM for text response (OpenAI Chat Completions compatible protocol)"
169
+ request_schema:
170
+ model: string
171
+ messages:
172
+ - role: enum[system, user, assistant, tool]
173
+ content: string
174
+ temperature: float
175
+ max_tokens: int
176
+ stream: bool
177
+ response_schema:
178
+ choices:
179
+ - message:
180
+ role: string
181
+ content: string
182
+ finish_reason: string
183
+ usage:
184
+ prompt_tokens: int
185
+ completion_tokens: int
186
+ adapter_slots:
187
+ - request.model
188
+ - request.messages
189
+ - response.choices
190
+ auth:
191
+ type: bearer
192
+ location: header
193
+ name: Authorization
194
+ timeout_ms: 30000
195
+
196
+ # Tencent Cloud TRTC Conversational AI (control plane): StartAIConversation etc.
197
+ # Unlike LLM, the TRTC control plane contract is not adaptable (tightly bound to Tencent Cloud);
198
+ # declared here only for assembly-phase awareness
199
+ - name: trtc.start_ai_conversation
200
+ direction: outbound
201
+ method: POST
202
+ path: "tencentcloudapi.com/?Action=StartAIConversation"
203
+ description: "Tencent Cloud TRTC control plane: launch AI conversation (tightly bound to Tencent Cloud protocol, not adaptable)"
204
+ request_schema:
205
+ SdkAppId: int
206
+ RoomId: string
207
+ AgentConfig: object
208
+ STTConfig: object
209
+ LLMConfig: object
210
+ TTSConfig: object
211
+ response_schema:
212
+ TaskId: string
213
+ SessionId: string
214
+ adapter_slots: [] # No remapping allowed
215
+ timeout_ms: 10000
216
+
217
+ # ---------------------------------------------------------------------------
218
+ # Security declarations (P0 mitigations in place)
219
+ # ---------------------------------------------------------------------------
220
+ security:
221
+ log_redaction:
222
+ enabled: true
223
+ patterns:
224
+ - "secret_id"
225
+ - "secret_key"
226
+ - "api_key"
227
+ - "app_key"
228
+ - "token"
229
+ - "usersig"
230
+ - "credential"
231
+ - "authorization"
232
+ injection_protection:
233
+ xss_guard: true
234
+ prompt_injection_guard: true
235
+ credential_storage:
236
+ source: "env-only" # Credentials only from environment variables
237
+ cache_file: ".credentials_cache"
238
+ cache_permission: "0600"
239
+ env_file_permission: "0600"
240
+ network:
241
+ enforce_https: true # End-to-end HTTPS
242
+
243
+ # ---------------------------------------------------------------------------
244
+ # Acceptance criteria (aligned with dev guide §11.1)
245
+ # ---------------------------------------------------------------------------
246
+ acceptance:
247
+ - "ASR/LLM/TTS pipeline has no hard-coded business logic"
248
+ - "3-key connectivity self-check executed immediately upon input"
249
+ - "Web Demo top status bar: all 3 indicator LEDs green"
250
+ - "Credential cache file permissions set to 600; no plain-text keys in logs"
@@ -0,0 +1,6 @@
1
+ fastapi>=0.110.0
2
+ uvicorn[standard]>=0.27.0
3
+ pydantic>=2.5.0
4
+ python-dotenv>=1.0.0
5
+ requests>=2.31.0
6
+ PyYAML>=6.0