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

@@ -1,4 +1,4 @@
import type { Agent, Share, HashrateSample, BuildRecord, FleetStats, ServerConfig, BuildRequest, BuildResponse, ServerInfo } from '../types';
import type { Agent, Share, HashrateSample, BuildRecord, ServerConfig, BuildRequest, BuildResponse, ServerInfo, BlueprintInfo, FleetAlert, PoolStatus, AIActivityEntry, EarningsEstimate } from '../types';
const API_BASE = '/api/v1';
@@ -15,12 +15,8 @@ async function fetchJSON<T>(url: string, options?: RequestInit): Promise<T> {
}
export const api = {
// Dashboard
getStats: () => fetchJSON<FleetStats>('/dashboard/stats'),
// Agents
listAgents: () => fetchJSON<Agent[]>('/agents'),
getAgent: (id: string) => fetchJSON<Agent>(`/agents/${id}`),
getAgentStats: (id: string, limit?: number) =>
fetchJSON<HashrateSample[]>(`/agents/${id}/stats${limit ? `?limit=${limit}` : ''}`),
@@ -62,9 +58,37 @@ export const api = {
});
},
downloadBuild: (buildId: string) => `${API_BASE}/builds/${buildId}/download`,
buildDownloadUrl: (buildId: string) => `${API_BASE}/builds/${buildId}/download`,
buildUninstallUrl: (buildId: string) => `${API_BASE}/builds/${buildId}/uninstall`,
// Blueprints (config presets)
listBlueprints: () => fetchJSON<BlueprintInfo[]>('/blueprints'),
getBlueprint: (name: string) => fetchJSON<any>(`/blueprints/${encodeURIComponent(name)}`),
saveBlueprint: (name: string, data: any) =>
fetchJSON<{ success: boolean; name: string; file_path: string; created_at: string }>('/blueprints', {
method: 'POST',
body: JSON.stringify({ name, data }),
}),
deleteBlueprint: (name: string) =>
fetchJSON<{ success: string; name: string }>(`/blueprints?name=${encodeURIComponent(name)}`, {
method: 'DELETE',
}),
// Health / server
healthCheck: () => fetchJSON<{ status: string }>('/health'),
getServerInfo: () => fetchJSON<ServerInfo>('/server/info'),
// Fleet ops
getAlerts: () => fetchJSON<FleetAlert[]>('/alerts'),
getPoolStatus: () => fetchJSON<PoolStatus[]>('/pools/status'),
getAIActivity: () => fetchJSON<AIActivityEntry[]>('/ai/activity'),
getEarningsEstimate: (hashrate: number) =>
fetchJSON<EarningsEstimate>(`/earnings/estimate?hashrate=${encodeURIComponent(hashrate)}`),
sendAgentCommand: (id: string, action: string, tailLines?: number) =>
fetchJSON<{ success: boolean }>(`/agents/${id}/command`, {
method: 'POST',
body: JSON.stringify({ action, tail_lines: tailLines }),
}),
getAgentLog: (id: string, refresh = false) =>
fetchJSON<{ agent_id: string; content: string }>(`/agents/${id}/log${refresh ? '?refresh=1' : ''}`),
};