@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
package/bin/cli.js CHANGED
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * @tencent-rtc/trtc-agent-skills installer
7
7
  *
8
- * Installs the TRTC AI Integration skill suite (6 cross-referencing skills:
9
- * trtc + trtc-onboarding/docs/topic/search/apply) plus the shared
10
- * knowledge-base into your IDE's skills directory, and wires up the
8
+ * Installs the TRTC AI Integration skill suite (cross-referencing skills:
9
+ * trtc + trtc-onboarding/docs/topic/search/apply + trtc-ai-service) plus the
10
+ * shared knowledge-base into your IDE's skills directory, and wires up the
11
11
  * `tencent-rtc-skill-tool` MCP server (used for prompt / runtime telemetry).
12
12
  *
13
13
  * IMPORTANT — why skills are copied as SIBLING DIRECTORIES:
@@ -50,15 +50,32 @@ const SKILLS_SRC = path.join(PKG_ROOT, "skills");
50
50
  const KB_SRC = path.join(PKG_ROOT, "knowledge-base");
51
51
  const HOOKS_SRC = path.join(PKG_ROOT, "hooks");
52
52
 
53
- // The 6 skills that make up the suite. Order is cosmetic; `trtc` is the entry.
54
- const SKILL_NAMES = [
53
+ // Dynamically discover all skills under SKILLS_SRC. Each skill must be a
54
+ // directory containing a SKILL.md entry point. `trtc` is always listed first;
55
+ // the rest are sorted alphabetically. This avoids the stale-hardcoded-list
56
+ // problem — adding a new skill directory is enough to get it installed.
57
+ //
58
+ // Security: only skills in SKILL_ALLOWLIST are installed. This prevents
59
+ // draft / fork / debug directories from being silently picked up.
60
+ const SKILL_ALLOWLIST = new Set([
55
61
  "trtc",
56
- "trtc-onboarding",
57
62
  "trtc-docs",
58
- "trtc-topic",
59
- "trtc-search",
60
- "trtc-apply",
61
- ];
63
+ "trtc-conference",
64
+ "trtc-ai-service",
65
+ ]);
66
+
67
+ function getSkillNames() {
68
+ return fs.readdirSync(SKILLS_SRC, { withFileTypes: true })
69
+ .filter(entry => entry.isDirectory())
70
+ .map(entry => entry.name)
71
+ .filter(name => SKILL_ALLOWLIST.has(name))
72
+ .filter(name => fs.existsSync(path.join(SKILLS_SRC, name, "SKILL.md")))
73
+ .sort((a, b) => {
74
+ if (a === "trtc") return -1;
75
+ if (b === "trtc") return 1;
76
+ return a.localeCompare(b);
77
+ });
78
+ }
62
79
 
63
80
  // IDE skill-install targets (project-level). Each IDE reads skills from a
64
81
  // different directory, but the layout inside is identical: one dir per skill.
@@ -94,9 +111,9 @@ const MCP_SERVER_ENTRY = "@tencent-rtc/skill-tool@latest";
94
111
  // The original hooks.json uses ${CLAUDE_PLUGIN_ROOT} / ${CODEBUDDY_PLUGIN_ROOT}
95
112
  // placeholders that get expanded by the IDE in plugin mode; in npx mode we
96
113
  // materialize them to absolute paths under the IDE's settings dir.
97
- // cursor: hooks-cursor.json is rewritten + merged into ~/.cursor/hooks.json
98
- // (USER-LEVEL — Cursor doesn't load project-level hooks). The
99
- // cursor-adapter.py is copied to <root>/.cursor/hooks/ and its hardcoded
114
+ // cursor: hooks-cursor.json is rewritten + merged into <root>/.cursor/hooks.json
115
+ // (project-level). cursor-adapter.py is copied to
116
+ // <root>/.cursor/hooks/trtc-agent-skills/ and its hardcoded
100
117
  // $HOME/.cursor/plugins/local/... reference is rewritten to the actual path.
101
118
  const HOOKS_TARGETS = {
102
119
  claude: {
@@ -119,22 +136,64 @@ const HOOKS_TARGETS = {
119
136
  hooksDir: ".codex/hooks",
120
137
  // Codex loads hooks from <repo>/.codex/hooks.json (or ~/.codex/hooks.json)
121
138
  // — NOT from .agents/settings.json. See https://developers.openai.com/codex/hooks
139
+ //
140
+ // Codex CLI ≥0.135 parses hooks.json with a strict serde schema that rejects
141
+ // unknown top-level fields ("unknown field `__trtc_agent_skills__`, expected
142
+ // `hooks`"). We therefore mark codex as `strictSchema: true` so the merge
143
+ // logic skips the marker injection (uninstall identifies our entries by
144
+ // hook command path substrings instead — see OWNED_COMMAND_HINTS).
122
145
  settingsFile: ".codex/hooks.json",
123
146
  sourceConfig: "hooks.json",
124
147
  rootPlaceholder: "${CLAUDE_PLUGIN_ROOT}",
125
148
  rootRewrite: ".codex",
126
149
  fallbackPlaceholder: "${CODEBUDDY_PLUGIN_ROOT}",
150
+ strictSchema: true,
127
151
  },
128
152
  cursor: {
129
- hooksDir: ".cursor/hooks",
130
- // user-level Cursor only loads ~/.cursor/hooks.json, not project-level.
131
- settingsFile: path.join(os.homedir(), ".cursor", "hooks.json"),
153
+ // Namespace under .cursor/hooks/trtc-agent-skills/ so we never collide
154
+ // with another skill's hooks/ contents. cursor-adapter.py auto-detects
155
+ // PLUGIN_ROOT by walking up to the nearest dir containing skills/, so
156
+ // this nested location still resolves correctly.
157
+ hooksDir: ".cursor/hooks/trtc-agent-skills",
158
+ hooksFiles: ["cursor-adapter.py"],
159
+ settingsFile: ".cursor/hooks.json",
132
160
  sourceConfig: "hooks-cursor.json",
133
161
  // The hardcoded path string we need to rewrite in hooks-cursor.json.
134
162
  cursorAdapterPlaceholder: "$HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py",
135
163
  },
136
164
  };
137
165
 
166
+ // For IDEs whose hook config schema rejects unknown fields (codex), we cannot
167
+ // embed our `__trtc_agent_skills__` ownership markers. Instead, uninstall
168
+ // detects "our" hook entries by checking whether any command string contains
169
+ // one of these path-segment hints — every guardrail script we ship lives under
170
+ // `skills/<skill>/hooks/` or `skills/<skill>/guardrails/`, and the cursor
171
+ // adapter under our namespaced hooks subdir.
172
+ const OWNED_COMMAND_HINTS = [
173
+ "/skills/trtc/hooks/",
174
+ "/skills/trtc/room-builder/guardrails/",
175
+ "/skills/trtc-topic/guardrails/",
176
+ "/skills/trtc-apply/guardrails/",
177
+ "/skills/trtc-conference/hooks/",
178
+ "/hooks/trtc-agent-skills/cursor-adapter.py",
179
+ ];
180
+
181
+ function isOwnedHookEntry(entry) {
182
+ if (!entry || typeof entry !== "object") return false;
183
+ if (entry.__trtc_agent_skills__) return true;
184
+ // Cursor-style: { command: "...", ... }
185
+ if (typeof entry.command === "string" && OWNED_COMMAND_HINTS.some(h => entry.command.includes(h))) {
186
+ return true;
187
+ }
188
+ // Claude/Codex-style: { matcher?, hooks: [{ command, ... }] }
189
+ if (Array.isArray(entry.hooks)) {
190
+ return entry.hooks.some(h => h && typeof h === "object"
191
+ && typeof h.command === "string"
192
+ && OWNED_COMMAND_HINTS.some(hint => h.command.includes(hint)));
193
+ }
194
+ return false;
195
+ }
196
+
138
197
  // AI instruction files distribution per IDE.
139
198
  // - root-md : project-root markdown files (CLAUDE.md / AGENTS.md / CODEBUDDY.md).
140
199
  // If the file already exists, our content is wrapped in HTML
@@ -290,13 +349,20 @@ function printHelp() {
290
349
  }
291
350
 
292
351
  function listSkills() {
352
+ const descriptions = {
353
+ "trtc": "Entry router — detects product/platform, routes to sub-skills",
354
+ "trtc-ai-service": "AI customer service scenarios (TRTC Conversational AI)",
355
+ "trtc-onboarding": "Get-started / integration / troubleshooting flow",
356
+ "trtc-docs": "Docs & error-code lookup",
357
+ "trtc-topic": "Step-by-step scenario walkthrough",
358
+ "trtc-search": "Internal slice lookup (AI-facing)",
359
+ "trtc-apply": "Internal compile/integration quality gate",
360
+ };
293
361
  console.log(`\n ${c.bold("Skills shipped in this package:")}\n`);
294
- console.log(` ${c.cyan("trtc/")} ${c.dim("Entry router detects product/platform, routes to sub-skills")}`);
295
- console.log(` ${c.cyan("trtc-onboarding/")} ${c.dim("Get-started / integration / troubleshooting flow")}`);
296
- console.log(` ${c.cyan("trtc-docs/")} ${c.dim("Docs & error-code lookup")}`);
297
- console.log(` ${c.cyan("trtc-topic/")} ${c.dim("Step-by-step scenario walkthrough")}`);
298
- console.log(` ${c.cyan("trtc-search/")} ${c.dim("Internal slice lookup (AI-facing)")}`);
299
- console.log(` ${c.cyan("trtc-apply/")} ${c.dim("Internal compile/integration quality gate")}`);
362
+ for (const name of getSkillNames()) {
363
+ const desc = descriptions[name] || "";
364
+ console.log(` ${c.cyan(name + "/")}` + (desc ? ` ${c.dim(desc)}` : ""));
365
+ }
300
366
  console.log("");
301
367
  }
302
368
 
@@ -304,7 +370,7 @@ function listSkills() {
304
370
  function cleanSkills(skillsRootAbs) {
305
371
  if (!fs.existsSync(skillsRootAbs)) return 0;
306
372
  let wiped = 0;
307
- for (const name of SKILL_NAMES) {
373
+ for (const name of getSkillNames()) {
308
374
  const target = path.join(skillsRootAbs, name);
309
375
  if (fs.existsSync(target)) { rmrf(target); wiped++; }
310
376
  }
@@ -345,9 +411,9 @@ function cleanAiInstructions(ideList, resolvedRoot) {
345
411
  }
346
412
  }
347
413
 
348
- // Strip our hook entries from each IDE's settings.json. We tag entries with
349
- // __trtc_agent_skills__ so we can filter precisely without disturbing the
350
- // user's own hook entries (relevant for cursor's user-level hooks.json).
414
+ // Strip our hook entries from each IDE's settings file. We tag entries with
415
+ // __trtc_agent_skills__ where the IDE schema allows (claude/codebuddy/cursor),
416
+ // and fall back to command-path matching for strict-schema IDEs (codex).
351
417
  function cleanHooksSettings(ideList, resolvedRoot) {
352
418
  for (const ide of ideList) {
353
419
  const target = HOOKS_TARGETS[ide];
@@ -369,23 +435,35 @@ function cleanHooksSettings(ideList, resolvedRoot) {
369
435
  for (const event of Object.keys(settings.hooks)) {
370
436
  const val = settings.hooks[event];
371
437
  if (Array.isArray(val)) {
372
- settings.hooks[event] = val.filter(e => !(e && typeof e === "object" && e.__trtc_agent_skills__));
438
+ settings.hooks[event] = val.filter(e => !isOwnedHookEntry(e));
373
439
  if (settings.hooks[event].length === 0) delete settings.hooks[event];
440
+ } else if (val && typeof val === "object" && Array.isArray(val.hooks)) {
441
+ // Some IDEs nest hooks under a single object per event instead of
442
+ // an array. Filter the inner hooks list.
443
+ val.hooks = val.hooks.filter(h => !isOwnedHookEntry(h));
444
+ if (val.hooks.length === 0) delete settings.hooks[event];
374
445
  } else {
375
- // Non-array (claude/codebuddy style) we own the whole event under our install.
376
- delete settings.hooks[event];
446
+ // Unknown shapeleave it alone rather than risk corrupting it.
377
447
  }
378
448
  }
379
449
  if (Object.keys(settings.hooks).length === 0) delete settings.hooks;
380
450
  }
381
451
 
452
+ // For strict-schema codex, if we cleared everything, remove the file so
453
+ // codex doesn't see a stale empty file.
454
+ const onlyHadOurState = !settings.hooks && Object.keys(settings).length === 0;
455
+ if (onlyHadOurState) {
456
+ rmrf(settingsPath);
457
+ continue;
458
+ }
459
+
382
460
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
383
461
  }
384
462
  }
385
463
 
386
464
  function installSkills(skillsRootAbs) {
387
465
  ensureDir(skillsRootAbs);
388
- for (const name of SKILL_NAMES) {
466
+ for (const name of getSkillNames()) {
389
467
  const src = path.join(SKILLS_SRC, name);
390
468
  if (fs.existsSync(src)) {
391
469
  copyRecursive(src, path.join(skillsRootAbs, name));
@@ -487,10 +565,16 @@ function mergeHooksConfig(target, resolvedRoot, ideAbsRoot) {
487
565
  const incomingHooks = parsed.hooks || {};
488
566
  if (!existing.hooks || typeof existing.hooks !== "object") existing.hooks = {};
489
567
 
490
- // Marker used inside user-level cursor hooks.json to identify our entries
491
- // when multiple projects install. Tagged on each individual hook entry so
492
- // a future uninstall can filter precisely.
568
+ // For strict-schema IDEs (codex) we MUST NOT embed any ownership marker —
569
+ // codex CLI ≥0.135 rejects the whole file with
570
+ // "unknown field `__trtc_agent_skills__`, expected `hooks`"
571
+ // and skips all hooks. Identify our entries on uninstall via command-path
572
+ // hints (see isOwnedHookEntry) instead.
573
+ const useMarker = !target.strictSchema;
574
+
575
+ // Marker to identify our entries so a future uninstall can filter precisely.
493
576
  const tagged = (entry) => {
577
+ if (!useMarker) return entry;
494
578
  if (entry && typeof entry === "object") {
495
579
  return Object.assign({}, entry, { __trtc_agent_skills__: true });
496
580
  }
@@ -501,24 +585,32 @@ function mergeHooksConfig(target, resolvedRoot, ideAbsRoot) {
501
585
  if (Array.isArray(eventValue)) {
502
586
  // Cursor format: hooks.<event> = [{command: ...}, ...]
503
587
  const stripped = (existing.hooks[eventName] || [])
504
- .filter(e => !(e && typeof e === "object" && e.__trtc_agent_skills__));
588
+ .filter(e => !isOwnedHookEntry(e));
505
589
  existing.hooks[eventName] = stripped.concat(eventValue.map(tagged));
506
590
  } else if (Array.isArray(existing.hooks[eventName])) {
507
591
  // existing is array (cursor-style), incoming is non-array (claude-style):
508
592
  // overwrite — this combination shouldn't happen in practice.
509
593
  existing.hooks[eventName] = eventValue;
510
594
  } else {
511
- // Claude/Codebuddy format: hooks.<event> = [{matcher, hooks: [...]}, ...]
512
- // The bundled hooks.json IS the only source for this key; just replace.
595
+ // Claude/Codebuddy/Codex format: hooks.<event> = [{matcher, hooks:[...]}, ...]
596
+ // For strict-schema codex, the bundled hooks.json IS the only source for
597
+ // this key and we own the file; just replace.
513
598
  existing.hooks[eventName] = eventValue;
514
599
  }
515
600
  }
516
601
 
517
602
  // Top-level marker so a future uninstall can detect our presence quickly.
518
- existing.__trtc_agent_skills__ = {
519
- version: PKG_VERSION,
520
- hookEvents: Object.keys(incomingHooks),
521
- };
603
+ // Skip for strict-schema IDEs (codex) — see useMarker above.
604
+ if (useMarker) {
605
+ existing.__trtc_agent_skills__ = {
606
+ version: PKG_VERSION,
607
+ hookEvents: Object.keys(incomingHooks),
608
+ };
609
+ } else if (existing.__trtc_agent_skills__) {
610
+ // Defensive: if a previous (buggy) install left this field behind, clean
611
+ // it up so codex doesn't keep failing schema validation.
612
+ delete existing.__trtc_agent_skills__;
613
+ }
522
614
 
523
615
  // Preserve / propagate top-level keys that the IDE expects (e.g. cursor
524
616
  // requires `"version": 1` at the root of ~/.cursor/hooks.json or it rejects
@@ -812,7 +904,7 @@ function main() {
812
904
  }
813
905
 
814
906
  installSkills(skillsRootAbs);
815
- for (const name of SKILL_NAMES) console.log(c.green(" ✓ ") + name + "/");
907
+ for (const name of getSkillNames()) console.log(c.green(" ✓ ") + name + "/");
816
908
 
817
909
  const kbDest = copyKnowledgeBase(skillsRootAbs);
818
910
  console.log(c.green(" ✓ ") + "knowledge-base/ " + c.dim("→ " + kbDest));
@@ -25,8 +25,8 @@ Cursor event mapping (see hooks-cursor.json):
25
25
  sessionStart -> trtc-prepare-ui
26
26
  beforeReadFile -> gate-slice-read
27
27
  preToolUse -> gate-slice-write (filtered to Write/Edit inside)
28
- afterFileEdit -> verify-ui-post-write, verify-slice-must
29
- stop -> stop-apply-evidence, trtc-verify-ui, verify-apply-project
28
+ afterFileEdit -> verify-ui-post-write
29
+ stop -> stop-apply-evidence, trtc-verify-ui
30
30
  (Claude Code's `Stop` event fires per agent loop
31
31
  iteration end. Cursor's `stop` event has the same
32
32
  semantic ("Called when the agent loop ends") and
@@ -42,10 +42,9 @@ Cursor event mapping (see hooks-cursor.json):
42
42
  firing. Empirically (Cursor 3.3.8) `stop` does
43
43
  fire reliably; the original "stop never fires"
44
44
  observation was caused by hooks not being loaded
45
- at all, not by the `stop` event itself. See
46
- install instructions in the README for the
47
- documented user-level `~/.cursor/hooks.json`
48
- install path — plugin-level hooks declared in
45
+ at all, not by the `stop` event itself. npx
46
+ installs to project-level `.cursor/hooks.json`;
47
+ plugin-level hooks declared in
49
48
  .cursor-plugin/plugin.json are NOT loaded by
50
49
  current Cursor versions.)
51
50
 
@@ -62,7 +61,24 @@ import sys
62
61
  from pathlib import Path
63
62
 
64
63
  ADAPTER_DIR = Path(__file__).resolve().parent
65
- PLUGIN_ROOT = ADAPTER_DIR.parent # plugin install root
64
+
65
+
66
+ def _find_plugin_root(start: Path) -> Path:
67
+ # Walk up until we find a directory that contains skills/. This makes the
68
+ # adapter location-independent: it works whether it lives at
69
+ # <plugin>/hooks/cursor-adapter.py (Cursor plugin install + the original
70
+ # npx layout) or under a namespaced subdir like
71
+ # <plugin>/hooks/trtc-agent-skills/cursor-adapter.py (current npx layout,
72
+ # chosen so multiple skill packages can co-exist under .cursor/hooks/).
73
+ # Falls back to the old `.parent` behaviour if no `skills/` is found, so
74
+ # we never regress an existing install.
75
+ for candidate in (start, *start.parents):
76
+ if (candidate / "skills").is_dir():
77
+ return candidate
78
+ return start.parent
79
+
80
+
81
+ PLUGIN_ROOT = _find_plugin_root(ADAPTER_DIR)
66
82
 
67
83
 
68
84
  # Optional debug logging — only writes when TRTC_HOOK_DEBUG_LOG is set to a
@@ -103,23 +119,20 @@ def _probe_log(key, payload) -> None:
103
119
 
104
120
  # Dispatch table: dispatch_key -> relative script path under PLUGIN_ROOT.
105
121
  DISPATCH = {
106
- "trtc-prepare-ui": "skills/trtc/room-builder/guardrails/trtc_prepare_ui.py",
107
- "gate-slice-read": "skills/trtc-topic/guardrails/gate_slice_read.py",
108
- "gate-slice-write": "skills/trtc-topic/guardrails/gate_slice_write.py",
109
- "verify-ui-post-write": "skills/trtc/room-builder/guardrails/verify_ui_post_write.sh",
110
- "verify-slice-must": "skills/trtc-apply/guardrails/verify_slice_must_rules.py",
111
- "stop-apply-evidence": "skills/trtc-topic/guardrails/stop_require_apply_evidence.py",
112
- "trtc-verify-ui": "skills/trtc/room-builder/guardrails/trtc_verify_ui.py",
113
- "verify-apply-project": "skills/trtc-apply/guardrails/verify_apply_project.py",
122
+ "gate-slice-read": "skills/trtc/hooks/gate_slice_read.py",
123
+ "topic-phase-gate": "skills/trtc/hooks/topic_phase_gate.py",
124
+ "gate-slice-write": "skills/trtc/hooks/gate_slice_write.py",
125
+ "stop-apply-evidence": "skills/trtc/hooks/stop_require_apply_evidence.py",
126
+ "pretooluse-require-business-decisions": "skills/trtc-conference/hooks/pretooluse_require_business_decisions.py",
114
127
  }
115
128
 
116
129
  # Dispatch keys whose underlying scripts read JSON from stdin.
117
130
  # Other keys are CLI-only and will receive empty stdin.
118
131
  STDIN_KEYS = {
119
132
  "gate-slice-read",
133
+ "topic-phase-gate",
120
134
  "gate-slice-write",
121
- "verify-ui-post-write",
122
- "verify-slice-must",
135
+ "pretooluse-require-business-decisions",
123
136
  }
124
137
 
125
138
 
@@ -164,7 +177,21 @@ def _translate_payload(key: str, cursor: dict) -> dict:
164
177
  tool_input = cursor.get("tool_input") or cursor.get("toolInput") or {}
165
178
  return {"tool_name": tool_name, "tool_input": tool_input}
166
179
 
167
- if key in ("verify-ui-post-write", "verify-slice-must"):
180
+ if key == "topic-phase-gate":
181
+ tool_name = cursor.get("tool_name") or cursor.get("toolName")
182
+ if tool_name not in ("Write", "Edit"):
183
+ return {}
184
+ tool_input = cursor.get("tool_input") or cursor.get("toolInput") or {}
185
+ return {"tool_name": tool_name, "tool_input": tool_input}
186
+
187
+ if key == "pretooluse-require-business-decisions":
188
+ tool_name = cursor.get("tool_name") or cursor.get("toolName")
189
+ if tool_name not in ("Write", "Edit"):
190
+ return {}
191
+ tool_input = cursor.get("tool_input") or cursor.get("toolInput") or {}
192
+ return {"tool_name": tool_name, "tool_input": tool_input}
193
+
194
+ if key in ("verify-ui-post-write",):
168
195
  # Cursor's afterFileEdit payload: {file_path, edits}
169
196
  file_path = cursor.get("file_path") or cursor.get("filePath")
170
197
  return {"tool_name": "Edit", "tool_input": {"file_path": file_path}}
@@ -1,38 +1,25 @@
1
1
  {
2
2
  "version": 1,
3
3
  "hooks": {
4
- "sessionStart": [
5
- {
6
- "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py trtc-prepare-ui"
7
- }
8
- ],
9
- "beforeReadFile": [
4
+ "beforeReadFile": [
10
5
  {
11
6
  "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py gate-slice-read"
12
7
  }
13
8
  ],
14
9
  "preToolUse": [
15
10
  {
16
- "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py gate-slice-write"
17
- }
18
- ],
19
- "afterFileEdit": [
11
+ "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py topic-phase-gate"
12
+ },
20
13
  {
21
- "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py verify-ui-post-write"
14
+ "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py gate-slice-write"
22
15
  },
23
16
  {
24
- "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py verify-slice-must"
17
+ "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py pretooluse-require-business-decisions"
25
18
  }
26
19
  ],
27
20
  "stop": [
28
21
  {
29
22
  "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py stop-apply-evidence"
30
- },
31
- {
32
- "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py trtc-verify-ui"
33
- },
34
- {
35
- "command": "python3 $HOME/.cursor/plugins/local/trtc-agent-skills/hooks/cursor-adapter.py verify-apply-project"
36
23
  }
37
24
  ]
38
25
  }
package/hooks/hooks.json CHANGED
@@ -1,22 +1,12 @@
1
1
  {
2
2
  "hooks": {
3
- "SessionStart": [
4
- {
5
- "hooks": [
6
- {
7
- "type": "command",
8
- "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/room-builder/guardrails/trtc_prepare_ui.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/room-builder/guardrails/trtc_prepare_ui.py\""
9
- }
10
- ]
11
- }
12
- ],
13
3
  "PreToolUse": [
14
4
  {
15
5
  "matcher": "Read",
16
6
  "hooks": [
17
7
  {
18
8
  "type": "command",
19
- "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-topic/guardrails/gate_slice_read.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-topic/guardrails/gate_slice_read.py\""
9
+ "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/hooks/gate_slice_read.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/hooks/gate_slice_read.py\""
20
10
  }
21
11
  ]
22
12
  },
@@ -25,22 +15,15 @@
25
15
  "hooks": [
26
16
  {
27
17
  "type": "command",
28
- "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-topic/guardrails/gate_slice_write.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-topic/guardrails/gate_slice_write.py\""
29
- }
30
- ]
31
- }
32
- ],
33
- "PostToolUse": [
34
- {
35
- "matcher": "Write|Edit",
36
- "hooks": [
18
+ "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/hooks/topic_phase_gate.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/hooks/topic_phase_gate.py\""
19
+ },
37
20
  {
38
21
  "type": "command",
39
- "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/room-builder/guardrails/verify_ui_post_write.sh\" ] || bash \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/room-builder/guardrails/verify_ui_post_write.sh\""
22
+ "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/hooks/gate_slice_write.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/hooks/gate_slice_write.py\""
40
23
  },
41
24
  {
42
25
  "type": "command",
43
- "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-apply/guardrails/verify_slice_must_rules.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-apply/guardrails/verify_slice_must_rules.py\""
26
+ "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-conference/hooks/pretooluse_require_business_decisions.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-conference/hooks/pretooluse_require_business_decisions.py\""
44
27
  }
45
28
  ]
46
29
  }
@@ -50,15 +33,7 @@
50
33
  "hooks": [
51
34
  {
52
35
  "type": "command",
53
- "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-topic/guardrails/stop_require_apply_evidence.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-topic/guardrails/stop_require_apply_evidence.py\""
54
- },
55
- {
56
- "type": "command",
57
- "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/room-builder/guardrails/trtc_verify_ui.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/room-builder/guardrails/trtc_verify_ui.py\""
58
- },
59
- {
60
- "type": "command",
61
- "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-apply/guardrails/verify_apply_project.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc-apply/guardrails/verify_apply_project.py\""
36
+ "command": "[ ! -f \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/hooks/stop_require_apply_evidence.py\" ] || python3 \"${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}/skills/trtc/hooks/stop_require_apply_evidence.py\""
62
37
  }
63
38
  ]
64
39
  }