feat: integrate NOFXi agent into dev

This commit is contained in:
lky-spec
2026-04-18 16:06:42 +08:00
parent 851f152c50
commit 5c4e7502d7
76 changed files with 17714 additions and 1082 deletions

20
main.go
View File

@@ -1,13 +1,15 @@
package main
import (
"log/slog"
"nofx/api"
nofxiagent "nofx/agent"
"nofx/auth"
"nofx/config"
"nofx/crypto"
"nofx/telemetry"
"nofx/logger"
"nofx/manager"
"nofx/telemetry"
_ "nofx/mcp/payment"
_ "nofx/mcp/provider"
"nofx/store"
@@ -141,6 +143,14 @@ func main() {
}
}()
// Start the NOFXi web agent on top of the current dev branch services.
nofxiAgent := nofxiagent.New(traderManager, st, nil, slog.Default())
nofxiAgent.Start()
defer nofxiAgent.Stop()
agentWeb := nofxiagent.NewWebHandler(nofxiAgent, slog.Default())
server.RegisterAgentHandler(agentWeb)
// Start Telegram bot (if TELEGRAM_BOT_TOKEN is configured)
go telegram.Start(cfg, st, telegramReloadCh)
@@ -154,6 +164,14 @@ func main() {
<-quit
logger.Info("📴 Shutdown signal received, closing system...")
if err := server.Shutdown(); err != nil {
logger.Warnf("⚠️ HTTP server shutdown error: %v", err)
}
logger.Info("✅ HTTP server stopped")
nofxiAgent.Stop()
logger.Info("✅ NOFXi agent stopped")
// Stop all traders
traderManager.StopAll()
logger.Info("✅ System shut down safely")