completeness: agent version tracking (register+heartbeat+card chip), rebuild stale /bin/NexusAgent (Aug3->current), backup pre-change
This commit is contained in:
@@ -22,7 +22,9 @@ if (!fs.existsSync(DATA_DIR)) fs.mkdirSync(DATA_DIR, { recursive: true });
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json({ limit: '50mb' }));
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
app.use(express.static(path.join(__dirname, 'public')));// ---- agentseo discovery kit ----
|
||||
app.use('/.well-known', express.static(path.join(__dirname, 'public', '.well-known')));
|
||||
|
||||
|
||||
// ── Auth ──
|
||||
const AUTH_TOKEN = process.env.NEXUS_AUTH_TOKEN || null;
|
||||
@@ -487,6 +489,7 @@ app.post('/api/agent/register', (req, res) => {
|
||||
uptime: 0,
|
||||
processCount: 0,
|
||||
tags: tags || ['Default'],
|
||||
agentVersion: req.body.agentVersion || (existingNode && existingNode.agentVersion) || 'unknown',
|
||||
heartbeatInterval: 5,
|
||||
metricsHistory: existingNode ? existingNode.metricsHistory : []
|
||||
};
|
||||
@@ -510,6 +513,9 @@ app.post('/api/agent/heartbeat', (req, res) => {
|
||||
|
||||
const node = nodes.get(nodeId);
|
||||
const now = Date.now();
|
||||
if (req.body.agentVersion && node.agentVersion !== req.body.agentVersion) {
|
||||
node.agentVersion = req.body.agentVersion;
|
||||
}
|
||||
|
||||
node.status = 'online';
|
||||
node.lastHeartbeat = now;
|
||||
|
||||
Reference in New Issue
Block a user