blockmine 1.24.0 → 1.27.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/CHANGELOG.md +76 -1
- package/README.en.md +427 -0
- package/README.md +40 -0
- package/backend/package.json +2 -2
- package/backend/prisma/migrations/20260328173000_add_plugin_source_ref/migration.sql +2 -0
- package/backend/prisma/migrations/migration_lock.toml +2 -2
- package/backend/prisma/schema.prisma +2 -0
- package/backend/src/ai/plugin-assistant-system-prompt.md +664 -5
- package/backend/src/api/routes/apiKeys.js +8 -0
- package/backend/src/api/routes/bots.js +271 -9
- package/backend/src/api/routes/eventGraphs.js +151 -1
- package/backend/src/api/routes/health.js +38 -0
- package/backend/src/api/routes/nodeRegistry.js +63 -0
- package/backend/src/api/routes/plugins.js +254 -29
- package/backend/src/api/routes/servers.js +14 -2
- package/backend/src/container.js +11 -8
- package/backend/src/core/BotCommandLoader.js +161 -0
- package/backend/src/core/BotConnection.js +125 -0
- package/backend/src/core/BotEventHandlers.js +234 -0
- package/backend/src/core/BotIPCHandler.js +445 -0
- package/backend/src/core/BotManager.js +15 -7
- package/backend/src/core/BotProcess.js +169 -140
- package/backend/src/core/EventGraphManager.js +7 -3
- package/backend/src/core/GraphDebugHandler.js +229 -0
- package/backend/src/core/GraphDebugIPC.js +117 -0
- package/backend/src/core/GraphExecutionEngine.js +545 -978
- package/backend/src/core/GraphTraversal.js +80 -0
- package/backend/src/core/GraphValidation.js +73 -0
- package/backend/src/core/NodeDefinition.js +138 -0
- package/backend/src/core/NodeRegistry.js +153 -141
- package/backend/src/core/PluginLoader.js +83 -3
- package/backend/src/core/PluginManager.js +346 -35
- package/backend/src/core/RewindSignal.js +9 -0
- package/backend/src/core/config/ConfigValidator.js +72 -0
- package/backend/src/core/config/FeatureFlags.js +52 -0
- package/backend/src/core/config/__tests__/ConfigValidator.test.js +232 -0
- package/backend/src/core/domain/entities/Bot.js +39 -0
- package/backend/src/core/domain/entities/Command.js +41 -0
- package/backend/src/core/domain/entities/EventGraph.js +39 -0
- package/backend/src/core/domain/entities/Plugin.js +45 -0
- package/backend/src/core/domain/entities/User.js +40 -0
- package/backend/src/core/domain/services/DependencyResolver.js +168 -0
- package/backend/src/core/domain/services/GraphValidator.js +117 -0
- package/backend/src/core/domain/services/PermissionChecker.js +34 -0
- package/backend/src/core/domain/services/__tests__/DependencyResolver.test.js +126 -0
- package/backend/src/core/domain/valueObjects/BotConfig.js +27 -0
- package/backend/src/core/domain/valueObjects/DependencyGraph.js +86 -0
- package/backend/src/core/domain/valueObjects/PluginManifest.js +36 -0
- package/backend/src/core/errors/BaseError.js +29 -0
- package/backend/src/core/errors/ErrorHandler.js +81 -0
- package/backend/src/core/errors/__tests__/ErrorHandler.test.js +188 -0
- package/backend/src/core/errors/index.js +68 -0
- package/backend/src/core/infrastructure/BatchingUtility.js +66 -0
- package/backend/src/core/infrastructure/CircuitBreaker.js +103 -0
- package/backend/src/core/infrastructure/ConnectionPool.js +81 -0
- package/backend/src/core/infrastructure/RateLimiter.js +64 -0
- package/backend/src/core/infrastructure/__tests__/BatchingUtility.test.js +86 -0
- package/backend/src/core/infrastructure/__tests__/CircuitBreaker.test.js +156 -0
- package/backend/src/core/infrastructure/__tests__/ConnectionPool.test.js +146 -0
- package/backend/src/core/infrastructure/__tests__/RateLimiter.test.js +171 -0
- package/backend/src/core/ipc/botApiFactory.js +72 -0
- package/backend/src/core/ipc/ipcMessageTypes.js +115 -0
- package/backend/src/core/logging/AuditLogger.js +61 -0
- package/backend/src/core/logging/StructuredLogger.js +80 -0
- package/backend/src/core/logging/__tests__/StructuredLogger.test.js +213 -0
- package/backend/src/core/logging/index.js +7 -0
- package/backend/src/core/metrics/MetricsCollector.js +104 -0
- package/backend/src/core/metrics/__tests__/MetricsCollector.test.js +131 -0
- package/backend/src/core/node-registries/actionsNodes.js +191 -0
- package/backend/src/core/node-registries/arraysNodes.js +152 -0
- package/backend/src/core/node-registries/botNodes.js +48 -0
- package/backend/src/core/node-registries/containerNodes.js +141 -0
- package/backend/src/core/node-registries/dataNodes.js +284 -0
- package/backend/src/core/node-registries/debugNodes.js +23 -0
- package/backend/src/core/node-registries/eventsNodes.js +223 -0
- package/backend/src/core/node-registries/flowNodes.js +151 -0
- package/backend/src/core/node-registries/furnaceNodes.js +123 -0
- package/backend/src/core/node-registries/index.js +108 -0
- package/backend/src/core/node-registries/inventory.js +102 -106
- package/backend/src/core/node-registries/logicNodes.js +54 -0
- package/backend/src/core/node-registries/mathNodes.js +38 -0
- package/backend/src/core/node-registries/navigationNodes.js +109 -0
- package/backend/src/core/node-registries/objectsNodes.js +90 -0
- package/backend/src/core/node-registries/stringsNodes.js +165 -0
- package/backend/src/core/node-registries/timeNodes.js +105 -0
- package/backend/src/core/node-registries/typeNodes.js +22 -0
- package/backend/src/core/node-registries/usersNodes.js +126 -0
- package/backend/src/core/nodes/arrays/shuffle.js +14 -0
- package/backend/src/core/nodes/bot/get_name.js +8 -0
- package/backend/src/core/nodes/bot/stop_bot.js +5 -0
- package/backend/src/core/nodes/container/open.js +101 -111
- package/backend/src/core/nodes/data/store_read.js +26 -0
- package/backend/src/core/nodes/data/store_write.js +23 -0
- package/backend/src/core/nodes/event/call_event.js +31 -0
- package/backend/src/core/nodes/event/custom_event.js +8 -0
- package/backend/src/core/nodes/flow/timer.js +35 -0
- package/backend/src/core/nodes/inventory/drop.js +73 -65
- package/backend/src/core/nodes/inventory/equip.js +54 -45
- package/backend/src/core/nodes/inventory/select_slot.js +48 -46
- package/backend/src/core/nodes/navigation/follow.js +54 -51
- package/backend/src/core/nodes/navigation/go_to.js +41 -53
- package/backend/src/core/nodes/navigation/go_to_entity.js +65 -69
- package/backend/src/core/nodes/navigation/go_to_player.js +65 -70
- package/backend/src/core/nodes/navigation/stop.js +17 -26
- package/backend/src/core/nodes/users/add_to_group.js +24 -0
- package/backend/src/core/nodes/users/check_permission.js +26 -0
- package/backend/src/core/nodes/users/remove_from_group.js +24 -0
- package/backend/src/core/services/BotIPCMessageRouter.js +337 -0
- package/backend/src/core/services/BotLifecycleService.js +43 -450
- package/backend/src/core/services/CacheManager.js +83 -23
- package/backend/src/core/services/CrashRestartManager.js +42 -0
- package/backend/src/core/services/DebugSessionManager.js +114 -12
- package/backend/src/core/services/EventGraphService.js +69 -0
- package/backend/src/core/services/MinecraftBotManager.js +9 -1
- package/backend/src/core/services/PluginManagementService.js +84 -0
- package/backend/src/core/services/TestModeContext.js +65 -0
- package/backend/src/core/services/__tests__/CacheManager.test.js +168 -0
- package/backend/src/core/services.js +1 -11
- package/backend/src/core/validation/InputValidator.js +167 -0
- package/backend/src/core/validation/__tests__/InputValidator.test.js +296 -0
- package/backend/src/real-time/botApi/index.js +1 -1
- package/backend/src/real-time/socketHandler.js +26 -0
- package/backend/src/server.js +21 -6
- package/frontend/dist/assets/browser-ponyfill-D8y0Ty7C.js +2 -0
- package/frontend/dist/assets/index-CFJLS0dk.css +32 -0
- package/frontend/dist/assets/index-D91UGNMG.js +11260 -0
- package/frontend/dist/flags/en.svg +32 -0
- package/frontend/dist/flags/ru.svg +5 -0
- package/frontend/dist/index.html +2 -2
- package/frontend/dist/locales/en/admin.json +100 -0
- package/frontend/dist/locales/en/api-keys.json +58 -0
- package/frontend/dist/locales/en/bots.json +113 -0
- package/frontend/dist/locales/en/common.json +53 -0
- package/frontend/dist/locales/en/configuration.json +22 -0
- package/frontend/dist/locales/en/console.json +10 -0
- package/frontend/dist/locales/en/dashboard.json +85 -0
- package/frontend/dist/locales/en/dialogs.json +70 -0
- package/frontend/dist/locales/en/event-graphs.json +50 -0
- package/frontend/dist/locales/en/graph-store.json +70 -0
- package/frontend/dist/locales/en/login.json +36 -0
- package/frontend/dist/locales/en/management.json +192 -0
- package/frontend/dist/locales/en/minecraft-viewer.json +27 -0
- package/frontend/dist/locales/en/nodes.json +1132 -0
- package/frontend/dist/locales/en/permissions.json +50 -0
- package/frontend/dist/locales/en/plugin-detail.json +69 -0
- package/frontend/dist/locales/en/plugins.json +329 -0
- package/frontend/dist/locales/en/proxies.json +81 -0
- package/frontend/dist/locales/en/servers.json +39 -0
- package/frontend/dist/locales/en/setup.json +19 -0
- package/frontend/dist/locales/en/sidebar.json +195 -0
- package/frontend/dist/locales/en/tasks.json +62 -0
- package/frontend/dist/locales/en/visual-editor.json +418 -0
- package/frontend/dist/locales/en/websocket.json +86 -0
- package/frontend/dist/locales/ru/admin.json +100 -0
- package/frontend/dist/locales/ru/api-keys.json +58 -0
- package/frontend/dist/locales/ru/bots.json +113 -0
- package/frontend/dist/locales/ru/common.json +49 -0
- package/frontend/dist/locales/ru/configuration.json +22 -0
- package/frontend/dist/locales/ru/console.json +10 -0
- package/frontend/dist/locales/ru/dashboard.json +85 -0
- package/frontend/dist/locales/ru/dialogs.json +70 -0
- package/frontend/dist/locales/ru/event-graphs.json +50 -0
- package/frontend/dist/locales/ru/graph-store.json +70 -0
- package/frontend/dist/locales/ru/login.json +36 -0
- package/frontend/dist/locales/ru/management.json +192 -0
- package/frontend/dist/locales/ru/minecraft-viewer.json +30 -0
- package/frontend/dist/locales/ru/nodes.json +1131 -0
- package/frontend/dist/locales/ru/permissions.json +50 -0
- package/frontend/dist/locales/ru/plugin-detail.json +49 -0
- package/frontend/dist/locales/ru/plugins.json +209 -0
- package/frontend/dist/locales/ru/proxies.json +81 -0
- package/frontend/dist/locales/ru/servers.json +39 -0
- package/frontend/dist/locales/ru/setup.json +19 -0
- package/frontend/dist/locales/ru/sidebar.json +195 -0
- package/frontend/dist/locales/ru/tasks.json +62 -0
- package/frontend/dist/locales/ru/visual-editor.json +420 -0
- package/frontend/dist/locales/ru/websocket.json +86 -0
- package/frontend/dist/monacoeditorwork/css.worker.bundle.js +7 -7
- package/frontend/dist/monacoeditorwork/html.worker.bundle.js +7 -7
- package/frontend/dist/monacoeditorwork/json.worker.bundle.js +7 -7
- package/frontend/dist/monacoeditorwork/ts.worker.bundle.js +3 -3
- package/frontend/package.json +6 -0
- package/nul +12 -0
- package/package.json +3 -3
- package/screen/3dviewer.png +0 -0
- package/screen/console.png +0 -0
- package/screen/dashboard.png +0 -0
- package/screen/graph_collabe.png +0 -0
- package/screen/graph_live_debug.png +0 -0
- package/screen/language_selector.png +0 -0
- package/screen/management_command.png +0 -0
- package/screen/node_debug_trace.png +0 -0
- package/screen/plugin_/320/276/320/261/320/267/320/276/321/200.png +0 -0
- package/screen/websocket.png +0 -0
- package/screen//320/275/320/260/321/201/321/202/321/200/320/276/320/271/320/272/320/270_/320/276/321/202/320/264/320/265/320/273/321/214/320/275/321/213/321/205_/320/272/320/276/320/274/320/260/320/275/320/264_/320/272/320/260/320/266/320/264/321/203_/320/272/320/276/320/274/320/260/320/275/320/273/320/264/321/203_/320/274/320/276/320/266/320/275/320/276_/320/275/320/260/321/201/321/202/321/200/320/260/320/270/320/262/320/260/321/202/321/214.png +0 -0
- package/screen//320/277/320/273/320/260/320/275/320/270/321/200/320/276/320/262/321/211/320/270/320/272_/320/274/320/276/320/266/320/275/320/276_/320/267/320/260/320/264/320/260/320/262/320/260/321/202/321/214_/320/264/320/265/320/271/321/201/321/202/320/262/320/270/321/217_/320/277/320/276_/320/262/321/200/320/265/320/274/320/265/320/275/320/270.png +0 -0
- package/.claude/agents/README.md +0 -469
- package/.claude/agents/auth-route-debugger.md +0 -118
- package/.claude/agents/auth-route-tester.md +0 -93
- package/.claude/agents/auto-error-resolver.md +0 -97
- package/.claude/agents/build-optimizer.md +0 -236
- package/.claude/agents/code-architect.md +0 -34
- package/.claude/agents/code-architecture-reviewer.md +0 -83
- package/.claude/agents/code-explorer.md +0 -51
- package/.claude/agents/code-refactor-master.md +0 -94
- package/.claude/agents/code-reviewer.md +0 -46
- package/.claude/agents/cost-optimizer.md +0 -134
- package/.claude/agents/deployment-orchestrator.md +0 -113
- package/.claude/agents/documentation-architect.md +0 -82
- package/.claude/agents/frontend-error-fixer.md +0 -77
- package/.claude/agents/iac-code-generator.md +0 -71
- package/.claude/agents/incident-responder.md +0 -346
- package/.claude/agents/infrastructure-architect.md +0 -31
- package/.claude/agents/kubernetes-specialist.md +0 -56
- package/.claude/agents/migration-planner.md +0 -181
- package/.claude/agents/network-architect.md +0 -196
- package/.claude/agents/plan-reviewer.md +0 -52
- package/.claude/agents/refactor-planner.md +0 -63
- package/.claude/agents/security-scanner.md +0 -102
- package/.claude/agents/web-research-specialist.md +0 -78
- package/.claude/commands/cost-analysis.md +0 -315
- package/.claude/commands/dev-docs-update.md +0 -55
- package/.claude/commands/dev-docs.md +0 -51
- package/.claude/commands/feature-dev.md +0 -125
- package/.claude/commands/incident-debug.md +0 -247
- package/.claude/commands/infra-plan.md +0 -81
- package/.claude/commands/migration-plan.md +0 -478
- package/.claude/commands/route-research-for-testing.md +0 -37
- package/.claude/commands/security-review.md +0 -66
- package/.claude/hooks/CONFIG.md +0 -448
- package/.claude/hooks/README.md +0 -163
- package/.claude/hooks/SKILL_ACTIVATION_COMPLETE.md +0 -226
- package/.claude/hooks/WINDOWS_HOOKS_README.md +0 -151
- package/.claude/hooks/add-skill-activation-banners.ts +0 -132
- package/.claude/hooks/comprehensive-skill-test.ts +0 -1315
- package/.claude/hooks/error-handling-reminder.sh +0 -12
- package/.claude/hooks/error-handling-reminder.ts +0 -222
- package/.claude/hooks/k8s-manifest-validator.sh +0 -56
- package/.claude/hooks/package-lock.json +0 -556
- package/.claude/hooks/package.json +0 -16
- package/.claude/hooks/post-tool-use-tracker.ps1 +0 -174
- package/.claude/hooks/post-tool-use-tracker.sh +0 -183
- package/.claude/hooks/security-policy-check.sh +0 -247
- package/.claude/hooks/skill-activation-prompt.ps1 +0 -10
- package/.claude/hooks/skill-activation-prompt.sh +0 -10
- package/.claude/hooks/skill-activation-prompt.ts +0 -141
- package/.claude/hooks/stop-build-check-enhanced.sh +0 -130
- package/.claude/hooks/terraform-validator.sh +0 -53
- package/.claude/hooks/test-input.json +0 -7
- package/.claude/hooks/test-skill-activation.ts +0 -427
- package/.claude/hooks/trigger-build-resolver.sh +0 -79
- package/.claude/hooks/tsc-check.sh +0 -173
- package/.claude/hooks/tsconfig.json +0 -19
- package/.claude/settings.json +0 -59
- package/.claude/settings.local.json +0 -67
- package/.claude/skills/README.md +0 -507
- package/.claude/skills/api-engineering/SKILL.md +0 -63
- package/.claude/skills/api-engineering/resources/api-versioning.md +0 -88
- package/.claude/skills/api-engineering/resources/graphql-patterns.md +0 -106
- package/.claude/skills/api-engineering/resources/rate-limiting.md +0 -118
- package/.claude/skills/api-engineering/resources/rest-api-design.md +0 -105
- package/.claude/skills/backend-dev-guidelines/SKILL.md +0 -306
- package/.claude/skills/backend-dev-guidelines/resources/architecture-overview.md +0 -451
- package/.claude/skills/backend-dev-guidelines/resources/async-and-errors.md +0 -307
- package/.claude/skills/backend-dev-guidelines/resources/complete-examples.md +0 -638
- package/.claude/skills/backend-dev-guidelines/resources/configuration.md +0 -275
- package/.claude/skills/backend-dev-guidelines/resources/database-patterns.md +0 -224
- package/.claude/skills/backend-dev-guidelines/resources/middleware-guide.md +0 -213
- package/.claude/skills/backend-dev-guidelines/resources/routing-and-controllers.md +0 -756
- package/.claude/skills/backend-dev-guidelines/resources/sentry-and-monitoring.md +0 -336
- package/.claude/skills/backend-dev-guidelines/resources/services-and-repositories.md +0 -789
- package/.claude/skills/backend-dev-guidelines/resources/testing-guide.md +0 -235
- package/.claude/skills/backend-dev-guidelines/resources/validation-patterns.md +0 -754
- package/.claude/skills/budget-and-cost-management/SKILL.md +0 -850
- package/.claude/skills/build-engineering/SKILL.md +0 -431
- package/.claude/skills/build-engineering/resources/artifact-repositories.md +0 -72
- package/.claude/skills/build-engineering/resources/build-caching.md +0 -96
- package/.claude/skills/build-engineering/resources/build-pipelines.md +0 -105
- package/.claude/skills/build-engineering/resources/build-security.md +0 -95
- package/.claude/skills/build-engineering/resources/build-systems.md +0 -389
- package/.claude/skills/build-engineering/resources/compilation-optimization.md +0 -201
- package/.claude/skills/build-engineering/resources/dependency-management.md +0 -73
- package/.claude/skills/build-engineering/resources/monorepo-builds.md +0 -110
- package/.claude/skills/build-engineering/resources/performance-optimization.md +0 -113
- package/.claude/skills/build-engineering/resources/reproducible-builds.md +0 -82
- package/.claude/skills/cloud-engineering/SKILL.md +0 -675
- package/.claude/skills/cloud-engineering/resources/aws-patterns.md +0 -742
- package/.claude/skills/cloud-engineering/resources/azure-patterns.md +0 -714
- package/.claude/skills/cloud-engineering/resources/cleared-cloud-environments.md +0 -987
- package/.claude/skills/cloud-engineering/resources/cloud-cost-optimization.md +0 -757
- package/.claude/skills/cloud-engineering/resources/cloud-networking.md +0 -1058
- package/.claude/skills/cloud-engineering/resources/cloud-security-tools.md +0 -1530
- package/.claude/skills/cloud-engineering/resources/cloud-security.md +0 -990
- package/.claude/skills/cloud-engineering/resources/gcp-patterns.md +0 -758
- package/.claude/skills/cloud-engineering/resources/migration-strategies.md +0 -820
- package/.claude/skills/cloud-engineering/resources/multi-cloud-strategies.md +0 -670
- package/.claude/skills/cloud-engineering/resources/oci-patterns.md +0 -1198
- package/.claude/skills/cloud-engineering/resources/serverless-patterns.md +0 -795
- package/.claude/skills/cloud-engineering/resources/well-architected-frameworks.md +0 -966
- package/.claude/skills/cybersecurity/SKILL.md +0 -409
- package/.claude/skills/cybersecurity/resources/security-architecture.md +0 -266
- package/.claude/skills/database-engineering/SKILL.md +0 -61
- package/.claude/skills/database-engineering/resources/backup-and-recovery.md +0 -72
- package/.claude/skills/database-engineering/resources/database-replication.md +0 -63
- package/.claude/skills/database-engineering/resources/postgresql-fundamentals.md +0 -70
- package/.claude/skills/database-engineering/resources/query-optimization.md +0 -68
- package/.claude/skills/devsecops/SKILL.md +0 -374
- package/.claude/skills/devsecops/resources/ci-cd-security.md +0 -204
- package/.claude/skills/devsecops/resources/compliance-automation.md +0 -530
- package/.claude/skills/devsecops/resources/compliance-frameworks.md +0 -2322
- package/.claude/skills/devsecops/resources/container-security.md +0 -915
- package/.claude/skills/devsecops/resources/cspm-integration.md +0 -1440
- package/.claude/skills/devsecops/resources/policy-enforcement.md +0 -619
- package/.claude/skills/devsecops/resources/secrets-management.md +0 -755
- package/.claude/skills/devsecops/resources/security-monitoring.md +0 -146
- package/.claude/skills/devsecops/resources/security-scanning.md +0 -887
- package/.claude/skills/devsecops/resources/security-testing.md +0 -203
- package/.claude/skills/devsecops/resources/supply-chain-security.md +0 -518
- package/.claude/skills/devsecops/resources/vulnerability-management.md +0 -481
- package/.claude/skills/devsecops/resources/zero-trust-architecture.md +0 -177
- package/.claude/skills/documentation-as-code/SKILL.md +0 -323
- package/.claude/skills/documentation-as-code/resources/api-documentation.md +0 -90
- package/.claude/skills/documentation-as-code/resources/changelog-management.md +0 -79
- package/.claude/skills/documentation-as-code/resources/diagram-generation.md +0 -44
- package/.claude/skills/documentation-as-code/resources/docs-as-code-workflow.md +0 -99
- package/.claude/skills/documentation-as-code/resources/documentation-automation.md +0 -68
- package/.claude/skills/documentation-as-code/resources/documentation-sites.md +0 -79
- package/.claude/skills/documentation-as-code/resources/markdown-best-practices.md +0 -162
- package/.claude/skills/documentation-as-code/resources/openapi-specification.md +0 -77
- package/.claude/skills/documentation-as-code/resources/readme-engineering.md +0 -60
- package/.claude/skills/documentation-as-code/resources/technical-writing-guide.md +0 -202
- package/.claude/skills/engineering-management/SKILL.md +0 -356
- package/.claude/skills/engineering-management/resources/career-ladders.md +0 -609
- package/.claude/skills/engineering-management/resources/hiring-and-assessment.md +0 -555
- package/.claude/skills/engineering-management/resources/one-on-one-guides.md +0 -609
- package/.claude/skills/engineering-management/resources/resource-planning.md +0 -557
- package/.claude/skills/engineering-management/resources/team-organization-patterns.md +0 -491
- package/.claude/skills/engineering-management/resources/technical-interviews.md +0 -474
- package/.claude/skills/engineering-operations-management/SKILL.md +0 -817
- package/.claude/skills/error-tracking/SKILL.md +0 -379
- package/.claude/skills/frontend-design/SKILL.md +0 -42
- package/.claude/skills/frontend-dev-guidelines/SKILL.md +0 -403
- package/.claude/skills/frontend-dev-guidelines/resources/common-patterns.md +0 -331
- package/.claude/skills/frontend-dev-guidelines/resources/complete-examples.md +0 -872
- package/.claude/skills/frontend-dev-guidelines/resources/component-patterns.md +0 -502
- package/.claude/skills/frontend-dev-guidelines/resources/data-fetching.md +0 -767
- package/.claude/skills/frontend-dev-guidelines/resources/file-organization.md +0 -502
- package/.claude/skills/frontend-dev-guidelines/resources/loading-and-error-states.md +0 -501
- package/.claude/skills/frontend-dev-guidelines/resources/performance.md +0 -406
- package/.claude/skills/frontend-dev-guidelines/resources/routing-guide.md +0 -364
- package/.claude/skills/frontend-dev-guidelines/resources/styling-guide.md +0 -428
- package/.claude/skills/frontend-dev-guidelines/resources/typescript-standards.md +0 -418
- package/.claude/skills/general-it-engineering/SKILL.md +0 -393
- package/.claude/skills/general-it-engineering/resources/asset-management.md +0 -712
- package/.claude/skills/general-it-engineering/resources/automation-orchestration.md +0 -817
- package/.claude/skills/general-it-engineering/resources/business-continuity.md +0 -786
- package/.claude/skills/general-it-engineering/resources/change-management.md +0 -715
- package/.claude/skills/general-it-engineering/resources/enterprise-monitoring.md +0 -729
- package/.claude/skills/general-it-engineering/resources/help-desk-operations.md +0 -738
- package/.claude/skills/general-it-engineering/resources/incident-service-management.md +0 -834
- package/.claude/skills/general-it-engineering/resources/it-governance.md +0 -753
- package/.claude/skills/general-it-engineering/resources/itil-framework.md +0 -503
- package/.claude/skills/general-it-engineering/resources/service-management.md +0 -669
- package/.claude/skills/infrastructure-architecture/SKILL.md +0 -328
- package/.claude/skills/infrastructure-architecture/resources/architecture-decision-records.md +0 -505
- package/.claude/skills/infrastructure-architecture/resources/architecture-patterns.md +0 -528
- package/.claude/skills/infrastructure-architecture/resources/capacity-planning.md +0 -453
- package/.claude/skills/infrastructure-architecture/resources/cleared-environment-architecture.md +0 -773
- package/.claude/skills/infrastructure-architecture/resources/cost-architecture.md +0 -499
- package/.claude/skills/infrastructure-architecture/resources/data-architecture.md +0 -501
- package/.claude/skills/infrastructure-architecture/resources/disaster-recovery.md +0 -535
- package/.claude/skills/infrastructure-architecture/resources/migration-architecture.md +0 -512
- package/.claude/skills/infrastructure-architecture/resources/multi-region-design.md +0 -608
- package/.claude/skills/infrastructure-architecture/resources/reference-architectures.md +0 -562
- package/.claude/skills/infrastructure-architecture/resources/security-architecture.md +0 -538
- package/.claude/skills/infrastructure-architecture/resources/system-design-principles.md +0 -489
- package/.claude/skills/infrastructure-architecture/resources/workload-classification.md +0 -1000
- package/.claude/skills/infrastructure-strategy/SKILL.md +0 -924
- package/.claude/skills/network-engineering/SKILL.md +0 -385
- package/.claude/skills/network-engineering/resources/dns-management.md +0 -738
- package/.claude/skills/network-engineering/resources/load-balancing.md +0 -820
- package/.claude/skills/network-engineering/resources/network-architecture.md +0 -546
- package/.claude/skills/network-engineering/resources/network-security.md +0 -921
- package/.claude/skills/network-engineering/resources/network-troubleshooting.md +0 -749
- package/.claude/skills/network-engineering/resources/routing-switching.md +0 -373
- package/.claude/skills/network-engineering/resources/sdn-networking.md +0 -695
- package/.claude/skills/network-engineering/resources/service-mesh-networking.md +0 -777
- package/.claude/skills/network-engineering/resources/tcp-ip-protocols.md +0 -444
- package/.claude/skills/network-engineering/resources/vpn-connectivity.md +0 -672
- package/.claude/skills/node-development/SKILL.md +0 -317
- package/.claude/skills/observability-engineering/SKILL.md +0 -101
- package/.claude/skills/observability-engineering/resources/apm-tools.md +0 -97
- package/.claude/skills/observability-engineering/resources/correlation-strategies.md +0 -87
- package/.claude/skills/observability-engineering/resources/distributed-tracing.md +0 -98
- package/.claude/skills/observability-engineering/resources/logs-aggregation.md +0 -118
- package/.claude/skills/observability-engineering/resources/observability-cost-optimization.md +0 -141
- package/.claude/skills/observability-engineering/resources/opentelemetry.md +0 -110
- package/.claude/skills/platform-engineering/SKILL.md +0 -555
- package/.claude/skills/platform-engineering/resources/architecture-overview.md +0 -600
- package/.claude/skills/platform-engineering/resources/container-orchestration.md +0 -916
- package/.claude/skills/platform-engineering/resources/cost-optimization.md +0 -634
- package/.claude/skills/platform-engineering/resources/developer-platforms.md +0 -670
- package/.claude/skills/platform-engineering/resources/gitops-automation.md +0 -650
- package/.claude/skills/platform-engineering/resources/infrastructure-as-code.md +0 -778
- package/.claude/skills/platform-engineering/resources/infrastructure-standards.md +0 -708
- package/.claude/skills/platform-engineering/resources/multi-tenancy.md +0 -602
- package/.claude/skills/platform-engineering/resources/platform-security.md +0 -711
- package/.claude/skills/platform-engineering/resources/resource-management.md +0 -592
- package/.claude/skills/platform-engineering/resources/service-mesh.md +0 -628
- package/.claude/skills/release-engineering/SKILL.md +0 -393
- package/.claude/skills/release-engineering/resources/artifact-management.md +0 -108
- package/.claude/skills/release-engineering/resources/build-optimization.md +0 -84
- package/.claude/skills/release-engineering/resources/ci-cd-pipelines.md +0 -411
- package/.claude/skills/release-engineering/resources/deployment-strategies.md +0 -197
- package/.claude/skills/release-engineering/resources/pipeline-security.md +0 -62
- package/.claude/skills/release-engineering/resources/progressive-delivery.md +0 -83
- package/.claude/skills/release-engineering/resources/release-automation.md +0 -68
- package/.claude/skills/release-engineering/resources/release-orchestration.md +0 -77
- package/.claude/skills/release-engineering/resources/rollback-strategies.md +0 -66
- package/.claude/skills/release-engineering/resources/versioning-strategies.md +0 -59
- package/.claude/skills/route-tester/SKILL.md +0 -392
- package/.claude/skills/skill-developer/ADVANCED.md +0 -197
- package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +0 -306
- package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +0 -152
- package/.claude/skills/skill-developer/SKILL.md +0 -430
- package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +0 -315
- package/.claude/skills/skill-developer/TRIGGER_TYPES.md +0 -305
- package/.claude/skills/skill-developer/TROUBLESHOOTING.md +0 -514
- package/.claude/skills/skill-rules.json +0 -2989
- package/.claude/skills/sre/SKILL.md +0 -464
- package/.claude/skills/sre/resources/alerting-best-practices.md +0 -282
- package/.claude/skills/sre/resources/capacity-planning.md +0 -226
- package/.claude/skills/sre/resources/chaos-engineering.md +0 -193
- package/.claude/skills/sre/resources/disaster-recovery.md +0 -232
- package/.claude/skills/sre/resources/incident-management.md +0 -436
- package/.claude/skills/sre/resources/observability-stack.md +0 -240
- package/.claude/skills/sre/resources/on-call-runbooks.md +0 -167
- package/.claude/skills/sre/resources/performance-optimization.md +0 -108
- package/.claude/skills/sre/resources/reliability-patterns.md +0 -183
- package/.claude/skills/sre/resources/slo-sli-sla.md +0 -464
- package/.claude/skills/sre/resources/toil-reduction.md +0 -145
- package/.claude/skills/systems-engineering/SKILL.md +0 -648
- package/.claude/skills/systems-engineering/resources/automation-patterns.md +0 -771
- package/.claude/skills/systems-engineering/resources/configuration-management.md +0 -998
- package/.claude/skills/systems-engineering/resources/linux-administration.md +0 -672
- package/.claude/skills/systems-engineering/resources/networking-fundamentals.md +0 -982
- package/.claude/skills/systems-engineering/resources/performance-tuning.md +0 -871
- package/.claude/skills/systems-engineering/resources/powershell-scripting.md +0 -482
- package/.claude/skills/systems-engineering/resources/security-hardening.md +0 -739
- package/.claude/skills/systems-engineering/resources/shell-scripting.md +0 -915
- package/.claude/skills/systems-engineering/resources/storage-management.md +0 -628
- package/.claude/skills/systems-engineering/resources/system-monitoring.md +0 -787
- package/.claude/skills/systems-engineering/resources/troubleshooting-guide.md +0 -753
- package/.claude/skills/systems-engineering/resources/windows-administration.md +0 -738
- package/.claude/skills/technical-leadership/SKILL.md +0 -728
- package/backend/docs/SECRETS_DOCUMENTATION.md +0 -327
- package/backend/package-lock.json +0 -6801
- package/backend/src/core/node-registries/actions.js +0 -202
- package/backend/src/core/node-registries/arrays.js +0 -155
- package/backend/src/core/node-registries/bot.js +0 -23
- package/backend/src/core/node-registries/container.js +0 -162
- package/backend/src/core/node-registries/data.js +0 -290
- package/backend/src/core/node-registries/debug.js +0 -26
- package/backend/src/core/node-registries/events.js +0 -201
- package/backend/src/core/node-registries/flow.js +0 -139
- package/backend/src/core/node-registries/furnace.js +0 -143
- package/backend/src/core/node-registries/logic.js +0 -62
- package/backend/src/core/node-registries/math.js +0 -42
- package/backend/src/core/node-registries/navigation.js +0 -111
- package/backend/src/core/node-registries/objects.js +0 -98
- package/backend/src/core/node-registries/strings.js +0 -187
- package/backend/src/core/node-registries/time.js +0 -113
- package/backend/src/core/node-registries/type.js +0 -25
- package/backend/src/core/node-registries/users.js +0 -79
- package/frontend/dist/assets/index-BC-NbKXi.css +0 -32
- package/frontend/dist/assets/index-DqJXZMHY.js +0 -11266
|
@@ -6,23 +6,224 @@ const { pluginManager } = require('../../core/services');
|
|
|
6
6
|
|
|
7
7
|
const prisma = new PrismaClient();
|
|
8
8
|
const OFFICIAL_CATALOG_URL = "https://raw.githubusercontent.com/blockmineJS/official-plugins-list/main/index.json";
|
|
9
|
+
const CATALOG_TTL_MS = 5 * 60 * 1000;
|
|
10
|
+
const PLUGIN_DETAIL_TTL_MS = 10 * 60 * 1000;
|
|
11
|
+
const PLUGIN_CHANGELOG_TTL_MS = 10 * 60 * 1000;
|
|
12
|
+
|
|
13
|
+
let catalogCache = {
|
|
14
|
+
data: null,
|
|
15
|
+
expiresAt: 0,
|
|
16
|
+
pending: null,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const pluginDetailCache = new Map();
|
|
20
|
+
const pluginChangelogCache = new Map();
|
|
21
|
+
const GITHUB_REQUEST_TIMEOUT_MS = 10000;
|
|
22
|
+
|
|
23
|
+
function getGithubHeaders(extra = {}) {
|
|
24
|
+
const headers = {
|
|
25
|
+
'Accept': 'application/vnd.github+json',
|
|
26
|
+
'User-Agent': 'BlockMine',
|
|
27
|
+
...extra
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
if (process.env.GITHUB_TOKEN) {
|
|
31
|
+
headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
|
32
|
+
}
|
|
9
33
|
|
|
10
|
-
|
|
11
|
-
|
|
34
|
+
return headers;
|
|
35
|
+
}
|
|
12
36
|
|
|
13
|
-
|
|
37
|
+
async function fetchWithTimeout(url, options = {}) {
|
|
38
|
+
const controller = new AbortController();
|
|
39
|
+
const timeoutId = setTimeout(() => controller.abort(), GITHUB_REQUEST_TIMEOUT_MS);
|
|
14
40
|
try {
|
|
15
|
-
|
|
16
|
-
|
|
41
|
+
return await fetch(url, { ...options, signal: controller.signal });
|
|
42
|
+
} finally {
|
|
43
|
+
clearTimeout(timeoutId);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function fetchOfficialCatalog(force = false) {
|
|
48
|
+
const now = Date.now();
|
|
49
|
+
|
|
50
|
+
if (!force && catalogCache.data && catalogCache.expiresAt > now) {
|
|
51
|
+
return catalogCache.data;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (catalogCache.pending) {
|
|
55
|
+
return catalogCache.pending;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
catalogCache.pending = (async () => {
|
|
59
|
+
const response = await fetchWithTimeout(OFFICIAL_CATALOG_URL);
|
|
60
|
+
|
|
17
61
|
if (!response.ok) {
|
|
18
62
|
const errorText = await response.text();
|
|
19
63
|
console.error(`[API Error] Failed to fetch catalog from GitHub. Status: ${response.status}, Response: ${errorText}`);
|
|
20
64
|
throw new Error(`GitHub returned status ${response.status}`);
|
|
21
65
|
}
|
|
22
|
-
|
|
23
|
-
|
|
66
|
+
|
|
67
|
+
const data = await response.json();
|
|
68
|
+
catalogCache.data = data;
|
|
69
|
+
catalogCache.expiresAt = Date.now() + CATALOG_TTL_MS;
|
|
70
|
+
return data;
|
|
71
|
+
})();
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
return await catalogCache.pending;
|
|
75
|
+
} catch (error) {
|
|
76
|
+
catalogCache.data = null;
|
|
77
|
+
catalogCache.expiresAt = 0;
|
|
78
|
+
throw error;
|
|
79
|
+
} finally {
|
|
80
|
+
catalogCache.pending = null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function getCachedTimedValue(cache, key) {
|
|
85
|
+
const cached = cache.get(key);
|
|
86
|
+
if (!cached) return null;
|
|
87
|
+
if (cached.expiresAt <= Date.now()) {
|
|
88
|
+
cache.delete(key);
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return cached.data;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function setCachedTimedValue(cache, key, data, ttlMs) {
|
|
95
|
+
cache.set(key, {
|
|
96
|
+
data,
|
|
97
|
+
expiresAt: Date.now() + ttlMs,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function getCachedPluginDetail(pluginName) {
|
|
102
|
+
return getCachedTimedValue(pluginDetailCache, pluginName);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function setCachedPluginDetail(pluginName, data) {
|
|
106
|
+
setCachedTimedValue(pluginDetailCache, pluginName, data, PLUGIN_DETAIL_TTL_MS);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function getCachedPluginChangelog(pluginName) {
|
|
110
|
+
return getCachedTimedValue(pluginChangelogCache, pluginName);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function setCachedPluginChangelog(pluginName, data) {
|
|
114
|
+
setCachedTimedValue(pluginChangelogCache, pluginName, data, PLUGIN_CHANGELOG_TTL_MS);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function parseGithubRepoInfo(repoUrl) {
|
|
118
|
+
if (typeof repoUrl !== 'string') {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
const parsedUrl = new URL(repoUrl);
|
|
124
|
+
const hostname = parsedUrl.hostname.toLowerCase();
|
|
125
|
+
if (!['github.com', 'www.github.com'].includes(hostname)) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const pathParts = parsedUrl.pathname.split('/').filter(Boolean);
|
|
130
|
+
if (pathParts.length < 2) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
owner: pathParts[0],
|
|
136
|
+
repo: pathParts[1].replace(/\.git$/i, '')
|
|
137
|
+
};
|
|
138
|
+
} catch {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async function fetchGithubReadme(owner, repo) {
|
|
144
|
+
const response = await fetchWithTimeout(
|
|
145
|
+
`https://api.github.com/repos/${owner}/${repo}/readme`,
|
|
146
|
+
{ headers: getGithubHeaders({ 'Accept': 'application/vnd.github.raw+json' }) }
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
if (!response.ok) {
|
|
150
|
+
if (response.status === 403) {
|
|
151
|
+
const remaining = response.headers.get('x-ratelimit-remaining');
|
|
152
|
+
if (remaining === '0') {
|
|
153
|
+
console.warn(`[GitHub README] Rate limit reached while loading README for ${owner}/${repo}.`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return response.text();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function renderGithubMarkdown(markdown, owner, repo) {
|
|
163
|
+
if (!markdown) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const response = await fetchWithTimeout('https://api.github.com/markdown', {
|
|
168
|
+
method: 'POST',
|
|
169
|
+
headers: getGithubHeaders({
|
|
170
|
+
'Accept': 'text/html',
|
|
171
|
+
'Content-Type': 'application/json'
|
|
172
|
+
}),
|
|
173
|
+
body: JSON.stringify({
|
|
174
|
+
text: markdown,
|
|
175
|
+
mode: 'gfm',
|
|
176
|
+
context: `${owner}/${repo}`
|
|
177
|
+
})
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
if (!response.ok) {
|
|
181
|
+
if (response.status === 403) {
|
|
182
|
+
const remaining = response.headers.get('x-ratelimit-remaining');
|
|
183
|
+
if (remaining === '0') {
|
|
184
|
+
console.warn(`[GitHub Markdown] Rate limit reached while rendering ${owner}/${repo}.`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return response.text();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
async function fetchLatestGithubReleaseBody(repoUrl) {
|
|
194
|
+
const repoInfo = parseGithubRepoInfo(repoUrl);
|
|
195
|
+
if (!repoInfo) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const response = await fetchWithTimeout(
|
|
200
|
+
`https://api.github.com/repos/${repoInfo.owner}/${repoInfo.repo}/releases/latest`,
|
|
201
|
+
{ headers: getGithubHeaders() }
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
if (!response.ok) {
|
|
205
|
+
if (response.status === 403) {
|
|
206
|
+
const remaining = response.headers.get('x-ratelimit-remaining');
|
|
207
|
+
if (remaining === '0') {
|
|
208
|
+
console.warn(`[GitHub Releases] Rate limit reached while loading changelog for ${repoInfo.owner}/${repoInfo.repo}.`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const release = await response.json();
|
|
215
|
+
return typeof release?.body === 'string' ? release.body : null;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
router.get('/catalog', async (req, res) => {
|
|
220
|
+
try {
|
|
221
|
+
res.json(await fetchOfficialCatalog());
|
|
24
222
|
} catch (error) {
|
|
25
223
|
console.error(`[API Error] Could not fetch catalog URL. Reason: ${error.message}`);
|
|
224
|
+
if (error.name === 'AbortError' || error.message.includes('aborted') || error.message.includes('timed out')) {
|
|
225
|
+
return res.json([]);
|
|
226
|
+
}
|
|
26
227
|
res.status(500).json({ error: 'Не удалось загрузить каталог плагинов.' });
|
|
27
228
|
}
|
|
28
229
|
});
|
|
@@ -31,9 +232,7 @@ router.post('/check-updates/:botId', authenticateUniversal, authorize('plugin:up
|
|
|
31
232
|
try {
|
|
32
233
|
const botId = parseInt(req.params.botId);
|
|
33
234
|
|
|
34
|
-
const
|
|
35
|
-
if (!catalogResponse.ok) throw new Error('Не удалось загрузить каталог для проверки обновлений.');
|
|
36
|
-
const catalog = await catalogResponse.json();
|
|
235
|
+
const catalog = await fetchOfficialCatalog();
|
|
37
236
|
|
|
38
237
|
const updates = await pluginManager.checkForUpdates(botId, catalog);
|
|
39
238
|
res.json(updates);
|
|
@@ -47,7 +246,7 @@ router.post('/update/:pluginId', authenticateUniversal, authorize('plugin:update
|
|
|
47
246
|
try {
|
|
48
247
|
const pluginId = parseInt(req.params.pluginId);
|
|
49
248
|
const { targetTag } = req.body; // Получаем тег из тела запроса (если указан)
|
|
50
|
-
const updatedPlugin = await pluginManager.updatePlugin(pluginId, targetTag);
|
|
249
|
+
const updatedPlugin = await pluginManager.updatePlugin(pluginId, targetTag, req.body?.targetRepoUrl);
|
|
51
250
|
res.json(updatedPlugin);
|
|
52
251
|
} catch (error) {
|
|
53
252
|
res.status(500).json({ error: error.message });
|
|
@@ -92,6 +291,8 @@ router.get('/:id/info', authenticateUniversal, authorize('plugin:list'), async (
|
|
|
92
291
|
description: true,
|
|
93
292
|
sourceType: true,
|
|
94
293
|
sourceUri: true,
|
|
294
|
+
sourceRefType: true,
|
|
295
|
+
sourceRef: true,
|
|
95
296
|
isEnabled: true,
|
|
96
297
|
manifest: true,
|
|
97
298
|
settings: true,
|
|
@@ -142,6 +343,8 @@ router.get('/bot/:botId', authenticateUniversal, authorize('plugin:list'), async
|
|
|
142
343
|
description: true,
|
|
143
344
|
sourceType: true,
|
|
144
345
|
sourceUri: true,
|
|
346
|
+
sourceRefType: true,
|
|
347
|
+
sourceRef: true,
|
|
145
348
|
isEnabled: true,
|
|
146
349
|
manifest: true,
|
|
147
350
|
settings: true,
|
|
@@ -176,14 +379,42 @@ router.get('/bot/:botId', authenticateUniversal, authorize('plugin:list'), async
|
|
|
176
379
|
}
|
|
177
380
|
});
|
|
178
381
|
|
|
382
|
+
router.get('/catalog/:name/changelog', async (req, res) => {
|
|
383
|
+
try {
|
|
384
|
+
const pluginName = req.params.name;
|
|
385
|
+
const cachedChangelog = getCachedPluginChangelog(pluginName);
|
|
386
|
+
|
|
387
|
+
if (cachedChangelog !== null) {
|
|
388
|
+
return res.json({ body: cachedChangelog });
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
const catalog = await fetchOfficialCatalog();
|
|
392
|
+
const pluginInfo = catalog.find((plugin) => plugin.name === pluginName);
|
|
393
|
+
|
|
394
|
+
if (!pluginInfo) {
|
|
395
|
+
return res.status(404).json({ error: 'Plugin not found in catalog.' });
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const changelogBody = (await fetchLatestGithubReleaseBody(pluginInfo.repoUrl)) || '';
|
|
399
|
+
setCachedPluginChangelog(pluginName, changelogBody);
|
|
400
|
+
|
|
401
|
+
return res.json({ body: changelogBody });
|
|
402
|
+
} catch (error) {
|
|
403
|
+
console.error(`[API Error] /catalog/:name/changelog:`, error);
|
|
404
|
+
return res.status(500).json({ error: 'Failed to load plugin changelog.' });
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
|
|
179
408
|
router.get('/catalog/:name', async (req, res) => {
|
|
180
409
|
try {
|
|
181
410
|
const pluginName = req.params.name;
|
|
411
|
+
const cachedDetail = getCachedPluginDetail(pluginName);
|
|
182
412
|
|
|
183
|
-
|
|
184
|
-
|
|
413
|
+
if (cachedDetail) {
|
|
414
|
+
return res.json(cachedDetail);
|
|
415
|
+
}
|
|
185
416
|
|
|
186
|
-
const catalog = await
|
|
417
|
+
const catalog = await fetchOfficialCatalog();
|
|
187
418
|
const pluginInfo = catalog.find(p => p.name === pluginName);
|
|
188
419
|
|
|
189
420
|
if (!pluginInfo) {
|
|
@@ -191,6 +422,7 @@ router.get('/catalog/:name', async (req, res) => {
|
|
|
191
422
|
}
|
|
192
423
|
|
|
193
424
|
let readmeContent = pluginInfo.description || 'Описание для этого плагина не предоставлено.';
|
|
425
|
+
let readmeHtml = null;
|
|
194
426
|
|
|
195
427
|
try {
|
|
196
428
|
const urlParts = new URL(pluginInfo.repoUrl);
|
|
@@ -200,19 +432,10 @@ router.get('/catalog/:name', async (req, res) => {
|
|
|
200
432
|
const owner = pathParts[0];
|
|
201
433
|
const repo = pathParts[1].replace('.git', '');
|
|
202
434
|
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
`https://raw.githubusercontent.com/${owner}/${repo}/master/readme.md`,
|
|
208
|
-
];
|
|
209
|
-
|
|
210
|
-
for (const url of readmeUrls) {
|
|
211
|
-
const readmeResponse = await fetch(getCacheBustedUrl(url));
|
|
212
|
-
if (readmeResponse.ok) {
|
|
213
|
-
readmeContent = await readmeResponse.text();
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
435
|
+
const fetchedReadme = await fetchGithubReadme(owner, repo);
|
|
436
|
+
if (fetchedReadme) {
|
|
437
|
+
readmeContent = fetchedReadme;
|
|
438
|
+
readmeHtml = await renderGithubMarkdown(fetchedReadme, owner, repo);
|
|
216
439
|
}
|
|
217
440
|
}
|
|
218
441
|
} catch (readmeError) {
|
|
@@ -221,9 +444,11 @@ router.get('/catalog/:name', async (req, res) => {
|
|
|
221
444
|
|
|
222
445
|
const finalPluginData = {
|
|
223
446
|
...pluginInfo,
|
|
224
|
-
fullDescription: readmeContent
|
|
447
|
+
fullDescription: readmeContent,
|
|
448
|
+
readmeHtml
|
|
225
449
|
};
|
|
226
450
|
|
|
451
|
+
setCachedPluginDetail(pluginName, finalPluginData);
|
|
227
452
|
res.json(finalPluginData);
|
|
228
453
|
} catch (error) {
|
|
229
454
|
console.error(`[API Error] /catalog/:name :`, error);
|
|
@@ -374,4 +599,4 @@ router.delete('/bot/:botId/:pluginName/store/:key', authenticateUniversal, autho
|
|
|
374
599
|
}
|
|
375
600
|
});
|
|
376
601
|
|
|
377
|
-
module.exports = router;
|
|
602
|
+
module.exports = router;
|
|
@@ -39,8 +39,14 @@ router.post('/', authorize('server:create'), async (req, res) => {
|
|
|
39
39
|
if (!name || !host || !version) {
|
|
40
40
|
return res.status(400).json({ error: 'Имя, хост и версия сервера обязательны' });
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
const portNumber = port ? parseInt(port, 10) : 25565;
|
|
44
|
+
if (isNaN(portNumber) || portNumber < 1 || portNumber > 65535) {
|
|
45
|
+
return res.status(400).json({ error: 'Порт должен быть числом от 1 до 65535 (максимум 5 цифр)' });
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
const newServer = await prisma.server.create({
|
|
43
|
-
data: { name, host, port:
|
|
49
|
+
data: { name, host, port: portNumber, version },
|
|
44
50
|
});
|
|
45
51
|
res.status(201).json(newServer);
|
|
46
52
|
} catch (error) {
|
|
@@ -58,7 +64,13 @@ router.put('/:id', authorize('server:create'), async (req, res) => {
|
|
|
58
64
|
const dataToUpdate = {};
|
|
59
65
|
if (name !== undefined) dataToUpdate.name = name;
|
|
60
66
|
if (host !== undefined) dataToUpdate.host = host;
|
|
61
|
-
if (port !== undefined && port !== '')
|
|
67
|
+
if (port !== undefined && port !== '') {
|
|
68
|
+
const portNumber = parseInt(port, 10);
|
|
69
|
+
if (isNaN(portNumber) || portNumber < 1 || portNumber > 65535) {
|
|
70
|
+
return res.status(400).json({ error: 'Порт должен быть числом от 1 до 65535 (максимум 5 цифр)' });
|
|
71
|
+
}
|
|
72
|
+
dataToUpdate.port = portNumber;
|
|
73
|
+
}
|
|
62
74
|
if (version !== undefined) dataToUpdate.version = version;
|
|
63
75
|
|
|
64
76
|
Object.keys(dataToUpdate).forEach(k => { if (dataToUpdate[k] === undefined) delete dataToUpdate[k]; });
|
package/backend/src/container.js
CHANGED
|
@@ -19,10 +19,13 @@ const ResourceMonitorService = require('./core/services/ResourceMonitorService')
|
|
|
19
19
|
const TelemetryService = require('./core/services/TelemetryService');
|
|
20
20
|
const BotLifecycleService = require('./core/services/BotLifecycleService');
|
|
21
21
|
const CommandExecutionService = require('./core/services/CommandExecutionService');
|
|
22
|
+
const PluginManagementService = require('./core/services/PluginManagementService');
|
|
23
|
+
const EventGraphService = require('./core/services/EventGraphService');
|
|
22
24
|
|
|
23
25
|
// Core
|
|
24
26
|
const EventGraphManager = require('./core/EventGraphManager');
|
|
25
27
|
const PluginManager = require('./core/PluginManager');
|
|
28
|
+
const BotManager = require('./core/BotManager');
|
|
26
29
|
|
|
27
30
|
function createLogger() {
|
|
28
31
|
return {
|
|
@@ -36,14 +39,12 @@ function createLogger() {
|
|
|
36
39
|
function configureContainer() {
|
|
37
40
|
const container = createContainer();
|
|
38
41
|
|
|
39
|
-
// Infrastructure
|
|
40
42
|
container.register({
|
|
41
43
|
prisma: asValue(prisma),
|
|
42
44
|
config: asValue(config),
|
|
43
45
|
logger: asFunction(createLogger).singleton(),
|
|
44
46
|
});
|
|
45
47
|
|
|
46
|
-
// Repositories
|
|
47
48
|
container.register({
|
|
48
49
|
botRepository: asClass(BotRepository).singleton(),
|
|
49
50
|
commandRepository: asClass(CommandRepository).singleton(),
|
|
@@ -55,7 +56,6 @@ function configureContainer() {
|
|
|
55
56
|
groupRepository: asClass(GroupRepository).singleton(),
|
|
56
57
|
});
|
|
57
58
|
|
|
58
|
-
// Core Services
|
|
59
59
|
container.register({
|
|
60
60
|
cacheManager: asClass(CacheManager).singleton(),
|
|
61
61
|
botProcessManager: asClass(BotProcessManager).singleton(),
|
|
@@ -63,17 +63,20 @@ function configureContainer() {
|
|
|
63
63
|
telemetryService: asClass(TelemetryService).singleton(),
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
container.register({
|
|
67
|
+
botLifecycleService: asClass(BotLifecycleService).singleton(),
|
|
68
|
+
commandExecutionService: asClass(CommandExecutionService).singleton(),
|
|
69
|
+
pluginManagementService: asClass(PluginManagementService).singleton(),
|
|
70
|
+
eventGraphService: asClass(EventGraphService).singleton(),
|
|
71
|
+
});
|
|
72
|
+
|
|
67
73
|
container.register({
|
|
68
74
|
pluginManager: asClass(PluginManager).singleton(),
|
|
69
|
-
// EventGraphManager создаётся без зависимости - botManager передаётся через setter
|
|
70
75
|
eventGraphManager: asClass(EventGraphManager).singleton(),
|
|
71
76
|
});
|
|
72
77
|
|
|
73
|
-
// High-level Services (зависят от managers)
|
|
74
78
|
container.register({
|
|
75
|
-
|
|
76
|
-
commandExecutionService: asClass(CommandExecutionService).singleton(),
|
|
79
|
+
botManager: asClass(BotManager).singleton(),
|
|
77
80
|
});
|
|
78
81
|
|
|
79
82
|
return container;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
const Command = require('./system/Command');
|
|
2
|
+
const { loadCommands } = require('./system/CommandRegistry');
|
|
3
|
+
const { MessageTypes } = require('./ipc/ipcMessageTypes');
|
|
4
|
+
|
|
5
|
+
async function loadBotCommands(bot, config, prisma) {
|
|
6
|
+
bot.commands = await loadCommands();
|
|
7
|
+
|
|
8
|
+
const dbCommands = await prisma.command.findMany({ where: { botId: config.id } });
|
|
9
|
+
|
|
10
|
+
for (const dbCommand of dbCommands) {
|
|
11
|
+
const existingCommand = bot.commands.get(dbCommand.name);
|
|
12
|
+
|
|
13
|
+
if (existingCommand) {
|
|
14
|
+
existingCommand.isEnabled = dbCommand.isEnabled;
|
|
15
|
+
existingCommand.description = dbCommand.description;
|
|
16
|
+
existingCommand.cooldown = dbCommand.cooldown;
|
|
17
|
+
existingCommand.aliases = JSON.parse(dbCommand.aliases || '[]');
|
|
18
|
+
existingCommand.permissionId = dbCommand.permissionId;
|
|
19
|
+
existingCommand.allowedChatTypes = JSON.parse(dbCommand.allowedChatTypes || '[]');
|
|
20
|
+
|
|
21
|
+
const aliases = JSON.parse(dbCommand.aliases || '[]');
|
|
22
|
+
for (const alias of aliases) {
|
|
23
|
+
bot.commands.set(alias, existingCommand);
|
|
24
|
+
}
|
|
25
|
+
} else if (dbCommand.isVisual) {
|
|
26
|
+
const visualCommand = createVisualCommand(bot, dbCommand);
|
|
27
|
+
bot.commands.set(visualCommand.name, visualCommand);
|
|
28
|
+
|
|
29
|
+
const visualAliases = JSON.parse(dbCommand.aliases || '[]');
|
|
30
|
+
for (const alias of visualAliases) {
|
|
31
|
+
bot.commands.set(alias, visualCommand);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
for (const cmd of bot.commands.values()) {
|
|
37
|
+
if (cmd.aliases && Array.isArray(cmd.aliases)) {
|
|
38
|
+
for (const alias of cmd.aliases) {
|
|
39
|
+
if (!bot.commands.has(alias)) {
|
|
40
|
+
bot.commands.set(alias, cmd);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (process.send) {
|
|
47
|
+
for (const cmd of bot.commands.values()) {
|
|
48
|
+
process.send({
|
|
49
|
+
type: MessageTypes.COMMAND.REGISTER,
|
|
50
|
+
commandConfig: {
|
|
51
|
+
name: cmd.name,
|
|
52
|
+
description: cmd.description,
|
|
53
|
+
aliases: cmd.aliases,
|
|
54
|
+
owner: cmd.owner,
|
|
55
|
+
permissions: cmd.permissions,
|
|
56
|
+
cooldown: cmd.cooldown,
|
|
57
|
+
allowedChatTypes: cmd.allowedChatTypes,
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return bot.commands;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function createVisualCommand(bot, dbCommand) {
|
|
67
|
+
const visualCommand = new Command({
|
|
68
|
+
name: dbCommand.name,
|
|
69
|
+
description: dbCommand.description,
|
|
70
|
+
aliases: JSON.parse(dbCommand.aliases || '[]'),
|
|
71
|
+
cooldown: dbCommand.cooldown,
|
|
72
|
+
allowedChatTypes: JSON.parse(dbCommand.allowedChatTypes || '[]'),
|
|
73
|
+
args: JSON.parse(dbCommand.argumentsJson || '[]'),
|
|
74
|
+
owner: 'visual_editor',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
visualCommand.permissionId = dbCommand.permissionId;
|
|
78
|
+
visualCommand.graphJson = dbCommand.graphJson;
|
|
79
|
+
visualCommand.owner = 'visual_editor';
|
|
80
|
+
|
|
81
|
+
visualCommand.handler = (botInstance, typeChat, user, args) => {
|
|
82
|
+
const playerList = botInstance ? Object.keys(botInstance.players) : [];
|
|
83
|
+
const botState = botInstance ? { yaw: botInstance.entity.yaw, pitch: botInstance.entity.pitch } : {};
|
|
84
|
+
const botEntity = botInstance && botInstance.entity ? {
|
|
85
|
+
position: botInstance.entity.position,
|
|
86
|
+
yaw: botInstance.entity.yaw,
|
|
87
|
+
pitch: botInstance.entity.pitch
|
|
88
|
+
} : null;
|
|
89
|
+
|
|
90
|
+
const context = {
|
|
91
|
+
bot: botInstance,
|
|
92
|
+
botApi: botInstance.api,
|
|
93
|
+
user,
|
|
94
|
+
args,
|
|
95
|
+
typeChat,
|
|
96
|
+
players: playerList,
|
|
97
|
+
botState,
|
|
98
|
+
botEntity,
|
|
99
|
+
botId: botInstance.config.id,
|
|
100
|
+
graphId: dbCommand.id,
|
|
101
|
+
eventType: 'command',
|
|
102
|
+
eventArgs: {
|
|
103
|
+
commandName: dbCommand.name,
|
|
104
|
+
user: { username: user?.username },
|
|
105
|
+
args,
|
|
106
|
+
typeChat
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return botInstance.graphExecutionEngine.execute(visualCommand.graphJson, context);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return visualCommand;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function registerTemporaryCommand(bot, commandData) {
|
|
117
|
+
const tempCommand = new Command({
|
|
118
|
+
name: commandData.name,
|
|
119
|
+
description: commandData.description || '',
|
|
120
|
+
aliases: commandData.aliases || [],
|
|
121
|
+
cooldown: commandData.cooldown || 0,
|
|
122
|
+
allowedChatTypes: commandData.allowedChatTypes || ['chat', 'private'],
|
|
123
|
+
args: [],
|
|
124
|
+
owner: 'runtime',
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
tempCommand.permissionId = commandData.permissionId || null;
|
|
128
|
+
tempCommand.isTemporary = true;
|
|
129
|
+
tempCommand.tempId = commandData.tempId;
|
|
130
|
+
tempCommand.isVisual = false;
|
|
131
|
+
tempCommand.handler = () => {};
|
|
132
|
+
|
|
133
|
+
bot.commands.set(commandData.name, tempCommand);
|
|
134
|
+
|
|
135
|
+
if (Array.isArray(commandData.aliases)) {
|
|
136
|
+
for (const alias of commandData.aliases) {
|
|
137
|
+
bot.commands.set(alias, tempCommand);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function unregisterTemporaryCommand(bot, commandName, aliases) {
|
|
143
|
+
if (bot.commands.has(commandName)) {
|
|
144
|
+
bot.commands.delete(commandName);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (Array.isArray(aliases)) {
|
|
148
|
+
for (const alias of aliases) {
|
|
149
|
+
if (bot.commands.has(alias)) {
|
|
150
|
+
bot.commands.delete(alias);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
module.exports = {
|
|
157
|
+
loadBotCommands,
|
|
158
|
+
createVisualCommand,
|
|
159
|
+
registerTemporaryCommand,
|
|
160
|
+
unregisterTemporaryCommand
|
|
161
|
+
};
|