@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.
- package/.cursor/rules/main.mdc +12 -0
- package/AGENTS.md +14 -104
- package/CLAUDE.md +15 -127
- package/CODEBUDDY.md +32 -118
- package/README.md +7 -5
- package/README.zh.md +7 -5
- package/bin/cli.js +133 -41
- package/hooks/__pycache__/cursor-adapter.cpython-313.pyc +0 -0
- package/hooks/cursor-adapter.py +45 -18
- package/hooks/hooks-cursor.json +5 -18
- package/hooks/hooks.json +6 -31
- package/knowledge-base/conference/web/index.yaml +143 -0
- package/knowledge-base/platform-slice-template.md +1041 -133
- package/knowledge-base/products.yaml +76 -0
- package/knowledge-base/scenario-spec.md +1316 -115
- package/knowledge-base/scenarios/conference/base/general-conference.md +22 -2
- package/knowledge-base/scenarios/conference/base/webinar-conference.md +14 -0
- package/knowledge-base/scenarios/conference/medical/1v1-video-consultation.md +19 -0
- package/knowledge-base/scenarios/conference/medical/medical-multidoctor-consultation.md +13 -0
- package/knowledge-base/scenarios/live/entertainment-live-room.md +12 -0
- package/knowledge-base/slice-spec.md +2377 -299
- package/knowledge-base/slices/conference/web/integration-audit.md +1 -1
- package/knowledge-base/slices/conference/web/login-auth.md +14 -1
- package/knowledge-base/tooling/aliases.yaml +92 -0
- package/knowledge-base/tooling/intent-signals.yaml +181 -0
- package/knowledge-base/tooling/symptom-keywords.yaml +21 -0
- package/package.json +1 -1
- package/skills/trtc/SKILL.md +202 -245
- package/skills/trtc/hooks/__pycache__/report_prompt.cpython-313.pyc +0 -0
- package/skills/{trtc-topic/guardrails → trtc/hooks}/gate_slice_read.py +12 -8
- package/skills/{trtc-topic/guardrails → trtc/hooks}/gate_slice_write.py +16 -12
- package/skills/{trtc-topic/guardrails → trtc/hooks}/stop_require_apply_evidence.py +22 -14
- package/skills/trtc/hooks/topic_phase_gate.py +161 -0
- package/skills/{trtc-topic → trtc}/runtime/README.md +2 -2
- package/skills/{trtc-onboarding/reference/reporting-protocol.md → trtc/runtime/REPORTING.md} +5 -5
- package/skills/{trtc-topic → trtc}/runtime/RUNTIME.md +5 -5
- package/skills/trtc/runtime/lib/__init__.py +0 -0
- package/skills/{trtc-topic → trtc}/runtime/package-lock.json +2 -2
- package/skills/{trtc-topic → trtc}/runtime/package.json +2 -2
- package/skills/{trtc-topic → trtc}/runtime/telemetry-bridge.mjs +1 -1
- package/skills/{trtc-topic/scripts → trtc/tools}/STATE-MACHINE-GUIDE.md +23 -23
- package/skills/trtc/tools/__init__.py +2 -0
- package/skills/trtc/tools/__pycache__/__init__.cpython-313.pyc +0 -0
- package/skills/trtc/tools/__pycache__/query_classifier.cpython-313.pyc +0 -0
- package/skills/trtc/tools/__pycache__/reporting.cpython-313.pyc +0 -0
- package/skills/trtc/tools/__pycache__/search.cpython-313.pyc +0 -0
- package/skills/trtc/tools/__pycache__/session.cpython-313.pyc +0 -0
- package/skills/trtc/tools/apply.py +540 -0
- package/skills/trtc/tools/docs.py +712 -0
- package/skills/trtc/tools/docsbot.py +182 -0
- package/skills/trtc/tools/entry/render_ai_instructions.py +92 -0
- package/skills/trtc/tools/flow.py +1089 -0
- package/skills/{trtc-topic/scripts → trtc/tools}/init_slice_queue.py +5 -4
- package/skills/{trtc-topic/scripts → trtc/tools}/next_slice.py +5 -4
- package/skills/trtc/tools/query_classifier.py +301 -0
- package/skills/trtc/tools/reporting.py +447 -0
- package/skills/trtc/tools/search.py +817 -0
- package/skills/trtc/tools/session.py +1261 -0
- package/skills/trtc/tools/state_machine.py +690 -0
- package/skills/trtc-ai-service/README.md +195 -0
- package/skills/trtc-ai-service/README.zh-CN.md +193 -0
- package/skills/trtc-ai-service/SKILL.md +945 -0
- package/skills/trtc-ai-service/auto_adapters/README.md +40 -0
- package/skills/trtc-ai-service/auto_adapters/frontend-spa/README.md +27 -0
- package/skills/trtc-ai-service/auto_adapters/frontend-spa/angular/voice-agent.component.ts.tpl +131 -0
- package/skills/trtc-ai-service/auto_adapters/frontend-spa/manifest.yaml +57 -0
- package/skills/trtc-ai-service/auto_adapters/frontend-spa/react/VoiceAgent.tsx.tpl +142 -0
- package/skills/trtc-ai-service/auto_adapters/frontend-spa/vue/VoiceAgent.vue.tpl +121 -0
- package/skills/trtc-ai-service/auto_adapters/integration_templates/generic-backend.md +45 -0
- package/skills/trtc-ai-service/auto_adapters/integration_templates/generic-frontend.md +51 -0
- package/skills/trtc-ai-service/auto_adapters/integration_templates/generic-rest-api.md +93 -0
- package/skills/trtc-ai-service/auto_adapters/java-backend/README.md +25 -0
- package/skills/trtc-ai-service/auto_adapters/java-backend/manifest.yaml +30 -0
- package/skills/trtc-ai-service/auto_adapters/java-backend/quarkus/VoiceAgentFilter.java.tpl +64 -0
- package/skills/trtc-ai-service/auto_adapters/java-backend/springboot/VoiceAgentFilter.java.tpl +91 -0
- package/skills/trtc-ai-service/auto_adapters/manifest.yaml +43 -0
- package/skills/trtc-ai-service/auto_adapters/node-backend/README.md +25 -0
- package/skills/trtc-ai-service/auto_adapters/node-backend/express.js.tpl +40 -0
- package/skills/trtc-ai-service/auto_adapters/node-backend/fastify.js.tpl +27 -0
- package/skills/trtc-ai-service/auto_adapters/node-backend/koa.js.tpl +31 -0
- package/skills/trtc-ai-service/auto_adapters/node-backend/manifest.yaml +47 -0
- package/skills/trtc-ai-service/auto_adapters/python-backend/README.md +22 -0
- package/skills/trtc-ai-service/auto_adapters/python-backend/django.py.tpl +32 -0
- package/skills/trtc-ai-service/auto_adapters/python-backend/fastapi.py.tpl +35 -0
- package/skills/trtc-ai-service/auto_adapters/python-backend/flask.py.tpl +31 -0
- package/skills/trtc-ai-service/auto_adapters/python-backend/manifest.yaml +45 -0
- package/skills/trtc-ai-service/capabilities/__init__.py +43 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/.env.example +29 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/INTEGRATION.md +134 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/INTERFACE_ADAPT.md +111 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/QUICK_START.md +62 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/manifest.yaml +250 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/requirements.txt +6 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/__init__.py +10 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/_capability_loader.py +218 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/agent.py +231 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/credentials.py +132 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/health.py +355 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/log_filter.py +76 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/modality.py +109 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/server.py +312 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/trtc_client.py +315 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/usersig.py +90 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/tests/test_skeleton.py +216 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/README.md +48 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/app.js +415 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/index.html +68 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/styles.css +136 -0
- package/skills/trtc-ai-service/capabilities/digital-human/README.md +31 -0
- package/skills/trtc-ai-service/capabilities/digital-human/manifest.yaml +64 -0
- package/skills/trtc-ai-service/capabilities/digital-human/src/__init__.py +2 -0
- package/skills/trtc-ai-service/capabilities/digital-human/src/router.py +43 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/INTERFACE_ADAPT.md +353 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/README.md +44 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/manifest.yaml +227 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/__init__.py +2 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/__init__.py +9 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/default_rest.py +242 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/factory.py +89 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/local_queue.py +258 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/mock.py +132 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/core/__init__.py +25 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/core/intent_detector.py +75 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/core/models.py +163 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/core/service.py +192 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/feedback_store.py +54 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/ports/__init__.py +4 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/ports/handoff_client.py +86 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/queue.py +62 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/router.py +201 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/summary_link.py +77 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/trigger.py +25 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/INTERFACE_ADAPT.md +297 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/README.md +51 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/data/faq.json +20 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/manifest.yaml +211 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/__init__.py +8 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/__init__.py +9 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/default_rest.py +209 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/factory.py +86 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/local_json.py +172 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/mock.py +91 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/__init__.py +12 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/models.py +77 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/scoring.py +73 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/service.py +78 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/ports/__init__.py +4 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/ports/kb_client.py +61 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/retriever.py +56 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/router.py +85 -0
- package/skills/trtc-ai-service/capabilities/session-summary/INTERFACE_ADAPT.md +99 -0
- package/skills/trtc-ai-service/capabilities/session-summary/README.md +47 -0
- package/skills/trtc-ai-service/capabilities/session-summary/data/test_session.json +18 -0
- package/skills/trtc-ai-service/capabilities/session-summary/manifest.yaml +165 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/__init__.py +2 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/__init__.py +5 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/base.py +31 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/default_rest.py +67 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/factory.py +51 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/local_json.py +42 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/mock.py +22 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/recorder.py +210 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/router.py +93 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/summarizer.py +163 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/INTERFACE_ADAPT.md +158 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/README.md +50 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/data/tools.yaml +58 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/examples/__init__.py +1 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/examples/local_tools.py +101 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/manifest.yaml +146 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/src/__init__.py +8 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/src/dispatcher.py +54 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/src/registry.py +219 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/src/router.py +50 -0
- package/skills/trtc-ai-service/references/business-contract-spec.md +263 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/README.md +86 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/output-templates/recipe.yaml.j2 +194 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q1-business-scenario.md +43 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q2-io-modality.md +57 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q3-ui-form.md +55 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q4-capabilities.md +78 -0
- package/skills/trtc-ai-service/scenarios/customer-service/README.md +114 -0
- package/skills/trtc-ai-service/scenarios/customer-service/recipe.yaml +154 -0
- package/skills/trtc-ai-service/scenarios/customer-service/sample-data/README.md +32 -0
- package/skills/trtc-ai-service/scenarios/customer-service/sample-data/faq-sample.json +37 -0
- package/skills/trtc-ai-service/scenarios/customer-service/system-prompt.template.md +94 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/app.js +347 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/index.html +125 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/styles.css +487 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/tokens.css +71 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/design-system/DESIGN_GUIDELINES.md +370 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/README.md +68 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/app.js +1307 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/data.js +40 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/index.html +233 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/mock-shop.json +21 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/styles.css +603 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/tokens.css +71 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/agent-link.js +323 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/app.js +458 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/index.html +109 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/styles.css +489 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/tokens.css +59 -0
- package/skills/trtc-ai-service/scripts/add-capability.py +364 -0
- package/skills/trtc-ai-service/scripts/contract-adapt.py +334 -0
- package/skills/trtc-ai-service/scripts/detect-stack.py +40 -0
- package/skills/trtc-ai-service/scripts/lib/__init__.py +20 -0
- package/skills/trtc-ai-service/scripts/lib/adapter_codegen.py +509 -0
- package/skills/trtc-ai-service/scripts/lib/arbitrator.py +152 -0
- package/skills/trtc-ai-service/scripts/lib/contract_resolver.py +519 -0
- package/skills/trtc-ai-service/scripts/lib/credential_validators.py +253 -0
- package/skills/trtc-ai-service/scripts/lib/curl_parser.py +303 -0
- package/skills/trtc-ai-service/scripts/lib/degrader.py +140 -0
- package/skills/trtc-ai-service/scripts/lib/injector.py +347 -0
- package/skills/trtc-ai-service/scripts/lib/manifest_resolver.py +288 -0
- package/skills/trtc-ai-service/scripts/lib/openapi_parser.py +289 -0
- package/skills/trtc-ai-service/scripts/lib/stack_detector.py +159 -0
- package/skills/trtc-ai-service/scripts/lib/tokens_compile.py +204 -0
- package/skills/trtc-ai-service/scripts/post-install-patch.py +225 -0
- package/skills/trtc-ai-service/scripts/setup-credentials.py +393 -0
- package/skills/trtc-ai-service/scripts/verify-credentials.py +108 -0
- package/skills/trtc-ai-service/start.sh +111 -0
- package/skills/trtc-ai-service/tests/__init__.py +1 -0
- package/skills/trtc-ai-service/tests/test_arbitrator.py +64 -0
- package/skills/trtc-ai-service/tests/test_capability_overlay.py +85 -0
- package/skills/trtc-ai-service/tests/test_contract_resolver.py +190 -0
- package/skills/trtc-ai-service/tests/test_handoff_ports.py +195 -0
- package/skills/trtc-ai-service/tests/test_kb_ports.py +195 -0
- package/skills/trtc-ai-service/tests/test_manifest_resolver.py +95 -0
- package/skills/trtc-ai-service/tests/test_recipe_assembly.py +175 -0
- package/skills/trtc-ai-service/tests/test_stack_and_degrader.py +101 -0
- package/skills/trtc-ai-service/tests/test_verify_credentials.py +285 -0
- package/skills/trtc-ai-service/triggers.yaml +29 -0
- package/skills/trtc-conference/SKILL.md +324 -0
- package/skills/trtc-conference/flows/onboarding.md +205 -0
- package/skills/trtc-conference/flows/topic.md +474 -0
- package/skills/trtc-conference/flows/troubleshoot.md +85 -0
- package/skills/trtc-conference/hooks/pretooluse_require_business_decisions.py +213 -0
- package/skills/trtc-conference/playbooks/medical-quickstart.md +84 -0
- package/skills/trtc-conference/playbooks/official-roomkit.md +97 -0
- package/skills/trtc-conference/references/local-usersig/basic-info-config.ts +39 -0
- package/skills/trtc-conference/references/usersig-handling.md +134 -0
- package/skills/trtc-conference/templates/medical-consultation/src/config/lib-generate-test-usersig-es.min.d.ts +4 -0
- package/skills/trtc-conference/templates/medical-consultation/src/config/lib-generate-test-usersig-es.min.js +2 -0
- package/skills/trtc-conference/tests/__pycache__/test_conference_onboarding_contract.cpython-313-pytest-9.0.2.pyc +0 -0
- package/skills/trtc-conference/tests/__pycache__/test_conference_topic_flow_contract.cpython-313-pytest-9.0.2.pyc +0 -0
- package/skills/trtc-conference/tests/test_conference_index_contract.py +43 -0
- package/skills/trtc-conference/tests/test_conference_onboarding_contract.py +103 -0
- package/skills/trtc-conference/tests/test_conference_template_contract.py +25 -0
- package/skills/trtc-conference/tests/test_conference_topic_flow_contract.py +132 -0
- package/skills/trtc-conference/tools/apply_checks.py +328 -0
- package/skills/trtc-conference/verify_lib/__init__.py +0 -0
- package/skills/{trtc-apply/guardrails/apply_lib → trtc-conference/verify_lib}/rule_parser.py +1 -1
- package/skills/trtc-docs/SKILL.md +91 -119
- package/.cursor/rules/ui-mode.mdc +0 -99
- package/ai-instructions/base.md +0 -13
- package/ai-instructions/ui-mode.md +0 -93
- package/knowledge-base/index.yaml +0 -462
- package/skills/trtc/room-builder/SKILL.md +0 -133
- package/skills/trtc/room-builder/templates/scenarios/medical-consultation/README.md +0 -108
- package/skills/trtc/room-builder/tools/render_ai_instructions.py +0 -226
- package/skills/trtc-apply/SKILL.md +0 -97
- package/skills/trtc-onboarding/SKILL.md +0 -841
- package/skills/trtc-onboarding/reference/path-a1-demo.md +0 -103
- package/skills/trtc-onboarding/reference/path-a2-integrate.md +0 -737
- package/skills/trtc-onboarding/reference/path-b-troubleshoot.md +0 -186
- package/skills/trtc-onboarding/reference/path-c-expand.md +0 -43
- package/skills/trtc-onboarding/reference/supported-matrix.md +0 -100
- package/skills/trtc-search/SKILL.md +0 -228
- package/skills/trtc-topic/SKILL.md +0 -622
- package/skills/trtc-topic/scripts/apply.py +0 -581
- package/skills/trtc-topic/scripts/lib/state_machine.py +0 -328
- package/skills/trtc-topic/tests/README.md +0 -70
- package/skills/trtc-topic/tests/conftest.py +0 -72
- package/skills/trtc-topic/tests/test_apply_cli.py +0 -480
- package/skills/trtc-topic/tests/test_end_to_end.py +0 -305
- package/skills/trtc-topic/tests/test_finalize_session.py +0 -51
- package/skills/trtc-topic/tests/test_gates.py +0 -316
- package/skills/trtc-topic/tests/test_session_resolver.py +0 -260
- package/skills/trtc-topic/tests/test_state_machine.py +0 -414
- package/skills/trtc-topic/tests/test_stop_require_apply.py +0 -99
- package/skills/trtc-topic/tests/test_topic_skill_invariants.py +0 -130
- /package/skills/{trtc-topic → trtc}/runtime/lib/platforms.py +0 -0
- /package/skills/{trtc-topic → trtc}/runtime/telemetry_collector.py +0 -0
- /package/skills/{trtc-onboarding/reference → trtc/runtime}/usersig-handling.md +0 -0
- /package/skills/{trtc-topic/scripts → trtc/tools}/finalize_session.py +0 -0
- /package/skills/{trtc-apply/guardrails/apply_lib → trtc-ai-service/capabilities/conversation-core/tests}/__init__.py +0 -0
- /package/skills/{trtc-topic → trtc-conference}/references/execution-units.yaml +0 -0
- /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
- /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
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/docs/backend-contract.zh-CN.md +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/docs/integration.zh-CN.md +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/docs/theme.zh-CN.md +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/index.html +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/package.json +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/postcss.config.js +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/App.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/ConsultationManagePanel.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/LanguageSwitch.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/LoadingSpinner.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalAlert.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalBusinessPanel.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalButton.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalConfirmDialog.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalDataPanel.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/MedicalRecordPanel.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/components/PrescriptionPanel.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/config/basic-info-config.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/config/runtime-config.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/env.d.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/ConsultationChatPanel.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/ConsultationMembersPanel.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/ConsultationTranscriptionPanel.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/ConsultationVideoStage.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/InviteDoctorDialog.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/components/KickMemberConfirmDialog.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/types.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/useConsultationChat.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/useConsultationDevices.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/useConsultationParticipants.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/useConsultationPermissions.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/features/consultation/utils.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/i18n/en-US/index.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/i18n/index.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/i18n/medicalTranslate.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/i18n/state.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/i18n/zh-CN/index.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/main.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/mock/appointments.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/mock/users.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/router/index.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/index.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/integration/appointmentService.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/integration/authService.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/integration/launchContext.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/integration/userService.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/mock/appointmentService.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/mock/authService.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/mock/userService.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/services/adapters/types.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/shared/icons.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/styles/index.css +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/styles/tailwind.css +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/styles/theme.css +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/utils/auth.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/utils/format.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/utils/navigation.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/utils/session.ts +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/DoctorConsultationView.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/DoctorDashboardView.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/LoginView.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/PatientConsultationFinishedView.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/PatientConsultationView.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/PatientSelectDoctorView.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/src/views/PatientWaitingView.vue +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/tsconfig.json +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/tsconfig.node.json +0 -0
- /package/skills/{trtc/room-builder/templates/scenarios → trtc-conference/templates}/medical-consultation/vite.config.ts +0 -0
- /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
- /package/skills/{trtc-topic/runtime/lib → trtc-conference/tools}/__init__.py +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# auto_adapters - Tech Stack Decoupling Adapter Component Library
|
|
2
|
+
|
|
3
|
+
> Read by the Agent during the integration phase. Based on the tech stack identified by `stack_detector`,
|
|
4
|
+
> selects the corresponding adapter, renders template code, and injects it into the user's project.
|
|
5
|
+
|
|
6
|
+
## Adapter Index
|
|
7
|
+
|
|
8
|
+
| Adapter | Matching Tech Stack | Injected Artifact | Default Target |
|
|
9
|
+
|:---|:---|:---|:---|
|
|
10
|
+
| `frontend-spa` | `react` / `vue` / `angular` / `next` | `VoiceAgent.{tsx,vue,ts}` component | `src/components/` |
|
|
11
|
+
| `node-backend` | `express` / `koa` / `fastify` | Reverse proxy middleware | `routes/voice-agent.js` |
|
|
12
|
+
| `java-backend` | `spring-boot` / `quarkus` | `Filter` or `Quarkus Filter` | `src/main/java/.../VoiceAgentFilter.java` |
|
|
13
|
+
| `python-backend` | `flask` / `fastapi` / `django` | Decorator / sub-router | `voice_agent_proxy.py` |
|
|
14
|
+
|
|
15
|
+
## Template Rendering Variables
|
|
16
|
+
|
|
17
|
+
All `.tpl` files use `${VAR}` placeholders (to avoid conflicts with JS / Python `{{}}`):
|
|
18
|
+
|
|
19
|
+
| Variable | Default | Description |
|
|
20
|
+
|:---|:---|:---|
|
|
21
|
+
| `${SKELETON_BASE_URL}` | `http://localhost:3000` | conversation-core process address |
|
|
22
|
+
| `${API_PREFIX}` | `/api/v1` | Skeleton REST prefix |
|
|
23
|
+
| `${COMPONENT_NAME}` | `VoiceAgent` | Frontend component name |
|
|
24
|
+
| `${ROUTE_PREFIX}` | `/voice-agent` | Backend proxy route prefix |
|
|
25
|
+
|
|
26
|
+
## Three-Level Degradation Chain
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
L1 Full Auto: stack_detector.primary matched → adapter.render() → write to user project
|
|
30
|
+
│
|
|
31
|
+
│ Failed (syntax conflict / path conflict)
|
|
32
|
+
▼
|
|
33
|
+
L2 Semi-Auto: Output INTEGRATION_GUIDE.md (based on integration_templates/generic-*.md)
|
|
34
|
+
│
|
|
35
|
+
│ stack_detector.primary is None
|
|
36
|
+
▼
|
|
37
|
+
L3 Manual API: Output integration_templates/generic-rest-api.md
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
See `scripts/lib/degrader.py` and `scripts/add-capability.py` for details.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frontend-spa Adapter
|
|
2
|
+
|
|
3
|
+
> Connect the conversation-core skeleton REST API to any frontend SPA.
|
|
4
|
+
> The Agent selects the appropriate subdirectory template based on the current `tech_stack` during the L1 phase and renders it into the user's project.
|
|
5
|
+
|
|
6
|
+
| tech_stack | Template | Default Target |
|
|
7
|
+
|:---|:---|:---|
|
|
8
|
+
| react / next | `react/VoiceAgent.tsx.tpl` | `src/components/${COMPONENT_NAME}.tsx` |
|
|
9
|
+
| vue | `vue/VoiceAgent.vue.tpl` | `src/components/${COMPONENT_NAME}.vue` |
|
|
10
|
+
| angular | `angular/voice-agent.component.ts.tpl` | `src/app/voice-agent/voice-agent.component.ts` |
|
|
11
|
+
|
|
12
|
+
## Dependency Installation (written by Agent into package.json)
|
|
13
|
+
|
|
14
|
+
- `trtc-sdk-v5 >= 5.0.0`
|
|
15
|
+
|
|
16
|
+
## Security
|
|
17
|
+
|
|
18
|
+
- Templates use `${SKELETON_BASE_URL}` for fetch; in production this must be replaced with an HTTPS address (skeleton manifest `security.network.enforce_https = true`).
|
|
19
|
+
- TRTC SDK requires a wss channel; allow in CSP:
|
|
20
|
+
```
|
|
21
|
+
connect-src https://${SKELETON_BASE_URL} wss://*.trtc.tencent-cloud.com;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Capability Overlay
|
|
25
|
+
|
|
26
|
+
- With `tool-calling` installed: type `/tool xxx {...}` in the Send box to trigger local tool calls.
|
|
27
|
+
- With `human-handoff` installed: sending keywords like "talk to agent" triggers the queue-and-connect flow.
|
package/skills/trtc-ai-service/auto_adapters/frontend-spa/angular/voice-agent.component.ts.tpl
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// voice-agent.component.ts
|
|
2
|
+
// Auto-generated by conversation-core/auto_adapters/frontend-spa (Angular)
|
|
3
|
+
// Connect to TRTC ConversationAI via skeleton REST
|
|
4
|
+
import { Component, OnInit } from '@angular/core';
|
|
5
|
+
import { HttpClient } from '@angular/common/http';
|
|
6
|
+
|
|
7
|
+
const SKELETON_BASE_URL = '${SKELETON_BASE_URL}';
|
|
8
|
+
const API_PREFIX = '${API_PREFIX}';
|
|
9
|
+
|
|
10
|
+
interface SessionCfg {
|
|
11
|
+
session_id: string;
|
|
12
|
+
sdk_app_id: number;
|
|
13
|
+
room_id: string;
|
|
14
|
+
user_id: string;
|
|
15
|
+
user_sig: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Component({
|
|
19
|
+
selector: 'app-voice-agent',
|
|
20
|
+
template: `
|
|
21
|
+
<div style="font-family:system-ui;padding:16px;">
|
|
22
|
+
<h3>TRTC Voice Agent</h3>
|
|
23
|
+
<div *ngIf="health" style="display:flex;gap:16px;margin-bottom:8px;">
|
|
24
|
+
<span *ngFor="let kv of healthEntries">
|
|
25
|
+
<span [style.color]="kv.status === 'ok' ? '#1ec97c' : '#e74c3c'">●</span>
|
|
26
|
+
{{ kv.name }}
|
|
27
|
+
</span>
|
|
28
|
+
</div>
|
|
29
|
+
<button *ngIf="!session" (click)="start()">Start</button>
|
|
30
|
+
<ng-container *ngIf="session">
|
|
31
|
+
<button (click)="stop()">Stop</button>
|
|
32
|
+
<input [(ngModel)]="text" placeholder="type message..." style="margin-left:8px;padding:4px;width:240px;" />
|
|
33
|
+
<button (click)="send()">Send</button>
|
|
34
|
+
</ng-container>
|
|
35
|
+
<pre style="background:#111;color:#0f0;padding:8px;height:200px;overflow:auto;">{{ logs.join('\n') }}</pre>
|
|
36
|
+
</div>
|
|
37
|
+
`,
|
|
38
|
+
})
|
|
39
|
+
export class VoiceAgentComponent implements OnInit {
|
|
40
|
+
health: any = null;
|
|
41
|
+
healthEntries: { name: string; status: string }[] = [];
|
|
42
|
+
session: SessionCfg | null = null;
|
|
43
|
+
logs: string[] = [];
|
|
44
|
+
text = '';
|
|
45
|
+
trtc: any = null;
|
|
46
|
+
|
|
47
|
+
constructor(private http: HttpClient) {}
|
|
48
|
+
|
|
49
|
+
log(m: string) {
|
|
50
|
+
this.logs = [...this.logs.slice(-20), '[' + new Date().toLocaleTimeString() + '] ' + m];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
ngOnInit() {
|
|
54
|
+
this.http.get<any>(SKELETON_BASE_URL + API_PREFIX + '/health').subscribe({
|
|
55
|
+
next: (h) => {
|
|
56
|
+
this.health = h;
|
|
57
|
+
this.healthEntries = Object.entries(h.checks || {}).map(([name, v]: [string, any]) => ({
|
|
58
|
+
name,
|
|
59
|
+
status: v.status,
|
|
60
|
+
}));
|
|
61
|
+
},
|
|
62
|
+
error: (e) => this.log('health failed: ' + e.message),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async start() {
|
|
67
|
+
try {
|
|
68
|
+
const cfg: any = await this.http
|
|
69
|
+
.post(SKELETON_BASE_URL + API_PREFIX + '/get_config', {})
|
|
70
|
+
.toPromise();
|
|
71
|
+
this.session = cfg.data;
|
|
72
|
+
this.log('session=' + cfg.data.session_id);
|
|
73
|
+
|
|
74
|
+
const TRTC = (await import('trtc-sdk-v5')).default;
|
|
75
|
+
this.trtc = TRTC.create();
|
|
76
|
+
await this.trtc.enterRoom({
|
|
77
|
+
roomId: Number(cfg.data.room_id),
|
|
78
|
+
sdkAppId: cfg.data.sdk_app_id,
|
|
79
|
+
userId: cfg.data.user_id,
|
|
80
|
+
userSig: cfg.data.user_sig,
|
|
81
|
+
});
|
|
82
|
+
await this.trtc.startLocalAudio();
|
|
83
|
+
await this.http
|
|
84
|
+
.post(SKELETON_BASE_URL + API_PREFIX + '/agent/start', {
|
|
85
|
+
session_id: cfg.data.session_id,
|
|
86
|
+
language: 'zh',
|
|
87
|
+
})
|
|
88
|
+
.toPromise();
|
|
89
|
+
this.log('agent started');
|
|
90
|
+
} catch (e: any) {
|
|
91
|
+
this.log('start failed: ' + e.message);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async stop() {
|
|
96
|
+
if (!this.session) return;
|
|
97
|
+
try {
|
|
98
|
+
await this.http
|
|
99
|
+
.post(SKELETON_BASE_URL + API_PREFIX + '/agent/stop', {
|
|
100
|
+
session_id: this.session.session_id,
|
|
101
|
+
})
|
|
102
|
+
.toPromise();
|
|
103
|
+
if (this.trtc) {
|
|
104
|
+
await this.trtc.exitRoom();
|
|
105
|
+
await this.trtc.destroy();
|
|
106
|
+
this.trtc = null;
|
|
107
|
+
}
|
|
108
|
+
this.session = null;
|
|
109
|
+
this.log('stopped');
|
|
110
|
+
} catch (e: any) {
|
|
111
|
+
this.log('stop failed: ' + e.message);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async send() {
|
|
116
|
+
if (!this.session || !this.text.trim()) return;
|
|
117
|
+
try {
|
|
118
|
+
await this.http
|
|
119
|
+
.post(SKELETON_BASE_URL + API_PREFIX + '/agent/control', {
|
|
120
|
+
session_id: this.session.session_id,
|
|
121
|
+
text: this.text,
|
|
122
|
+
interrupt: true,
|
|
123
|
+
})
|
|
124
|
+
.toPromise();
|
|
125
|
+
this.log('pushed: ' + this.text);
|
|
126
|
+
this.text = '';
|
|
127
|
+
} catch (e: any) {
|
|
128
|
+
this.log('push failed: ' + e.message);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frontend-spa adapter manifest
|
|
2
|
+
# Rendered by Agent when targeting a frontend SPA project (React / Vue / Angular / Next).
|
|
3
|
+
|
|
4
|
+
name: "frontend-spa"
|
|
5
|
+
version: "1.0.0"
|
|
6
|
+
target_role: "frontend"
|
|
7
|
+
tech_stack: ["react", "vue", "angular", "next"]
|
|
8
|
+
|
|
9
|
+
# Render entries: tech_stack -> template file + default target path + install hints
|
|
10
|
+
templates:
|
|
11
|
+
react:
|
|
12
|
+
file: "react/VoiceAgent.tsx.tpl"
|
|
13
|
+
target_path: "src/components/${COMPONENT_NAME}.tsx"
|
|
14
|
+
install_hint: |
|
|
15
|
+
In your root component render section, add:
|
|
16
|
+
import { ${COMPONENT_NAME} } from './components/${COMPONENT_NAME}';
|
|
17
|
+
<${COMPONENT_NAME} />
|
|
18
|
+
package_dependencies:
|
|
19
|
+
- "trtc-sdk-v5@>=5.0.0"
|
|
20
|
+
next:
|
|
21
|
+
file: "react/VoiceAgent.tsx.tpl"
|
|
22
|
+
target_path: "components/${COMPONENT_NAME}.tsx"
|
|
23
|
+
install_hint: |
|
|
24
|
+
In app/page.tsx (or pages/index.tsx):
|
|
25
|
+
'use client';
|
|
26
|
+
import dynamic from 'next/dynamic';
|
|
27
|
+
const ${COMPONENT_NAME} = dynamic(() => import('@/components/${COMPONENT_NAME}'), { ssr: false });
|
|
28
|
+
package_dependencies:
|
|
29
|
+
- "trtc-sdk-v5@>=5.0.0"
|
|
30
|
+
vue:
|
|
31
|
+
file: "vue/VoiceAgent.vue.tpl"
|
|
32
|
+
target_path: "src/components/${COMPONENT_NAME}.vue"
|
|
33
|
+
install_hint: |
|
|
34
|
+
In parent component:
|
|
35
|
+
<script setup>import ${COMPONENT_NAME} from './components/${COMPONENT_NAME}.vue'</script>
|
|
36
|
+
<template><${COMPONENT_NAME} /></template>
|
|
37
|
+
package_dependencies:
|
|
38
|
+
- "trtc-sdk-v5@>=5.0.0"
|
|
39
|
+
angular:
|
|
40
|
+
file: "angular/voice-agent.component.ts.tpl"
|
|
41
|
+
target_path: "src/app/voice-agent/voice-agent.component.ts"
|
|
42
|
+
install_hint: |
|
|
43
|
+
Add VoiceAgentComponent to your NgModule's declarations;
|
|
44
|
+
use <app-voice-agent></app-voice-agent> in your template.
|
|
45
|
+
package_dependencies:
|
|
46
|
+
- "trtc-sdk-v5@>=5.0.0"
|
|
47
|
+
|
|
48
|
+
# 默认变量(被顶层 default_variables 覆盖)
|
|
49
|
+
defaults:
|
|
50
|
+
SKELETON_BASE_URL: "http://localhost:3000"
|
|
51
|
+
API_PREFIX: "/api/v1"
|
|
52
|
+
COMPONENT_NAME: "VoiceAgent"
|
|
53
|
+
|
|
54
|
+
# 安全
|
|
55
|
+
security:
|
|
56
|
+
csp_hint: "TRTC SDK 需要允许 wss://*.trtc.tencent-cloud.com 与 https://${SKELETON_BASE_URL}"
|
|
57
|
+
https_required: true
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// ${COMPONENT_NAME}.tsx
|
|
2
|
+
// Auto-generated by conversation-core/auto_adapters/frontend-spa
|
|
3
|
+
// Connect to TRTC ConversationAI via skeleton REST (minimal join-room + status display, non-business version)
|
|
4
|
+
// Install dependency: trtc-sdk-v5
|
|
5
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
const SKELETON_BASE_URL = '${SKELETON_BASE_URL}';
|
|
8
|
+
const API_PREFIX = '${API_PREFIX}';
|
|
9
|
+
|
|
10
|
+
interface HealthResp {
|
|
11
|
+
status: 'ok' | 'partial_failure' | string;
|
|
12
|
+
checks: Record<string, { status: string; latency_ms: number | null; error?: string }>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface SessionConfig {
|
|
16
|
+
session_id: string;
|
|
17
|
+
sdk_app_id: number;
|
|
18
|
+
room_id: string;
|
|
19
|
+
user_id: string;
|
|
20
|
+
user_sig: string;
|
|
21
|
+
agent_user_id: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const ${COMPONENT_NAME}: React.FC = () => {
|
|
25
|
+
const [health, setHealth] = useState<HealthResp | null>(null);
|
|
26
|
+
const [session, setSession] = useState<SessionConfig | null>(null);
|
|
27
|
+
const [logs, setLogs] = useState<string[]>([]);
|
|
28
|
+
const [text, setText] = useState('');
|
|
29
|
+
const trtcRef = useRef<any>(null);
|
|
30
|
+
|
|
31
|
+
const log = (msg: string) =>
|
|
32
|
+
setLogs((prev) => [...prev.slice(-20), '[' + new Date().toLocaleTimeString() + '] ' + msg]);
|
|
33
|
+
|
|
34
|
+
const callJson = async (path: string, body?: unknown) => {
|
|
35
|
+
const resp = await fetch(SKELETON_BASE_URL + API_PREFIX + path, {
|
|
36
|
+
method: body ? 'POST' : 'GET',
|
|
37
|
+
headers: { 'Content-Type': 'application/json' },
|
|
38
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
39
|
+
});
|
|
40
|
+
if (!resp.ok) throw new Error(path + ' -> HTTP ' + resp.status);
|
|
41
|
+
return resp.json();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
callJson('/health').then(setHealth).catch((e) => log('health failed: ' + e.message));
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
48
|
+
const start = async () => {
|
|
49
|
+
try {
|
|
50
|
+
const cfg = await callJson('/get_config', {});
|
|
51
|
+
const data: SessionConfig = cfg.data;
|
|
52
|
+
setSession(data);
|
|
53
|
+
log('session=' + data.session_id + ' room=' + data.room_id);
|
|
54
|
+
|
|
55
|
+
// Join room (user side)
|
|
56
|
+
const TRTC = (await import('trtc-sdk-v5')).default;
|
|
57
|
+
const trtc = TRTC.create();
|
|
58
|
+
trtcRef.current = trtc;
|
|
59
|
+
await trtc.enterRoom({
|
|
60
|
+
roomId: Number(data.room_id),
|
|
61
|
+
sdkAppId: data.sdk_app_id,
|
|
62
|
+
userId: data.user_id,
|
|
63
|
+
userSig: data.user_sig,
|
|
64
|
+
});
|
|
65
|
+
await trtc.startLocalAudio();
|
|
66
|
+
log('entered room');
|
|
67
|
+
|
|
68
|
+
// Start AI channel bot
|
|
69
|
+
await callJson('/agent/start', { session_id: data.session_id, language: 'zh' });
|
|
70
|
+
log('agent started');
|
|
71
|
+
} catch (e: any) {
|
|
72
|
+
log('start failed: ' + e.message);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const stop = async () => {
|
|
77
|
+
if (!session) return;
|
|
78
|
+
try {
|
|
79
|
+
await callJson('/agent/stop', { session_id: session.session_id });
|
|
80
|
+
if (trtcRef.current) {
|
|
81
|
+
await trtcRef.current.exitRoom();
|
|
82
|
+
await trtcRef.current.destroy();
|
|
83
|
+
trtcRef.current = null;
|
|
84
|
+
}
|
|
85
|
+
log('stopped');
|
|
86
|
+
setSession(null);
|
|
87
|
+
} catch (e: any) {
|
|
88
|
+
log('stop failed: ' + e.message);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const send = async () => {
|
|
93
|
+
if (!session || !text.trim()) return;
|
|
94
|
+
try {
|
|
95
|
+
await callJson('/agent/control', {
|
|
96
|
+
session_id: session.session_id,
|
|
97
|
+
text,
|
|
98
|
+
interrupt: true,
|
|
99
|
+
});
|
|
100
|
+
log('text pushed: ' + text);
|
|
101
|
+
setText('');
|
|
102
|
+
} catch (e: any) {
|
|
103
|
+
log('push failed: ' + e.message);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<div style={{ fontFamily: 'system-ui', padding: 16 }}>
|
|
109
|
+
<h3>TRTC Voice Agent</h3>
|
|
110
|
+
<div style={{ display: 'flex', gap: 16, marginBottom: 8 }}>
|
|
111
|
+
{health
|
|
112
|
+
? Object.entries(health.checks).map(([k, v]) => (
|
|
113
|
+
<span key={k}>
|
|
114
|
+
<span style={{ color: v.status === 'ok' ? '#1ec97c' : '#e74c3c' }}>●</span>
|
|
115
|
+
{' '}
|
|
116
|
+
{k}
|
|
117
|
+
</span>
|
|
118
|
+
))
|
|
119
|
+
: 'loading...'}
|
|
120
|
+
</div>
|
|
121
|
+
{!session ? (
|
|
122
|
+
<button onClick={start}>Start</button>
|
|
123
|
+
) : (
|
|
124
|
+
<>
|
|
125
|
+
<button onClick={stop}>Stop</button>
|
|
126
|
+
<input
|
|
127
|
+
value={text}
|
|
128
|
+
onChange={(e) => setText(e.target.value)}
|
|
129
|
+
placeholder="type message..."
|
|
130
|
+
style={{ marginLeft: 8, padding: 4, width: 240 }}
|
|
131
|
+
/>
|
|
132
|
+
<button onClick={send}>Send</button>
|
|
133
|
+
</>
|
|
134
|
+
)}
|
|
135
|
+
<pre style={{ background: '#111', color: '#0f0', padding: 8, height: 200, overflow: 'auto' }}>
|
|
136
|
+
{logs.join('\n')}
|
|
137
|
+
</pre>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export default ${COMPONENT_NAME};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<!-- ${COMPONENT_NAME}.vue
|
|
2
|
+
Auto-generated by conversation-core/auto_adapters/frontend-spa
|
|
3
|
+
Connect to TRTC ConversationAI via skeleton REST (minimal verification version) -->
|
|
4
|
+
<script setup lang="ts">
|
|
5
|
+
import { onMounted, ref } from 'vue';
|
|
6
|
+
|
|
7
|
+
const SKELETON_BASE_URL = '${SKELETON_BASE_URL}';
|
|
8
|
+
const API_PREFIX = '${API_PREFIX}';
|
|
9
|
+
|
|
10
|
+
interface SessionCfg {
|
|
11
|
+
session_id: string;
|
|
12
|
+
sdk_app_id: number;
|
|
13
|
+
room_id: string;
|
|
14
|
+
user_id: string;
|
|
15
|
+
user_sig: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const health = ref<any>(null);
|
|
19
|
+
const session = ref<SessionCfg | null>(null);
|
|
20
|
+
const logs = ref<string[]>([]);
|
|
21
|
+
const text = ref('');
|
|
22
|
+
const trtc = ref<any>(null);
|
|
23
|
+
|
|
24
|
+
function log(msg: string) {
|
|
25
|
+
logs.value = [...logs.value.slice(-20), '[' + new Date().toLocaleTimeString() + '] ' + msg];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function callJson(path: string, body?: unknown) {
|
|
29
|
+
const resp = await fetch(SKELETON_BASE_URL + API_PREFIX + path, {
|
|
30
|
+
method: body ? 'POST' : 'GET',
|
|
31
|
+
headers: { 'Content-Type': 'application/json' },
|
|
32
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
33
|
+
});
|
|
34
|
+
if (!resp.ok) throw new Error(path + ' -> HTTP ' + resp.status);
|
|
35
|
+
return resp.json();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
onMounted(async () => {
|
|
39
|
+
try {
|
|
40
|
+
health.value = await callJson('/health');
|
|
41
|
+
} catch (e: any) { log('health failed: ' + e.message); }
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
async function start() {
|
|
45
|
+
try {
|
|
46
|
+
const cfg = await callJson('/get_config', {});
|
|
47
|
+
session.value = cfg.data;
|
|
48
|
+
log('session=' + cfg.data.session_id);
|
|
49
|
+
|
|
50
|
+
const TRTC = (await import('trtc-sdk-v5')).default;
|
|
51
|
+
const t = TRTC.create();
|
|
52
|
+
trtc.value = t;
|
|
53
|
+
await t.enterRoom({
|
|
54
|
+
roomId: Number(cfg.data.room_id),
|
|
55
|
+
sdkAppId: cfg.data.sdk_app_id,
|
|
56
|
+
userId: cfg.data.user_id,
|
|
57
|
+
userSig: cfg.data.user_sig,
|
|
58
|
+
});
|
|
59
|
+
await t.startLocalAudio();
|
|
60
|
+
log('entered room');
|
|
61
|
+
|
|
62
|
+
await callJson('/agent/start', { session_id: cfg.data.session_id, language: 'zh' });
|
|
63
|
+
log('agent started');
|
|
64
|
+
} catch (e: any) { log('start failed: ' + e.message); }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function stop() {
|
|
68
|
+
if (!session.value) return;
|
|
69
|
+
try {
|
|
70
|
+
await callJson('/agent/stop', { session_id: session.value.session_id });
|
|
71
|
+
if (trtc.value) {
|
|
72
|
+
await trtc.value.exitRoom();
|
|
73
|
+
await trtc.value.destroy();
|
|
74
|
+
trtc.value = null;
|
|
75
|
+
}
|
|
76
|
+
log('stopped');
|
|
77
|
+
session.value = null;
|
|
78
|
+
} catch (e: any) { log('stop failed: ' + e.message); }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function send() {
|
|
82
|
+
if (!session.value || !text.value.trim()) return;
|
|
83
|
+
try {
|
|
84
|
+
await callJson('/agent/control', {
|
|
85
|
+
session_id: session.value.session_id,
|
|
86
|
+
text: text.value,
|
|
87
|
+
interrupt: true,
|
|
88
|
+
});
|
|
89
|
+
log('pushed: ' + text.value);
|
|
90
|
+
text.value = '';
|
|
91
|
+
} catch (e: any) { log('push failed: ' + e.message); }
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<template>
|
|
96
|
+
<div class="voice-agent">
|
|
97
|
+
<h3>TRTC Voice Agent</h3>
|
|
98
|
+
<div class="status">
|
|
99
|
+
<span v-if="health" v-for="(v, k) in health.checks" :key="k">
|
|
100
|
+
<span :style="{ color: v.status === 'ok' ? '#1ec97c' : '#e74c3c' }">●</span> {{ k }}
|
|
101
|
+
</span>
|
|
102
|
+
<span v-else>loading...</span>
|
|
103
|
+
</div>
|
|
104
|
+
<div class="actions">
|
|
105
|
+
<button v-if="!session" @click="start">Start</button>
|
|
106
|
+
<template v-else>
|
|
107
|
+
<button @click="stop">Stop</button>
|
|
108
|
+
<input v-model="text" placeholder="type message..." />
|
|
109
|
+
<button @click="send">Send</button>
|
|
110
|
+
</template>
|
|
111
|
+
</div>
|
|
112
|
+
<pre class="logs">{{ logs.join('\n') }}</pre>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
|
|
116
|
+
<style scoped>
|
|
117
|
+
.voice-agent { font-family: system-ui; padding: 16px; }
|
|
118
|
+
.status { display: flex; gap: 16px; margin-bottom: 8px; }
|
|
119
|
+
.actions input { margin-left: 8px; padding: 4px; width: 240px; }
|
|
120
|
+
.logs { background: #111; color: #0f0; padding: 8px; height: 200px; overflow: auto; }
|
|
121
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Generic Backend Integration Guide (L2 Semi-Auto)
|
|
2
|
+
|
|
3
|
+
> When the Agent has identified your backend tech stack but auto-rendering failed, follow these steps to complete the integration.
|
|
4
|
+
> Core idea: mount a reverse proxy route in your web framework that transparently forwards `${ROUTE_PREFIX}/*`
|
|
5
|
+
> to the skeleton process's `${API_PREFIX}/*`.
|
|
6
|
+
|
|
7
|
+
## 1. Deploy conversation-core Skeleton
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd capabilities/conversation-core
|
|
11
|
+
python -m src.server # Default listens on 0.0.0.0:3000
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 2. Copy Reverse Proxy Template
|
|
15
|
+
|
|
16
|
+
| Framework | Template |
|
|
17
|
+
|:---|:---|
|
|
18
|
+
| Express | `auto_adapters/node-backend/express.js.tpl` |
|
|
19
|
+
| Koa | `auto_adapters/node-backend/koa.js.tpl` |
|
|
20
|
+
| Fastify | `auto_adapters/node-backend/fastify.js.tpl` |
|
|
21
|
+
| Spring Boot | `auto_adapters/java-backend/springboot/VoiceAgentFilter.java.tpl` |
|
|
22
|
+
| Quarkus | `auto_adapters/java-backend/quarkus/VoiceAgentFilter.java.tpl` |
|
|
23
|
+
| Flask | `auto_adapters/python-backend/flask.py.tpl` |
|
|
24
|
+
| FastAPI | `auto_adapters/python-backend/fastapi.py.tpl` |
|
|
25
|
+
| Django | `auto_adapters/python-backend/django.py.tpl` |
|
|
26
|
+
|
|
27
|
+
Replace placeholder variables (`${SKELETON_BASE_URL}` / `${API_PREFIX}` / `${ROUTE_PREFIX}`).
|
|
28
|
+
|
|
29
|
+
## 3. Register Route
|
|
30
|
+
|
|
31
|
+
Mount the router / filter / blueprint in your app entry point as described in the template's `install_hint`.
|
|
32
|
+
|
|
33
|
+
## 4. Security Checklist
|
|
34
|
+
|
|
35
|
+
- **HTTPS**: Enforce in production.
|
|
36
|
+
- **SSRF**: The skeleton address must not come directly from user input; if connecting to an internal network skeleton, first confirm with the user explicitly.
|
|
37
|
+
- **Request Body Limit**: Default `64KB`, preventing large payloads from overwhelming the ASR/LLM pipeline.
|
|
38
|
+
- **Auth**: Inject auth logic (JWT / API Key) in the reverse proxy; the skeleton itself only trusts requests from the reverse proxy source.
|
|
39
|
+
|
|
40
|
+
## 5. Verify
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
curl -s http://localhost:8000${ROUTE_PREFIX}/health | jq .status
|
|
44
|
+
# Expected: "ok"
|
|
45
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Generic Frontend Integration Guide (L2 Semi-Auto)
|
|
2
|
+
|
|
3
|
+
> When the Agent has identified your frontend tech stack but auto-rendering failed due to path conflicts or syntax errors,
|
|
4
|
+
> follow these steps to complete the integration manually.
|
|
5
|
+
|
|
6
|
+
## Step 1 · Install Dependencies
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install trtc-sdk-v5
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Step 2 · Copy Component Template
|
|
13
|
+
|
|
14
|
+
Choose the corresponding template from `auto_adapters/frontend-spa/` based on your framework:
|
|
15
|
+
|
|
16
|
+
- React / Next: `react/VoiceAgent.tsx.tpl`
|
|
17
|
+
- Vue: `vue/VoiceAgent.vue.tpl`
|
|
18
|
+
- Angular: `angular/voice-agent.component.ts.tpl`
|
|
19
|
+
|
|
20
|
+
Copy the template content to your project's components directory and replace these placeholder variables with real values:
|
|
21
|
+
|
|
22
|
+
| Placeholder | Default | Description |
|
|
23
|
+
|:---|:---|:---|
|
|
24
|
+
| `${SKELETON_BASE_URL}` | `http://localhost:3000` | Skeleton process address |
|
|
25
|
+
| `${API_PREFIX}` | `/api/v1` | Skeleton REST prefix |
|
|
26
|
+
| `${COMPONENT_NAME}` | `VoiceAgent` | Component / file name |
|
|
27
|
+
|
|
28
|
+
## Step 3 · Mount in Parent Component
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { VoiceAgent } from './components/VoiceAgent';
|
|
32
|
+
|
|
33
|
+
export default function Page() {
|
|
34
|
+
return <main><VoiceAgent /></main>;
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Step 4 · CSP & HTTPS
|
|
39
|
+
|
|
40
|
+
If CSP is deployed in production, append:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
connect-src https://${SKELETON_BASE_URL} wss://*.trtc.tencent-cloud.com;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Step 5 · Verify
|
|
47
|
+
|
|
48
|
+
Open the page; you should see three LEDs at the top: `tencent_cloud / trtc / llm`.
|
|
49
|
+
Once all are green, click `Start` to join the room and talk to the AI.
|
|
50
|
+
|
|
51
|
+
If any LED is red, check `.env` and the 3 keys based on the diagnostic JSON output in the page console.
|