aurix-ai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +329 -0
- package/bin/aurix +172 -0
- package/bin/aurix.cmd +23 -0
- package/dist/agent/AgentLoop.d.ts +52 -0
- package/dist/agent/AgentLoop.d.ts.map +1 -0
- package/dist/agent/AgentLoop.js +543 -0
- package/dist/agent/AgentLoop.js.map +1 -0
- package/dist/agent/AgentsMD.d.ts +8 -0
- package/dist/agent/AgentsMD.d.ts.map +1 -0
- package/dist/agent/AgentsMD.js +53 -0
- package/dist/agent/AgentsMD.js.map +1 -0
- package/dist/agent/CodeReview.d.ts +13 -0
- package/dist/agent/CodeReview.d.ts.map +1 -0
- package/dist/agent/CodeReview.js +134 -0
- package/dist/agent/CodeReview.js.map +1 -0
- package/dist/agent/Config.d.ts +63 -0
- package/dist/agent/Config.d.ts.map +1 -0
- package/dist/agent/Config.js +55 -0
- package/dist/agent/Config.js.map +1 -0
- package/dist/agent/Context.d.ts +4 -0
- package/dist/agent/Context.d.ts.map +1 -0
- package/dist/agent/Context.js +390 -0
- package/dist/agent/Context.js.map +1 -0
- package/dist/agent/ContextManager.d.ts +23 -0
- package/dist/agent/ContextManager.d.ts.map +1 -0
- package/dist/agent/ContextManager.js +163 -0
- package/dist/agent/ContextManager.js.map +1 -0
- package/dist/agent/MemoryEngine.d.ts +24 -0
- package/dist/agent/MemoryEngine.d.ts.map +1 -0
- package/dist/agent/MemoryEngine.js +347 -0
- package/dist/agent/MemoryEngine.js.map +1 -0
- package/dist/agent/MultiAgent.d.ts +22 -0
- package/dist/agent/MultiAgent.d.ts.map +1 -0
- package/dist/agent/MultiAgent.js +466 -0
- package/dist/agent/MultiAgent.js.map +1 -0
- package/dist/agent/ResearchPipeline.d.ts +22 -0
- package/dist/agent/ResearchPipeline.d.ts.map +1 -0
- package/dist/agent/ResearchPipeline.js +195 -0
- package/dist/agent/ResearchPipeline.js.map +1 -0
- package/dist/agent/Setup.d.ts +3 -0
- package/dist/agent/Setup.d.ts.map +1 -0
- package/dist/agent/Setup.js +503 -0
- package/dist/agent/Setup.js.map +1 -0
- package/dist/agent/TokenCounter.d.ts +6 -0
- package/dist/agent/TokenCounter.d.ts.map +1 -0
- package/dist/agent/TokenCounter.js +73 -0
- package/dist/agent/TokenCounter.js.map +1 -0
- package/dist/agent/research/CitationGuardian.d.ts +10 -0
- package/dist/agent/research/CitationGuardian.d.ts.map +1 -0
- package/dist/agent/research/CitationGuardian.js +43 -0
- package/dist/agent/research/CitationGuardian.js.map +1 -0
- package/dist/agent/research/ClaimExtractor.d.ts +7 -0
- package/dist/agent/research/ClaimExtractor.d.ts.map +1 -0
- package/dist/agent/research/ClaimExtractor.js +49 -0
- package/dist/agent/research/ClaimExtractor.js.map +1 -0
- package/dist/agent/research/DebateSystem.d.ts +6 -0
- package/dist/agent/research/DebateSystem.d.ts.map +1 -0
- package/dist/agent/research/DebateSystem.js +33 -0
- package/dist/agent/research/DebateSystem.js.map +1 -0
- package/dist/agent/research/FinalReviewer.d.ts +10 -0
- package/dist/agent/research/FinalReviewer.d.ts.map +1 -0
- package/dist/agent/research/FinalReviewer.js +35 -0
- package/dist/agent/research/FinalReviewer.js.map +1 -0
- package/dist/agent/research/JudgeAgent.d.ts +7 -0
- package/dist/agent/research/JudgeAgent.d.ts.map +1 -0
- package/dist/agent/research/JudgeAgent.js +40 -0
- package/dist/agent/research/JudgeAgent.js.map +1 -0
- package/dist/agent/research/LogicCritic.d.ts +10 -0
- package/dist/agent/research/LogicCritic.d.ts.map +1 -0
- package/dist/agent/research/LogicCritic.js +39 -0
- package/dist/agent/research/LogicCritic.js.map +1 -0
- package/dist/agent/research/PlanningAgent.d.ts +10 -0
- package/dist/agent/research/PlanningAgent.d.ts.map +1 -0
- package/dist/agent/research/PlanningAgent.js +39 -0
- package/dist/agent/research/PlanningAgent.js.map +1 -0
- package/dist/agent/research/RequestAnalyzer.d.ts +14 -0
- package/dist/agent/research/RequestAnalyzer.d.ts.map +1 -0
- package/dist/agent/research/RequestAnalyzer.js +38 -0
- package/dist/agent/research/RequestAnalyzer.js.map +1 -0
- package/dist/agent/research/ResearchAgent.d.ts +12 -0
- package/dist/agent/research/ResearchAgent.d.ts.map +1 -0
- package/dist/agent/research/ResearchAgent.js +64 -0
- package/dist/agent/research/ResearchAgent.js.map +1 -0
- package/dist/agent/research/SkepticAgent.d.ts +9 -0
- package/dist/agent/research/SkepticAgent.d.ts.map +1 -0
- package/dist/agent/research/SkepticAgent.js +38 -0
- package/dist/agent/research/SkepticAgent.js.map +1 -0
- package/dist/agent/research/SupporterAgent.d.ts +9 -0
- package/dist/agent/research/SupporterAgent.d.ts.map +1 -0
- package/dist/agent/research/SupporterAgent.js +31 -0
- package/dist/agent/research/SupporterAgent.js.map +1 -0
- package/dist/agent/research/VideoAgent.d.ts +10 -0
- package/dist/agent/research/VideoAgent.d.ts.map +1 -0
- package/dist/agent/research/VideoAgent.js +49 -0
- package/dist/agent/research/VideoAgent.js.map +1 -0
- package/dist/agent/research/WriterAgent.d.ts +6 -0
- package/dist/agent/research/WriterAgent.d.ts.map +1 -0
- package/dist/agent/research/WriterAgent.js +30 -0
- package/dist/agent/research/WriterAgent.js.map +1 -0
- package/dist/agent/research/index.d.ts +15 -0
- package/dist/agent/research/index.d.ts.map +1 -0
- package/dist/agent/research/index.js +14 -0
- package/dist/agent/research/index.js.map +1 -0
- package/dist/agent/research/types.d.ts +49 -0
- package/dist/agent/research/types.d.ts.map +1 -0
- package/dist/agent/research/types.js +17 -0
- package/dist/agent/research/types.js.map +1 -0
- package/dist/cli/AltScreen.d.ts +3 -0
- package/dist/cli/AltScreen.d.ts.map +1 -0
- package/dist/cli/AltScreen.js +72 -0
- package/dist/cli/AltScreen.js.map +1 -0
- package/dist/cli/App.d.ts +11 -0
- package/dist/cli/App.d.ts.map +1 -0
- package/dist/cli/App.js +1319 -0
- package/dist/cli/App.js.map +1 -0
- package/dist/cli/Banner.d.ts +13 -0
- package/dist/cli/Banner.d.ts.map +1 -0
- package/dist/cli/Banner.js +12 -0
- package/dist/cli/Banner.js.map +1 -0
- package/dist/cli/BlackFill.d.ts +3 -0
- package/dist/cli/BlackFill.d.ts.map +1 -0
- package/dist/cli/BlackFill.js +9 -0
- package/dist/cli/BlackFill.js.map +1 -0
- package/dist/cli/ChatArea.d.ts +20 -0
- package/dist/cli/ChatArea.d.ts.map +1 -0
- package/dist/cli/ChatArea.js +300 -0
- package/dist/cli/ChatArea.js.map +1 -0
- package/dist/cli/ConnectModal.d.ts +9 -0
- package/dist/cli/ConnectModal.d.ts.map +1 -0
- package/dist/cli/ConnectModal.js +101 -0
- package/dist/cli/ConnectModal.js.map +1 -0
- package/dist/cli/FileDiff.d.ts +16 -0
- package/dist/cli/FileDiff.d.ts.map +1 -0
- package/dist/cli/FileDiff.js +45 -0
- package/dist/cli/FileDiff.js.map +1 -0
- package/dist/cli/InputBox.d.ts +18 -0
- package/dist/cli/InputBox.d.ts.map +1 -0
- package/dist/cli/InputBox.js +573 -0
- package/dist/cli/InputBox.js.map +1 -0
- package/dist/cli/LoginModal.d.ts +10 -0
- package/dist/cli/LoginModal.d.ts.map +1 -0
- package/dist/cli/LoginModal.js +129 -0
- package/dist/cli/LoginModal.js.map +1 -0
- package/dist/cli/Menu.d.ts +26 -0
- package/dist/cli/Menu.d.ts.map +1 -0
- package/dist/cli/Menu.js +115 -0
- package/dist/cli/Menu.js.map +1 -0
- package/dist/cli/MouseFilter.d.ts +2 -0
- package/dist/cli/MouseFilter.d.ts.map +1 -0
- package/dist/cli/MouseFilter.js +47 -0
- package/dist/cli/MouseFilter.js.map +1 -0
- package/dist/cli/Panel.d.ts.map +1 -0
- package/dist/cli/Panel.js.map +1 -0
- package/dist/cli/PermissionPrompt.d.ts +9 -0
- package/dist/cli/PermissionPrompt.d.ts.map +1 -0
- package/dist/cli/PermissionPrompt.js +56 -0
- package/dist/cli/PermissionPrompt.js.map +1 -0
- package/dist/cli/SessionPanel.d.ts +15 -0
- package/dist/cli/SessionPanel.d.ts.map +1 -0
- package/dist/cli/SessionPanel.js +28 -0
- package/dist/cli/SessionPanel.js.map +1 -0
- package/dist/cli/SetupUI.d.ts +34 -0
- package/dist/cli/SetupUI.d.ts.map +1 -0
- package/dist/cli/SetupUI.js +311 -0
- package/dist/cli/SetupUI.js.map +1 -0
- package/dist/cli/StatusBar.d.ts +12 -0
- package/dist/cli/StatusBar.d.ts.map +1 -0
- package/dist/cli/StatusBar.js +7 -0
- package/dist/cli/StatusBar.js.map +1 -0
- package/dist/cli/WhatsAppModal.d.ts +10 -0
- package/dist/cli/WhatsAppModal.d.ts.map +1 -0
- package/dist/cli/WhatsAppModal.js +78 -0
- package/dist/cli/WhatsAppModal.js.map +1 -0
- package/dist/cli/animation/useThinking.d.ts +2 -0
- package/dist/cli/animation/useThinking.d.ts.map +1 -0
- package/dist/cli/animation/useThinking.js +50 -0
- package/dist/cli/animation/useThinking.js.map +1 -0
- package/dist/cli/commands.d.ts +26 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +816 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/theme.d.ts +101 -0
- package/dist/cli/theme.d.ts.map +1 -0
- package/dist/cli/theme.js +222 -0
- package/dist/cli/theme.js.map +1 -0
- package/dist/commands/SlashCommands.d.ts +15 -0
- package/dist/commands/SlashCommands.d.ts.map +1 -0
- package/dist/commands/SlashCommands.js +238 -0
- package/dist/commands/SlashCommands.js.map +1 -0
- package/dist/gateway/Discord.d.ts +13 -0
- package/dist/gateway/Discord.d.ts.map +1 -0
- package/dist/gateway/Discord.js +144 -0
- package/dist/gateway/Discord.js.map +1 -0
- package/dist/gateway/Gateway.d.ts +71 -0
- package/dist/gateway/Gateway.d.ts.map +1 -0
- package/dist/gateway/Gateway.js +665 -0
- package/dist/gateway/Gateway.js.map +1 -0
- package/dist/gateway/Telegram.d.ts +18 -0
- package/dist/gateway/Telegram.d.ts.map +1 -0
- package/dist/gateway/Telegram.js +224 -0
- package/dist/gateway/Telegram.js.map +1 -0
- package/dist/gateway/WASessionStore.d.ts +13 -0
- package/dist/gateway/WASessionStore.d.ts.map +1 -0
- package/dist/gateway/WASessionStore.js +94 -0
- package/dist/gateway/WASessionStore.js.map +1 -0
- package/dist/gateway/WhatsApp.d.ts +19 -0
- package/dist/gateway/WhatsApp.d.ts.map +1 -0
- package/dist/gateway/WhatsApp.js +159 -0
- package/dist/gateway/WhatsApp.js.map +1 -0
- package/dist/gateway-entry.d.ts +3 -0
- package/dist/gateway-entry.d.ts.map +1 -0
- package/dist/gateway-entry.js +50 -0
- package/dist/gateway-entry.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +213 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/index.d.ts +70 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +390 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/skills/SkillRegistry.d.ts +33 -0
- package/dist/skills/SkillRegistry.d.ts.map +1 -0
- package/dist/skills/SkillRegistry.js +102 -0
- package/dist/skills/SkillRegistry.js.map +1 -0
- package/dist/token-counter.linux-x64-gnu.node +0 -0
- package/dist/tools/Backend.d.ts +3 -0
- package/dist/tools/Backend.d.ts.map +1 -0
- package/dist/tools/Backend.js +154 -0
- package/dist/tools/Backend.js.map +1 -0
- package/dist/tools/Blockchain.d.ts +3 -0
- package/dist/tools/Blockchain.d.ts.map +1 -0
- package/dist/tools/Blockchain.js +82 -0
- package/dist/tools/Blockchain.js.map +1 -0
- package/dist/tools/Browser.d.ts +5 -0
- package/dist/tools/Browser.d.ts.map +1 -0
- package/dist/tools/Browser.js +2253 -0
- package/dist/tools/Browser.js.map +1 -0
- package/dist/tools/Cloud.d.ts +3 -0
- package/dist/tools/Cloud.d.ts.map +1 -0
- package/dist/tools/Cloud.js +115 -0
- package/dist/tools/Cloud.js.map +1 -0
- package/dist/tools/CodeExec.d.ts +3 -0
- package/dist/tools/CodeExec.d.ts.map +1 -0
- package/dist/tools/CodeExec.js +76 -0
- package/dist/tools/CodeExec.js.map +1 -0
- package/dist/tools/Cybersec.d.ts +3 -0
- package/dist/tools/Cybersec.d.ts.map +1 -0
- package/dist/tools/Cybersec.js +186 -0
- package/dist/tools/Cybersec.js.map +1 -0
- package/dist/tools/Deploy.d.ts +3 -0
- package/dist/tools/Deploy.d.ts.map +1 -0
- package/dist/tools/Deploy.js +87 -0
- package/dist/tools/Deploy.js.map +1 -0
- package/dist/tools/Diagram.d.ts +3 -0
- package/dist/tools/Diagram.d.ts.map +1 -0
- package/dist/tools/Diagram.js +38 -0
- package/dist/tools/Diagram.js.map +1 -0
- package/dist/tools/Docker.d.ts +3 -0
- package/dist/tools/Docker.d.ts.map +1 -0
- package/dist/tools/Docker.js +45 -0
- package/dist/tools/Docker.js.map +1 -0
- package/dist/tools/Email.d.ts +3 -0
- package/dist/tools/Email.d.ts.map +1 -0
- package/dist/tools/Email.js +172 -0
- package/dist/tools/Email.js.map +1 -0
- package/dist/tools/Excel.d.ts +3 -0
- package/dist/tools/Excel.d.ts.map +1 -0
- package/dist/tools/Excel.js +41 -0
- package/dist/tools/Excel.js.map +1 -0
- package/dist/tools/FileEdit.d.ts +3 -0
- package/dist/tools/FileEdit.d.ts.map +1 -0
- package/dist/tools/FileEdit.js +69 -0
- package/dist/tools/FileEdit.js.map +1 -0
- package/dist/tools/FileOps.d.ts +5 -0
- package/dist/tools/FileOps.d.ts.map +1 -0
- package/dist/tools/FileOps.js +76 -0
- package/dist/tools/FileOps.js.map +1 -0
- package/dist/tools/Frontend.d.ts +3 -0
- package/dist/tools/Frontend.d.ts.map +1 -0
- package/dist/tools/Frontend.js +124 -0
- package/dist/tools/Frontend.js.map +1 -0
- package/dist/tools/GifSearch.d.ts +3 -0
- package/dist/tools/GifSearch.d.ts.map +1 -0
- package/dist/tools/GifSearch.js +36 -0
- package/dist/tools/GifSearch.js.map +1 -0
- package/dist/tools/Github.d.ts +3 -0
- package/dist/tools/Github.d.ts.map +1 -0
- package/dist/tools/Github.js +95 -0
- package/dist/tools/Github.js.map +1 -0
- package/dist/tools/GithubConnect.d.ts +3 -0
- package/dist/tools/GithubConnect.d.ts.map +1 -0
- package/dist/tools/GithubConnect.js +282 -0
- package/dist/tools/GithubConnect.js.map +1 -0
- package/dist/tools/Humanizer.d.ts +3 -0
- package/dist/tools/Humanizer.d.ts.map +1 -0
- package/dist/tools/Humanizer.js +45 -0
- package/dist/tools/Humanizer.js.map +1 -0
- package/dist/tools/Maps.d.ts +3 -0
- package/dist/tools/Maps.d.ts.map +1 -0
- package/dist/tools/Maps.js +51 -0
- package/dist/tools/Maps.js.map +1 -0
- package/dist/tools/McpManage.d.ts +26 -0
- package/dist/tools/McpManage.d.ts.map +1 -0
- package/dist/tools/McpManage.js +229 -0
- package/dist/tools/McpManage.js.map +1 -0
- package/dist/tools/Memory.d.ts +3 -0
- package/dist/tools/Memory.d.ts.map +1 -0
- package/dist/tools/Memory.js +68 -0
- package/dist/tools/Memory.js.map +1 -0
- package/dist/tools/Music.d.ts +3 -0
- package/dist/tools/Music.d.ts.map +1 -0
- package/dist/tools/Music.js +274 -0
- package/dist/tools/Music.js.map +1 -0
- package/dist/tools/Notifier.d.ts +3 -0
- package/dist/tools/Notifier.d.ts.map +1 -0
- package/dist/tools/Notifier.js +31 -0
- package/dist/tools/Notifier.js.map +1 -0
- package/dist/tools/Osint.d.ts +3 -0
- package/dist/tools/Osint.d.ts.map +1 -0
- package/dist/tools/Osint.js +57 -0
- package/dist/tools/Osint.js.map +1 -0
- package/dist/tools/Pdf.d.ts +3 -0
- package/dist/tools/Pdf.d.ts.map +1 -0
- package/dist/tools/Pdf.js +152 -0
- package/dist/tools/Pdf.js.map +1 -0
- package/dist/tools/Planning.d.ts +3 -0
- package/dist/tools/Planning.d.ts.map +1 -0
- package/dist/tools/Planning.js +212 -0
- package/dist/tools/Planning.js.map +1 -0
- package/dist/tools/Pptx.d.ts +3 -0
- package/dist/tools/Pptx.d.ts.map +1 -0
- package/dist/tools/Pptx.js +47 -0
- package/dist/tools/Pptx.js.map +1 -0
- package/dist/tools/Registry.d.ts +39 -0
- package/dist/tools/Registry.d.ts.map +1 -0
- package/dist/tools/Registry.js +151 -0
- package/dist/tools/Registry.js.map +1 -0
- package/dist/tools/Research.d.ts +3 -0
- package/dist/tools/Research.d.ts.map +1 -0
- package/dist/tools/Research.js +126 -0
- package/dist/tools/Research.js.map +1 -0
- package/dist/tools/ResearchForums.d.ts +3 -0
- package/dist/tools/ResearchForums.d.ts.map +1 -0
- package/dist/tools/ResearchForums.js +84 -0
- package/dist/tools/ResearchForums.js.map +1 -0
- package/dist/tools/Scraper.d.ts +3 -0
- package/dist/tools/Scraper.d.ts.map +1 -0
- package/dist/tools/Scraper.js +54 -0
- package/dist/tools/Scraper.js.map +1 -0
- package/dist/tools/SendFile.d.ts +4 -0
- package/dist/tools/SendFile.d.ts.map +1 -0
- package/dist/tools/SendFile.js +71 -0
- package/dist/tools/SendFile.js.map +1 -0
- package/dist/tools/SkillLoader.d.ts +3 -0
- package/dist/tools/SkillLoader.d.ts.map +1 -0
- package/dist/tools/SkillLoader.js +132 -0
- package/dist/tools/SkillLoader.js.map +1 -0
- package/dist/tools/SystemMonitor.d.ts +3 -0
- package/dist/tools/SystemMonitor.d.ts.map +1 -0
- package/dist/tools/SystemMonitor.js +59 -0
- package/dist/tools/SystemMonitor.js.map +1 -0
- package/dist/tools/Terminal.d.ts +3 -0
- package/dist/tools/Terminal.d.ts.map +1 -0
- package/dist/tools/Terminal.js +32 -0
- package/dist/tools/Terminal.js.map +1 -0
- package/dist/tools/Todo.d.ts +3 -0
- package/dist/tools/Todo.d.ts.map +1 -0
- package/dist/tools/Todo.js +87 -0
- package/dist/tools/Todo.js.map +1 -0
- package/dist/tools/Trading.d.ts +3 -0
- package/dist/tools/Trading.d.ts.map +1 -0
- package/dist/tools/Trading.js +277 -0
- package/dist/tools/Trading.js.map +1 -0
- package/dist/tools/Vision.d.ts +3 -0
- package/dist/tools/Vision.d.ts.map +1 -0
- package/dist/tools/Vision.js +99 -0
- package/dist/tools/Vision.js.map +1 -0
- package/dist/tools/Vps.d.ts +3 -0
- package/dist/tools/Vps.d.ts.map +1 -0
- package/dist/tools/Vps.js +178 -0
- package/dist/tools/Vps.js.map +1 -0
- package/dist/tools/WebSearch.d.ts +3 -0
- package/dist/tools/WebSearch.d.ts.map +1 -0
- package/dist/tools/WebSearch.js +115 -0
- package/dist/tools/WebSearch.js.map +1 -0
- package/dist/tools/YouTube.d.ts +3 -0
- package/dist/tools/YouTube.d.ts.map +1 -0
- package/dist/tools/YouTube.js +30 -0
- package/dist/tools/YouTube.js.map +1 -0
- package/dist/utils/ascii-logo.d.ts +9 -0
- package/dist/utils/ascii-logo.d.ts.map +1 -0
- package/dist/utils/ascii-logo.js +34 -0
- package/dist/utils/ascii-logo.js.map +1 -0
- package/dist/utils/base-url.d.ts +9 -0
- package/dist/utils/base-url.d.ts.map +1 -0
- package/dist/utils/base-url.js +58 -0
- package/dist/utils/base-url.js.map +1 -0
- package/native/token-counter/index.d.ts +7 -0
- package/native/token-counter/index.js +316 -0
- package/native/token-counter/node_modules/.package-lock.json +568 -0
- package/native/token-counter/node_modules/2/array.js +25 -0
- package/native/token-counter/node_modules/2/index.js +12 -0
- package/native/token-counter/node_modules/2/iterator.js +13 -0
- package/native/token-counter/node_modules/2/license.txt +21 -0
- package/native/token-counter/node_modules/2/map.js +27 -0
- package/native/token-counter/node_modules/2/number.js +109 -0
- package/native/token-counter/node_modules/2/object.js +23 -0
- package/native/token-counter/node_modules/2/package.json +60 -0
- package/native/token-counter/node_modules/2/readme.md +246 -0
- package/native/token-counter/node_modules/2/string.js +11 -0
- package/native/token-counter/node_modules/2/test.js +520 -0
- package/native/token-counter/node_modules/@lamansky/every/index.js +16 -0
- package/native/token-counter/node_modules/@lamansky/every/license.txt +21 -0
- package/native/token-counter/node_modules/@lamansky/every/package.json +38 -0
- package/native/token-counter/node_modules/@lamansky/every/readme.md +46 -0
- package/native/token-counter/node_modules/@lamansky/flatten/index.js +5 -0
- package/native/token-counter/node_modules/@lamansky/flatten/license.txt +21 -0
- package/native/token-counter/node_modules/@lamansky/flatten/package.json +35 -0
- package/native/token-counter/node_modules/@lamansky/flatten/readme.md +41 -0
- package/native/token-counter/node_modules/@napi-rs/cli/LICENSE +21 -0
- package/native/token-counter/node_modules/@napi-rs/cli/README.md +96 -0
- package/native/token-counter/node_modules/@napi-rs/cli/package.json +65 -0
- package/native/token-counter/node_modules/@napi-rs/cli/scripts/index.js +51371 -0
- package/native/token-counter/node_modules/add-counter/index.js +3 -0
- package/native/token-counter/node_modules/add-counter/license.txt +21 -0
- package/native/token-counter/node_modules/add-counter/package.json +34 -0
- package/native/token-counter/node_modules/add-counter/readme.md +36 -0
- package/native/token-counter/node_modules/array-pad/LICENSE +22 -0
- package/native/token-counter/node_modules/array-pad/README.md +80 -0
- package/native/token-counter/node_modules/array-pad/index.js +30 -0
- package/native/token-counter/node_modules/array-pad/package.json +28 -0
- package/native/token-counter/node_modules/arrify/index.js +8 -0
- package/native/token-counter/node_modules/arrify/license +21 -0
- package/native/token-counter/node_modules/arrify/package.json +33 -0
- package/native/token-counter/node_modules/arrify/readme.md +36 -0
- package/native/token-counter/node_modules/case-insensitive/index.js +72 -0
- package/native/token-counter/node_modules/case-insensitive/license.txt +21 -0
- package/native/token-counter/node_modules/case-insensitive/package.json +39 -0
- package/native/token-counter/node_modules/case-insensitive/readme.md +39 -0
- package/native/token-counter/node_modules/case-insensitive/test.js +114 -0
- package/native/token-counter/node_modules/class-chain/index.js +32 -0
- package/native/token-counter/node_modules/class-chain/license.txt +21 -0
- package/native/token-counter/node_modules/class-chain/package.json +39 -0
- package/native/token-counter/node_modules/class-chain/readme.md +23 -0
- package/native/token-counter/node_modules/class-chain/test.js +77 -0
- package/native/token-counter/node_modules/copy-own/index.js +10 -0
- package/native/token-counter/node_modules/copy-own/license.txt +21 -0
- package/native/token-counter/node_modules/copy-own/package.json +37 -0
- package/native/token-counter/node_modules/copy-own/readme.md +67 -0
- package/native/token-counter/node_modules/def-props/index.js +43 -0
- package/native/token-counter/node_modules/def-props/license.txt +21 -0
- package/native/token-counter/node_modules/def-props/node_modules/is-obj/index.d.ts +22 -0
- package/native/token-counter/node_modules/def-props/node_modules/is-obj/index.js +6 -0
- package/native/token-counter/node_modules/def-props/node_modules/is-obj/license +9 -0
- package/native/token-counter/node_modules/def-props/node_modules/is-obj/package.json +34 -0
- package/native/token-counter/node_modules/def-props/node_modules/is-obj/readme.md +39 -0
- package/native/token-counter/node_modules/def-props/package.json +51 -0
- package/native/token-counter/node_modules/def-props/readme.md +117 -0
- package/native/token-counter/node_modules/empty-iterator/index.js +3 -0
- package/native/token-counter/node_modules/empty-iterator/license.txt +21 -0
- package/native/token-counter/node_modules/empty-iterator/package.json +33 -0
- package/native/token-counter/node_modules/empty-iterator/readme.md +23 -0
- package/native/token-counter/node_modules/enforce-range/index.js +15 -0
- package/native/token-counter/node_modules/enforce-range/license.txt +21 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/array.js +43 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/index.js +10 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/iterator.js +26 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/license.txt +21 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/map.js +47 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/number.js +33 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/object.js +61 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/package.json +41 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/readme.md +210 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/string.js +37 -0
- package/native/token-counter/node_modules/enforce-range/node_modules/2/test.js +413 -0
- package/native/token-counter/node_modules/enforce-range/package.json +36 -0
- package/native/token-counter/node_modules/enforce-range/readme.md +53 -0
- package/native/token-counter/node_modules/english-list/.travis.yml +6 -0
- package/native/token-counter/node_modules/english-list/LICENSE +22 -0
- package/native/token-counter/node_modules/english-list/README.md +44 -0
- package/native/token-counter/node_modules/english-list/index.js +34 -0
- package/native/token-counter/node_modules/english-list/package.json +31 -0
- package/native/token-counter/node_modules/english-list/test.log +6 -0
- package/native/token-counter/node_modules/errate/index.js +19 -0
- package/native/token-counter/node_modules/errate/license.txt +21 -0
- package/native/token-counter/node_modules/errate/package.json +39 -0
- package/native/token-counter/node_modules/errate/readme.md +79 -0
- package/native/token-counter/node_modules/ffn/index.js +9 -0
- package/native/token-counter/node_modules/ffn/license.txt +21 -0
- package/native/token-counter/node_modules/ffn/package.json +34 -0
- package/native/token-counter/node_modules/ffn/readme.md +51 -0
- package/native/token-counter/node_modules/get-own-property/index.js +5 -0
- package/native/token-counter/node_modules/get-own-property/license.txt +21 -0
- package/native/token-counter/node_modules/get-own-property/package.json +31 -0
- package/native/token-counter/node_modules/get-own-property/readme.md +22 -0
- package/native/token-counter/node_modules/has-duplicates/index.js +11 -0
- package/native/token-counter/node_modules/has-duplicates/license.txt +21 -0
- package/native/token-counter/node_modules/has-duplicates/package.json +32 -0
- package/native/token-counter/node_modules/has-duplicates/readme.md +23 -0
- package/native/token-counter/node_modules/has-duplicates/test.js +30 -0
- package/native/token-counter/node_modules/if-else-throw/index.js +8 -0
- package/native/token-counter/node_modules/if-else-throw/license.txt +21 -0
- package/native/token-counter/node_modules/if-else-throw/package.json +37 -0
- package/native/token-counter/node_modules/if-else-throw/readme.md +32 -0
- package/native/token-counter/node_modules/is-array-of-length/index.js +7 -0
- package/native/token-counter/node_modules/is-array-of-length/license.txt +21 -0
- package/native/token-counter/node_modules/is-array-of-length/package.json +42 -0
- package/native/token-counter/node_modules/is-array-of-length/readme.md +41 -0
- package/native/token-counter/node_modules/is-class-of/index.js +7 -0
- package/native/token-counter/node_modules/is-class-of/license.txt +21 -0
- package/native/token-counter/node_modules/is-class-of/package.json +35 -0
- package/native/token-counter/node_modules/is-class-of/readme.md +57 -0
- package/native/token-counter/node_modules/is-global-object/index.js +6 -0
- package/native/token-counter/node_modules/is-global-object/license.txt +21 -0
- package/native/token-counter/node_modules/is-global-object/package.json +34 -0
- package/native/token-counter/node_modules/is-global-object/readme.md +22 -0
- package/native/token-counter/node_modules/is-instance-of/index.js +28 -0
- package/native/token-counter/node_modules/is-instance-of/license.txt +21 -0
- package/native/token-counter/node_modules/is-instance-of/package.json +44 -0
- package/native/token-counter/node_modules/is-instance-of/readme.md +55 -0
- package/native/token-counter/node_modules/is-iterable/index.js +5 -0
- package/native/token-counter/node_modules/is-iterable/license +21 -0
- package/native/token-counter/node_modules/is-iterable/package.json +30 -0
- package/native/token-counter/node_modules/is-iterable/readme.md +23 -0
- package/native/token-counter/node_modules/is-nil/LICENSE +21 -0
- package/native/token-counter/node_modules/is-nil/README.md +47 -0
- package/native/token-counter/node_modules/is-nil/index.js +6 -0
- package/native/token-counter/node_modules/is-nil/package.json +46 -0
- package/native/token-counter/node_modules/is-obj/index.js +5 -0
- package/native/token-counter/node_modules/is-obj/license +21 -0
- package/native/token-counter/node_modules/is-obj/package.json +33 -0
- package/native/token-counter/node_modules/is-obj/readme.md +34 -0
- package/native/token-counter/node_modules/is-object/.eslintignore +1 -0
- package/native/token-counter/node_modules/is-object/.eslintrc +5 -0
- package/native/token-counter/node_modules/is-object/.nycrc +13 -0
- package/native/token-counter/node_modules/is-object/.testem.json +14 -0
- package/native/token-counter/node_modules/is-object/CHANGELOG.md +121 -0
- package/native/token-counter/node_modules/is-object/LICENSE +19 -0
- package/native/token-counter/node_modules/is-object/README.md +48 -0
- package/native/token-counter/node_modules/is-object/index.js +5 -0
- package/native/token-counter/node_modules/is-object/package.json +78 -0
- package/native/token-counter/node_modules/is-object/test/index.js +44 -0
- package/native/token-counter/node_modules/is-plain-object/LICENSE +21 -0
- package/native/token-counter/node_modules/is-plain-object/README.md +104 -0
- package/native/token-counter/node_modules/is-plain-object/index.d.ts +5 -0
- package/native/token-counter/node_modules/is-plain-object/index.js +37 -0
- package/native/token-counter/node_modules/is-plain-object/package.json +79 -0
- package/native/token-counter/node_modules/isobject/LICENSE +21 -0
- package/native/token-counter/node_modules/isobject/README.md +122 -0
- package/native/token-counter/node_modules/isobject/index.d.ts +5 -0
- package/native/token-counter/node_modules/isobject/index.js +12 -0
- package/native/token-counter/node_modules/isobject/package.json +74 -0
- package/native/token-counter/node_modules/lodash.set/LICENSE +47 -0
- package/native/token-counter/node_modules/lodash.set/README.md +18 -0
- package/native/token-counter/node_modules/lodash.set/index.js +990 -0
- package/native/token-counter/node_modules/lodash.set/package.json +17 -0
- package/native/token-counter/node_modules/longest-first/index.js +3 -0
- package/native/token-counter/node_modules/longest-first/license.txt +21 -0
- package/native/token-counter/node_modules/longest-first/package.json +36 -0
- package/native/token-counter/node_modules/longest-first/readme.md +29 -0
- package/native/token-counter/node_modules/m-o/index.js +27 -0
- package/native/token-counter/node_modules/m-o/license.txt +21 -0
- package/native/token-counter/node_modules/m-o/node_modules/new-object/index.js +23 -0
- package/native/token-counter/node_modules/m-o/node_modules/new-object/license.txt +21 -0
- package/native/token-counter/node_modules/m-o/node_modules/new-object/package.json +40 -0
- package/native/token-counter/node_modules/m-o/node_modules/new-object/readme.md +55 -0
- package/native/token-counter/node_modules/m-o/package.json +45 -0
- package/native/token-counter/node_modules/m-o/readme.md +87 -0
- package/native/token-counter/node_modules/map-iter/index.js +6 -0
- package/native/token-counter/node_modules/map-iter/license.txt +21 -0
- package/native/token-counter/node_modules/map-iter/package.json +40 -0
- package/native/token-counter/node_modules/map-iter/readme.md +46 -0
- package/native/token-counter/node_modules/new-object/index.js +5 -0
- package/native/token-counter/node_modules/new-object/license.txt +21 -0
- package/native/token-counter/node_modules/new-object/package.json +49 -0
- package/native/token-counter/node_modules/new-object/readme.md +145 -0
- package/native/token-counter/node_modules/ofn/index.js +22 -0
- package/native/token-counter/node_modules/ofn/license.txt +21 -0
- package/native/token-counter/node_modules/ofn/package.json +40 -0
- package/native/token-counter/node_modules/ofn/readme.md +63 -0
- package/native/token-counter/node_modules/otherwise/index.js +11 -0
- package/native/token-counter/node_modules/otherwise/license.txt +21 -0
- package/native/token-counter/node_modules/otherwise/package.json +38 -0
- package/native/token-counter/node_modules/otherwise/readme.md +29 -0
- package/native/token-counter/node_modules/parser-factory/index.js +138 -0
- package/native/token-counter/node_modules/parser-factory/license.txt +21 -0
- package/native/token-counter/node_modules/parser-factory/node_modules/arrify/index.d.ts +38 -0
- package/native/token-counter/node_modules/parser-factory/node_modules/arrify/index.js +23 -0
- package/native/token-counter/node_modules/parser-factory/node_modules/arrify/license +9 -0
- package/native/token-counter/node_modules/parser-factory/node_modules/arrify/package.json +35 -0
- package/native/token-counter/node_modules/parser-factory/node_modules/arrify/readme.md +39 -0
- package/native/token-counter/node_modules/parser-factory/package.json +38 -0
- package/native/token-counter/node_modules/parser-factory/readme.md +15 -0
- package/native/token-counter/node_modules/pfn/index.js +5 -0
- package/native/token-counter/node_modules/pfn/license.txt +21 -0
- package/native/token-counter/node_modules/pfn/package.json +41 -0
- package/native/token-counter/node_modules/pfn/readme.md +111 -0
- package/native/token-counter/node_modules/pfn/strict.js +8 -0
- package/native/token-counter/node_modules/plainify/index.js +5 -0
- package/native/token-counter/node_modules/plainify/license.txt +21 -0
- package/native/token-counter/node_modules/plainify/package.json +36 -0
- package/native/token-counter/node_modules/plainify/readme.md +47 -0
- package/native/token-counter/node_modules/possible-function/changelog.md +7 -0
- package/native/token-counter/node_modules/possible-function/index.js +43 -0
- package/native/token-counter/node_modules/possible-function/license.txt +21 -0
- package/native/token-counter/node_modules/possible-function/package.json +34 -0
- package/native/token-counter/node_modules/possible-function/readme.md +77 -0
- package/native/token-counter/node_modules/possible-function/test.js +32 -0
- package/native/token-counter/node_modules/qfn/index.js +11 -0
- package/native/token-counter/node_modules/qfn/license.txt +21 -0
- package/native/token-counter/node_modules/qfn/package.json +40 -0
- package/native/token-counter/node_modules/qfn/readme.md +45 -0
- package/native/token-counter/node_modules/roadblock/index.js +3 -0
- package/native/token-counter/node_modules/roadblock/license.txt +21 -0
- package/native/token-counter/node_modules/roadblock/package.json +40 -0
- package/native/token-counter/node_modules/roadblock/readme.md +59 -0
- package/native/token-counter/node_modules/round-to/index.d.ts +56 -0
- package/native/token-counter/node_modules/round-to/index.js +37 -0
- package/native/token-counter/node_modules/round-to/license +9 -0
- package/native/token-counter/node_modules/round-to/package.json +38 -0
- package/native/token-counter/node_modules/round-to/readme.md +71 -0
- package/native/token-counter/node_modules/rtrim-array/index.js +10 -0
- package/native/token-counter/node_modules/rtrim-array/license.txt +21 -0
- package/native/token-counter/node_modules/rtrim-array/package.json +41 -0
- package/native/token-counter/node_modules/rtrim-array/readme.md +75 -0
- package/native/token-counter/node_modules/sbo/index.js +25 -0
- package/native/token-counter/node_modules/sbo/license.txt +21 -0
- package/native/token-counter/node_modules/sbo/package.json +50 -0
- package/native/token-counter/node_modules/sbo/readme.md +105 -0
- package/native/token-counter/node_modules/sorp/index.js +3 -0
- package/native/token-counter/node_modules/sorp/license.txt +21 -0
- package/native/token-counter/node_modules/sorp/package.json +34 -0
- package/native/token-counter/node_modules/sorp/readme.md +25 -0
- package/native/token-counter/node_modules/trim-call/index.js +6 -0
- package/native/token-counter/node_modules/trim-call/license.txt +21 -0
- package/native/token-counter/node_modules/trim-call/package.json +40 -0
- package/native/token-counter/node_modules/trim-call/readme.md +80 -0
- package/native/token-counter/node_modules/type-error/LICENSE +21 -0
- package/native/token-counter/node_modules/type-error/README.md +24 -0
- package/native/token-counter/node_modules/type-error/index.js +35 -0
- package/native/token-counter/node_modules/type-error/package.json +11 -0
- package/native/token-counter/node_modules/vfn/index.js +21 -0
- package/native/token-counter/node_modules/vfn/license.txt +21 -0
- package/native/token-counter/node_modules/vfn/package.json +40 -0
- package/native/token-counter/node_modules/vfn/readme.md +81 -0
- package/native/token-counter/node_modules/wfn/index.js +43 -0
- package/native/token-counter/node_modules/wfn/license.txt +21 -0
- package/native/token-counter/node_modules/wfn/package.json +38 -0
- package/native/token-counter/node_modules/wfn/readme.md +81 -0
- package/native/token-counter/package-lock.json +578 -0
- package/native/token-counter/package.json +21 -0
- package/native/token-counter/token-counter.linux-x64-gnu.node +0 -0
- package/package.json +98 -0
- package/scripts/build.cjs +27 -0
- package/scripts/deploy.sh +29 -0
- package/scripts/music.py +268 -0
- package/scripts/postinstall.mjs +81 -0
- package/scripts/push.sh +5 -0
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import crypto from 'crypto';
|
|
3
|
+
import { loadConfig, saveConfig } from '../agent/Config.js';
|
|
4
|
+
import { AgentLoop } from '../agent/AgentLoop.js';
|
|
5
|
+
function cryptoRandomId() {
|
|
6
|
+
return crypto.randomBytes(6).toString('hex');
|
|
7
|
+
}
|
|
8
|
+
const COMMAND_GUIDE = `⏳ *AURIX Agent* — Multi-Agent AI Assistant
|
|
9
|
+
|
|
10
|
+
📋 *ALL COMMANDS:*
|
|
11
|
+
|
|
12
|
+
*Session:*
|
|
13
|
+
/start — Show this guide
|
|
14
|
+
/help — Quick help
|
|
15
|
+
/reset — Clear conversation
|
|
16
|
+
/cancel — Stop current task (unlocks queue)
|
|
17
|
+
/title [name] — Name & save session (auto-random if no name)
|
|
18
|
+
/resume [name] — Load a saved session (list if no name)
|
|
19
|
+
/save — Save current session
|
|
20
|
+
/status — Model, provider, uptime
|
|
21
|
+
/history — Message count
|
|
22
|
+
|
|
23
|
+
*Configuration:*
|
|
24
|
+
/model <name> — Switch AI model
|
|
25
|
+
/baseurl <url> — Change API base URL
|
|
26
|
+
/apikey <key> — Set API key
|
|
27
|
+
/depth <level> — Research depth (low/medium/high/xhigh/max/ultra)
|
|
28
|
+
/fast — Toggle fast mode
|
|
29
|
+
|
|
30
|
+
*Tools & Skills:*
|
|
31
|
+
/tools — List available tools
|
|
32
|
+
/skills — List available skills
|
|
33
|
+
|
|
34
|
+
*AI Features:*
|
|
35
|
+
/review — AI code review
|
|
36
|
+
/plan — Planning mode
|
|
37
|
+
/research <topic> — Deep research with sources
|
|
38
|
+
/research-forums <topic> — Research on Reddit, X, YouTube, HN, etc.
|
|
39
|
+
/summarize — Summarize long text
|
|
40
|
+
|
|
41
|
+
*Documents:*
|
|
42
|
+
/pdf <content> — Generate PDF document
|
|
43
|
+
/pptx <topic> — Generate PowerPoint
|
|
44
|
+
/xlsx <topic> — Generate Excel spreadsheet
|
|
45
|
+
|
|
46
|
+
*Advanced:*
|
|
47
|
+
/compress — Compress context
|
|
48
|
+
/agents — Show active agents
|
|
49
|
+
/queue <text> — Queue a message
|
|
50
|
+
|
|
51
|
+
💡 *RESEARCH DEPTH:*
|
|
52
|
+
low — Quick single-agent answers
|
|
53
|
+
medium — Research + sources
|
|
54
|
+
high — Full team + citations (multi-agent)
|
|
55
|
+
xhigh — + Debate system
|
|
56
|
+
max — + Logic critic
|
|
57
|
+
ultra — + Final review loop (publication-grade)
|
|
58
|
+
|
|
59
|
+
💡 *TIPS:*
|
|
60
|
+
Just type your question to start.
|
|
61
|
+
Use /depth to control thoroughness.
|
|
62
|
+
Journal/scientific answers include sources.`;
|
|
63
|
+
const WA_COMMAND_GUIDE = `⏳ *AURIX Agent* — Multi-Agent AI Assistant
|
|
64
|
+
|
|
65
|
+
📋 *ALL COMMANDS:*
|
|
66
|
+
|
|
67
|
+
*Session:*
|
|
68
|
+
!ai start — Show this guide
|
|
69
|
+
!ai help — Quick help
|
|
70
|
+
!ai reset — Clear conversation
|
|
71
|
+
!ai cancel — Stop current task
|
|
72
|
+
!ai status — Model, provider, uptime
|
|
73
|
+
!ai history — Message count
|
|
74
|
+
|
|
75
|
+
*Configuration:*
|
|
76
|
+
!ai model <name> — Switch AI model
|
|
77
|
+
!ai depth <level> — Research depth
|
|
78
|
+
|
|
79
|
+
*Tools & Skills:*
|
|
80
|
+
!ai tools — List available tools
|
|
81
|
+
!ai skills — List available skills
|
|
82
|
+
|
|
83
|
+
*AI Features:*
|
|
84
|
+
!ai review — AI code review
|
|
85
|
+
!ai plan — Planning mode
|
|
86
|
+
!ai research <topic> — Deep research
|
|
87
|
+
!ai research-forums <topic> — Research on Reddit, X, YouTube
|
|
88
|
+
!ai summarize — Summarize text
|
|
89
|
+
|
|
90
|
+
*Documents:*
|
|
91
|
+
!ai pdf <content> — Generate PDF
|
|
92
|
+
!ai pptx <topic> — Generate PowerPoint
|
|
93
|
+
!ai xlsx <topic> — Generate Excel
|
|
94
|
+
|
|
95
|
+
💡 Just type your question after !ai
|
|
96
|
+
Example: !ai make a python loop script`;
|
|
97
|
+
const MINI_GUIDE = `Hi! I'm AURIX Agent ⏳
|
|
98
|
+
Type /start for all commands, or just ask me anything.
|
|
99
|
+
Research: /depth low|medium|high|xhigh|max|ultra`;
|
|
100
|
+
const WA_MINI_GUIDE = `Hi! I'm AURIX Agent ⏳
|
|
101
|
+
Type !ai start for all commands.
|
|
102
|
+
Example: !ai make me a python script`;
|
|
103
|
+
const VALID_DEPTHS = ['low', 'medium', 'high', 'xhigh', 'max', 'ultra'];
|
|
104
|
+
const STATUS_EMOJIS = {
|
|
105
|
+
thinking: '⏳',
|
|
106
|
+
tool_start: '🔧',
|
|
107
|
+
text: '✍️',
|
|
108
|
+
done: '✅',
|
|
109
|
+
error: '❌',
|
|
110
|
+
};
|
|
111
|
+
function formatStatus(status, detail) {
|
|
112
|
+
const emoji = STATUS_EMOJIS[status] || '⏳';
|
|
113
|
+
const label = {
|
|
114
|
+
thinking: 'Thinking...',
|
|
115
|
+
tool_start: `Using ${detail || 'tool'}...`,
|
|
116
|
+
text: 'Writing response...',
|
|
117
|
+
done: 'Done!',
|
|
118
|
+
error: 'Error',
|
|
119
|
+
};
|
|
120
|
+
return `${emoji} ${label[status] || status}`;
|
|
121
|
+
}
|
|
122
|
+
const SOURCE_LABELS = {
|
|
123
|
+
reddit: 'Reddit',
|
|
124
|
+
x: 'X/Twitter',
|
|
125
|
+
twitter: 'X/Twitter',
|
|
126
|
+
youtube: 'YouTube',
|
|
127
|
+
tiktok: 'TikTok',
|
|
128
|
+
hackernews: 'Hacker News',
|
|
129
|
+
polymarket: 'Polymarket',
|
|
130
|
+
github: 'GitHub',
|
|
131
|
+
instagram: 'Instagram',
|
|
132
|
+
bluesky: 'Bluesky',
|
|
133
|
+
threads: 'Threads',
|
|
134
|
+
pinterest: 'Pinterest',
|
|
135
|
+
web: 'Web',
|
|
136
|
+
digg: 'Digg',
|
|
137
|
+
truthsocial: 'Truth Social',
|
|
138
|
+
facebook: 'Facebook',
|
|
139
|
+
};
|
|
140
|
+
function formatToolStatus(toolName, args) {
|
|
141
|
+
if (toolName === 'research_forums') {
|
|
142
|
+
const sources = args?.sources
|
|
143
|
+
? String(args.sources).split(',').map(s => SOURCE_LABELS[s.trim().toLowerCase()] || s.trim())
|
|
144
|
+
: ['Reddit', 'X/Twitter', 'YouTube', 'Hacker News', 'GitHub', 'Web'];
|
|
145
|
+
return `🔬 Researching on ${sources.join(', ')}...`;
|
|
146
|
+
}
|
|
147
|
+
if (toolName === 'research') {
|
|
148
|
+
const depth = args?.depth ? String(args.depth) : 'standard';
|
|
149
|
+
const query = args?.query ? String(args.query).slice(0, 60) : '';
|
|
150
|
+
return `🔬 Deep research: ${query} (${depth} depth)...`;
|
|
151
|
+
}
|
|
152
|
+
if (toolName === 'web_search') {
|
|
153
|
+
const query = args?.query ? String(args.query).slice(0, 60) : '';
|
|
154
|
+
return `🔍 Searching web: ${query}...`;
|
|
155
|
+
}
|
|
156
|
+
if (toolName === 'terminal' || toolName === 'bash') {
|
|
157
|
+
const cmd = args?.command ? String(args.command).slice(0, 100) : '';
|
|
158
|
+
return `🔧 Running: ${cmd}...`;
|
|
159
|
+
}
|
|
160
|
+
if (toolName === 'browser') {
|
|
161
|
+
const action = args?.action ? String(args.action) : '';
|
|
162
|
+
const target = args?.target ? ` → ${String(args.target).slice(0, 40)}` : '';
|
|
163
|
+
const value = args?.value ? ` "${String(args.value).slice(0, 30)}"` : '';
|
|
164
|
+
return `🌐 Browser: ${action}${target}${value}...`;
|
|
165
|
+
}
|
|
166
|
+
if (toolName === 'read_file') {
|
|
167
|
+
const file = args?.file_path || args?.path ? String(args.file_path || args.path) : '';
|
|
168
|
+
const shortFile = String(file).split('/').pop() || file;
|
|
169
|
+
return `📄 Reading: ${shortFile}...`;
|
|
170
|
+
}
|
|
171
|
+
if (toolName === 'write_file') {
|
|
172
|
+
const file = args?.file_path || args?.path ? String(args.file_path || args.path) : '';
|
|
173
|
+
const shortFile = String(file).split('/').pop() || file;
|
|
174
|
+
return `📄 Writing: ${shortFile}...`;
|
|
175
|
+
}
|
|
176
|
+
if (toolName === 'file_edit') {
|
|
177
|
+
const file = args?.file_path || args?.path ? String(args.file_path || args.path) : '';
|
|
178
|
+
const shortFile = String(file).split('/').pop() || file;
|
|
179
|
+
return `✏️ Editing: ${shortFile}...`;
|
|
180
|
+
}
|
|
181
|
+
if (toolName === 'search_files') {
|
|
182
|
+
const pattern = args?.pattern ? String(args.pattern).slice(0, 40) : '';
|
|
183
|
+
const path = args?.path ? ` in ${String(args.path)}` : '';
|
|
184
|
+
return `🔍 Searching: ${pattern}${path}...`;
|
|
185
|
+
}
|
|
186
|
+
return formatStatus('tool_start', toolName);
|
|
187
|
+
}
|
|
188
|
+
function cleanResponse(text) {
|
|
189
|
+
return text
|
|
190
|
+
.replace(/\$[\s\S]*?\$/gm, '')
|
|
191
|
+
.replace(/```(?:bash|sh|shell)\n[\s\S]*?```/gm, '')
|
|
192
|
+
.replace(/>\s.*$/gm, '')
|
|
193
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
194
|
+
.trim();
|
|
195
|
+
}
|
|
196
|
+
export class Gateway extends EventEmitter {
|
|
197
|
+
platforms = new Map();
|
|
198
|
+
agents = new Map();
|
|
199
|
+
config;
|
|
200
|
+
registry;
|
|
201
|
+
firstTimeUsers = new Set();
|
|
202
|
+
userDepths = new Map();
|
|
203
|
+
startTime;
|
|
204
|
+
activeProcessing = new Set();
|
|
205
|
+
lastContext = new Map();
|
|
206
|
+
sessionNames = new Map();
|
|
207
|
+
messageQueue = new Map();
|
|
208
|
+
constructor(config, registry) {
|
|
209
|
+
super();
|
|
210
|
+
this.config = config;
|
|
211
|
+
this.registry = registry;
|
|
212
|
+
this.startTime = Date.now();
|
|
213
|
+
}
|
|
214
|
+
register(platform) {
|
|
215
|
+
this.platforms.set(platform.name, platform);
|
|
216
|
+
platform.on('message', (msg) => this.handleMessage(msg));
|
|
217
|
+
}
|
|
218
|
+
getAgent(key) {
|
|
219
|
+
let agent = this.agents.get(key);
|
|
220
|
+
if (!agent) {
|
|
221
|
+
agent = new AgentLoop(this.config, this.registry);
|
|
222
|
+
this.agents.set(key, agent);
|
|
223
|
+
}
|
|
224
|
+
return agent;
|
|
225
|
+
}
|
|
226
|
+
getUserKey(msg) {
|
|
227
|
+
return `${msg.platform}:${msg.authorId}`;
|
|
228
|
+
}
|
|
229
|
+
isUserAllowed(msg) {
|
|
230
|
+
const gw = this.config.gateway;
|
|
231
|
+
if (!gw)
|
|
232
|
+
return true;
|
|
233
|
+
let allowed;
|
|
234
|
+
if (msg.platform === 'telegram')
|
|
235
|
+
allowed = gw.telegram?.allowedUsers;
|
|
236
|
+
else if (msg.platform === 'discord')
|
|
237
|
+
allowed = gw.discord?.allowedUsers;
|
|
238
|
+
else if (msg.platform === 'whatsapp')
|
|
239
|
+
allowed = gw.whatsapp?.allowedUsers;
|
|
240
|
+
if (!allowed || allowed.length === 0)
|
|
241
|
+
return true;
|
|
242
|
+
return allowed.includes(msg.authorId);
|
|
243
|
+
}
|
|
244
|
+
getUptime() {
|
|
245
|
+
const seconds = Math.floor((Date.now() - this.startTime) / 1000);
|
|
246
|
+
const h = Math.floor(seconds / 3600);
|
|
247
|
+
const m = Math.floor((seconds % 3600) / 60);
|
|
248
|
+
const s = seconds % 60;
|
|
249
|
+
if (h > 0)
|
|
250
|
+
return `${h}h ${m}m`;
|
|
251
|
+
if (m > 0)
|
|
252
|
+
return `${m}m ${s}s`;
|
|
253
|
+
return `${s}s`;
|
|
254
|
+
}
|
|
255
|
+
isWhatsApp(msg) {
|
|
256
|
+
return msg.platform === 'whatsapp';
|
|
257
|
+
}
|
|
258
|
+
normalizeCommand(text, platform) {
|
|
259
|
+
const trimmed = text.trim();
|
|
260
|
+
if (platform === 'whatsapp') {
|
|
261
|
+
if (trimmed.toLowerCase().startsWith('!ai')) {
|
|
262
|
+
const rest = trimmed.slice(3).trim();
|
|
263
|
+
const parts = rest.split(/\s+/);
|
|
264
|
+
return { cmd: (parts[0] || '').toLowerCase(), args: parts.slice(1).join(' ') };
|
|
265
|
+
}
|
|
266
|
+
return { cmd: '', args: trimmed };
|
|
267
|
+
}
|
|
268
|
+
const parts = trimmed.split(/\s+/);
|
|
269
|
+
const cmd = parts[0].toLowerCase().replace(/^\//, '');
|
|
270
|
+
return { cmd, args: parts.slice(1).join(' ') };
|
|
271
|
+
}
|
|
272
|
+
async handleMessage(msg) {
|
|
273
|
+
const agentKey = this.getUserKey(msg);
|
|
274
|
+
const platform = this.platforms.get(msg.platform);
|
|
275
|
+
if (!platform)
|
|
276
|
+
return;
|
|
277
|
+
this.lastContext.set(agentKey, {
|
|
278
|
+
platform: msg.platform,
|
|
279
|
+
channelId: msg.channelId,
|
|
280
|
+
replyTo: msg.replyTo,
|
|
281
|
+
});
|
|
282
|
+
const text = msg.content.trim();
|
|
283
|
+
const isWA = this.isWhatsApp(msg);
|
|
284
|
+
const { cmd, args } = this.normalizeCommand(text, msg.platform);
|
|
285
|
+
if (cmd === 'cancel') {
|
|
286
|
+
if (this.activeProcessing.has(agentKey)) {
|
|
287
|
+
const agent = this.agents.get(agentKey);
|
|
288
|
+
if (agent)
|
|
289
|
+
agent.interrupt();
|
|
290
|
+
this.activeProcessing.delete(agentKey);
|
|
291
|
+
this.messageQueue.delete(agentKey);
|
|
292
|
+
await platform.send('🛑 Task cancelled. Queue cleared.', msg.channelId, msg.replyTo);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
await platform.send('No active task to cancel.', msg.channelId, msg.replyTo);
|
|
296
|
+
}
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (!this.isUserAllowed(msg)) {
|
|
300
|
+
await platform.send('🔒 Access denied. Your user ID is not in the allowed list for this bot.', msg.channelId, msg.replyTo);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (cmd === 'proxy') {
|
|
304
|
+
const proxyRegex = /^\d{1,3}(\.\d{1,3}){3}:\d{1,5}(:[^:\s]+:[^:\s]+)?$/;
|
|
305
|
+
const proxyLines = args.split(/[\s\n]+/).map(l => l.trim()).filter(l => proxyRegex.test(l));
|
|
306
|
+
if (proxyLines.length === 0) {
|
|
307
|
+
await platform.send('🌐 Usage: /proxy <ip:port:user:pass>\nPaste one or more proxies (one per line).', msg.channelId, msg.replyTo);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
try {
|
|
311
|
+
const config = loadConfig();
|
|
312
|
+
if (!config.browser)
|
|
313
|
+
config.browser = {};
|
|
314
|
+
if (!config.browser.proxies)
|
|
315
|
+
config.browser.proxies = [];
|
|
316
|
+
let added = 0;
|
|
317
|
+
for (const line of proxyLines) {
|
|
318
|
+
if (!config.browser.proxies.includes(line)) {
|
|
319
|
+
config.browser.proxies.push(line);
|
|
320
|
+
added++;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (added > 0) {
|
|
324
|
+
saveConfig(config);
|
|
325
|
+
await platform.send(`🌐 ${added} proxy added (total: ${config.browser.proxies.length}).`, msg.channelId, msg.replyTo);
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
await platform.send(`🌐 All proxies already exist (total: ${config.browser.proxies.length}).`, msg.channelId, msg.replyTo);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
catch (e) {
|
|
332
|
+
await platform.send(`Failed to save proxies: ${e.message}`, msg.channelId, msg.replyTo);
|
|
333
|
+
}
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (this.activeProcessing.has(agentKey)) {
|
|
337
|
+
this.messageQueue.set(agentKey, msg);
|
|
338
|
+
await platform.send('📋 Task queued. Current task still running — your message will be processed after it finishes.\nUse /cancel to stop the current task.', msg.channelId, msg.replyTo);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
this.emit('message', msg);
|
|
342
|
+
if (isWA && !text.toLowerCase().startsWith('!ai')) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (cmd === 'start') {
|
|
346
|
+
await platform.send(isWA ? WA_COMMAND_GUIDE : COMMAND_GUIDE, msg.channelId, msg.replyTo);
|
|
347
|
+
this.firstTimeUsers.add(agentKey);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (cmd === 'help') {
|
|
351
|
+
const helpText = isWA
|
|
352
|
+
? `⏳ AURIX Quick Help\n\n!ai start — Full guide\n!ai reset — Clear context\n!ai model <name> — Switch model\n!ai depth <level> — Research depth\n!ai tools — List tools\n!ai status — Show status\n\nOr just type: !ai <your question>`
|
|
353
|
+
: `⏳ AURIX Quick Help\n\n/start — Full guide\n/reset — Clear context\n/model <name> — Switch model\n/depth <level> — Research depth (low/medium/high/xhigh/max/ultra)\n/tools — List tools\n/skills — List skills\n/status — Show status\n/history — Message count\n\nOr just type your question!`;
|
|
354
|
+
await platform.send(helpText, msg.channelId, msg.replyTo);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (!this.firstTimeUsers.has(agentKey)) {
|
|
358
|
+
this.firstTimeUsers.add(agentKey);
|
|
359
|
+
await platform.send(isWA ? WA_MINI_GUIDE : MINI_GUIDE, msg.channelId, msg.replyTo);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
if (cmd === 'reset') {
|
|
363
|
+
this.agents.delete(agentKey);
|
|
364
|
+
await platform.send('✅ Context reset. Starting fresh.', msg.channelId, msg.replyTo);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (cmd === 'model' && args) {
|
|
368
|
+
const agent = this.getAgent(agentKey);
|
|
369
|
+
agent.setProvider({ model: args });
|
|
370
|
+
await platform.send(`✅ Model switched to: ${args}`, msg.channelId, msg.replyTo);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (cmd === 'baseurl' && args) {
|
|
374
|
+
const agent = this.getAgent(agentKey);
|
|
375
|
+
agent.setProvider({ baseUrl: args });
|
|
376
|
+
await platform.send(`✅ Base URL switched to: ${args}`, msg.channelId, msg.replyTo);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if (cmd === 'apikey' && args) {
|
|
380
|
+
const agent = this.getAgent(agentKey);
|
|
381
|
+
agent.setProvider({ apiKey: args });
|
|
382
|
+
const masked = args.slice(0, 8) + '...' + args.slice(-4);
|
|
383
|
+
await platform.send(`✅ API key updated (${masked})`, msg.channelId, msg.replyTo);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (cmd === 'depth' && args) {
|
|
387
|
+
const mode = args.toLowerCase();
|
|
388
|
+
if (VALID_DEPTHS.includes(mode)) {
|
|
389
|
+
this.userDepths.set(agentKey, mode);
|
|
390
|
+
const desc = {
|
|
391
|
+
low: 'Quick single-agent answers',
|
|
392
|
+
medium: 'Research + sources',
|
|
393
|
+
high: 'Full team + citations (multi-agent)',
|
|
394
|
+
xhigh: '+ Debate system',
|
|
395
|
+
max: '+ Logic critic',
|
|
396
|
+
ultra: '+ Final review loop (publication-grade)',
|
|
397
|
+
};
|
|
398
|
+
await platform.send(`✅ Research depth: ${mode}\n${desc[mode]}`, msg.channelId, msg.replyTo);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
await platform.send(`❌ Invalid depth. Choose: ${VALID_DEPTHS.join(', ')}`, msg.channelId, msg.replyTo);
|
|
402
|
+
}
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (cmd === 'tools') {
|
|
406
|
+
const tools = this.registry.list();
|
|
407
|
+
if (tools.length === 0) {
|
|
408
|
+
await platform.send('No tools registered.', msg.channelId, msg.replyTo);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const toolList = tools.slice(0, 30).map(t => ` 🔧 ${t.name} — ${t.description.slice(0, 50)}`).join('\n');
|
|
412
|
+
await platform.send(`🔧 Available tools (${tools.length}):\n${toolList}`, msg.channelId, msg.replyTo);
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (cmd === 'skills') {
|
|
416
|
+
await platform.send('📚 Skills listing coming soon. Check /tools for capabilities.', msg.channelId, msg.replyTo);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
if (cmd === 'status') {
|
|
420
|
+
const agent = this.getAgent(agentKey);
|
|
421
|
+
const depth = this.userDepths.get(agentKey) || 'low';
|
|
422
|
+
const platforms = this.getPlatforms().join(', ');
|
|
423
|
+
await platform.send(`⏳ AURIX Agent Status\n\n🤖 Model: ${agent.getModel()}\n🔌 Provider: ${agent.getProviderName()}\n📊 Depth: ${depth}\n⏱️ Uptime: ${this.getUptime()}\n🌐 Platforms: ${platforms}`, msg.channelId, msg.replyTo);
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (cmd === 'history') {
|
|
427
|
+
const agent = this.getAgent(agentKey);
|
|
428
|
+
const count = agent.getMessages().length;
|
|
429
|
+
await platform.send(`📝 ${count} messages in conversation.`, msg.channelId, msg.replyTo);
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
if (cmd === 'save') {
|
|
433
|
+
const agent = this.getAgent(agentKey);
|
|
434
|
+
const name = this.sessionNames.get(agentKey);
|
|
435
|
+
const sessionId = agent.saveSession(name);
|
|
436
|
+
if (name) {
|
|
437
|
+
await platform.send(`✅ Session saved as "${name}"!\nResume with: /resume ${name}`, msg.channelId, msg.replyTo);
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
await platform.send(`✅ Session saved!\nName it with: /title <name>\nResume with: /resume ${sessionId}`, msg.channelId, msg.replyTo);
|
|
441
|
+
}
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
if (cmd === 'title') {
|
|
445
|
+
const agent = this.getAgent(agentKey);
|
|
446
|
+
let name = args.trim();
|
|
447
|
+
if (!name) {
|
|
448
|
+
name = 's-' + cryptoRandomId();
|
|
449
|
+
}
|
|
450
|
+
name = name.replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').slice(0, 40);
|
|
451
|
+
this.sessionNames.set(agentKey, name);
|
|
452
|
+
agent.saveSession(name);
|
|
453
|
+
await platform.send(`💾 Session named: "${name}"\nAuto-saved. Resume anytime: /resume ${name}`, msg.channelId, msg.replyTo);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if (cmd === 'resume') {
|
|
457
|
+
let name = args.trim();
|
|
458
|
+
if (!name) {
|
|
459
|
+
try {
|
|
460
|
+
const fs = await import('fs');
|
|
461
|
+
const path = await import('path');
|
|
462
|
+
const os = await import('os');
|
|
463
|
+
const sessionsDir = path.join(os.homedir(), '.aurix', 'memories', 'sessions');
|
|
464
|
+
if (fs.existsSync(sessionsDir)) {
|
|
465
|
+
const files = fs.readdirSync(sessionsDir)
|
|
466
|
+
.filter(f => f.endsWith('.json'))
|
|
467
|
+
.map(f => {
|
|
468
|
+
const stat = fs.statSync(path.join(sessionsDir, f));
|
|
469
|
+
return { name: f.replace('.json', ''), time: stat.mtimeMs };
|
|
470
|
+
})
|
|
471
|
+
.sort((a, b) => b.time - a.time)
|
|
472
|
+
.slice(0, 10);
|
|
473
|
+
if (files.length === 0) {
|
|
474
|
+
await platform.send('No saved sessions found. Use /title <name> to create one.', msg.channelId, msg.replyTo);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const list = files.map((f, i) => ` ${i + 1}. ${f.name}`).join('\n');
|
|
478
|
+
await platform.send(`💾 Saved sessions:\n${list}\n\nResume with: /resume <name>`, msg.channelId, msg.replyTo);
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
catch { }
|
|
483
|
+
await platform.send('No saved sessions found. Use /title <name> to create one.', msg.channelId, msg.replyTo);
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
this.agents.delete(agentKey);
|
|
487
|
+
const agent = this.getAgent(agentKey);
|
|
488
|
+
const count = agent.loadSession(name);
|
|
489
|
+
if (count > 0) {
|
|
490
|
+
this.sessionNames.set(agentKey, name);
|
|
491
|
+
await platform.send(`✅ Session "${name}" loaded (${count} messages).\nContinuing where you left off.`, msg.channelId, msg.replyTo);
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
await platform.send(`❌ Session "${name}" not found.\nUse /resume (no args) to list available sessions.`, msg.channelId, msg.replyTo);
|
|
495
|
+
}
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
if (cmd === 'compress') {
|
|
499
|
+
await platform.send('⏳ Compressing context...', msg.channelId, msg.replyTo);
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
if (cmd === 'fast') {
|
|
503
|
+
await platform.send('⚡ Fast mode toggled.', msg.channelId, msg.replyTo);
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (cmd === 'agents') {
|
|
507
|
+
await platform.send('🤖 Active agents: Main agent running. Use /depth high+ for multi-agent.', msg.channelId, msg.replyTo);
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
if (cmd === 'review') {
|
|
511
|
+
await platform.send('🔍 Code review: paste your code and I\'ll review it!', msg.channelId, msg.replyTo);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
if (cmd === 'plan') {
|
|
515
|
+
await platform.send('📋 Planning mode: describe your project and I\'ll create a plan!', msg.channelId, msg.replyTo);
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
const userPrompt = isWA ? (args || text.replace(/^!ai\s*/i, '').trim()) : text;
|
|
519
|
+
if (!userPrompt || cmd === '')
|
|
520
|
+
return;
|
|
521
|
+
const platformTag = `[sent from ${msg.platform}]`;
|
|
522
|
+
const forwardTag = msg.forwardedFrom ? ` [forwarded from ${msg.forwardedFrom}]` : '';
|
|
523
|
+
const attachTag = msg.attachments?.length
|
|
524
|
+
? ' ' + msg.attachments.map(a => `[image: ${a.filename || a.url || 'attached'}]`).join(' ')
|
|
525
|
+
: '';
|
|
526
|
+
const taggedPrompt = `${platformTag}${forwardTag}${attachTag} ${userPrompt}`;
|
|
527
|
+
const agent = this.getAgent(agentKey);
|
|
528
|
+
this.activeProcessing.add(agentKey);
|
|
529
|
+
try {
|
|
530
|
+
let fullResponse = '';
|
|
531
|
+
let statusMsg = formatStatus('thinking');
|
|
532
|
+
await platform.send(statusMsg, msg.channelId, msg.replyTo);
|
|
533
|
+
let lastStatusUpdate = Date.now();
|
|
534
|
+
let lastToolStatus = '';
|
|
535
|
+
for await (const event of agent.run(taggedPrompt)) {
|
|
536
|
+
if (event.type === 'tool_start') {
|
|
537
|
+
const newStatus = formatToolStatus(event.toolName || event.data, event.toolArgs);
|
|
538
|
+
if (newStatus !== lastToolStatus) {
|
|
539
|
+
await platform.send(newStatus, msg.channelId, msg.replyTo);
|
|
540
|
+
lastToolStatus = newStatus;
|
|
541
|
+
lastStatusUpdate = Date.now();
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
else if (event.type === 'text') {
|
|
545
|
+
fullResponse += event.data;
|
|
546
|
+
const now = Date.now();
|
|
547
|
+
if (now - lastStatusUpdate > 5000 && fullResponse.length > 50) {
|
|
548
|
+
statusMsg = formatStatus('text');
|
|
549
|
+
await platform.send(statusMsg, msg.channelId, msg.replyTo);
|
|
550
|
+
lastStatusUpdate = now;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
else if (event.type === 'error') {
|
|
554
|
+
await platform.send(`❌ ${event.data}`, msg.channelId, msg.replyTo);
|
|
555
|
+
}
|
|
556
|
+
else if (event.type === 'compact') {
|
|
557
|
+
await platform.send(`📦 ${event.data}`, msg.channelId, msg.replyTo);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
if (fullResponse) {
|
|
561
|
+
const cleaned = cleanResponse(fullResponse);
|
|
562
|
+
const chunks = splitMessage(cleaned, 1900);
|
|
563
|
+
for (const chunk of chunks) {
|
|
564
|
+
await platform.send(chunk, msg.channelId, msg.replyTo);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
catch (e) {
|
|
569
|
+
await platform.send(`❌ Error: ${e.message}`, msg.channelId, msg.replyTo);
|
|
570
|
+
}
|
|
571
|
+
finally {
|
|
572
|
+
this.activeProcessing.delete(agentKey);
|
|
573
|
+
}
|
|
574
|
+
this.emit('response', { msg, response: 'sent' });
|
|
575
|
+
const queued = this.messageQueue.get(agentKey);
|
|
576
|
+
if (queued) {
|
|
577
|
+
this.messageQueue.delete(agentKey);
|
|
578
|
+
await platform.send('▶️ Processing queued message...', queued.channelId, queued.replyTo);
|
|
579
|
+
setImmediate(() => this.handleMessage(queued));
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
async start() {
|
|
583
|
+
const results = [];
|
|
584
|
+
for (const [name, platform] of this.platforms) {
|
|
585
|
+
try {
|
|
586
|
+
await platform.connect();
|
|
587
|
+
results.push(`${name}: connected`);
|
|
588
|
+
}
|
|
589
|
+
catch (e) {
|
|
590
|
+
results.push(`${name}: failed (${e.message})`);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
console.log('\n[AURIX Gateway]');
|
|
594
|
+
results.forEach(r => console.log(` ${r}`));
|
|
595
|
+
console.log();
|
|
596
|
+
}
|
|
597
|
+
async stop() {
|
|
598
|
+
for (const [, platform] of this.platforms) {
|
|
599
|
+
try {
|
|
600
|
+
await platform.disconnect();
|
|
601
|
+
}
|
|
602
|
+
catch { }
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
getPlatforms() {
|
|
606
|
+
return Array.from(this.platforms.keys());
|
|
607
|
+
}
|
|
608
|
+
getLastContext(userKey) {
|
|
609
|
+
return this.lastContext.get(userKey);
|
|
610
|
+
}
|
|
611
|
+
getMostRecentContext() {
|
|
612
|
+
let latest = null;
|
|
613
|
+
for (const [userKey, ctx] of this.lastContext) {
|
|
614
|
+
latest = { userKey, ...ctx };
|
|
615
|
+
}
|
|
616
|
+
return latest;
|
|
617
|
+
}
|
|
618
|
+
getAllContexts() {
|
|
619
|
+
return Array.from(this.lastContext.entries()).map(([userKey, ctx]) => ({
|
|
620
|
+
userKey,
|
|
621
|
+
...ctx,
|
|
622
|
+
}));
|
|
623
|
+
}
|
|
624
|
+
getPlatform(name) {
|
|
625
|
+
return this.platforms.get(name);
|
|
626
|
+
}
|
|
627
|
+
async sendFileToUser(userKey, filePath, caption) {
|
|
628
|
+
const ctx = this.lastContext.get(userKey);
|
|
629
|
+
if (!ctx)
|
|
630
|
+
return 'No active conversation context found. The user needs to send a message first.';
|
|
631
|
+
const platform = this.platforms.get(ctx.platform);
|
|
632
|
+
if (!platform)
|
|
633
|
+
return `Platform "${ctx.platform}" not found.`;
|
|
634
|
+
if (!platform.sendFile)
|
|
635
|
+
return `Platform "${ctx.platform}" does not support file sending.`;
|
|
636
|
+
try {
|
|
637
|
+
await platform.sendFile(filePath, ctx.channelId, caption, ctx.replyTo);
|
|
638
|
+
return `File sent: ${filePath}`;
|
|
639
|
+
}
|
|
640
|
+
catch (e) {
|
|
641
|
+
return `Failed to send file: ${e.message}`;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
function splitMessage(text, maxLen) {
|
|
646
|
+
if (text.length <= maxLen)
|
|
647
|
+
return [text];
|
|
648
|
+
const chunks = [];
|
|
649
|
+
const lines = text.split('\n');
|
|
650
|
+
let current = '';
|
|
651
|
+
for (const line of lines) {
|
|
652
|
+
if (current.length + line.length + 1 > maxLen) {
|
|
653
|
+
if (current)
|
|
654
|
+
chunks.push(current);
|
|
655
|
+
current = line;
|
|
656
|
+
}
|
|
657
|
+
else {
|
|
658
|
+
current += (current ? '\n' : '') + line;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
if (current)
|
|
662
|
+
chunks.push(current);
|
|
663
|
+
return chunks.length > 0 ? chunks : [text.slice(0, maxLen)];
|
|
664
|
+
}
|
|
665
|
+
//# sourceMappingURL=Gateway.js.map
|