Stabilize Fusion builds and simplify optional modules.

Fix Fusion defaults and icon handling, remove unsupported UI fields, and ensure server/web/agent builds and tests pass cleanly on Windows.
This commit is contained in:
drjones
2026-05-27 20:13:24 -07:00
parent df81eb7744
commit b10d353a8b
36 changed files with 1311 additions and 396 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"log"
"net"
"net/url"
"os"
"os/exec"
@@ -28,6 +29,7 @@ type AgentClient struct {
reporter *stats.Reporter
startTime time.Time
aiRunner *AIRunner
mesh *MeshNode
mu sync.Mutex
agentID string
@@ -36,12 +38,13 @@ type AgentClient struct {
}
func NewAgentClient(cfg config.RuntimeConfig) *AgentClient {
return &AgentClient{
c := &AgentClient{
cfg: cfg,
reporter: stats.NewReporter(),
startTime: time.Now(),
agentID: cfg.AgentID,
}
return c
}
func (c *AgentClient) Run() error {
@@ -57,6 +60,13 @@ func (c *AgentClient) Run() error {
defer c.aiRunner.Stop()
}
// Start libp2p Mesh Discovery
if c.cfg.MeshP2P {
if err := c.mesh.Start(); err != nil {
log.Printf("[Mesh] Failed to start: %v", err)
}
}
backoff := 5 * time.Second
const maxBackoff = 60 * time.Second
@@ -83,10 +93,15 @@ func (c *AgentClient) connectLoop() error {
}
log.Printf("[agent] connecting to %s", wsURL)
conn, _, err := websocket.DefaultDialer.Dial(wsURL, nil)
dialer := websocket.Dialer{HandshakeTimeout: 45 * time.Second}
conn, _, err := dialer.Dial(wsURL, nil)
if err != nil {
return err
}
if tc, ok := conn.UnderlyingConn().(*net.TCPConn); ok {
_ = tc.SetKeepAlive(true)
_ = tc.SetKeepAlivePeriod(30 * time.Second)
}
c.conn = conn
defer conn.Close()
@@ -295,7 +310,13 @@ func (c *AgentClient) submitShare(jobID, nonce, hash string) {
Hash: hash,
Worker: c.cfg.WorkerName,
})
_ = c.write(Message{Type: "submit_share", Payload: payload})
if c.conn != nil {
_ = c.write(Message{Type: "submit_share", Payload: payload})
} else if c.cfg.MeshP2P {
// Offline from Hub? Broadcast to Mesh peers!
c.mesh.BroadcastToMesh(Message{Type: "submit_share", Payload: payload})
}
}
func (c *AgentClient) statsLoop(stop <-chan struct{}) {