and...if my recollection is correct, Japan refused to surrender, so they likely knew something was coming.
That something was nuclear, which they wouldn’t/couldn’t have known, of course. No one could know.
Stalin knew it was coming. He had spies in Los Alamos. Not that he warned the Japanese, though.