Skip to content

v0.15.0

Choose a tag to compare

@github-actions github-actions released this 19 Nov 16:38
· 16 commits to main since this release
cd69fad

Added

  • An agent skill, skills/telegram-sync-cli/SKILL.md: when to use tg, finding chats and
    messages, counting and reading whole chats with one tg sql query and checking that the
    cache covers the chat, confirming before tg send, the error schema and the exit codes.
    Install it with bunx skills add neoromantic/telegram-sync-cli or
    tg skill install --dir <skills dir>, which writes the same file from tg itself. A test
    runs every command in its examples against made-up data and checks the answers of its SQL.
  • tg skill validate reports the account record the next command uses without --account
    (account, accounts_total): activeAccount in config.json, else the active account,
    else the only one. It also reports whether a live process holds daemon.pid
    (daemon: { status, pid }). Neither checks that the session is authorized or online. No
    account, several and none active, or an invalid config.json is an issue. Each value is
    read on its own: one that can't be read is null (accounts_total) or unknown
    (daemon.status), with the reason, and the others stay accurate.
  • tg send --markdown and --html send rich messages such as headings and tables on
    supported accounts. The result includes format. File captions stay plain text.

Changed

  • tg starts about five times faster for every command that answers from the cache, and for
    --help and --version: it loads the Telegram client library only when a command calls
    Telegram (0.1 s of CPU instead of 0.5 s on a source install).

  • A group (basic group or supergroup) adds new messages to the cache only while you take part
    in it: you sent an ordinary message there in the last 90 days. Reading a group doesn't count.
    The rule holds in every tg chats sync mode and in tg messages list/get, --fresh
    included (which still return Telegram's page). Messages already cached stay; private chats
    and channels are unchanged. After each dialog pass the daemon asks Telegram once per group
    for your newest message of the last 90 days, at the lowest priority. Your next message in a
    group, from any device or with tg send, turns it back on; the messages of the pause aren't
    fetched later. tg chats list and tg chats sync show such a group with syncEnabled: false,
    the reason group_participation_required or group_participation_unknown and
    lastOwnMessageAt, and tg status leaves it out of the chats with sync on and of the history
    progress. See docs/sync-strategy.md.

  • Breaking: tg skill installs only the Markdown skill. tg 0.14.0 and older wrote
    <dataDir>/skill.json there and ignored --dir. Now:

    • tg skill manifest is removed;
    • tg skill install needs --dir, the agent's skills directory, and rejects an empty one;
    • it writes <dir>/telegram-sync-cli/SKILL.md instead of <dataDir>/skill.json,
      replacing a file already there, local edits included, and refusing a symbolic link for
      telegram-sync-cli or SKILL.md (the skills directory itself may be one);
    • its JSON drops data.manifest and keeps path, bytes and overwritten.

    Replace tg skill install with:

    tg skill install --dir ~/.claude/skills
  • Breaking: tg skill validate reports a missing account as an issue, so before
    tg auth login it prints valid: false, still with exit 0. tg 0.14.0 and older checked only
    the credentials and the data directory.

  • Breaking: src/db/index.ts no longer exports db, the open data.db connection. Code
    that imports it from the package source calls getDataDb(), which opens data.db on first
    use.

Fixed

  • tg skill install and tg skill validate work with a corrupt data.db, which stopped every
    command with a SQLite stack trace before it started: data.db now opens when a command first
    reads an account. Install writes the skill, and validate names the file as an issue.
  • A command acts on the chat and account it checked against
    allowedChats: the check pins the account and hands its resolved chat to the command, so a
    switch of the active account or a second lookup in between can't move it (#217).
  • A flag a command doesn't declare (--acount 2) and a value after a boolean flag
    (--silent false, which ran as --silent) are INVALID_ARGS instead of being ignored (#217).
  • A Telegram call that succeeded is no longer reported as failed when tg can't write it to its
    local api_activity log, so a retry doesn't repeat a send (#217).
  • The npm package declares long, which tg imports directly. Until now it only arrived
    through @mtcute/core, so an install that doesn't hoist transitive dependencies could fail
    to start.
  • tg auth login --phone works for a user who already has an account under another phone,
    such as the user:<id> account of a QR login or a number they have since changed (#213).
    The phone moves to that account, which keeps its cache. Until now the login failed with
    UNIQUE constraint failed: accounts.phone and left a second account behind.
  • A login of a user who already has an account under another phone or a QR login gives that
    account the new session. Until now the account kept its old session, so after the old
    session was ended in Telegram the login succeeded but the account stayed signed out.