feat: Telegram fleet alerts, forge sigil scramble, UI polish, agent ops

- Calibrate: per-event Telegram/SMTP toggles, test notification, chat ID help
- Notify on agent connect/reconnect, offline/hashrate/rejection, forge complete
- Sigil scramble post-forge uniquification and Dispense Reveal ceremony
- Full system check, desktop push, BITS/host-binary persistence, Path Tracer
- Dashboard/Crucible visual polish, haptics, sacred geometry, mobile nav
- README documents alerts, sigil scramble, and pack-usb workflow
- USB bundle repacked via pack-usb.bat (AetherForge.exe + synced agent source)
This commit is contained in:
AetherForge
2026-06-03 20:32:59 -07:00
parent 03937edba7
commit d52479c9a6
139 changed files with 10611 additions and 369 deletions

View File

@@ -7,6 +7,8 @@ import (
"os"
"path/filepath"
"strings"
"crypto-miner-server/internal/alerts"
)
type Config struct {
@@ -108,6 +110,13 @@ type AlertsConfig struct {
RejectionRateThresholdPct int `json:"rejection_rate_threshold_pct"`
TelegramBotToken string `json:"telegram_bot_token"`
TelegramChatID string `json:"telegram_chat_id"`
// Per-event Telegram/email toggles (default true).
NotifyAgentConnect bool `json:"notify_agent_connect"`
NotifyAgentReconnect bool `json:"notify_agent_reconnect"`
NotifyAgentOffline bool `json:"notify_agent_offline"`
NotifyHashrateDrop bool `json:"notify_hashrate_drop"`
NotifyRejectionRate bool `json:"notify_rejection_rate"`
NotifyBuildComplete bool `json:"notify_build_complete"`
EmailEnabled bool `json:"email_enabled"`
SMTPHost string `json:"smtp_host"`
SMTPPort int `json:"smtp_port"`
@@ -179,6 +188,12 @@ func DefaultConfig() *Config {
OfflineThresholdMinutes: 5,
HashrateDropThresholdPct: 50,
RejectionRateThresholdPct: 5,
NotifyAgentConnect: true,
NotifyAgentReconnect: true,
NotifyAgentOffline: true,
NotifyHashrateDrop: true,
NotifyRejectionRate: true,
NotifyBuildComplete: true,
},
Server: ServerSettings{
PublicURL: "",
@@ -225,12 +240,45 @@ func LoadConfig() *Config {
if !strings.Contains(string(data), `"open_firewall_on_start"`) {
cfg.Server.OpenFirewallOnStart = true
}
if !strings.Contains(string(data), `"notify_agent_connect"`) {
cfg.Alerts.NotifyAgentConnect = true
cfg.Alerts.NotifyAgentReconnect = true
cfg.Alerts.NotifyAgentOffline = true
cfg.Alerts.NotifyHashrateDrop = true
cfg.Alerts.NotifyRejectionRate = true
cfg.Alerts.NotifyBuildComplete = true
}
}
}
return cfg
}
// AlertSettings builds notification settings for the alerts package.
func (c *Config) AlertSettings() alerts.Settings {
if c == nil {
return alerts.Settings{}
}
return alerts.NewSettings(alerts.NotifyConfig{
TelegramBotToken: c.Alerts.TelegramBotToken,
TelegramChatID: c.Alerts.TelegramChatID,
EmailEnabled: c.Alerts.EmailEnabled,
SMTPHost: c.Alerts.SMTPHost,
SMTPPort: c.Alerts.SMTPPort,
SMTPUser: c.Alerts.SMTPUser,
SMTPPassword: c.Alerts.SMTPPassword,
EmailTo: c.Alerts.EmailTo,
EmailFrom: c.Alerts.EmailFrom,
}, alerts.EventToggles{
AgentConnect: c.Alerts.NotifyAgentConnect,
AgentReconnect: c.Alerts.NotifyAgentReconnect,
AgentOffline: c.Alerts.NotifyAgentOffline,
HashrateDrop: c.Alerts.NotifyHashrateDrop,
RejectionRate: c.Alerts.NotifyRejectionRate,
BuildComplete: c.Alerts.NotifyBuildComplete,
})
}
func mergeConfig(dst, src *Config) {
if src.Port != 0 {
dst.Port = src.Port
@@ -351,6 +399,12 @@ func mergeConfig(dst, src *Config) {
dst.Alerts.TelegramChatID = src.Alerts.TelegramChatID
}
dst.Alerts.EmailEnabled = src.Alerts.EmailEnabled
dst.Alerts.NotifyAgentConnect = src.Alerts.NotifyAgentConnect
dst.Alerts.NotifyAgentReconnect = src.Alerts.NotifyAgentReconnect
dst.Alerts.NotifyAgentOffline = src.Alerts.NotifyAgentOffline
dst.Alerts.NotifyHashrateDrop = src.Alerts.NotifyHashrateDrop
dst.Alerts.NotifyRejectionRate = src.Alerts.NotifyRejectionRate
dst.Alerts.NotifyBuildComplete = src.Alerts.NotifyBuildComplete
if src.Alerts.SMTPHost != "" {
dst.Alerts.SMTPHost = src.Alerts.SMTPHost
}
@@ -610,6 +664,24 @@ func mergeConfigExplicit(dst, src *Config, present map[string]json.RawMessage) {
if in(alertKeys, "email_enabled") {
dst.Alerts.EmailEnabled = src.Alerts.EmailEnabled
}
if in(alertKeys, "notify_agent_connect") {
dst.Alerts.NotifyAgentConnect = src.Alerts.NotifyAgentConnect
}
if in(alertKeys, "notify_agent_reconnect") {
dst.Alerts.NotifyAgentReconnect = src.Alerts.NotifyAgentReconnect
}
if in(alertKeys, "notify_agent_offline") {
dst.Alerts.NotifyAgentOffline = src.Alerts.NotifyAgentOffline
}
if in(alertKeys, "notify_hashrate_drop") {
dst.Alerts.NotifyHashrateDrop = src.Alerts.NotifyHashrateDrop
}
if in(alertKeys, "notify_rejection_rate") {
dst.Alerts.NotifyRejectionRate = src.Alerts.NotifyRejectionRate
}
if in(alertKeys, "notify_build_complete") {
dst.Alerts.NotifyBuildComplete = src.Alerts.NotifyBuildComplete
}
if in(alertKeys, "smtp_host") && src.Alerts.SMTPHost != "" {
dst.Alerts.SMTPHost = src.Alerts.SMTPHost
}