feat: enhance after-pack script to copy OpenClaw runtime dependencies
- Added a new script `bundle-openclaw.mjs` to bundle OpenClaw runtime dependencies. - Updated `after-pack.cjs` to copy bundled OpenClaw runtime and its node_modules. - Improved cleanup of unnecessary development files in node_modules. - Adjusted paths for resources in the packaging process. style: update loading indicator styles in ChatHistoryPanel - Changed the border radius and padding for the loading indicator in ChatHistoryPanel. fix: improve ProvidersSection to handle provider account syncing - Added logic to sync model configuration to provider accounts. - Introduced error handling and loading states during the sync process. - Enhanced vendor resolution and account management logic. fix: fallback session handling in chat store - Implemented fallback session logic in loadSessions to ensure a valid session is always available on error.
This commit is contained in:
48
electron/gateway/request-store.ts
Normal file
48
electron/gateway/request-store.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
export interface PendingGatewayRequest {
|
||||
resolve: (value: unknown) => void;
|
||||
reject: (error: Error) => void;
|
||||
timeout: NodeJS.Timeout | null;
|
||||
}
|
||||
|
||||
export function clearPendingGatewayRequests(
|
||||
pendingRequests: Map<string, PendingGatewayRequest>,
|
||||
error: Error,
|
||||
): void {
|
||||
for (const [, request] of pendingRequests) {
|
||||
if (request.timeout) {
|
||||
clearTimeout(request.timeout);
|
||||
}
|
||||
request.reject(error);
|
||||
}
|
||||
pendingRequests.clear();
|
||||
}
|
||||
|
||||
export function resolvePendingGatewayRequest(
|
||||
pendingRequests: Map<string, PendingGatewayRequest>,
|
||||
id: string,
|
||||
value: unknown,
|
||||
): boolean {
|
||||
const request = pendingRequests.get(id);
|
||||
if (!request) return false;
|
||||
if (request.timeout) {
|
||||
clearTimeout(request.timeout);
|
||||
}
|
||||
pendingRequests.delete(id);
|
||||
request.resolve(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
export function rejectPendingGatewayRequest(
|
||||
pendingRequests: Map<string, PendingGatewayRequest>,
|
||||
id: string,
|
||||
error: Error,
|
||||
): boolean {
|
||||
const request = pendingRequests.get(id);
|
||||
if (!request) return false;
|
||||
if (request.timeout) {
|
||||
clearTimeout(request.timeout);
|
||||
}
|
||||
pendingRequests.delete(id);
|
||||
request.reject(error);
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user