Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

490 B
Raw Blame
/** Waits for `action` and resolves to whether it went through; when it fails (refused, or the link gave up), `undo` takes back what it already showed before `fail` reports why. */
export async function undoOnFailure(action: Promise<unknown>, undo: (() => void) | undefined, fail: (message: string) => void): Promise<boolean> {
  try {
    await action
    return true
  } catch (error) {
    undo?.()
    fail(error instanceof Error ? error.message : String(error))
    return false
  }
}