chore: stabilize Zhinian pilot delivery

This commit is contained in:
inman
2026-05-12 19:44:44 +08:00
parent 45389855e1
commit 20b5aff4ad
174 changed files with 41428 additions and 784 deletions

View File

@@ -166,6 +166,15 @@ function applyRuntimeAppIcon(): void {
}
}
function getE2ERendererQuery(): Record<string, string> | undefined {
if (!isE2EMode) return undefined;
const shouldSkipSetupForE2E = process.env.CLAWX_E2E_SKIP_SETUP === '1';
return {
e2e: '1',
...(shouldSkipSetupForE2E ? { e2eSkipSetup: '1' } : {}),
};
}
/**
* Create the main application window
*/
@@ -173,13 +182,6 @@ function createWindow(): BrowserWindow {
const isMac = process.platform === 'darwin';
const isWindows = process.platform === 'win32';
const useCustomTitleBar = isWindows;
const shouldSkipSetupForE2E = process.env.CLAWX_E2E_SKIP_SETUP === '1';
const e2eRendererQuery = isE2EMode
? {
e2e: '1',
...(shouldSkipSetupForE2E ? { e2eSkipSetup: '1' } : {}),
}
: undefined;
const win = new BrowserWindow({
width: 1280,
@@ -217,6 +219,12 @@ function createWindow(): BrowserWindow {
return { action: 'deny' };
});
return win;
}
function loadMainWindow(win: BrowserWindow): void {
const e2eRendererQuery = getE2ERendererQuery();
// Load the app
if (process.env.VITE_DEV_SERVER_URL) {
const rendererUrl = new URL(process.env.VITE_DEV_SERVER_URL);
@@ -234,8 +242,6 @@ function createWindow(): BrowserWindow {
query: e2eRendererQuery,
});
}
return win;
}
function focusWindow(win: BrowserWindow): void {
@@ -322,7 +328,9 @@ async function initialize(): Promise<void> {
// Set application menu
createMenu();
// Create the main window
// Create the main window, but load the renderer only after IPC registration.
// The renderer restores the YINIAN session during boot; loading too early can
// race Electron's main-process handler registration on fast machines.
const window = createMainWindow();
// Create system tray
@@ -356,6 +364,10 @@ async function initialize(): Promise<void> {
// Register IPC handlers
registerIpcHandlers(gatewayManager, clawHubService, window);
// Register update handlers before loading the renderer for the same reason:
// renderer boot probes should never observe a missing main-process handler.
registerUpdateHandlers(appUpdater, window);
hostApiServer = startHostApiServer({
gatewayManager,
clawHubService,
@@ -363,6 +375,8 @@ async function initialize(): Promise<void> {
mainWindow: window,
});
loadMainWindow(window);
// Initialize extension system
await extensionRegistry.initialize({
gatewayManager,
@@ -376,9 +390,6 @@ async function initialize(): Promise<void> {
clawHubService.setMarketplaceProvider(marketplaceProvider);
}
// Register update handlers
registerUpdateHandlers(appUpdater, window);
// Note: Auto-check for updates is driven by the renderer (update store init)
// so it respects the user's "Auto-check for updates" setting.

View File

@@ -1370,7 +1370,7 @@ function registerGatewayHandlers(
logger.info(`[chat:sendWithMedia] Sending: message="${message.substring(0, 100)}", attachments=${imageAttachments.length}, fileRefs=${fileReferences.length}`);
// Longer timeout for chat sends to tolerate complex agent tasks and high-latency model responses.
const timeoutMs = 330000;
const timeoutMs = 30 * 60_000;
const result = await gatewayManager.rpc('chat.send', rpcParams, timeoutMs);
logger.info(`[chat:sendWithMedia] RPC result: ${JSON.stringify(result)}`);
return { success: true, result };