feat(win): hermes wsl installer hooks
This commit is contained in:
@@ -2,9 +2,11 @@ import type { BrowserWindow } from 'electron';
|
||||
import type { GatewayManager } from '../gateway/manager';
|
||||
import type { ClawHubService } from '../gateway/clawhub';
|
||||
import type { HostEventBus } from './event-bus';
|
||||
import type { HermesManager } from '../hermes/manager';
|
||||
|
||||
export interface HostApiContext {
|
||||
gatewayManager: GatewayManager;
|
||||
hermesManager: HermesManager;
|
||||
clawHubService: ClawHubService;
|
||||
eventBus: HostEventBus;
|
||||
mainWindow: BrowserWindow | null;
|
||||
|
||||
31
electron/api/routes/hermes.ts
Normal file
31
electron/api/routes/hermes.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { IncomingMessage, ServerResponse } from 'http';
|
||||
import type { HostApiContext } from '../context';
|
||||
import { sendJson } from '../route-utils';
|
||||
|
||||
export async function handleHermesRoutes(
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
url: URL,
|
||||
ctx: HostApiContext,
|
||||
): Promise<boolean> {
|
||||
if (url.pathname === '/api/hermes/status' && req.method === 'GET') {
|
||||
const status = await ctx.hermesManager.refreshStatus();
|
||||
sendJson(res, 200, { success: true, status });
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.pathname === '/api/hermes/install' && req.method === 'POST') {
|
||||
const result = await ctx.hermesManager.install();
|
||||
sendJson(res, result.success ? 200 : 500, { ...result });
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.pathname === '/api/hermes/start' && req.method === 'POST') {
|
||||
const result = await ctx.hermesManager.startGateway();
|
||||
sendJson(res, result.success ? 200 : 500, { ...result });
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { extensionRegistry } from '../extensions/registry';
|
||||
import type { HostApiContext } from './context';
|
||||
import { handleAppRoutes } from './routes/app';
|
||||
import { handleGatewayRoutes } from './routes/gateway';
|
||||
import { handleHermesRoutes } from './routes/hermes';
|
||||
import { handleSettingsRoutes } from './routes/settings';
|
||||
import { handleProviderRoutes } from './routes/providers';
|
||||
import { handleAgentRoutes } from './routes/agents';
|
||||
@@ -29,6 +30,7 @@ type RouteHandler = (
|
||||
const coreRouteHandlers: RouteHandler[] = [
|
||||
handleAppRoutes,
|
||||
handleGatewayRoutes,
|
||||
handleHermesRoutes,
|
||||
handleSettingsRoutes,
|
||||
handleProviderRoutes,
|
||||
handleAgentRoutes,
|
||||
|
||||
Reference in New Issue
Block a user