- 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.
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
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;
|
|
}
|