@tencent-rtc/trtc-agent-skills 0.1.1 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/rules/main.mdc +12 -0
- package/AGENTS.md +14 -97
- package/CLAUDE.md +15 -120
- package/CODEBUDDY.md +32 -118
- package/README.md +7 -5
- package/README.zh.md +7 -5
- package/bin/cli.js +133 -41
- package/hooks/__pycache__/cursor-adapter.cpython-313.pyc +0 -0
- package/hooks/cursor-adapter.py +45 -18
- package/hooks/hooks-cursor.json +5 -18
- package/hooks/hooks.json +6 -31
- package/knowledge-base/conference/web/index.yaml +143 -0
- package/knowledge-base/platform-slice-template.md +1041 -133
- package/knowledge-base/products.yaml +76 -0
- package/knowledge-base/scenario-spec.md +1316 -115
- package/knowledge-base/scenarios/conference/base/general-conference.md +26 -3
- package/knowledge-base/scenarios/conference/base/webinar-conference.md +14 -0
- package/knowledge-base/scenarios/conference/medical/1v1-video-consultation.md +19 -0
- package/knowledge-base/scenarios/conference/medical/medical-multidoctor-consultation.md +13 -0
- package/knowledge-base/scenarios/live/entertainment-live-room.md +12 -0
- package/knowledge-base/slice-spec.md +2377 -299
- package/knowledge-base/slices/conference/web/integration-audit.md +155 -0
- package/knowledge-base/slices/conference/web/login-auth.md +16 -2
- package/knowledge-base/slices/conference/web/official-roomkit-login-ui.md +41 -13
- package/knowledge-base/slices/conference/web/prejoin-check.md +8 -5
- package/knowledge-base/tooling/aliases.yaml +92 -0
- package/knowledge-base/tooling/intent-signals.yaml +181 -0
- package/knowledge-base/tooling/symptom-keywords.yaml +21 -0
- package/package.json +1 -1
- package/skills/trtc/SKILL.md +202 -244
- package/skills/trtc/hooks/__pycache__/report_prompt.cpython-313.pyc +0 -0
- package/skills/{trtc-topic/guardrails → trtc/hooks}/gate_slice_read.py +12 -8
- package/skills/{trtc-topic/guardrails → trtc/hooks}/gate_slice_write.py +16 -12
- package/skills/{trtc-topic/guardrails → trtc/hooks}/stop_require_apply_evidence.py +22 -14
- package/skills/trtc/hooks/topic_phase_gate.py +161 -0
- package/skills/trtc/room-builder/assets/local-usersig/basic-info-config.ts +39 -0
- package/skills/trtc/room-builder/assets/local-usersig/lib-generate-test-usersig-es.min.d.ts +4 -0
- package/skills/trtc/room-builder/assets/local-usersig/lib-generate-test-usersig-es.min.js +2 -0
- package/skills/{trtc-topic → trtc}/runtime/README.md +2 -2
- package/skills/{trtc-onboarding/reference/reporting-protocol.md → trtc/runtime/REPORTING.md} +5 -3
- 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/runtime/usersig-handling.md +134 -0
- package/skills/{trtc-topic/scripts → trtc/tools}/STATE-MACHINE-GUIDE.md +23 -23
- package/skills/trtc/tools/__init__.py +2 -0
- package/skills/trtc/tools/__pycache__/__init__.cpython-313.pyc +0 -0
- package/skills/trtc/tools/__pycache__/query_classifier.cpython-313.pyc +0 -0
- package/skills/trtc/tools/__pycache__/reporting.cpython-313.pyc +0 -0
- package/skills/trtc/tools/__pycache__/search.cpython-313.pyc +0 -0
- package/skills/trtc/tools/__pycache__/session.cpython-313.pyc +0 -0
- package/skills/trtc/tools/apply.py +540 -0
- package/skills/trtc/tools/docs.py +712 -0
- package/skills/trtc/tools/docsbot.py +182 -0
- package/skills/trtc/tools/entry/render_ai_instructions.py +92 -0
- package/skills/trtc/tools/flow.py +1089 -0
- package/skills/{trtc-topic/scripts → trtc/tools}/init_slice_queue.py +5 -4
- package/skills/{trtc-topic/scripts → trtc/tools}/next_slice.py +5 -4
- package/skills/trtc/tools/query_classifier.py +301 -0
- package/skills/trtc/tools/reporting.py +447 -0
- package/skills/trtc/tools/search.py +817 -0
- package/skills/trtc/tools/session.py +1261 -0
- package/skills/trtc/tools/state_machine.py +690 -0
- package/skills/trtc-ai-service/README.md +195 -0
- package/skills/trtc-ai-service/README.zh-CN.md +193 -0
- package/skills/trtc-ai-service/SKILL.md +945 -0
- package/skills/trtc-ai-service/auto_adapters/README.md +40 -0
- package/skills/trtc-ai-service/auto_adapters/frontend-spa/README.md +27 -0
- package/skills/trtc-ai-service/auto_adapters/frontend-spa/angular/voice-agent.component.ts.tpl +131 -0
- package/skills/trtc-ai-service/auto_adapters/frontend-spa/manifest.yaml +57 -0
- package/skills/trtc-ai-service/auto_adapters/frontend-spa/react/VoiceAgent.tsx.tpl +142 -0
- package/skills/trtc-ai-service/auto_adapters/frontend-spa/vue/VoiceAgent.vue.tpl +121 -0
- package/skills/trtc-ai-service/auto_adapters/integration_templates/generic-backend.md +45 -0
- package/skills/trtc-ai-service/auto_adapters/integration_templates/generic-frontend.md +51 -0
- package/skills/trtc-ai-service/auto_adapters/integration_templates/generic-rest-api.md +93 -0
- package/skills/trtc-ai-service/auto_adapters/java-backend/README.md +25 -0
- package/skills/trtc-ai-service/auto_adapters/java-backend/manifest.yaml +30 -0
- package/skills/trtc-ai-service/auto_adapters/java-backend/quarkus/VoiceAgentFilter.java.tpl +64 -0
- package/skills/trtc-ai-service/auto_adapters/java-backend/springboot/VoiceAgentFilter.java.tpl +91 -0
- package/skills/trtc-ai-service/auto_adapters/manifest.yaml +43 -0
- package/skills/trtc-ai-service/auto_adapters/node-backend/README.md +25 -0
- package/skills/trtc-ai-service/auto_adapters/node-backend/express.js.tpl +40 -0
- package/skills/trtc-ai-service/auto_adapters/node-backend/fastify.js.tpl +27 -0
- package/skills/trtc-ai-service/auto_adapters/node-backend/koa.js.tpl +31 -0
- package/skills/trtc-ai-service/auto_adapters/node-backend/manifest.yaml +47 -0
- package/skills/trtc-ai-service/auto_adapters/python-backend/README.md +22 -0
- package/skills/trtc-ai-service/auto_adapters/python-backend/django.py.tpl +32 -0
- package/skills/trtc-ai-service/auto_adapters/python-backend/fastapi.py.tpl +35 -0
- package/skills/trtc-ai-service/auto_adapters/python-backend/flask.py.tpl +31 -0
- package/skills/trtc-ai-service/auto_adapters/python-backend/manifest.yaml +45 -0
- package/skills/trtc-ai-service/capabilities/__init__.py +43 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/.env.example +29 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/INTEGRATION.md +134 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/INTERFACE_ADAPT.md +111 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/QUICK_START.md +62 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/manifest.yaml +250 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/requirements.txt +6 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/__init__.py +10 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/_capability_loader.py +218 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/agent.py +231 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/credentials.py +132 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/health.py +355 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/log_filter.py +76 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/modality.py +109 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/server.py +312 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/trtc_client.py +315 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/src/usersig.py +90 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/tests/test_skeleton.py +216 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/README.md +48 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/app.js +415 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/index.html +68 -0
- package/skills/trtc-ai-service/capabilities/conversation-core/web-demo/styles.css +136 -0
- package/skills/trtc-ai-service/capabilities/digital-human/README.md +31 -0
- package/skills/trtc-ai-service/capabilities/digital-human/manifest.yaml +64 -0
- package/skills/trtc-ai-service/capabilities/digital-human/src/__init__.py +2 -0
- package/skills/trtc-ai-service/capabilities/digital-human/src/router.py +43 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/INTERFACE_ADAPT.md +353 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/README.md +44 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/manifest.yaml +227 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/__init__.py +2 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/__init__.py +9 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/default_rest.py +242 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/factory.py +89 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/local_queue.py +258 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/adapters/mock.py +132 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/core/__init__.py +25 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/core/intent_detector.py +75 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/core/models.py +163 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/core/service.py +192 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/feedback_store.py +54 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/ports/__init__.py +4 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/ports/handoff_client.py +86 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/queue.py +62 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/router.py +201 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/summary_link.py +77 -0
- package/skills/trtc-ai-service/capabilities/human-handoff/src/trigger.py +25 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/INTERFACE_ADAPT.md +297 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/README.md +51 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/data/faq.json +20 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/manifest.yaml +211 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/__init__.py +8 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/__init__.py +9 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/default_rest.py +209 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/factory.py +86 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/local_json.py +172 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/adapters/mock.py +91 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/__init__.py +12 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/models.py +77 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/scoring.py +73 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/core/service.py +78 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/ports/__init__.py +4 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/ports/kb_client.py +61 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/retriever.py +56 -0
- package/skills/trtc-ai-service/capabilities/knowledge-base/src/router.py +85 -0
- package/skills/trtc-ai-service/capabilities/session-summary/INTERFACE_ADAPT.md +99 -0
- package/skills/trtc-ai-service/capabilities/session-summary/README.md +47 -0
- package/skills/trtc-ai-service/capabilities/session-summary/data/test_session.json +18 -0
- package/skills/trtc-ai-service/capabilities/session-summary/manifest.yaml +165 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/__init__.py +2 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/__init__.py +5 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/base.py +31 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/default_rest.py +67 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/factory.py +51 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/local_json.py +42 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/adapters/mock.py +22 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/recorder.py +210 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/router.py +93 -0
- package/skills/trtc-ai-service/capabilities/session-summary/src/summarizer.py +163 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/INTERFACE_ADAPT.md +158 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/README.md +50 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/data/tools.yaml +58 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/examples/__init__.py +1 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/examples/local_tools.py +101 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/manifest.yaml +146 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/src/__init__.py +8 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/src/dispatcher.py +54 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/src/registry.py +219 -0
- package/skills/trtc-ai-service/capabilities/tool-calling/src/router.py +50 -0
- package/skills/trtc-ai-service/references/business-contract-spec.md +263 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/README.md +86 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/output-templates/recipe.yaml.j2 +194 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q1-business-scenario.md +43 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q2-io-modality.md +57 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q3-ui-form.md +55 -0
- package/skills/trtc-ai-service/scenarios/custom-builder/prompts/q4-capabilities.md +78 -0
- package/skills/trtc-ai-service/scenarios/customer-service/README.md +114 -0
- package/skills/trtc-ai-service/scenarios/customer-service/recipe.yaml +154 -0
- package/skills/trtc-ai-service/scenarios/customer-service/sample-data/README.md +32 -0
- package/skills/trtc-ai-service/scenarios/customer-service/sample-data/faq-sample.json +37 -0
- package/skills/trtc-ai-service/scenarios/customer-service/system-prompt.template.md +94 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/app.js +347 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/index.html +125 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/styles.css +487 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/admin-board/tokens.css +71 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/design-system/DESIGN_GUIDELINES.md +370 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/README.md +68 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/app.js +1307 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/data.js +40 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/index.html +233 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/mock-shop.json +21 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/styles.css +603 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/voice-customer-service/tokens.css +71 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/agent-link.js +323 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/app.js +458 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/index.html +109 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/styles.css +489 -0
- package/skills/trtc-ai-service/scenarios/customer-service/ui/widget-floating/tokens.css +59 -0
- package/skills/trtc-ai-service/scripts/add-capability.py +364 -0
- package/skills/trtc-ai-service/scripts/contract-adapt.py +334 -0
- package/skills/trtc-ai-service/scripts/detect-stack.py +40 -0
- package/skills/trtc-ai-service/scripts/lib/__init__.py +20 -0
- package/skills/trtc-ai-service/scripts/lib/adapter_codegen.py +509 -0
- package/skills/trtc-ai-service/scripts/lib/arbitrator.py +152 -0
- package/skills/trtc-ai-service/scripts/lib/contract_resolver.py +519 -0
- package/skills/trtc-ai-service/scripts/lib/credential_validators.py +253 -0
- package/skills/trtc-ai-service/scripts/lib/curl_parser.py +303 -0
- package/skills/trtc-ai-service/scripts/lib/degrader.py +140 -0
- package/skills/trtc-ai-service/scripts/lib/injector.py +347 -0
- package/skills/trtc-ai-service/scripts/lib/manifest_resolver.py +288 -0
- package/skills/trtc-ai-service/scripts/lib/openapi_parser.py +289 -0
- package/skills/trtc-ai-service/scripts/lib/stack_detector.py +159 -0
- package/skills/trtc-ai-service/scripts/lib/tokens_compile.py +204 -0
- package/skills/trtc-ai-service/scripts/post-install-patch.py +225 -0
- package/skills/trtc-ai-service/scripts/setup-credentials.py +393 -0
- package/skills/trtc-ai-service/scripts/verify-credentials.py +108 -0
- package/skills/trtc-ai-service/start.sh +111 -0
- package/skills/trtc-ai-service/tests/__init__.py +1 -0
- package/skills/trtc-ai-service/tests/test_arbitrator.py +64 -0
- package/skills/trtc-ai-service/tests/test_capability_overlay.py +85 -0
- package/skills/trtc-ai-service/tests/test_contract_resolver.py +190 -0
- package/skills/trtc-ai-service/tests/test_handoff_ports.py +195 -0
- package/skills/trtc-ai-service/tests/test_kb_ports.py +195 -0
- package/skills/trtc-ai-service/tests/test_manifest_resolver.py +95 -0
- package/skills/trtc-ai-service/tests/test_recipe_assembly.py +175 -0
- package/skills/trtc-ai-service/tests/test_stack_and_degrader.py +101 -0
- package/skills/trtc-ai-service/tests/test_verify_credentials.py +285 -0
- package/skills/trtc-ai-service/triggers.yaml +29 -0
- package/skills/trtc-conference/SKILL.md +324 -0
- package/skills/trtc-conference/flows/onboarding.md +205 -0
- package/skills/trtc-conference/flows/topic.md +474 -0
- package/skills/trtc-conference/flows/troubleshoot.md +85 -0
- package/skills/trtc-conference/hooks/pretooluse_require_business_decisions.py +213 -0
- package/skills/trtc-conference/playbooks/medical-quickstart.md +84 -0
- package/skills/trtc-conference/playbooks/official-roomkit.md +97 -0
- package/skills/trtc-conference/references/local-usersig/basic-info-config.ts +39 -0
- package/skills/trtc-conference/references/usersig-handling.md +134 -0
- package/skills/trtc-conference/templates/medical-consultation/src/config/lib-generate-test-usersig-es.min.d.ts +4 -0
- package/skills/trtc-conference/templates/medical-consultation/src/config/lib-generate-test-usersig-es.min.js +2 -0
- package/skills/trtc-conference/tests/__pycache__/test_conference_onboarding_contract.cpython-313-pytest-9.0.2.pyc +0 -0
- package/skills/trtc-conference/tests/__pycache__/test_conference_topic_flow_contract.cpython-313-pytest-9.0.2.pyc +0 -0
- package/skills/trtc-conference/tests/test_conference_index_contract.py +43 -0
- package/skills/trtc-conference/tests/test_conference_onboarding_contract.py +103 -0
- package/skills/trtc-conference/tests/test_conference_template_contract.py +25 -0
- package/skills/trtc-conference/tests/test_conference_topic_flow_contract.py +132 -0
- package/skills/trtc-conference/tools/apply_checks.py +328 -0
- package/skills/trtc-conference/verify_lib/__init__.py +0 -0
- package/skills/{trtc-apply/guardrails/apply_lib → trtc-conference/verify_lib}/rule_parser.py +1 -1
- package/skills/trtc-docs/SKILL.md +91 -119
- package/.cursor/rules/ui-mode.mdc +0 -92
- package/ai-instructions/base.md +0 -13
- package/ai-instructions/ui-mode.md +0 -86
- package/knowledge-base/index.yaml +0 -454
- package/skills/trtc/room-builder/SKILL.md +0 -138
- 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 -839
- package/skills/trtc-onboarding/reference/path-a1-demo.md +0 -103
- package/skills/trtc-onboarding/reference/path-a2-integrate.md +0 -693
- package/skills/trtc-onboarding/reference/path-b-troubleshoot.md +0 -115
- package/skills/trtc-onboarding/reference/path-c-expand.md +0 -43
- package/skills/trtc-onboarding/reference/supported-matrix.md +0 -100
- package/skills/trtc-onboarding/reference/usersig-handling.md +0 -140
- package/skills/trtc-search/SKILL.md +0 -221
- package/skills/trtc-topic/SKILL.md +0 -638
- 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-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
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
# Medical Consultation UIKit Demo
|
|
2
|
-
|
|
3
|
-
医疗场景化音视频源码示例,基于 Vue 3、Vite 和音视频 UIKit 构建。该项目展示如何把稳定的实时音视频能力嵌入互联网医院、远程问诊、复诊随访和 MDT 多学科会诊等医疗业务流程。
|
|
4
|
-
|
|
5
|
-
> 本项目是医疗问诊前端源码模板,不是完整 HIS / EMR / 处方 / 支付 / 医保系统。示例中的病历、处方、检查资料和医生数据仅用于展示业务系统接入方式。
|
|
6
|
-
|
|
7
|
-
## 能力概览
|
|
8
|
-
|
|
9
|
-
- 医生端问诊工作台:音视频主画面、业务插槽、聊天、实时转写、成员管理。
|
|
10
|
-
- 患者端问诊链路:选择医生、候诊、接听呼叫、视频问诊、问诊结束页。
|
|
11
|
-
- 即时呼叫:医生在工作台发起呼叫,患者在候诊页接听进入房间。
|
|
12
|
-
- MDT 会诊:主治医生可邀请会诊医生,医生端和患者端均支持多人视频缩略流。
|
|
13
|
-
- 业务插槽:中间区域可替换为客户 EMR / HIS / PACS / 处方 / 随访页面。
|
|
14
|
-
- 双模式数据源:`mock` 用于本地演示,`integration` 用于客户业务系统接入。
|
|
15
|
-
|
|
16
|
-
## 快速开始
|
|
17
|
-
|
|
18
|
-
当前 demo 位于 monorepo 中,请在仓库根目录运行:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
pnpm -C conference/demos/web-vite-medical-vue3 dev
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
构建验证:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
pnpm -C conference/demos/web-vite-medical-vue3 build
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## 运行模式
|
|
31
|
-
|
|
32
|
-
通过环境变量切换数据和业务区展示模式:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
VITE_MEDICAL_MODE=mock
|
|
36
|
-
VITE_MEDICAL_BUSINESS_PANEL_MODE=demo
|
|
37
|
-
VITE_MEDICAL_BUSINESS_SLOT_TITLE="EMR / HIS / PACS 业务插槽"
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
| 配置 | 可选值 | 说明 |
|
|
41
|
-
| --- | --- | --- |
|
|
42
|
-
| `VITE_MEDICAL_MODE` | `mock` | 使用内置演示账号和预约数据 |
|
|
43
|
-
| `VITE_MEDICAL_MODE` | `integration` | 从客户业务系统入口读取上下文 |
|
|
44
|
-
| `VITE_MEDICAL_BUSINESS_PANEL_MODE` | `demo` | 展示病历、处方、资料示例 |
|
|
45
|
-
| `VITE_MEDICAL_BUSINESS_PANEL_MODE` | `slot` | 展示业务插槽提示,便于客户替换 |
|
|
46
|
-
|
|
47
|
-
正式接入建议:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
VITE_MEDICAL_MODE=integration
|
|
51
|
-
VITE_MEDICAL_BUSINESS_PANEL_MODE=slot
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## 项目结构
|
|
55
|
-
|
|
56
|
-
```text
|
|
57
|
-
src/
|
|
58
|
-
config/ # 运行配置和 SDK 演示配置
|
|
59
|
-
mock/ # 本地演示数据
|
|
60
|
-
services/adapters/ # mock / integration 数据适配层
|
|
61
|
-
features/consultation/ # 会诊成员、角色、权限等通用逻辑
|
|
62
|
-
views/ # 页面级组件
|
|
63
|
-
components/ # 医疗业务区与协同面板组件
|
|
64
|
-
utils/ # session、导航、格式化等工具
|
|
65
|
-
styles/ # 样式入口和主题变量
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## 关键代码
|
|
69
|
-
|
|
70
|
-
| 文件 | 说明 |
|
|
71
|
-
| --- | --- |
|
|
72
|
-
| `src/views/DoctorConsultationView.vue` | 医生问诊工作台 |
|
|
73
|
-
| `src/views/PatientConsultationView.vue` | 患者视频问诊页 |
|
|
74
|
-
| `src/components/MedicalBusinessPanel.vue` | 医生端中间业务插槽 |
|
|
75
|
-
| `src/components/ConsultationManagePanel.vue` | 聊天、转写、成员管理、会诊邀请 |
|
|
76
|
-
| `src/features/consultation/components/ConsultationVideoStage.vue` | 多人主画面与缩略流布局 |
|
|
77
|
-
| `src/features/consultation/useConsultationParticipants.ts` | 多人视频成员列表和主画面聚焦逻辑 |
|
|
78
|
-
| `src/features/consultation/useConsultationPermissions.ts` | 主治医生 / 会诊医生权限控制 |
|
|
79
|
-
| `src/services/adapters/types.ts` | 模板内部统一数据结构 |
|
|
80
|
-
| `src/services/adapters/integration/*` | 客户业务系统接入示例骨架 |
|
|
81
|
-
|
|
82
|
-
## 接入文档
|
|
83
|
-
|
|
84
|
-
详细接入说明见:
|
|
85
|
-
|
|
86
|
-
- [中文接入说明](./docs/integration.zh-CN.md)
|
|
87
|
-
- [后端接口契约建议](./docs/backend-contract.zh-CN.md)
|
|
88
|
-
- [主题定制说明](./docs/theme.zh-CN.md)
|
|
89
|
-
|
|
90
|
-
## 场景边界
|
|
91
|
-
|
|
92
|
-
该 demo 聚焦音视频产品在医疗业务中的集成方式:
|
|
93
|
-
|
|
94
|
-
- 预约、挂号、病历、处方、检查资料等医疗主数据由客户业务系统负责。
|
|
95
|
-
- `roomId` 建议由客户后端生成并持久化,前端只消费接口返回结果。
|
|
96
|
-
- UserSig 建议由客户服务端签发,前端只使用服务端返回的登录信息。
|
|
97
|
-
- mock 数据、示例表单和患者选医生页面仅用于演示,不代表完整医疗业务系统。
|
|
98
|
-
|
|
99
|
-
## 常见改造点
|
|
100
|
-
|
|
101
|
-
- 替换 `src/services/adapters/integration/*`,接入客户登录、用户和预约接口。
|
|
102
|
-
- 替换 `MedicalBusinessPanel.vue`,接入客户 EMR / HIS / PACS 页面。
|
|
103
|
-
- 按客户产品策略决定患者端是否展示聊天、转写和会诊医生信息。
|
|
104
|
-
- 按品牌规范调整 `src/styles/theme.css` 和页面中的主题色。
|
|
105
|
-
|
|
106
|
-
## License
|
|
107
|
-
|
|
108
|
-
请根据最终开源策略补充 License。
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""render_ai_instructions.py — Render ai-instructions/*.md to tool-specific entry files.
|
|
3
|
-
|
|
4
|
-
Sources: ai-instructions/*.md (single source of truth, human-edited)
|
|
5
|
-
Targets:
|
|
6
|
-
- AGENTS.md (for Codex / Aider / Cline / CodeBuddy)
|
|
7
|
-
- CLAUDE.md (between AI-INSTRUCTIONS markers)
|
|
8
|
-
- .cursor/rules/{name}.mdc (one per source file; with Cursor frontmatter)
|
|
9
|
-
|
|
10
|
-
Grown TDD-style; see tests/unit/test_render_ai_instructions.py.
|
|
11
|
-
"""
|
|
12
|
-
import argparse
|
|
13
|
-
import sys
|
|
14
|
-
from pathlib import Path
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def _sources(project_root, *, include_base=True):
|
|
18
|
-
"""Return sorted list of .md source files under ai-instructions/.
|
|
19
|
-
|
|
20
|
-
base.md is the fixed preamble for AGENTS.md (tells Codex to read CLAUDE.md).
|
|
21
|
-
When include_base=False it is excluded — used by CLAUDE.md and Cursor renders
|
|
22
|
-
which don't need a self-referential pointer.
|
|
23
|
-
"""
|
|
24
|
-
src_dir = project_root / "ai-instructions"
|
|
25
|
-
if not src_dir.exists():
|
|
26
|
-
return []
|
|
27
|
-
files = sorted(src_dir.glob("*.md"))
|
|
28
|
-
if not include_base:
|
|
29
|
-
files = [f for f in files if f.name != "base.md"]
|
|
30
|
-
return files
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Single source-of-truth banner. Reused across all derived targets so the
|
|
34
|
-
# message stays identical and contributors can grep for "DO NOT EDIT" to
|
|
35
|
-
# find every generated file.
|
|
36
|
-
_BANNER = (
|
|
37
|
-
"<!-- DO NOT EDIT — generated from ai-instructions/ by "
|
|
38
|
-
"skills/trtc/room-builder/tools/render_ai_instructions.py. "
|
|
39
|
-
"Edit the source markdown and re-run the renderer instead. -->"
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def _render_agents_md(project_root):
|
|
44
|
-
"""Regenerate AGENTS.md by concatenating all sources.
|
|
45
|
-
|
|
46
|
-
base.md is rendered first as a plain preamble (no H1 header) so Codex
|
|
47
|
-
sees the "read CLAUDE.md" instruction at the top. Remaining sources get
|
|
48
|
-
an H1 section header per file.
|
|
49
|
-
"""
|
|
50
|
-
base_path = project_root / "ai-instructions" / "base.md"
|
|
51
|
-
sources = _sources(project_root, include_base=False)
|
|
52
|
-
parts = [_BANNER + "\n"]
|
|
53
|
-
# Preamble from base.md (rendered without a # header — it has its own).
|
|
54
|
-
if base_path.exists():
|
|
55
|
-
parts.append(base_path.read_text().rstrip() + "\n")
|
|
56
|
-
for src in sources:
|
|
57
|
-
parts.append(f"# {src.stem}\n\n{src.read_text().rstrip()}\n")
|
|
58
|
-
(project_root / "AGENTS.md").write_text("\n".join(parts) if (base_path.exists() or sources) else _BANNER + "\n")
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
BEGIN_MARKER = "<!-- AI-INSTRUCTIONS:BEGIN -->"
|
|
62
|
-
END_MARKER = "<!-- AI-INSTRUCTIONS:END -->"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def _demote_headings(body):
|
|
66
|
-
"""Add one '#' to every ATX heading line.
|
|
67
|
-
|
|
68
|
-
`## Foo` → `### Foo`, `### Foo` → `#### Foo`, etc. Lines that aren't
|
|
69
|
-
headings are returned unchanged. Used in CLAUDE.md so body sections
|
|
70
|
-
nest under the renderer-prepended `## {name}` parent.
|
|
71
|
-
"""
|
|
72
|
-
out = []
|
|
73
|
-
for line in body.splitlines():
|
|
74
|
-
# Match an ATX heading: 1-6 '#' followed by a space.
|
|
75
|
-
stripped = line.lstrip()
|
|
76
|
-
if stripped.startswith("#"):
|
|
77
|
-
hashes = len(stripped) - len(stripped.lstrip("#"))
|
|
78
|
-
if 1 <= hashes <= 5 and stripped[hashes:hashes + 1] == " ":
|
|
79
|
-
# Preserve leading whitespace (rare in markdown but safe).
|
|
80
|
-
lead = line[:len(line) - len(stripped)]
|
|
81
|
-
out.append(f"{lead}#{stripped}")
|
|
82
|
-
continue
|
|
83
|
-
out.append(line)
|
|
84
|
-
return "\n".join(out)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def _rendered_block(project_root):
|
|
88
|
-
"""The string content placed between markers in CLAUDE.md.
|
|
89
|
-
|
|
90
|
-
Section headers are H2 (`## {name}`). Body headings are demoted by one
|
|
91
|
-
level so they nest as children of the section header instead of
|
|
92
|
-
appearing as adjacent siblings. Banner placed first so a casual reader
|
|
93
|
-
sees the warning before any rendered content.
|
|
94
|
-
|
|
95
|
-
base.md is excluded — CLAUDE.md doesn't need a pointer to itself.
|
|
96
|
-
"""
|
|
97
|
-
sources = _sources(project_root, include_base=False)
|
|
98
|
-
parts = [_BANNER + "\n"]
|
|
99
|
-
for src in sources:
|
|
100
|
-
body = _demote_headings(src.read_text().rstrip())
|
|
101
|
-
parts.append(f"## {src.stem}\n\n{body}\n")
|
|
102
|
-
return "\n".join(parts)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def _render_claude_md(project_root):
|
|
106
|
-
"""Update CLAUDE.md in place between AI-INSTRUCTIONS markers.
|
|
107
|
-
|
|
108
|
-
If markers exist: replace content strictly between them.
|
|
109
|
-
If markers don't exist: append markers + rendered block at EOF.
|
|
110
|
-
Content outside the markers is never touched.
|
|
111
|
-
"""
|
|
112
|
-
claude_path = project_root / "CLAUDE.md"
|
|
113
|
-
existing = claude_path.read_text() if claude_path.exists() else ""
|
|
114
|
-
block = _rendered_block(project_root)
|
|
115
|
-
marker_block = f"{BEGIN_MARKER}\n{block}\n{END_MARKER}\n"
|
|
116
|
-
|
|
117
|
-
if BEGIN_MARKER in existing and END_MARKER in existing:
|
|
118
|
-
begin = existing.index(BEGIN_MARKER)
|
|
119
|
-
end = existing.index(END_MARKER) + len(END_MARKER)
|
|
120
|
-
# Preserve trailing newline behavior from the original end-marker position.
|
|
121
|
-
trailing_nl = "\n" if end < len(existing) and existing[end] == "\n" else ""
|
|
122
|
-
new = existing[:begin] + marker_block.rstrip("\n") + trailing_nl + existing[end + len(trailing_nl):]
|
|
123
|
-
claude_path.write_text(new)
|
|
124
|
-
else:
|
|
125
|
-
# Append block at EOF (with a blank line separator).
|
|
126
|
-
sep = "" if existing.endswith("\n\n") or not existing else ("\n" if existing.endswith("\n") else "\n\n")
|
|
127
|
-
claude_path.write_text(existing + sep + marker_block)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def _render_cursor_rules(project_root):
|
|
131
|
-
"""One .cursor/rules/{name}.mdc per source file, with Cursor frontmatter.
|
|
132
|
-
|
|
133
|
-
Banner placed AFTER the frontmatter so Cursor's YAML parser still works.
|
|
134
|
-
base.md is excluded — Cursor reads its own rules, no redirect needed.
|
|
135
|
-
"""
|
|
136
|
-
rules_dir = project_root / ".cursor" / "rules"
|
|
137
|
-
rules_dir.mkdir(parents=True, exist_ok=True)
|
|
138
|
-
for src in _sources(project_root, include_base=False):
|
|
139
|
-
target = rules_dir / f"{src.stem}.mdc"
|
|
140
|
-
body = src.read_text().rstrip()
|
|
141
|
-
target.write_text(
|
|
142
|
-
"---\n"
|
|
143
|
-
"alwaysApply: true\n"
|
|
144
|
-
"---\n"
|
|
145
|
-
"\n"
|
|
146
|
-
f"{_BANNER}\n"
|
|
147
|
-
"\n"
|
|
148
|
-
f"{body}\n"
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def _check_targets_up_to_date(project_root):
|
|
153
|
-
"""Compare current target contents to what would be rendered.
|
|
154
|
-
|
|
155
|
-
Returns a list of stale target paths (relative to project_root). Empty
|
|
156
|
-
list = everything in sync.
|
|
157
|
-
|
|
158
|
-
Implementation: render to a temporary in-memory representation and diff
|
|
159
|
-
against current file contents. The cleanest way is to capture what
|
|
160
|
-
each render function would write before it writes; rather than
|
|
161
|
-
refactoring all three to return strings, we copy the current targets
|
|
162
|
-
out, run the renderers, diff, then restore on mismatch (so --check
|
|
163
|
-
has no side effect on the working tree).
|
|
164
|
-
"""
|
|
165
|
-
targets = ["AGENTS.md", "CLAUDE.md"]
|
|
166
|
-
rules_dir = project_root / ".cursor" / "rules"
|
|
167
|
-
for src in _sources(project_root):
|
|
168
|
-
targets.append(f".cursor/rules/{src.stem}.mdc")
|
|
169
|
-
|
|
170
|
-
# Snapshot current contents.
|
|
171
|
-
snapshot = {}
|
|
172
|
-
for rel in targets:
|
|
173
|
-
p = project_root / rel
|
|
174
|
-
snapshot[rel] = p.read_bytes() if p.exists() else None
|
|
175
|
-
|
|
176
|
-
# Run render to compute new contents.
|
|
177
|
-
_render_agents_md(project_root)
|
|
178
|
-
_render_claude_md(project_root)
|
|
179
|
-
_render_cursor_rules(project_root)
|
|
180
|
-
|
|
181
|
-
stale = []
|
|
182
|
-
for rel in targets:
|
|
183
|
-
p = project_root / rel
|
|
184
|
-
new = p.read_bytes() if p.exists() else None
|
|
185
|
-
if new != snapshot[rel]:
|
|
186
|
-
stale.append(rel)
|
|
187
|
-
|
|
188
|
-
# Restore original contents so --check has no side effect.
|
|
189
|
-
for rel, original in snapshot.items():
|
|
190
|
-
p = project_root / rel
|
|
191
|
-
if original is None:
|
|
192
|
-
if p.exists():
|
|
193
|
-
p.unlink()
|
|
194
|
-
else:
|
|
195
|
-
p.write_bytes(original)
|
|
196
|
-
return stale
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
def main():
|
|
200
|
-
parser = argparse.ArgumentParser(description="Render ai-instructions/*.md to tool files.")
|
|
201
|
-
parser.add_argument("--project-root", default=".",
|
|
202
|
-
help="Repo root (defaults to CWD)")
|
|
203
|
-
parser.add_argument("--check", action="store_true",
|
|
204
|
-
help="Exit 2 if any target is stale (CI mode); no writes.")
|
|
205
|
-
args = parser.parse_args()
|
|
206
|
-
root = Path(args.project_root).resolve()
|
|
207
|
-
|
|
208
|
-
if args.check:
|
|
209
|
-
stale = _check_targets_up_to_date(root)
|
|
210
|
-
if stale:
|
|
211
|
-
print("render_ai_instructions: stale targets:", file=sys.stderr)
|
|
212
|
-
for s in stale:
|
|
213
|
-
print(f" {s}", file=sys.stderr)
|
|
214
|
-
print("Re-run `python3 skills/trtc/room-builder/tools/render_ai_instructions.py` and commit the diff.",
|
|
215
|
-
file=sys.stderr)
|
|
216
|
-
return 2
|
|
217
|
-
return 0
|
|
218
|
-
|
|
219
|
-
_render_agents_md(root)
|
|
220
|
-
_render_claude_md(root)
|
|
221
|
-
_render_cursor_rules(root)
|
|
222
|
-
return 0
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if __name__ == "__main__":
|
|
226
|
-
sys.exit(main())
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: trtc-apply
|
|
3
|
-
description: >
|
|
4
|
-
INTERNAL structural gate for TRTC code generated by the topic / onboarding
|
|
5
|
-
skills. Not a user-facing skill, and NOT a correctness verifier. It does one
|
|
6
|
-
job: stop the AI from declaring a slice "done" and ending the turn before a
|
|
7
|
-
deterministic check has run. The check itself is lightweight — code exists +
|
|
8
|
-
the slice's entry symbol is wired up (with comment/string anti-cheat) — it
|
|
9
|
-
does NOT verify types, compilation, or runtime behavior. Triggered only by
|
|
10
|
-
other skills in this repo (topic step gates, onboarding A2). Do NOT route to
|
|
11
|
-
this skill when a user asks "review my code" or "check this implementation".
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# TRTC apply — Structural Gate
|
|
15
|
-
|
|
16
|
-
apply 是 topic / onboarding 代码交付流程里的一道**结构门**,不是正确性校验器。
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
它保证「流程没被跳过」,不保证「代码是对的」。
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
正确性由两处负责,不在 apply 范围内:
|
|
23
|
-
- **生成阶段**:slice 的 MUST / MUST NOT 约束指导代码怎么写。
|
|
24
|
-
- **客户侧**:在真实项目里编译 / 运行确认。apply 跑在客户五花八门的已有项目里,无法假设一个统一可靠的 build,因此**刻意不做编译**——编译失败往往与生成代码无关(历史报错、缺依赖、私有 registry、monorepo 配置),把它当门禁只会产生噪声并拖慢每个 slice。
|
|
25
|
-
|
|
26
|
-
本 skill 只有一种触发场景:topic / onboarding 生成代码后**内部调用**。它不是面向外部用户的"贴代码帮我检查"服务;若用户贴代码求排障,走 onboarding Path B。
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## 它实际做的两件事
|
|
31
|
-
|
|
32
|
-
### 1. 强制门(防止"自我宣布完成就停")
|
|
33
|
-
|
|
34
|
-
apply 接在状态机上。每个 slice 的状态流转:
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
slice_read → code_written → apply_passed → user_confirmed
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
- 写完代码后必须运行 `apply.py`,把状态从 `code_written` 推到 `apply_passed`,否则
|
|
41
|
-
- `guardrails/stop_require_apply_evidence.py`(Stop hook)会**拦住结束**:`code_written` 或 `apply_failed` 状态下不允许 AI 结束本轮。
|
|
42
|
-
|
|
43
|
-
这是 apply 真正的价值:LLM 不能写一段"看起来对"的代码就自我盖章完成。
|
|
44
|
-
|
|
45
|
-
### 2. 代码非空 + 入口符号检查(轻量,不等于正确)
|
|
46
|
-
|
|
47
|
-
`apply.py` 扫 `<project_root>/src/**/*.{vue,ts}`,做两件事:
|
|
48
|
-
|
|
49
|
-
- **代码非空**:`src/` 不存在或没有源码 → `static-only` → fail(没有可检查的内容,不放行)。
|
|
50
|
-
- **入口符号**:每个 slice 有一个「入口符号」(它的 composable / 组件,如 device-control 的 `useDeviceState`)。该入口符号作为**真实代码标识符**出现在某个源文件里即通过;没有出现则 fail;**该 slice 没有登记入口符号 → 跳过**(无法机械检查,绝不误判)。
|
|
51
|
-
|
|
52
|
-
入口符号映射是单一来源:`apply_lib/rule_parser.py` 的 `COMPOSABLE_TO_SLICE`(配 `entry_symbols_for_slice()`)。
|
|
53
|
-
|
|
54
|
-
- 匹配前先用 `_strip_comments_and_strings` 剥掉注释与字符串字面量——防止把入口塞进 `// 注释` 或 `"字符串"` 骗过检查(来自 demo-test-2 真实 bug)。**入口符号是代码标识符,从不出现在字符串里,所以这步剥离不会冤枉正确代码**(这正是它取代旧「MUST 符号 grep」的原因:旧检查会把写在字符串里的符号——如错误码常量——剥掉而产生假阴性)。
|
|
55
|
-
- 失败信息会点名该 slice 的入口 composable(那是它公开文档里的 import,不是隐藏的 API pattern,点名安全且有助修复)。
|
|
56
|
-
|
|
57
|
-
> 明确边界:这一步**不验证**参数 / 类型 / 调用顺序 / 是否被执行 / 能否编译 / 运行时行为,也**不再**逐条核对 slice 的 MUST 符号。它只回答"代码非空,且这个 slice 的能力入口被接上了"。正确性由 slice 的 MUST / MUST NOT 约束(生成阶段)和客户侧编译运行负责。
|
|
58
|
-
|
|
59
|
-
### 3. 重复声明检查(窄范围,真实编译错误)
|
|
60
|
-
|
|
61
|
-
`apply.py` 还有一个**高精度、窄范围**的编译安全检查:只针对"从 `use*()` 调用解构出来的名字"——同名被解构 ≥2 次,或被解构且又以 `const/function/class` 声明,则判为 `duplicate-declaration` 并 fail。两个真实案例:
|
|
62
|
-
|
|
63
|
-
- `const { getCameraList } = useDeviceState()` 之后又写 `function getCameraList()`;
|
|
64
|
-
- `subscribeEvent` 同时从 `useRoomParticipantState()` 和 `useRoomState()` 解构。
|
|
65
|
-
|
|
66
|
-
它**不是**通用重复声明 linter(两个不同作用域的同名局部 `const` 不会被误报)。修法是给其中一个解构起别名:`const { subscribeEvent: subscribeParticipantEvent } = useRoomParticipantState()`。
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## 调用方式
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
python3 skills/trtc-topic/scripts/apply.py --slice <slice_id>
|
|
74
|
-
# 或按交付单元
|
|
75
|
-
python3 skills/trtc-topic/scripts/apply.py --unit <unit_id>
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
- session 路径解析:`$TRTC_SESSION_PATH` → `$CLAUDE_PROJECT_DIR/.trtc-session.yaml` → `./.trtc-session.yaml`。
|
|
79
|
-
- 退出码:`0` 通过(状态 → `apply_passed`) / `1` 失败(状态 → `apply_failed`) / `2` 用法错误。
|
|
80
|
-
- 证据写入 `<session_dir>/.trtc-apply-evidence/<slug>.json`(状态、入口检查数 `entries_checked`、每个 slice 的 `entry_result`、未过项的语义文本)。
|
|
81
|
-
- `src/` 不存在或无源码 → 记为 `static-only`,结论为 `fail`(无可检查内容,不放行)。
|
|
82
|
-
|
|
83
|
-
`auto_advance_policy` 为 `pause_on_failure` / `pause_at_end` 时,通过后自动推进到 `user_confirmed`;否则(默认 `pause_each`)保留每步向用户确认的暂停。
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## 范围与非目标
|
|
88
|
-
|
|
89
|
-
| 在范围内 | 不在范围内 |
|
|
90
|
-
|---------|-----------|
|
|
91
|
-
| web / vue 生成代码 | iOS / Android / Flutter / Electron |
|
|
92
|
-
| 代码非空 + 单 slice 入口符号检查 | 类型 / 编译 / 运行时正确性 |
|
|
93
|
-
| 注释/字符串防作弊 | 逐条核对 slice 的 MUST 符号 / 参数 / 调用顺序 |
|
|
94
|
-
| 重复声明(编译安全)检查 | 跨 slice 前置状态、生命周期、清理对称性 |
|
|
95
|
-
| 状态机强制门 + Stop hook | 集成安全(diff 范围、SDK 初始化冲突、回归测试) |
|
|
96
|
-
|
|
97
|
-
入口符号检查只在「共用入口」(如 `conference` 对象同时承载 login-auth 与 room-lifecycle)上区分度较弱:导入一次即可让同入口的多个 slice 都过。这是「删掉逐符号 grep、改用入口门」时已接受的取舍——门的核心价值是状态机强制(不许自我盖章结束),而非判据的精度。跨 slice / 场景级的更强校验目前未实现,且不应硬编码进本门;正确性应由 slice 的 MUST / MUST NOT 约束与客户侧编译运行承接。
|