blockmine 1.25.0 → 1.27.1

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 (165) hide show
  1. package/CHANGELOG.md +46 -1
  2. package/backend/cli.js +1 -1
  3. package/backend/package.json +2 -2
  4. package/backend/prisma/migrations/20260328173000_add_plugin_source_ref/migration.sql +2 -0
  5. package/backend/prisma/migrations/migration_lock.toml +2 -2
  6. package/backend/prisma/schema.prisma +2 -0
  7. package/backend/src/api/routes/apiKeys.js +8 -0
  8. package/backend/src/api/routes/bots.js +258 -9
  9. package/backend/src/api/routes/eventGraphs.js +151 -1
  10. package/backend/src/api/routes/health.js +38 -0
  11. package/backend/src/api/routes/nodeRegistry.js +63 -0
  12. package/backend/src/api/routes/plugins.js +254 -29
  13. package/backend/src/container.js +11 -8
  14. package/backend/src/core/BotCommandLoader.js +161 -0
  15. package/backend/src/core/BotConnection.js +125 -0
  16. package/backend/src/core/BotEventHandlers.js +234 -0
  17. package/backend/src/core/BotIPCHandler.js +445 -0
  18. package/backend/src/core/BotManager.js +15 -7
  19. package/backend/src/core/BotProcess.js +75 -142
  20. package/backend/src/core/EventGraphManager.js +7 -3
  21. package/backend/src/core/GraphDebugHandler.js +229 -0
  22. package/backend/src/core/GraphDebugIPC.js +117 -0
  23. package/backend/src/core/GraphExecutionEngine.js +545 -978
  24. package/backend/src/core/GraphTraversal.js +80 -0
  25. package/backend/src/core/GraphValidation.js +73 -0
  26. package/backend/src/core/NodeDefinition.js +138 -0
  27. package/backend/src/core/NodeRegistry.js +153 -141
  28. package/backend/src/core/PluginManager.js +272 -31
  29. package/backend/src/core/RewindSignal.js +9 -0
  30. package/backend/src/core/config/ConfigValidator.js +72 -0
  31. package/backend/src/core/config/FeatureFlags.js +52 -0
  32. package/backend/src/core/config/__tests__/ConfigValidator.test.js +232 -0
  33. package/backend/src/core/domain/entities/Bot.js +39 -0
  34. package/backend/src/core/domain/entities/Command.js +41 -0
  35. package/backend/src/core/domain/entities/EventGraph.js +39 -0
  36. package/backend/src/core/domain/entities/Plugin.js +45 -0
  37. package/backend/src/core/domain/entities/User.js +40 -0
  38. package/backend/src/core/domain/services/DependencyResolver.js +168 -0
  39. package/backend/src/core/domain/services/GraphValidator.js +117 -0
  40. package/backend/src/core/domain/services/PermissionChecker.js +34 -0
  41. package/backend/src/core/domain/services/__tests__/DependencyResolver.test.js +126 -0
  42. package/backend/src/core/domain/valueObjects/BotConfig.js +27 -0
  43. package/backend/src/core/domain/valueObjects/DependencyGraph.js +86 -0
  44. package/backend/src/core/domain/valueObjects/PluginManifest.js +36 -0
  45. package/backend/src/core/errors/BaseError.js +29 -0
  46. package/backend/src/core/errors/ErrorHandler.js +81 -0
  47. package/backend/src/core/errors/__tests__/ErrorHandler.test.js +188 -0
  48. package/backend/src/core/errors/index.js +68 -0
  49. package/backend/src/core/infrastructure/BatchingUtility.js +66 -0
  50. package/backend/src/core/infrastructure/CircuitBreaker.js +103 -0
  51. package/backend/src/core/infrastructure/ConnectionPool.js +81 -0
  52. package/backend/src/core/infrastructure/RateLimiter.js +64 -0
  53. package/backend/src/core/infrastructure/__tests__/BatchingUtility.test.js +86 -0
  54. package/backend/src/core/infrastructure/__tests__/CircuitBreaker.test.js +156 -0
  55. package/backend/src/core/infrastructure/__tests__/ConnectionPool.test.js +146 -0
  56. package/backend/src/core/infrastructure/__tests__/RateLimiter.test.js +171 -0
  57. package/backend/src/core/ipc/botApiFactory.js +72 -0
  58. package/backend/src/core/ipc/ipcMessageTypes.js +115 -0
  59. package/backend/src/core/logging/AuditLogger.js +61 -0
  60. package/backend/src/core/logging/StructuredLogger.js +80 -0
  61. package/backend/src/core/logging/__tests__/StructuredLogger.test.js +213 -0
  62. package/backend/src/core/logging/index.js +7 -0
  63. package/backend/src/core/metrics/MetricsCollector.js +104 -0
  64. package/backend/src/core/metrics/__tests__/MetricsCollector.test.js +131 -0
  65. package/backend/src/core/node-registries/actionsNodes.js +191 -0
  66. package/backend/src/core/node-registries/arraysNodes.js +152 -0
  67. package/backend/src/core/node-registries/botNodes.js +48 -0
  68. package/backend/src/core/node-registries/containerNodes.js +141 -0
  69. package/backend/src/core/node-registries/dataNodes.js +284 -0
  70. package/backend/src/core/node-registries/debugNodes.js +23 -0
  71. package/backend/src/core/node-registries/eventsNodes.js +223 -0
  72. package/backend/src/core/node-registries/flowNodes.js +151 -0
  73. package/backend/src/core/node-registries/furnaceNodes.js +123 -0
  74. package/backend/src/core/node-registries/index.js +108 -0
  75. package/backend/src/core/node-registries/inventory.js +102 -106
  76. package/backend/src/core/node-registries/logicNodes.js +54 -0
  77. package/backend/src/core/node-registries/mathNodes.js +38 -0
  78. package/backend/src/core/node-registries/navigationNodes.js +109 -0
  79. package/backend/src/core/node-registries/objectsNodes.js +90 -0
  80. package/backend/src/core/node-registries/stringsNodes.js +165 -0
  81. package/backend/src/core/node-registries/timeNodes.js +105 -0
  82. package/backend/src/core/node-registries/typeNodes.js +22 -0
  83. package/backend/src/core/node-registries/usersNodes.js +126 -0
  84. package/backend/src/core/nodes/arrays/shuffle.js +14 -0
  85. package/backend/src/core/nodes/bot/get_name.js +8 -0
  86. package/backend/src/core/nodes/bot/stop_bot.js +5 -0
  87. package/backend/src/core/nodes/container/open.js +101 -111
  88. package/backend/src/core/nodes/data/store_read.js +26 -0
  89. package/backend/src/core/nodes/data/store_write.js +23 -0
  90. package/backend/src/core/nodes/event/call_event.js +31 -0
  91. package/backend/src/core/nodes/event/custom_event.js +8 -0
  92. package/backend/src/core/nodes/flow/timer.js +35 -0
  93. package/backend/src/core/nodes/inventory/drop.js +73 -65
  94. package/backend/src/core/nodes/inventory/equip.js +54 -45
  95. package/backend/src/core/nodes/inventory/select_slot.js +48 -46
  96. package/backend/src/core/nodes/navigation/follow.js +54 -51
  97. package/backend/src/core/nodes/navigation/go_to.js +41 -53
  98. package/backend/src/core/nodes/navigation/go_to_entity.js +65 -69
  99. package/backend/src/core/nodes/navigation/go_to_player.js +65 -70
  100. package/backend/src/core/nodes/navigation/stop.js +17 -26
  101. package/backend/src/core/nodes/users/add_to_group.js +24 -0
  102. package/backend/src/core/nodes/users/check_permission.js +26 -0
  103. package/backend/src/core/nodes/users/remove_from_group.js +24 -0
  104. package/backend/src/core/services/BotIPCMessageRouter.js +337 -0
  105. package/backend/src/core/services/BotLifecycleService.js +41 -632
  106. package/backend/src/core/services/CacheManager.js +83 -23
  107. package/backend/src/core/services/CrashRestartManager.js +42 -0
  108. package/backend/src/core/services/DebugSessionManager.js +114 -12
  109. package/backend/src/core/services/EventGraphService.js +69 -0
  110. package/backend/src/core/services/MinecraftBotManager.js +9 -1
  111. package/backend/src/core/services/PluginManagementService.js +84 -0
  112. package/backend/src/core/services/TestModeContext.js +65 -0
  113. package/backend/src/core/services/__tests__/CacheManager.test.js +168 -0
  114. package/backend/src/core/services.js +1 -11
  115. package/backend/src/core/validation/InputValidator.js +167 -0
  116. package/backend/src/core/validation/__tests__/InputValidator.test.js +296 -0
  117. package/backend/src/real-time/botApi/index.js +1 -1
  118. package/backend/src/real-time/socketHandler.js +26 -0
  119. package/backend/src/server.js +10 -5
  120. package/frontend/dist/assets/{browser-ponyfill-DN7pwmHT.js → browser-ponyfill-D8y0Ty7C.js} +1 -1
  121. package/frontend/dist/assets/index-CFJLS0dk.css +32 -0
  122. package/frontend/dist/assets/{index-LSy71uwm.js → index-D91UGNMG.js} +1880 -1881
  123. package/frontend/dist/index.html +2 -2
  124. package/frontend/dist/locales/en/bots.json +4 -1
  125. package/frontend/dist/locales/en/common.json +7 -1
  126. package/frontend/dist/locales/en/login.json +2 -0
  127. package/frontend/dist/locales/en/management.json +79 -1
  128. package/frontend/dist/locales/en/nodes.json +59 -4
  129. package/frontend/dist/locales/en/plugin-detail.json +24 -4
  130. package/frontend/dist/locales/en/plugins.json +226 -7
  131. package/frontend/dist/locales/en/setup.json +2 -0
  132. package/frontend/dist/locales/en/sidebar.json +171 -3
  133. package/frontend/dist/locales/en/visual-editor.json +230 -31
  134. package/frontend/dist/locales/ru/bots.json +4 -1
  135. package/frontend/dist/locales/ru/login.json +2 -0
  136. package/frontend/dist/locales/ru/management.json +79 -1
  137. package/frontend/dist/locales/ru/minecraft-viewer.json +3 -0
  138. package/frontend/dist/locales/ru/nodes.json +105 -51
  139. package/frontend/dist/locales/ru/plugins.json +103 -4
  140. package/frontend/dist/locales/ru/setup.json +2 -0
  141. package/frontend/dist/locales/ru/sidebar.json +171 -3
  142. package/frontend/dist/locales/ru/visual-editor.json +232 -33
  143. package/frontend/package.json +2 -0
  144. package/nul +12 -0
  145. package/package.json +3 -3
  146. package/scripts/postinstall.js +38 -0
  147. package/backend/package-lock.json +0 -6801
  148. package/backend/src/core/node-registries/actions.js +0 -202
  149. package/backend/src/core/node-registries/arrays.js +0 -155
  150. package/backend/src/core/node-registries/bot.js +0 -23
  151. package/backend/src/core/node-registries/container.js +0 -162
  152. package/backend/src/core/node-registries/data.js +0 -290
  153. package/backend/src/core/node-registries/debug.js +0 -26
  154. package/backend/src/core/node-registries/events.js +0 -201
  155. package/backend/src/core/node-registries/flow.js +0 -139
  156. package/backend/src/core/node-registries/furnace.js +0 -143
  157. package/backend/src/core/node-registries/logic.js +0 -62
  158. package/backend/src/core/node-registries/math.js +0 -42
  159. package/backend/src/core/node-registries/navigation.js +0 -111
  160. package/backend/src/core/node-registries/objects.js +0 -98
  161. package/backend/src/core/node-registries/strings.js +0 -187
  162. package/backend/src/core/node-registries/time.js +0 -113
  163. package/backend/src/core/node-registries/type.js +0 -25
  164. package/backend/src/core/node-registries/users.js +0 -79
  165. package/frontend/dist/assets/index-SfhKxI4-.css +0 -32
@@ -0,0 +1,284 @@
1
+ const { GRAPH_TYPES } = require('../../core/constants/graphTypes');
2
+
3
+ const dataNodes = [
4
+ {
5
+ type: 'data:get_argument',
6
+ label: '📥 Получить аргумент',
7
+ category: 'Данные',
8
+ description: 'Получает значение аргумента команды по его имени.',
9
+ graphType: GRAPH_TYPES.COMMAND,
10
+ evaluator: require('../../core/nodes/data/get_argument').evaluate,
11
+ computeInputs: (data) => [],
12
+ computeOutputs: (data) => [
13
+ { id: 'value', name: 'Значение', type: 'Any' },
14
+ { id: 'exists', name: 'Существует', type: 'Boolean' }
15
+ ],
16
+ defaultData: { argumentName: '' }
17
+ },
18
+ {
19
+ type: 'data:get_variable',
20
+ label: '📤 Получить переменную',
21
+ category: 'Данные',
22
+ description: 'Получает значение переменной графа.',
23
+ graphType: GRAPH_TYPES.ALL,
24
+ evaluator: require('../../core/nodes/data/get_variable').evaluate,
25
+ computeInputs: (data) => [],
26
+ computeOutputs: (data) => [
27
+ { id: 'value', name: 'Значение', type: 'Wildcard' }
28
+ ],
29
+ defaultData: {}
30
+ },
31
+ {
32
+ type: 'data:get_entity_field',
33
+ label: '📦 Получить поле сущности',
34
+ category: 'Данные',
35
+ description: 'Получает определенное поле из объекта сущности (например, "position.x", "username").',
36
+ graphType: GRAPH_TYPES.ALL,
37
+ evaluator: require('../../core/nodes/data/get_entity_field').evaluate,
38
+ computeInputs: (data) => [
39
+ { id: 'entity', name: 'Сущность', type: 'Object', required: true }
40
+ ],
41
+ computeOutputs: (data) => [
42
+ { id: 'username', name: 'Никнейм', type: 'String' },
43
+ { id: 'type', name: 'Тип', type: 'String' },
44
+ { id: 'position', name: 'Позиция', type: 'Object' },
45
+ { id: 'isValid', name: 'Валидна', type: 'Boolean' }
46
+ ],
47
+ defaultData: {}
48
+ },
49
+ {
50
+ type: 'data:string_literal',
51
+ label: '📜 Строка',
52
+ category: 'Данные',
53
+ description: 'Текстовое значение с поддержкой переменных. Используйте {имя} для вставки значений.',
54
+ graphType: GRAPH_TYPES.ALL,
55
+ dynamicPins: true,
56
+ evaluator: require('../../core/nodes/data/string_literal').evaluate,
57
+ computeInputs: (data) => [],
58
+ computeOutputs: (data) => [
59
+ { id: 'value', name: 'Значение', type: 'String' }
60
+ ],
61
+ defaultData: {}
62
+ },
63
+ {
64
+ type: 'data:number_literal',
65
+ label: '🔢 Число',
66
+ category: 'Данные',
67
+ description: 'Простое числовое значение.',
68
+ graphType: GRAPH_TYPES.ALL,
69
+ evaluator: require('../../core/nodes/data/number_literal').evaluate,
70
+ computeInputs: (data) => [
71
+ { id: 'value', name: 'Значение', type: 'Number', required: true, inlineField: true, placeholder: '0' }
72
+ ],
73
+ computeOutputs: (data) => [
74
+ { id: 'value', name: 'Значение', type: 'Number' }
75
+ ],
76
+ defaultData: { value: 0 }
77
+ },
78
+ {
79
+ type: 'data:boolean_literal',
80
+ label: '✔️ Булево',
81
+ category: 'Данные',
82
+ description: 'Значение Истина/Ложь.',
83
+ graphType: GRAPH_TYPES.ALL,
84
+ evaluator: require('../../core/nodes/data/boolean_literal').evaluate,
85
+ computeInputs: (data) => [
86
+ { id: 'value', name: 'Значение', type: 'Boolean', required: true, inlineField: true, placeholder: 'true' }
87
+ ],
88
+ computeOutputs: (data) => [
89
+ { id: 'value', name: 'Значение', type: 'Boolean' }
90
+ ],
91
+ defaultData: { value: true }
92
+ },
93
+ {
94
+ type: 'data:make_object',
95
+ label: '🏗️ Собрать объект',
96
+ category: 'Данные',
97
+ description: 'Создает JSON-объект из пар ключ-значение.',
98
+ graphType: GRAPH_TYPES.ALL,
99
+ dynamicPins: true,
100
+ evaluator: require('../../core/nodes/data/make_object').evaluate,
101
+ computeInputs: (data) => [],
102
+ computeOutputs: (data) => [
103
+ { id: 'value', name: 'Объект', type: 'Object' }
104
+ ],
105
+ defaultData: {}
106
+ },
107
+ {
108
+ type: 'data:cast',
109
+ label: '✨ Приведение типов',
110
+ category: 'Данные',
111
+ description: 'Приводит входящее значение к указанному целевому типу.',
112
+ graphType: GRAPH_TYPES.ALL,
113
+ evaluator: require('../../core/nodes/data/cast').evaluate,
114
+ computeInputs: (data) => [
115
+ { id: 'value', name: 'Значение', type: 'Wildcard', required: true }
116
+ ],
117
+ computeOutputs: (data) => [
118
+ { id: 'result', name: 'Результат', type: 'Wildcard' }
119
+ ],
120
+ defaultData: { targetType: 'String' }
121
+ },
122
+ {
123
+ type: 'data:type_check',
124
+ label: '🔍 Проверка типа',
125
+ category: 'Данные',
126
+ description: 'Проверяет тип входного значения.',
127
+ graphType: GRAPH_TYPES.ALL,
128
+ evaluator: require('../../core/nodes/data/type_check').evaluate,
129
+ computeInputs: (data) => [
130
+ { id: 'value', name: 'Значение', type: 'Wildcard', required: true }
131
+ ],
132
+ computeOutputs: (data) => [
133
+ { id: 'result', name: 'Совпадает?', type: 'Boolean', description: 'True, если значение соответствует выбранному типу' },
134
+ { id: 'type_name', name: 'Имя типа', type: 'String', description: 'Фактическое название типа значения' }
135
+ ],
136
+ defaultData: { checkType: 'String' }
137
+ },
138
+ {
139
+ type: 'data:get_server_players',
140
+ label: '👥 Список игроков',
141
+ category: 'Данные',
142
+ graphType: GRAPH_TYPES.ALL,
143
+ description: 'Возвращает массив с именами всех игроков на сервере.',
144
+ evaluator: require('../../core/nodes/data/get_server_players').evaluate,
145
+ computeInputs: (data) => [],
146
+ computeOutputs: (data) => [
147
+ { id: 'players', name: 'Игроки', type: 'Array' }
148
+ ],
149
+ defaultData: {}
150
+ },
151
+ {
152
+ type: 'data:get_nearby_entities',
153
+ label: '👁️ Получить существ рядом',
154
+ category: 'Данные',
155
+ description: 'Возвращает массив существ в радиусе от бота.',
156
+ graphType: GRAPH_TYPES.ALL,
157
+ evaluator: require('../../core/nodes/data/get_nearby_entities').evaluate,
158
+ computeInputs: (data) => [
159
+ { id: 'radius', name: 'Радиус', type: 'Number', required: false, inlineField: true, placeholder: '10' }
160
+ ],
161
+ computeOutputs: (data) => [
162
+ { id: 'entities', name: 'Существа', type: 'Array' }
163
+ ],
164
+ defaultData: { radius: 10 }
165
+ },
166
+ {
167
+ type: 'data:get_nearby_players',
168
+ label: '👥 Игроки рядом',
169
+ category: 'Данные',
170
+ description: 'Возвращает массив игроков с расстоянием.',
171
+ graphType: GRAPH_TYPES.ALL,
172
+ evaluator: require('../../core/nodes/data/get_nearby_players').evaluate,
173
+ computeInputs: (data) => [
174
+ { id: 'radius', name: 'Радиус', type: 'Number', required: false, inlineField: true, placeholder: '10' }
175
+ ],
176
+ computeOutputs: (data) => [
177
+ { id: 'players', name: 'Игроки', type: 'Array' }
178
+ ],
179
+ defaultData: { radius: 10 }
180
+ },
181
+ {
182
+ type: 'data:entity_info',
183
+ label: '🔍 Информация о существе',
184
+ category: 'Данные',
185
+ description: 'Извлекает данные из объекта существа.',
186
+ graphType: GRAPH_TYPES.ALL,
187
+ evaluator: require('../../core/nodes/data/entity_info').evaluate,
188
+ computeInputs: (data) => [
189
+ { id: 'entity', name: 'Существо', type: 'Object', required: true }
190
+ ],
191
+ computeOutputs: (data) => [
192
+ { id: 'type', name: 'Тип', type: 'String' },
193
+ { id: 'username', name: 'Имя', type: 'String' },
194
+ { id: 'distance', name: 'Расстояние', type: 'Number' },
195
+ { id: 'position', name: 'Позиция', type: 'Object' },
196
+ { id: 'id', name: 'ID', type: 'Number' },
197
+ { id: 'isPlayer', name: 'Это игрок?', type: 'Boolean' }
198
+ ],
199
+ defaultData: {}
200
+ },
201
+ {
202
+ type: 'data:get_user_field',
203
+ label: '👤 Данные пользователя',
204
+ category: 'Данные',
205
+ description: 'Получает различные данные из объекта пользователя.',
206
+ graphType: GRAPH_TYPES.ALL,
207
+ evaluator: require('../../core/nodes/data/get_user_field').evaluate,
208
+ computeInputs: (data) => [
209
+ { id: 'user', name: 'Пользователь', type: 'User', required: true }
210
+ ],
211
+ computeOutputs: (data) => [
212
+ { id: 'username', name: 'Никнейм', type: 'String' },
213
+ { id: 'groups', name: 'Группы', type: 'Array' },
214
+ { id: 'permissions', name: 'Права', type: 'Array' },
215
+ { id: 'isBlacklisted', name: 'В черном списке', type: 'Boolean' }
216
+ ],
217
+ defaultData: {}
218
+ },
219
+ {
220
+ type: 'data:length',
221
+ label: '📏 Размер (длина)',
222
+ category: 'Массив',
223
+ graphType: GRAPH_TYPES.ALL,
224
+ description: 'Возвращает количество элементов в массиве или длину строки.',
225
+ evaluator: require('../../core/nodes/data/length').evaluate,
226
+ computeInputs: (data) => [
227
+ { id: 'data', name: 'Массив или Строка', type: 'Any', required: true }
228
+ ],
229
+ computeOutputs: (data) => [
230
+ { id: 'length', name: 'Длина', type: 'Number' }
231
+ ],
232
+ defaultData: {}
233
+ },
234
+ {
235
+ type: 'data:array_literal',
236
+ label: '📋 Массив',
237
+ category: 'Массив',
238
+ description: 'Создает массив из элементов.',
239
+ graphType: GRAPH_TYPES.ALL,
240
+ dynamicPins: true,
241
+ evaluator: require('../../core/nodes/data/array_literal').evaluate,
242
+ computeInputs: (data) => [],
243
+ computeOutputs: (data) => [
244
+ { id: 'value', name: 'Массив', type: 'Array' }
245
+ ],
246
+ defaultData: {}
247
+ },
248
+ {
249
+ type: 'data:store_read',
250
+ label: 'Прочитать из Store',
251
+ category: 'Данные',
252
+ description: 'Читает значение из хранилища плагина (PluginDataStore) по ключу.',
253
+ graphType: GRAPH_TYPES.ALL,
254
+ evaluator: require('../../core/nodes/data/store_read').evaluate,
255
+ computeInputs: (data) => [
256
+ { id: 'plugin_name', name: 'Плагин', type: 'String', required: true, inlineField: true, placeholder: 'my-plugin' },
257
+ { id: 'key', name: 'Ключ', type: 'String', required: true, inlineField: true, placeholder: 'myKey' }
258
+ ],
259
+ computeOutputs: (data) => [
260
+ { id: 'value', name: 'Значение', type: 'Wildcard' }
261
+ ],
262
+ defaultData: { plugin_name: '', key: '' }
263
+ },
264
+ {
265
+ type: 'data:store_write',
266
+ label: 'Записать в Store',
267
+ category: 'Данные',
268
+ description: 'Сохраняет значение в хранилище плагина (PluginDataStore) по ключу.',
269
+ graphType: GRAPH_TYPES.ALL,
270
+ executor: require('../../core/nodes/data/store_write').execute,
271
+ computeInputs: (data) => [
272
+ { id: 'exec', name: 'Выполнить', type: 'Exec', required: true },
273
+ { id: 'plugin_name', name: 'Плагин', type: 'String', required: true, inlineField: true, placeholder: 'my-plugin' },
274
+ { id: 'key', name: 'Ключ', type: 'String', required: true, inlineField: true, placeholder: 'myKey' },
275
+ { id: 'value', name: 'Значение', type: 'Wildcard', required: true }
276
+ ],
277
+ computeOutputs: (data) => [
278
+ { id: 'exec', name: 'Далее', type: 'Exec' }
279
+ ],
280
+ defaultData: { plugin_name: '', key: '' }
281
+ }
282
+ ];
283
+
284
+ module.exports = dataNodes;
@@ -0,0 +1,23 @@
1
+ const { GRAPH_TYPES } = require('../../core/constants/graphTypes');
2
+
3
+ const debugNodes = [
4
+ {
5
+ type: 'debug:log',
6
+ label: '🐞 Отладка (консоль)',
7
+ category: 'Отладка',
8
+ description: 'Выводит значение в консоль терминала, где запущен бот.',
9
+ graphType: GRAPH_TYPES.ALL,
10
+ executor: require('../../core/nodes/debug/log').execute,
11
+ computeInputs: (data) => [
12
+ { id: 'exec', name: 'Exec', type: 'Exec' },
13
+ { id: 'value', name: 'Значение', type: 'Wildcard', required: true }
14
+ ],
15
+ computeOutputs: () => [
16
+ { id: 'exec', name: 'Exec', type: 'Exec' }
17
+ ],
18
+ defaultData: {},
19
+ theme: { headerColor: '#64748b', accentColor: '#94a3b8' }
20
+ }
21
+ ];
22
+
23
+ module.exports = debugNodes;
@@ -0,0 +1,223 @@
1
+ const { GRAPH_TYPES } = require('../../core/constants/graphTypes');
2
+
3
+ const eventsNodes = [
4
+ {
5
+ type: 'event:command',
6
+ label: '▶️ При выполнении команды',
7
+ category: 'События',
8
+ description: 'Стартовая точка для графа команды.',
9
+ graphType: GRAPH_TYPES.ALL,
10
+ computeInputs: () => [],
11
+ computeOutputs: (data) => [
12
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
13
+ { id: 'command_name', name: 'Имя команды', type: 'String' },
14
+ { id: 'user', name: 'Пользователь', type: 'User' },
15
+ { id: 'args', name: 'Аргументы', type: 'Object' },
16
+ { id: 'chat_type', name: 'Тип чата', type: 'String' },
17
+ { id: 'success', name: 'Успешно', type: 'Boolean', description: 'Возвращает true, если команда не попала на ошибку' }
18
+ ],
19
+ defaultData: {},
20
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
21
+ },
22
+ {
23
+ type: 'event:chat',
24
+ label: '💬 Сообщение в чате',
25
+ category: 'События',
26
+ description: 'Срабатывает, когда в чат приходит сообщение.',
27
+ graphType: GRAPH_TYPES.EVENT,
28
+ computeInputs: () => [],
29
+ computeOutputs: (data) => [
30
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
31
+ { id: 'username', name: 'Игрок', type: 'String' },
32
+ { id: 'message', name: 'Сообщение', type: 'String' },
33
+ { id: 'chatType', name: 'Тип чата', type: 'String' }
34
+ ],
35
+ defaultData: {},
36
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
37
+ },
38
+ {
39
+ type: 'event:raw_message',
40
+ label: '📝 Сырое сообщение',
41
+ category: 'События',
42
+ description: 'Срабатывает при получении любого сообщения в сыром виде.',
43
+ graphType: GRAPH_TYPES.EVENT,
44
+ computeInputs: () => [],
45
+ computeOutputs: (data) => [
46
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
47
+ { id: 'rawText', name: 'Сырой текст', type: 'String' }
48
+ ],
49
+ defaultData: {},
50
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
51
+ },
52
+ {
53
+ type: 'event:playerJoined',
54
+ label: '👋 Игрок зашел',
55
+ category: 'События',
56
+ description: 'Срабатывает, когда игрок заходит на сервер.',
57
+ graphType: GRAPH_TYPES.EVENT,
58
+ computeInputs: () => [],
59
+ computeOutputs: (data) => [
60
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
61
+ { id: 'user', name: 'Пользователь', type: 'User' }
62
+ ],
63
+ defaultData: {},
64
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
65
+ },
66
+ {
67
+ type: 'event:playerLeft',
68
+ label: '🚪 Игрок вышел',
69
+ category: 'События',
70
+ description: 'Срабатывает, когда игрок покидает сервер.',
71
+ graphType: GRAPH_TYPES.EVENT,
72
+ computeInputs: () => [],
73
+ computeOutputs: (data) => [
74
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
75
+ { id: 'user', name: 'Пользователь', type: 'User' }
76
+ ],
77
+ defaultData: {},
78
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
79
+ },
80
+ {
81
+ type: 'event:entitySpawn',
82
+ label: '📦 Сущность появилась',
83
+ category: 'События',
84
+ description: 'Вызывается, когда новая сущность появляется в поле зрения бота.',
85
+ graphType: GRAPH_TYPES.EVENT,
86
+ computeInputs: () => [],
87
+ computeOutputs: (data) => [
88
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
89
+ { id: 'entity', name: 'Сущность', type: 'Object' }
90
+ ],
91
+ defaultData: {},
92
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
93
+ },
94
+ {
95
+ type: 'event:entityMoved',
96
+ label: '🧍 Сущность подвинулась',
97
+ category: 'События',
98
+ description: 'Вызывается, когда любая сущность перемещается.',
99
+ graphType: GRAPH_TYPES.EVENT,
100
+ computeInputs: () => [],
101
+ computeOutputs: (data) => [
102
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
103
+ { id: 'entity', name: 'Сущность', type: 'Object' }
104
+ ],
105
+ defaultData: {},
106
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
107
+ },
108
+ {
109
+ type: 'event:entityGone',
110
+ label: '❌ Сущность исчезла',
111
+ category: 'События',
112
+ description: 'Вызывается, когда сущность пропадает из зоны видимости бота.',
113
+ graphType: GRAPH_TYPES.EVENT,
114
+ computeInputs: () => [],
115
+ computeOutputs: (data) => [
116
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
117
+ { id: 'entity', name: 'Сущность', type: 'Object' }
118
+ ],
119
+ defaultData: {},
120
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
121
+ },
122
+ {
123
+ type: 'event:botDied',
124
+ label: '💀 Бот умер',
125
+ category: 'События',
126
+ description: 'Срабатывает, когда бот умирает.',
127
+ graphType: GRAPH_TYPES.EVENT,
128
+ computeInputs: () => [],
129
+ computeOutputs: (data) => [
130
+ { id: 'exec', name: 'Выполнить', type: 'Exec' }
131
+ ],
132
+ defaultData: {},
133
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
134
+ },
135
+ {
136
+ type: 'event:botStartup',
137
+ label: '🚀 При запуске бота',
138
+ category: 'События',
139
+ description: 'Срабатывает один раз при запуске бота.',
140
+ graphType: GRAPH_TYPES.EVENT,
141
+ computeInputs: () => [],
142
+ computeOutputs: (data) => [
143
+ { id: 'exec', name: 'Выполнить', type: 'Exec' }
144
+ ],
145
+ defaultData: {},
146
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
147
+ },
148
+ {
149
+ type: 'event:health',
150
+ label: '❤️ Здоровье/Голод изменилось',
151
+ category: 'События',
152
+ description: 'Срабатывает при изменении здоровья, голода или насыщения бота.',
153
+ graphType: GRAPH_TYPES.EVENT,
154
+ computeInputs: () => [],
155
+ computeOutputs: (data) => [
156
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
157
+ { id: 'health', name: 'Здоровье', type: 'Number' },
158
+ { id: 'food', name: 'Голод', type: 'Number' },
159
+ { id: 'saturation', name: 'Насыщение', type: 'Number' }
160
+ ],
161
+ defaultData: {},
162
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
163
+ },
164
+ {
165
+ type: 'event:websocket_call',
166
+ label: '📡 Вызов из WebSocket API',
167
+ category: 'События',
168
+ description: 'Срабатывает, когда граф вызывается через WebSocket API.',
169
+ graphType: GRAPH_TYPES.EVENT,
170
+ computeInputs: () => [],
171
+ computeOutputs: (data) => [
172
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
173
+ { id: 'graphName', name: 'Имя графа', type: 'String' },
174
+ { id: 'data', name: 'Данные', type: 'Object' },
175
+ { id: 'socketId', name: 'Socket ID', type: 'String' },
176
+ { id: 'keyPrefix', name: 'API ключ (префикс)', type: 'String' }
177
+ ],
178
+ defaultData: {},
179
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
180
+ },
181
+ {
182
+ type: 'event:custom_event',
183
+ label: '▶️ Событие',
184
+ category: 'События',
185
+ description: 'Стартовая нода пользовательского события с динамическими параметрами',
186
+ graphType: GRAPH_TYPES.EVENT,
187
+ computeInputs: () => [],
188
+ computeOutputs: (data) => [
189
+ { id: 'exec', name: 'Выполнить', type: 'Exec' },
190
+ ...(data.pins || []).map((pin) => ({ id: pin.id, name: pin.name, type: pin.type }))
191
+ ],
192
+ evaluator: require('../../core/nodes/event/custom_event').evaluate,
193
+ defaultData: { pins: [] },
194
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
195
+ },
196
+ {
197
+ type: 'event:call_event',
198
+ label: 'Вызвать событие',
199
+ category: 'Управление',
200
+ description: 'Вызывает пользовательское событие и передаёт параметры',
201
+ graphType: GRAPH_TYPES.ALL,
202
+ computeInputs: (data, context) => {
203
+ const pins = [{ id: 'exec', name: 'Выполнить', type: 'Exec' }];
204
+ if (data.selectedEventId != null) {
205
+ const selectedNode = (context.nodes || []).find(n => n.id === data.selectedEventId);
206
+ if (selectedNode && selectedNode.type === 'event:custom_event') {
207
+ (selectedNode.data.pins || [])
208
+ .filter(pin => pin.type !== 'Exec')
209
+ .forEach(pin => pins.push({ id: pin.id, name: pin.name, type: pin.type }));
210
+ }
211
+ }
212
+ return pins;
213
+ },
214
+ computeOutputs: () => [
215
+ { id: 'exec', name: 'Выполнить', type: 'Exec' }
216
+ ],
217
+ executor: require('../../core/nodes/event/call_event').executor,
218
+ defaultData: { selectedEventId: null },
219
+ theme: { headerColor: '#8b5cf6', accentColor: '#a78bfa' }
220
+ }
221
+ ];
222
+
223
+ module.exports = eventsNodes;