Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:1ay1 Agentty Self Update

From Leeroopedia
Knowledge Sources
Domains Distribution, Updates
Last Updated 2026-10-28 12:00 GMT

Overview

Self-update against GitHub releases: background version check, `agentty update` command, and atomic binary replacement with fail-safe rollback.

Description

The agentty::update module implements self-update against GitHub releases. Design goals: never slow anything down (TUI check on a background thread, deferred past first paint, rate-limited by a 24h on-disk cache); make updating trivial (`agentty update`, `/update` in the palette); fail safe (download to sibling temp, verify, atomic rename — the running process keeps its old image).

Channel: GitHub releases of agentty-org/agentty, single-file binaries named `agentty-<os>-<arch>[.exe]`. Package-manager installs (rpm/pacman/ebuild) are detected by install-path heuristics and get a "use your package manager" message instead of a self-replace.

Usage

Import this when you need to: check for updates, perform a self-update, or query the current/latest version.

Code Reference

Source Location

Signature

namespace agentty::update {

struct CheckResult {
    bool        update_available = false;
    std::string current, latest, url, error;
};

[[nodiscard]] bool version_less(const std::string& a, const std::string& b);
[[nodiscard]] std::string current_version();
[[nodiscard]] CheckResult check_latest(bool force = false);
[[nodiscard]] std::optional<CheckResult> cached_check();
[[nodiscard]] std::string platform_asset();
[[nodiscard]] bool self_update_possible(std::string& reason);
[[nodiscard]] std::string perform_update(const std::string& tag,
    const std::function<void(std::size_t, std::size_t)>& progress = {});
}

Import

#include "agentty/util/update.hpp"

I/O Contract

Inputs

Name Type Required Description
tag std::string Yes (perform) The release tag to update to
force bool No (check) Bypass the 24h cache

Outputs

Name Type Description
CheckResult struct update_available, current, latest, url, error
perform_update() std::string Empty on success; human error message on failure

Usage Examples

Check and Perform Update

#include "agentty/util/update.hpp"

// Background check (rate-limited by 24h cache):
auto check = agentty::update::check_latest();
if (check.update_available) {
    // Show "⬆ v{latest}" chip in status bar
    // /update or `agentty update`:
    auto err = agentty::update::perform_update(check.latest,
        [](size_t done, size_t total) { /* progress */ });
    if (!err.empty()) {
        // err is a human-readable failure message
    }
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment