SAN FRANCISCO - The Japanese and South Korean leaders agreed Thursday to respond jointly and trilaterally with the United States to North Korea's nuclear posturing as they vowed to communicate closely about regional and global challenges, in the latest sign of a thawing in relations long marred by wartime history.