- 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.
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import type { ChannelAccountCatalogGroup, ChannelConnectionStatus } from '@src/lib/channel-types';
|
|
import { buildChannelStatusSummary, type ChannelStatusSummary } from '@electron/utils/channel-status';
|
|
|
|
export interface GatewayHealthSnapshot {
|
|
ok: boolean;
|
|
status: 'connected' | 'disconnected' | 'reconnecting';
|
|
initialized: boolean;
|
|
mode: 'in-process' | 'openclaw';
|
|
port?: number | null;
|
|
pid?: number | null;
|
|
lastError?: string;
|
|
}
|
|
|
|
export interface GatewayDiagnosticsSummary {
|
|
status: ChannelConnectionStatus;
|
|
gateway: GatewayHealthSnapshot;
|
|
channels: ChannelStatusSummary;
|
|
}
|
|
|
|
function normalizeGatewayStatus(status: GatewayHealthSnapshot['status']): ChannelConnectionStatus {
|
|
if (status === 'reconnecting') return 'connecting';
|
|
return status;
|
|
}
|
|
|
|
export function buildGatewayDiagnosticsSummary(
|
|
health: GatewayHealthSnapshot,
|
|
channelGroups: readonly ChannelAccountCatalogGroup[],
|
|
): GatewayDiagnosticsSummary {
|
|
const channels = buildChannelStatusSummary(channelGroups);
|
|
const gatewayStatus = normalizeGatewayStatus(health.status);
|
|
|
|
return {
|
|
status: health.ok
|
|
? (channels.status === 'connected'
|
|
? 'connected'
|
|
: channels.status === 'disconnected'
|
|
? 'degraded'
|
|
: channels.status)
|
|
: gatewayStatus,
|
|
gateway: health,
|
|
channels,
|
|
};
|
|
}
|