Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

859 B
Raw Blame
import type { DeviceLinkConnectionStatus, Session } from '@/lib/ccAgent.types';

interface DeviceLinkWriteState {
  deviceLinkDeviceId?: string | null;
  deviceLinkConnectionStatus?: DeviceLinkConnectionStatus | null;
}

/** Device-link entities stay selectable while cached offline, but writes must wait for reconnection. */
export function isDeviceLinkWriteBlocked(
  target: DeviceLinkWriteState | null | undefined,
): boolean {
  return Boolean(
    target?.deviceLinkDeviceId &&
      target.deviceLinkConnectionStatus === 'disconnected',
  );
}

/** Device-link sessions stay selectable while cached offline, but writes must wait for reconnection. */
export function isRemoteSessionWriteBlocked(
  session: Pick<Session, 'deviceLinkDeviceId' | 'deviceLinkConnectionStatus'> | null | undefined,
): boolean {
  return isDeviceLinkWriteBlocked(session);
}