William Gibson, the writer who coined the term “cyberspace” and whose novel “Neuromancer” heavily influenced the film “The Matrix,” has spent a lifetime imagining surreal and noirish possibilities for human development. But Donald Trump’s victory threw him off balance. “I think it took me about three months to come out of the shock of his actually having been elected,” Gibson told me. And when he finally did come out of it, Gibson still wasn’t quite sure what to do with the manuscript he’d been working on, about a young woman in modern-day San Francisco, since the world he’d situated her in seemed to have suddenly disappeared.

“If I had somehow been able to finish it, by the time it was published, it would have just been this lost thing,” he said, “completely out of time and unconcerned with what I immediately saw as being the beginning of something extraordinary, and almost certainly something extraordinarily bad.”

In the end, he turned the new book into a sequel to his 2014 novel, “The Peripheral.” Part of “The Peripheral” is set in a 22nd century where the world as we know it has been wiped out by a confluence of events known as “The Jackpot,” which is, as Gibson put it to me, “all the bad stuff that we’re worried about now coming true.” Eighty percent of the population has died, and many of the survivors live under the authority of a hereditary oligarchy descended from Russian kleptocrats. People in that future have developed the ability to use data to reach back in time, but when they do, rather than changing the course of events, they inaugurate new, parallel continuums, called “stubs.”

Much of the new book, “Agency,” takes place in a stub where Hillary Clinton won the election and Brexit never happened. Characters from the future — from Gibson’s extrapolated version of our own dark timeline — try to help people in the alternate past avoid a similarly cataclysmic fate. The question looming over the book is not whether the future will be horrifying but whether there’s even the possibility of a future that isn’t.