@tencent-rtc/trtc-agent-skills 0.1.3 → 0.1.5
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 +15 -125
- package/README.md +7 -5
- package/README.zh.md +7 -5
- package/bin/cli.js +151 -46
- 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/chat/web/index.yaml +168 -0
- package/knowledge-base/chat/web/path-d-signals.yaml +4 -0
- package/knowledge-base/conference/web/index.yaml +143 -0
- package/knowledge-base/docs/chat/debug/GenerateTestUserSig.js +23 -0
- package/knowledge-base/docs/chat/debug/lib-generate-test-usersig.min.js +1 -0
- package/knowledge-base/docs/chat/gen-usersig.md +129 -0
- package/knowledge-base/docs/chat/product.md +61 -0
- package/knowledge-base/docs/chat/restapi.md +227 -0
- package/knowledge-base/docs/chat/sdk/android/faq.md +7 -0
- package/knowledge-base/docs/chat/sdk/android/index.md +94 -0
- package/knowledge-base/docs/chat/sdk/flutter/faq.md +7 -0
- package/knowledge-base/docs/chat/sdk/flutter/index.md +83 -0
- package/knowledge-base/docs/chat/sdk/ios/faq.md +7 -0
- package/knowledge-base/docs/chat/sdk/ios/index.md +94 -0
- package/knowledge-base/docs/chat/sdk/web/faq.md +8 -0
- package/knowledge-base/docs/chat/sdk/web/index.md +97 -0
- package/knowledge-base/docs/chat/uikit/android/index.md +28 -0
- package/knowledge-base/docs/chat/uikit/flutter/index.md +17 -0
- package/knowledge-base/docs/chat/uikit/ios/index.md +28 -0
- package/knowledge-base/docs/chat/uikit/react/index.md +6 -0
- package/knowledge-base/docs/chat/uikit/uniapp/index.md +6 -0
- package/knowledge-base/docs/chat/uikit/vue3/index.md +6 -0
- package/knowledge-base/docs/chat/webhook.md +73 -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/chat/web/at-mention.md +417 -0
- package/knowledge-base/slices/chat/web/conversation-actions.md +178 -0
- package/knowledge-base/slices/chat/web/conversation-list.md +368 -0
- package/knowledge-base/slices/chat/web/detect-integration.md +36 -0
- package/knowledge-base/slices/chat/web/detect-style.md +88 -0
- package/knowledge-base/slices/chat/web/direct-chat-entry.md +210 -0
- package/knowledge-base/slices/chat/web/login-auth.md +244 -0
- package/knowledge-base/slices/chat/web/message-base-actions.md +273 -0
- package/knowledge-base/slices/chat/web/message-input.md +209 -0
- package/knowledge-base/slices/chat/web/message-list.md +532 -0
- package/knowledge-base/slices/chat/web/send-custom-message.md +189 -0
- package/knowledge-base/slices/chat/web/send-media.md +214 -0
- package/knowledge-base/slices/chat/web/state-api-skeleton.md +60 -0
- package/knowledge-base/slices/chat/web/style-guide.md +210 -0
- 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 +4 -1
- package/skills/trtc/SKILL.md +249 -258
- 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 +166 -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/tools/kb.py +130 -0
- 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 +468 -0
- package/skills/trtc/tools/reporting_v2.py +263 -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.ja.md +199 -0
- package/skills/trtc-ai-service/README.md +199 -0
- package/skills/trtc-ai-service/README.zh-CN.md +197 -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-chat/.docs-query.yaml +8 -0
- package/skills/trtc-chat/SKILL.md +186 -0
- package/skills/trtc-chat/docs/SKILL.md +31 -0
- package/skills/trtc-chat/flows/maintenance.md +19 -0
- package/skills/trtc-chat/flows/onboarding.md +79 -0
- package/skills/trtc-chat/references/01-detect-project.md +136 -0
- package/skills/trtc-chat/references/02-path-a-questions.md +182 -0
- package/skills/trtc-chat/references/02-path-a-scaffold-template.md +59 -0
- package/skills/trtc-chat/references/02-path-a-script.md +266 -0
- package/skills/trtc-chat/references/02-path-a-templates.md +159 -0
- package/skills/trtc-chat/references/03-path-b-script.md +226 -0
- package/skills/trtc-chat/references/04-path-c-script.md +95 -0
- package/skills/trtc-chat/references/04-uikit-redirect.md +32 -0
- package/skills/trtc-chat/references/05-path-d-script.md +647 -0
- package/skills/trtc-chat/references/05-slice-loading.md +139 -0
- package/skills/trtc-chat/references/06-a-defensive-coding.md +139 -0
- package/skills/trtc-chat/references/06-hard-rules.md +190 -0
- package/skills/trtc-chat/references/08-state-config.md +229 -0
- package/skills/trtc-chat/references/09-troubleshoot.md +91 -0
- package/skills/trtc-chat/references/10-references-index.md +63 -0
- package/skills/trtc-chat/references/11-what-to-do-next-template.md +338 -0
- package/skills/trtc-chat/references/12-page-composition.md +73 -0
- package/skills/trtc-chat/references/13-reporting.md +128 -0
- package/skills/trtc-chat/references/14-official-docs.md +169 -0
- package/skills/trtc-chat/references/execution-units.yaml +27 -0
- package/skills/trtc-chat/references/vue3.md +104 -0
- package/skills/trtc-chat/tests/test_chat_bundle_contract.py +293 -0
- package/skills/trtc-chat/tools/__init__.py +5 -0
- package/skills/trtc-chat/tools/_delegate.py +32 -0
- package/skills/trtc-chat/tools/flow.py +8 -0
- package/skills/trtc-chat/tools/kb.py +8 -0
- package/skills/trtc-chat/tools/reporting_v2.py +8 -0
- package/skills/trtc-chat/tools/session.py +8 -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,90 @@
|
|
|
1
|
+
"""TLS-SIG-API-v2 UserSig generator (pure Python, no third-party dependencies).
|
|
2
|
+
|
|
3
|
+
TRTC room authentication uses SDKAppID + SDKSecretKey to sign the UserId via HMAC-SHA256,
|
|
4
|
+
then compresses with zlib + base64url encodes to produce the UserSig. This implementation
|
|
5
|
+
matches the official ``TLSSigAPIv2`` behavior, enabling usage in a minimal skeleton without
|
|
6
|
+
additional SDKs.
|
|
7
|
+
|
|
8
|
+
Reference: https://cloud.tencent.com/document/product/647/17275
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import base64
|
|
13
|
+
import hashlib
|
|
14
|
+
import hmac
|
|
15
|
+
import json
|
|
16
|
+
import time
|
|
17
|
+
import zlib
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _base64_encode(data: bytes) -> str:
|
|
21
|
+
s = base64.b64encode(data).decode("utf-8")
|
|
22
|
+
# TRTC custom base64url: + → *, / → -, = → _
|
|
23
|
+
return s.replace("+", "*").replace("/", "-").replace("=", "_")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _hmac_sha256(
|
|
27
|
+
sdk_app_id: int,
|
|
28
|
+
user_id: str,
|
|
29
|
+
secret_key: str,
|
|
30
|
+
current_ts: int,
|
|
31
|
+
expire: int,
|
|
32
|
+
base64_userbuf: str | None = None,
|
|
33
|
+
) -> str:
|
|
34
|
+
raw_to_sign = (
|
|
35
|
+
f"TLS.identifier:{user_id}\n"
|
|
36
|
+
f"TLS.sdkappid:{sdk_app_id}\n"
|
|
37
|
+
f"TLS.time:{current_ts}\n"
|
|
38
|
+
f"TLS.expire:{expire}\n"
|
|
39
|
+
)
|
|
40
|
+
if base64_userbuf is not None:
|
|
41
|
+
raw_to_sign += f"TLS.userbuf:{base64_userbuf}\n"
|
|
42
|
+
digest = hmac.new(
|
|
43
|
+
secret_key.encode("utf-8"),
|
|
44
|
+
raw_to_sign.encode("utf-8"),
|
|
45
|
+
hashlib.sha256,
|
|
46
|
+
).digest()
|
|
47
|
+
return base64.b64encode(digest).decode("utf-8")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def gen_user_sig(
|
|
51
|
+
sdk_app_id: int,
|
|
52
|
+
sdk_secret_key: str,
|
|
53
|
+
user_id: str,
|
|
54
|
+
expire_seconds: int = 86400,
|
|
55
|
+
) -> str:
|
|
56
|
+
"""Generate a UserSig.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
sdk_app_id: TRTC SDKAppID (integer).
|
|
60
|
+
sdk_secret_key: TRTC SDKSecretKey.
|
|
61
|
+
user_id: User identifier within the room; must remain stable.
|
|
62
|
+
expire_seconds: Validity duration in seconds, default 24 hours.
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
A UserSig string ready for use with the TRTC Web SDK for room entry.
|
|
66
|
+
"""
|
|
67
|
+
if not sdk_app_id or not sdk_secret_key:
|
|
68
|
+
raise ValueError("sdk_app_id and sdk_secret_key are required")
|
|
69
|
+
if not user_id:
|
|
70
|
+
raise ValueError("user_id is required")
|
|
71
|
+
|
|
72
|
+
current_ts = int(time.time())
|
|
73
|
+
sig = _hmac_sha256(
|
|
74
|
+
sdk_app_id=sdk_app_id,
|
|
75
|
+
user_id=user_id,
|
|
76
|
+
secret_key=sdk_secret_key,
|
|
77
|
+
current_ts=current_ts,
|
|
78
|
+
expire=expire_seconds,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
payload = {
|
|
82
|
+
"TLS.ver": "2.0",
|
|
83
|
+
"TLS.identifier": str(user_id),
|
|
84
|
+
"TLS.sdkappid": int(sdk_app_id),
|
|
85
|
+
"TLS.expire": int(expire_seconds),
|
|
86
|
+
"TLS.time": int(current_ts),
|
|
87
|
+
"TLS.sig": sig,
|
|
88
|
+
}
|
|
89
|
+
compressed = zlib.compress(json.dumps(payload).encode("utf-8"))
|
|
90
|
+
return _base64_encode(compressed)
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"""Skeleton core pipeline unit tests.
|
|
2
|
+
|
|
3
|
+
Verification targets:
|
|
4
|
+
- 3-key credential encapsulation loads correctly from environment variables
|
|
5
|
+
- I/O modality channel selection and degradation strategy work correctly
|
|
6
|
+
- Log redaction filter masks common sensitive fields
|
|
7
|
+
- UserSig generator produces non-empty, reasonably-sized signatures for valid input
|
|
8
|
+
- Skeleton source code contains no hardcoded business logic (FAQ / industry prompts etc.)
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import logging
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
import pytest
|
|
18
|
+
|
|
19
|
+
_HERE = Path(__file__).resolve().parent
|
|
20
|
+
_CORE = _HERE.parent
|
|
21
|
+
sys.path.insert(0, str(_CORE))
|
|
22
|
+
|
|
23
|
+
from src.credentials import load_from_env # noqa: E402
|
|
24
|
+
from src.log_filter import RedactingFilter # noqa: E402
|
|
25
|
+
from src.modality import Channel, IoModality, from_dict # noqa: E402
|
|
26
|
+
from src.usersig import gen_user_sig # noqa: E402
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# ---------------------------------------------------------------------------
|
|
30
|
+
# credentials
|
|
31
|
+
# ---------------------------------------------------------------------------
|
|
32
|
+
def test_credentials_from_env(monkeypatch):
|
|
33
|
+
monkeypatch.setenv("TENCENT_CLOUD_SECRET_ID", "AKID_xxx")
|
|
34
|
+
monkeypatch.setenv("TENCENT_CLOUD_SECRET_KEY", "secret_xxx")
|
|
35
|
+
monkeypatch.setenv("TRTC_SDK_APP_ID", "1400000000")
|
|
36
|
+
monkeypatch.setenv("TRTC_SDK_SECRET_KEY", "trtc_secret")
|
|
37
|
+
monkeypatch.setenv("LLM_API_KEY", "sk-xxx")
|
|
38
|
+
|
|
39
|
+
cred = load_from_env()
|
|
40
|
+
assert cred.fully_configured is True
|
|
41
|
+
assert cred.tencent_cloud.secret_id == "AKID_xxx"
|
|
42
|
+
assert cred.trtc.sdk_app_id == 1400000000
|
|
43
|
+
assert cred.llm.model == "gpt-4o-mini" # default
|
|
44
|
+
assert cred.missing() == []
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_credentials_missing(monkeypatch):
|
|
48
|
+
for k in (
|
|
49
|
+
"TENCENT_CLOUD_SECRET_ID", "TENCENT_CLOUD_SECRET_KEY",
|
|
50
|
+
"TRTC_SDK_APP_ID", "TRTC_SDK_SECRET_KEY", "LLM_API_KEY",
|
|
51
|
+
):
|
|
52
|
+
monkeypatch.delenv(k, raising=False)
|
|
53
|
+
cred = load_from_env()
|
|
54
|
+
assert cred.fully_configured is False
|
|
55
|
+
assert set(cred.missing()) == {"tencent_cloud", "trtc", "llm"}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# ---------------------------------------------------------------------------
|
|
59
|
+
# modality
|
|
60
|
+
# ---------------------------------------------------------------------------
|
|
61
|
+
def test_modality_default_resolve():
|
|
62
|
+
mod = IoModality()
|
|
63
|
+
assert mod.resolve_input_channel(voice_available=True) == Channel.VOICE_INPUT
|
|
64
|
+
assert mod.resolve_output_channel(voice_available=True) == Channel.VOICE_OUTPUT
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_modality_fallback_to_text_when_voice_unavailable():
|
|
68
|
+
mod = IoModality()
|
|
69
|
+
assert mod.resolve_input_channel(voice_available=False) == Channel.TEXT_INPUT
|
|
70
|
+
assert mod.resolve_output_channel(voice_available=False) == Channel.TEXT_OUTPUT
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_modality_text_only_scenario():
|
|
74
|
+
mod = from_dict(
|
|
75
|
+
{
|
|
76
|
+
"voice_input": {"enabled": False},
|
|
77
|
+
"voice_output": {"enabled": False},
|
|
78
|
+
"text_input": {"enabled": True},
|
|
79
|
+
"text_output": {"enabled": True},
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
assert mod.resolve_input_channel(voice_available=True) == Channel.TEXT_INPUT
|
|
83
|
+
assert mod.resolve_output_channel(voice_available=True) == Channel.TEXT_OUTPUT
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_modality_all_disabled_raises():
|
|
87
|
+
mod = from_dict(
|
|
88
|
+
{
|
|
89
|
+
"voice_input": {"enabled": False},
|
|
90
|
+
"voice_output": {"enabled": False},
|
|
91
|
+
"text_input": {"enabled": False},
|
|
92
|
+
"text_output": {"enabled": False},
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
with pytest.raises(RuntimeError):
|
|
96
|
+
mod.resolve_input_channel(voice_available=False)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# ---------------------------------------------------------------------------
|
|
100
|
+
# log redaction (P0 security)
|
|
101
|
+
# ---------------------------------------------------------------------------
|
|
102
|
+
def test_log_redacting_filter():
|
|
103
|
+
rec = logging.LogRecord(
|
|
104
|
+
name="t", level=logging.INFO, pathname="", lineno=1,
|
|
105
|
+
msg="boot with secret_key=ABCDEFGHIJKLMNOP and api_key: sk-1234567890abcdef",
|
|
106
|
+
args=(), exc_info=None,
|
|
107
|
+
)
|
|
108
|
+
flt = RedactingFilter()
|
|
109
|
+
assert flt.filter(rec) is True
|
|
110
|
+
masked = rec.getMessage()
|
|
111
|
+
assert "ABCDEFGHIJKLMNOP" not in masked
|
|
112
|
+
assert "sk-1234567890abcdef" not in masked
|
|
113
|
+
assert "secret_key" in masked # Field name preserved
|
|
114
|
+
assert "api_key" in masked
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
# ---------------------------------------------------------------------------
|
|
118
|
+
# usersig
|
|
119
|
+
# ---------------------------------------------------------------------------
|
|
120
|
+
def test_usersig_basic():
|
|
121
|
+
sig = gen_user_sig(
|
|
122
|
+
sdk_app_id=1400000000,
|
|
123
|
+
sdk_secret_key="dummy_secret_for_unit_test",
|
|
124
|
+
user_id="user_123",
|
|
125
|
+
expire_seconds=60,
|
|
126
|
+
)
|
|
127
|
+
assert isinstance(sig, str) and len(sig) > 32
|
|
128
|
+
# TRTC custom base64url charset (+ → *, / → -, = → _)
|
|
129
|
+
allowed = set(
|
|
130
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789*-_"
|
|
131
|
+
)
|
|
132
|
+
assert all(c in allowed for c in sig)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def test_usersig_input_validation():
|
|
136
|
+
with pytest.raises(ValueError):
|
|
137
|
+
gen_user_sig(0, "k", "user")
|
|
138
|
+
with pytest.raises(ValueError):
|
|
139
|
+
gen_user_sig(1400000000, "", "user")
|
|
140
|
+
with pytest.raises(ValueError):
|
|
141
|
+
gen_user_sig(1400000000, "k", "")
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
# ---------------------------------------------------------------------------
|
|
145
|
+
# Skeleton purity: source code should not contain industry keywords
|
|
146
|
+
# (e-commerce / orders / restaurant / reservation etc.).
|
|
147
|
+
# Check target: after stripping comments and docstrings, actual code must not contain hardcoded business logic.
|
|
148
|
+
# ---------------------------------------------------------------------------
|
|
149
|
+
import ast
|
|
150
|
+
import io
|
|
151
|
+
import tokenize
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _strip_comments_and_docstrings(source: str) -> str:
|
|
155
|
+
"""Return code after stripping comments and docstrings."""
|
|
156
|
+
# 1) Remove # comments
|
|
157
|
+
out_tokens = []
|
|
158
|
+
g = tokenize.generate_tokens(io.StringIO(source).readline)
|
|
159
|
+
for tok_type, tok_val, *_ in g:
|
|
160
|
+
if tok_type == tokenize.COMMENT:
|
|
161
|
+
continue
|
|
162
|
+
out_tokens.append((tok_type, tok_val))
|
|
163
|
+
no_comments = tokenize.untokenize(out_tokens)
|
|
164
|
+
# 2) Remove docstrings: rewrite AST without Expr(Constant(str)) nodes
|
|
165
|
+
try:
|
|
166
|
+
tree = ast.parse(no_comments)
|
|
167
|
+
except SyntaxError:
|
|
168
|
+
return no_comments
|
|
169
|
+
|
|
170
|
+
class _DocstringRemover(ast.NodeTransformer):
|
|
171
|
+
def _strip(self, node):
|
|
172
|
+
if (
|
|
173
|
+
node.body
|
|
174
|
+
and isinstance(node.body[0], ast.Expr)
|
|
175
|
+
and isinstance(node.body[0].value, ast.Constant)
|
|
176
|
+
and isinstance(node.body[0].value.value, str)
|
|
177
|
+
):
|
|
178
|
+
node.body = node.body[1:] or [ast.Pass()]
|
|
179
|
+
return node
|
|
180
|
+
|
|
181
|
+
def visit_Module(self, node):
|
|
182
|
+
self.generic_visit(node)
|
|
183
|
+
return self._strip(node)
|
|
184
|
+
|
|
185
|
+
def visit_FunctionDef(self, node):
|
|
186
|
+
self.generic_visit(node)
|
|
187
|
+
return self._strip(node)
|
|
188
|
+
|
|
189
|
+
def visit_AsyncFunctionDef(self, node):
|
|
190
|
+
self.generic_visit(node)
|
|
191
|
+
return self._strip(node)
|
|
192
|
+
|
|
193
|
+
def visit_ClassDef(self, node):
|
|
194
|
+
self.generic_visit(node)
|
|
195
|
+
return self._strip(node)
|
|
196
|
+
|
|
197
|
+
cleaned = _DocstringRemover().visit(tree)
|
|
198
|
+
ast.fix_missing_locations(cleaned)
|
|
199
|
+
return ast.unparse(cleaned)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def test_skeleton_purity_no_business_keywords():
|
|
203
|
+
forbidden = []
|
|
204
|
+
forbidden = [
|
|
205
|
+
|
|
206
|
+
"FAQ",
|
|
207
|
+
]
|
|
208
|
+
src_dir = _CORE / "src"
|
|
209
|
+
offenders = []
|
|
210
|
+
for py in src_dir.glob("*.py"):
|
|
211
|
+
raw = py.read_text(encoding="utf-8")
|
|
212
|
+
code_only = _strip_comments_and_docstrings(raw)
|
|
213
|
+
for kw in forbidden:
|
|
214
|
+
if kw in code_only:
|
|
215
|
+
offenders.append((py.name, kw))
|
|
216
|
+
assert offenders == [], f"Skeleton contains business keywords: {offenders}"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Web Demo · 3-Step Quick Start Guide
|
|
2
|
+
|
|
3
|
+
> This directory is the minimal runnable verification page for conversation-core, **containing no business logic**.
|
|
4
|
+
|
|
5
|
+
## Three Steps to Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. Install dependencies (first time)
|
|
9
|
+
pip install -r capabilities/conversation-core/requirements.txt
|
|
10
|
+
|
|
11
|
+
# 2. Configure three keys (interactive guide)
|
|
12
|
+
python scripts/setup-credentials.py
|
|
13
|
+
|
|
14
|
+
# 3. Launch the Demo
|
|
15
|
+
bash start.sh
|
|
16
|
+
# or: cd capabilities/conversation-core && python -m src.server
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Open your browser and visit <http://localhost:3000>.
|
|
20
|
+
|
|
21
|
+
## Verification Checklist
|
|
22
|
+
|
|
23
|
+
After opening the page, check in the following order:
|
|
24
|
+
|
|
25
|
+
1. The three indicator LEDs in the top status bar go from `gray` → `yellow (pending)` → `green`.
|
|
26
|
+
2. Once all three LEDs are green, the "Start Conversation" button becomes clickable.
|
|
27
|
+
3. Clicking it automatically calls `/api/v1/get_config` and `/api/v1/agent/start`; the console will output `task_id`.
|
|
28
|
+
4. Send any text in the text input box; you can see the ServerPushText injection record in the TRTC console.
|
|
29
|
+
|
|
30
|
+
## Troubleshooting
|
|
31
|
+
|
|
32
|
+
Click "Recheck" in the top-right corner to force a connectivity refresh. On failure, the browser console will output structured diagnostics, e.g.:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"tencent_cloud": { "status": "ok", "latency_ms": 120 },
|
|
37
|
+
"trtc": { "status": "ok", "latency_ms": 12 },
|
|
38
|
+
"llm": { "status": "failed", "error_code": "E003", "detail": "unauthorized: 401" }
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Cross-reference the `error_code` with the `INTEGRATION.md` troubleshooting dictionary to locate the issue.
|
|
43
|
+
|
|
44
|
+
## Not in Scope for This Demo
|
|
45
|
+
|
|
46
|
+
- Real audio capture and TRTC RTC room entry (handled by Phase 2 `frontend-spa` adapter or the integrator)
|
|
47
|
+
- Business knowledge base / FAQ / tool calling (overlaid by standalone capability packages)
|
|
48
|
+
- Digital human rendering, handoff, session summaries, etc. (overlaid by standalone capability packages)
|