Improve portable launch, forge persistence, and operator auth UX.

Persist build extra_files for Build Manager history, print dashboard login on every start, add libp2p for Mesh P2P forge, defer WebSocket until login, and split devrun.bat from LAUNCH.bat with USB deck auto-detection.
This commit is contained in:
AetherForge
2026-05-31 18:56:43 -07:00
parent 2f528229f2
commit feba06e008
80 changed files with 2897 additions and 675 deletions

View File

@@ -27,12 +27,68 @@ const OFFLINE_AGENT = {
test.describe('Remote actions UI', () => {
test.beforeEach(async ({ page }) => {
await page.route('**/api/v1/agents', async (route) => {
if (route.request().method() === 'GET' && route.request().url().endsWith('/agents')) {
await route.fulfill({ json: [OFFLINE_AGENT] });
// AgentsPage syncs from WebSocket when connected; mock dashboard WS init (HTTP route cannot intercept WS).
await page.addInitScript((agent) => {
const RealWS = WebSocket;
const g = globalThis as typeof globalThis & { __afRealWebSocket?: typeof WebSocket };
g.__afRealWebSocket = RealWS;
globalThis.WebSocket = function (url: string | URL, protocols?: string | string[]) {
const urlStr = String(url);
if (!urlStr.includes('/ws/dashboard')) {
return new g.__afRealWebSocket!(url, protocols);
}
let openHandler: (() => void) | null = null;
let messageHandler: ((ev: MessageEvent) => void) | null = null;
let closeHandler: (() => void) | null = null;
const sock = {
readyState: 0,
send() {},
close() {
sock.readyState = 3;
closeHandler?.();
},
set onopen(fn: (() => void) | null) {
openHandler = fn;
},
get onopen() {
return openHandler;
},
set onmessage(fn: ((ev: MessageEvent) => void) | null) {
messageHandler = fn;
},
get onmessage() {
return messageHandler;
},
set onclose(fn: (() => void) | null) {
closeHandler = fn;
},
get onclose() {
return closeHandler;
},
set onerror(_fn: (() => void) | null) {},
get onerror() {
return null;
},
};
queueMicrotask(() => {
sock.readyState = 1;
openHandler?.();
messageHandler?.({
data: JSON.stringify({ type: 'init', payload: { agents: [agent] } }),
} as MessageEvent);
});
return sock as unknown as WebSocket;
} as unknown as typeof WebSocket;
globalThis.WebSocket.OPEN = 1;
globalThis.WebSocket.CONNECTING = 0;
globalThis.WebSocket.CLOSED = 3;
}, OFFLINE_AGENT);
await page.route(/\/api\/v1\/agents$/, async (route) => {
if (route.request().method() !== 'GET') {
await route.continue();
return;
}
await route.continue();
await route.fulfill({ json: [OFFLINE_AGENT] });
});
await page.route('**/api/v1/agents/*/stats*', async (route) => {
await route.fulfill({ json: [] });