@rotifer/playground 0.8.1 → 0.8.6
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/CHANGELOG.md +46 -11
- package/README.md +92 -58
- package/README.zh.md +90 -49
- package/dist/cloud/auth.d.ts +9 -3
- package/dist/cloud/auth.d.ts.map +1 -1
- package/dist/cloud/auth.js +28 -13
- package/dist/cloud/auth.js.map +1 -1
- package/dist/cloud/client.d.ts +4 -3
- package/dist/cloud/client.d.ts.map +1 -1
- package/dist/cloud/client.js +139 -68
- package/dist/cloud/client.js.map +1 -1
- package/dist/cloud/types.d.ts +3 -0
- package/dist/cloud/types.d.ts.map +1 -1
- package/dist/cloud/types.js.map +1 -1
- package/dist/commands/agent-create.d.ts +20 -0
- package/dist/commands/agent-create.d.ts.map +1 -1
- package/dist/commands/agent-create.js +91 -80
- package/dist/commands/agent-create.js.map +1 -1
- package/dist/commands/agent-list.d.ts.map +1 -1
- package/dist/commands/agent-list.js +27 -24
- package/dist/commands/agent-list.js.map +1 -1
- package/dist/commands/agent-run.d.ts +24 -0
- package/dist/commands/agent-run.d.ts.map +1 -1
- package/dist/commands/agent-run.js +166 -44
- package/dist/commands/agent-run.js.map +1 -1
- package/dist/commands/api-key.d.ts +3 -0
- package/dist/commands/api-key.d.ts.map +1 -0
- package/dist/commands/api-key.js +235 -0
- package/dist/commands/api-key.js.map +1 -0
- package/dist/commands/arena-list.d.ts.map +1 -1
- package/dist/commands/arena-list.js +113 -97
- package/dist/commands/arena-list.js.map +1 -1
- package/dist/commands/arena-submit.d.ts.map +1 -1
- package/dist/commands/arena-submit.js +114 -37
- package/dist/commands/arena-submit.js.map +1 -1
- package/dist/commands/arena-watch.d.ts.map +1 -1
- package/dist/commands/arena-watch.js +59 -87
- package/dist/commands/arena-watch.js.map +1 -1
- package/dist/commands/compare.d.ts.map +1 -1
- package/dist/commands/compare.js +40 -50
- package/dist/commands/compare.js.map +1 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +80 -58
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/hello.d.ts +3 -0
- package/dist/commands/hello.d.ts.map +1 -0
- package/dist/commands/hello.js +575 -0
- package/dist/commands/hello.js.map +1 -0
- package/dist/commands/info.d.ts.map +1 -1
- package/dist/commands/info.js +130 -40
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +39 -60
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +35 -9
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +111 -58
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +23 -10
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/network.d.ts.map +1 -1
- package/dist/commands/network.js +48 -67
- package/dist/commands/network.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +152 -53
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/reputation.js +84 -85
- package/dist/commands/reputation.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +32 -12
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +8 -9
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +80 -54
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/self-update.d.ts +7 -0
- package/dist/commands/self-update.d.ts.map +1 -0
- package/dist/commands/self-update.js +187 -0
- package/dist/commands/self-update.js.map +1 -0
- package/dist/commands/stats.d.ts.map +1 -1
- package/dist/commands/stats.js +20 -26
- package/dist/commands/stats.js.map +1 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +104 -79
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/user-config.d.ts +3 -0
- package/dist/commands/user-config.d.ts.map +1 -0
- package/dist/commands/user-config.js +82 -0
- package/dist/commands/user-config.js.map +1 -0
- package/dist/commands/versions.d.ts.map +1 -1
- package/dist/commands/versions.js +46 -33
- package/dist/commands/versions.js.map +1 -1
- package/dist/commands/vg.d.ts.map +1 -1
- package/dist/commands/vg.js +65 -63
- package/dist/commands/vg.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +33 -23
- package/dist/commands/whoami.js.map +1 -1
- package/dist/commands/wrap.d.ts.map +1 -1
- package/dist/commands/wrap.js +57 -40
- package/dist/commands/wrap.js.map +1 -1
- package/dist/index.js +61 -1
- package/dist/index.js.map +1 -1
- package/dist/publish/pre-publish-check.d.ts +15 -0
- package/dist/publish/pre-publish-check.d.ts.map +1 -0
- package/dist/publish/pre-publish-check.js +228 -0
- package/dist/publish/pre-publish-check.js.map +1 -0
- package/dist/runtime/domain-failover.d.ts +1 -1
- package/dist/runtime/domain-failover.js +1 -1
- package/dist/runtime/network-gateway.d.ts +1 -1
- package/dist/runtime/network-gateway.d.ts.map +1 -1
- package/dist/runtime/network-gateway.js +10 -10
- package/dist/runtime/network-gateway.js.map +1 -1
- package/dist/scanner/scanner.js +3 -3
- package/dist/scanner/scanner.js.map +1 -1
- package/dist/utils/binding.d.ts +1 -0
- package/dist/utils/binding.d.ts.map +1 -1
- package/dist/utils/binding.js +37 -15
- package/dist/utils/binding.js.map +1 -1
- package/dist/utils/content-hash.d.ts +3 -0
- package/dist/utils/content-hash.d.ts.map +1 -0
- package/dist/utils/content-hash.js +25 -0
- package/dist/utils/content-hash.js.map +1 -0
- package/dist/utils/detect-source-language.d.ts +20 -0
- package/dist/utils/detect-source-language.d.ts.map +1 -0
- package/dist/utils/detect-source-language.js +83 -0
- package/dist/utils/detect-source-language.js.map +1 -0
- package/dist/utils/display.d.ts +44 -1
- package/dist/utils/display.d.ts.map +1 -1
- package/dist/utils/display.js +443 -14
- package/dist/utils/display.js.map +1 -1
- package/dist/utils/domain-suggest.d.ts.map +1 -1
- package/dist/utils/domain-suggest.js +3 -3
- package/dist/utils/domain-suggest.js.map +1 -1
- package/dist/utils/javy-compiler.d.ts.map +1 -1
- package/dist/utils/javy-compiler.js +10 -3
- package/dist/utils/javy-compiler.js.map +1 -1
- package/dist/utils/open-browser.d.ts +7 -3
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js +15 -4
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/palette.d.ts +49 -0
- package/dist/utils/palette.d.ts.map +1 -0
- package/dist/utils/palette.js +80 -0
- package/dist/utils/palette.js.map +1 -0
- package/dist/utils/private-fs.d.ts +3 -0
- package/dist/utils/private-fs.d.ts.map +1 -0
- package/dist/utils/private-fs.js +25 -0
- package/dist/utils/private-fs.js.map +1 -0
- package/dist/utils/project-root.d.ts +2 -0
- package/dist/utils/project-root.d.ts.map +1 -0
- package/dist/utils/project-root.js +49 -0
- package/dist/utils/project-root.js.map +1 -0
- package/dist/utils/run-logger.d.ts +24 -0
- package/dist/utils/run-logger.d.ts.map +1 -0
- package/dist/utils/run-logger.js +70 -0
- package/dist/utils/run-logger.js.map +1 -0
- package/dist/utils/sandbox-defaults.d.ts +9 -0
- package/dist/utils/sandbox-defaults.d.ts.map +1 -0
- package/dist/utils/sandbox-defaults.js +12 -0
- package/dist/utils/sandbox-defaults.js.map +1 -0
- package/dist/utils/update-check.d.ts +20 -0
- package/dist/utils/update-check.d.ts.map +1 -0
- package/dist/utils/update-check.js +155 -0
- package/dist/utils/update-check.js.map +1 -0
- package/dist/utils/user-config.d.ts +10 -0
- package/dist/utils/user-config.d.ts.map +1 -0
- package/dist/utils/user-config.js +54 -0
- package/dist/utils/user-config.js.map +1 -0
- package/dist/utils/validate-gene-name.d.ts +7 -0
- package/dist/utils/validate-gene-name.d.ts.map +1 -0
- package/dist/utils/validate-gene-name.js +28 -0
- package/dist/utils/validate-gene-name.js.map +1 -0
- package/genes/genesis-code-format/phenotype.json +4 -3
- package/genes/genesis-file-read/phenotype.json +4 -3
- package/genes/genesis-l0-constraint/phenotype.json +4 -3
- package/genes/genesis-web-search/phenotype.json +5 -4
- package/genes/genesis-web-search-lite/phenotype.json +4 -3
- package/package.json +35 -8
- package/scripts/postinstall.js +38 -0
- package/dist/errors/formatter.d.ts +0 -25
- package/dist/errors/formatter.d.ts.map +0 -1
- package/dist/errors/formatter.js +0 -43
- package/dist/errors/formatter.js.map +0 -1
- package/genes/academic-writer/.cloud-manifest.json +0 -6
- package/genes/academic-writer/.gene-manifest.json +0 -8
- package/genes/academic-writer/SKILL.md +0 -274
- package/genes/academic-writer/phenotype.json +0 -28
- package/genes/ai-components/.cloud-manifest.json +0 -6
- package/genes/ai-components/.gene-manifest.json +0 -8
- package/genes/ai-components/SKILL.md +0 -381
- package/genes/ai-components/phenotype.json +0 -28
- package/genes/algorithmic-art/.cloud-manifest.json +0 -6
- package/genes/algorithmic-art/.gene-manifest.json +0 -8
- package/genes/algorithmic-art/SKILL.md +0 -405
- package/genes/algorithmic-art/phenotype.json +0 -28
- package/genes/answer-synthesizer/.cloud-manifest.json +0 -6
- package/genes/answer-synthesizer/index.ts +0 -194
- package/genes/answer-synthesizer/phenotype.json +0 -61
- package/genes/api-designer/.cloud-manifest.json +0 -6
- package/genes/api-designer/.gene-manifest.json +0 -8
- package/genes/api-designer/SKILL.md +0 -456
- package/genes/api-designer/phenotype.json +0 -28
- package/genes/auto-coder/.cloud-manifest.json +0 -6
- package/genes/auto-coder/.gene-manifest.json +0 -8
- package/genes/auto-coder/SKILL.md +0 -400
- package/genes/auto-coder/phenotype.json +0 -28
- package/genes/auto-writer/.cloud-manifest.json +0 -6
- package/genes/auto-writer/.gene-manifest.json +0 -8
- package/genes/auto-writer/SKILL.md +0 -361
- package/genes/auto-writer/phenotype.json +0 -28
- package/genes/brand-personality/.cloud-manifest.json +0 -6
- package/genes/brand-personality/.gene-manifest.json +0 -8
- package/genes/brand-personality/SKILL.md +0 -549
- package/genes/brand-personality/phenotype.json +0 -28
- package/genes/business-writer/.cloud-manifest.json +0 -6
- package/genes/business-writer/.gene-manifest.json +0 -8
- package/genes/business-writer/SKILL.md +0 -448
- package/genes/business-writer/phenotype.json +0 -28
- package/genes/citation-manager/.cloud-manifest.json +0 -6
- package/genes/citation-manager/.gene-manifest.json +0 -8
- package/genes/citation-manager/SKILL.md +0 -279
- package/genes/citation-manager/index.ts +0 -162
- package/genes/citation-manager/package.json +0 -1
- package/genes/citation-manager/phenotype.json +0 -50
- package/genes/code-complexity/.cloud-manifest.json +0 -6
- package/genes/code-complexity/README.md +0 -35
- package/genes/code-complexity/index.ts +0 -101
- package/genes/code-complexity/phenotype.json +0 -34
- package/genes/copywriter/.cloud-manifest.json +0 -6
- package/genes/copywriter/.gene-manifest.json +0 -8
- package/genes/copywriter/SKILL.md +0 -329
- package/genes/copywriter/phenotype.json +0 -28
- package/genes/creative-writer/.cloud-manifest.json +0 -6
- package/genes/creative-writer/.gene-manifest.json +0 -8
- package/genes/creative-writer/SKILL.md +0 -356
- package/genes/creative-writer/phenotype.json +0 -28
- package/genes/data-modeler/.cloud-manifest.json +0 -6
- package/genes/data-modeler/.gene-manifest.json +0 -8
- package/genes/data-modeler/SKILL.md +0 -486
- package/genes/data-modeler/phenotype.json +0 -28
- package/genes/debugger/.cloud-manifest.json +0 -6
- package/genes/debugger/.gene-manifest.json +0 -8
- package/genes/debugger/SKILL.md +0 -416
- package/genes/debugger/phenotype.json +0 -28
- package/genes/design-tokens/.cloud-manifest.json +0 -6
- package/genes/design-tokens/.gene-manifest.json +0 -8
- package/genes/design-tokens/SKILL.md +0 -222
- package/genes/design-tokens/index.ts +0 -128
- package/genes/design-tokens/package.json +0 -1
- package/genes/design-tokens/phenotype.json +0 -1
- package/genes/devops-automator/.cloud-manifest.json +0 -6
- package/genes/devops-automator/.gene-manifest.json +0 -8
- package/genes/devops-automator/SKILL.md +0 -490
- package/genes/devops-automator/phenotype.json +0 -28
- package/genes/doc-coauthoring/.cloud-manifest.json +0 -6
- package/genes/doc-coauthoring/.gene-manifest.json +0 -8
- package/genes/doc-coauthoring/SKILL.md +0 -375
- package/genes/doc-coauthoring/phenotype.json +0 -28
- package/genes/doc-retrieval/.cloud-manifest.json +0 -6
- package/genes/doc-retrieval/index.ts +0 -134
- package/genes/doc-retrieval/phenotype.json +0 -54
- package/genes/docs-writer/.cloud-manifest.json +0 -6
- package/genes/docs-writer/.gene-manifest.json +0 -8
- package/genes/docs-writer/SKILL.md +0 -492
- package/genes/docs-writer/phenotype.json +0 -28
- package/genes/evolve-life/.cloud-manifest.json +0 -6
- package/genes/evolve-life/.compile-result.json +0 -12
- package/genes/evolve-life/README.md +0 -52
- package/genes/evolve-life/gene.ir.wasm +0 -0
- package/genes/evolve-life/gene.wasm +0 -0
- package/genes/evolve-life/index.ts +0 -255
- package/genes/evolve-life/phenotype.json +0 -129
- package/genes/evolve-life-bitwise/.cloud-manifest.json +0 -6
- package/genes/evolve-life-bitwise/.compile-result.json +0 -12
- package/genes/evolve-life-bitwise/gene.ir.wasm +0 -0
- package/genes/evolve-life-bitwise/gene.wasm +0 -0
- package/genes/evolve-life-bitwise/index.ts +0 -273
- package/genes/evolve-life-bitwise/phenotype.json +0 -129
- package/genes/evolve-life-sparse/.cloud-manifest.json +0 -6
- package/genes/evolve-life-sparse/.compile-result.json +0 -12
- package/genes/evolve-life-sparse/gene.ir.wasm +0 -0
- package/genes/evolve-life-sparse/gene.wasm +0 -0
- package/genes/evolve-life-sparse/index.ts +0 -236
- package/genes/evolve-life-sparse/phenotype.json +0 -129
- package/genes/fact-checker/.cloud-manifest.json +0 -6
- package/genes/fact-checker/.gene-manifest.json +0 -8
- package/genes/fact-checker/SKILL.md +0 -373
- package/genes/fact-checker/phenotype.json +0 -28
- package/genes/git-workflow/.cloud-manifest.json +0 -6
- package/genes/git-workflow/.gene-manifest.json +0 -8
- package/genes/git-workflow/SKILL.md +0 -407
- package/genes/git-workflow/phenotype.json +0 -28
- package/genes/grammar-checker/.cloud-manifest.json +0 -6
- package/genes/grammar-checker/.gene-manifest.json +0 -8
- package/genes/grammar-checker/SKILL.md +0 -194
- package/genes/grammar-checker/index.ts +0 -168
- package/genes/grammar-checker/package.json +0 -1
- package/genes/grammar-checker/phenotype.json +0 -52
- package/genes/guard-balanced/.gene-manifest.json +0 -8
- package/genes/guard-balanced/phenotype.json +0 -105
- package/genes/guard-balanced/system-prompt.md +0 -23
- package/genes/guard-strict/.gene-manifest.json +0 -8
- package/genes/guard-strict/phenotype.json +0 -107
- package/genes/guard-strict/system-prompt.md +0 -18
- package/genes/json-validator/.cloud-manifest.json +0 -6
- package/genes/json-validator/README.md +0 -42
- package/genes/json-validator/index.ts +0 -112
- package/genes/json-validator/phenotype.json +0 -42
- package/genes/license-advisor/.cloud-manifest.json +0 -6
- package/genes/license-advisor/.gene-manifest.json +0 -8
- package/genes/license-advisor/SKILL.md +0 -117
- package/genes/license-advisor/phenotype.json +0 -28
- package/genes/logic-architect/.cloud-manifest.json +0 -6
- package/genes/logic-architect/.gene-manifest.json +0 -8
- package/genes/logic-architect/SKILL.md +0 -451
- package/genes/logic-architect/phenotype.json +0 -28
- package/genes/markdown-formatter/.cloud-manifest.json +0 -6
- package/genes/markdown-formatter/README.md +0 -34
- package/genes/markdown-formatter/index.ts +0 -86
- package/genes/markdown-formatter/phenotype.json +0 -32
- package/genes/orch/.cloud-manifest.json +0 -6
- package/genes/orch/.gene-manifest.json +0 -8
- package/genes/orch/SKILL.md +0 -504
- package/genes/orch/phenotype.json +0 -28
- package/genes/particle-barneshut/.cloud-manifest.json +0 -6
- package/genes/particle-barneshut/.compile-result.json +0 -12
- package/genes/particle-barneshut/README.md +0 -55
- package/genes/particle-barneshut/gene.ir.wasm +0 -0
- package/genes/particle-barneshut/gene.wasm +0 -0
- package/genes/particle-barneshut/index.ts +0 -486
- package/genes/particle-barneshut/phenotype.json +0 -137
- package/genes/particle-brute/.cloud-manifest.json +0 -6
- package/genes/particle-brute/.compile-result.json +0 -12
- package/genes/particle-brute/README.md +0 -55
- package/genes/particle-brute/gene.ir.wasm +0 -0
- package/genes/particle-brute/gene.wasm +0 -0
- package/genes/particle-brute/index.ts +0 -277
- package/genes/particle-brute/phenotype.json +0 -137
- package/genes/particle-spatial/.cloud-manifest.json +0 -6
- package/genes/particle-spatial/.compile-result.json +0 -12
- package/genes/particle-spatial/README.md +0 -53
- package/genes/particle-spatial/gene.ir.wasm +0 -0
- package/genes/particle-spatial/gene.wasm +0 -0
- package/genes/particle-spatial/index.ts +0 -352
- package/genes/particle-spatial/phenotype.json +0 -137
- package/genes/performance-optimizer/.cloud-manifest.json +0 -6
- package/genes/performance-optimizer/.gene-manifest.json +0 -8
- package/genes/performance-optimizer/SKILL.md +0 -480
- package/genes/performance-optimizer/phenotype.json +0 -28
- package/genes/plagiarism-checker/.cloud-manifest.json +0 -6
- package/genes/plagiarism-checker/.gene-manifest.json +0 -8
- package/genes/plagiarism-checker/SKILL.md +0 -342
- package/genes/plagiarism-checker/phenotype.json +0 -28
- package/genes/product-manager/.cloud-manifest.json +0 -6
- package/genes/product-manager/.gene-manifest.json +0 -8
- package/genes/product-manager/SKILL.md +0 -249
- package/genes/product-manager/phenotype.json +0 -28
- package/genes/project-reviewer/.cloud-manifest.json +0 -6
- package/genes/project-reviewer/.gene-manifest.json +0 -8
- package/genes/project-reviewer/SKILL.md +0 -312
- package/genes/project-reviewer/phenotype.json +0 -28
- package/genes/prompt-engineer/.cloud-manifest.json +0 -6
- package/genes/prompt-engineer/.gene-manifest.json +0 -8
- package/genes/prompt-engineer/SKILL.md +0 -411
- package/genes/prompt-engineer/phenotype.json +0 -28
- package/genes/prompt-review-perf/.gene-manifest.json +0 -8
- package/genes/prompt-review-perf/phenotype.json +0 -61
- package/genes/prompt-review-perf/system-prompt.md +0 -22
- package/genes/prompt-review-readability/.gene-manifest.json +0 -8
- package/genes/prompt-review-readability/phenotype.json +0 -60
- package/genes/prompt-review-readability/system-prompt.md +0 -21
- package/genes/prompt-review-security/.gene-manifest.json +0 -8
- package/genes/prompt-review-security/phenotype.json +0 -60
- package/genes/prompt-review-security/system-prompt.md +0 -21
- package/genes/readability-analyzer/.cloud-manifest.json +0 -6
- package/genes/readability-analyzer/.gene-manifest.json +0 -8
- package/genes/readability-analyzer/SKILL.md +0 -357
- package/genes/readability-analyzer/index.ts +0 -123
- package/genes/readability-analyzer/package.json +0 -1
- package/genes/readability-analyzer/phenotype.json +0 -35
- package/genes/rotifer-protocol/SKILL.md +0 -121
- package/genes/rule-router-frequency/.gene-manifest.json +0 -8
- package/genes/rule-router-frequency/phenotype.json +0 -76
- package/genes/rule-router-frequency/system-prompt.md +0 -26
- package/genes/rule-router-relevance/.gene-manifest.json +0 -8
- package/genes/rule-router-relevance/phenotype.json +0 -76
- package/genes/rule-router-relevance/system-prompt.md +0 -29
- package/genes/security-auditor/.cloud-manifest.json +0 -6
- package/genes/security-auditor/.gene-manifest.json +0 -8
- package/genes/security-auditor/SKILL.md +0 -494
- package/genes/security-auditor/phenotype.json +0 -28
- package/genes/seo-optimizer/.cloud-manifest.json +0 -6
- package/genes/seo-optimizer/.gene-manifest.json +0 -8
- package/genes/seo-optimizer/SKILL.md +0 -327
- package/genes/seo-optimizer/index.ts +0 -206
- package/genes/seo-optimizer/package.json +0 -1
- package/genes/seo-optimizer/phenotype.json +0 -1
- package/genes/source-linker/.cloud-manifest.json +0 -6
- package/genes/source-linker/index.ts +0 -88
- package/genes/source-linker/phenotype.json +0 -45
- package/genes/style-optimizer/.cloud-manifest.json +0 -6
- package/genes/style-optimizer/.gene-manifest.json +0 -8
- package/genes/style-optimizer/SKILL.md +0 -285
- package/genes/style-optimizer/phenotype.json +0 -28
- package/genes/tech-lead/.cloud-manifest.json +0 -6
- package/genes/tech-lead/.gene-manifest.json +0 -8
- package/genes/tech-lead/SKILL.md +0 -451
- package/genes/tech-lead/phenotype.json +0 -28
- package/genes/test-wrap/.cloud-manifest.json +0 -6
- package/genes/test-wrap/.gene-manifest.json +0 -8
- package/genes/test-wrap/phenotype.json +0 -28
- package/genes/testing-strategist/.cloud-manifest.json +0 -6
- package/genes/testing-strategist/.gene-manifest.json +0 -8
- package/genes/testing-strategist/SKILL.md +0 -500
- package/genes/testing-strategist/phenotype.json +0 -28
- package/genes/text-summarizer/.cloud-manifest.json +0 -6
- package/genes/text-summarizer/README.md +0 -34
- package/genes/text-summarizer/index.ts +0 -122
- package/genes/text-summarizer/phenotype.json +0 -32
- package/genes/tone-analyzer/.cloud-manifest.json +0 -6
- package/genes/tone-analyzer/.gene-manifest.json +0 -8
- package/genes/tone-analyzer/SKILL.md +0 -410
- package/genes/tone-analyzer/phenotype.json +0 -28
- package/genes/translator/.cloud-manifest.json +0 -6
- package/genes/translator/.gene-manifest.json +0 -8
- package/genes/translator/SKILL.md +0 -355
- package/genes/translator/phenotype.json +0 -28
- package/genes/ui-components/.cloud-manifest.json +0 -6
- package/genes/ui-components/.gene-manifest.json +0 -8
- package/genes/ui-components/SKILL.md +0 -467
- package/genes/ui-components/phenotype.json +0 -28
- package/genes/uiux-designer/.cloud-manifest.json +0 -6
- package/genes/uiux-designer/.gene-manifest.json +0 -8
- package/genes/uiux-designer/SKILL.md +0 -353
- package/genes/uiux-designer/phenotype.json +0 -28
- package/genes/url-extractor/.cloud-manifest.json +0 -6
- package/genes/url-extractor/README.md +0 -37
- package/genes/url-extractor/index.ts +0 -86
- package/genes/url-extractor/phenotype.json +0 -48
- package/genes/ux-patterns/.cloud-manifest.json +0 -6
- package/genes/ux-patterns/.gene-manifest.json +0 -8
- package/genes/ux-patterns/SKILL.md +0 -872
- package/genes/ux-patterns/phenotype.json +0 -28
- package/genes/web3-components/.cloud-manifest.json +0 -6
- package/genes/web3-components/.gene-manifest.json +0 -8
- package/genes/web3-components/SKILL.md +0 -390
- package/genes/web3-components/phenotype.json +0 -28
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"domain": "orchestration.dispatch",
|
|
3
|
-
"description": "Intelligent skill orchestration hub. Automatically identifies and dispatches the most suitable skills based on user intent. Analyzes conversation context, matches task types, and combines multiple skills for complex tasks.",
|
|
4
|
-
"inputSchema": {
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"prompt": {
|
|
8
|
-
"type": "string"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"required": []
|
|
12
|
-
},
|
|
13
|
-
"outputSchema": {
|
|
14
|
-
"type": "object",
|
|
15
|
-
"properties": {
|
|
16
|
-
"result": {
|
|
17
|
-
"type": "string"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"dependencies": [],
|
|
22
|
-
"version": "0.1.0",
|
|
23
|
-
"author": "rotifer-team",
|
|
24
|
-
"createdAt": 1771939421033,
|
|
25
|
-
"fidelity": "Wrapped",
|
|
26
|
-
"transparency": "Open",
|
|
27
|
-
"source": "skill"
|
|
28
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"geneId": "303fa9c27069e25be94e2e2e336cc2bb09c153d595bc6ea84c485b08db13c35e",
|
|
3
|
-
"name": "particle-barneshut",
|
|
4
|
-
"domain": "sim.particle",
|
|
5
|
-
"compiledAt": "2026-03-14T09:13:45.199Z",
|
|
6
|
-
"fidelity": "Native",
|
|
7
|
-
"wasmAvailable": true,
|
|
8
|
-
"irHash": "391614d239e64ad94d257ec59c079a1a060d0143b28f6edd8ec255858f961d1c",
|
|
9
|
-
"totalSize": 1335283,
|
|
10
|
-
"codeSectionSize": 956115,
|
|
11
|
-
"durationMs": 7374
|
|
12
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# particle-barneshut
|
|
2
|
-
|
|
3
|
-
Barnes-Hut quadtree N-body gravitational simulation — a pure-computation Native Gene for the Rotifer Protocol.
|
|
4
|
-
|
|
5
|
-
## Algorithm
|
|
6
|
-
|
|
7
|
-
Builds a quadtree each step to hierarchically group distant particles. When computing the force on particle i:
|
|
8
|
-
|
|
9
|
-
1. If a tree node is a leaf containing a different particle, compute direct force
|
|
10
|
-
2. If an internal node satisfies `(size / distance) < θ`, approximate all particles in that node as a single body at its center of mass
|
|
11
|
-
3. Otherwise, recurse into the four children (NW, NE, SW, SE)
|
|
12
|
-
|
|
13
|
-
With θ = 0.5 (the default opening angle), this achieves O(n log n) force evaluations per step while maintaining good accuracy — typically within 1-2% of the exact brute-force solution.
|
|
14
|
-
|
|
15
|
-
Integration uses the symplectic leapfrog (kick-drift-kick) scheme.
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Solar system preset (64 particles)
|
|
21
|
-
rotifer run particle-barneshut --input '{"preset": "solar"}'
|
|
22
|
-
|
|
23
|
-
# Large cluster (512 particles, 200 steps)
|
|
24
|
-
rotifer run particle-barneshut --input '{"preset": "cluster", "count": 512, "steps": 200}'
|
|
25
|
-
|
|
26
|
-
# Binary star system
|
|
27
|
-
rotifer run particle-barneshut --input '{"preset": "binary", "count": 100}'
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Presets
|
|
31
|
-
|
|
32
|
-
| Preset | Description |
|
|
33
|
-
|--------|-------------|
|
|
34
|
-
| `solar` | Central massive body + orbiting lighter bodies with circular velocities |
|
|
35
|
-
| `binary` | Two equal-mass stars in mutual orbit + debris ring |
|
|
36
|
-
| `cluster` | Random particles in a disk with small random velocities |
|
|
37
|
-
| `collision` | Two groups of particles approaching head-on |
|
|
38
|
-
|
|
39
|
-
## Output
|
|
40
|
-
|
|
41
|
-
- `particles` — final positions and velocities of all particles
|
|
42
|
-
- `steps_computed` — number of simulation steps executed
|
|
43
|
-
- `total_energy` — total system energy (kinetic + potential) for conservation validation
|
|
44
|
-
- `interactions_computed` — total tree-node force evaluations (fewer than brute-force)
|
|
45
|
-
|
|
46
|
-
## Fitness Characteristics
|
|
47
|
-
|
|
48
|
-
| Metric | Expected |
|
|
49
|
-
|--------|----------|
|
|
50
|
-
| Success Rate | 1.0 (deterministic, no failure mode) |
|
|
51
|
-
| Accuracy | High (θ=0.5: ~1-2% error vs brute-force) |
|
|
52
|
-
| Complexity | O(n log n × steps) |
|
|
53
|
-
| Interactions | ~O(n log n) per step (varies with particle distribution) |
|
|
54
|
-
| Best For | Medium-to-large N (64-2048), best accuracy/cost tradeoff |
|
|
55
|
-
| Weakness | Tree construction overhead for very small N |
|
|
Binary file
|
|
Binary file
|
|
@@ -1,486 +0,0 @@
|
|
|
1
|
-
interface Particle {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
vx: number;
|
|
5
|
-
vy: number;
|
|
6
|
-
mass: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface ParticleInput {
|
|
10
|
-
particles?: Particle[];
|
|
11
|
-
preset?: "solar" | "binary" | "cluster" | "collision";
|
|
12
|
-
count?: number;
|
|
13
|
-
steps?: number;
|
|
14
|
-
dt?: number;
|
|
15
|
-
G?: number;
|
|
16
|
-
softening?: number;
|
|
17
|
-
seed?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface ParticleOutput {
|
|
21
|
-
particles: Particle[];
|
|
22
|
-
steps_computed: number;
|
|
23
|
-
total_energy: number;
|
|
24
|
-
interactions_computed: number;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface QuadNode {
|
|
28
|
-
cx: number;
|
|
29
|
-
cy: number;
|
|
30
|
-
mass: number;
|
|
31
|
-
x: number;
|
|
32
|
-
y: number;
|
|
33
|
-
size: number;
|
|
34
|
-
children: (QuadNode | null)[];
|
|
35
|
-
particleIdx: number;
|
|
36
|
-
particleIndices?: number[];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const MIN_CELL_SIZE = 1e-10;
|
|
40
|
-
|
|
41
|
-
function mulberry32(seed: number): () => number {
|
|
42
|
-
let s = seed | 0;
|
|
43
|
-
return () => {
|
|
44
|
-
s = (s + 0x6d2b79f5) | 0;
|
|
45
|
-
let t = Math.imul(s ^ (s >>> 15), 1 | s);
|
|
46
|
-
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
47
|
-
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function generatePreset(
|
|
52
|
-
preset: "solar" | "binary" | "cluster" | "collision",
|
|
53
|
-
count: number,
|
|
54
|
-
seed: number
|
|
55
|
-
): Particle[] {
|
|
56
|
-
const rng = mulberry32(seed);
|
|
57
|
-
const G = 1.0;
|
|
58
|
-
|
|
59
|
-
switch (preset) {
|
|
60
|
-
case "solar": {
|
|
61
|
-
const particles: Particle[] = [];
|
|
62
|
-
const M_central = 100;
|
|
63
|
-
particles.push({ x: 0, y: 0, vx: 0, vy: 0, mass: M_central });
|
|
64
|
-
|
|
65
|
-
const nOrbiters = Math.min(count - 1, 63);
|
|
66
|
-
for (let i = 0; i < nOrbiters; i++) {
|
|
67
|
-
const r = 2 + rng() * 8;
|
|
68
|
-
const theta = rng() * 2 * Math.PI;
|
|
69
|
-
const x = r * Math.cos(theta);
|
|
70
|
-
const y = r * Math.sin(theta);
|
|
71
|
-
const v = Math.sqrt((G * M_central) / r);
|
|
72
|
-
const vx = -v * Math.sin(theta);
|
|
73
|
-
const vy = v * Math.cos(theta);
|
|
74
|
-
const mass = 0.1 + rng() * 0.9;
|
|
75
|
-
particles.push({ x, y, vx, vy, mass });
|
|
76
|
-
}
|
|
77
|
-
return particles;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
case "binary": {
|
|
81
|
-
const particles: Particle[] = [];
|
|
82
|
-
const m1 = 50;
|
|
83
|
-
const m2 = 50;
|
|
84
|
-
const d = 4;
|
|
85
|
-
const r1 = (d * m2) / (m1 + m2);
|
|
86
|
-
const r2 = (d * m1) / (m1 + m2);
|
|
87
|
-
const omega = Math.sqrt((G * (m1 + m2)) / (d * d * d));
|
|
88
|
-
const v1 = omega * r1;
|
|
89
|
-
const v2 = omega * r2;
|
|
90
|
-
|
|
91
|
-
particles.push({ x: -r1, y: 0, vx: 0, vy: -v1, mass: m1 });
|
|
92
|
-
particles.push({ x: r2, y: 0, vx: 0, vy: v2, mass: m2 });
|
|
93
|
-
|
|
94
|
-
const nDebris = Math.min(count - 2, 62);
|
|
95
|
-
for (let i = 0; i < nDebris; i++) {
|
|
96
|
-
const r = 6 + rng() * 4;
|
|
97
|
-
const theta = rng() * 2 * Math.PI;
|
|
98
|
-
const x = r * Math.cos(theta);
|
|
99
|
-
const y = r * Math.sin(theta);
|
|
100
|
-
const v = Math.sqrt((G * (m1 + m2)) / r) * (0.8 + rng() * 0.4);
|
|
101
|
-
const vx = -v * Math.sin(theta);
|
|
102
|
-
const vy = v * Math.cos(theta);
|
|
103
|
-
const mass = 0.1 + rng() * 0.5;
|
|
104
|
-
particles.push({ x, y, vx, vy, mass });
|
|
105
|
-
}
|
|
106
|
-
return particles;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
case "cluster": {
|
|
110
|
-
const particles: Particle[] = [];
|
|
111
|
-
const radius = 5;
|
|
112
|
-
for (let i = 0; i < count; i++) {
|
|
113
|
-
const r = radius * Math.sqrt(rng());
|
|
114
|
-
const theta = rng() * 2 * Math.PI;
|
|
115
|
-
const x = r * Math.cos(theta);
|
|
116
|
-
const y = r * Math.sin(theta);
|
|
117
|
-
const vMax = 0.3;
|
|
118
|
-
const vx = (rng() - 0.5) * 2 * vMax;
|
|
119
|
-
const vy = (rng() - 0.5) * 2 * vMax;
|
|
120
|
-
const mass = 0.5 + rng() * 1.5;
|
|
121
|
-
particles.push({ x, y, vx, vy, mass });
|
|
122
|
-
}
|
|
123
|
-
return particles;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
case "collision": {
|
|
127
|
-
const particles: Particle[] = [];
|
|
128
|
-
const half = Math.floor(count / 2);
|
|
129
|
-
const sep = 10;
|
|
130
|
-
const vApproach = 1.5;
|
|
131
|
-
|
|
132
|
-
for (let i = 0; i < half; i++) {
|
|
133
|
-
const x = -sep + (rng() - 0.5) * 4;
|
|
134
|
-
const y = (rng() - 0.5) * 4;
|
|
135
|
-
const vx = vApproach + (rng() - 0.5) * 0.4;
|
|
136
|
-
const vy = (rng() - 0.5) * 0.4;
|
|
137
|
-
const mass = 0.5 + rng() * 1.5;
|
|
138
|
-
particles.push({ x, y, vx, vy, mass });
|
|
139
|
-
}
|
|
140
|
-
for (let i = 0; i < count - half; i++) {
|
|
141
|
-
const x = sep + (rng() - 0.5) * 4;
|
|
142
|
-
const y = (rng() - 0.5) * 4;
|
|
143
|
-
const vx = -vApproach + (rng() - 0.5) * 0.4;
|
|
144
|
-
const vy = (rng() - 0.5) * 0.4;
|
|
145
|
-
const mass = 0.5 + rng() * 1.5;
|
|
146
|
-
particles.push({ x, y, vx, vy, mass });
|
|
147
|
-
}
|
|
148
|
-
return particles;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
default:
|
|
152
|
-
return generatePreset("cluster", count, seed);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function createEmptyNode(x: number, y: number, size: number): QuadNode {
|
|
157
|
-
return {
|
|
158
|
-
cx: 0,
|
|
159
|
-
cy: 0,
|
|
160
|
-
mass: 0,
|
|
161
|
-
x,
|
|
162
|
-
y,
|
|
163
|
-
size,
|
|
164
|
-
children: [null, null, null, null],
|
|
165
|
-
particleIdx: -1,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function getQuadrant(px: number, py: number, cx: number, cy: number): number {
|
|
170
|
-
if (px < cx) {
|
|
171
|
-
return py < cy ? 0 : 2;
|
|
172
|
-
}
|
|
173
|
-
return py < cy ? 1 : 3;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function insertParticle(
|
|
177
|
-
node: QuadNode,
|
|
178
|
-
particles: Particle[],
|
|
179
|
-
idx: number
|
|
180
|
-
): void {
|
|
181
|
-
const p = particles[idx];
|
|
182
|
-
const half = node.size / 2;
|
|
183
|
-
|
|
184
|
-
if (half < MIN_CELL_SIZE) {
|
|
185
|
-
if (node.particleIdx >= 0) {
|
|
186
|
-
node.particleIndices = [node.particleIdx];
|
|
187
|
-
node.particleIdx = -1;
|
|
188
|
-
}
|
|
189
|
-
if (!node.particleIndices) node.particleIndices = [];
|
|
190
|
-
node.particleIndices.push(idx);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (node.particleIdx >= 0) {
|
|
195
|
-
const existing = particles[node.particleIdx];
|
|
196
|
-
const q = getQuadrant(existing.x, existing.y, node.x, node.y);
|
|
197
|
-
const child = createEmptyNode(
|
|
198
|
-
node.x + (q === 0 || q === 2 ? -half / 2 : half / 2),
|
|
199
|
-
node.y + (q < 2 ? -half / 2 : half / 2),
|
|
200
|
-
half
|
|
201
|
-
);
|
|
202
|
-
insertParticle(child, particles, node.particleIdx);
|
|
203
|
-
node.children[q] = child;
|
|
204
|
-
node.particleIdx = -1;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const q = getQuadrant(p.x, p.y, node.x, node.y);
|
|
208
|
-
let child = node.children[q];
|
|
209
|
-
|
|
210
|
-
if (child === null) {
|
|
211
|
-
child = createEmptyNode(
|
|
212
|
-
node.x + (q === 0 || q === 2 ? -half / 2 : half / 2),
|
|
213
|
-
node.y + (q < 2 ? -half / 2 : half / 2),
|
|
214
|
-
half
|
|
215
|
-
);
|
|
216
|
-
child.particleIdx = idx;
|
|
217
|
-
child.cx = p.x;
|
|
218
|
-
child.cy = p.y;
|
|
219
|
-
child.mass = p.mass;
|
|
220
|
-
node.children[q] = child;
|
|
221
|
-
} else {
|
|
222
|
-
insertParticle(child, particles, idx);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function computeCenterOfMass(node: QuadNode, particles: Particle[]): void {
|
|
227
|
-
if (node.particleIdx >= 0) {
|
|
228
|
-
const p = particles[node.particleIdx];
|
|
229
|
-
node.cx = p.x;
|
|
230
|
-
node.cy = p.y;
|
|
231
|
-
node.mass = p.mass;
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (node.particleIndices && node.particleIndices.length > 0) {
|
|
236
|
-
let totalMass = 0;
|
|
237
|
-
let sumX = 0;
|
|
238
|
-
let sumY = 0;
|
|
239
|
-
for (const i of node.particleIndices) {
|
|
240
|
-
const p = particles[i];
|
|
241
|
-
totalMass += p.mass;
|
|
242
|
-
sumX += p.x * p.mass;
|
|
243
|
-
sumY += p.y * p.mass;
|
|
244
|
-
}
|
|
245
|
-
if (totalMass > 0) {
|
|
246
|
-
node.cx = sumX / totalMass;
|
|
247
|
-
node.cy = sumY / totalMass;
|
|
248
|
-
}
|
|
249
|
-
node.mass = totalMass;
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
let totalMass = 0;
|
|
254
|
-
let sumX = 0;
|
|
255
|
-
let sumY = 0;
|
|
256
|
-
|
|
257
|
-
for (const c of node.children) {
|
|
258
|
-
if (c !== null) {
|
|
259
|
-
computeCenterOfMass(c, particles);
|
|
260
|
-
totalMass += c.mass;
|
|
261
|
-
sumX += c.cx * c.mass;
|
|
262
|
-
sumY += c.cy * c.mass;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (totalMass > 0) {
|
|
267
|
-
node.cx = sumX / totalMass;
|
|
268
|
-
node.cy = sumY / totalMass;
|
|
269
|
-
}
|
|
270
|
-
node.mass = totalMass;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const THETA = 0.5;
|
|
274
|
-
|
|
275
|
-
function computeForce(
|
|
276
|
-
node: QuadNode,
|
|
277
|
-
particles: Particle[],
|
|
278
|
-
idx: number,
|
|
279
|
-
G: number,
|
|
280
|
-
softening: number,
|
|
281
|
-
ax: Float64Array,
|
|
282
|
-
ay: Float64Array,
|
|
283
|
-
interactions: { count: number }
|
|
284
|
-
): void {
|
|
285
|
-
const p = particles[idx];
|
|
286
|
-
const dx = node.cx - p.x;
|
|
287
|
-
const dy = node.cy - p.y;
|
|
288
|
-
const rSq = dx * dx + dy * dy + softening * softening;
|
|
289
|
-
const r = Math.sqrt(rSq);
|
|
290
|
-
|
|
291
|
-
if (node.particleIdx >= 0) {
|
|
292
|
-
if (node.particleIdx === idx) return;
|
|
293
|
-
const factor = (G * node.mass) / Math.pow(rSq, 1.5);
|
|
294
|
-
ax[idx] += factor * dx;
|
|
295
|
-
ay[idx] += factor * dy;
|
|
296
|
-
interactions.count += 1;
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
if (node.particleIndices && node.particleIndices.length > 0) {
|
|
301
|
-
for (const j of node.particleIndices) {
|
|
302
|
-
if (j === idx) continue;
|
|
303
|
-
const pj = particles[j];
|
|
304
|
-
const dxj = pj.x - p.x;
|
|
305
|
-
const dyj = pj.y - p.y;
|
|
306
|
-
const rSqj = dxj * dxj + dyj * dyj + softening * softening;
|
|
307
|
-
const factor = (G * pj.mass) / Math.pow(rSqj, 1.5);
|
|
308
|
-
ax[idx] += factor * dxj;
|
|
309
|
-
ay[idx] += factor * dyj;
|
|
310
|
-
interactions.count += 1;
|
|
311
|
-
}
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const ratio = node.size / (r + 1e-10);
|
|
316
|
-
|
|
317
|
-
if (ratio < THETA) {
|
|
318
|
-
const factor = (G * node.mass) / Math.pow(rSq, 1.5);
|
|
319
|
-
ax[idx] += factor * dx;
|
|
320
|
-
ay[idx] += factor * dy;
|
|
321
|
-
interactions.count += 1;
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
for (const c of node.children) {
|
|
326
|
-
if (c !== null && c.mass > 0) {
|
|
327
|
-
computeForce(c, particles, idx, G, softening, ax, ay, interactions);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function computeTotalEnergy(
|
|
333
|
-
particles: Particle[],
|
|
334
|
-
G: number,
|
|
335
|
-
softening: number
|
|
336
|
-
): number {
|
|
337
|
-
let kinetic = 0;
|
|
338
|
-
let potential = 0;
|
|
339
|
-
const n = particles.length;
|
|
340
|
-
|
|
341
|
-
for (let i = 0; i < n; i++) {
|
|
342
|
-
const p = particles[i];
|
|
343
|
-
kinetic += 0.5 * p.mass * (p.vx * p.vx + p.vy * p.vy);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
for (let i = 0; i < n; i++) {
|
|
347
|
-
for (let j = i + 1; j < n; j++) {
|
|
348
|
-
const pi = particles[i];
|
|
349
|
-
const pj = particles[j];
|
|
350
|
-
const dx = pj.x - pi.x;
|
|
351
|
-
const dy = pj.y - pi.y;
|
|
352
|
-
const rSq = dx * dx + dy * dy + softening * softening;
|
|
353
|
-
const r = Math.sqrt(rSq);
|
|
354
|
-
potential -= (G * pi.mass * pj.mass) / r;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return kinetic + potential;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
export async function express(input: ParticleInput): Promise<ParticleOutput> {
|
|
362
|
-
const count = Math.max(2, Math.min(2048, input.count ?? 64));
|
|
363
|
-
const steps = Math.max(1, Math.min(10000, input.steps ?? 100));
|
|
364
|
-
const dt = input.dt ?? 0.01;
|
|
365
|
-
const G = input.G ?? 1.0;
|
|
366
|
-
const softening = input.softening ?? 0.01;
|
|
367
|
-
const seed = input.seed ?? 42;
|
|
368
|
-
|
|
369
|
-
let particles: Particle[];
|
|
370
|
-
|
|
371
|
-
if (input.particles && input.particles.length > 0) {
|
|
372
|
-
particles = input.particles.map((p) => ({
|
|
373
|
-
x: p.x,
|
|
374
|
-
y: p.y,
|
|
375
|
-
vx: p.vx,
|
|
376
|
-
vy: p.vy,
|
|
377
|
-
mass: p.mass,
|
|
378
|
-
}));
|
|
379
|
-
} else {
|
|
380
|
-
const preset = input.preset ?? "cluster";
|
|
381
|
-
particles = generatePreset(preset, count, seed);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
const n = particles.length;
|
|
385
|
-
const ax = new Float64Array(n);
|
|
386
|
-
const ay = new Float64Array(n);
|
|
387
|
-
let interactionsComputed = 0;
|
|
388
|
-
const margin = 0.1;
|
|
389
|
-
|
|
390
|
-
for (let stepIdx = 0; stepIdx < steps; stepIdx++) {
|
|
391
|
-
let minX = Infinity;
|
|
392
|
-
let maxX = -Infinity;
|
|
393
|
-
let minY = Infinity;
|
|
394
|
-
let maxY = -Infinity;
|
|
395
|
-
|
|
396
|
-
for (let i = 0; i < n; i++) {
|
|
397
|
-
const p = particles[i];
|
|
398
|
-
if (p.x < minX) minX = p.x;
|
|
399
|
-
if (p.x > maxX) maxX = p.x;
|
|
400
|
-
if (p.y < minY) minY = p.y;
|
|
401
|
-
if (p.y > maxY) maxY = p.y;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
const size = Math.max(maxX - minX, maxY - minY, 1) / 2 + margin;
|
|
405
|
-
const root = createEmptyNode(
|
|
406
|
-
(minX + maxX) / 2,
|
|
407
|
-
(minY + maxY) / 2,
|
|
408
|
-
size
|
|
409
|
-
);
|
|
410
|
-
|
|
411
|
-
for (let i = 0; i < n; i++) {
|
|
412
|
-
insertParticle(root, particles, i);
|
|
413
|
-
}
|
|
414
|
-
computeCenterOfMass(root, particles);
|
|
415
|
-
|
|
416
|
-
ax.fill(0);
|
|
417
|
-
ay.fill(0);
|
|
418
|
-
const interactions = { count: 0 };
|
|
419
|
-
|
|
420
|
-
for (let i = 0; i < n; i++) {
|
|
421
|
-
computeForce(root, particles, i, G, softening, ax, ay, interactions);
|
|
422
|
-
}
|
|
423
|
-
interactionsComputed += interactions.count;
|
|
424
|
-
|
|
425
|
-
for (let i = 0; i < n; i++) {
|
|
426
|
-
const p = particles[i];
|
|
427
|
-
p.vx += 0.5 * dt * ax[i];
|
|
428
|
-
p.vy += 0.5 * dt * ay[i];
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
for (let i = 0; i < n; i++) {
|
|
432
|
-
const p = particles[i];
|
|
433
|
-
p.x += dt * p.vx;
|
|
434
|
-
p.y += dt * p.vy;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
minX = Infinity;
|
|
438
|
-
maxX = -Infinity;
|
|
439
|
-
minY = Infinity;
|
|
440
|
-
maxY = -Infinity;
|
|
441
|
-
|
|
442
|
-
for (let i = 0; i < n; i++) {
|
|
443
|
-
const p = particles[i];
|
|
444
|
-
if (p.x < minX) minX = p.x;
|
|
445
|
-
if (p.x > maxX) maxX = p.x;
|
|
446
|
-
if (p.y < minY) minY = p.y;
|
|
447
|
-
if (p.y > maxY) maxY = p.y;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
const size2 = Math.max(maxX - minX, maxY - minY, 1) / 2 + margin;
|
|
451
|
-
const root2 = createEmptyNode(
|
|
452
|
-
(minX + maxX) / 2,
|
|
453
|
-
(minY + maxY) / 2,
|
|
454
|
-
size2
|
|
455
|
-
);
|
|
456
|
-
|
|
457
|
-
for (let i = 0; i < n; i++) {
|
|
458
|
-
insertParticle(root2, particles, i);
|
|
459
|
-
}
|
|
460
|
-
computeCenterOfMass(root2, particles);
|
|
461
|
-
|
|
462
|
-
ax.fill(0);
|
|
463
|
-
ay.fill(0);
|
|
464
|
-
const interactions2 = { count: 0 };
|
|
465
|
-
|
|
466
|
-
for (let i = 0; i < n; i++) {
|
|
467
|
-
computeForce(root2, particles, i, G, softening, ax, ay, interactions2);
|
|
468
|
-
}
|
|
469
|
-
interactionsComputed += interactions2.count;
|
|
470
|
-
|
|
471
|
-
for (let i = 0; i < n; i++) {
|
|
472
|
-
const p = particles[i];
|
|
473
|
-
p.vx += 0.5 * dt * ax[i];
|
|
474
|
-
p.vy += 0.5 * dt * ay[i];
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
const totalEnergy = computeTotalEnergy(particles, G, softening);
|
|
479
|
-
|
|
480
|
-
return {
|
|
481
|
-
particles,
|
|
482
|
-
steps_computed: steps,
|
|
483
|
-
total_energy: totalEnergy,
|
|
484
|
-
interactions_computed: interactionsComputed,
|
|
485
|
-
};
|
|
486
|
-
}
|