import type { GatewayStatus, RuntimeStatus, WorkspaceSummary } from "@qjclaw/shared-types"

export function canExchangeMessages(
  workspace: WorkspaceSummary | null,
  runtimeStatus: RuntimeStatus | null,
  gatewayStatus: GatewayStatus | null
) {
  if (!workspace?.chatReady || !runtimeStatus || gatewayStatus?.state !== "connected") {
    return false
  }

  return runtimeStatus.activeMode === "external-gateway" || runtimeStatus.processState === "running"
}
