pitboard-core 0.22.0

The engine behind Pitboard: switches Claude Code, Codex and Claude Desktop between accounts by parking and restoring their logins. Its API serves Pitboard's own front ends.
Documentation
//! What Pitboard believes about Antigravity's CLI, agy, and where each fact was read: agy
//! 1.5.19's darwin-arm64, linux-x64 and windows-x64 builds, read as bytes on 28 November 2026
//! and never run. The function names are those Go's own function table gives each build.

use crate::assumptions::OnSystem::{NotRead, Read};
use crate::assumptions::{Assumption, PerSystem};

pub(crate) const VERIFIED_AGAINST: &str = "1.5.19";

const fn everywhere(name: &'static str) -> PerSystem {
    PerSystem {
        name,
        macos: Read(VERIFIED_AGAINST),
        linux: Read(VERIFIED_AGAINST),
        windows: Read(VERIFIED_AGAINST),
    }
}

pub(crate) const ASSUMPTIONS: &[Assumption] = &[
    Assumption {
        name: "agy_login_item_on_macos",
        fact: "On macOS agy keeps its login in a keychain item through go-keyring: service \
               `gemini`, account `antigravity`, written with `security -i` as \
               `add-generic-password -U -s gemini -a antigravity -w`, its value \
               `go-keyring-base64:` and the login's JSON in standard base64.",
        read_from: "The keyring package's set and get functions and the storage setup that \
                    names its account",
        verified_against: VERIFIED_AGAINST,
        depends: "`agy::live` reads and writes the item through `Host::go_keyring`, and \
                  `agy::document` opens and seals its value",
        probe: &["add-generic-password -U -s", "go-keyring-base64:"],
        absent: &[],
    },
    Assumption {
        name: "agy_login_item_on_linux",
        fact: "On Linux agy keeps its login in a Secret Service item through go-keyring: \
               attributes `service` `gemini` and `username` `antigravity`, labelled \
               `Password for 'antigravity' on 'gemini'`, the login's JSON as plain text, in \
               the `login` collection or the one the `default` alias names.",
        read_from: "The keyring package's Secret Service set and get functions",
        verified_against: VERIFIED_AGAINST,
        depends: "`secret_service::Vault::go_keyring` addresses the item by those attributes",
        probe: &[
            "/org/freedesktop/secrets/collection/login",
            "Password for '",
        ],
        absent: &[],
    },
    Assumption {
        name: "agy_login_item_on_windows",
        fact: "On Windows agy keeps its login in the Credential Manager generic item \
               `gemini:antigravity`, user name `antigravity`, the login's JSON as its blob, \
               kept on the local machine, and refuses one past 2560 bytes.",
        read_from: "The keyring package's Windows set function, its `CredWriteW` call and the \
                    length it compares the blob with",
        verified_against: VERIFIED_AGAINST,
        depends: "`credman::Generic::go_keyring` names, keeps and bounds the item that way",
        probe: &["CredWriteW"],
        absent: &[],
    },
    Assumption {
        name: "agy_token_files",
        fact: "agy keeps its login in a file where its keyring cannot hold it: the CLI in \
               `.gemini/antigravity-cli/antigravity-oauth-token`, the language server the App \
               and `agy --hub` run in `.gemini/jetski-standalone-oauth-token`, both under the \
               home Go's `os.UserHomeDir` names. A file named \
               `antigravity-keyring-unavailable` in each one's `cache` folder says its keyring \
               was found wanting, and the next login goes to the file.",
        read_from: "The CLI's and the language server's token storage setup, and the marker's \
                    path function",
        verified_against: VERIFIED_AGAINST,
        depends: "`agy::paths` names the files and markers, and `agy::live` reads both files \
                  after the item and writes a login with no place yet to the files where a \
                  marker is there",
        probe: &[
            "jetski-standalone-oauth-token",
            "-oauth-token",
            "-keyring-unavailable",
            "antigravity-cli",
        ],
        absent: &[],
    },
    Assumption {
        name: "agy_split_login",
        fact: "A login past its keyring's ceiling goes whole to the file and the item is \
               cleared; one whose tokens are in one place and project and plan in another is \
               merged on load, the place with tokens first and every field it lacks taken \
               from the other.",
        read_from: "`healSplitKeyringToken` and `mergeMissingFromTokenlessKeyring`",
        verified_against: VERIFIED_AGAINST,
        depends: "`agy::document::merged` merges the parts as agy does, and `agy::live` writes \
                  a login past the item's ceiling to the files and clears every part of the \
                  account it replaces",
        probe: &["healSplitKeyringToken", "mergeMissingFromTokenlessKeyring"],
        absent: &[],
    },
    Assumption {
        name: "agy_stored_token",
        fact: "agy stores its login as one JSON object: `token` with `access_token`, \
               `token_type`, `refresh_token` and `expiry`, beside `auth_method`, \
               `id_token_email`, `wif_provider`, `project_id`, `user_tier` and \
               `tier_display_name`, and reads whose it is from `id_token_email`, asking \
               nobody.",
        read_from: "The JSON names of the stored token's Go type",
        verified_against: VERIFIED_AGAINST,
        depends: "`agy::engine` names the account by `id_token_email`, fingerprints \
                  `token.refresh_token`, reads the plan from `tier_display_name`, and refuses \
                  a login with a `wif_provider`",
        probe: &["id_token_email", "tier_display_name"],
        absent: &[],
    },
    Assumption {
        name: "agy_files_only",
        fact: "agy keeps its login in files alone, never its keyring, where \
               `AGY_CLI_FORCE_FILE_TOKEN_STORAGE` is true, and on Linux where no session bus \
               is named, over SSH and in WSL.",
        read_from: "`forceFileFromEnv` and the keyring's availability check",
        verified_against: VERIFIED_AGAINST,
        depends: "`agy::paths::files_only` reads the same environment, and a sign-in into a \
                  private home sets the variable so no keyring item is written",
        probe: &[
            "AGY_CLI_FORCE_FILE_TOKEN_STORAGE",
            "DBUS_SESSION_BUS_ADDRESS",
            "WSL_DISTRO_NAME",
            "SSH_CONNECTION",
        ],
        absent: &[],
    },
    Assumption {
        name: "agy_sign_in",
        fact: "`agy` with no argument and `AGY_CLI_CDE_AUTH_ACTION=login` signs in and stops: it \
               prints `Please visit the following URL to authorize the application:` and the \
               address to standard output, then `Enter the authorization code:`, reads one code \
               from standard input, keeps the login in the language server's token storage and \
               prints `Successfully authenticated as` the account. A code it cannot exchange \
               ends it, exit 1. agy has no login subcommand.",
        read_from: "`auth.RunAuthActionWithOptions` and `authclient.TerminalTokenAcquirer`, read \
                    on 29 November 2026",
        verified_against: VERIFIED_AGAINST,
        depends: "`Agy::sign_in` sets the variable and runs agy with no argument, \
                  `Agy::read_sign_in` offers the address and a field for the code, and \
                  `login_from_sign_in` reads the language server's file",
        probe: &[
            "Please visit the following URL to authorize the application:",
            "Enter the authorization code:",
            "AGY_CLI_CDE_AUTH_ACTION",
        ],
        absent: &[],
    },
    Assumption {
        name: "agy_usage_command",
        fact: "`agy -p \"/usage\" --output-format json` asks Google for the account's quota and \
               prints one JSON object whose `command.data` holds `groups`, each with `buckets` \
               of a `name`, a `window`, `remaining_fraction` or `remaining_amount`, and \
               `reset_time` in RFC 3339; it spends no quota, and exits 1 signed out and 2 under \
               a Gemini API key.",
        read_from: "`printmode.usageReport`, the `quotaJSON`, `groupJSON` and `bucketJSON` \
                    types and `printmode.ExitCode`, read on 29 November 2026",
        verified_against: VERIFIED_AGAINST,
        depends: "Pitboard reads an Antigravity account's usage only from this run of agy",
        probe: &[
            "remaining_fraction",
            "reset_time",
            "retrieveUserQuotaSummary",
        ],
        absent: &[],
    },
];

pub(crate) const PER_SYSTEM: &[PerSystem] = &[
    PerSystem {
        name: "agy_login_item_on_macos",
        macos: Read(VERIFIED_AGAINST),
        linux: NotRead("the keychain is macOS's; Linux's item is `agy_login_item_on_linux`"),
        windows: NotRead("the keychain is macOS's; Windows' item is `agy_login_item_on_windows`"),
    },
    PerSystem {
        name: "agy_login_item_on_linux",
        macos: NotRead("the Secret Service is Linux's"),
        linux: Read(VERIFIED_AGAINST),
        windows: NotRead("the Secret Service is Linux's"),
    },
    PerSystem {
        name: "agy_login_item_on_windows",
        macos: NotRead("Credential Manager is Windows'"),
        linux: NotRead("Credential Manager is Windows'"),
        windows: Read(VERIFIED_AGAINST),
    },
    everywhere("agy_token_files"),
    everywhere("agy_split_login"),
    everywhere("agy_stored_token"),
    everywhere("agy_files_only"),
    everywhere("agy_sign_in"),
    everywhere("agy_usage_command"),
];