myagent-ai 1.0.0
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/Dockerfile +30 -0
- package/README.md +333 -0
- package/agents/__init__.py +6 -0
- package/agents/__pycache__/main_agent.cpython-312.pyc +0 -0
- package/agents/base.py +115 -0
- package/agents/main_agent.py +695 -0
- package/agents/memory_agent.py +313 -0
- package/agents/tool_agent.py +248 -0
- package/chatbot/__init__.py +5 -0
- package/chatbot/base.py +124 -0
- package/chatbot/discord_bot.py +146 -0
- package/chatbot/feishu_bot.py +548 -0
- package/chatbot/manager.py +164 -0
- package/chatbot/qq_bot.py +189 -0
- package/chatbot/telegram_bot.py +167 -0
- package/chatbot/wechat_bot.py +558 -0
- package/communication/__init__.py +66 -0
- package/communication/channel.py +576 -0
- package/communication/crypto.py +347 -0
- package/communication/manager.py +397 -0
- package/communication/peer.py +156 -0
- package/config.py +464 -0
- package/core/__init__.py +10 -0
- package/core/config_broadcast.py +276 -0
- package/core/llm.py +878 -0
- package/core/logger.py +241 -0
- package/core/task_queue.py +362 -0
- package/core/utils.py +184 -0
- package/executor/__init__.py +4 -0
- package/executor/__pycache__/engine.cpython-312.pyc +0 -0
- package/executor/engine.py +1215 -0
- package/groups/__init__.py +15 -0
- package/groups/manager.py +724 -0
- package/knowledge/__init__.py +4 -0
- package/knowledge/rag.py +444 -0
- package/main.py +801 -0
- package/memory/__init__.py +4 -0
- package/memory/manager.py +840 -0
- package/organization/__init__.py +4 -0
- package/organization/manager.py +350 -0
- package/package.json +58 -0
- package/requirements.txt +59 -0
- package/setup.py +40 -0
- package/skills/ASR/LICENSE.txt +21 -0
- package/skills/ASR/SKILL.md +580 -0
- package/skills/ASR/scripts/asr.ts +27 -0
- package/skills/LLM/LICENSE.txt +21 -0
- package/skills/LLM/SKILL.md +856 -0
- package/skills/LLM/scripts/chat.ts +32 -0
- package/skills/TTS/LICENSE.txt +21 -0
- package/skills/TTS/SKILL.md +735 -0
- package/skills/TTS/tts.ts +25 -0
- package/skills/VLM/LICENSE.txt +21 -0
- package/skills/VLM/SKILL.md +588 -0
- package/skills/VLM/scripts/vlm.ts +57 -0
- package/skills/__init__.py +5 -0
- package/skills/agent-browser/SKILL.md +328 -0
- package/skills/ai-news-collectors/SKILL.md +157 -0
- package/skills/ai-news-collectors/_meta.json +6 -0
- package/skills/ai-news-collectors/references/sources.md +128 -0
- package/skills/aminer-open-academic/SKILL.md +312 -0
- package/skills/aminer-open-academic/_meta.json +6 -0
- package/skills/aminer-open-academic/evals/evals.json +46 -0
- package/skills/aminer-open-academic/references/api-catalog.md +1032 -0
- package/skills/aminer-open-academic/scripts/__pycache__/aminer_client.cpython-312.pyc +0 -0
- package/skills/aminer-open-academic/scripts/aminer_client.py +875 -0
- package/skills/auto-target-tracker/SKILL.md +317 -0
- package/skills/base.py +147 -0
- package/skills/blog-writer/2024-02-17-radical-transparency-sales.md +35 -0
- package/skills/blog-writer/2024-02-17-raycast-spotlight-superpowers.md +33 -0
- package/skills/blog-writer/2024-02-17-short-form-content-marketing.md +47 -0
- package/skills/blog-writer/2024-02-17-typing-speed-benefits.md +33 -0
- package/skills/blog-writer/2024-03-14-effective-ai-prompts.md +55 -0
- package/skills/blog-writer/2024-11-08-ai-revolutionizing-entry-level-sales.md +43 -0
- package/skills/blog-writer/2025-11-12-why-ai-art-is-useless.md +49 -0
- package/skills/blog-writer/README.md +2 -0
- package/skills/blog-writer/SKILL.md +158 -0
- package/skills/blog-writer/__pycache__/manage_examples.cpython-312.pyc +0 -0
- package/skills/blog-writer/_meta.json +6 -0
- package/skills/blog-writer/manage_examples.py +90 -0
- package/skills/blog-writer/style-guide.md +160 -0
- package/skills/browser_skill.py +146 -0
- package/skills/coding-agent/SKILL.md +120 -0
- package/skills/coding-agent/_meta.json +6 -0
- package/skills/coding-agent/criteria.md +48 -0
- package/skills/coding-agent/execution.md +42 -0
- package/skills/coding-agent/memory-template.md +38 -0
- package/skills/coding-agent/planning.md +31 -0
- package/skills/coding-agent/state.md +60 -0
- package/skills/coding-agent/verification.md +39 -0
- package/skills/content-strategy/SKILL.md +181 -0
- package/skills/content-strategy/_meta.json +6 -0
- package/skills/contentanalysis/ExtractWisdom/SKILL.md +229 -0
- package/skills/contentanalysis/ExtractWisdom/Workflows/Extract.md +60 -0
- package/skills/contentanalysis/SKILL.md +14 -0
- package/skills/docx/CHANGELOG.md +85 -0
- package/skills/docx/LICENSE.txt +30 -0
- package/skills/docx/SKILL.md +455 -0
- package/skills/docx/docx-js.md +681 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/docx/ooxml/scripts/__pycache__/pack.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/__pycache__/unpack.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/__pycache__/validate.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/pack.py +159 -0
- package/skills/docx/ooxml/scripts/unpack.py +29 -0
- package/skills/docx/ooxml/scripts/validate.py +69 -0
- package/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/base.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/docx.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/pptx.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/redlining.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/base.py +951 -0
- package/skills/docx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/docx/ooxml.md +615 -0
- package/skills/docx/scripts/__init__.py +1 -0
- package/skills/docx/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/docx/scripts/__pycache__/add_toc_placeholders.cpython-312.pyc +0 -0
- package/skills/docx/scripts/__pycache__/document.cpython-312.pyc +0 -0
- package/skills/docx/scripts/__pycache__/utilities.cpython-312.pyc +0 -0
- package/skills/docx/scripts/add_toc_placeholders.py +220 -0
- package/skills/docx/scripts/document.py +1302 -0
- package/skills/docx/scripts/templates/comments.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/skills/docx/scripts/templates/people.xml +3 -0
- package/skills/docx/scripts/utilities.py +374 -0
- package/skills/dream-interpreter/SKILL.md +88 -0
- package/skills/dream-interpreter/assets/example_asset.txt +24 -0
- package/skills/dream-interpreter/references/api_reference.md +34 -0
- package/skills/dream-interpreter/references/interpretation-guide.md +83 -0
- package/skills/dream-interpreter/references/output-schema.md +65 -0
- package/skills/dream-interpreter/references/questioning-strategy.md +62 -0
- package/skills/dream-interpreter/references/visual-mapping.md +81 -0
- package/skills/dream-interpreter/scripts/__pycache__/example.cpython-312.pyc +0 -0
- package/skills/dream-interpreter/scripts/example.py +19 -0
- package/skills/dream-interpreter/skill.json +7 -0
- package/skills/file_skill.py +246 -0
- package/skills/finance/Finance_API_Doc.md +445 -0
- package/skills/finance/SKILL.md +53 -0
- package/skills/fullstack-dev/SKILL.md +205 -0
- package/skills/get-fortune-analysis/SKILL.md +370 -0
- package/skills/get-fortune-analysis/lunar_python.py +91 -0
- package/skills/gift-evaluator/SKILL.md +83 -0
- package/skills/gift-evaluator/__pycache__/html_tools.cpython-312.pyc +0 -0
- package/skills/gift-evaluator/html_tools.py +268 -0
- package/skills/image-edit/LICENSE.txt +21 -0
- package/skills/image-edit/SKILL.md +896 -0
- package/skills/image-edit/scripts/image-edit.ts +36 -0
- package/skills/image-generation/LICENSE.txt +21 -0
- package/skills/image-generation/SKILL.md +583 -0
- package/skills/image-generation/scripts/image-generation.ts +28 -0
- package/skills/image-understand/LICENSE.txt +21 -0
- package/skills/image-understand/SKILL.md +855 -0
- package/skills/image-understand/scripts/image-understand.ts +41 -0
- package/skills/interview-designer/README.md +70 -0
- package/skills/interview-designer/SKILL.md +53 -0
- package/skills/interview-designer/_meta.json +6 -0
- package/skills/interview-designer/references/design_rationale.md +43 -0
- package/skills/interview-designer/templates/interview_guide_template.md +62 -0
- package/skills/market-research-reports/SKILL.md +901 -0
- package/skills/market-research-reports/assets/FORMATTING_GUIDE.md +428 -0
- package/skills/market-research-reports/assets/market_report_template.tex +1380 -0
- package/skills/market-research-reports/assets/market_research.sty +564 -0
- package/skills/market-research-reports/references/data_analysis_patterns.md +548 -0
- package/skills/market-research-reports/references/report_structure_guide.md +999 -0
- package/skills/market-research-reports/references/visual_generation_guide.md +1077 -0
- package/skills/market-research-reports/scripts/__pycache__/generate_market_visuals.cpython-312.pyc +0 -0
- package/skills/market-research-reports/scripts/generate_market_visuals.py +529 -0
- package/skills/marketing-mode/README.md +49 -0
- package/skills/marketing-mode/SKILL.md +693 -0
- package/skills/marketing-mode/_meta.json +6 -0
- package/skills/marketing-mode/mode-prompt.md +39 -0
- package/skills/marketing-mode/skill.json +51 -0
- package/skills/mindfulness-meditation/SKILL.md +65 -0
- package/skills/mindfulness-meditation/_meta.json +6 -0
- package/skills/multi-search-engine/CHANGELOG.md +15 -0
- package/skills/multi-search-engine/CHANNELLOG.md +48 -0
- package/skills/multi-search-engine/SKILL.md +78 -0
- package/skills/multi-search-engine/_meta.json +6 -0
- package/skills/multi-search-engine/config.json +14 -0
- package/skills/multi-search-engine/metadata.json +7 -0
- package/skills/multi-search-engine/references/international-search.md +651 -0
- package/skills/pdf/LICENSE.txt +30 -0
- package/skills/pdf/SKILL.md +1534 -0
- package/skills/pdf/forms.md +205 -0
- package/skills/pdf/reference.md +765 -0
- package/skills/pdf/scripts/__pycache__/add_zai_metadata.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/check_bounding_boxes.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/check_bounding_boxes_test.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/check_fillable_fields.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/convert_pdf_to_images.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/create_validation_image.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/extract_form_field_info.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/fill_fillable_fields.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/fill_pdf_form_with_annotations.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/sanitize_code.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/add_zai_metadata.py +172 -0
- package/skills/pdf/scripts/check_bounding_boxes.py +70 -0
- package/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/skills/pdf/scripts/check_fillable_fields.py +12 -0
- package/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/skills/pdf/scripts/create_validation_image.py +41 -0
- package/skills/pdf/scripts/extract_form_field_info.py +152 -0
- package/skills/pdf/scripts/fill_fillable_fields.py +114 -0
- package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/skills/pdf/scripts/sanitize_code.py +110 -0
- package/skills/podcast-generate/LICENSE.txt +21 -0
- package/skills/podcast-generate/SKILL.md +198 -0
- package/skills/podcast-generate/generate.ts +661 -0
- package/skills/podcast-generate/package.json +30 -0
- package/skills/podcast-generate/readme.md +177 -0
- package/skills/podcast-generate/test_data/segments.jsonl +3 -0
- package/skills/podcast-generate/tsconfig.json +26 -0
- package/skills/pptx/LICENSE.txt +30 -0
- package/skills/pptx/SKILL.md +507 -0
- package/skills/pptx/html2pptx.md +625 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/pptx/ooxml/scripts/__pycache__/pack.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/__pycache__/unpack.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/__pycache__/validate.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/pack.py +159 -0
- package/skills/pptx/ooxml/scripts/unpack.py +29 -0
- package/skills/pptx/ooxml/scripts/validate.py +69 -0
- package/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/base.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/docx.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/pptx.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/redlining.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/base.py +951 -0
- package/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/pptx/ooxml.md +427 -0
- package/skills/pptx/scripts/__pycache__/inventory.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/inventory.cpython-313.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/rearrange.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/replace.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/thumbnail.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/html2pptx.js +1044 -0
- package/skills/pptx/scripts/inventory.py +1020 -0
- package/skills/pptx/scripts/rearrange.py +231 -0
- package/skills/pptx/scripts/replace.py +385 -0
- package/skills/pptx/scripts/thumbnail.py +450 -0
- package/skills/qingyan-research/SKILL.md +294 -0
- package/skills/qingyan-research/__pycache__/generate_html.cpython-312.pyc +0 -0
- package/skills/qingyan-research/generate_html.py +33 -0
- package/skills/registry.py +344 -0
- package/skills/search_skill.py +228 -0
- package/skills/seo-content-writer/SKILL.md +661 -0
- package/skills/seo-content-writer/_meta.json +6 -0
- package/skills/seo-content-writer/references/content-structure-templates.md +875 -0
- package/skills/seo-content-writer/references/title-formulas.md +339 -0
- package/skills/skill-creator/LICENSE.txt +202 -0
- package/skills/skill-creator/SKILL.md +485 -0
- package/skills/skill-creator/agents/analyzer.md +274 -0
- package/skills/skill-creator/agents/comparator.md +202 -0
- package/skills/skill-creator/agents/grader.md +223 -0
- package/skills/skill-creator/assets/eval_review.html +146 -0
- package/skills/skill-creator/eval-viewer/__pycache__/generate_review.cpython-312.pyc +0 -0
- package/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/skills/skill-creator/references/schemas.md +430 -0
- package/skills/skill-creator/scripts/__init__.py +0 -0
- package/skills/skill-creator/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/aggregate_benchmark.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/generate_report.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/improve_description.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/package_skill.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/quick_validate.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/run_eval.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/run_loop.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/utils.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/skills/skill-creator/scripts/generate_report.py +326 -0
- package/skills/skill-creator/scripts/improve_description.py +236 -0
- package/skills/skill-creator/scripts/package_skill.py +136 -0
- package/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/skills/skill-creator/scripts/run_eval.py +310 -0
- package/skills/skill-creator/scripts/run_loop.py +328 -0
- package/skills/skill-creator/scripts/utils.py +47 -0
- package/skills/skill-finder-cn/SKILL.md +66 -0
- package/skills/skill-finder-cn/_meta.json +6 -0
- package/skills/skill-finder-cn/package.json +5 -0
- package/skills/skill-finder-cn/scripts/search.sh +15 -0
- package/skills/skill-vetter/SKILL.md +137 -0
- package/skills/stock-analysis-skill/SKILL.md +156 -0
- package/skills/stock-analysis-skill/package.json +21 -0
- package/skills/stock-analysis-skill/src/analyzer.ts +264 -0
- package/skills/stock-analysis-skill/src/dataFetcher.ts +130 -0
- package/skills/stock-analysis-skill/src/dividend.ts +226 -0
- package/skills/stock-analysis-skill/src/index.ts +327 -0
- package/skills/stock-analysis-skill/src/rumorScanner.ts +200 -0
- package/skills/stock-analysis-skill/src/types.ts +167 -0
- package/skills/stock-analysis-skill/src/watchlist.ts +292 -0
- package/skills/stock-analysis-skill/tsconfig.json +15 -0
- package/skills/storyboard-manager/SKILL.md +532 -0
- package/skills/storyboard-manager/index.js +9 -0
- package/skills/storyboard-manager/package.json +11 -0
- package/skills/storyboard-manager/references/character_development.md +232 -0
- package/skills/storyboard-manager/references/story_structures.md +148 -0
- package/skills/storyboard-manager/scripts/__pycache__/consistency_checker.cpython-312.pyc +0 -0
- package/skills/storyboard-manager/scripts/__pycache__/timeline_tracker.cpython-312.pyc +0 -0
- package/skills/storyboard-manager/scripts/consistency_checker.py +391 -0
- package/skills/storyboard-manager/scripts/timeline_tracker.py +352 -0
- package/skills/system_skill.py +249 -0
- package/skills/ui-ux-pro-max/SKILL.md +43 -0
- package/skills/ui-ux-pro-max/_meta.json +6 -0
- package/skills/ui-ux-pro-max/assets/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/assets/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/assets/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/assets/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/assets/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/assets/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/assets/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/assets/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/assets/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/assets/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/assets/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/references/upstream-README.md +488 -0
- package/skills/ui-ux-pro-max/references/upstream-skill-content.md +288 -0
- package/skills/ui-ux-pro-max/scripts/__init__.py +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/search.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +1071 -0
- package/skills/ui-ux-pro-max/scripts/search.py +111 -0
- package/skills/video-generation/LICENSE.txt +21 -0
- package/skills/video-generation/SKILL.md +1082 -0
- package/skills/video-generation/scripts/video.ts +168 -0
- package/skills/video-understand/LICENSE.txt +21 -0
- package/skills/video-understand/SKILL.md +916 -0
- package/skills/video-understand/scripts/video-understand.ts +41 -0
- package/skills/visual-design-foundations/SKILL.md +318 -0
- package/skills/visual-design-foundations/references/color-systems.md +417 -0
- package/skills/visual-design-foundations/references/spacing-iconography.md +425 -0
- package/skills/visual-design-foundations/references/typography-systems.md +432 -0
- package/skills/web-reader/LICENSE.txt +21 -0
- package/skills/web-reader/SKILL.md +1140 -0
- package/skills/web-reader/scripts/web-reader.ts +37 -0
- package/skills/web-search/LICENSE.txt +21 -0
- package/skills/web-search/SKILL.md +912 -0
- package/skills/web-search/scripts/web_search.ts +44 -0
- package/skills/web-shader-extractor/SKILL.md +145 -0
- package/skills/web-shader-extractor/references/config-extraction.md +50 -0
- package/skills/web-shader-extractor/references/encoded-definitions.md +53 -0
- package/skills/web-shader-extractor/references/extraction-workflow.md +61 -0
- package/skills/web-shader-extractor/references/porting-strategy.md +164 -0
- package/skills/web-shader-extractor/references/shader-injection.md +126 -0
- package/skills/web-shader-extractor/references/shaders-com.md +190 -0
- package/skills/web-shader-extractor/references/tech-signatures.md +54 -0
- package/skills/web-shader-extractor/references/tsl-extraction.md +41 -0
- package/skills/web-shader-extractor/references/unicorn-studio.md +353 -0
- package/skills/web-shader-extractor/scripts/fetch-rendered-dom.mjs +153 -0
- package/skills/web-shader-extractor/scripts/scan-bundle.sh +76 -0
- package/skills/writing-plans/SKILL.md +116 -0
- package/skills/writing-plans/_meta.json +6 -0
- package/skills/xlsx/LICENSE.txt +30 -0
- package/skills/xlsx/SKILL.md +496 -0
- package/skills/xlsx/__pycache__/recalc.cpython-312.pyc +0 -0
- package/skills/xlsx/recalc.py +178 -0
- package/start.sh +36 -0
- package/web/__init__.py +1 -0
- package/web/__pycache__/api_server.cpython-312.pyc +0 -0
- package/web/api_server.py +2043 -0
- package/web/ui/chat.html +3235 -0
- package/web/ui/index.html +458 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import ZAI from 'z-ai-web-dev-sdk';
|
|
2
|
+
|
|
3
|
+
interface SearchFunctionResultItem {
|
|
4
|
+
url: string;
|
|
5
|
+
name: string;
|
|
6
|
+
snippet: string;
|
|
7
|
+
host_name: string;
|
|
8
|
+
rank: number;
|
|
9
|
+
date: string;
|
|
10
|
+
favicon: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async function main(query: string, num: number = 10) {
|
|
14
|
+
try {
|
|
15
|
+
const zai = await ZAI.create();
|
|
16
|
+
|
|
17
|
+
const searchResult = await zai.functions.invoke('web_search', {
|
|
18
|
+
query: query,
|
|
19
|
+
num: num
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
console.log('Search Results:');
|
|
23
|
+
console.log('================\n');
|
|
24
|
+
|
|
25
|
+
if (Array.isArray(searchResult)) {
|
|
26
|
+
searchResult.forEach((item: SearchFunctionResultItem, index: number) => {
|
|
27
|
+
console.log(`${index + 1}. ${item.name}`);
|
|
28
|
+
console.log(` URL: ${item.url}`);
|
|
29
|
+
console.log(` Snippet: ${item.snippet}`);
|
|
30
|
+
console.log(` Host: ${item.host_name}`);
|
|
31
|
+
console.log(` Date: ${item.date}`);
|
|
32
|
+
console.log('');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
console.log(`\nTotal results: ${searchResult.length}`);
|
|
36
|
+
} else {
|
|
37
|
+
console.log('Unexpected response format:', searchResult);
|
|
38
|
+
}
|
|
39
|
+
} catch (err: any) {
|
|
40
|
+
console.error('Web search failed:', err?.message || err);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
main('What is the capital of France?', 5);
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-shader-extractor
|
|
3
|
+
description: |
|
|
4
|
+
从网页中提取 WebGL/Canvas/Shader 视觉特效代码,反混淆后移植为独立原生 JS 项目。
|
|
5
|
+
触发条件:用户提供网址并要求提取 shader、提取特效、提取动画效果、提取 canvas 效果、
|
|
6
|
+
复刻某网站的视觉效果、"把这个网站的背景效果扒下来" 等。
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Web Shader Extractor
|
|
10
|
+
|
|
11
|
+
从网页提取 WebGL/Canvas/Shader 特效,反混淆并移植为独立项目。
|
|
12
|
+
|
|
13
|
+
核心原则:
|
|
14
|
+
- **先 1:1 复刻,确认正确后再考虑简化框架**
|
|
15
|
+
- **全程自主执行,不中断用户** — 提取是只读操作,安全性无风险。除 Phase 6 简化提议外,所有步骤自动完成,不询问用户确认。遇到问题自行判断最佳方案继续推进,只在需要用户做产品决策时才询问。
|
|
16
|
+
|
|
17
|
+
## Phase 0: 环境检查(首次自动执行)
|
|
18
|
+
|
|
19
|
+
在开始提取前,检查并自动安装所需依赖。**不要询问用户,直接安装**。
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# 1. 检查 Node.js
|
|
23
|
+
node --version 2>/dev/null || {
|
|
24
|
+
echo "Node.js not found, installing..."
|
|
25
|
+
# macOS
|
|
26
|
+
brew install node 2>/dev/null || {
|
|
27
|
+
# fallback: 直接下载 LTS
|
|
28
|
+
curl -fsSL https://nodejs.org/dist/v22.15.0/node-v22.15.0-darwin-arm64.tar.gz | tar xz -C /usr/local --strip-components=1
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# 2. Playwright 及浏览器(fetch-rendered-dom.mjs 内置自动安装,但这里预检可提前发现问题)
|
|
33
|
+
RUNNER_DIR="$HOME/.cache/playwright-runner"
|
|
34
|
+
if [ ! -d "$RUNNER_DIR/node_modules/playwright" ]; then
|
|
35
|
+
echo "Installing Playwright (one-time setup)..."
|
|
36
|
+
mkdir -p "$RUNNER_DIR"
|
|
37
|
+
echo '{"type":"module"}' > "$RUNNER_DIR/package.json"
|
|
38
|
+
npm install playwright --prefix "$RUNNER_DIR"
|
|
39
|
+
npx --prefix "$RUNNER_DIR" playwright install chromium
|
|
40
|
+
echo "Playwright + Chromium installed."
|
|
41
|
+
fi
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
如果安装过程中遇到权限或网络问题,尝试以下备选方案:
|
|
45
|
+
- npm 权限问题 → 使用 `--prefix` 安装到用户目录
|
|
46
|
+
- 网络问题(Chromium 下载慢)→ 设置 `PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright` 使用国内镜像
|
|
47
|
+
- 实在无法安装 Playwright → 降级为纯 curl 模式(跳过 DOM 渲染,仅分析静态 HTML + JS bundle),在 Phase 2 中标注可能缺失 canvas-info
|
|
48
|
+
|
|
49
|
+
## Phase 1: 获取源码
|
|
50
|
+
|
|
51
|
+
**并行执行**:Playwright 获取渲染后 DOM + curl 获取静态 HTML。
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Playwright(获取 canvas 引擎版本、组件树、运行时网络请求)
|
|
55
|
+
node ~/.claude/skills/web-shader-extractor/scripts/fetch-rendered-dom.mjs '<URL>'
|
|
56
|
+
# → /tmp/rendered/: dom.html, canvas-info.json, network.json, screenshot.png, console.log
|
|
57
|
+
|
|
58
|
+
# curl(获取原始 HTML,用于提取内嵌配置和密钥)
|
|
59
|
+
curl -s -L --compressed '<URL>' > /tmp/page.html
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
如果 Playwright 脚本失败(未安装/启动异常),先尝试自动修复(重新安装依赖),若仍失败则降级为纯 curl 模式继续工作,不要停下来询问用户。
|
|
63
|
+
|
|
64
|
+
从 network.json 和 HTML 交叉提取 JS URL,批量下载到 /tmp/。
|
|
65
|
+
|
|
66
|
+
### Phase 2: 技术栈识别
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
canvas-info.json 的 dataEngine 字段:
|
|
70
|
+
├─ "three.js rXXX" → Three.js(r170+ 可能是 TSL → references/tsl-extraction.md)
|
|
71
|
+
├─ "Babylon.js vX.X" → Babylon.js
|
|
72
|
+
├─ null → 进一步区分:
|
|
73
|
+
│ ├─ bundle 含 createShader/shaderSource → Raw WebGL / PixiJS
|
|
74
|
+
│ └─ bundle 含 getContext('2d') 且无 WebGL 调用 → 2D Canvas(→ references/porting-strategy.md § 2D Canvas)
|
|
75
|
+
└─ 无 canvas → CSS/SVG 动画
|
|
76
|
+
|
|
77
|
+
URL 或 HTML 特征匹配已知平台 → 直接跳转专用工作流(跳过通用 Phase 3-4):
|
|
78
|
+
├─ unicorn.studio → references/unicorn-studio.md(Firestore REST API 直取配置+shader)
|
|
79
|
+
└─ shaders.com → references/shaders-com.md(Nuxt payload + XOR 解码 + TSL→GLSL 翻译)
|
|
80
|
+
|
|
81
|
+
扫描确认:bash scripts/scan-bundle.sh /tmp/*.js
|
|
82
|
+
→ 框架特征速查 references/tech-signatures.md
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Phase 3: 配置提取
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
1. 搜索公开 API → 直接获取配置(API 返回可能是编码的 → references/encoded-definitions.md)
|
|
89
|
+
2. 从 Nuxt payload / __NEXT_DATA__ / HTML 内嵌 JSON 提取
|
|
90
|
+
3. 从 JS bundle 提取默认值
|
|
91
|
+
→ 详见 references/config-extraction.md
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Phase 4: Shader 代码提取
|
|
95
|
+
|
|
96
|
+
用 **Agent** 分析 JS bundle(1MB+ 不适合主上下文)。
|
|
97
|
+
→ Agent prompt 模板和反混淆规则 `references/extraction-workflow.md`
|
|
98
|
+
|
|
99
|
+
### Phase 5: 移植
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
纯 2D 全屏 shader → 原生 WebGL2(零依赖)
|
|
103
|
+
3D / PBR / GPGPU → 保留原始框架(CDN importmap)
|
|
104
|
+
不确定 → 先用原始框架,Phase 6 再评估
|
|
105
|
+
→ 详见 references/porting-strategy.md
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Phase 6: 简化评估
|
|
109
|
+
|
|
110
|
+
移植完成后,自行验证效果(打开页面截图对比)。如果效果正确且存在简化空间,**向用户提议简化方案**,由用户决定是否执行。
|
|
111
|
+
|
|
112
|
+
### Phase 7: 提取报告(询问用户是否生成)
|
|
113
|
+
|
|
114
|
+
提取完成后,**询问用户**是否生成 `EXTRACTION-REPORT.md`(会消耗额外 token 回顾对话历史)。
|
|
115
|
+
|
|
116
|
+
报告内容结构:
|
|
117
|
+
```markdown
|
|
118
|
+
# 提取报告:{项目名}
|
|
119
|
+
**来源/作者/平台/时间**
|
|
120
|
+
|
|
121
|
+
## 目标效果(一句话描述)
|
|
122
|
+
## 提取思路与时间线(每个迭代的问题→修复)
|
|
123
|
+
## 场景结构(组件树/图层结构)
|
|
124
|
+
## 最终渲染管线(pass 列表)
|
|
125
|
+
## 关键资源文件
|
|
126
|
+
## 发现的关键经验(表格:经验/影响/沉淀位置)
|
|
127
|
+
## 剩余已知差异
|
|
128
|
+
## 技术栈(原始 vs 移植)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
报告放在项目目录内(如 `ascii-glyph-dither/EXTRACTION-REPORT.md`)。
|
|
132
|
+
|
|
133
|
+
## Reference 索引
|
|
134
|
+
|
|
135
|
+
| 需要时 | 读取 |
|
|
136
|
+
|--------|------|
|
|
137
|
+
| 识别框架(Three.js/WebGL/PixiJS 特征) | `references/tech-signatures.md` |
|
|
138
|
+
| Agent 提取 prompt + 反混淆规则 | `references/extraction-workflow.md` |
|
|
139
|
+
| 获取配置参数(API/payload/内嵌) | `references/config-extraction.md` |
|
|
140
|
+
| Three.js TSL 节点 shader 重建 | `references/tsl-extraction.md` |
|
|
141
|
+
| 编码/加密配置解码 | `references/encoded-definitions.md` |
|
|
142
|
+
| onBeforeCompile GLSL 注入陷阱 | `references/shader-injection.md` |
|
|
143
|
+
| 移植框架选择 + 项目结构 | `references/porting-strategy.md` |
|
|
144
|
+
| **Unicorn Studio** 专用流程(curtains.js + Firestore) | `references/unicorn-studio.md` |
|
|
145
|
+
| **shaders.com** 专用流程(TSL + XOR 编码 + Y-flip 陷阱) | `references/shaders-com.md` |
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# 配置参数提取
|
|
2
|
+
|
|
3
|
+
配置值必须从源站提取,不猜测。(猜错实例:颜色差 60x、图案完全不同)
|
|
4
|
+
|
|
5
|
+
## 来源(按优先级)
|
|
6
|
+
|
|
7
|
+
### 1. 公开 REST API
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# 在 JS bundle 中搜索 API 端点
|
|
11
|
+
grep -oE 'api/(presets|shaders|collections)[^"]*' /tmp/*.js
|
|
12
|
+
# 直接调用
|
|
13
|
+
curl -s -L --compressed 'https://example.com/api/collections/slug/uuid'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
API 返回可能是编码的 → 见 `encoded-definitions.md`
|
|
17
|
+
|
|
18
|
+
### 2. Nuxt.js Payload
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
grep -oE '_payload\.json[^"]*' /tmp/page.html # payload URL
|
|
22
|
+
grep -oE 'public:\{[^}]*\}' /tmp/page.html # runtime config(可能含密钥)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 3. Next.js
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# App Router (RSC)
|
|
29
|
+
grep -oE '"(scene|glass|postProcessing)":\{' /tmp/page.html
|
|
30
|
+
# Pages Router
|
|
31
|
+
grep -o '<script id="__NEXT_DATA__"[^>]*>[^<]*' /tmp/page.html | sed 's/.*>//'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 4. 内联 JSON / window 全局变量
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
grep -oE 'window\.__CONFIG__\s*=\s*\{[^;]+' /tmp/page.html
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 5. JS Bundle 默认值(最后手段)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
grep -oE '(config|options|settings)\s*=\s*\{' /tmp/entry-chunk.js
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 验证
|
|
47
|
+
|
|
48
|
+
- 颜色范围:0-1 还是 0-255?
|
|
49
|
+
- resolution:像素值还是比例系数?
|
|
50
|
+
- 布尔值:`false` 是否跳过整个渲染 pass?
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# 编码配置解码
|
|
2
|
+
|
|
3
|
+
## 识别信号
|
|
4
|
+
|
|
5
|
+
1. API 返回有 `_encoded: true` 标志
|
|
6
|
+
2. `definition` 字段是 Base64 字符串而非 JSON
|
|
7
|
+
3. JS 中有 `atob()`/`btoa()` + `TextEncoder`/`TextDecoder` + XOR
|
|
8
|
+
4. Runtime config 中有 `obfuscationKey`
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
grep -oE '(atob|btoa|obfuscation|_encoded)' /tmp/*.js | sort | uniq -c
|
|
12
|
+
grep -oE 'obfuscationKey:"[^"]*"' /tmp/page.html
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 常见方案
|
|
16
|
+
|
|
17
|
+
### Base64 + XOR
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
import base64, json
|
|
21
|
+
|
|
22
|
+
def decode(encoded, key):
|
|
23
|
+
raw = base64.b64decode(encoded)
|
|
24
|
+
key_bytes = key.encode('utf-8')
|
|
25
|
+
decrypted = bytes([raw[i] ^ key_bytes[i % len(key_bytes)] for i in range(len(raw))])
|
|
26
|
+
return json.loads(decrypted.decode('utf-8'))
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 短码映射(组件/属性名缩写)
|
|
30
|
+
|
|
31
|
+
配置中 `C74`/`p29` 代替 `StudioBackground`/`color`。
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
grep -oE '(codeToComponent|codeToProp)' /tmp/bundle.js
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
映射表通常是动态生成的——所有名称按字母排序分配 `C{nn}`/`p{nn}` 编号。
|
|
38
|
+
|
|
39
|
+
## 密钥来源
|
|
40
|
+
|
|
41
|
+
| 框架 | 位置 |
|
|
42
|
+
|------|------|
|
|
43
|
+
| Nuxt.js | `public:{obfuscationKey:"..."}` in HTML |
|
|
44
|
+
| Next.js | `__NEXT_DATA__` 的 runtimeConfig |
|
|
45
|
+
| SPA | bundle 常量或 `window.__CONFIG__` |
|
|
46
|
+
|
|
47
|
+
## 查找解码函数
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
grep -l '_encoded' /tmp/*.js
|
|
51
|
+
grep -A3 '_encoded' /tmp/bundle.js
|
|
52
|
+
# 模式:if (t._encoded) { return decode(t.definition, key) }
|
|
53
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Shader 代码提取:Agent Prompt 与反混淆
|
|
2
|
+
|
|
3
|
+
## Agent 深度提取 Prompt 模板
|
|
4
|
+
|
|
5
|
+
启动 Agent(subagent_type: general-purpose)分析 bundle:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
分析文件 /tmp/main.js(约 X MB 的 minified JS bundle),提取所有与视觉特效相关的代码。
|
|
9
|
+
|
|
10
|
+
需要提取的内容:
|
|
11
|
+
|
|
12
|
+
1. **GLSL Shader 源码**:搜索包含 "precision", "uniform", "void main",
|
|
13
|
+
"gl_FragColor", "gl_Position" 的字符串。提取完整的 vertex/fragment shader。
|
|
14
|
+
|
|
15
|
+
2. **渲染相关 JS 类**:canvas/renderer 创建、粒子/几何体管理、
|
|
16
|
+
requestAnimationFrame 动画循环、鼠标交互代码。
|
|
17
|
+
|
|
18
|
+
3. **符号映射表**:minified 变量名 → 原始含义
|
|
19
|
+
(THREE.Vector2, THREE.Color, THREE.Scene 等)
|
|
20
|
+
|
|
21
|
+
4. **配置和参数**:默认颜色、尺寸、密度等可调参数
|
|
22
|
+
|
|
23
|
+
将所有提取的代码保存到 /tmp/extracted-effects.txt,按功能分段标注。
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**关键**:Agent 能看到完整文件,主上下文放不下 1MB+ 的 bundle。
|
|
27
|
+
|
|
28
|
+
## 识别 Minified 符号
|
|
29
|
+
|
|
30
|
+
通过构造参数和方法调用推断:
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
new ??(40, w/h, 0.1, 1000) → PerspectiveCamera(fov, aspect, near, far)
|
|
34
|
+
new ??(-1, 1, 1, -1, 0, 1) → OrthographicCamera
|
|
35
|
+
new ??({canvas, antialias, ...}) → WebGLRenderer
|
|
36
|
+
new ??(2, 2) → PlaneGeometry(w, h)
|
|
37
|
+
new ??(data, w, h, fmt, type) → DataTexture
|
|
38
|
+
new ??(w, h, {minFilter, ...}) → WebGLRenderTarget
|
|
39
|
+
|
|
40
|
+
??.setRenderTarget() → renderer
|
|
41
|
+
??.getElapsedTime() → clock
|
|
42
|
+
??.setAttribute() → bufferGeometry
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 框架脱壳(React / Vue 等 → Vanilla JS)
|
|
46
|
+
|
|
47
|
+
Canvas 效果常被 React/Vue 等框架包装。脱壳思路:
|
|
48
|
+
|
|
49
|
+
1. **找副作用入口**:`useEffect`/`onMounted` 中的 Canvas 初始化代码就是核心逻辑
|
|
50
|
+
2. **收集 cleanup**:所有销毁操作(`removeEventListener`、`cancelAnimationFrame`、`observer.disconnect()`)汇总为 `destroy()` 函数
|
|
51
|
+
3. **丢弃响应式包装**:Canvas 状态(粒子位置、帧计数等)只在 RAF 内读写,直接用 `let` 变量,不需要 `useState`/`ref` 等响应式容器
|
|
52
|
+
|
|
53
|
+
原生 API(`IntersectionObserver`、`ResizeObserver`、`matchMedia` 等)不受框架影响,原样保留。
|
|
54
|
+
|
|
55
|
+
## 反混淆规则
|
|
56
|
+
|
|
57
|
+
1. **类名**:根据构造参数和方法调用推断
|
|
58
|
+
2. **变量名**:根据用途命名(`ringPos`, `particleScale`, `simMaterial`)
|
|
59
|
+
3. **Shader 变量**:uniform/varying 名通常未被 minify(`uTime`, `vPosition`)
|
|
60
|
+
4. **保留原始 GLSL**:shader 代码通常是完整字符串,直接提取
|
|
61
|
+
5. **字符串注入**:`${someVar.noise}` 表示噪声库被注入到 shader 中
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# 移植策略
|
|
2
|
+
|
|
3
|
+
## 框架选择
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
纯 2D Canvas(getContext('2d'),无 WebGL)?
|
|
7
|
+
├─ YES → Vanilla JS(零依赖,见下方 § 2D Canvas)
|
|
8
|
+
└─ NO → 纯 2D 全屏 shader / 后处理?
|
|
9
|
+
├─ YES → 原生 WebGL2(零依赖)
|
|
10
|
+
└─ NO → 涉及 3D / PBR / GPGPU / onBeforeCompile?
|
|
11
|
+
├─ YES → 保留原始框架(CDN importmap)
|
|
12
|
+
└─ 不确定 → 先用原始框架,Phase 6 再评估
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 原生 WebGL 项目结构
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
<name>/
|
|
19
|
+
├── index.html # <canvas>
|
|
20
|
+
├── js/
|
|
21
|
+
│ ├── main.js # WebGL2 初始化 + 多 pass 渲染循环
|
|
22
|
+
│ └── shaders/ # .glsl.js(export const fragmentShader)
|
|
23
|
+
└── README.md
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- `canvas.getContext('webgl2')` + `#version 300 es`(`in`/`out`、`texture()`)
|
|
27
|
+
- 多 pass 用 framebuffer + texture attachment
|
|
28
|
+
- `requestAnimationFrame` 驱动
|
|
29
|
+
|
|
30
|
+
## Three.js 项目结构
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
<name>/
|
|
34
|
+
├── index.html # importmap CDN
|
|
35
|
+
├── js/
|
|
36
|
+
│ ├── main.js # 场景/相机/渲染器 + RTT 管线
|
|
37
|
+
│ └── shaders/ # .glsl.js
|
|
38
|
+
└── README.md
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- `RawShaderMaterial` + `glslVersion: THREE.GLSL3`
|
|
42
|
+
- `WebGLRenderTarget` 做多 pass
|
|
43
|
+
- CDN importmap,零安装
|
|
44
|
+
|
|
45
|
+
CDN 模板:
|
|
46
|
+
```html
|
|
47
|
+
<script type="importmap">
|
|
48
|
+
{ "imports": { "three": "https://cdn.jsdelivr.net/npm/three@0.183.0/build/three.module.js" } }
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
验证:`curl -sI '<url>' | head -3`
|
|
53
|
+
|
|
54
|
+
## 多层合成场景移植要点
|
|
55
|
+
|
|
56
|
+
从 Unicorn Studio / curtains.js 等 no-code 工具提取的场景通常有复杂的 FBO 链。以下是常见陷阱和正确做法:
|
|
57
|
+
|
|
58
|
+
### 1. 理解 parentLayer 与 effects 的父子关系
|
|
59
|
+
|
|
60
|
+
在 Unicorn Studio 中:
|
|
61
|
+
- **Element 层**(shape/text/image)的 `effects[]` 数组存储子效果的 UUID
|
|
62
|
+
- **Effect 层**的 `parentLayer` 字段指向父元素的 UUID
|
|
63
|
+
- 子效果按 effects 数组顺序依次渲染,每个 pass 读取前一个 pass 的 FBO
|
|
64
|
+
|
|
65
|
+
移植时必须还原这个链式 FBO 结构,不能简单合并成一个 pass。
|
|
66
|
+
|
|
67
|
+
### 2. showBg=0 的透明背景
|
|
68
|
+
|
|
69
|
+
`showBg=0` 意味着 shader 在未命中几何体的区域输出 `vec4(0)`(完全透明)。
|
|
70
|
+
这不是"黑色",而是**透明**,后续合成时会显示下方图层。
|
|
71
|
+
|
|
72
|
+
```glsl
|
|
73
|
+
// 正确:showBg=0 → 透明
|
|
74
|
+
if (hit < 0.5) { fragColor = vec4(0.0); return; }
|
|
75
|
+
|
|
76
|
+
// 错误:输出黑色(会覆盖下方图层)
|
|
77
|
+
if (hit < 0.5) { fragColor = vec4(0.0, 0.0, 0.0, 1.0); return; }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
移植时必须用 alpha composite pass(`fg + bg * (1 - fg.a)`)将结果叠加到下方图层。
|
|
81
|
+
|
|
82
|
+
### 3. 文字/图片元素的合成方式
|
|
83
|
+
|
|
84
|
+
Element 层(text/image)需要用 Canvas 2D 渲染后作为纹理上传 WebGL。
|
|
85
|
+
**合成方式决定了视觉效果**:
|
|
86
|
+
|
|
87
|
+
```glsl
|
|
88
|
+
// 错误:alpha-over 覆盖(丢失背景纹理)
|
|
89
|
+
fragColor = mix(bg, vec4(txt.rgb, 1.0), txt.a);
|
|
90
|
+
|
|
91
|
+
// 错误:additive(饱和为白色,丢失色彩变化)
|
|
92
|
+
fragColor = vec4(bg.rgb + txt.rgb * txt.a, 1.0);
|
|
93
|
+
|
|
94
|
+
// 正确:亮度放大(保留背景噪声的色彩纹理变化)
|
|
95
|
+
fragColor = vec4(bg.rgb * mix(1.0, amplifyFactor, txt.a), 1.0);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**原理**:原始场景中文字元素叠加在噪声层上,经过 glyph dither 后,
|
|
99
|
+
字符颜色取自该位置的像素色。如果文字区域是平坦单色,ASCII 字符就是单色的。
|
|
100
|
+
用亮度放大方式,噪声的色相比例完整保留(紫:青:暗 按相同系数放大),
|
|
101
|
+
glyph dither 后的字符就带有噪声纹理的色彩变化。
|
|
102
|
+
|
|
103
|
+
### 4. 重复效果实例
|
|
104
|
+
|
|
105
|
+
同一种效果(如 noiseFill)可能在场景中出现多次:一次作为背景独立层,
|
|
106
|
+
一次作为 shape group 的子效果。参数可能相同但在管线中位置不同,
|
|
107
|
+
子效果的输出会被后续效果(如 SDF 折射)处理,产生不同的视觉。
|
|
108
|
+
|
|
109
|
+
### 5. Glyph Atlas 兼容性
|
|
110
|
+
|
|
111
|
+
base64 内嵌的 PNG glyph atlas 在某些浏览器/WebGL 环境中 `texImage2D` 会报
|
|
112
|
+
`INVALID_VALUE: bad image data`。推荐用 Canvas 2D 动态生成。
|
|
113
|
+
|
|
114
|
+
### 6. 颜色空间一致性(最常见的视觉偏差来源)
|
|
115
|
+
|
|
116
|
+
Three.js / shaders.com 等工具全程在 **linear 空间** 工作。移植到原生 WebGL 时:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
错误做法(每个 pass 独立 gamma):
|
|
120
|
+
Pass1: 输出 pow(linear, 1/2.2) ← sRGB
|
|
121
|
+
Pass2: 读入 sRGB + 计算高光(linear) + 输出 pow(result, 1/2.2) ← 混乱!
|
|
122
|
+
|
|
123
|
+
正确做法(全程 linear,最终一次 gamma):
|
|
124
|
+
Pass1~N: 全部输出 linear 值
|
|
125
|
+
Final: pow(linear, 1/2.2) ← 唯一一次 sRGB 编码
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
hex 颜色定义 → `pow(srgb, 2.2)` 转 linear → 全程 linear 计算 → 最终 `pow(linear, 1/2.2)` 输出。
|
|
129
|
+
|
|
130
|
+
### 7. 参数精确对齐原则
|
|
131
|
+
|
|
132
|
+
**绝对禁止手动调参来"补偿"视觉差异**。所有公式乘数必须与原始代码完全一致。
|
|
133
|
+
如果效果不对,应排查颜色空间、噪声实现、时间基准等根因,而不是改乘数。
|
|
134
|
+
手动调参在当前配置下可能看起来更好,但会在其他参数组合下崩溃。
|
|
135
|
+
|
|
136
|
+
## 2D Canvas
|
|
137
|
+
|
|
138
|
+
每个效果一个文件,导出 `create<Name>Effect(container)` → `{ destroy }`。多效果用 `main.js` 管理切换。
|
|
139
|
+
|
|
140
|
+
### 性能要求
|
|
141
|
+
|
|
142
|
+
- `IntersectionObserver` + `visibilitychange` — 不可见时停止 RAF
|
|
143
|
+
- DPR 上限 `Math.min(devicePixelRatio, 2)`
|
|
144
|
+
- 后处理用离屏 Canvas 缓存,静态内容仅 resize 时重建
|
|
145
|
+
- 大量粒子数据用 `Float32Array`
|
|
146
|
+
|
|
147
|
+
## 通用规范
|
|
148
|
+
|
|
149
|
+
- ES Module(`import`/`export`)
|
|
150
|
+
- minified 变量名替换为有意义名称
|
|
151
|
+
- README 含效果说明、技术原理、可调参数
|
|
152
|
+
|
|
153
|
+
## Phase 6:简化评估
|
|
154
|
+
|
|
155
|
+
**触发**:移植完成后自行验证效果正确。**提议而非自动执行** — 这是全流程唯一需要用户决策的步骤。
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
只用了 RawShaderMaterial + WebGLRenderTarget + fullscreen quad?
|
|
159
|
+
├─ → 可简化为原生 WebGL2(减少 ~600KB)
|
|
160
|
+
用到 PBR / onBeforeCompile / 3D 场景?
|
|
161
|
+
├─ → 不简化
|
|
162
|
+
不确定?
|
|
163
|
+
└─ → 不提议
|
|
164
|
+
```
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# onBeforeCompile 注入 GLSL 的陷阱
|
|
2
|
+
|
|
3
|
+
## 场景
|
|
4
|
+
|
|
5
|
+
使用 `MeshPhysicalMaterial` 的 `transmission` 功能但需要增强效果时(如 drei 的 MeshTransmissionMaterial),
|
|
6
|
+
通过 `material.onBeforeCompile` 注入自定义 GLSL 代码。
|
|
7
|
+
|
|
8
|
+
## 常见陷阱
|
|
9
|
+
|
|
10
|
+
### 1. 函数签名版本差异
|
|
11
|
+
|
|
12
|
+
Three.js 不同版本的内置函数签名不同:
|
|
13
|
+
|
|
14
|
+
```glsl
|
|
15
|
+
// r166 及之前
|
|
16
|
+
vec4 getIBLVolumeRefraction(n, v, roughness, diffuseColor, specularColor, specularF90,
|
|
17
|
+
pos, modelMatrix, viewMatrix, projectionMatrix, ior, thickness,
|
|
18
|
+
attenuationColor, attenuationDistance)
|
|
19
|
+
|
|
20
|
+
// r167+ 新增 dispersion 参数
|
|
21
|
+
vec4 getIBLVolumeRefraction(n, v, roughness, diffuseColor, specularColor, specularF90,
|
|
22
|
+
pos, modelMatrix, viewMatrix, projectionMatrix, dispersion, ior, thickness,
|
|
23
|
+
attenuationColor, attenuationDistance)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**必须检查目标版本的实际签名**:
|
|
27
|
+
```bash
|
|
28
|
+
curl -s "https://cdn.jsdelivr.net/npm/three@0.167.0/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js" \
|
|
29
|
+
| tr '\n' ' ' | grep -oE 'vec4 getIBLVolumeRefraction\([^)]+\)'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 2. GLSL 不允许嵌套函数定义
|
|
33
|
+
|
|
34
|
+
```glsl
|
|
35
|
+
// 错误!GLSL 不支持函数内定义函数
|
|
36
|
+
void main() {
|
|
37
|
+
float myRand(vec2 co) { return fract(sin(...)); } // 编译失败
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 正确:函数必须在全局作用域
|
|
41
|
+
float myRand(vec2 co) { return fract(sin(...)); }
|
|
42
|
+
void main() {
|
|
43
|
+
float r = myRand(uv);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 3. 条件编译宏保护
|
|
48
|
+
|
|
49
|
+
某些变量只在特定宏下可用:
|
|
50
|
+
- `vWorldPosition` → 需要 `USE_TRANSMISSION` 启用
|
|
51
|
+
- `vTransmissionMapUv` → 需要 `USE_TRANSMISSIONMAP` 启用
|
|
52
|
+
- `roughnessFactor` → 在 `lights_physical_fragment` 之后可用
|
|
53
|
+
|
|
54
|
+
```glsl
|
|
55
|
+
// 在替换 #include <transmission_fragment> 时
|
|
56
|
+
// 原始代码自带 #ifdef USE_TRANSMISSION,替换代码也必须包含
|
|
57
|
+
#ifdef USE_TRANSMISSION
|
|
58
|
+
// ... 你的代码
|
|
59
|
+
#endif
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 4. 变量名冲突
|
|
63
|
+
|
|
64
|
+
注入的全局函数/变量可能与 Three.js 内部冲突:
|
|
65
|
+
- 避免使用 `hash`, `random`, `noise` 等通用名
|
|
66
|
+
- 自定义函数加前缀:`snoise` → OK,`random` → 可能冲突
|
|
67
|
+
- uniform 名称加前缀 `u`:`uDistortion`, `uNoiseTime`
|
|
68
|
+
|
|
69
|
+
## 推荐模式
|
|
70
|
+
|
|
71
|
+
### 安全注入:修改 normal 而不替换整个 chunk
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
material.onBeforeCompile = (shader) => {
|
|
75
|
+
shader.uniforms.uDistortion = { value: 0 };
|
|
76
|
+
shader.uniforms.uNoiseTime = { value: 0 };
|
|
77
|
+
|
|
78
|
+
// 在 fragment shader 最前面加 uniform 声明 + 工具函数
|
|
79
|
+
shader.fragmentShader = `
|
|
80
|
+
uniform float uDistortion;
|
|
81
|
+
uniform float uNoiseTime;
|
|
82
|
+
${noiseGLSL}
|
|
83
|
+
` + shader.fragmentShader;
|
|
84
|
+
|
|
85
|
+
// 在 transmission_fragment 之前插入法线扰动
|
|
86
|
+
shader.fragmentShader = shader.fragmentShader.replace(
|
|
87
|
+
'#include <transmission_fragment>',
|
|
88
|
+
`
|
|
89
|
+
#ifdef USE_TRANSMISSION
|
|
90
|
+
{
|
|
91
|
+
// 扰动 normal 影响折射方向
|
|
92
|
+
if (uDistortion > 0.0) {
|
|
93
|
+
normal = normalize(normal + uDistortion * vec3(
|
|
94
|
+
snoiseFractal(vWorldPosition * 0.08 + vec3(uNoiseTime)),
|
|
95
|
+
snoiseFractal(vWorldPosition.zxy * 0.08 - vec3(uNoiseTime)),
|
|
96
|
+
snoiseFractal(vWorldPosition.yxz * 0.08)
|
|
97
|
+
));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
#endif
|
|
101
|
+
#include <transmission_fragment>
|
|
102
|
+
`
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 完整替换:需要随机多采样 + 色差时
|
|
108
|
+
|
|
109
|
+
当需要 MeshTransmissionMaterial 的颗粒感(随机采样噪声)和色差效果时,
|
|
110
|
+
必须完整替换 `#include <transmission_fragment>`。关键点:
|
|
111
|
+
|
|
112
|
+
1. 保留 `#ifdef USE_TRANSMISSION` / `#endif` 包裹
|
|
113
|
+
2. 保留 transmissionMap 和 thicknessMap 的 `#ifdef` 块
|
|
114
|
+
3. 使用正确版本的 `getIBLVolumeRefraction` 签名
|
|
115
|
+
4. 自己处理色差时,传 `dispersion = 0.0`,用不同 IOR 采样 R/G/B
|
|
116
|
+
5. 低采样数(6)+ 每像素随机偏移 → 产生可见的胶片颗粒感
|
|
117
|
+
|
|
118
|
+
## 视觉效果来源速查
|
|
119
|
+
|
|
120
|
+
| 效果 | 来源 | 实现方式 |
|
|
121
|
+
|------|------|----------|
|
|
122
|
+
| 玻璃折射 | MeshPhysicalMaterial `transmission` | Three.js 内置 |
|
|
123
|
+
| 色差 (chromatic aberration) | 不同 IOR 采样 R/G/B | 替换 transmission_fragment |
|
|
124
|
+
| 胶片颗粒感 | 低采样数 + 每像素随机方向 | 替换 transmission_fragment |
|
|
125
|
+
| 有机扭曲 | simplex noise 扰动法线/折射方向 | onBeforeCompile 注入 |
|
|
126
|
+
| 颜色偏移 | `dispersion` 属性 (r167+) | MeshPhysicalMaterial 内置 |
|