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.
Files changed (476) hide show
  1. package/CHANGELOG.md +76 -1
  2. package/README.en.md +427 -0
  3. package/README.md +40 -0
  4. package/backend/package.json +2 -2
  5. package/backend/prisma/migrations/20260328173000_add_plugin_source_ref/migration.sql +2 -0
  6. package/backend/prisma/migrations/migration_lock.toml +2 -2
  7. package/backend/prisma/schema.prisma +2 -0
  8. package/backend/src/ai/plugin-assistant-system-prompt.md +664 -5
  9. package/backend/src/api/routes/apiKeys.js +8 -0
  10. package/backend/src/api/routes/bots.js +271 -9
  11. package/backend/src/api/routes/eventGraphs.js +151 -1
  12. package/backend/src/api/routes/health.js +38 -0
  13. package/backend/src/api/routes/nodeRegistry.js +63 -0
  14. package/backend/src/api/routes/plugins.js +254 -29
  15. package/backend/src/api/routes/servers.js +14 -2
  16. package/backend/src/container.js +11 -8
  17. package/backend/src/core/BotCommandLoader.js +161 -0
  18. package/backend/src/core/BotConnection.js +125 -0
  19. package/backend/src/core/BotEventHandlers.js +234 -0
  20. package/backend/src/core/BotIPCHandler.js +445 -0
  21. package/backend/src/core/BotManager.js +15 -7
  22. package/backend/src/core/BotProcess.js +169 -140
  23. package/backend/src/core/EventGraphManager.js +7 -3
  24. package/backend/src/core/GraphDebugHandler.js +229 -0
  25. package/backend/src/core/GraphDebugIPC.js +117 -0
  26. package/backend/src/core/GraphExecutionEngine.js +545 -978
  27. package/backend/src/core/GraphTraversal.js +80 -0
  28. package/backend/src/core/GraphValidation.js +73 -0
  29. package/backend/src/core/NodeDefinition.js +138 -0
  30. package/backend/src/core/NodeRegistry.js +153 -141
  31. package/backend/src/core/PluginLoader.js +83 -3
  32. package/backend/src/core/PluginManager.js +346 -35
  33. package/backend/src/core/RewindSignal.js +9 -0
  34. package/backend/src/core/config/ConfigValidator.js +72 -0
  35. package/backend/src/core/config/FeatureFlags.js +52 -0
  36. package/backend/src/core/config/__tests__/ConfigValidator.test.js +232 -0
  37. package/backend/src/core/domain/entities/Bot.js +39 -0
  38. package/backend/src/core/domain/entities/Command.js +41 -0
  39. package/backend/src/core/domain/entities/EventGraph.js +39 -0
  40. package/backend/src/core/domain/entities/Plugin.js +45 -0
  41. package/backend/src/core/domain/entities/User.js +40 -0
  42. package/backend/src/core/domain/services/DependencyResolver.js +168 -0
  43. package/backend/src/core/domain/services/GraphValidator.js +117 -0
  44. package/backend/src/core/domain/services/PermissionChecker.js +34 -0
  45. package/backend/src/core/domain/services/__tests__/DependencyResolver.test.js +126 -0
  46. package/backend/src/core/domain/valueObjects/BotConfig.js +27 -0
  47. package/backend/src/core/domain/valueObjects/DependencyGraph.js +86 -0
  48. package/backend/src/core/domain/valueObjects/PluginManifest.js +36 -0
  49. package/backend/src/core/errors/BaseError.js +29 -0
  50. package/backend/src/core/errors/ErrorHandler.js +81 -0
  51. package/backend/src/core/errors/__tests__/ErrorHandler.test.js +188 -0
  52. package/backend/src/core/errors/index.js +68 -0
  53. package/backend/src/core/infrastructure/BatchingUtility.js +66 -0
  54. package/backend/src/core/infrastructure/CircuitBreaker.js +103 -0
  55. package/backend/src/core/infrastructure/ConnectionPool.js +81 -0
  56. package/backend/src/core/infrastructure/RateLimiter.js +64 -0
  57. package/backend/src/core/infrastructure/__tests__/BatchingUtility.test.js +86 -0
  58. package/backend/src/core/infrastructure/__tests__/CircuitBreaker.test.js +156 -0
  59. package/backend/src/core/infrastructure/__tests__/ConnectionPool.test.js +146 -0
  60. package/backend/src/core/infrastructure/__tests__/RateLimiter.test.js +171 -0
  61. package/backend/src/core/ipc/botApiFactory.js +72 -0
  62. package/backend/src/core/ipc/ipcMessageTypes.js +115 -0
  63. package/backend/src/core/logging/AuditLogger.js +61 -0
  64. package/backend/src/core/logging/StructuredLogger.js +80 -0
  65. package/backend/src/core/logging/__tests__/StructuredLogger.test.js +213 -0
  66. package/backend/src/core/logging/index.js +7 -0
  67. package/backend/src/core/metrics/MetricsCollector.js +104 -0
  68. package/backend/src/core/metrics/__tests__/MetricsCollector.test.js +131 -0
  69. package/backend/src/core/node-registries/actionsNodes.js +191 -0
  70. package/backend/src/core/node-registries/arraysNodes.js +152 -0
  71. package/backend/src/core/node-registries/botNodes.js +48 -0
  72. package/backend/src/core/node-registries/containerNodes.js +141 -0
  73. package/backend/src/core/node-registries/dataNodes.js +284 -0
  74. package/backend/src/core/node-registries/debugNodes.js +23 -0
  75. package/backend/src/core/node-registries/eventsNodes.js +223 -0
  76. package/backend/src/core/node-registries/flowNodes.js +151 -0
  77. package/backend/src/core/node-registries/furnaceNodes.js +123 -0
  78. package/backend/src/core/node-registries/index.js +108 -0
  79. package/backend/src/core/node-registries/inventory.js +102 -106
  80. package/backend/src/core/node-registries/logicNodes.js +54 -0
  81. package/backend/src/core/node-registries/mathNodes.js +38 -0
  82. package/backend/src/core/node-registries/navigationNodes.js +109 -0
  83. package/backend/src/core/node-registries/objectsNodes.js +90 -0
  84. package/backend/src/core/node-registries/stringsNodes.js +165 -0
  85. package/backend/src/core/node-registries/timeNodes.js +105 -0
  86. package/backend/src/core/node-registries/typeNodes.js +22 -0
  87. package/backend/src/core/node-registries/usersNodes.js +126 -0
  88. package/backend/src/core/nodes/arrays/shuffle.js +14 -0
  89. package/backend/src/core/nodes/bot/get_name.js +8 -0
  90. package/backend/src/core/nodes/bot/stop_bot.js +5 -0
  91. package/backend/src/core/nodes/container/open.js +101 -111
  92. package/backend/src/core/nodes/data/store_read.js +26 -0
  93. package/backend/src/core/nodes/data/store_write.js +23 -0
  94. package/backend/src/core/nodes/event/call_event.js +31 -0
  95. package/backend/src/core/nodes/event/custom_event.js +8 -0
  96. package/backend/src/core/nodes/flow/timer.js +35 -0
  97. package/backend/src/core/nodes/inventory/drop.js +73 -65
  98. package/backend/src/core/nodes/inventory/equip.js +54 -45
  99. package/backend/src/core/nodes/inventory/select_slot.js +48 -46
  100. package/backend/src/core/nodes/navigation/follow.js +54 -51
  101. package/backend/src/core/nodes/navigation/go_to.js +41 -53
  102. package/backend/src/core/nodes/navigation/go_to_entity.js +65 -69
  103. package/backend/src/core/nodes/navigation/go_to_player.js +65 -70
  104. package/backend/src/core/nodes/navigation/stop.js +17 -26
  105. package/backend/src/core/nodes/users/add_to_group.js +24 -0
  106. package/backend/src/core/nodes/users/check_permission.js +26 -0
  107. package/backend/src/core/nodes/users/remove_from_group.js +24 -0
  108. package/backend/src/core/services/BotIPCMessageRouter.js +337 -0
  109. package/backend/src/core/services/BotLifecycleService.js +43 -450
  110. package/backend/src/core/services/CacheManager.js +83 -23
  111. package/backend/src/core/services/CrashRestartManager.js +42 -0
  112. package/backend/src/core/services/DebugSessionManager.js +114 -12
  113. package/backend/src/core/services/EventGraphService.js +69 -0
  114. package/backend/src/core/services/MinecraftBotManager.js +9 -1
  115. package/backend/src/core/services/PluginManagementService.js +84 -0
  116. package/backend/src/core/services/TestModeContext.js +65 -0
  117. package/backend/src/core/services/__tests__/CacheManager.test.js +168 -0
  118. package/backend/src/core/services.js +1 -11
  119. package/backend/src/core/validation/InputValidator.js +167 -0
  120. package/backend/src/core/validation/__tests__/InputValidator.test.js +296 -0
  121. package/backend/src/real-time/botApi/index.js +1 -1
  122. package/backend/src/real-time/socketHandler.js +26 -0
  123. package/backend/src/server.js +21 -6
  124. package/frontend/dist/assets/browser-ponyfill-D8y0Ty7C.js +2 -0
  125. package/frontend/dist/assets/index-CFJLS0dk.css +32 -0
  126. package/frontend/dist/assets/index-D91UGNMG.js +11260 -0
  127. package/frontend/dist/flags/en.svg +32 -0
  128. package/frontend/dist/flags/ru.svg +5 -0
  129. package/frontend/dist/index.html +2 -2
  130. package/frontend/dist/locales/en/admin.json +100 -0
  131. package/frontend/dist/locales/en/api-keys.json +58 -0
  132. package/frontend/dist/locales/en/bots.json +113 -0
  133. package/frontend/dist/locales/en/common.json +53 -0
  134. package/frontend/dist/locales/en/configuration.json +22 -0
  135. package/frontend/dist/locales/en/console.json +10 -0
  136. package/frontend/dist/locales/en/dashboard.json +85 -0
  137. package/frontend/dist/locales/en/dialogs.json +70 -0
  138. package/frontend/dist/locales/en/event-graphs.json +50 -0
  139. package/frontend/dist/locales/en/graph-store.json +70 -0
  140. package/frontend/dist/locales/en/login.json +36 -0
  141. package/frontend/dist/locales/en/management.json +192 -0
  142. package/frontend/dist/locales/en/minecraft-viewer.json +27 -0
  143. package/frontend/dist/locales/en/nodes.json +1132 -0
  144. package/frontend/dist/locales/en/permissions.json +50 -0
  145. package/frontend/dist/locales/en/plugin-detail.json +69 -0
  146. package/frontend/dist/locales/en/plugins.json +329 -0
  147. package/frontend/dist/locales/en/proxies.json +81 -0
  148. package/frontend/dist/locales/en/servers.json +39 -0
  149. package/frontend/dist/locales/en/setup.json +19 -0
  150. package/frontend/dist/locales/en/sidebar.json +195 -0
  151. package/frontend/dist/locales/en/tasks.json +62 -0
  152. package/frontend/dist/locales/en/visual-editor.json +418 -0
  153. package/frontend/dist/locales/en/websocket.json +86 -0
  154. package/frontend/dist/locales/ru/admin.json +100 -0
  155. package/frontend/dist/locales/ru/api-keys.json +58 -0
  156. package/frontend/dist/locales/ru/bots.json +113 -0
  157. package/frontend/dist/locales/ru/common.json +49 -0
  158. package/frontend/dist/locales/ru/configuration.json +22 -0
  159. package/frontend/dist/locales/ru/console.json +10 -0
  160. package/frontend/dist/locales/ru/dashboard.json +85 -0
  161. package/frontend/dist/locales/ru/dialogs.json +70 -0
  162. package/frontend/dist/locales/ru/event-graphs.json +50 -0
  163. package/frontend/dist/locales/ru/graph-store.json +70 -0
  164. package/frontend/dist/locales/ru/login.json +36 -0
  165. package/frontend/dist/locales/ru/management.json +192 -0
  166. package/frontend/dist/locales/ru/minecraft-viewer.json +30 -0
  167. package/frontend/dist/locales/ru/nodes.json +1131 -0
  168. package/frontend/dist/locales/ru/permissions.json +50 -0
  169. package/frontend/dist/locales/ru/plugin-detail.json +49 -0
  170. package/frontend/dist/locales/ru/plugins.json +209 -0
  171. package/frontend/dist/locales/ru/proxies.json +81 -0
  172. package/frontend/dist/locales/ru/servers.json +39 -0
  173. package/frontend/dist/locales/ru/setup.json +19 -0
  174. package/frontend/dist/locales/ru/sidebar.json +195 -0
  175. package/frontend/dist/locales/ru/tasks.json +62 -0
  176. package/frontend/dist/locales/ru/visual-editor.json +420 -0
  177. package/frontend/dist/locales/ru/websocket.json +86 -0
  178. package/frontend/dist/monacoeditorwork/css.worker.bundle.js +7 -7
  179. package/frontend/dist/monacoeditorwork/html.worker.bundle.js +7 -7
  180. package/frontend/dist/monacoeditorwork/json.worker.bundle.js +7 -7
  181. package/frontend/dist/monacoeditorwork/ts.worker.bundle.js +3 -3
  182. package/frontend/package.json +6 -0
  183. package/nul +12 -0
  184. package/package.json +3 -3
  185. package/screen/3dviewer.png +0 -0
  186. package/screen/console.png +0 -0
  187. package/screen/dashboard.png +0 -0
  188. package/screen/graph_collabe.png +0 -0
  189. package/screen/graph_live_debug.png +0 -0
  190. package/screen/language_selector.png +0 -0
  191. package/screen/management_command.png +0 -0
  192. package/screen/node_debug_trace.png +0 -0
  193. package/screen/plugin_/320/276/320/261/320/267/320/276/321/200.png +0 -0
  194. package/screen/websocket.png +0 -0
  195. 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
  196. 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
  197. package/.claude/agents/README.md +0 -469
  198. package/.claude/agents/auth-route-debugger.md +0 -118
  199. package/.claude/agents/auth-route-tester.md +0 -93
  200. package/.claude/agents/auto-error-resolver.md +0 -97
  201. package/.claude/agents/build-optimizer.md +0 -236
  202. package/.claude/agents/code-architect.md +0 -34
  203. package/.claude/agents/code-architecture-reviewer.md +0 -83
  204. package/.claude/agents/code-explorer.md +0 -51
  205. package/.claude/agents/code-refactor-master.md +0 -94
  206. package/.claude/agents/code-reviewer.md +0 -46
  207. package/.claude/agents/cost-optimizer.md +0 -134
  208. package/.claude/agents/deployment-orchestrator.md +0 -113
  209. package/.claude/agents/documentation-architect.md +0 -82
  210. package/.claude/agents/frontend-error-fixer.md +0 -77
  211. package/.claude/agents/iac-code-generator.md +0 -71
  212. package/.claude/agents/incident-responder.md +0 -346
  213. package/.claude/agents/infrastructure-architect.md +0 -31
  214. package/.claude/agents/kubernetes-specialist.md +0 -56
  215. package/.claude/agents/migration-planner.md +0 -181
  216. package/.claude/agents/network-architect.md +0 -196
  217. package/.claude/agents/plan-reviewer.md +0 -52
  218. package/.claude/agents/refactor-planner.md +0 -63
  219. package/.claude/agents/security-scanner.md +0 -102
  220. package/.claude/agents/web-research-specialist.md +0 -78
  221. package/.claude/commands/cost-analysis.md +0 -315
  222. package/.claude/commands/dev-docs-update.md +0 -55
  223. package/.claude/commands/dev-docs.md +0 -51
  224. package/.claude/commands/feature-dev.md +0 -125
  225. package/.claude/commands/incident-debug.md +0 -247
  226. package/.claude/commands/infra-plan.md +0 -81
  227. package/.claude/commands/migration-plan.md +0 -478
  228. package/.claude/commands/route-research-for-testing.md +0 -37
  229. package/.claude/commands/security-review.md +0 -66
  230. package/.claude/hooks/CONFIG.md +0 -448
  231. package/.claude/hooks/README.md +0 -163
  232. package/.claude/hooks/SKILL_ACTIVATION_COMPLETE.md +0 -226
  233. package/.claude/hooks/WINDOWS_HOOKS_README.md +0 -151
  234. package/.claude/hooks/add-skill-activation-banners.ts +0 -132
  235. package/.claude/hooks/comprehensive-skill-test.ts +0 -1315
  236. package/.claude/hooks/error-handling-reminder.sh +0 -12
  237. package/.claude/hooks/error-handling-reminder.ts +0 -222
  238. package/.claude/hooks/k8s-manifest-validator.sh +0 -56
  239. package/.claude/hooks/package-lock.json +0 -556
  240. package/.claude/hooks/package.json +0 -16
  241. package/.claude/hooks/post-tool-use-tracker.ps1 +0 -174
  242. package/.claude/hooks/post-tool-use-tracker.sh +0 -183
  243. package/.claude/hooks/security-policy-check.sh +0 -247
  244. package/.claude/hooks/skill-activation-prompt.ps1 +0 -10
  245. package/.claude/hooks/skill-activation-prompt.sh +0 -10
  246. package/.claude/hooks/skill-activation-prompt.ts +0 -141
  247. package/.claude/hooks/stop-build-check-enhanced.sh +0 -130
  248. package/.claude/hooks/terraform-validator.sh +0 -53
  249. package/.claude/hooks/test-input.json +0 -7
  250. package/.claude/hooks/test-skill-activation.ts +0 -427
  251. package/.claude/hooks/trigger-build-resolver.sh +0 -79
  252. package/.claude/hooks/tsc-check.sh +0 -173
  253. package/.claude/hooks/tsconfig.json +0 -19
  254. package/.claude/settings.json +0 -59
  255. package/.claude/settings.local.json +0 -67
  256. package/.claude/skills/README.md +0 -507
  257. package/.claude/skills/api-engineering/SKILL.md +0 -63
  258. package/.claude/skills/api-engineering/resources/api-versioning.md +0 -88
  259. package/.claude/skills/api-engineering/resources/graphql-patterns.md +0 -106
  260. package/.claude/skills/api-engineering/resources/rate-limiting.md +0 -118
  261. package/.claude/skills/api-engineering/resources/rest-api-design.md +0 -105
  262. package/.claude/skills/backend-dev-guidelines/SKILL.md +0 -306
  263. package/.claude/skills/backend-dev-guidelines/resources/architecture-overview.md +0 -451
  264. package/.claude/skills/backend-dev-guidelines/resources/async-and-errors.md +0 -307
  265. package/.claude/skills/backend-dev-guidelines/resources/complete-examples.md +0 -638
  266. package/.claude/skills/backend-dev-guidelines/resources/configuration.md +0 -275
  267. package/.claude/skills/backend-dev-guidelines/resources/database-patterns.md +0 -224
  268. package/.claude/skills/backend-dev-guidelines/resources/middleware-guide.md +0 -213
  269. package/.claude/skills/backend-dev-guidelines/resources/routing-and-controllers.md +0 -756
  270. package/.claude/skills/backend-dev-guidelines/resources/sentry-and-monitoring.md +0 -336
  271. package/.claude/skills/backend-dev-guidelines/resources/services-and-repositories.md +0 -789
  272. package/.claude/skills/backend-dev-guidelines/resources/testing-guide.md +0 -235
  273. package/.claude/skills/backend-dev-guidelines/resources/validation-patterns.md +0 -754
  274. package/.claude/skills/budget-and-cost-management/SKILL.md +0 -850
  275. package/.claude/skills/build-engineering/SKILL.md +0 -431
  276. package/.claude/skills/build-engineering/resources/artifact-repositories.md +0 -72
  277. package/.claude/skills/build-engineering/resources/build-caching.md +0 -96
  278. package/.claude/skills/build-engineering/resources/build-pipelines.md +0 -105
  279. package/.claude/skills/build-engineering/resources/build-security.md +0 -95
  280. package/.claude/skills/build-engineering/resources/build-systems.md +0 -389
  281. package/.claude/skills/build-engineering/resources/compilation-optimization.md +0 -201
  282. package/.claude/skills/build-engineering/resources/dependency-management.md +0 -73
  283. package/.claude/skills/build-engineering/resources/monorepo-builds.md +0 -110
  284. package/.claude/skills/build-engineering/resources/performance-optimization.md +0 -113
  285. package/.claude/skills/build-engineering/resources/reproducible-builds.md +0 -82
  286. package/.claude/skills/cloud-engineering/SKILL.md +0 -675
  287. package/.claude/skills/cloud-engineering/resources/aws-patterns.md +0 -742
  288. package/.claude/skills/cloud-engineering/resources/azure-patterns.md +0 -714
  289. package/.claude/skills/cloud-engineering/resources/cleared-cloud-environments.md +0 -987
  290. package/.claude/skills/cloud-engineering/resources/cloud-cost-optimization.md +0 -757
  291. package/.claude/skills/cloud-engineering/resources/cloud-networking.md +0 -1058
  292. package/.claude/skills/cloud-engineering/resources/cloud-security-tools.md +0 -1530
  293. package/.claude/skills/cloud-engineering/resources/cloud-security.md +0 -990
  294. package/.claude/skills/cloud-engineering/resources/gcp-patterns.md +0 -758
  295. package/.claude/skills/cloud-engineering/resources/migration-strategies.md +0 -820
  296. package/.claude/skills/cloud-engineering/resources/multi-cloud-strategies.md +0 -670
  297. package/.claude/skills/cloud-engineering/resources/oci-patterns.md +0 -1198
  298. package/.claude/skills/cloud-engineering/resources/serverless-patterns.md +0 -795
  299. package/.claude/skills/cloud-engineering/resources/well-architected-frameworks.md +0 -966
  300. package/.claude/skills/cybersecurity/SKILL.md +0 -409
  301. package/.claude/skills/cybersecurity/resources/security-architecture.md +0 -266
  302. package/.claude/skills/database-engineering/SKILL.md +0 -61
  303. package/.claude/skills/database-engineering/resources/backup-and-recovery.md +0 -72
  304. package/.claude/skills/database-engineering/resources/database-replication.md +0 -63
  305. package/.claude/skills/database-engineering/resources/postgresql-fundamentals.md +0 -70
  306. package/.claude/skills/database-engineering/resources/query-optimization.md +0 -68
  307. package/.claude/skills/devsecops/SKILL.md +0 -374
  308. package/.claude/skills/devsecops/resources/ci-cd-security.md +0 -204
  309. package/.claude/skills/devsecops/resources/compliance-automation.md +0 -530
  310. package/.claude/skills/devsecops/resources/compliance-frameworks.md +0 -2322
  311. package/.claude/skills/devsecops/resources/container-security.md +0 -915
  312. package/.claude/skills/devsecops/resources/cspm-integration.md +0 -1440
  313. package/.claude/skills/devsecops/resources/policy-enforcement.md +0 -619
  314. package/.claude/skills/devsecops/resources/secrets-management.md +0 -755
  315. package/.claude/skills/devsecops/resources/security-monitoring.md +0 -146
  316. package/.claude/skills/devsecops/resources/security-scanning.md +0 -887
  317. package/.claude/skills/devsecops/resources/security-testing.md +0 -203
  318. package/.claude/skills/devsecops/resources/supply-chain-security.md +0 -518
  319. package/.claude/skills/devsecops/resources/vulnerability-management.md +0 -481
  320. package/.claude/skills/devsecops/resources/zero-trust-architecture.md +0 -177
  321. package/.claude/skills/documentation-as-code/SKILL.md +0 -323
  322. package/.claude/skills/documentation-as-code/resources/api-documentation.md +0 -90
  323. package/.claude/skills/documentation-as-code/resources/changelog-management.md +0 -79
  324. package/.claude/skills/documentation-as-code/resources/diagram-generation.md +0 -44
  325. package/.claude/skills/documentation-as-code/resources/docs-as-code-workflow.md +0 -99
  326. package/.claude/skills/documentation-as-code/resources/documentation-automation.md +0 -68
  327. package/.claude/skills/documentation-as-code/resources/documentation-sites.md +0 -79
  328. package/.claude/skills/documentation-as-code/resources/markdown-best-practices.md +0 -162
  329. package/.claude/skills/documentation-as-code/resources/openapi-specification.md +0 -77
  330. package/.claude/skills/documentation-as-code/resources/readme-engineering.md +0 -60
  331. package/.claude/skills/documentation-as-code/resources/technical-writing-guide.md +0 -202
  332. package/.claude/skills/engineering-management/SKILL.md +0 -356
  333. package/.claude/skills/engineering-management/resources/career-ladders.md +0 -609
  334. package/.claude/skills/engineering-management/resources/hiring-and-assessment.md +0 -555
  335. package/.claude/skills/engineering-management/resources/one-on-one-guides.md +0 -609
  336. package/.claude/skills/engineering-management/resources/resource-planning.md +0 -557
  337. package/.claude/skills/engineering-management/resources/team-organization-patterns.md +0 -491
  338. package/.claude/skills/engineering-management/resources/technical-interviews.md +0 -474
  339. package/.claude/skills/engineering-operations-management/SKILL.md +0 -817
  340. package/.claude/skills/error-tracking/SKILL.md +0 -379
  341. package/.claude/skills/frontend-design/SKILL.md +0 -42
  342. package/.claude/skills/frontend-dev-guidelines/SKILL.md +0 -403
  343. package/.claude/skills/frontend-dev-guidelines/resources/common-patterns.md +0 -331
  344. package/.claude/skills/frontend-dev-guidelines/resources/complete-examples.md +0 -872
  345. package/.claude/skills/frontend-dev-guidelines/resources/component-patterns.md +0 -502
  346. package/.claude/skills/frontend-dev-guidelines/resources/data-fetching.md +0 -767
  347. package/.claude/skills/frontend-dev-guidelines/resources/file-organization.md +0 -502
  348. package/.claude/skills/frontend-dev-guidelines/resources/loading-and-error-states.md +0 -501
  349. package/.claude/skills/frontend-dev-guidelines/resources/performance.md +0 -406
  350. package/.claude/skills/frontend-dev-guidelines/resources/routing-guide.md +0 -364
  351. package/.claude/skills/frontend-dev-guidelines/resources/styling-guide.md +0 -428
  352. package/.claude/skills/frontend-dev-guidelines/resources/typescript-standards.md +0 -418
  353. package/.claude/skills/general-it-engineering/SKILL.md +0 -393
  354. package/.claude/skills/general-it-engineering/resources/asset-management.md +0 -712
  355. package/.claude/skills/general-it-engineering/resources/automation-orchestration.md +0 -817
  356. package/.claude/skills/general-it-engineering/resources/business-continuity.md +0 -786
  357. package/.claude/skills/general-it-engineering/resources/change-management.md +0 -715
  358. package/.claude/skills/general-it-engineering/resources/enterprise-monitoring.md +0 -729
  359. package/.claude/skills/general-it-engineering/resources/help-desk-operations.md +0 -738
  360. package/.claude/skills/general-it-engineering/resources/incident-service-management.md +0 -834
  361. package/.claude/skills/general-it-engineering/resources/it-governance.md +0 -753
  362. package/.claude/skills/general-it-engineering/resources/itil-framework.md +0 -503
  363. package/.claude/skills/general-it-engineering/resources/service-management.md +0 -669
  364. package/.claude/skills/infrastructure-architecture/SKILL.md +0 -328
  365. package/.claude/skills/infrastructure-architecture/resources/architecture-decision-records.md +0 -505
  366. package/.claude/skills/infrastructure-architecture/resources/architecture-patterns.md +0 -528
  367. package/.claude/skills/infrastructure-architecture/resources/capacity-planning.md +0 -453
  368. package/.claude/skills/infrastructure-architecture/resources/cleared-environment-architecture.md +0 -773
  369. package/.claude/skills/infrastructure-architecture/resources/cost-architecture.md +0 -499
  370. package/.claude/skills/infrastructure-architecture/resources/data-architecture.md +0 -501
  371. package/.claude/skills/infrastructure-architecture/resources/disaster-recovery.md +0 -535
  372. package/.claude/skills/infrastructure-architecture/resources/migration-architecture.md +0 -512
  373. package/.claude/skills/infrastructure-architecture/resources/multi-region-design.md +0 -608
  374. package/.claude/skills/infrastructure-architecture/resources/reference-architectures.md +0 -562
  375. package/.claude/skills/infrastructure-architecture/resources/security-architecture.md +0 -538
  376. package/.claude/skills/infrastructure-architecture/resources/system-design-principles.md +0 -489
  377. package/.claude/skills/infrastructure-architecture/resources/workload-classification.md +0 -1000
  378. package/.claude/skills/infrastructure-strategy/SKILL.md +0 -924
  379. package/.claude/skills/network-engineering/SKILL.md +0 -385
  380. package/.claude/skills/network-engineering/resources/dns-management.md +0 -738
  381. package/.claude/skills/network-engineering/resources/load-balancing.md +0 -820
  382. package/.claude/skills/network-engineering/resources/network-architecture.md +0 -546
  383. package/.claude/skills/network-engineering/resources/network-security.md +0 -921
  384. package/.claude/skills/network-engineering/resources/network-troubleshooting.md +0 -749
  385. package/.claude/skills/network-engineering/resources/routing-switching.md +0 -373
  386. package/.claude/skills/network-engineering/resources/sdn-networking.md +0 -695
  387. package/.claude/skills/network-engineering/resources/service-mesh-networking.md +0 -777
  388. package/.claude/skills/network-engineering/resources/tcp-ip-protocols.md +0 -444
  389. package/.claude/skills/network-engineering/resources/vpn-connectivity.md +0 -672
  390. package/.claude/skills/node-development/SKILL.md +0 -317
  391. package/.claude/skills/observability-engineering/SKILL.md +0 -101
  392. package/.claude/skills/observability-engineering/resources/apm-tools.md +0 -97
  393. package/.claude/skills/observability-engineering/resources/correlation-strategies.md +0 -87
  394. package/.claude/skills/observability-engineering/resources/distributed-tracing.md +0 -98
  395. package/.claude/skills/observability-engineering/resources/logs-aggregation.md +0 -118
  396. package/.claude/skills/observability-engineering/resources/observability-cost-optimization.md +0 -141
  397. package/.claude/skills/observability-engineering/resources/opentelemetry.md +0 -110
  398. package/.claude/skills/platform-engineering/SKILL.md +0 -555
  399. package/.claude/skills/platform-engineering/resources/architecture-overview.md +0 -600
  400. package/.claude/skills/platform-engineering/resources/container-orchestration.md +0 -916
  401. package/.claude/skills/platform-engineering/resources/cost-optimization.md +0 -634
  402. package/.claude/skills/platform-engineering/resources/developer-platforms.md +0 -670
  403. package/.claude/skills/platform-engineering/resources/gitops-automation.md +0 -650
  404. package/.claude/skills/platform-engineering/resources/infrastructure-as-code.md +0 -778
  405. package/.claude/skills/platform-engineering/resources/infrastructure-standards.md +0 -708
  406. package/.claude/skills/platform-engineering/resources/multi-tenancy.md +0 -602
  407. package/.claude/skills/platform-engineering/resources/platform-security.md +0 -711
  408. package/.claude/skills/platform-engineering/resources/resource-management.md +0 -592
  409. package/.claude/skills/platform-engineering/resources/service-mesh.md +0 -628
  410. package/.claude/skills/release-engineering/SKILL.md +0 -393
  411. package/.claude/skills/release-engineering/resources/artifact-management.md +0 -108
  412. package/.claude/skills/release-engineering/resources/build-optimization.md +0 -84
  413. package/.claude/skills/release-engineering/resources/ci-cd-pipelines.md +0 -411
  414. package/.claude/skills/release-engineering/resources/deployment-strategies.md +0 -197
  415. package/.claude/skills/release-engineering/resources/pipeline-security.md +0 -62
  416. package/.claude/skills/release-engineering/resources/progressive-delivery.md +0 -83
  417. package/.claude/skills/release-engineering/resources/release-automation.md +0 -68
  418. package/.claude/skills/release-engineering/resources/release-orchestration.md +0 -77
  419. package/.claude/skills/release-engineering/resources/rollback-strategies.md +0 -66
  420. package/.claude/skills/release-engineering/resources/versioning-strategies.md +0 -59
  421. package/.claude/skills/route-tester/SKILL.md +0 -392
  422. package/.claude/skills/skill-developer/ADVANCED.md +0 -197
  423. package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +0 -306
  424. package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +0 -152
  425. package/.claude/skills/skill-developer/SKILL.md +0 -430
  426. package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +0 -315
  427. package/.claude/skills/skill-developer/TRIGGER_TYPES.md +0 -305
  428. package/.claude/skills/skill-developer/TROUBLESHOOTING.md +0 -514
  429. package/.claude/skills/skill-rules.json +0 -2989
  430. package/.claude/skills/sre/SKILL.md +0 -464
  431. package/.claude/skills/sre/resources/alerting-best-practices.md +0 -282
  432. package/.claude/skills/sre/resources/capacity-planning.md +0 -226
  433. package/.claude/skills/sre/resources/chaos-engineering.md +0 -193
  434. package/.claude/skills/sre/resources/disaster-recovery.md +0 -232
  435. package/.claude/skills/sre/resources/incident-management.md +0 -436
  436. package/.claude/skills/sre/resources/observability-stack.md +0 -240
  437. package/.claude/skills/sre/resources/on-call-runbooks.md +0 -167
  438. package/.claude/skills/sre/resources/performance-optimization.md +0 -108
  439. package/.claude/skills/sre/resources/reliability-patterns.md +0 -183
  440. package/.claude/skills/sre/resources/slo-sli-sla.md +0 -464
  441. package/.claude/skills/sre/resources/toil-reduction.md +0 -145
  442. package/.claude/skills/systems-engineering/SKILL.md +0 -648
  443. package/.claude/skills/systems-engineering/resources/automation-patterns.md +0 -771
  444. package/.claude/skills/systems-engineering/resources/configuration-management.md +0 -998
  445. package/.claude/skills/systems-engineering/resources/linux-administration.md +0 -672
  446. package/.claude/skills/systems-engineering/resources/networking-fundamentals.md +0 -982
  447. package/.claude/skills/systems-engineering/resources/performance-tuning.md +0 -871
  448. package/.claude/skills/systems-engineering/resources/powershell-scripting.md +0 -482
  449. package/.claude/skills/systems-engineering/resources/security-hardening.md +0 -739
  450. package/.claude/skills/systems-engineering/resources/shell-scripting.md +0 -915
  451. package/.claude/skills/systems-engineering/resources/storage-management.md +0 -628
  452. package/.claude/skills/systems-engineering/resources/system-monitoring.md +0 -787
  453. package/.claude/skills/systems-engineering/resources/troubleshooting-guide.md +0 -753
  454. package/.claude/skills/systems-engineering/resources/windows-administration.md +0 -738
  455. package/.claude/skills/technical-leadership/SKILL.md +0 -728
  456. package/backend/docs/SECRETS_DOCUMENTATION.md +0 -327
  457. package/backend/package-lock.json +0 -6801
  458. package/backend/src/core/node-registries/actions.js +0 -202
  459. package/backend/src/core/node-registries/arrays.js +0 -155
  460. package/backend/src/core/node-registries/bot.js +0 -23
  461. package/backend/src/core/node-registries/container.js +0 -162
  462. package/backend/src/core/node-registries/data.js +0 -290
  463. package/backend/src/core/node-registries/debug.js +0 -26
  464. package/backend/src/core/node-registries/events.js +0 -201
  465. package/backend/src/core/node-registries/flow.js +0 -139
  466. package/backend/src/core/node-registries/furnace.js +0 -143
  467. package/backend/src/core/node-registries/logic.js +0 -62
  468. package/backend/src/core/node-registries/math.js +0 -42
  469. package/backend/src/core/node-registries/navigation.js +0 -111
  470. package/backend/src/core/node-registries/objects.js +0 -98
  471. package/backend/src/core/node-registries/strings.js +0 -187
  472. package/backend/src/core/node-registries/time.js +0 -113
  473. package/backend/src/core/node-registries/type.js +0 -25
  474. package/backend/src/core/node-registries/users.js +0 -79
  475. package/frontend/dist/assets/index-BC-NbKXi.css +0 -32
  476. package/frontend/dist/assets/index-DqJXZMHY.js +0 -11266
@@ -6,12 +6,14 @@ const { Vec3 } = require('vec3');
6
6
  const { PrismaClient } = require('@prisma/client');
7
7
  const { loadCommands } = require('./system/CommandRegistry');
8
8
  const { getRuntimeCommandRegistry } = require('./system/RuntimeCommandRegistry');
9
- const { initializePlugins } = require('./PluginLoader');
9
+ const { initializePlugins, ensurePluginDependencies } = require('./PluginLoader');
10
10
  const MessageQueue = require('./MessageQueue');
11
11
  const Command = require('./system/Command');
12
12
  const { parseArguments } = require('./system/parseArguments');
13
13
  const GraphExecutionEngine = require('./GraphExecutionEngine');
14
14
  const NodeRegistry = require('./NodeRegistry');
15
+ const { createBotApi } = require('./ipc/botApiFactory');
16
+ const { MessageTypes, EventTypes } = require('./ipc/ipcMessageTypes');
15
17
 
16
18
  const UserService = require('./UserService');
17
19
  const PermissionManager = require('./ipc/PermissionManager.stub.js');
@@ -40,7 +42,7 @@ JSON.parse = function (text, reviver) {
40
42
 
41
43
  function sendLog(content) {
42
44
  if (process.send) {
43
- process.send({ type: 'log', content });
45
+ process.send({ type: MessageTypes.BOT.LOG, content });
44
46
  } else {
45
47
  console.log(`[ChildProcess Log] ${content}`);
46
48
  }
@@ -49,7 +51,6 @@ function sendLog(content) {
49
51
 
50
52
  function sendEvent(eventName, eventArgs) {
51
53
  if (process.send) {
52
- // Добавляем информацию о боте (позицию) во все события
53
54
  const enrichedArgs = {
54
55
  ...eventArgs,
55
56
  botEntity: bot && bot.entity ? {
@@ -58,7 +59,7 @@ function sendEvent(eventName, eventArgs) {
58
59
  pitch: bot.entity.pitch
59
60
  } : null
60
61
  };
61
- process.send({ type: 'event', eventType: eventName, args: enrichedArgs });
62
+ process.send({ type: MessageTypes.BOT.EVENT, eventType: eventName, args: enrichedArgs });
62
63
  }
63
64
  }
64
65
 
@@ -145,7 +146,7 @@ function handleIncomingCommand(type, username, message) {
145
146
 
146
147
  if (process.send) {
147
148
  process.send({
148
- type: 'validate_and_run_command',
149
+ type: MessageTypes.COMMAND.VALIDATE_AND_RUN,
149
150
  commandName: commandInstance.name,
150
151
  username,
151
152
  args: processedArgs,
@@ -159,17 +160,17 @@ function handleIncomingCommand(type, username, message) {
159
160
  }
160
161
 
161
162
  process.on('message', async (message) => {
162
- if (message.type === 'plugin:ui:start-updates') {
163
+ if (message.type === MessageTypes.PLUGIN.UI_START_UPDATES) {
163
164
  const { pluginName } = message;
164
165
  const state = pluginUiState.get(pluginName);
165
166
  if (state && process.send) {
166
167
  process.send({
167
- type: 'plugin:data',
168
+ type: MessageTypes.PLUGIN.UI_DATA,
168
169
  plugin: pluginName,
169
170
  payload: state
170
171
  });
171
172
  }
172
- } else if (message.type === 'user_action_response') {
173
+ } else if (message.type === MessageTypes.USER.ACTION_RESPONSE) {
173
174
  if (pendingRequests.has(message.requestId)) {
174
175
  const { resolve, reject } = pendingRequests.get(message.requestId);
175
176
  if (message.error) {
@@ -179,16 +180,26 @@ process.on('message', async (message) => {
179
180
  }
180
181
  pendingRequests.delete(message.requestId);
181
182
  }
182
- } else if (message.type === 'system:get_player_list') {
183
+ } else if (message.type === MessageTypes.USER.CREDENTIALS_OPERATION_RESPONSE) {
184
+ if (pendingRequests.has(message.requestId)) {
185
+ const { resolve, reject } = pendingRequests.get(message.requestId);
186
+ if (message.error) {
187
+ reject(new Error(message.error));
188
+ } else {
189
+ resolve(message.payload);
190
+ }
191
+ pendingRequests.delete(message.requestId);
192
+ }
193
+ } else if (message.type === MessageTypes.SYSTEM.GET_PLAYER_LIST) {
183
194
  const playerList = bot ? Object.keys(bot.players) : [];
184
195
  if (process.send) {
185
196
  process.send({
186
- type: 'get_player_list_response',
197
+ type: MessageTypes.SYSTEM.GET_PLAYER_LIST_RESPONSE,
187
198
  requestId: message.requestId,
188
199
  payload: { players: playerList }
189
200
  });
190
201
  }
191
- } else if (message.type === 'system:get_nearby_entities') {
202
+ } else if (message.type === MessageTypes.SYSTEM.GET_NEARBY_ENTITIES) {
192
203
  const entities = [];
193
204
  if (bot && bot.entities) {
194
205
  const centerPos = message.payload?.position || bot.entity?.position;
@@ -215,12 +226,12 @@ process.on('message', async (message) => {
215
226
 
216
227
  if (process.send) {
217
228
  process.send({
218
- type: 'get_nearby_entities_response',
229
+ type: MessageTypes.SYSTEM.GET_NEARBY_ENTITIES_RESPONSE,
219
230
  requestId: message.requestId,
220
231
  payload: { entities }
221
232
  });
222
233
  }
223
- } else if (message.type === 'viewer:get_state') {
234
+ } else if (message.type === MessageTypes.VIEWER.GET_STATE) {
224
235
  if (bot && process.send) {
225
236
  let blocks = undefined;
226
237
 
@@ -287,12 +298,12 @@ process.on('message', async (message) => {
287
298
  };
288
299
 
289
300
  process.send({
290
- type: 'viewer:state_response',
301
+ type: MessageTypes.VIEWER.STATE_RESPONSE,
291
302
  requestId: message.requestId,
292
303
  payload: state
293
304
  });
294
305
  }
295
- } else if (message.type === 'viewer:control') {
306
+ } else if (message.type === MessageTypes.VIEWER.CONTROL) {
296
307
  const { command } = message;
297
308
  if (!bot) return;
298
309
 
@@ -357,58 +368,12 @@ process.on('message', async (message) => {
357
368
  } catch (error) {
358
369
  sendLog(`[Viewer] Control error: ${error.message}`);
359
370
  }
360
- } else if (message.type === 'execute_event_graph') {
361
- // Выполнение event графа в child process
371
+ } else if (message.type === MessageTypes.GRAPH.EXECUTE_EVENT_GRAPH) {
362
372
  const { botId, graph, eventType, eventArgs } = message;
363
373
 
364
374
  try {
365
-
366
375
  const playerList = bot ? Object.keys(bot.players) : [];
367
- const botApi = {
368
- sendMessage: (chatType, message, recipient) => {
369
- if (!bot || !bot.messageQueue) {
370
- sendLog('[EventGraph] Bot not ready');
371
- return;
372
- }
373
-
374
- bot.messageQueue.enqueue(chatType, message, recipient);
375
- },
376
- executeCommand: (command) => {
377
- if (!bot || !bot.messageQueue) {
378
- sendLog('[EventGraph] Bot not ready');
379
- return;
380
- }
381
- bot.messageQueue.enqueue('command', command);
382
- },
383
- lookAt: async (x, y, z) => {
384
- if (!bot) return;
385
- const target = new Vec3(x, y, z);
386
- await bot.lookAt(target);
387
- },
388
- navigate: async (x, y, z) => {
389
- if (!bot || !bot.pathfinder) return;
390
- const goal = new (require('mineflayer-pathfinder').goals.GoalBlock)(x, y, z);
391
- await bot.pathfinder.goto(goal);
392
- },
393
- attack: (entityId) => {
394
- if (!bot) return;
395
- const entity = bot.entities[entityId];
396
- if (entity) bot.attack(entity);
397
- },
398
- follow: (username) => {
399
- if (!bot || !bot.pathfinder) return;
400
- const player = bot.players[username];
401
- if (player && player.entity) {
402
- const goal = new (require('mineflayer-pathfinder').goals.GoalFollow)(player.entity, 3);
403
- bot.pathfinder.setGoal(goal, true);
404
- }
405
- },
406
- stopFollow: () => {
407
- if (bot && bot.pathfinder) {
408
- bot.pathfinder.setGoal(null);
409
- }
410
- }
411
- };
376
+ const botApi = createBotApi(bot, { enableLogging: true });
412
377
 
413
378
  const context = {
414
379
  bot: bot, // Полный mineflayer bot
@@ -436,7 +401,7 @@ process.on('message', async (message) => {
436
401
  sendLog(`[EventGraph] Error executing ${eventType} graph: ${error.message}`);
437
402
  sendLog(`[EventGraph] Stack: ${error.stack}`);
438
403
  }
439
- } else if (message.type === 'start') {
404
+ } else if (message.type === MessageTypes.BOT.START) {
440
405
  const config = message.config;
441
406
  sendLog(`[System] Получена команда на запуск бота ${config.username}...`);
442
407
  try {
@@ -503,6 +468,9 @@ process.on('message', async (message) => {
503
468
  bot.sendLog = sendLog;
504
469
  bot.messageQueue = new MessageQueue(bot);
505
470
 
471
+ // Plugin Registry для экспорта API между плагинами
472
+ bot.pluginRegistry = new Map();
473
+
506
474
  const installedPluginNames = config.plugins.map(p => p.name);
507
475
  bot.api = {
508
476
  Command: Command,
@@ -511,7 +479,7 @@ process.on('message', async (message) => {
511
479
  if (type === 'websocket') {
512
480
  if (process.send) {
513
481
  process.send({
514
- type: 'send_websocket_message',
482
+ type: MessageTypes.WEBSOCKET.SEND_MESSAGE,
515
483
  payload: {
516
484
  botId: bot.config.id,
517
485
  message: message,
@@ -620,7 +588,7 @@ process.on('message', async (message) => {
620
588
 
621
589
  if (process.send) {
622
590
  process.send({
623
- type: 'register_command',
591
+ type: MessageTypes.COMMAND.REGISTER,
624
592
  commandConfig: {
625
593
  name: command.name,
626
594
  description: command.description,
@@ -651,7 +619,7 @@ process.on('message', async (message) => {
651
619
 
652
620
  if (process.send) {
653
621
  process.send({
654
- type: 'request_user_action',
622
+ type: MessageTypes.USER.REQUEST_ACTION,
655
623
  requestId,
656
624
  payload: {
657
625
  targetUsername: username,
@@ -778,15 +746,97 @@ process.on('message', async (message) => {
778
746
 
779
747
  if (process.send) {
780
748
  process.send({
781
- type: 'plugin:data',
749
+ type: MessageTypes.PLUGIN.UI_DATA,
782
750
  plugin: pluginName,
783
751
  payload: newState
784
752
  });
785
753
  }
754
+ },
755
+
756
+ // === Методы для управления credentials ===
757
+ updateCredentials: async ({ username, password }) => {
758
+ return new Promise((resolve, reject) => {
759
+ const requestId = uuidv4();
760
+ pendingRequests.set(requestId, { resolve, reject });
761
+
762
+ if (process.send) {
763
+ process.send({
764
+ type: MessageTypes.BOT.UPDATE_CREDENTIALS,
765
+ requestId,
766
+ payload: {
767
+ botId: bot.config.id,
768
+ username,
769
+ password
770
+ }
771
+ });
772
+ } else {
773
+ reject(new Error('IPC channel is not available.'));
774
+ }
775
+
776
+ setTimeout(() => {
777
+ if (pendingRequests.has(requestId)) {
778
+ reject(new Error('Request to update credentials timed out.'));
779
+ pendingRequests.delete(requestId);
780
+ }
781
+ }, 10000);
782
+ });
783
+ },
784
+
785
+ restart: async () => {
786
+ return new Promise((resolve, reject) => {
787
+ const requestId = uuidv4();
788
+ pendingRequests.set(requestId, { resolve, reject });
789
+
790
+ if (process.send) {
791
+ process.send({
792
+ type: MessageTypes.BOT.RESTART,
793
+ requestId,
794
+ payload: {
795
+ botId: bot.config.id
796
+ }
797
+ });
798
+ } else {
799
+ reject(new Error('IPC channel is not available.'));
800
+ }
801
+
802
+ setTimeout(() => {
803
+ if (pendingRequests.has(requestId)) {
804
+ reject(new Error('Request to restart bot timed out.'));
805
+ pendingRequests.delete(requestId);
806
+ }
807
+ }, 10000);
808
+ });
809
+ },
810
+
811
+ changeCredentials: async ({ username, password }) => {
812
+ return new Promise((resolve, reject) => {
813
+ const requestId = uuidv4();
814
+ pendingRequests.set(requestId, { resolve, reject });
815
+
816
+ if (process.send) {
817
+ process.send({
818
+ type: MessageTypes.BOT.CHANGE_CREDENTIALS,
819
+ requestId,
820
+ payload: {
821
+ botId: bot.config.id,
822
+ username,
823
+ password
824
+ }
825
+ });
826
+ } else {
827
+ reject(new Error('IPC channel is not available.'));
828
+ }
829
+
830
+ setTimeout(() => {
831
+ if (pendingRequests.has(requestId)) {
832
+ reject(new Error('Request to change credentials timed out.'));
833
+ pendingRequests.delete(requestId);
834
+ }
835
+ }, 10000);
836
+ });
786
837
  }
787
838
  };
788
839
 
789
- // Упрощенный alias для отправки сообщений (используется в командах и нодах)
790
840
  bot.sendMessage = (type, message, username) => {
791
841
  bot.api.sendMessage(type, message, username);
792
842
  };
@@ -797,7 +847,7 @@ process.on('message', async (message) => {
797
847
  const processApi = {
798
848
  appendLog: (botId, message) => {
799
849
  if (process.send) {
800
- process.send({ type: 'log', content: message });
850
+ process.send({ type: MessageTypes.BOT.LOG, content: message });
801
851
  }
802
852
  }
803
853
  };
@@ -895,7 +945,7 @@ process.on('message', async (message) => {
895
945
  if (process.send) {
896
946
  for (const cmd of bot.commands.values()) {
897
947
  process.send({
898
- type: 'register_command',
948
+ type: MessageTypes.COMMAND.REGISTER,
899
949
  commandConfig: {
900
950
  name: cmd.name,
901
951
  description: cmd.description,
@@ -909,6 +959,7 @@ process.on('message', async (message) => {
909
959
  }
910
960
  }
911
961
 
962
+ await ensurePluginDependencies(config.plugins, sendLog);
912
963
  await initializePlugins(bot, config.plugins, prisma);
913
964
  sendLog('[System] Все системы инициализированы.');
914
965
 
@@ -932,7 +983,7 @@ process.on('message', async (message) => {
932
983
 
933
984
  if (process.send && rawMessageText.trim()) {
934
985
  process.send({
935
- type: 'viewer:chat',
986
+ type: MessageTypes.VIEWER.CHAT,
936
987
  payload: {
937
988
  rawText: rawMessageText,
938
989
  timestamp: Date.now()
@@ -954,12 +1005,22 @@ process.on('message', async (message) => {
954
1005
 
955
1006
  bot.on('chat', (username, message) => {
956
1007
  if (messageHandledByCustomParser) return;
957
- handleIncomingCommand('chat', username, message);
1008
+ bot.events.emit('chat:message', {
1009
+ username,
1010
+ message,
1011
+ type: EventTypes.CHAT,
1012
+ raw: message
1013
+ });
958
1014
  });
959
1015
 
960
1016
  bot.on('whisper', (username, message) => {
961
1017
  if (messageHandledByCustomParser) return;
962
- handleIncomingCommand('whisper', username, message);
1018
+ bot.events.emit('chat:message', {
1019
+ username,
1020
+ message,
1021
+ type: EventTypes.WHISPER,
1022
+ raw: message
1023
+ });
963
1024
  });
964
1025
 
965
1026
  bot.on('userAction', async ({ action, target, ...data }) => {
@@ -990,8 +1051,8 @@ process.on('message', async (message) => {
990
1051
  }
991
1052
  sendLog('[Event: login] Успешно залогинился!');
992
1053
  if (process.send && !botReadySent) {
993
- process.send({ type: 'bot_ready' });
994
- process.send({ type: 'status', status: 'running' });
1054
+ process.send({ type: MessageTypes.BOT.READY });
1055
+ process.send({ type: MessageTypes.BOT.STATUS, status: 'running' });
995
1056
  botReadySent = true;
996
1057
  }
997
1058
  });
@@ -1010,7 +1071,13 @@ process.on('message', async (message) => {
1010
1071
 
1011
1072
  bot.on('kicked', (reason) => {
1012
1073
  let reasonText;
1013
- try { reasonText = JSON.parse(reason).text || reason; } catch (e) { reasonText = reason; }
1074
+ if (typeof reason === 'string') {
1075
+ try { reasonText = JSON.parse(reason).text || reason; } catch (e) { reasonText = reason; }
1076
+ } else if (reason && typeof reason === 'object') {
1077
+ reasonText = reason.text || reason.message || reason.reason || JSON.stringify(reason);
1078
+ } else {
1079
+ reasonText = String(reason);
1080
+ }
1014
1081
  sendLog(`[Event: kicked] Меня кикнули. Причина: ${reasonText}.`);
1015
1082
  process.exit(0);
1016
1083
  });
@@ -1084,7 +1151,7 @@ process.on('message', async (message) => {
1084
1151
  // Отправка события для viewer
1085
1152
  if (process.send) {
1086
1153
  process.send({
1087
- type: 'viewer:spawn',
1154
+ type: MessageTypes.VIEWER.SPAWN,
1088
1155
  payload: {
1089
1156
  position: bot.entity?.position,
1090
1157
  yaw: bot.entity?.yaw,
@@ -1097,7 +1164,7 @@ process.on('message', async (message) => {
1097
1164
  bot.on('health', () => {
1098
1165
  if (process.send) {
1099
1166
  process.send({
1100
- type: 'viewer:health',
1167
+ type: MessageTypes.VIEWER.HEALTH,
1101
1168
  payload: {
1102
1169
  health: bot.health,
1103
1170
  food: bot.food
@@ -1109,7 +1176,7 @@ process.on('message', async (message) => {
1109
1176
  bot.on('move', () => {
1110
1177
  if (process.send) {
1111
1178
  process.send({
1112
- type: 'viewer:move',
1179
+ type: MessageTypes.VIEWER.MOVE,
1113
1180
  payload: {
1114
1181
  position: bot.entity?.position,
1115
1182
  yaw: bot.entity?.yaw,
@@ -1145,7 +1212,7 @@ process.on('message', async (message) => {
1145
1212
  sendLog(`[CRITICAL] Критическая ошибка при создании бота: ${err.stack}`);
1146
1213
  process.exit(1);
1147
1214
  }
1148
- } else if (message.type === 'config:reload') {
1215
+ } else if (message.type === MessageTypes.CONFIG.RELOAD) {
1149
1216
  sendLog('[System] Received config:reload command. Reloading configuration...');
1150
1217
  try {
1151
1218
  const newConfig = await fetchNewConfig(bot.config.id, prisma);
@@ -1162,7 +1229,7 @@ process.on('message', async (message) => {
1162
1229
  } catch (error) {
1163
1230
  sendLog(`[System] Error reloading configuration: ${error.message}`);
1164
1231
  }
1165
- } else if (message.type === 'stop') {
1232
+ } else if (message.type === MessageTypes.BOT.STOP) {
1166
1233
  if (connectionTimeout) {
1167
1234
  clearTimeout(connectionTimeout);
1168
1235
  connectionTimeout = null;
@@ -1170,12 +1237,12 @@ process.on('message', async (message) => {
1170
1237
  botReadySent = false;
1171
1238
  if (bot) bot.quit();
1172
1239
  else process.exit(0);
1173
- } else if (message.type === 'chat') {
1240
+ } else if (message.type === MessageTypes.CHAT.CHAT) {
1174
1241
  if (bot && bot.entity) {
1175
1242
  const { message: msg, chatType, username } = message.payload;
1176
1243
  bot.messageQueue.enqueue(chatType, msg, username);
1177
1244
  }
1178
- } else if (message.type === 'register_temp_command') {
1245
+ } else if (message.type === MessageTypes.COMMAND.REGISTER_TEMP) {
1179
1246
  // Регистрация временной команды из главного процесса
1180
1247
  const { commandData } = message;
1181
1248
 
@@ -1207,7 +1274,7 @@ process.on('message', async (message) => {
1207
1274
  } catch (error) {
1208
1275
  sendLog(`[BotProcess] Ошибка регистрации временной команды: ${error.message}`);
1209
1276
  }
1210
- } else if (message.type === 'unregister_temp_command') {
1277
+ } else if (message.type === MessageTypes.COMMAND.UNREGISTER_TEMP) {
1211
1278
  const { commandName, aliases } = message;
1212
1279
 
1213
1280
  try {
@@ -1225,7 +1292,7 @@ process.on('message', async (message) => {
1225
1292
  } catch (error) {
1226
1293
  sendLog(`[BotProcess] Ошибка удаления временной команды: ${error.message}`);
1227
1294
  }
1228
- } else if (message.type === 'execute_handler') {
1295
+ } else if (message.type === MessageTypes.GRAPH.EXECUTE_HANDLER) {
1229
1296
  const { commandName, username, args, typeChat } = message;
1230
1297
  const commandInstance = bot.commands.get(commandName);
1231
1298
  if (commandInstance) {
@@ -1248,7 +1315,7 @@ process.on('message', async (message) => {
1248
1315
  }
1249
1316
  })();
1250
1317
  }
1251
- } else if (message.type === 'execute_command_request') {
1318
+ } else if (message.type === MessageTypes.GRAPH.EXECUTE_COMMAND_REQUEST) {
1252
1319
  const { requestId, payload } = message;
1253
1320
  const { commandName, args, username, typeChat } = payload;
1254
1321
 
@@ -1272,7 +1339,7 @@ process.on('message', async (message) => {
1272
1339
  if (typeChat === 'websocket') {
1273
1340
  result = await commandInstance.handler(context);
1274
1341
  if (process.send) {
1275
- process.send({ type: 'execute_command_response', requestId, result });
1342
+ process.send({ type: MessageTypes.GRAPH.EXECUTE_COMMAND_RESPONSE, requestId, result });
1276
1343
  }
1277
1344
  } else {
1278
1345
  commandInstance.handler(context).catch(e => {
@@ -1301,7 +1368,7 @@ process.on('message', async (message) => {
1301
1368
  result = sendMessageCalled ? resultFromSendMessage : returnValue;
1302
1369
 
1303
1370
  if (process.send) {
1304
- process.send({ type: 'execute_command_response', requestId, result });
1371
+ process.send({ type: MessageTypes.GRAPH.EXECUTE_COMMAND_RESPONSE, requestId, result });
1305
1372
  }
1306
1373
  } finally {
1307
1374
  bot.sendMessage = originalSendMessage;
@@ -1316,15 +1383,15 @@ process.on('message', async (message) => {
1316
1383
 
1317
1384
  } catch (error) {
1318
1385
  if (process.send) {
1319
- process.send({ type: 'execute_command_response', requestId, error: error.message });
1386
+ process.send({ type: MessageTypes.GRAPH.EXECUTE_COMMAND_RESPONSE, requestId, error: error.message });
1320
1387
  }
1321
1388
  }
1322
1389
  })();
1323
- } else if (message.type === 'invalidate_user_cache') {
1390
+ } else if (message.type === MessageTypes.USER.INVALIDATE_USER_CACHE) {
1324
1391
  if (message.username && bot && bot.config) {
1325
1392
  UserService.clearCache(message.username, bot.config.id);
1326
1393
  }
1327
- } else if (message.type === 'invalidate_all_user_cache') {
1394
+ } else if (message.type === MessageTypes.USER.INVALIDATE_ALL_USER_CACHE) {
1328
1395
  if (bot && bot.config) {
1329
1396
  for (const [cacheKey, user] of UserService.cache.entries()) {
1330
1397
  if (cacheKey.startsWith(`${bot.config.id}:`)) {
@@ -1333,7 +1400,7 @@ process.on('message', async (message) => {
1333
1400
  }
1334
1401
  sendLog(`[BotProcess] Кэш пользователей очищен для бота ${bot.config.id}`);
1335
1402
  }
1336
- } else if (message.type === 'handle_permission_error') {
1403
+ } else if (message.type === MessageTypes.COMMAND.HANDLE_PERMISSION_ERROR) {
1337
1404
  const { commandName, username, typeChat } = message;
1338
1405
  const commandInstance = bot.commands.get(commandName);
1339
1406
  if (commandInstance) {
@@ -1343,7 +1410,7 @@ process.on('message', async (message) => {
1343
1410
  bot.api.sendMessage(typeChat, `У вас нет прав для выполнения команды ${commandName}.`, username);
1344
1411
  }
1345
1412
  }
1346
- } else if (message.type === 'handle_wrong_chat') {
1413
+ } else if (message.type === MessageTypes.COMMAND.HANDLE_WRONG_CHAT) {
1347
1414
  const { commandName, username, typeChat } = message;
1348
1415
  const commandInstance = bot.commands.get(commandName);
1349
1416
  if (commandInstance) {
@@ -1353,7 +1420,7 @@ process.on('message', async (message) => {
1353
1420
  bot.api.sendMessage('private', `Команду ${commandName} нельзя использовать в этом типе чата - ${typeChat}.`, username);
1354
1421
  }
1355
1422
  }
1356
- } else if (message.type === 'handle_cooldown') {
1423
+ } else if (message.type === MessageTypes.COMMAND.HANDLE_COOLDOWN) {
1357
1424
  const { commandName, username, typeChat, timeLeft } = message;
1358
1425
  const commandInstance = bot.commands.get(commandName);
1359
1426
  if (commandInstance) {
@@ -1363,7 +1430,7 @@ process.on('message', async (message) => {
1363
1430
  bot.api.sendMessage(typeChat, `Команду ${commandName} можно будет использовать через ${timeLeft} сек.`, username);
1364
1431
  }
1365
1432
  }
1366
- } else if (message.type === 'handle_blacklist') {
1433
+ } else if (message.type === MessageTypes.COMMAND.HANDLE_BLACKLIST) {
1367
1434
  const { commandName, username, typeChat } = message;
1368
1435
  const commandInstance = bot.commands.get(commandName);
1369
1436
  if (commandInstance) {
@@ -1371,12 +1438,12 @@ process.on('message', async (message) => {
1371
1438
  commandInstance.onBlacklisted(bot, typeChat, { username });
1372
1439
  }
1373
1440
  }
1374
- } else if (message.type === 'send_message') {
1441
+ } else if (message.type === MessageTypes.CHAT.SEND_MESSAGE) {
1375
1442
  const { typeChat, message: msg, username } = message;
1376
1443
  if (bot && bot.api) {
1377
1444
  bot.api.sendMessage(typeChat, msg, username);
1378
1445
  }
1379
- } else if (message.type === 'action') {
1446
+ } else if (message.type === MessageTypes.CHAT.ACTION) {
1380
1447
  if (message.name === 'lookAt' && bot && message.payload.position) {
1381
1448
  const { x, y, z } = message.payload.position;
1382
1449
  if (typeof x === 'number' && typeof y === 'number' && typeof z === 'number') {
@@ -1385,7 +1452,7 @@ process.on('message', async (message) => {
1385
1452
  sendLog(`[BotProcess] Ошибка lookAt: получены невалидные координаты: ${JSON.stringify(message.payload.position)}`);
1386
1453
  }
1387
1454
  }
1388
- } else if (message.type === 'plugins:reload') {
1455
+ } else if (message.type === MessageTypes.PLUGINS.RELOAD) {
1389
1456
  sendLog('[System] Получена команда на перезагрузку плагинов...');
1390
1457
  const newConfig = await fetchNewConfig(bot.config.id, prisma);
1391
1458
  if (newConfig) {
@@ -1399,12 +1466,11 @@ process.on('message', async (message) => {
1399
1466
  } else {
1400
1467
  sendLog('[System] Не удалось получить новую конфигурацию для перезагрузки плагинов.');
1401
1468
  }
1402
- } else if (message.type === 'server_command') {
1469
+ } else if (message.type === MessageTypes.SERVER.COMMAND) {
1403
1470
  if (bot && bot.messageQueue && message.payload && message.payload.command) {
1404
1471
  bot.messageQueue.enqueue('command', message.payload.command);
1405
1472
  }
1406
- } else if (message.type === 'execute_event_graph') {
1407
- // Выполнение event графа в child process
1473
+ } else if (message.type === MessageTypes.GRAPH.EXECUTE_EVENT_GRAPH) {
1408
1474
  const { graph, eventType, eventArgs } = message;
1409
1475
 
1410
1476
  try {
@@ -1419,44 +1485,7 @@ process.on('message', async (message) => {
1419
1485
  return;
1420
1486
  }
1421
1487
 
1422
- const botApi = {
1423
- sendMessage: (chatType, messageText, recipient) => {
1424
- if (!bot || !bot.messageQueue) return;
1425
- bot.messageQueue.enqueue(chatType, messageText, recipient);
1426
- },
1427
- executeCommand: (command) => {
1428
- if (!bot || !bot.messageQueue) return;
1429
- bot.messageQueue.enqueue('command', command);
1430
- },
1431
- lookAt: async (x, y, z) => {
1432
- if (!bot) return;
1433
- const target = new Vec3(x, y, z);
1434
- await bot.lookAt(target);
1435
- },
1436
- navigate: async (x, y, z) => {
1437
- if (!bot || !bot.pathfinder) return;
1438
- const goal = new (require('mineflayer-pathfinder').goals.GoalBlock)(x, y, z);
1439
- await bot.pathfinder.goto(goal);
1440
- },
1441
- attack: (entityId) => {
1442
- if (!bot) return;
1443
- const entity = bot.entities[entityId];
1444
- if (entity) bot.attack(entity);
1445
- },
1446
- follow: (username) => {
1447
- if (!bot || !bot.pathfinder) return;
1448
- const player = bot.players[username];
1449
- if (player && player.entity) {
1450
- const goal = new (require('mineflayer-pathfinder').goals.GoalFollow)(player.entity, 3);
1451
- bot.pathfinder.setGoal(goal, true);
1452
- }
1453
- },
1454
- stopFollow: () => {
1455
- if (bot && bot.pathfinder) {
1456
- bot.pathfinder.setGoal(null);
1457
- }
1458
- }
1459
- };
1488
+ const botApi = createBotApi(bot);
1460
1489
 
1461
1490
  const players = bot ? Object.keys(bot.players) : [];
1462
1491
 
@@ -7,14 +7,18 @@ const botHistoryStore = require('./BotHistoryStore');
7
7
  const prisma = prismaService.getClient();
8
8
 
9
9
  class EventGraphManager {
10
- constructor(botManager = null) {
11
- this.botManager = botManager;
10
+ constructor() {
11
+ this._botManager = null;
12
12
  this.activeGraphs = new Map();
13
13
  this.graphStates = new Map();
14
14
  }
15
15
 
16
+ get botManager() {
17
+ return this._botManager;
18
+ }
19
+
16
20
  setBotManager(botManager) {
17
- this.botManager = botManager;
21
+ this._botManager = botManager;
18
22
  }
19
23
 
20
24
  async loadGraphsForBot(botId) {