@johpaz/hive 1.7.2 → 1.7.3

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 (427) hide show
  1. package/README.md +178 -36
  2. package/dist/hive.js +315124 -0
  3. package/package.json +11 -3
  4. package/packages/core/src/index.ts +0 -1
  5. package/.dockerignore +0 -9
  6. package/CONTRIBUTING.md +0 -44
  7. package/Dockerfile +0 -67
  8. package/docker-compose.yml +0 -19
  9. package/packages/cli/package.json +0 -28
  10. package/packages/cli/src/commands/agent-run.ts +0 -168
  11. package/packages/cli/src/commands/agents.ts +0 -398
  12. package/packages/cli/src/commands/chat.ts +0 -142
  13. package/packages/cli/src/commands/config.ts +0 -50
  14. package/packages/cli/src/commands/cron.ts +0 -161
  15. package/packages/cli/src/commands/dev.ts +0 -95
  16. package/packages/cli/src/commands/doctor.ts +0 -133
  17. package/packages/cli/src/commands/gateway.ts +0 -422
  18. package/packages/cli/src/commands/logs.ts +0 -57
  19. package/packages/cli/src/commands/mcp.ts +0 -175
  20. package/packages/cli/src/commands/message.ts +0 -77
  21. package/packages/cli/src/commands/onboard.ts +0 -1696
  22. package/packages/cli/src/commands/security.ts +0 -144
  23. package/packages/cli/src/commands/service.ts +0 -50
  24. package/packages/cli/src/commands/sessions.ts +0 -116
  25. package/packages/cli/src/commands/skills.ts +0 -187
  26. package/packages/cli/src/commands/update.ts +0 -25
  27. package/packages/cli/src/index.ts +0 -190
  28. package/packages/cli/src/utils/token.ts +0 -6
  29. package/packages/code-bridge/README.md +0 -78
  30. package/packages/code-bridge/package.json +0 -18
  31. package/packages/code-bridge/src/index.ts +0 -95
  32. package/packages/code-bridge/src/process-manager.ts +0 -212
  33. package/packages/code-bridge/src/schemas.ts +0 -133
  34. package/packages/core/package.json +0 -55
  35. package/packages/core/src/agent/agent-loop.ts +0 -520
  36. package/packages/core/src/agent/compaction.ts +0 -183
  37. package/packages/core/src/agent/context-compiler.ts +0 -544
  38. package/packages/core/src/agent/context-guard.ts +0 -91
  39. package/packages/core/src/agent/conversation-store.ts +0 -193
  40. package/packages/core/src/agent/curator.ts +0 -158
  41. package/packages/core/src/agent/hooks.ts +0 -166
  42. package/packages/core/src/agent/llm-client.ts +0 -503
  43. package/packages/core/src/agent/native-tools.ts +0 -31
  44. package/packages/core/src/agent/playbook-selector.ts +0 -143
  45. package/packages/core/src/agent/prompt-builder.ts +0 -167
  46. package/packages/core/src/agent/providers/index.ts +0 -186
  47. package/packages/core/src/agent/providers.ts +0 -1
  48. package/packages/core/src/agent/reflector.ts +0 -200
  49. package/packages/core/src/agent/service.ts +0 -266
  50. package/packages/core/src/agent/skill-selector.ts +0 -413
  51. package/packages/core/src/agent/stuck-loop.ts +0 -133
  52. package/packages/core/src/agent/tool-selector.ts +0 -623
  53. package/packages/core/src/agent/tracer.ts +0 -102
  54. package/packages/core/src/canvas/canvas-manager.ts +0 -319
  55. package/packages/core/src/canvas/canvas-tools.ts +0 -420
  56. package/packages/core/src/canvas/emitter.ts +0 -119
  57. package/packages/core/src/canvas/index.ts +0 -2
  58. package/packages/core/src/channels/base.ts +0 -140
  59. package/packages/core/src/channels/discord.ts +0 -260
  60. package/packages/core/src/channels/index.ts +0 -7
  61. package/packages/core/src/channels/manager.ts +0 -383
  62. package/packages/core/src/channels/slack.ts +0 -287
  63. package/packages/core/src/channels/telegram.ts +0 -552
  64. package/packages/core/src/channels/webchat.ts +0 -139
  65. package/packages/core/src/channels/whatsapp.ts +0 -375
  66. package/packages/core/src/config/index.ts +0 -12
  67. package/packages/core/src/config/loader.ts +0 -529
  68. package/packages/core/src/events/agent-bus.ts +0 -460
  69. package/packages/core/src/events/event-bus.ts +0 -169
  70. package/packages/core/src/gateway/helpers/cors.ts +0 -32
  71. package/packages/core/src/gateway/helpers/index.ts +0 -4
  72. package/packages/core/src/gateway/helpers/narration.ts +0 -60
  73. package/packages/core/src/gateway/helpers/path.ts +0 -13
  74. package/packages/core/src/gateway/helpers/redact.ts +0 -61
  75. package/packages/core/src/gateway/index.ts +0 -5
  76. package/packages/core/src/gateway/initializer.ts +0 -332
  77. package/packages/core/src/gateway/lane-queue.ts +0 -169
  78. package/packages/core/src/gateway/resolver.ts +0 -108
  79. package/packages/core/src/gateway/router.ts +0 -124
  80. package/packages/core/src/gateway/routes/agents.ts +0 -187
  81. package/packages/core/src/gateway/routes/channels.ts +0 -203
  82. package/packages/core/src/gateway/routes/chat.ts +0 -241
  83. package/packages/core/src/gateway/routes/config.ts +0 -12
  84. package/packages/core/src/gateway/routes/cron.ts +0 -42
  85. package/packages/core/src/gateway/routes/ethics.ts +0 -46
  86. package/packages/core/src/gateway/routes/mcp.ts +0 -346
  87. package/packages/core/src/gateway/routes/models.ts +0 -93
  88. package/packages/core/src/gateway/routes/projects.ts +0 -179
  89. package/packages/core/src/gateway/routes/providers.ts +0 -192
  90. package/packages/core/src/gateway/routes/setup.ts +0 -267
  91. package/packages/core/src/gateway/routes/skills.ts +0 -70
  92. package/packages/core/src/gateway/routes/system.ts +0 -165
  93. package/packages/core/src/gateway/routes/tasks.ts +0 -44
  94. package/packages/core/src/gateway/routes/tools.ts +0 -35
  95. package/packages/core/src/gateway/routes/users.ts +0 -118
  96. package/packages/core/src/gateway/routes/voice.ts +0 -73
  97. package/packages/core/src/gateway/routes/workspace.ts +0 -281
  98. package/packages/core/src/gateway/server.ts +0 -1978
  99. package/packages/core/src/gateway/session.ts +0 -95
  100. package/packages/core/src/gateway/slash-commands.ts +0 -193
  101. package/packages/core/src/heartbeat/index.ts +0 -157
  102. package/packages/core/src/mcp/hot-reload.ts +0 -213
  103. package/packages/core/src/mcp/singleton.ts +0 -21
  104. package/packages/core/src/memory/index.ts +0 -1
  105. package/packages/core/src/memory/notes.ts +0 -68
  106. package/packages/core/src/plugins/api.ts +0 -128
  107. package/packages/core/src/plugins/index.ts +0 -2
  108. package/packages/core/src/plugins/loader.ts +0 -365
  109. package/packages/core/src/resilience/circuit-breaker.ts +0 -225
  110. package/packages/core/src/security/google-chat.ts +0 -269
  111. package/packages/core/src/security/index.ts +0 -192
  112. package/packages/core/src/security/pairing.ts +0 -250
  113. package/packages/core/src/security/rate-limit.ts +0 -270
  114. package/packages/core/src/security/signal.ts +0 -321
  115. package/packages/core/src/state/store.ts +0 -312
  116. package/packages/core/src/storage/crypto.ts +0 -101
  117. package/packages/core/src/storage/onboarding.ts +0 -1609
  118. package/packages/core/src/storage/schema.ts +0 -567
  119. package/packages/core/src/storage/seed.ts +0 -608
  120. package/packages/core/src/storage/sqlite.ts +0 -363
  121. package/packages/core/src/storage/usage.ts +0 -270
  122. package/packages/core/src/tools/agents/index.ts +0 -607
  123. package/packages/core/src/tools/bridge-events.ts +0 -26
  124. package/packages/core/src/tools/canvas/index.ts +0 -281
  125. package/packages/core/src/tools/cli/index.ts +0 -142
  126. package/packages/core/src/tools/codebridge/index.ts +0 -179
  127. package/packages/core/src/tools/core/index.ts +0 -257
  128. package/packages/core/src/tools/cron/index.ts +0 -373
  129. package/packages/core/src/tools/filesystem/fs-delete.ts +0 -78
  130. package/packages/core/src/tools/filesystem/fs-edit.ts +0 -106
  131. package/packages/core/src/tools/filesystem/fs-exists.ts +0 -63
  132. package/packages/core/src/tools/filesystem/fs-glob.ts +0 -108
  133. package/packages/core/src/tools/filesystem/fs-list.ts +0 -129
  134. package/packages/core/src/tools/filesystem/fs-read.ts +0 -72
  135. package/packages/core/src/tools/filesystem/fs-write.ts +0 -67
  136. package/packages/core/src/tools/filesystem/index.ts +0 -34
  137. package/packages/core/src/tools/filesystem/workspace-guard.ts +0 -62
  138. package/packages/core/src/tools/index.ts +0 -197
  139. package/packages/core/src/tools/projects/index.ts +0 -37
  140. package/packages/core/src/tools/projects/project-create.ts +0 -94
  141. package/packages/core/src/tools/projects/project-done.ts +0 -66
  142. package/packages/core/src/tools/projects/project-fail.ts +0 -66
  143. package/packages/core/src/tools/projects/project-list.ts +0 -96
  144. package/packages/core/src/tools/projects/project-update.ts +0 -72
  145. package/packages/core/src/tools/projects/task-create.ts +0 -68
  146. package/packages/core/src/tools/projects/task-evaluate.ts +0 -93
  147. package/packages/core/src/tools/projects/task-update.ts +0 -93
  148. package/packages/core/src/tools/search-knowledge/search-knowledge.ts +0 -155
  149. package/packages/core/src/tools/types.ts +0 -39
  150. package/packages/core/src/tools/voice/index.ts +0 -104
  151. package/packages/core/src/tools/web/browser-click.ts +0 -54
  152. package/packages/core/src/tools/web/browser-navigate.ts +0 -84
  153. package/packages/core/src/tools/web/browser-screenshot.ts +0 -54
  154. package/packages/core/src/tools/web/browser-type.ts +0 -60
  155. package/packages/core/src/tools/web/index.ts +0 -31
  156. package/packages/core/src/tools/web/web-fetch.ts +0 -78
  157. package/packages/core/src/tools/web/web-search.ts +0 -123
  158. package/packages/core/src/utils/benchmark.ts +0 -80
  159. package/packages/core/src/utils/crypto.ts +0 -73
  160. package/packages/core/src/utils/date.ts +0 -42
  161. package/packages/core/src/utils/index.ts +0 -5
  162. package/packages/core/src/utils/logger.ts +0 -389
  163. package/packages/core/src/utils/retry.ts +0 -70
  164. package/packages/core/src/utils/toon.ts +0 -356
  165. package/packages/core/src/voice/index.ts +0 -583
  166. package/packages/hive-ui/README.md +0 -52
  167. package/packages/hive-ui/components.json +0 -20
  168. package/packages/hive-ui/index.html +0 -30
  169. package/packages/hive-ui/package.json +0 -90
  170. package/packages/hive-ui/public/favicon.ico +0 -0
  171. package/packages/hive-ui/public/placeholder.svg +0 -1
  172. package/packages/hive-ui/src/App.tsx +0 -115
  173. package/packages/hive-ui/src/components/CronJobsPanel.tsx +0 -200
  174. package/packages/hive-ui/src/components/NavLink.tsx +0 -34
  175. package/packages/hive-ui/src/components/NotesPanel.tsx +0 -79
  176. package/packages/hive-ui/src/components/SystemMonitor.tsx +0 -270
  177. package/packages/hive-ui/src/components/UsageStatsPanel.tsx +0 -334
  178. package/packages/hive-ui/src/components/WelcomeDialog.tsx +0 -279
  179. package/packages/hive-ui/src/components/ui/accordion.tsx +0 -52
  180. package/packages/hive-ui/src/components/ui/alert-dialog.tsx +0 -104
  181. package/packages/hive-ui/src/components/ui/alert.tsx +0 -45
  182. package/packages/hive-ui/src/components/ui/aspect-ratio.tsx +0 -5
  183. package/packages/hive-ui/src/components/ui/avatar.tsx +0 -38
  184. package/packages/hive-ui/src/components/ui/badge.tsx +0 -29
  185. package/packages/hive-ui/src/components/ui/bee-loader.tsx +0 -68
  186. package/packages/hive-ui/src/components/ui/breadcrumb.tsx +0 -90
  187. package/packages/hive-ui/src/components/ui/button.tsx +0 -47
  188. package/packages/hive-ui/src/components/ui/calendar.tsx +0 -54
  189. package/packages/hive-ui/src/components/ui/card.tsx +0 -45
  190. package/packages/hive-ui/src/components/ui/carousel.tsx +0 -224
  191. package/packages/hive-ui/src/components/ui/chart.tsx +0 -303
  192. package/packages/hive-ui/src/components/ui/checkbox.tsx +0 -26
  193. package/packages/hive-ui/src/components/ui/collapsible.tsx +0 -9
  194. package/packages/hive-ui/src/components/ui/command.tsx +0 -133
  195. package/packages/hive-ui/src/components/ui/context-menu.tsx +0 -178
  196. package/packages/hive-ui/src/components/ui/dialog.tsx +0 -95
  197. package/packages/hive-ui/src/components/ui/drawer.tsx +0 -87
  198. package/packages/hive-ui/src/components/ui/dropdown-menu.tsx +0 -179
  199. package/packages/hive-ui/src/components/ui/form.tsx +0 -129
  200. package/packages/hive-ui/src/components/ui/hover-card.tsx +0 -27
  201. package/packages/hive-ui/src/components/ui/input-otp.tsx +0 -61
  202. package/packages/hive-ui/src/components/ui/input.tsx +0 -22
  203. package/packages/hive-ui/src/components/ui/label.tsx +0 -17
  204. package/packages/hive-ui/src/components/ui/menubar.tsx +0 -207
  205. package/packages/hive-ui/src/components/ui/navigation-menu.tsx +0 -120
  206. package/packages/hive-ui/src/components/ui/pagination.tsx +0 -80
  207. package/packages/hive-ui/src/components/ui/popover.tsx +0 -29
  208. package/packages/hive-ui/src/components/ui/progress.tsx +0 -23
  209. package/packages/hive-ui/src/components/ui/radio-group.tsx +0 -36
  210. package/packages/hive-ui/src/components/ui/resizable.tsx +0 -37
  211. package/packages/hive-ui/src/components/ui/scroll-area.tsx +0 -38
  212. package/packages/hive-ui/src/components/ui/select.tsx +0 -143
  213. package/packages/hive-ui/src/components/ui/separator.tsx +0 -20
  214. package/packages/hive-ui/src/components/ui/sheet.tsx +0 -107
  215. package/packages/hive-ui/src/components/ui/sidebar.tsx +0 -636
  216. package/packages/hive-ui/src/components/ui/skeleton.tsx +0 -7
  217. package/packages/hive-ui/src/components/ui/slider.tsx +0 -23
  218. package/packages/hive-ui/src/components/ui/sonner.tsx +0 -27
  219. package/packages/hive-ui/src/components/ui/switch.tsx +0 -27
  220. package/packages/hive-ui/src/components/ui/table.tsx +0 -72
  221. package/packages/hive-ui/src/components/ui/tabs.tsx +0 -53
  222. package/packages/hive-ui/src/components/ui/textarea.tsx +0 -21
  223. package/packages/hive-ui/src/components/ui/toast.tsx +0 -111
  224. package/packages/hive-ui/src/components/ui/toaster.tsx +0 -24
  225. package/packages/hive-ui/src/components/ui/toggle-group.tsx +0 -49
  226. package/packages/hive-ui/src/components/ui/toggle.tsx +0 -37
  227. package/packages/hive-ui/src/components/ui/tooltip.tsx +0 -28
  228. package/packages/hive-ui/src/components/ui/use-toast.ts +0 -3
  229. package/packages/hive-ui/src/hooks/use-mobile.tsx +0 -19
  230. package/packages/hive-ui/src/hooks/use-toast.ts +0 -186
  231. package/packages/hive-ui/src/hooks/useAgentConfig.ts +0 -25
  232. package/packages/hive-ui/src/hooks/useAgents.ts +0 -38
  233. package/packages/hive-ui/src/hooks/useBridge.ts +0 -38
  234. package/packages/hive-ui/src/hooks/useCanvas.ts +0 -24
  235. package/packages/hive-ui/src/hooks/useChannels.ts +0 -2
  236. package/packages/hive-ui/src/hooks/useEthics.ts +0 -51
  237. package/packages/hive-ui/src/hooks/useProviders.ts +0 -14
  238. package/packages/hive-ui/src/hooks/useTheme.ts +0 -29
  239. package/packages/hive-ui/src/hooks/useUserConfig.ts +0 -17
  240. package/packages/hive-ui/src/hooks/useWebSocket.ts +0 -12
  241. package/packages/hive-ui/src/index.css +0 -620
  242. package/packages/hive-ui/src/lib/api.ts +0 -100
  243. package/packages/hive-ui/src/lib/constants.ts +0 -6
  244. package/packages/hive-ui/src/lib/models.ts +0 -64
  245. package/packages/hive-ui/src/lib/swal.ts +0 -30
  246. package/packages/hive-ui/src/lib/utils.ts +0 -6
  247. package/packages/hive-ui/src/lib/websocket.ts +0 -7
  248. package/packages/hive-ui/src/main.tsx +0 -5
  249. package/packages/hive-ui/src/modules/agent-config/details/AgentDetailsEditor.tsx +0 -524
  250. package/packages/hive-ui/src/modules/agent-config/ethics/EthicsConflictDetector.tsx +0 -18
  251. package/packages/hive-ui/src/modules/agent-config/ethics/EthicsEditor.tsx +0 -19
  252. package/packages/hive-ui/src/modules/agent-config/ethics/EthicsRulesList.tsx +0 -36
  253. package/packages/hive-ui/src/modules/agent-config/ethics/EthicsTemplateGallery.tsx +0 -361
  254. package/packages/hive-ui/src/modules/agent-config/ethics/index.ts +0 -4
  255. package/packages/hive-ui/src/modules/agent-config/index.ts +0 -6
  256. package/packages/hive-ui/src/modules/agent-config/mcp/MCPServerAdd.tsx +0 -322
  257. package/packages/hive-ui/src/modules/agent-config/mcp/MCPServerCard.tsx +0 -93
  258. package/packages/hive-ui/src/modules/agent-config/mcp/MCPServerConfig.tsx +0 -427
  259. package/packages/hive-ui/src/modules/agent-config/mcp/MCPServerList.tsx +0 -85
  260. package/packages/hive-ui/src/modules/agent-config/mcp/MCPToolExplorer.tsx +0 -79
  261. package/packages/hive-ui/src/modules/agent-config/mcp/index.ts +0 -5
  262. package/packages/hive-ui/src/modules/agent-config/shared/ConfigEditorLayout.tsx +0 -30
  263. package/packages/hive-ui/src/modules/agent-config/shared/ConfigExporter.tsx +0 -26
  264. package/packages/hive-ui/src/modules/agent-config/shared/ConfigImporter.tsx +0 -25
  265. package/packages/hive-ui/src/modules/agent-config/shared/DiffViewer.tsx +0 -31
  266. package/packages/hive-ui/src/modules/agent-config/shared/MarkdownEditor.tsx +0 -32
  267. package/packages/hive-ui/src/modules/agent-config/shared/SaveStatusIndicator.tsx +0 -23
  268. package/packages/hive-ui/src/modules/agent-config/shared/ValidationPanel.tsx +0 -36
  269. package/packages/hive-ui/src/modules/agent-config/shared/index.ts +0 -7
  270. package/packages/hive-ui/src/modules/agent-config/skills/SkillCard.tsx +0 -81
  271. package/packages/hive-ui/src/modules/agent-config/skills/SkillConfigEditor.tsx +0 -22
  272. package/packages/hive-ui/src/modules/agent-config/skills/SkillCreator.tsx +0 -60
  273. package/packages/hive-ui/src/modules/agent-config/skills/SkillInstaller.tsx +0 -23
  274. package/packages/hive-ui/src/modules/agent-config/skills/SkillList.tsx +0 -72
  275. package/packages/hive-ui/src/modules/agent-config/skills/SkillsTab.tsx +0 -202
  276. package/packages/hive-ui/src/modules/agent-config/skills/index.ts +0 -5
  277. package/packages/hive-ui/src/modules/agent-config/tools/ToolCard.tsx +0 -27
  278. package/packages/hive-ui/src/modules/agent-config/tools/ToolConfigPanel.tsx +0 -22
  279. package/packages/hive-ui/src/modules/agent-config/tools/ToolManager.tsx +0 -266
  280. package/packages/hive-ui/src/modules/agent-config/tools/ToolPermissions.tsx +0 -287
  281. package/packages/hive-ui/src/modules/agent-config/tools/ToolRegistry.tsx +0 -84
  282. package/packages/hive-ui/src/modules/agent-config/tools/ToolUsageStats.tsx +0 -52
  283. package/packages/hive-ui/src/modules/agent-config/tools/index.ts +0 -4
  284. package/packages/hive-ui/src/modules/agent-config/user/ActiveAgentsList.tsx +0 -109
  285. package/packages/hive-ui/src/modules/agent-config/user/GlobalConfigOverview.tsx +0 -119
  286. package/packages/hive-ui/src/modules/agent-config/user/UserMemoryManager.tsx +0 -54
  287. package/packages/hive-ui/src/modules/agent-config/user/UserPreferencesForm.tsx +0 -163
  288. package/packages/hive-ui/src/modules/agent-config/user/UserProfileEditor.tsx +0 -261
  289. package/packages/hive-ui/src/modules/agent-config/user/index.ts +0 -3
  290. package/packages/hive-ui/src/modules/agents/AgentActivityLog.tsx +0 -25
  291. package/packages/hive-ui/src/modules/agents/AgentCard.tsx +0 -305
  292. package/packages/hive-ui/src/modules/agents/AgentCreateForm.tsx +0 -446
  293. package/packages/hive-ui/src/modules/agents/AgentDetail.tsx +0 -28
  294. package/packages/hive-ui/src/modules/agents/AgentInternalCard.tsx +0 -162
  295. package/packages/hive-ui/src/modules/agents/AgentList.tsx +0 -29
  296. package/packages/hive-ui/src/modules/agents/AgentStatusBadge.tsx +0 -34
  297. package/packages/hive-ui/src/modules/agents/ModelSelector.tsx +0 -151
  298. package/packages/hive-ui/src/modules/bridge/BridgeLogViewer.tsx +0 -61
  299. package/packages/hive-ui/src/modules/bridge/BridgeProcessList.tsx +0 -77
  300. package/packages/hive-ui/src/modules/bridge/BridgeStatus.tsx +0 -23
  301. package/packages/hive-ui/src/modules/bridge/BridgeTerminal.tsx +0 -7
  302. package/packages/hive-ui/src/modules/canvas/CanvasButton.tsx +0 -3
  303. package/packages/hive-ui/src/modules/canvas/CanvasChart.tsx +0 -3
  304. package/packages/hive-ui/src/modules/canvas/CanvasComponentMap.tsx +0 -605
  305. package/packages/hive-ui/src/modules/canvas/CanvasContainer.tsx +0 -360
  306. package/packages/hive-ui/src/modules/canvas/CanvasForm.tsx +0 -3
  307. package/packages/hive-ui/src/modules/canvas/CanvasMarkdown.tsx +0 -3
  308. package/packages/hive-ui/src/modules/canvas/CanvasTable.tsx +0 -3
  309. package/packages/hive-ui/src/modules/canvas/ComponentRenderer.tsx +0 -30
  310. package/packages/hive-ui/src/modules/canvas/DynamicRenderer.tsx +0 -3
  311. package/packages/hive-ui/src/modules/channels/available/AvailableChannelsGrid.tsx +0 -89
  312. package/packages/hive-ui/src/modules/channels/available/ChannelAuthForm.tsx +0 -33
  313. package/packages/hive-ui/src/modules/channels/available/ChannelSetupWizard.tsx +0 -48
  314. package/packages/hive-ui/src/modules/channels/available/ChannelTestConnection.tsx +0 -37
  315. package/packages/hive-ui/src/modules/channels/available/ChannelTypeCard.tsx +0 -30
  316. package/packages/hive-ui/src/modules/channels/available/ChannelWebhookConfig.tsx +0 -30
  317. package/packages/hive-ui/src/modules/channels/available/index.ts +0 -6
  318. package/packages/hive-ui/src/modules/channels/connected/ChannelCard.tsx +0 -95
  319. package/packages/hive-ui/src/modules/channels/connected/ChannelConfigPanel.tsx +0 -260
  320. package/packages/hive-ui/src/modules/channels/connected/ChannelDisconnectButton.tsx +0 -21
  321. package/packages/hive-ui/src/modules/channels/connected/ChannelLogsViewer.tsx +0 -42
  322. package/packages/hive-ui/src/modules/channels/connected/ChannelQRCode.tsx +0 -32
  323. package/packages/hive-ui/src/modules/channels/connected/ChannelReconnectButton.tsx +0 -16
  324. package/packages/hive-ui/src/modules/channels/connected/ChannelStatusBadge.tsx +0 -26
  325. package/packages/hive-ui/src/modules/channels/connected/ConnectedChannelsList.tsx +0 -40
  326. package/packages/hive-ui/src/modules/channels/connected/index.ts +0 -8
  327. package/packages/hive-ui/src/modules/channels/shared/ChannelCard.tsx +0 -84
  328. package/packages/hive-ui/src/modules/channels/shared/ChannelConfigDialog.tsx +0 -279
  329. package/packages/hive-ui/src/modules/channels/shared/ChannelIcon.tsx +0 -40
  330. package/packages/hive-ui/src/modules/channels/shared/ChannelStats.tsx +0 -37
  331. package/packages/hive-ui/src/modules/channels/shared/ChannelTypeBadge.tsx +0 -23
  332. package/packages/hive-ui/src/modules/channels/shared/ConnectionHealthIndicator.tsx +0 -20
  333. package/packages/hive-ui/src/modules/channels/shared/MessagePreview.tsx +0 -19
  334. package/packages/hive-ui/src/modules/channels/shared/index.ts +0 -5
  335. package/packages/hive-ui/src/modules/chat/ChatContainer.tsx +0 -268
  336. package/packages/hive-ui/src/modules/chat/ChatHistory.tsx +0 -101
  337. package/packages/hive-ui/src/modules/chat/ChatInput.tsx +0 -108
  338. package/packages/hive-ui/src/modules/chat/ChatMessage.tsx +0 -137
  339. package/packages/hive-ui/src/modules/chat/ThinkingIndicator.tsx +0 -10
  340. package/packages/hive-ui/src/modules/layout/AppLayout.tsx +0 -45
  341. package/packages/hive-ui/src/modules/layout/ConnectionStatus.tsx +0 -19
  342. package/packages/hive-ui/src/modules/layout/Header.tsx +0 -20
  343. package/packages/hive-ui/src/modules/layout/HiveSidebar.tsx +0 -173
  344. package/packages/hive-ui/src/modules/layout/ThemeToggle.tsx +0 -18
  345. package/packages/hive-ui/src/modules/providers/ProviderCard.tsx +0 -319
  346. package/packages/hive-ui/src/modules/providers/ProviderConfigForm.tsx +0 -146
  347. package/packages/hive-ui/src/modules/providers/ProviderFailoverConfig.tsx +0 -110
  348. package/packages/hive-ui/src/modules/providers/ProviderList.tsx +0 -33
  349. package/packages/hive-ui/src/modules/providers/ProviderStatusIndicator.tsx +0 -23
  350. package/packages/hive-ui/src/modules/providers/configs/ProviderAPIKeyManager.tsx +0 -39
  351. package/packages/hive-ui/src/modules/providers/configs/ProviderEndpointConfig.tsx +0 -27
  352. package/packages/hive-ui/src/modules/providers/configs/ProviderRateLimits.tsx +0 -37
  353. package/packages/hive-ui/src/modules/providers/configs/ProviderRetryPolicy.tsx +0 -46
  354. package/packages/hive-ui/src/modules/providers/configs/index.ts +0 -4
  355. package/packages/hive-ui/src/modules/providers/index.ts +0 -5
  356. package/packages/hive-ui/src/modules/providers/models/ModelBenchmarkBadge.tsx +0 -21
  357. package/packages/hive-ui/src/modules/providers/models/ModelCapabilities.tsx +0 -44
  358. package/packages/hive-ui/src/modules/providers/models/ModelCard.tsx +0 -36
  359. package/packages/hive-ui/src/modules/providers/models/ModelComparisonTable.tsx +0 -47
  360. package/packages/hive-ui/src/modules/providers/models/ModelList.tsx +0 -51
  361. package/packages/hive-ui/src/modules/providers/models/ModelPricingInfo.tsx +0 -17
  362. package/packages/hive-ui/src/modules/providers/models/ModelSelector.tsx +0 -32
  363. package/packages/hive-ui/src/modules/providers/models/index.ts +0 -7
  364. package/packages/hive-ui/src/pages/AgentDetailPage.tsx +0 -74
  365. package/packages/hive-ui/src/pages/AgentNewPage.tsx +0 -5
  366. package/packages/hive-ui/src/pages/AgentsPage.tsx +0 -147
  367. package/packages/hive-ui/src/pages/BridgePage.tsx +0 -83
  368. package/packages/hive-ui/src/pages/CanvasPage.tsx +0 -32
  369. package/packages/hive-ui/src/pages/ChannelsPage.tsx +0 -176
  370. package/packages/hive-ui/src/pages/DashboardPage.tsx +0 -321
  371. package/packages/hive-ui/src/pages/Index.tsx +0 -14
  372. package/packages/hive-ui/src/pages/LogsPage.tsx +0 -252
  373. package/packages/hive-ui/src/pages/NotFound.tsx +0 -24
  374. package/packages/hive-ui/src/pages/ProjectsPage.tsx +0 -241
  375. package/packages/hive-ui/src/pages/ProvidersPage.tsx +0 -111
  376. package/packages/hive-ui/src/pages/SettingsPage.tsx +0 -147
  377. package/packages/hive-ui/src/pages/SetupPage.tsx +0 -1177
  378. package/packages/hive-ui/src/pages/WebChatPage.tsx +0 -15
  379. package/packages/hive-ui/src/stores/agentConfigStore.ts +0 -32
  380. package/packages/hive-ui/src/stores/agentStore.ts +0 -5
  381. package/packages/hive-ui/src/stores/bridgeStore.ts +0 -237
  382. package/packages/hive-ui/src/stores/canvasStore.ts +0 -250
  383. package/packages/hive-ui/src/stores/channelStore.ts +0 -5
  384. package/packages/hive-ui/src/stores/chatStore.ts +0 -42
  385. package/packages/hive-ui/src/stores/ethicsStore.ts +0 -141
  386. package/packages/hive-ui/src/stores/mcpStore.ts +0 -5
  387. package/packages/hive-ui/src/stores/modelStore.ts +0 -2
  388. package/packages/hive-ui/src/stores/projectsStore.ts +0 -141
  389. package/packages/hive-ui/src/stores/providerStore.ts +0 -2
  390. package/packages/hive-ui/src/stores/skillStore.ts +0 -5
  391. package/packages/hive-ui/src/stores/toolStore.ts +0 -5
  392. package/packages/hive-ui/src/stores/useGlobalConfigStore.ts +0 -937
  393. package/packages/hive-ui/src/stores/useLoaderStore.ts +0 -21
  394. package/packages/hive-ui/src/stores/useNotesAndCronsStore.ts +0 -144
  395. package/packages/hive-ui/src/stores/useWebSocketStore.ts +0 -152
  396. package/packages/hive-ui/src/stores/useWelcomeStore.ts +0 -37
  397. package/packages/hive-ui/src/stores/userConfigStore.ts +0 -23
  398. package/packages/hive-ui/src/stores/userStore.ts +0 -82
  399. package/packages/hive-ui/src/test/setup.ts +0 -15
  400. package/packages/hive-ui/src/types/agent-config.ts +0 -33
  401. package/packages/hive-ui/src/types/agent.ts +0 -65
  402. package/packages/hive-ui/src/types/bridge.ts +0 -27
  403. package/packages/hive-ui/src/types/canvas.ts +0 -76
  404. package/packages/hive-ui/src/types/channels.ts +0 -109
  405. package/packages/hive-ui/src/types/chat.ts +0 -25
  406. package/packages/hive-ui/src/types/connections.ts +0 -17
  407. package/packages/hive-ui/src/types/ethics.ts +0 -41
  408. package/packages/hive-ui/src/types/index.ts +0 -15
  409. package/packages/hive-ui/src/types/mcp.ts +0 -36
  410. package/packages/hive-ui/src/types/notes-crons.ts +0 -31
  411. package/packages/hive-ui/src/types/providers.ts +0 -145
  412. package/packages/hive-ui/src/types/skill.ts +0 -12
  413. package/packages/hive-ui/src/types/tool.ts +0 -44
  414. package/packages/hive-ui/src/types/user.ts +0 -26
  415. package/packages/hive-ui/src/types/websocket.ts +0 -14
  416. package/packages/hive-ui/src/vite-env.d.ts +0 -1
  417. package/packages/mcp/package.json +0 -26
  418. package/packages/mcp/src/config.ts +0 -13
  419. package/packages/mcp/src/index.ts +0 -1
  420. package/packages/mcp/src/logger.ts +0 -42
  421. package/packages/mcp/src/manager.ts +0 -439
  422. package/packages/mcp/src/transports/index.ts +0 -67
  423. package/packages/mcp/src/transports/sse.ts +0 -241
  424. package/packages/mcp/src/transports/websocket.ts +0 -159
  425. package/packages/skills/package.json +0 -21
  426. package/packages/skills/src/index.ts +0 -1
  427. package/packages/skills/src/loader.ts +0 -346
@@ -1,68 +0,0 @@
1
- import type { Config } from "../config/loader.ts";
2
- import { logger } from "../utils/logger.ts";
3
- import { dbService } from "../storage/sqlite.ts";
4
-
5
- export interface Note {
6
- title: string;
7
- content: string;
8
- createdAt: Date;
9
- updatedAt: Date;
10
- }
11
-
12
- export class MemoryStore {
13
- private log = logger.child("memory");
14
-
15
- constructor(config: Config) {
16
- // Configuration can remain unused as sqlite db handles path resolution
17
- }
18
-
19
- write(title: string, content: string): Note {
20
- const row = dbService.writeNote(title, content);
21
- this.log.debug(`Wrote note: ${title}`);
22
- return {
23
- title: row.title,
24
- content: row.content,
25
- createdAt: new Date(row.createdAt),
26
- updatedAt: new Date(row.updatedAt)
27
- };
28
- }
29
-
30
- read(title: string): Note | null {
31
- const row = dbService.readNote(title);
32
- if (!row) return null;
33
- return {
34
- title: row.title,
35
- content: row.content,
36
- createdAt: new Date(row.createdAt),
37
- updatedAt: new Date(row.updatedAt)
38
- };
39
- }
40
-
41
- list(): Array<{ title: string; path: string }> {
42
- return dbService.listNotes().map(row => ({
43
- title: row.title,
44
- path: `sqlite://notes/${row.id}`
45
- }));
46
- }
47
-
48
- delete(title: string): boolean {
49
- const deleted = dbService.deleteNote(title);
50
- if (deleted) {
51
- this.log.debug(`Deleted note: ${title}`);
52
- }
53
- return deleted;
54
- }
55
-
56
- search(query: string): Note[] {
57
- return dbService.searchNotes(query).map(row => ({
58
- title: row.title,
59
- content: row.content,
60
- createdAt: new Date(row.createdAt),
61
- updatedAt: new Date(row.updatedAt)
62
- }));
63
- }
64
- }
65
-
66
- export function createMemoryStore(config: Config): MemoryStore {
67
- return new MemoryStore(config);
68
- }
@@ -1,128 +0,0 @@
1
- import type { Logger, ChildLogger } from "../utils/logger.ts";
2
- import type { eventBus, EventMap, EventKey } from "../events/event-bus.ts";
3
- import type { StateStore } from "../state/store.ts";
4
-
5
- export interface PluginManifest {
6
- name: string;
7
- version: string;
8
- description?: string;
9
- author?: string;
10
- dependencies?: string[];
11
- hiveVersion?: string;
12
- main?: string;
13
- enabled?: boolean;
14
- }
15
-
16
- export interface ToolDefinition {
17
- name: string;
18
- description: string;
19
- parameters: Record<string, ParameterDefinition>;
20
- execute: (args: Record<string, unknown>) => Promise<unknown>;
21
- }
22
-
23
- export interface ParameterDefinition {
24
- type: "string" | "number" | "boolean" | "object" | "array";
25
- description?: string;
26
- required?: boolean;
27
- default?: unknown;
28
- enum?: string[];
29
- items?: ParameterDefinition;
30
- properties?: Record<string, ParameterDefinition>;
31
- }
32
-
33
- export interface ChannelDefinition {
34
- name: string;
35
- type: string;
36
- config: Record<string, unknown>;
37
- start: () => Promise<void>;
38
- stop: () => Promise<void>;
39
- send: (sessionId: string, message: unknown) => Promise<void>;
40
- }
41
-
42
- export interface CLICommand {
43
- name: string;
44
- description: string;
45
- handler: (args: string[], options: Record<string, unknown>) => Promise<void>;
46
- options?: Record<string, CommandOption>;
47
- }
48
-
49
- export interface CommandOption {
50
- alias?: string;
51
- description?: string;
52
- type?: "string" | "boolean" | "number";
53
- default?: unknown;
54
- }
55
-
56
- export interface PluginContext {
57
- pluginName: string;
58
- logger: ChildLogger;
59
- config: Record<string, unknown>;
60
- registerTool: (tool: ToolDefinition) => void;
61
- unregisterTool: (name: string) => void;
62
- registerChannel: (channel: ChannelDefinition) => void;
63
- unregisterChannel: (name: string) => void;
64
- registerCommand: (command: CLICommand) => void;
65
- unregisterCommand: (name: string) => void;
66
- events: {
67
- emit: <K extends EventKey>(event: K, data: EventMap[K]) => void;
68
- on: <K extends EventKey>(event: K, handler: (data: EventMap[K]) => void | Promise<void>) => () => void;
69
- once: <K extends EventKey>(event: K, handler: (data: EventMap[K]) => void | Promise<void>) => void;
70
- };
71
- state: {
72
- get: () => ReturnType<StateStore["getState"]>;
73
- subscribe: (listener: (state: ReturnType<StateStore["getState"]>) => void) => () => void;
74
- };
75
- getTool: (name: string) => ToolDefinition | undefined;
76
- getTools: () => ToolDefinition[];
77
- }
78
-
79
- export interface InboundMessage {
80
- sessionId: string;
81
- channel: string;
82
- userId: string;
83
- content: string;
84
- timestamp: number;
85
- }
86
-
87
- export interface AgentResponse {
88
- sessionId: string;
89
- content: string;
90
- toolsUsed: string[];
91
- duration: number;
92
- }
93
-
94
- export interface PluginToolCall {
95
- name: string;
96
- args: Record<string, unknown>;
97
- sessionId: string;
98
- }
99
-
100
- export type MiddlewareNext = () => Promise<void>;
101
- export type MiddlewareResult = Promise<void>;
102
-
103
- export interface HivePlugin {
104
- name: string;
105
- version: string;
106
- dependencies?: string[];
107
- manifest?: PluginManifest;
108
-
109
- activate(context: PluginContext): Promise<void>;
110
- deactivate(): Promise<void>;
111
-
112
- onMessage?: (message: InboundMessage, next: MiddlewareNext) => MiddlewareResult;
113
- onAgentResponse?: (response: AgentResponse, next: MiddlewareNext) => MiddlewareResult;
114
- onToolCall?: (call: PluginToolCall, next: () => Promise<unknown>) => Promise<unknown>;
115
- onError?: (error: Error, context: Record<string, unknown>) => Promise<void>;
116
- }
117
-
118
- export interface PluginState {
119
- name: string;
120
- status: "inactive" | "activating" | "active" | "deactivating" | "error";
121
- version: string;
122
- enabled: boolean;
123
- error?: string;
124
- loadedAt?: number;
125
- activatedAt?: number;
126
- }
127
-
128
- export type PluginConstructor = new () => HivePlugin;
@@ -1,2 +0,0 @@
1
- export * from "./api.ts";
2
- export * from "./loader.ts";
@@ -1,365 +0,0 @@
1
- import { mkdirSync, readdirSync, existsSync } from "node:fs";
2
- import * as path from "node:path";
3
- import { logger } from "../utils/logger.ts";
4
- import { eventBus } from "../events/event-bus.ts";
5
- import { stateStore } from "../state/store.ts";
6
- import type {
7
- HivePlugin,
8
- PluginManifest,
9
- PluginState,
10
- PluginContext,
11
- ToolDefinition,
12
- ChannelDefinition,
13
- CLICommand,
14
- PluginConstructor,
15
- } from "./api.ts";
16
-
17
- export interface PluginLoaderOptions {
18
- pluginDir: string;
19
- enableSandbox?: boolean;
20
- autoActivate?: boolean;
21
- pluginConfig?: Record<string, Record<string, unknown>>;
22
- }
23
-
24
- export class PluginLoader {
25
- private plugins: Map<string, HivePlugin> = new Map();
26
- private pluginStates: Map<string, PluginState> = new Map();
27
- private manifests: Map<string, PluginManifest> = new Map();
28
- private tools: Map<string, ToolDefinition> = new Map();
29
- private channels: Map<string, ChannelDefinition> = new Map();
30
- private commands: Map<string, CLICommand> = new Map();
31
- private log = logger.child("plugins");
32
-
33
- constructor(private options: PluginLoaderOptions) {
34
- if (!existsSync(options.pluginDir)) {
35
- mkdirSync(options.pluginDir, { recursive: true });
36
- }
37
- }
38
-
39
- async discover(): Promise<string[]> {
40
- const pluginDir = this.options.pluginDir;
41
- const discovered: string[] = [];
42
-
43
- try {
44
- const entries = readdirSync(pluginDir, { withFileTypes: true });
45
-
46
- for (const entry of entries) {
47
- if (entry.isDirectory()) {
48
- const manifestPath = path.join(pluginDir, entry.name, "manifest.json");
49
- if (existsSync(manifestPath)) {
50
- discovered.push(entry.name);
51
- }
52
- }
53
- }
54
- } catch (error) {
55
- this.log.error("Failed to discover plugins", { error: (error as Error).message });
56
- }
57
-
58
- return discovered;
59
- }
60
-
61
- async load(pluginName: string): Promise<void> {
62
- if (this.plugins.has(pluginName)) {
63
- this.log.warn(`Plugin ${pluginName} already loaded`);
64
- return;
65
- }
66
-
67
- const pluginPath = path.join(this.options.pluginDir, pluginName);
68
- const manifestPath = path.join(pluginPath, "manifest.json");
69
-
70
- this.updateState(pluginName, "activating");
71
-
72
- try {
73
- this.log.debug(`Reading plugin manifest: ${manifestPath}`);
74
- const manifestContent = await Bun.file(manifestPath).text();
75
- const manifest: PluginManifest = JSON.parse(manifestContent);
76
- this.manifests.set(pluginName, manifest);
77
-
78
- if (manifest.enabled === false) {
79
- this.updateState(pluginName, "inactive", "Disabled in manifest");
80
- return;
81
- }
82
-
83
- const mainFile = manifest.main ?? "index.js";
84
- const mainPath = path.join(pluginPath, mainFile);
85
-
86
- if (!(await Bun.file(mainPath).exists())) {
87
- throw new Error(`Main file not found: ${mainPath}`);
88
- }
89
-
90
- const PluginClass = await this.loadPluginClass(mainPath);
91
- const plugin = new PluginClass();
92
- const context = this.createContext(pluginName);
93
-
94
- await plugin.activate(context);
95
-
96
- this.plugins.set(pluginName, plugin);
97
- this.updateState(pluginName, "active");
98
-
99
- eventBus.emit("gateway:started", {
100
- host: "plugin",
101
- port: 0,
102
- });
103
-
104
- this.log.info(`Plugin ${pluginName} loaded`, {
105
- name: plugin.name,
106
- version: plugin.version,
107
- });
108
- } catch (error) {
109
- const errorMsg = (error as Error).message;
110
- this.updateState(pluginName, "error", errorMsg);
111
- this.log.error(`Failed to load plugin ${pluginName}`, { error: errorMsg });
112
- throw error;
113
- }
114
- }
115
-
116
- private async loadPluginClass(mainPath: string): Promise<PluginConstructor> {
117
- if (this.options.enableSandbox) {
118
- return this.loadSandboxed(mainPath);
119
- }
120
- return this.loadDirect(mainPath);
121
- }
122
-
123
- private async loadDirect(mainPath: string): Promise<PluginConstructor> {
124
- const module = await import(mainPath);
125
- const PluginClass = module.default ?? module[Object.keys(module)[0]!];
126
-
127
- if (typeof PluginClass !== "function") {
128
- throw new Error("Plugin must export a class as default");
129
- }
130
-
131
- return PluginClass;
132
- }
133
-
134
- private async loadSandboxed(mainPath: string): Promise<PluginConstructor> {
135
- this.log.debug(`Reading plugin source for sandboxed execution: ${mainPath}`);
136
- const code = await Bun.file(mainPath).text();
137
-
138
- const safeGlobals = this.createSafeGlobals();
139
- const wrappedCode = `
140
- (function(module, exports, __dirname, __filename) {
141
- ${code}
142
- })
143
- `;
144
-
145
- const module = { exports: {} };
146
- const exports = {};
147
-
148
- try {
149
- const fn = eval(wrappedCode);
150
- fn(module, exports, path.dirname(mainPath), mainPath);
151
-
152
- const PluginClass = (module.exports as any).default ?? (exports as any).default;
153
-
154
- if (typeof PluginClass !== "function") {
155
- throw new Error("Plugin must export a class as default");
156
- }
157
-
158
- return PluginClass;
159
- } catch (error) {
160
- throw new Error(`Sandboxed plugin execution failed: ${(error as Error).message}`);
161
- }
162
- }
163
-
164
- private createSafeGlobals(): Record<string, unknown> {
165
- return {
166
- console: {
167
- log: (...args: unknown[]) => this.log.debug(String(args[0])),
168
- error: (...args: unknown[]) => this.log.error(String(args[0])),
169
- warn: (...args: unknown[]) => this.log.warn(String(args[0])),
170
- info: (...args: unknown[]) => this.log.info(String(args[0])),
171
- },
172
- setTimeout: () => 0,
173
- clearTimeout: () => { },
174
- setInterval: () => 0,
175
- clearInterval: () => { },
176
- Buffer: {
177
- from: () => Buffer.from,
178
- isBuffer: () => false,
179
- },
180
- URL: URL,
181
- URLSearchParams: URLSearchParams,
182
- JSON: JSON,
183
- Object: Object,
184
- Array: Array,
185
- String: String,
186
- Number: Number,
187
- Boolean: Boolean,
188
- Date: Date,
189
- Error: Error,
190
- Promise: Promise,
191
- };
192
- }
193
-
194
- async unload(pluginName: string): Promise<void> {
195
- const plugin = this.plugins.get(pluginName);
196
-
197
- if (!plugin) {
198
- this.log.warn(`Plugin ${pluginName} not loaded`);
199
- return;
200
- }
201
-
202
- this.updateState(pluginName, "deactivating");
203
-
204
- try {
205
- await plugin.deactivate();
206
-
207
- for (const [toolName, tool] of this.tools) {
208
- if (toolName.startsWith(`${pluginName}:`)) {
209
- this.tools.delete(toolName);
210
- }
211
- }
212
-
213
- for (const [channelName, channel] of this.channels) {
214
- if (channelName.startsWith(`${pluginName}:`)) {
215
- await channel.stop();
216
- this.channels.delete(channelName);
217
- }
218
- }
219
-
220
- for (const [cmdName] of this.commands) {
221
- if (cmdName.startsWith(`${pluginName}:`)) {
222
- this.commands.delete(cmdName);
223
- }
224
- }
225
-
226
- this.plugins.delete(pluginName);
227
- this.updateState(pluginName, "inactive");
228
-
229
- this.log.info(`Plugin ${pluginName} unloaded`);
230
- } catch (error) {
231
- const errorMsg = (error as Error).message;
232
- this.updateState(pluginName, "error", errorMsg);
233
- this.log.error(`Failed to unload plugin ${pluginName}`, { error: errorMsg });
234
- throw error;
235
- }
236
- }
237
-
238
- async reload(pluginName: string): Promise<void> {
239
- this.log.info(`Reloading plugin ${pluginName}`);
240
- await this.unload(pluginName);
241
- await this.load(pluginName);
242
- }
243
-
244
- private createContext(pluginName: string): PluginContext {
245
- const pluginLogger = logger.child(pluginName);
246
- const pluginConfig = this.options.pluginConfig?.[pluginName] ?? {};
247
-
248
- return {
249
- pluginName,
250
- logger: pluginLogger,
251
- config: pluginConfig,
252
- registerTool: (tool: ToolDefinition) => {
253
- const fullName = `${pluginName}:${tool.name}`;
254
- this.tools.set(fullName, tool);
255
- this.log.debug(`Tool registered: ${fullName}`);
256
- },
257
- unregisterTool: (name: string) => {
258
- const fullName = `${pluginName}:${name}`;
259
- this.tools.delete(fullName);
260
- },
261
- registerChannel: (channel: ChannelDefinition) => {
262
- const fullName = `${pluginName}:${channel.name}`;
263
- this.channels.set(fullName, channel);
264
- this.log.debug(`Channel registered: ${fullName}`);
265
- },
266
- unregisterChannel: (name: string) => {
267
- const fullName = `${pluginName}:${name}`;
268
- this.channels.delete(fullName);
269
- },
270
- registerCommand: (command: CLICommand) => {
271
- const fullName = `${pluginName}:${command.name}`;
272
- this.commands.set(fullName, command);
273
- this.log.debug(`Command registered: ${fullName}`);
274
- },
275
- unregisterCommand: (name: string) => {
276
- const fullName = `${pluginName}:${name}`;
277
- this.commands.delete(fullName);
278
- },
279
- events: {
280
- emit: (event, data) => eventBus.emit(event as any, data as any),
281
- on: (event, handler) => eventBus.on(event as any, handler as any),
282
- once: (event, handler) => eventBus.once(event as any, handler as any),
283
- },
284
- state: {
285
- get: () => stateStore.getState(),
286
- subscribe: (listener) => stateStore.subscribe(listener),
287
- },
288
- getTool: (name: string) => this.tools.get(name) ?? this.tools.get(`${pluginName}:${name}`),
289
- getTools: () => Array.from(this.tools.values()),
290
- };
291
- }
292
-
293
- private updateState(name: string, status: PluginState["status"], error?: string): void {
294
- const existing = this.pluginStates.get(name);
295
- const manifest = this.manifests.get(name);
296
-
297
- this.pluginStates.set(name, {
298
- name,
299
- status,
300
- version: manifest?.version ?? existing?.version ?? "unknown",
301
- enabled: manifest?.enabled ?? true,
302
- error,
303
- loadedAt: existing?.loadedAt ?? Date.now(),
304
- activatedAt: status === "active" ? Date.now() : existing?.activatedAt,
305
- });
306
- }
307
-
308
- getPlugin(name: string): HivePlugin | undefined {
309
- return this.plugins.get(name);
310
- }
311
-
312
- getPluginState(name: string): PluginState | undefined {
313
- return this.pluginStates.get(name);
314
- }
315
-
316
- getAllPluginStates(): PluginState[] {
317
- return Array.from(this.pluginStates.values());
318
- }
319
-
320
- getTool(name: string): ToolDefinition | undefined {
321
- return this.tools.get(name);
322
- }
323
-
324
- getTools(): ToolDefinition[] {
325
- return Array.from(this.tools.values());
326
- }
327
-
328
- getChannel(name: string): ChannelDefinition | undefined {
329
- return this.channels.get(name);
330
- }
331
-
332
- getChannels(): ChannelDefinition[] {
333
- return Array.from(this.channels.values());
334
- }
335
-
336
- getCommand(name: string): CLICommand | undefined {
337
- return this.commands.get(name);
338
- }
339
-
340
- getCommands(): CLICommand[] {
341
- return Array.from(this.commands.values());
342
- }
343
-
344
- async loadAll(): Promise<void> {
345
- const discovered = await this.discover();
346
-
347
- for (const pluginName of discovered) {
348
- try {
349
- await this.load(pluginName);
350
- } catch (error) {
351
- this.log.error(`Failed to load ${pluginName}`, { error: (error as Error).message });
352
- }
353
- }
354
- }
355
-
356
- async unloadAll(): Promise<void> {
357
- for (const pluginName of this.plugins.keys()) {
358
- try {
359
- await this.unload(pluginName);
360
- } catch (error) {
361
- this.log.error(`Failed to unload ${pluginName}`, { error: (error as Error).message });
362
- }
363
- }
364
- }
365
- }