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
@@ -1,202 +0,0 @@
1
- const { GRAPH_TYPES } = require('../constants/graphTypes');
2
-
3
- /**
4
- * Регистрация нод категории "Действия"
5
- */
6
- function registerNodes(registry) {
7
- registry.registerNodeType({
8
- type: 'action:send_message',
9
- label: '🗣️ Отправить сообщение',
10
- category: 'Действия',
11
- description: 'Отправляет сообщение в чат. Поддерживает переменные в формате {varName}',
12
- graphType: GRAPH_TYPES.ALL,
13
- executor: require('../nodes/actions/send_message').execute,
14
- pins: {
15
- inputs: [
16
- { id: 'exec', name: 'Выполнить', type: 'Exec', required: true },
17
- { id: 'chat_type', name: 'Тип чата', type: 'String', required: true },
18
- { id: 'message', name: 'Сообщение', type: 'String', required: true },
19
- { id: 'recipient', name: 'Адресат', type: 'String', required: false }
20
- ],
21
- outputs: [
22
- { id: 'exec', name: 'Выполнено', type: 'Exec' }
23
- ]
24
- }
25
- });
26
-
27
- registry.registerNodeType({
28
- type: 'action:send_log',
29
- label: '📝 Записать в лог (веб)',
30
- category: 'Действия',
31
- description: 'Отправляет сообщение в консоль на странице бота.',
32
- graphType: GRAPH_TYPES.ALL,
33
- executor: require('../nodes/actions/send_log').execute,
34
- pins: {
35
- inputs: [
36
- { id: 'exec', name: 'Выполнить', type: 'Exec', required: true },
37
- { id: 'message', name: 'Сообщение', type: 'String', required: true },
38
- ],
39
- outputs: [
40
- { id: 'exec', name: 'Выполнено', type: 'Exec' },
41
- ]
42
- }
43
- });
44
-
45
- registry.registerNodeType({
46
- type: 'action:send_websocket_response',
47
- label: '📤 Отправить ответ в WebSocket',
48
- category: 'WebSocket API',
49
- description: 'Отправляет данные обратно клиенту, вызвавшему граф через WebSocket API.',
50
- graphType: GRAPH_TYPES.EVENT,
51
- executor: require('../nodes/actions/send_websocket_response').execute,
52
- pins: {
53
- inputs: [
54
- { id: 'exec', name: 'Выполнить', type: 'Exec', required: true },
55
- { id: 'data', name: 'Данные', type: 'Wildcard', required: true }
56
- ],
57
- outputs: [
58
- { id: 'exec', name: 'Выполнено', type: 'Exec' }
59
- ]
60
- }
61
- });
62
-
63
- registry.registerNodeType({
64
- type: 'action:bot_look_at',
65
- label: '🤖 Бот: Посмотреть на',
66
- category: 'Действия',
67
- description: 'Поворачивает голову бота в сторону координат или сущности.',
68
- graphType: GRAPH_TYPES.ALL,
69
- executor: require('../nodes/actions/bot_look_at').execute,
70
- pins: {
71
- inputs: [
72
- { id: 'exec', name: 'Выполнить', type: 'Exec', required: true },
73
- { id: 'target', name: 'Цель (Позиция/Сущность)', type: 'Object', required: true },
74
- { id: 'add_y', name: 'Прибавить к Y', type: 'Number', required: false }
75
- ],
76
- outputs: [
77
- { id: 'exec', name: 'Выполнено', type: 'Exec' }
78
- ]
79
- }
80
- });
81
-
82
- registry.registerNodeType({
83
- type: 'action:bot_set_variable',
84
- label: '💾 Записать переменную',
85
- category: 'Действия',
86
- description: 'Сохраняет значение в переменную графа.',
87
- graphType: GRAPH_TYPES.ALL,
88
- executor: require('../nodes/actions/bot_set_variable').execute,
89
- pins: {
90
- inputs: [
91
- { id: 'exec', name: 'Выполнить', type: 'Exec', required: true },
92
- { id: 'name', name: 'Имя', type: 'String', required: true },
93
- { id: 'value', name: 'Значение', type: 'Wildcard', required: true },
94
- { id: 'persist', name: 'Хранить в БД?', type: 'Boolean', required: false }
95
- ],
96
- outputs: [
97
- { id: 'exec', name: 'Выполнено', type: 'Exec' }
98
- ]
99
- }
100
- });
101
-
102
- registry.registerNodeType({
103
- type: 'action:http_request',
104
- label: '🌐 HTTP-запрос',
105
- category: 'Действия',
106
- description: 'Выполняет HTTP-запрос (GET, POST, PUT, DELETE и т.д.) и возвращает ответ.',
107
- graphType: GRAPH_TYPES.ALL,
108
- executor: require('../nodes/actions/http_request').execute,
109
- pins: {
110
- inputs: [
111
- { id: 'exec', name: 'Выполнить', type: 'Exec', required: true },
112
- { id: 'url', name: 'URL', type: 'String', required: true },
113
- { id: 'method', name: 'Метод', type: 'String', required: false },
114
- { id: 'queryParams', name: 'Query Params', type: 'Object', required: false },
115
- { id: 'headers', name: 'Headers', type: 'Object', required: false },
116
- { id: 'body', name: 'Тело (JSON)', type: 'Wildcard', required: false },
117
- { id: 'timeout', name: 'Таймаут (мс)', type: 'Number', required: false }
118
- ],
119
- outputs: [
120
- { id: 'exec', name: 'Успех', type: 'Exec' },
121
- { id: 'exec_error', name: 'Ошибка', type: 'Exec' },
122
- { id: 'status', name: 'Статус', type: 'Number' },
123
- { id: 'response', name: 'Ответ', type: 'Wildcard' },
124
- { id: 'response_headers', name: 'Заголовки ответа', type: 'Object' },
125
- { id: 'success', name: 'Успешно', type: 'Boolean' },
126
- { id: 'error', name: 'Ошибка', type: 'String' }
127
- ]
128
- }
129
- });
130
-
131
- registry.registerNodeType({
132
- type: 'action:create_command',
133
- label: '➕ Создать команду',
134
- category: 'Действия',
135
- description: 'Создает новую команду (временную или постоянную)',
136
- graphType: GRAPH_TYPES.ALL,
137
- executor: require('../nodes/actions/create_command').execute,
138
- pins: {
139
- inputs: [
140
- { id: 'exec', name: 'Выполнить', type: 'Exec', required: true },
141
- { id: 'name', name: 'Имя команды', type: 'String', required: true },
142
- { id: 'description', name: 'Описание', type: 'String', required: false },
143
- { id: 'aliases', name: 'Алиасы', type: 'Array', required: false },
144
- { id: 'cooldown', name: 'Кулдаун (сек)', type: 'Number', required: false },
145
- { id: 'allowedChatTypes', name: 'Типы чата', type: 'Array', required: false },
146
- { id: 'permissionName', name: 'Название права', type: 'String', required: false },
147
- { id: 'temporary', name: 'Временная?', type: 'Boolean', required: false }
148
- ],
149
- outputs: [
150
- { id: 'exec', name: 'Выполнено', type: 'Exec' },
151
- { id: 'commandId', name: 'ID команды', type: 'Number' },
152
- { id: 'success', name: 'Успешно', type: 'Boolean' }
153
- ]
154
- }
155
- });
156
-
157
- registry.registerNodeType({
158
- type: 'action:update_command',
159
- label: '✏️ Редактировать команду',
160
- category: 'Действия',
161
- description: 'Изменяет параметры существующей команды',
162
- graphType: GRAPH_TYPES.ALL,
163
- executor: require('../nodes/actions/update_command').execute,
164
- pins: {
165
- inputs: [
166
- { id: 'exec', name: 'Выполнить', type: 'Exec', required: true },
167
- { id: 'commandName', name: 'Имя команды', type: 'String', required: true },
168
- { id: 'newName', name: 'Новое имя', type: 'String', required: false },
169
- { id: 'description', name: 'Описание', type: 'String', required: false },
170
- { id: 'aliases', name: 'Алиасы', type: 'Array', required: false },
171
- { id: 'cooldown', name: 'Кулдаун (сек)', type: 'Number', required: false },
172
- { id: 'allowedChatTypes', name: 'Типы чата', type: 'Array', required: false },
173
- { id: 'permissionName', name: 'Название права', type: 'String', required: false }
174
- ],
175
- outputs: [
176
- { id: 'exec', name: 'Выполнено', type: 'Exec' },
177
- { id: 'success', name: 'Успешно', type: 'Boolean' }
178
- ]
179
- }
180
- });
181
-
182
- registry.registerNodeType({
183
- type: 'action:delete_command',
184
- label: '🗑️ Удалить команду',
185
- category: 'Действия',
186
- description: 'Удаляет существующую команду бота',
187
- graphType: GRAPH_TYPES.ALL,
188
- executor: require('../nodes/actions/delete_command').execute,
189
- pins: {
190
- inputs: [
191
- { id: 'exec', name: 'Выполнить', type: 'Exec', required: true },
192
- { id: 'commandName', name: 'Имя команды', type: 'String', required: true }
193
- ],
194
- outputs: [
195
- { id: 'exec', name: 'Выполнено', type: 'Exec' },
196
- { id: 'success', name: 'Успешно', type: 'Boolean' }
197
- ]
198
- }
199
- });
200
- }
201
-
202
- module.exports = { registerNodes };
@@ -1,155 +0,0 @@
1
- const { GRAPH_TYPES } = require('../constants/graphTypes');
2
-
3
- /**
4
- * Регистрация нод категории "Массивы"
5
- */
6
- function registerNodes(registry) {
7
- registry.registerNodeType({
8
- type: 'array:get_random_element',
9
- label: '🎲 Случайный элемент',
10
- category: 'Массив',
11
- graphType: GRAPH_TYPES.ALL,
12
- description: 'Возвращает случайный элемент из массива и его индекс.',
13
- evaluator: require('../nodes/arrays/get_random_element').evaluate,
14
- pins: {
15
- inputs: [
16
- { id: 'array', name: 'Массив', type: 'Array', required: true }
17
- ],
18
- outputs: [
19
- { id: 'element', name: 'Элемент', type: 'Any' },
20
- { id: 'index', name: 'Индекс', type: 'Number' }
21
- ]
22
- }
23
- });
24
-
25
- registry.registerNodeType({
26
- type: 'array:contains',
27
- label: '🔍 Массив: Содержит',
28
- category: 'Массив',
29
- description: 'Проверяет, содержит ли массив указанный элемент и возвращает его индекс.',
30
- graphType: GRAPH_TYPES.ALL,
31
- evaluator: require('../nodes/arrays/contains').evaluate,
32
- pins: {
33
- inputs: [
34
- { id: 'array', name: 'Массив', type: 'Array', required: true },
35
- { id: 'element', name: 'Элемент', type: 'Wildcard', required: true }
36
- ],
37
- outputs: [
38
- { id: 'result', name: 'Найден', type: 'Boolean' },
39
- { id: 'index', name: 'Индекс', type: 'Number' }
40
- ]
41
- }
42
- });
43
-
44
- registry.registerNodeType({
45
- type: 'array:get_by_index',
46
- label: '📦 Элемент по индексу',
47
- category: 'Массив',
48
- description: 'Получает элемент массива по его индексу.',
49
- graphType: GRAPH_TYPES.ALL,
50
- evaluator: require('../nodes/arrays/get_by_index').evaluate,
51
- pins: {
52
- inputs: [
53
- { id: 'array', name: 'Массив', type: 'Array', required: true },
54
- { id: 'index', name: 'Индекс', type: 'Number', required: true }
55
- ],
56
- outputs: [
57
- { id: 'element', name: 'Элемент', type: 'Any' }
58
- ]
59
- }
60
- });
61
-
62
- registry.registerNodeType({
63
- type: 'array:get_next',
64
- label: '➡️ Следующий элемент',
65
- category: 'Массив',
66
- description: 'Получает следующий элемент массива.',
67
- graphType: GRAPH_TYPES.ALL,
68
- evaluator: require('../nodes/arrays/get_next').evaluate,
69
- pins: {
70
- inputs: [
71
- { id: 'array', name: 'Массив', type: 'Array', required: true },
72
- { id: 'current_index', name: 'Текущий индекс', type: 'Number', required: true }
73
- ],
74
- outputs: [
75
- { id: 'next_element', name: 'Следующий элемент', type: 'Any' },
76
- { id: 'next_index', name: 'Следующий индекс', type: 'Number' },
77
- { id: 'has_next', name: 'Есть следующий?', type: 'Boolean', description: 'True, если следующий элемент существует' }
78
- ]
79
- }
80
- });
81
-
82
- registry.registerNodeType({
83
- type: 'array:add_element',
84
- label: '➕ Добавить элемент',
85
- category: 'Массив',
86
- description: 'Добавляет элемент в конец массива.',
87
- graphType: GRAPH_TYPES.ALL,
88
- evaluator: require('../nodes/arrays/add_element').evaluate,
89
- pins: {
90
- inputs: [
91
- { id: 'array', name: 'Массив', type: 'Array', required: true },
92
- { id: 'element', name: 'Элемент', type: 'Wildcard', required: true }
93
- ],
94
- outputs: [
95
- { id: 'result', name: 'Новый массив', type: 'Array' }
96
- ]
97
- }
98
- });
99
-
100
- registry.registerNodeType({
101
- type: 'array:remove_by_index',
102
- label: '➖ Удалить по индексу',
103
- category: 'Массив',
104
- description: 'Удаляет элемент из массива по его индексу.',
105
- graphType: GRAPH_TYPES.ALL,
106
- evaluator: require('../nodes/arrays/remove_by_index').evaluate,
107
- pins: {
108
- inputs: [
109
- { id: 'array', name: 'Массив', type: 'Array', required: true },
110
- { id: 'index', name: 'Индекс', type: 'Number', required: true }
111
- ],
112
- outputs: [
113
- { id: 'result', name: 'Новый массив', type: 'Array' }
114
- ]
115
- }
116
- });
117
-
118
- registry.registerNodeType({
119
- type: 'array:find_index',
120
- label: '🔍 Найти индекс',
121
- category: 'Массив',
122
- description: 'Находит индекс элемента в массиве (или -1 если не найден).',
123
- graphType: GRAPH_TYPES.ALL,
124
- evaluator: require('../nodes/arrays/find_index').evaluate,
125
- pins: {
126
- inputs: [
127
- { id: 'array', name: 'Массив', type: 'Array', required: true },
128
- { id: 'element', name: 'Элемент', type: 'Wildcard', required: true }
129
- ],
130
- outputs: [
131
- { id: 'index', name: 'Индекс', type: 'Number' }
132
- ]
133
- }
134
- });
135
-
136
- registry.registerNodeType({
137
- type: 'array:join',
138
- label: '🔗 Объединить в строку',
139
- category: 'Массив',
140
- description: 'Объединяет элементы массива в строку с разделителем.',
141
- graphType: GRAPH_TYPES.ALL,
142
- evaluator: require('../nodes/arrays/join').evaluate,
143
- pins: {
144
- inputs: [
145
- { id: 'array', name: 'Массив', type: 'Array', required: false },
146
- { id: 'separator', name: 'Разделитель', type: 'String', required: false }
147
- ],
148
- outputs: [
149
- { id: 'result', name: 'Result', type: 'String' }
150
- ]
151
- }
152
- });
153
- }
154
-
155
- module.exports = { registerNodes };
@@ -1,23 +0,0 @@
1
- const { GRAPH_TYPES } = require('../constants/graphTypes');
2
-
3
- /**
4
- * Регистрация нод категории "Бот"
5
- */
6
- function registerNodes(registry) {
7
- registry.registerNodeType({
8
- type: 'bot:get_position',
9
- label: '🤖 Позиция бота',
10
- category: 'Бот',
11
- description: 'Возвращает текущую позицию бота в мире.',
12
- graphType: GRAPH_TYPES.ALL,
13
- evaluator: require('../nodes/bot/get_position').evaluate,
14
- pins: {
15
- inputs: [],
16
- outputs: [
17
- { id: 'position', name: 'Позиция', type: 'Object' }
18
- ]
19
- }
20
- });
21
- }
22
-
23
- module.exports = { registerNodes };
@@ -1,162 +0,0 @@
1
- const { GRAPH_TYPES } = require('../constants/graphTypes');
2
-
3
- /**
4
- * Регистрация нод категории "Контейнеры"
5
- */
6
- function registerNodes(registry) {
7
- console.log('[Container Registry] Registering container nodes...');
8
-
9
- // ACTION NODES (с exec пинами) - используют executor
10
-
11
- registry.registerNodeType({
12
- type: 'container:open',
13
- label: '📦 Контейнер: открыть',
14
- category: 'Контейнеры',
15
- description: 'Открывает контейнер (сундук, бочку) по координатам.',
16
- graphType: GRAPH_TYPES.ALL,
17
- executor: require('../nodes/container/open').execute,
18
- evaluator: require('../nodes/container/open').evaluate,
19
- pins: {
20
- inputs: [
21
- { id: 'exec', name: 'Выполнить', type: 'Exec' },
22
- { id: 'x', name: 'X', type: 'Number', required: false },
23
- { id: 'y', name: 'Y', type: 'Number', required: false },
24
- { id: 'z', name: 'Z', type: 'Number', required: false }
25
- ],
26
- outputs: [
27
- { id: 'exec', name: 'Открыт', type: 'Exec' },
28
- { id: 'exec_failed', name: 'Ошибка', type: 'Exec' },
29
- { id: 'container', name: 'Контейнер', type: 'Object' },
30
- { id: 'success', name: 'Успех?', type: 'Boolean' }
31
- ]
32
- }
33
- });
34
-
35
- registry.registerNodeType({
36
- type: 'container:close',
37
- label: '📦 Контейнер: закрыть',
38
- category: 'Контейнеры',
39
- description: 'Закрывает текущий открытый контейнер.',
40
- graphType: GRAPH_TYPES.ALL,
41
- executor: require('../nodes/container/close').execute,
42
- pins: {
43
- inputs: [
44
- { id: 'exec', name: 'Выполнить', type: 'Exec' }
45
- ],
46
- outputs: [
47
- { id: 'exec', name: 'Закрыт', type: 'Exec' }
48
- ]
49
- }
50
- });
51
-
52
- registry.registerNodeType({
53
- type: 'container:deposit',
54
- label: '📦 Контейнер: положить',
55
- category: 'Контейнеры',
56
- description: 'Кладёт предмет из инвентаря в открытый контейнер.',
57
- graphType: GRAPH_TYPES.ALL,
58
- executor: require('../nodes/container/deposit').execute,
59
- evaluator: require('../nodes/container/deposit').evaluate,
60
- pins: {
61
- inputs: [
62
- { id: 'exec', name: 'Выполнить', type: 'Exec' },
63
- { id: 'itemName', name: 'Предмет', type: 'String', required: true },
64
- { id: 'count', name: 'Кол-во', type: 'Number', required: false }
65
- ],
66
- outputs: [
67
- { id: 'exec', name: 'Готово', type: 'Exec' },
68
- { id: 'exec_failed', name: 'Ошибка', type: 'Exec' },
69
- { id: 'deposited', name: 'Положено', type: 'Number' },
70
- { id: 'success', name: 'Успех?', type: 'Boolean' }
71
- ]
72
- }
73
- });
74
-
75
- registry.registerNodeType({
76
- type: 'container:withdraw',
77
- label: '📦 Контейнер: забрать',
78
- category: 'Контейнеры',
79
- description: 'Забирает предмет из контейнера в инвентарь.',
80
- graphType: GRAPH_TYPES.ALL,
81
- executor: require('../nodes/container/withdraw').execute,
82
- evaluator: require('../nodes/container/withdraw').evaluate,
83
- pins: {
84
- inputs: [
85
- { id: 'exec', name: 'Выполнить', type: 'Exec' },
86
- { id: 'itemName', name: 'Предмет', type: 'String', required: true },
87
- { id: 'count', name: 'Кол-во', type: 'Number', required: false }
88
- ],
89
- outputs: [
90
- { id: 'exec', name: 'Готово', type: 'Exec' },
91
- { id: 'exec_failed', name: 'Ошибка', type: 'Exec' },
92
- { id: 'withdrawn', name: 'Забрано', type: 'Number' },
93
- { id: 'success', name: 'Успех?', type: 'Boolean' }
94
- ]
95
- }
96
- });
97
-
98
- registry.registerNodeType({
99
- type: 'container:deposit_all',
100
- label: '📦 Контейнер: положить всё',
101
- category: 'Контейнеры',
102
- description: 'Кладёт все предметы (или определённого типа) в контейнер.',
103
- graphType: GRAPH_TYPES.ALL,
104
- executor: require('../nodes/container/deposit_all').execute,
105
- evaluator: require('../nodes/container/deposit_all').evaluate,
106
- pins: {
107
- inputs: [
108
- { id: 'exec', name: 'Выполнить', type: 'Exec' },
109
- { id: 'itemName', name: 'Предмет', type: 'String', required: false },
110
- { id: 'keepOne', name: 'Оставить 1', type: 'Boolean', required: false }
111
- ],
112
- outputs: [
113
- { id: 'exec', name: 'Готово', type: 'Exec' },
114
- { id: 'deposited', name: 'Положено', type: 'Number' }
115
- ]
116
- }
117
- });
118
-
119
- // DATA NODES (без exec пинов) - используют только evaluator
120
-
121
- registry.registerNodeType({
122
- type: 'container:get_items',
123
- label: '📦 Контейнер: содержимое',
124
- category: 'Контейнеры',
125
- description: 'Получает список предметов из открытого контейнера.',
126
- graphType: GRAPH_TYPES.ALL,
127
- evaluator: require('../nodes/container/get_items').evaluate,
128
- pins: {
129
- inputs: [
130
- { id: 'container', name: 'Контейнер', type: 'Object', required: false }
131
- ],
132
- outputs: [
133
- { id: 'items', name: 'Предметы', type: 'Array' },
134
- { id: 'count', name: 'Кол-во слотов', type: 'Number' }
135
- ]
136
- }
137
- });
138
-
139
- registry.registerNodeType({
140
- type: 'container:find_item',
141
- label: '📦 Контейнер: найти предмет',
142
- category: 'Контейнеры',
143
- description: 'Ищет предмет в открытом контейнере.',
144
- graphType: GRAPH_TYPES.ALL,
145
- evaluator: require('../nodes/container/find_item').evaluate,
146
- pins: {
147
- inputs: [
148
- { id: 'itemName', name: 'Предмет', type: 'String', required: true }
149
- ],
150
- outputs: [
151
- { id: 'item', name: 'Предмет', type: 'Object' },
152
- { id: 'slot', name: 'Слот', type: 'Number' },
153
- { id: 'count', name: 'Кол-во', type: 'Number' },
154
- { id: 'found', name: 'Найден?', type: 'Boolean' }
155
- ]
156
- }
157
- });
158
-
159
- console.log('[Container Registry] Container nodes registered successfully');
160
- }
161
-
162
- module.exports = { registerNodes };