@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,347 @@
1
+ /* =====================================================================
2
+ * Ticket Agent Board — Frontend Logic
3
+ * Backend contract: capabilities/human-handoff/manifest.yaml.endpoints
4
+ * GET /api/v1/handoff/admin/tickets[?status=&limit=] Ticket list
5
+ * GET /api/v1/handoff/admin/tickets/{ticket_id} Ticket detail
6
+ * POST /api/v1/handoff/admin/tickets/{ticket_id}/status Status update
7
+ * GET /api/v1/handoff/status Overall queue status
8
+ * POST /api/v1/handoff/request Manually submit a test ticket
9
+ * ===================================================================== */
10
+
11
+ (function () {
12
+ "use strict";
13
+
14
+ /* ---------- DOM ---------- */
15
+ const tbody = document.getElementById("ticket-rows");
16
+ const summary = document.getElementById("list-summary");
17
+ const filterList = document.getElementById("filter-list");
18
+ const drawer = document.getElementById("drawer");
19
+ const drawerBody = document.getElementById("drawer-body");
20
+ const btnCloseDrawer = document.getElementById("btn-close-drawer");
21
+ const btnRefresh = document.getElementById("btn-refresh");
22
+ const chkAuto = document.getElementById("chk-auto");
23
+ const btnSeed = document.getElementById("btn-seed");
24
+ const metricAgents = document.querySelector('[data-role="metric-agents"]');
25
+ const metricWaiting = document.querySelector('[data-role="metric-waiting"]');
26
+ const metricConnected = document.querySelector('[data-role="metric-connected"]');
27
+
28
+ const state = {
29
+ statusFilter: "",
30
+ list: [],
31
+ selectedId: null,
32
+ autoTimer: null,
33
+ };
34
+
35
+ const STATUS_LABEL = {
36
+ pending: "Pending",
37
+ processing: "In progress",
38
+ closed: "Closed",
39
+ canceled: "Canceled",
40
+ timeout: "Timeout",
41
+ };
42
+
43
+ const PRIORITY_LABEL = {
44
+ low: "Low",
45
+ normal: "Normal",
46
+ high: "High",
47
+ urgent: "Urgent",
48
+ };
49
+
50
+ /* ---------- Utilities ---------- */
51
+ function fmtTs(ts) {
52
+ if (!ts && ts !== 0) return "--";
53
+ const ms = ts < 1e12 ? ts * 1000 : ts; // compatible with epoch (seconds/milliseconds)
54
+ const d = new Date(ms);
55
+ if (Number.isNaN(d.getTime())) return "--";
56
+ const pad = (n) => String(n).padStart(2, "0");
57
+ return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
58
+ }
59
+
60
+ function escapeHtml(s) {
61
+ return String(s).replace(/[&<>"']/g, (c) => ({
62
+ "&": "&amp;",
63
+ "<": "&lt;",
64
+ ">": "&gt;",
65
+ '"': "&quot;",
66
+ "'": "&#39;",
67
+ }[c]));
68
+ }
69
+
70
+ function showToast(text, tone) {
71
+ let el = document.querySelector(".toast");
72
+ if (!el) {
73
+ el = document.createElement("div");
74
+ el.className = "toast";
75
+ document.body.appendChild(el);
76
+ }
77
+ el.textContent = text;
78
+ el.setAttribute("data-tone", tone || "");
79
+ el.classList.add("is-visible");
80
+ clearTimeout(el._timer);
81
+ el._timer = setTimeout(() => el.classList.remove("is-visible"), 2400);
82
+ }
83
+
84
+ /* ---------- Network ---------- */
85
+ async function api(path, opts) {
86
+ const init = Object.assign({ credentials: "same-origin" }, opts || {});
87
+ if (init.body && typeof init.body !== "string") {
88
+ init.body = JSON.stringify(init.body);
89
+ init.headers = Object.assign({ "Content-Type": "application/json" }, init.headers || {});
90
+ }
91
+ const resp = await fetch(path, init);
92
+ if (!resp.ok) {
93
+ let detail = `${resp.status} ${resp.statusText}`;
94
+ try {
95
+ const j = await resp.json();
96
+ if (j && j.detail) detail = j.detail;
97
+ } catch (e) { /* swallow */ }
98
+ throw new Error(detail);
99
+ }
100
+ return resp.json();
101
+ }
102
+
103
+ async function fetchOverall() {
104
+ try {
105
+ const body = await api("/api/v1/handoff/status");
106
+ const d = body.data || body;
107
+ metricAgents.textContent = d.available_agents != null ? d.available_agents : (d.agent_pool_size ?? "--");
108
+ metricWaiting.textContent = d.waiting ?? "--";
109
+ metricConnected.textContent = d.connected ?? "--";
110
+ } catch (err) {
111
+ console.warn("overall status failed", err);
112
+ }
113
+ }
114
+
115
+ async function fetchList() {
116
+ const url = new URL("/api/v1/handoff/admin/tickets", location.origin);
117
+ url.searchParams.set("limit", "100");
118
+ if (state.statusFilter) url.searchParams.set("status", state.statusFilter);
119
+ try {
120
+ const body = await api(url.pathname + url.search);
121
+ const data = body.data || body;
122
+ state.list = (data.items || []).slice();
123
+ renderList();
124
+ summary.textContent = `${state.list.length} ticket(s) · ${state.statusFilter ? STATUS_LABEL[state.statusFilter] : "All"}`;
125
+ } catch (err) {
126
+ tbody.innerHTML = `<tr class="empty-row"><td colspan="7">Failed to load: ${escapeHtml(err.message || err)}</td></tr>`;
127
+ summary.textContent = "Failed to load";
128
+ }
129
+ }
130
+
131
+ /* ---------- Rendering ---------- */
132
+ function renderList() {
133
+ if (!state.list.length) {
134
+ tbody.innerHTML = '<tr class="empty-row"><td colspan="7">No tickets yet. Click "Insert test ticket" on the left to create one.</td></tr>';
135
+ return;
136
+ }
137
+ const html = state.list.map((t) => renderRow(t)).join("");
138
+ tbody.innerHTML = html;
139
+
140
+ Array.from(tbody.querySelectorAll("tr[data-ticket-id]")).forEach((tr) => {
141
+ tr.addEventListener("click", (ev) => {
142
+ if (ev.target.closest(".row-actions")) return;
143
+ openDrawer(tr.getAttribute("data-ticket-id"));
144
+ });
145
+ });
146
+ Array.from(tbody.querySelectorAll("[data-action]")).forEach((btn) => {
147
+ btn.addEventListener("click", async (ev) => {
148
+ ev.stopPropagation();
149
+ const id = btn.getAttribute("data-ticket-id");
150
+ const action = btn.getAttribute("data-action");
151
+ await onActionClick(id, action);
152
+ });
153
+ });
154
+ }
155
+
156
+ function renderRow(t) {
157
+ const subj = t.subject || t.reason || "(empty)";
158
+ const sel = state.selectedId === t.ticket_id ? " is-selected" : "";
159
+ const priority = t.priority || "normal";
160
+ const status = t.status || "pending";
161
+
162
+ let actions = "";
163
+ if (status === "pending") {
164
+ actions = `
165
+ <button class="btn btn--accent btn--small" data-action="processing" data-ticket-id="${escapeHtml(t.ticket_id)}">Connect</button>
166
+ <button class="btn btn--ghost btn--small btn--danger" data-action="canceled" data-ticket-id="${escapeHtml(t.ticket_id)}">Cancel</button>
167
+ `;
168
+ } else if (status === "processing") {
169
+ actions = `
170
+ <button class="btn btn--ghost btn--small" data-action="closed" data-ticket-id="${escapeHtml(t.ticket_id)}">Close ticket</button>
171
+ `;
172
+ } else {
173
+ actions = '<span style="color: var(--color-text-tertiary); font-size: 12px;">Resolved</span>';
174
+ }
175
+
176
+ return `
177
+ <tr data-ticket-id="${escapeHtml(t.ticket_id)}" class="${sel}">
178
+ <td><span class="ticket-id">${escapeHtml(t.ticket_id)}</span></td>
179
+ <td>${escapeHtml(t.user_id || "--")}</td>
180
+ <td>${escapeHtml(subj)}</td>
181
+ <td><span class="priority" data-level="${escapeHtml(priority)}">${escapeHtml(PRIORITY_LABEL[priority] || priority)}</span></td>
182
+ <td><span class="status-pill" data-status="${escapeHtml(status)}">${escapeHtml(STATUS_LABEL[status] || status)}</span></td>
183
+ <td>${escapeHtml(fmtTs(t.created_at))}</td>
184
+ <td class="ticket-table__col-actions"><div class="row-actions">${actions}</div></td>
185
+ </tr>
186
+ `;
187
+ }
188
+
189
+ function renderDetail(t) {
190
+ if (!t) {
191
+ drawerBody.innerHTML = '<p class="drawer__placeholder">Ticket not found.</p>';
192
+ return;
193
+ }
194
+ const tx = (t.transcript || []).map((line) => `· ${line}`).join("\n");
195
+ let actions = "";
196
+ if (t.status === "pending") {
197
+ actions = `
198
+ <button class="btn btn--accent btn--small" data-detail-action="processing" data-ticket-id="${escapeHtml(t.ticket_id)}">Connect ticket</button>
199
+ <button class="btn btn--ghost btn--small btn--danger" data-detail-action="canceled" data-ticket-id="${escapeHtml(t.ticket_id)}">Cancel ticket</button>
200
+ `;
201
+ } else if (t.status === "processing") {
202
+ actions = `
203
+ <button class="btn btn--ghost btn--small" data-detail-action="closed" data-ticket-id="${escapeHtml(t.ticket_id)}">Close ticket</button>
204
+ `;
205
+ }
206
+ drawerBody.innerHTML = `
207
+ <dl class="detail-grid">
208
+ <dt>ID</dt><dd><span class="ticket-id">${escapeHtml(t.ticket_id)}</span></dd>
209
+ <dt>User</dt><dd>${escapeHtml(t.user_id || "--")}</dd>
210
+ <dt>Subject</dt><dd>${escapeHtml(t.subject || "(empty)")}</dd>
211
+ <dt>Priority</dt><dd><span class="priority" data-level="${escapeHtml(t.priority || "normal")}">${escapeHtml(PRIORITY_LABEL[t.priority] || t.priority || "Normal")}</span></dd>
212
+ <dt>Status</dt><dd><span class="status-pill" data-status="${escapeHtml(t.status)}">${escapeHtml(STATUS_LABEL[t.status] || t.status)}</span></dd>
213
+ <dt>Agent</dt><dd>${escapeHtml(t.agent_id || "--")}</dd>
214
+ <dt>Created</dt><dd>${escapeHtml(fmtTs(t.created_at))}</dd>
215
+ <dt>Updated</dt><dd>${escapeHtml(fmtTs(t.updated_at))}</dd>
216
+ ${t.closed_at ? `<dt>Closed</dt><dd>${escapeHtml(fmtTs(t.closed_at))}</dd>` : ""}
217
+ </dl>
218
+ <p class="drawer__placeholder" style="font-style:normal;">Conversation summary</p>
219
+ <div class="transcript">${escapeHtml(t.description || t.reason || "(none)")}</div>
220
+ ${tx ? `
221
+ <p class="transcript__title">Conversation transcript</p>
222
+ <div class="transcript">${escapeHtml(tx)}</div>
223
+ ` : ""}
224
+ ${t.feedback ? renderFeedbackBlock(t.feedback) : ""}
225
+ ${actions ? `<div class="action-row">${actions}</div>` : ""}
226
+ `;
227
+
228
+ Array.from(drawerBody.querySelectorAll("[data-detail-action]")).forEach((btn) => {
229
+ btn.addEventListener("click", async () => {
230
+ const id = btn.getAttribute("data-ticket-id");
231
+ const action = btn.getAttribute("data-detail-action");
232
+ await onActionClick(id, action);
233
+ });
234
+ });
235
+ }
236
+
237
+ /* ---------- Customer satisfaction feedback (issue 6) ---------- */
238
+ function renderFeedbackBlock(fb) {
239
+ const rating = Math.max(0, Math.min(5, parseInt(fb.rating, 10) || 0));
240
+ const stars = "\u2605".repeat(rating) + "\u2606".repeat(5 - rating);
241
+ const comment = fb.comment && String(fb.comment).trim();
242
+ return `
243
+ <div class="feedback-block">
244
+ <p class="transcript__title">Customer feedback</p>
245
+ <div class="feedback-body">
246
+ <div class="feedback-rating">
247
+ <span class="feedback-stars">${stars}</span>
248
+ <span class="feedback-score">${rating}/5</span>
249
+ </div>
250
+ <div class="feedback-comment${comment ? "" : " feedback-empty"}">${comment ? escapeHtml(comment) : "No written comment"}</div>
251
+ </div>
252
+ </div>`;
253
+ }
254
+
255
+ function openDrawer(ticketId) {
256
+ state.selectedId = ticketId;
257
+ drawer.hidden = false;
258
+ drawer.setAttribute("aria-hidden", "false");
259
+ const t = state.list.find((x) => x.ticket_id === ticketId);
260
+ if (t) renderDetail(t);
261
+ else {
262
+ // Fetch single detail (fallback when list pagination misses it)
263
+ api(`/api/v1/handoff/admin/tickets/${encodeURIComponent(ticketId)}`)
264
+ .then((b) => renderDetail(b.data || b))
265
+ .catch(() => renderDetail(null));
266
+ }
267
+ Array.from(tbody.querySelectorAll("tr")).forEach((tr) =>
268
+ tr.classList.toggle("is-selected", tr.getAttribute("data-ticket-id") === ticketId),
269
+ );
270
+ }
271
+ function closeDrawer() {
272
+ drawer.hidden = true;
273
+ drawer.setAttribute("aria-hidden", "true");
274
+ state.selectedId = null;
275
+ Array.from(tbody.querySelectorAll("tr")).forEach((tr) => tr.classList.remove("is-selected"));
276
+ }
277
+ btnCloseDrawer.addEventListener("click", closeDrawer);
278
+
279
+ /* ---------- Status transitions ---------- */
280
+ async function onActionClick(ticketId, status) {
281
+ const body = { status };
282
+ if (status === "processing") body.agent_id = "agent_demo_001";
283
+ try {
284
+ await api(`/api/v1/handoff/admin/tickets/${encodeURIComponent(ticketId)}/status`, {
285
+ method: "POST",
286
+ body,
287
+ });
288
+ showToast(`Ticket ${ticketId.slice(0, 12)} → ${STATUS_LABEL[status] || status}`, "success");
289
+ } catch (err) {
290
+ showToast(`Status change failed: ${err.message || err}`, "error");
291
+ }
292
+ await Promise.all([fetchList(), fetchOverall()]);
293
+ if (state.selectedId === ticketId) {
294
+ const t = state.list.find((x) => x.ticket_id === ticketId);
295
+ renderDetail(t);
296
+ }
297
+ }
298
+
299
+ /* ---------- Filters ---------- */
300
+ filterList.addEventListener("click", async (ev) => {
301
+ const btn = ev.target.closest(".filter-item");
302
+ if (!btn) return;
303
+ const status = btn.getAttribute("data-status");
304
+ if (status === null) return;
305
+ state.statusFilter = status;
306
+ Array.from(filterList.querySelectorAll(".filter-item")).forEach((b) =>
307
+ b.classList.toggle("is-active", b === btn),
308
+ );
309
+ await fetchList();
310
+ });
311
+
312
+ /* ---------- Refresh ---------- */
313
+ async function refreshAll() {
314
+ await Promise.all([fetchOverall(), fetchList()]);
315
+ }
316
+ btnRefresh.addEventListener("click", refreshAll);
317
+
318
+ function setupAutoRefresh() {
319
+ if (state.autoTimer) {
320
+ clearInterval(state.autoTimer);
321
+ state.autoTimer = null;
322
+ }
323
+ if (chkAuto.checked) {
324
+ state.autoTimer = setInterval(refreshAll, 5000);
325
+ }
326
+ }
327
+ chkAuto.addEventListener("change", setupAutoRefresh);
328
+
329
+ /* ---------- Test ticket (dev only) ---------- */
330
+ btnSeed.addEventListener("click", async () => {
331
+ const fakeId = "demo_seed_" + Math.random().toString(36).slice(2, 8);
332
+ try {
333
+ await api("/api/v1/handoff/request", {
334
+ method: "POST",
335
+ body: { session_id: fakeId, reason: "Manually inserted test ticket from board" },
336
+ });
337
+ showToast("Test ticket inserted", "success");
338
+ } catch (err) {
339
+ showToast(`Insert failed: ${err.message || err}`, "error");
340
+ }
341
+ await refreshAll();
342
+ });
343
+
344
+ /* ---------- Init ---------- */
345
+ refreshAll();
346
+ setupAutoRefresh();
347
+ })();
@@ -0,0 +1,125 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
6
+ <title>Agent Ticket Board</title>
7
+ <!-- Mounted under /static/admin/* via conversation-core StaticFiles -->
8
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
9
+ <link rel="stylesheet" href="tokens.css" />
10
+ <link rel="stylesheet" href="styles.css" />
11
+ </head>
12
+ <body>
13
+ <header class="topbar">
14
+ <div class="topbar__inner">
15
+ <div class="brand-mark">
16
+ <span class="brand-mark__logo" aria-hidden="true"></span>
17
+ <span class="brand-mark__name">Agent Ticket Board</span>
18
+ <span class="brand-mark__tag">demo</span>
19
+ </div>
20
+ <div class="topbar__meta">
21
+ <div class="metric" data-key="overall">
22
+ <span class="metric__label">Active agents</span>
23
+ <span class="metric__value" data-role="metric-agents">--</span>
24
+ </div>
25
+ <div class="metric" data-key="waiting">
26
+ <span class="metric__label">Waiting</span>
27
+ <span class="metric__value" data-role="metric-waiting">--</span>
28
+ </div>
29
+ <div class="metric" data-key="connected">
30
+ <span class="metric__label">In progress</span>
31
+ <span class="metric__value" data-role="metric-connected">--</span>
32
+ </div>
33
+ <button class="btn btn--ghost btn--small" type="button" id="btn-refresh">Refresh</button>
34
+ <label class="auto-toggle">
35
+ <input type="checkbox" id="chk-auto" checked />
36
+ <span>Auto refresh</span>
37
+ </label>
38
+ </div>
39
+ </div>
40
+ </header>
41
+
42
+ <main class="layout">
43
+ <!-- Left filter rail -->
44
+ <aside class="filter-rail">
45
+ <h2 class="filter-rail__title">Filter</h2>
46
+ <ul class="filter-list" id="filter-list">
47
+ <li><button class="filter-item is-active" data-status="" type="button">All</button></li>
48
+ <li><button class="filter-item" data-status="pending" type="button">
49
+ <span class="badge badge--warning"></span>Pending
50
+ </button></li>
51
+ <li><button class="filter-item" data-status="processing" type="button">
52
+ <span class="badge badge--info"></span>In progress
53
+ </button></li>
54
+ <li><button class="filter-item" data-status="closed" type="button">
55
+ <span class="badge badge--success"></span>Closed
56
+ </button></li>
57
+ <li><button class="filter-item" data-status="canceled" type="button">
58
+ <span class="badge badge--error"></span>Canceled
59
+ </button></li>
60
+ <li><button class="filter-item" data-status="timeout" type="button">
61
+ <span class="badge badge--error"></span>Timeout
62
+ </button></li>
63
+ </ul>
64
+
65
+ <h2 class="filter-rail__title">Tools</h2>
66
+ <ul class="filter-list">
67
+ <li>
68
+ <button class="filter-item" id="btn-seed" type="button">
69
+ <svg class="icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14"/><path d="M5 12h14"/></svg>
70
+ <span>Insert test ticket</span>
71
+ </button>
72
+ </li>
73
+ <li><a class="filter-item" href="/" target="_blank" rel="noopener">
74
+ <svg class="icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
75
+ <span>Customer widget</span>
76
+ </a></li>
77
+ </ul>
78
+ </aside>
79
+
80
+ <!-- Ticket table + detail drawer -->
81
+ <section class="content">
82
+ <div class="content__head">
83
+ <h1 class="content__title">Tickets</h1>
84
+ <p class="content__sub" id="list-summary">--</p>
85
+ </div>
86
+
87
+ <div class="table-wrap">
88
+ <table class="ticket-table" id="ticket-table">
89
+ <thead>
90
+ <tr>
91
+ <th>ID</th>
92
+ <th>User</th>
93
+ <th>Subject</th>
94
+ <th>Priority</th>
95
+ <th>Status</th>
96
+ <th>Created</th>
97
+ <th class="ticket-table__col-actions">Actions</th>
98
+ </tr>
99
+ </thead>
100
+ <tbody id="ticket-rows">
101
+ <tr class="empty-row" data-role="empty-row">
102
+ <td colspan="7">Loading…</td>
103
+ </tr>
104
+ </tbody>
105
+ </table>
106
+ </div>
107
+ </section>
108
+
109
+ <!-- Detail drawer -->
110
+ <aside class="drawer" id="drawer" aria-hidden="true" hidden>
111
+ <header class="drawer__head">
112
+ <h2 class="drawer__title">Ticket details</h2>
113
+ <button class="icon-btn" type="button" id="btn-close-drawer" aria-label="Close">
114
+ <svg class="icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
115
+ </button>
116
+ </header>
117
+ <div class="drawer__body" id="drawer-body">
118
+ <p class="drawer__placeholder">Select a ticket on the left to view details.</p>
119
+ </div>
120
+ </aside>
121
+ </main>
122
+
123
+ <script src="app.js" defer></script>
124
+ </body>
125
+ </html>