@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,101 @@
|
|
|
1
|
+
"""Tech stack detection + three-tier fallback tests."""
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import tempfile
|
|
6
|
+
import unittest
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
_ROOT = Path(__file__).resolve().parent.parent
|
|
10
|
+
sys.path.insert(0, str(_ROOT))
|
|
11
|
+
|
|
12
|
+
from scripts.lib import stack_detector as sd
|
|
13
|
+
from scripts.lib import degrader as dg
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _mkproj(files: dict) -> Path:
|
|
17
|
+
tmp = Path(tempfile.mkdtemp(prefix="stack_"))
|
|
18
|
+
for name, content in files.items():
|
|
19
|
+
p = tmp / name
|
|
20
|
+
p.parent.mkdir(parents=True, exist_ok=True)
|
|
21
|
+
p.write_text(content, encoding="utf-8")
|
|
22
|
+
return tmp
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class StackDetectorTests(unittest.TestCase):
|
|
26
|
+
|
|
27
|
+
def test_react_project(self):
|
|
28
|
+
proj = _mkproj({
|
|
29
|
+
"package.json": json.dumps({"dependencies": {"react": "^18.2.0", "react-dom": "^18.2.0"}}),
|
|
30
|
+
})
|
|
31
|
+
res = sd.detect(proj)
|
|
32
|
+
self.assertEqual(res.primary, "react")
|
|
33
|
+
self.assertIn("react", res.candidates)
|
|
34
|
+
|
|
35
|
+
def test_next_priority_over_react(self):
|
|
36
|
+
proj = _mkproj({
|
|
37
|
+
"package.json": json.dumps({"dependencies": {"next": "^14", "react": "^18"}}),
|
|
38
|
+
})
|
|
39
|
+
res = sd.detect(proj)
|
|
40
|
+
self.assertEqual(res.primary, "next")
|
|
41
|
+
|
|
42
|
+
def test_express_node_backend(self):
|
|
43
|
+
proj = _mkproj({"package.json": json.dumps({"dependencies": {"express": "^4"}})})
|
|
44
|
+
self.assertEqual(sd.detect(proj).primary, "express")
|
|
45
|
+
|
|
46
|
+
def test_spring_boot_pom(self):
|
|
47
|
+
proj = _mkproj({"pom.xml": "<artifactId>spring-boot-starter-web</artifactId>"})
|
|
48
|
+
self.assertEqual(sd.detect(proj).primary, "spring-boot")
|
|
49
|
+
|
|
50
|
+
def test_python_fastapi_priority_over_flask(self):
|
|
51
|
+
proj = _mkproj({"requirements.txt": "fastapi==0.110\nflask==3.0\n"})
|
|
52
|
+
self.assertEqual(sd.detect(proj).primary, "fastapi")
|
|
53
|
+
|
|
54
|
+
def test_unknown_returns_none(self):
|
|
55
|
+
proj = _mkproj({"random.txt": "hello"})
|
|
56
|
+
self.assertIsNone(sd.detect(proj).primary)
|
|
57
|
+
|
|
58
|
+
def test_match_adapter(self):
|
|
59
|
+
adapters = [
|
|
60
|
+
{"tech_stack": ["react", "vue"], "adapter": "frontend-spa"},
|
|
61
|
+
{"tech_stack": ["express"], "adapter": "node-backend"},
|
|
62
|
+
]
|
|
63
|
+
self.assertEqual(sd.match_adapter("react", adapters), "frontend-spa")
|
|
64
|
+
self.assertEqual(sd.match_adapter("express", adapters), "node-backend")
|
|
65
|
+
self.assertIsNone(sd.match_adapter("unknown", adapters))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class DegraderTests(unittest.TestCase):
|
|
69
|
+
|
|
70
|
+
def test_l1_when_match_and_codegen_ok(self):
|
|
71
|
+
d = dg.decide("react", "frontend-spa", True)
|
|
72
|
+
self.assertEqual(d.level, dg.DegradeLevel.L1_AUTO)
|
|
73
|
+
|
|
74
|
+
def test_l2_when_match_but_codegen_failed(self):
|
|
75
|
+
fb = {"guided_templates": ["x.md"]}
|
|
76
|
+
d = dg.decide("react", "frontend-spa", False, fallback=fb, code_gen_error="conflict")
|
|
77
|
+
self.assertEqual(d.level, dg.DegradeLevel.L2_GUIDED)
|
|
78
|
+
self.assertIn("x.md", d.artifacts)
|
|
79
|
+
self.assertIn("conflict", d.reason)
|
|
80
|
+
|
|
81
|
+
def test_l3_when_no_tech_stack(self):
|
|
82
|
+
fb = {"manual_api": {"rest_endpoint": "/api/v1", "sdk_packages": [{"npm": "x"}]}}
|
|
83
|
+
d = dg.decide(None, None, False, fallback=fb)
|
|
84
|
+
self.assertEqual(d.level, dg.DegradeLevel.L3_MANUAL)
|
|
85
|
+
self.assertTrue(any("rest_endpoint:/api/v1" in a for a in d.artifacts))
|
|
86
|
+
self.assertTrue(any("sdk:npm:x" in a for a in d.artifacts))
|
|
87
|
+
|
|
88
|
+
def test_l3_when_stack_known_but_no_adapter(self):
|
|
89
|
+
d = dg.decide("svelte", None, False, fallback={"manual_api": {}})
|
|
90
|
+
self.assertEqual(d.level, dg.DegradeLevel.L3_MANUAL)
|
|
91
|
+
self.assertIn("no adapter for tech_stack=svelte", d.reason)
|
|
92
|
+
|
|
93
|
+
def test_channel_matrix_has_16_rows(self):
|
|
94
|
+
rows = dg.channel_combinations_matrix()
|
|
95
|
+
self.assertEqual(len(rows), 16)
|
|
96
|
+
verdicts = {r["verdict"] for r in rows}
|
|
97
|
+
self.assertIn("silent_wait", verdicts)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
if __name__ == "__main__":
|
|
101
|
+
unittest.main()
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"""Phase 3 Stage 6: scripts/verify-credentials.py + scripts/lib/credential_validators tests.
|
|
2
|
+
|
|
3
|
+
Coverage targets:
|
|
4
|
+
- Unit: ValidationResult / BatchResult / load_dotenv / hint error code mapping
|
|
5
|
+
- Integration (subprocess): run verify-credentials.py in a **clean environment**
|
|
6
|
+
→ All three keys unconfigured → must output valid JSON with error == "E000" and non-zero exit code
|
|
7
|
+
- Unit (mock all three services): via patch of ``health.check_*`` verify
|
|
8
|
+
validate_tencent / validate_trtc / validate_llm / validate_all chain
|
|
9
|
+
returned ValidationResult fields match ``{ok, type, error, message, latency_ms}``
|
|
10
|
+
|
|
11
|
+
Red lines (aligned with SKILL.md §12 Tool Whitelist):
|
|
12
|
+
- Verification script **does not** accept keys as CLI arguments → tests only use .env and patch
|
|
13
|
+
- Output JSON must not contain credential plaintext (latency_ms / error code only)
|
|
14
|
+
"""
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import os
|
|
19
|
+
import subprocess
|
|
20
|
+
import sys
|
|
21
|
+
import tempfile
|
|
22
|
+
import unittest
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
from unittest.mock import patch
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
_ROOT = Path(__file__).resolve().parent.parent
|
|
28
|
+
sys.path.insert(0, str(_ROOT))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _run_cli(env_extra=None, args=None):
|
|
32
|
+
"""Fork a verify-credentials.py subprocess in an isolated environment.
|
|
33
|
+
|
|
34
|
+
Explicitly empties all three Key env variables to prevent .env file fallback overrides
|
|
35
|
+
(load_dotenv uses setdefault; empty strings in env prevent real values from .env injection).
|
|
36
|
+
"""
|
|
37
|
+
env = {
|
|
38
|
+
"PATH": os.environ.get("PATH", ""),
|
|
39
|
+
"HOME": os.environ.get("HOME", ""),
|
|
40
|
+
"PYTHONPATH": str(_ROOT),
|
|
41
|
+
# Force clear all candidate env variables to ensure ``configured`` is False
|
|
42
|
+
"TENCENT_CLOUD_SECRET_ID": "",
|
|
43
|
+
"TENCENT_CLOUD_SECRET_KEY": "",
|
|
44
|
+
"TRTC_SDK_APP_ID": "",
|
|
45
|
+
"TRTC_SDK_SECRET_KEY": "",
|
|
46
|
+
"LLM_API_KEY": "",
|
|
47
|
+
"LLM_API_URL": "",
|
|
48
|
+
"LLM_MODEL": "",
|
|
49
|
+
}
|
|
50
|
+
if env_extra:
|
|
51
|
+
env.update(env_extra)
|
|
52
|
+
cmd = [sys.executable, str(_ROOT / "scripts" / "verify-credentials.py")]
|
|
53
|
+
if args:
|
|
54
|
+
cmd.extend(args)
|
|
55
|
+
proc = subprocess.run(
|
|
56
|
+
cmd,
|
|
57
|
+
cwd=str(_ROOT),
|
|
58
|
+
capture_output=True,
|
|
59
|
+
text=True,
|
|
60
|
+
timeout=20,
|
|
61
|
+
env=env,
|
|
62
|
+
)
|
|
63
|
+
return proc
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class CredentialValidatorsUnitTests(unittest.TestCase):
|
|
67
|
+
"""Pure unit tests for the credential_validators module (no network calls)."""
|
|
68
|
+
|
|
69
|
+
def test_validation_result_to_dict_keys(self):
|
|
70
|
+
from scripts.lib.credential_validators import ValidationResult
|
|
71
|
+
r = ValidationResult(ok=True, type="tencent", message="ok", latency_ms=42)
|
|
72
|
+
d = r.to_dict()
|
|
73
|
+
self.assertSetEqual(
|
|
74
|
+
set(d.keys()), {"ok", "type", "error", "message", "latency_ms"}
|
|
75
|
+
)
|
|
76
|
+
self.assertTrue(d["ok"])
|
|
77
|
+
self.assertEqual(d["type"], "tencent")
|
|
78
|
+
|
|
79
|
+
def test_batch_result_aggregates(self):
|
|
80
|
+
from scripts.lib.credential_validators import BatchResult, ValidationResult
|
|
81
|
+
b = BatchResult(
|
|
82
|
+
ok=False,
|
|
83
|
+
items=[
|
|
84
|
+
ValidationResult(ok=True, type="tencent"),
|
|
85
|
+
ValidationResult(ok=False, type="trtc", error="E002", message="fail"),
|
|
86
|
+
ValidationResult(ok=True, type="llm"),
|
|
87
|
+
],
|
|
88
|
+
)
|
|
89
|
+
d = b.to_dict()
|
|
90
|
+
self.assertEqual(d["type"], "all")
|
|
91
|
+
self.assertFalse(d["ok"])
|
|
92
|
+
self.assertEqual(len(d["items"]), 3)
|
|
93
|
+
self.assertEqual(d["items"][1]["error"], "E002")
|
|
94
|
+
|
|
95
|
+
def test_hint_returns_known_codes(self):
|
|
96
|
+
from scripts.lib.credential_validators import hint
|
|
97
|
+
self.assertIn("腾讯云", hint("E001"))
|
|
98
|
+
self.assertIn("TRTC", hint("E002"))
|
|
99
|
+
self.assertIn("LLM", hint("E003"))
|
|
100
|
+
# Unknown error code → empty string
|
|
101
|
+
self.assertEqual(hint("E999"), "")
|
|
102
|
+
|
|
103
|
+
def test_load_dotenv_reads_kv(self):
|
|
104
|
+
from scripts.lib.credential_validators import load_dotenv
|
|
105
|
+
with tempfile.TemporaryDirectory() as td:
|
|
106
|
+
envf = Path(td) / ".env"
|
|
107
|
+
envf.write_text(
|
|
108
|
+
"FAKE_KEY_FOR_TEST=hello\n# comment\nFAKE_QUOTED=\"world\"\n",
|
|
109
|
+
encoding="utf-8",
|
|
110
|
+
)
|
|
111
|
+
try:
|
|
112
|
+
# Clear same-name process-level vars to ensure reading from file
|
|
113
|
+
os.environ.pop("FAKE_KEY_FOR_TEST", None)
|
|
114
|
+
os.environ.pop("FAKE_QUOTED", None)
|
|
115
|
+
seen = load_dotenv(envf)
|
|
116
|
+
self.assertEqual(seen.get("FAKE_KEY_FOR_TEST"), "hello")
|
|
117
|
+
self.assertEqual(seen.get("FAKE_QUOTED"), "world")
|
|
118
|
+
self.assertEqual(os.environ.get("FAKE_KEY_FOR_TEST"), "hello")
|
|
119
|
+
finally:
|
|
120
|
+
os.environ.pop("FAKE_KEY_FOR_TEST", None)
|
|
121
|
+
os.environ.pop("FAKE_QUOTED", None)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class VerifyCredentialsCliEmptyEnvTests(unittest.TestCase):
|
|
125
|
+
"""Subprocess: verify-credentials.py behavior in a clean environment (no .env, no keys)."""
|
|
126
|
+
|
|
127
|
+
def setUp(self):
|
|
128
|
+
# Use a clean tmp directory as cwd stand-in: point --env-file to a non-existent path
|
|
129
|
+
# while eliminating the chance of hitting the repo root .env / capabilities/conversation-core/.env
|
|
130
|
+
self.tmp = tempfile.TemporaryDirectory()
|
|
131
|
+
self.empty_env = Path(self.tmp.name) / "no.env"
|
|
132
|
+
self.empty_env.write_text("# empty\n", encoding="utf-8")
|
|
133
|
+
|
|
134
|
+
def tearDown(self):
|
|
135
|
+
self.tmp.cleanup()
|
|
136
|
+
|
|
137
|
+
def _run(self, *extra_args):
|
|
138
|
+
return _run_cli(args=["--env-file", str(self.empty_env), *extra_args])
|
|
139
|
+
|
|
140
|
+
def test_tencent_empty_returns_e000(self):
|
|
141
|
+
proc = self._run("--type", "tencent")
|
|
142
|
+
self.assertNotEqual(proc.returncode, 0, proc.stderr)
|
|
143
|
+
out = json.loads(proc.stdout.strip())
|
|
144
|
+
self.assertFalse(out["ok"])
|
|
145
|
+
self.assertEqual(out["type"], "tencent")
|
|
146
|
+
self.assertEqual(out["error"], "E000")
|
|
147
|
+
self.assertSetEqual(
|
|
148
|
+
set(out.keys()), {"ok", "type", "error", "message", "latency_ms"}
|
|
149
|
+
)
|
|
150
|
+
# Output must not contain real keys (empty_env also ensures this)
|
|
151
|
+
self.assertNotIn("AKID", proc.stdout)
|
|
152
|
+
self.assertNotIn("AKID", proc.stderr)
|
|
153
|
+
|
|
154
|
+
def test_trtc_empty_returns_e000(self):
|
|
155
|
+
proc = self._run("--type", "trtc")
|
|
156
|
+
out = json.loads(proc.stdout.strip())
|
|
157
|
+
self.assertFalse(out["ok"])
|
|
158
|
+
self.assertEqual(out["type"], "trtc")
|
|
159
|
+
self.assertEqual(out["error"], "E000")
|
|
160
|
+
|
|
161
|
+
def test_llm_empty_returns_e000(self):
|
|
162
|
+
proc = self._run("--type", "llm")
|
|
163
|
+
out = json.loads(proc.stdout.strip())
|
|
164
|
+
self.assertFalse(out["ok"])
|
|
165
|
+
self.assertEqual(out["type"], "llm")
|
|
166
|
+
self.assertEqual(out["error"], "E000")
|
|
167
|
+
|
|
168
|
+
def test_all_empty_returns_three_items(self):
|
|
169
|
+
proc = self._run("--type", "all")
|
|
170
|
+
self.assertNotEqual(proc.returncode, 0)
|
|
171
|
+
out = json.loads(proc.stdout.strip())
|
|
172
|
+
self.assertEqual(out["type"], "all")
|
|
173
|
+
self.assertFalse(out["ok"])
|
|
174
|
+
types = {item["type"] for item in out["items"]}
|
|
175
|
+
self.assertSetEqual(types, {"tencent", "trtc", "llm"})
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class VerifyCredentialsMockedNetworkTests(unittest.TestCase):
|
|
179
|
+
"""Patch health.check_* to simulate success / failure responses from all three services."""
|
|
180
|
+
|
|
181
|
+
def setUp(self):
|
|
182
|
+
# Inject fake keys at process level (only to make ``configured`` return True)
|
|
183
|
+
self._keys = {
|
|
184
|
+
"TENCENT_CLOUD_SECRET_ID": "AKID_TEST_FAKE_FAKE_FAKE_FAKE_FAKE_X",
|
|
185
|
+
"TENCENT_CLOUD_SECRET_KEY": "FakeKeyFakeKeyFakeKeyFakeKeyFakeKey",
|
|
186
|
+
"TRTC_SDK_APP_ID": "1400000001",
|
|
187
|
+
"TRTC_SDK_SECRET_KEY": "FakeTRTCSdkSecretKeyFakeTRTCSdkSecretKey",
|
|
188
|
+
"LLM_API_KEY": "sk-fake-test-key",
|
|
189
|
+
"LLM_API_URL": "https://api.openai.example/v1/chat/completions",
|
|
190
|
+
"LLM_MODEL": "gpt-test",
|
|
191
|
+
"LLM_TYPE": "openai",
|
|
192
|
+
}
|
|
193
|
+
self._saved = {k: os.environ.get(k) for k in self._keys}
|
|
194
|
+
for k, v in self._keys.items():
|
|
195
|
+
os.environ[k] = v
|
|
196
|
+
|
|
197
|
+
def tearDown(self):
|
|
198
|
+
for k, prev in self._saved.items():
|
|
199
|
+
if prev is None:
|
|
200
|
+
os.environ.pop(k, None)
|
|
201
|
+
else:
|
|
202
|
+
os.environ[k] = prev
|
|
203
|
+
|
|
204
|
+
def _import_health(self):
|
|
205
|
+
"""Explicitly import conversation-core's health module for patching.
|
|
206
|
+
|
|
207
|
+
Clean all cached ``src.*`` modules (side effect from test_handoff_ports / test_kb_ports),
|
|
208
|
+
and push conversation-core to the top of sys.path so ``src`` resolves back to this capability.
|
|
209
|
+
"""
|
|
210
|
+
core_dir = _ROOT / "capabilities" / "conversation-core"
|
|
211
|
+
# First clean up src.* modules injected by previous tests
|
|
212
|
+
for name in [k for k in list(sys.modules) if k == "src" or k.startswith("src.")]:
|
|
213
|
+
del sys.modules[name]
|
|
214
|
+
# Also remove other capabilities paths from sys.path to avoid ambiguity
|
|
215
|
+
sys.path[:] = [p for p in sys.path if "/capabilities/" not in p]
|
|
216
|
+
sys.path.insert(0, str(core_dir))
|
|
217
|
+
import importlib # noqa: WPS433
|
|
218
|
+
return importlib.import_module("src.health")
|
|
219
|
+
|
|
220
|
+
def test_tencent_ok(self):
|
|
221
|
+
h = self._import_health()
|
|
222
|
+
from scripts.lib.credential_validators import validate_tencent
|
|
223
|
+
with patch.object(h, "check_tencent_cloud") as m:
|
|
224
|
+
m.return_value = h.CheckResult(ok=True, latency_ms=120, detail="sts ok")
|
|
225
|
+
r = validate_tencent()
|
|
226
|
+
self.assertTrue(r.ok)
|
|
227
|
+
self.assertEqual(r.type, "tencent")
|
|
228
|
+
self.assertEqual(r.error, "")
|
|
229
|
+
self.assertEqual(r.latency_ms, 120)
|
|
230
|
+
|
|
231
|
+
def test_tencent_failure_maps_to_e001(self):
|
|
232
|
+
h = self._import_health()
|
|
233
|
+
from scripts.lib.credential_validators import validate_tencent
|
|
234
|
+
with patch.object(h, "check_tencent_cloud") as m:
|
|
235
|
+
m.return_value = h.CheckResult(
|
|
236
|
+
ok=False, latency_ms=33, error_code="E001", detail="AuthFailure"
|
|
237
|
+
)
|
|
238
|
+
r = validate_tencent()
|
|
239
|
+
self.assertFalse(r.ok)
|
|
240
|
+
self.assertEqual(r.error, "E001")
|
|
241
|
+
# Must not echo key plaintext
|
|
242
|
+
self.assertNotIn("FakeKey", r.message)
|
|
243
|
+
|
|
244
|
+
def test_trtc_ok_local_only(self):
|
|
245
|
+
h = self._import_health()
|
|
246
|
+
from scripts.lib.credential_validators import validate_trtc
|
|
247
|
+
with patch.object(h, "check_trtc") as m:
|
|
248
|
+
m.return_value = h.CheckResult(ok=True, latency_ms=12, detail="local-only")
|
|
249
|
+
r = validate_trtc(deep=False)
|
|
250
|
+
self.assertTrue(r.ok)
|
|
251
|
+
self.assertEqual(r.type, "trtc")
|
|
252
|
+
|
|
253
|
+
def test_llm_failure_maps_to_e003(self):
|
|
254
|
+
h = self._import_health()
|
|
255
|
+
from scripts.lib.credential_validators import validate_llm
|
|
256
|
+
with patch.object(h, "check_llm") as m:
|
|
257
|
+
m.return_value = h.CheckResult(
|
|
258
|
+
ok=False, latency_ms=55, error_code="E003", detail="401 Unauthorized"
|
|
259
|
+
)
|
|
260
|
+
r = validate_llm()
|
|
261
|
+
self.assertFalse(r.ok)
|
|
262
|
+
self.assertEqual(r.error, "E003")
|
|
263
|
+
self.assertEqual(r.type, "llm")
|
|
264
|
+
# Output message must not contain raw sk-* credentials
|
|
265
|
+
self.assertNotIn("sk-fake", r.message)
|
|
266
|
+
|
|
267
|
+
def test_validate_all_aggregates(self):
|
|
268
|
+
h = self._import_health()
|
|
269
|
+
from scripts.lib.credential_validators import validate_all
|
|
270
|
+
with patch.object(h, "check_tencent_cloud") as a, \
|
|
271
|
+
patch.object(h, "check_trtc") as b, \
|
|
272
|
+
patch.object(h, "check_llm") as c:
|
|
273
|
+
a.return_value = h.CheckResult(ok=True, latency_ms=100)
|
|
274
|
+
b.return_value = h.CheckResult(ok=True, latency_ms=80, detail="ok")
|
|
275
|
+
c.return_value = h.CheckResult(ok=False, latency_ms=20, error_code="E003", detail="boom")
|
|
276
|
+
batch = validate_all()
|
|
277
|
+
self.assertFalse(batch.ok)
|
|
278
|
+
items = batch.to_dict()["items"]
|
|
279
|
+
self.assertEqual(len(items), 3)
|
|
280
|
+
# Order is fixed: tencent → trtc → llm
|
|
281
|
+
self.assertEqual([i["type"] for i in items], ["tencent", "trtc", "llm"])
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
if __name__ == "__main__":
|
|
285
|
+
unittest.main()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# trtc-ai-service trigger word registry
|
|
2
|
+
#
|
|
3
|
+
# Documentation only — routing logic is inlined in skills/trtc/SKILL.md.
|
|
4
|
+
# Do NOT reference this file as a runtime routing dependency.
|
|
5
|
+
#
|
|
6
|
+
# Purpose: single source of truth for what triggers the AI service fast-path,
|
|
7
|
+
# so edits happen here and get back-ported to SKILL.md manually.
|
|
8
|
+
|
|
9
|
+
triggers:
|
|
10
|
+
include:
|
|
11
|
+
# Chinese
|
|
12
|
+
- "AI客服"
|
|
13
|
+
- "智能客服"
|
|
14
|
+
- "搭建AI客服"
|
|
15
|
+
- "集成AI客服"
|
|
16
|
+
- "对话式AI"
|
|
17
|
+
- "语音助手 + 客服" # both tokens must appear together
|
|
18
|
+
# English
|
|
19
|
+
- "AI customer service"
|
|
20
|
+
- "AI customer service agent"
|
|
21
|
+
- "conversational AI"
|
|
22
|
+
- "TRTC Conversational AI"
|
|
23
|
+
- "voice agent + customer service" # both tokens must appear together
|
|
24
|
+
|
|
25
|
+
removed_from_pr:
|
|
26
|
+
# Removed — too broad, causes false positives on unrelated TRTC queries
|
|
27
|
+
- "intelligent Q&A"
|
|
28
|
+
- "智能问答"
|
|
29
|
+
- "build AI agent" # no customer-service modifier → too wide
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trtc-chat
|
|
3
|
+
description: >
|
|
4
|
+
Internal Chat (IM) integration domain skill — enter ONLY via skills/trtc/SKILL.md
|
|
5
|
+
after product=chat routing. Not a standalone dispatcher entry. Handles Vue 3 Web
|
|
6
|
+
full/direct chat integration (Path A/B/C/D).
|
|
7
|
+
version: 0.1.4
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Chat Integration Domain Skill
|
|
11
|
+
|
|
12
|
+
## 前置说明
|
|
13
|
+
|
|
14
|
+
- **角色**:协同开发者,按 slice 最佳实践生成代码
|
|
15
|
+
- **调用入口(唯一)**:`trtc/SKILL.md` 完成 §-1 prompt reporting 与路由后 Read 本文件
|
|
16
|
+
- **当前支持**:Chat × Web(Vue3 / tuikit-atomicx-vue3)
|
|
17
|
+
- **无 Conference 式 topic flow**;集成全程 `active_flow=onboarding`,slice 在 path references 内
|
|
18
|
+
- **Python tools**:`python3 -m tools.*` 的 cwd 须为 `skills/trtc` 或 `skills/trtc-chat`(后者含 `tools/` shim,委托到 trtc);**禁止**在用户项目根执行(避免项目自有 `tools/` 抢占)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## §0 Cross-IDE 执行契约(最高优先级)
|
|
23
|
+
|
|
24
|
+
### 0.0 执行纪律
|
|
25
|
+
|
|
26
|
+
0. **skill 约束优先级高于一切**:gate / phase / 上报是强约束,不得绕过
|
|
27
|
+
1. **先行动后说话**:需要 tool call / Bash 时先执行再写用户可见文字
|
|
28
|
+
2. **先验证后推进**:phase gate 必须有 tool result 证据
|
|
29
|
+
3. **Session 写入后必须 READ 验证**(见 `08-state-config.md` §8.1.3)
|
|
30
|
+
4. **业务上报是 phase postcondition**;节点上报前 Read `13-reporting.md`,用 `reporting_v2.py send`
|
|
31
|
+
5. **用户 prompt**:每轮由 Root `reporting.py`;脚本节点的 `reporting_v2.py send` 见 `13-reporting.md`(含 Path B/C 业务 prompt)
|
|
32
|
+
|
|
33
|
+
### 0.1 统一操作语义
|
|
34
|
+
|
|
35
|
+
- Session 读写 → `python3 -m tools.session read` / `write-batch`
|
|
36
|
+
- KB 读取 → `python3 -m tools.kb resolve <path>` → Read 输出绝对路径(见 `08-state-config.md` §8.0;**禁止** `../knowledge-base`)。**仅**用于 knowledge-base 条目(`chat/` `slices/` `docs/` 等);`references/` `flows/` 等 skill 自带文件直接 Read,**禁止**走 `kb resolve`
|
|
37
|
+
- Slice index → `python3 -m tools.kb resolve chat/web/index.yaml`
|
|
38
|
+
|
|
39
|
+
### 0.2 证据规则 / 0.3 Fail-Closed
|
|
40
|
+
|
|
41
|
+
证据缺失视为未执行。阻断码:`BLOCKED: project_root_unresolved` / `session_not_initialized` / `phase_gate_not_satisfied` / `credential_missing` / `unsupported_platform` / `BLOCKED: dispatcher_bypass`
|
|
42
|
+
|
|
43
|
+
### 0.4 禁止默认替用户决策
|
|
44
|
+
|
|
45
|
+
未获用户输入前禁止默认 `integration_mode`(full/direct)或凭证。
|
|
46
|
+
|
|
47
|
+
### 0.5 入口门禁(禁止绕过 Root)
|
|
48
|
+
|
|
49
|
+
❗ **本文件不是 dispatcher**。仅允许在以下任一条件成立后进入:
|
|
50
|
+
|
|
51
|
+
| # | 条件 |
|
|
52
|
+
|---|------|
|
|
53
|
+
| 1 | 本轮已由 `trtc/SKILL.md` 路由至本文件(正常路径) |
|
|
54
|
+
| 2 | `.trtc-session.yaml` 存在且 `product=chat` 或 `active_domain_skill=trtc-chat`,且本轮 Agent 已先 Read `../trtc/SKILL.md` 并完成其 §-1 |
|
|
55
|
+
|
|
56
|
+
**若直接 Read 本文件(未经 Root)**:
|
|
57
|
+
|
|
58
|
+
1. **STOP** 集成/分流动作
|
|
59
|
+
2. 先 Read `../trtc/SKILL.md`,从 §-1 重新走 session guard → 分类 → 路由
|
|
60
|
+
3. 禁止凭本文件 frontmatter / 描述关键词跳过 dispatcher
|
|
61
|
+
|
|
62
|
+
**IM 纯咨询(Path D)**:由 Root 路由至 `docs/SKILL.md`,**不要**在本文件 Step 0 偷跑 Path D。
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## §1 Phase 状态机
|
|
67
|
+
|
|
68
|
+
`flow_state.chat.phase` 是唯一真相(`.trtc-session.yaml`,经 `tools.session`)。
|
|
69
|
+
|
|
70
|
+
| phase | 允许动作 |
|
|
71
|
+
|-------|----------|
|
|
72
|
+
| `detect` | 探测 + session 初始化 + A.1 |
|
|
73
|
+
| `collect_credentials` | 收集 SDKAppID / SecretKey |
|
|
74
|
+
| `collect_mode` | Full / Direct |
|
|
75
|
+
| `scaffold` | 脚手架 |
|
|
76
|
+
| `slices` | 一轮一 slice |
|
|
77
|
+
| `done` | 收尾;新功能→Path B;维护→Path C |
|
|
78
|
+
|
|
79
|
+
`phase=done` 时:加法 → Path B;减法/报错 → Path C。
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 入口:读取 session 状态
|
|
84
|
+
|
|
85
|
+
- `status=active` → 按 `active_flow` / `flow_state.chat.phase` 续接
|
|
86
|
+
- `active_flow=onboarding` 覆盖 detect…slices
|
|
87
|
+
- `status=completed` → 承接 Path B/C/D
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Step 0 — Path D 预检
|
|
92
|
+
|
|
93
|
+
Bash `python3 -m tools.kb resolve chat/web/path-d-signals.yaml` → Read 输出路径,再对照用户句。
|
|
94
|
+
|
|
95
|
+
命中条件(知识咨询信号 **且**):
|
|
96
|
+
- 无 `.trtc-session.yaml`,或
|
|
97
|
+
- `product=chat` 且 `flow_state.chat.phase=done` / `status=completed`
|
|
98
|
+
|
|
99
|
+
命中 → **STOP 本集成流**;应由 Root 已路由至 `docs/SKILL.md`。若尚未路由,Read `../trtc/SKILL.md` §A 后进入 `docs/SKILL.md`。
|
|
100
|
+
|
|
101
|
+
❗ 路由至 `docs/SKILL.md` 后 **不要**再 Read `path-d-signals.yaml`(门禁已完成;后续见 `docs/SKILL.md` → `05-path-d-script.md` D.1)。
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Step 1 — 项目探测
|
|
106
|
+
|
|
107
|
+
READ `references/01-detect-project.md` + `references/08-state-config.md` → 找根 → 写 `project_state.project_root`
|
|
108
|
+
|
|
109
|
+
非 vue3 → `BLOCKED: unsupported_platform`
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Step 1.5 — Session 初始化
|
|
114
|
+
|
|
115
|
+
READ `references/vue3.md`(按需)。
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
cd "<当前 trtc skill 目录>"
|
|
119
|
+
# 无 session 时:
|
|
120
|
+
python3 -m tools.session create --product chat --platform web --intent integrate-scenario
|
|
121
|
+
python3 -m tools.session write-batch --updates '{
|
|
122
|
+
"active_domain_skill": "trtc-chat",
|
|
123
|
+
"active_flow": "onboarding",
|
|
124
|
+
"project_state": {"project_root": "<projectRoot>"},
|
|
125
|
+
"flow_state": {"chat": {"phase": "detect", "chat_path": "A"}}
|
|
126
|
+
}' --expected-version <N>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
已有 session → 保留 phase,仅更新必要字段。
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Step 2 — 路径分流
|
|
134
|
+
|
|
135
|
+
| 优先级 | 条件 | 路径 |
|
|
136
|
+
|--------|------|------|
|
|
137
|
+
| 0 | Step 0 知识咨询 | D(经 Root → `docs/SKILL.md`) |
|
|
138
|
+
| 1 | 减法/维护/报错 | C → READ `flows/maintenance.md` |
|
|
139
|
+
| 2 | `phase=done` + 有 tuikit 依赖 | B |
|
|
140
|
+
| 3 | 已依赖 tuikit-atomicx-vue3 | B |
|
|
141
|
+
| 4 | 新项目 / 未依赖 | A |
|
|
142
|
+
|
|
143
|
+
Path A/B:
|
|
144
|
+
```bash
|
|
145
|
+
python3 -m tools.flow enter --phase onboarding --product chat --platform web
|
|
146
|
+
```
|
|
147
|
+
然后 READ `flows/onboarding.md` → `02-path-a-script.md` 或 `03-path-b-script.md`
|
|
148
|
+
|
|
149
|
+
**禁止** `enter --phase topic`
|
|
150
|
+
|
|
151
|
+
Path C → READ `references/04-path-c-script.md`
|
|
152
|
+
Path D(集成流内不应到达)→ 若误达,Read `docs/SKILL.md`
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## §3 Path A/B 强约束
|
|
157
|
+
|
|
158
|
+
- 一轮一 slice;禁止预读下轮 slice
|
|
159
|
+
- Write-then-Verify phase gate
|
|
160
|
+
- Path B 禁止 `reopen-add-feature`(用 §8.5 write-batch)
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## §4 Hard Rules 摘要
|
|
165
|
+
|
|
166
|
+
READ `references/06-hard-rules.md` + `06-a-defensive-coding.md`
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## §5 关键文件
|
|
171
|
+
|
|
172
|
+
- `{projectRoot}/.trtc-session.yaml`(唯一 session,经 `tools.session`)
|
|
173
|
+
- `{projectRoot}/WHAT-TO-DO-NEXT.md`(A.4 交付物)
|
|
174
|
+
- `skills/trtc-chat/.docs-query.yaml`(Path D 正交态)
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## §6 规则冲突优先级
|
|
179
|
+
|
|
180
|
+
本文件 §0/§1/0/1/2 > 路径脚本 > hard rules > 其他
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## §7 References 索引
|
|
185
|
+
|
|
186
|
+
见 `references/10-references-index.md`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trtc-chat-docs
|
|
3
|
+
description: >
|
|
4
|
+
Internal Chat IM docs query (Path D) — enter ONLY via skills/trtc/SKILL.md routing.
|
|
5
|
+
Not a standalone dispatcher entry. IM product/SDK/REST/Webhook/TUIKit/billing/errors.
|
|
6
|
+
version: 0.1.4
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Chat Docs Query — Path D
|
|
10
|
+
|
|
11
|
+
## 入口门禁
|
|
12
|
+
|
|
13
|
+
❗ **本文件不是 dispatcher**。仅允许在 `trtc/SKILL.md` 完成 §-1 prompt reporting 并路由至本文件后进入。
|
|
14
|
+
|
|
15
|
+
若直接 Read 本文件:先 Read `../../trtc/SKILL.md`,从 §-1 重走分类与路由。
|
|
16
|
+
|
|
17
|
+
## 门禁
|
|
18
|
+
|
|
19
|
+
- 无 session,或
|
|
20
|
+
- session 存在且 (`product=chat` ∧ (`status=completed` ∨ `flow_state.chat.phase=done`))
|
|
21
|
+
|
|
22
|
+
## 执行
|
|
23
|
+
|
|
24
|
+
Read `../references/05-path-d-script.md`,从 **D.0b** 起按 D.0–D.8 完整流程。
|
|
25
|
+
|
|
26
|
+
❗ **禁止再 Read `path-d-signals.yaml`**:该文件仅用于 Root §A / `trtc-chat/SKILL.md` Step 0 的 Path D **路由门禁**。本轮既已进入本文件,说明门禁已通过;意图分类用 `05-path-d-script.md` **D.1** 内联信号表 + `.docs-query.yaml` 状态机,**不要**重复 resolve/read 信号词文件。
|
|
27
|
+
|
|
28
|
+
## Prompt 上报
|
|
29
|
+
|
|
30
|
+
- 每轮用户句:`trtc/SKILL.md` §-1 `reporting.py prompt`
|
|
31
|
+
- 脚本节点:`reporting_v2.py send`(Path D `--json` prompt+answer / feedback;Path B/C 见 `13-reporting.md`)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
phase: maintenance
|
|
3
|
+
product: chat
|
|
4
|
+
platform: web
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Chat Maintenance Flow — Path C
|
|
8
|
+
|
|
9
|
+
> **调用方**:`trtc-chat/SKILL.md` Step 2 分流 Path C 时 Read 本文件。
|
|
10
|
+
>
|
|
11
|
+
> **职责**:维护 / 排障 / 减法 / 样式调整;**不**加载 slice。
|
|
12
|
+
|
|
13
|
+
## 执行
|
|
14
|
+
|
|
15
|
+
Read `../references/04-path-c-script.md`,从 C.1 执行完整 Path C 脚本。
|
|
16
|
+
|
|
17
|
+
可选:设 `active_flow=maintenance`(经 `tools.session write-batch`,禁止直接编辑 yaml)。
|
|
18
|
+
|
|
19
|
+
**禁止** `flow enter --phase maintenance`(`flow.py` 无此 phase;直读 reference 即可)。
|