@wirecat/tg-cli 0.0.0 → 0.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/LICENSE +204 -0
  2. package/README.md +527 -0
  3. package/THIRD_PARTY_NOTICES +55 -0
  4. package/dist/app.d.ts +11 -0
  5. package/dist/app.d.ts.map +1 -0
  6. package/dist/app.js +16 -0
  7. package/dist/app.js.map +1 -0
  8. package/dist/bin/tg.d.ts +3 -0
  9. package/dist/bin/tg.d.ts.map +1 -0
  10. package/dist/bin/tg.js +18 -0
  11. package/dist/bin/tg.js.map +1 -0
  12. package/dist/bot/adapter.d.ts +9 -0
  13. package/dist/bot/adapter.d.ts.map +1 -0
  14. package/dist/bot/adapter.js +171 -0
  15. package/dist/bot/adapter.js.map +1 -0
  16. package/dist/bot/generated/definitions.d.ts +3 -0
  17. package/dist/bot/generated/definitions.d.ts.map +1 -0
  18. package/dist/bot/generated/definitions.js +19104 -0
  19. package/dist/bot/generated/definitions.js.map +1 -0
  20. package/dist/bot/generated/manifest.d.ts +3 -0
  21. package/dist/bot/generated/manifest.d.ts.map +1 -0
  22. package/dist/bot/generated/manifest.js +15354 -0
  23. package/dist/bot/generated/manifest.js.map +1 -0
  24. package/dist/bot/generated/schemas.d.ts +1407 -0
  25. package/dist/bot/generated/schemas.d.ts.map +1 -0
  26. package/dist/bot/generated/schemas.js +5118 -0
  27. package/dist/bot/generated/schemas.js.map +1 -0
  28. package/dist/bot/generated/types.d.ts +6884 -0
  29. package/dist/bot/generated/types.d.ts.map +1 -0
  30. package/dist/bot/generated/types.js +5 -0
  31. package/dist/bot/generated/types.js.map +1 -0
  32. package/dist/bot/map.d.ts +122 -0
  33. package/dist/bot/map.d.ts.map +1 -0
  34. package/dist/bot/map.js +193 -0
  35. package/dist/bot/map.js.map +1 -0
  36. package/dist/bot/proxy.d.ts +15 -0
  37. package/dist/bot/proxy.d.ts.map +1 -0
  38. package/dist/bot/proxy.js +64 -0
  39. package/dist/bot/proxy.js.map +1 -0
  40. package/dist/bot/transport.d.ts +42 -0
  41. package/dist/bot/transport.d.ts.map +1 -0
  42. package/dist/bot/transport.js +158 -0
  43. package/dist/bot/transport.js.map +1 -0
  44. package/dist/browser.d.ts +6 -0
  45. package/dist/browser.d.ts.map +1 -0
  46. package/dist/browser.js +18 -0
  47. package/dist/browser.js.map +1 -0
  48. package/dist/commands/bot-api.d.ts +3 -0
  49. package/dist/commands/bot-api.d.ts.map +1 -0
  50. package/dist/commands/bot-api.js +112 -0
  51. package/dist/commands/bot-api.js.map +1 -0
  52. package/dist/commands/bot.d.ts +7 -0
  53. package/dist/commands/bot.d.ts.map +1 -0
  54. package/dist/commands/bot.js +99 -0
  55. package/dist/commands/bot.js.map +1 -0
  56. package/dist/commands/context.d.ts +59 -0
  57. package/dist/commands/context.d.ts.map +1 -0
  58. package/dist/commands/context.js +176 -0
  59. package/dist/commands/context.js.map +1 -0
  60. package/dist/commands/proxy-config.d.ts +9 -0
  61. package/dist/commands/proxy-config.d.ts.map +1 -0
  62. package/dist/commands/proxy-config.js +63 -0
  63. package/dist/commands/proxy-config.js.map +1 -0
  64. package/dist/commands/session.d.ts +22 -0
  65. package/dist/commands/session.d.ts.map +1 -0
  66. package/dist/commands/session.js +191 -0
  67. package/dist/commands/session.js.map +1 -0
  68. package/dist/commands/setup.d.ts +3 -0
  69. package/dist/commands/setup.d.ts.map +1 -0
  70. package/dist/commands/setup.js +203 -0
  71. package/dist/commands/setup.js.map +1 -0
  72. package/dist/commands/update.d.ts +2 -0
  73. package/dist/commands/update.d.ts.map +1 -0
  74. package/dist/commands/update.js +35 -0
  75. package/dist/commands/update.js.map +1 -0
  76. package/dist/install/postinstall.d.ts +8 -0
  77. package/dist/install/postinstall.d.ts.map +1 -0
  78. package/dist/install/postinstall.js +62 -0
  79. package/dist/install/postinstall.js.map +1 -0
  80. package/dist/paths.d.ts +9 -0
  81. package/dist/paths.d.ts.map +1 -0
  82. package/dist/paths.js +11 -0
  83. package/dist/paths.js.map +1 -0
  84. package/dist/program.d.ts +8 -0
  85. package/dist/program.d.ts.map +1 -0
  86. package/dist/program.js +138 -0
  87. package/dist/program.js.map +1 -0
  88. package/dist/proxy.d.ts +31 -0
  89. package/dist/proxy.d.ts.map +1 -0
  90. package/dist/proxy.js +99 -0
  91. package/dist/proxy.js.map +1 -0
  92. package/dist/telegram/adapter.d.ts +432 -0
  93. package/dist/telegram/adapter.d.ts.map +1 -0
  94. package/dist/telegram/adapter.js +1898 -0
  95. package/dist/telegram/adapter.js.map +1 -0
  96. package/dist/telegram/bot-history.d.ts +18 -0
  97. package/dist/telegram/bot-history.d.ts.map +1 -0
  98. package/dist/telegram/bot-history.js +145 -0
  99. package/dist/telegram/bot-history.js.map +1 -0
  100. package/dist/telegram/comments.d.ts +18 -0
  101. package/dist/telegram/comments.d.ts.map +1 -0
  102. package/dist/telegram/comments.js +48 -0
  103. package/dist/telegram/comments.js.map +1 -0
  104. package/dist/telegram/credentials.d.ts +22 -0
  105. package/dist/telegram/credentials.d.ts.map +1 -0
  106. package/dist/telegram/credentials.js +49 -0
  107. package/dist/telegram/credentials.js.map +1 -0
  108. package/dist/telegram/errors.d.ts +6 -0
  109. package/dist/telegram/errors.d.ts.map +1 -0
  110. package/dist/telegram/errors.js +186 -0
  111. package/dist/telegram/errors.js.map +1 -0
  112. package/dist/telegram/folder-rules.d.ts +14 -0
  113. package/dist/telegram/folder-rules.d.ts.map +1 -0
  114. package/dist/telegram/folder-rules.js +23 -0
  115. package/dist/telegram/folder-rules.js.map +1 -0
  116. package/dist/telegram/format-html.d.ts +4 -0
  117. package/dist/telegram/format-html.d.ts.map +1 -0
  118. package/dist/telegram/format-html.js +29 -0
  119. package/dist/telegram/format-html.js.map +1 -0
  120. package/dist/telegram/format-markdown.d.ts +3 -0
  121. package/dist/telegram/format-markdown.d.ts.map +1 -0
  122. package/dist/telegram/format-markdown.js +160 -0
  123. package/dist/telegram/format-markdown.js.map +1 -0
  124. package/dist/telegram/join-requests.d.ts +15 -0
  125. package/dist/telegram/join-requests.d.ts.map +1 -0
  126. package/dist/telegram/join-requests.js +35 -0
  127. package/dist/telegram/join-requests.js.map +1 -0
  128. package/dist/telegram/map.d.ts +92 -0
  129. package/dist/telegram/map.d.ts.map +1 -0
  130. package/dist/telegram/map.js +471 -0
  131. package/dist/telegram/map.js.map +1 -0
  132. package/dist/telegram/poll-voters.d.ts +15 -0
  133. package/dist/telegram/poll-voters.d.ts.map +1 -0
  134. package/dist/telegram/poll-voters.js +31 -0
  135. package/dist/telegram/poll-voters.js.map +1 -0
  136. package/dist/telegram/polls.d.ts +5 -0
  137. package/dist/telegram/polls.d.ts.map +1 -0
  138. package/dist/telegram/polls.js +20 -0
  139. package/dist/telegram/polls.js.map +1 -0
  140. package/dist/telegram/profile.d.ts +9 -0
  141. package/dist/telegram/profile.d.ts.map +1 -0
  142. package/dist/telegram/profile.js +175 -0
  143. package/dist/telegram/profile.js.map +1 -0
  144. package/dist/telegram/proxy.d.ts +48 -0
  145. package/dist/telegram/proxy.d.ts.map +1 -0
  146. package/dist/telegram/proxy.js +108 -0
  147. package/dist/telegram/proxy.js.map +1 -0
  148. package/dist/telegram/registration.d.ts +31 -0
  149. package/dist/telegram/registration.d.ts.map +1 -0
  150. package/dist/telegram/registration.js +95 -0
  151. package/dist/telegram/registration.js.map +1 -0
  152. package/dist/telegram/send-as.d.ts +17 -0
  153. package/dist/telegram/send-as.d.ts.map +1 -0
  154. package/dist/telegram/send-as.js +67 -0
  155. package/dist/telegram/send-as.js.map +1 -0
  156. package/dist/telegram/stats.d.ts +13 -0
  157. package/dist/telegram/stats.d.ts.map +1 -0
  158. package/dist/telegram/stats.js +135 -0
  159. package/dist/telegram/stats.js.map +1 -0
  160. package/dist/telegram/storage.d.ts +4 -0
  161. package/dist/telegram/storage.d.ts.map +1 -0
  162. package/dist/telegram/storage.js +68 -0
  163. package/dist/telegram/storage.js.map +1 -0
  164. package/dist/telegram/upload.d.ts +9 -0
  165. package/dist/telegram/upload.d.ts.map +1 -0
  166. package/dist/telegram/upload.js +29 -0
  167. package/dist/telegram/upload.js.map +1 -0
  168. package/dist/update.d.ts +28 -0
  169. package/dist/update.d.ts.map +1 -0
  170. package/dist/update.js +56 -0
  171. package/dist/update.js.map +1 -0
  172. package/dist/version.d.ts +2 -0
  173. package/dist/version.d.ts.map +1 -0
  174. package/dist/version.js +2 -0
  175. package/dist/version.js.map +1 -0
  176. package/install/postinstall.mjs +3 -0
  177. package/install/windows.ps1 +161 -0
  178. package/package.json +72 -3
  179. package/skills/tg-cli/SKILL.md +489 -0
  180. package/spec/bot/LICENSE +21 -0
  181. package/spec/bot/README.md +16 -0
package/README.md ADDED
@@ -0,0 +1,527 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/WireCatLabs/tg-cli/main/docs/design/logo_text.png" alt="Tg CLI" width="480">
3
+ </p>
4
+
5
+ # tg-cli
6
+
7
+ A Telegram client for the terminal and for AI agents. `tg` is a command line tool and an MCP server
8
+ for your own Telegram account: read your chats, find what was said, and answer — yourself, or
9
+ through Claude, Codex, Cursor and other agents, within limits you set. In the groups you run, see
10
+ which questions nobody answered and who joined.
11
+
12
+ It runs on Windows, macOS and Linux. Documentation: [wirecat.dev/en/docs/tg](https://wirecat.dev/en/docs/tg).
13
+
14
+ ```sh
15
+ tg inbox # other people's unread messages, in every chat
16
+ tg messages send "Book club" "Running 15 minutes late"
17
+ ```
18
+
19
+ [![npm](https://img.shields.io/npm/v/@wirecat/tg-cli)](https://www.npmjs.com/package/@wirecat/tg-cli)
20
+ [![CI](https://github.com/WireCatLabs/tg-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/WireCatLabs/tg-cli/actions/workflows/ci.yml)
21
+ [![Node](https://img.shields.io/node/v/@wirecat/tg-cli)](https://nodejs.org/)
22
+ [![Bun](https://img.shields.io/badge/bun-tested-f9f1e1)](https://bun.sh/)
23
+ [![npm downloads](https://img.shields.io/npm/dm/@wirecat/tg-cli)](https://www.npmjs.com/package/@wirecat/tg-cli)
24
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
25
+
26
+ ## The bot
27
+
28
+ `tg bot` works with a bot through Telegram's **official** [Bot API](https://core.telegram.org/bots/api)
29
+ and its token from [@BotFather](https://t.me/BotFather). You can keep several bots: each is kept
30
+ under a name you choose, and that name is the first word of the command.
31
+
32
+ **The entire Bot API.** All 185 methods of Telegram Bot API 10.3 are exposed through
33
+ `tg <bot> bot api <method>`, including operations beyond the convenient message and chat
34
+ commands. Use native field flags or JSON bodies for your own scripts and automation.
35
+ [Bot API guide](docs/bot.md#the-complete-bot-api) · [Every command and option](docs/commands.md).
36
+
37
+ ```sh
38
+ tg sales bot auth set # the token, at a hidden prompt; Telegram checks it first
39
+ tg sales bot auth show # which bot it is
40
+ tg sales bot recipients add user:<id> # the bot may write only here
41
+ tg sales bot messages send "Team" "Build is ready" --file report.pdf
42
+ tg bot list --check # every bot on this computer
43
+ ```
44
+
45
+ - **Every Bot API method.** `tg sales bot api --help` lists the complete native API;
46
+ each method's help lists its fields. The usual bot commands remain available alongside it.
47
+ - **One token per name, in the keyring.** `bot:<name>`, apart from your own login; `TG_BOT_TOKEN`
48
+ for CI. The token is never printed — not in an error, not with `--trace`, not in a run record.
49
+ - **Recipients and a journal.** Each bot has its own list of chats it may write to, and a journal
50
+ of what it did, without the text.
51
+ - **Messages and chats.** Send, edit, delete and pin, to a chat by id or by title, or to a person
52
+ as `user:<id>`; `--md`, `--html`, a file or a photo. `bot store fetch` imports older channel and supergroup messages;
53
+ `messages list` reads what this bot sent, received or imported on this computer.
54
+ History import uses a separate MTProto session; private chats and basic groups are unsupported.
55
+ - **Admins, members, buttons, the menu, webhooks.** `bot chats admins`, `bot chats members remove`,
56
+ `bot callbacks answer`, `bot commands`, `bot webhooks` — the same commands `max bot` has.
57
+ - **`bot watch`** prints what happens in the bot's chats as it arrives, and keeps it: that is the
58
+ bot's history on this computer.
59
+
60
+ In full: [docs/bot.md](docs/bot.md).
61
+
62
+ ## The personal account
63
+
64
+ `tg` works with your own account, as one more of your devices: every chat, its history, groups,
65
+ channels and contacts. It is not a bot: it talks to Telegram over MTProto, Telegram's own API for
66
+ client apps, with an app you register yourself.
67
+
68
+ ```sh
69
+ tg chats list --limit 5
70
+ tg messages list "Book club"
71
+ tg messages send "Book club" "Running 15 minutes late"
72
+ ```
73
+
74
+ In full: [docs/usage.md](docs/usage.md).
75
+
76
+ ## How to use it
77
+
78
+ - **A check on a schedule.** Morning and evening, the agent looks at what came in and sends you a
79
+ short summary: who is waiting for an answer, what is urgent, what you can skip.
80
+ - **Reports.** A week of a work chat: what was decided, who took what on, which questions are still
81
+ open.
82
+ - **Who owes what.** `tg review` hands over everything said since the last review in one call, your
83
+ own messages too. The agent sorts it into "I owe", "waiting on others" and "needs clarifying".
84
+ - **Reminders.** Whom you promised an answer and did not give one; whose question has waited three
85
+ days.
86
+ - **Draft replies.** The agent proposes the text, and you send it — or it sends, if you allowed it
87
+ to write to that chat.
88
+ - **Search.** "When did we agree to meet Anna?" — an answer with the date and the message itself.
89
+ - **A group you run.** Which questions nobody answered, who joined this week
90
+ ([groups.md](docs/groups.md)).
91
+
92
+ What that looks like:
93
+
94
+ ```text
95
+ You: What did I promise anyone in the last three days?
96
+ Agent: (calls tg review: 12 chats)
97
+ I owe
98
+ · Anna — send the invoice by Friday. "Anna", 24.09
99
+ Waiting on others
100
+ · Boris — the mock-up by 25.09. Not in "Design" yet
101
+ Needs clarifying
102
+ · "Project Alpha": who brings the samples — "we'll decide later", 25.09
103
+ Next review — from 26.09, 14:05.
104
+ You: Remind Boris about the mock-up.
105
+ Agent: Draft: "Boris, hi! How is the mock-up going?" Send it?
106
+ You: Yes.
107
+ ```
108
+
109
+ Set sending to `ask` in the profile's `permissions` for confirmation in the terminal. Over MCP,
110
+ `ask` permits the requested write; configure approval in the agent app. Reading marks nothing read.
111
+ Ready requests, a schedule and limits for each job: [recipes.md](docs/recipes.md).
112
+
113
+ ## Groups you run
114
+
115
+ ```sh
116
+ tg review --chat "Hiking" --unanswered # questions nobody answered in 24 hours
117
+ tg chats events "Hiking" --since-time 7d # who joined, left, was added or removed, and by whom
118
+ tg chats members list "Hiking" --all # everyone, with their role and when they were last seen
119
+ tg topics list "Hiking" # a forum group's topics, newest activity first
120
+ tg chats inspect https://t.me/+AbCdEf # where an invite link leads, without joining
121
+ tg chats create "Hiking 2027" @olga # a new group, with the people you name
122
+ ```
123
+
124
+ Renaming a group, adding and removing members and admins, resetting its invite link and moderation
125
+ rules for links, forwards and floods are commands too. In full: [docs/groups.md](docs/groups.md).
126
+
127
+ Enable topics with `topics enable`. Only the group owner can do this. A basic group needs
128
+ `--upgrade --yes`, which permanently changes its chat id; the result gives the new address.
129
+ An existing supergroup needs no upgrade. `topics create` creates a named topic; on an unknown
130
+ outcome, check the list and never repeat an unknown creation. Existing archive rows keep
131
+ their original chat ids; histories are not automatically merged across the migration.
132
+
133
+ Send into a forum topic with `messages send --topic` or `polls create --topic`. Use the id from
134
+ `topics list`; an explicit reply must belong to that topic. Text, photo/file captions and scheduled
135
+ sends keep the topic. Closed or missing topics are refused before sending. On an unknown outcome,
136
+ repeat with the same send id, chat and topic; check the scheduled queue instead of repeating a
137
+ scheduled send.
138
+
139
+ ## How it works
140
+
141
+ `tg` works in your name, as one more of your devices. It is not a bot: it talks to Telegram over
142
+ MTProto, Telegram's own API for client apps, with an app you register yourself. From then on `tg`
143
+ sees your chats, their history, groups, channels and contacts.
144
+
145
+ An agent connects to `tg` in one of two ways:
146
+
147
+ - **An agent with a terminal** — Claude Code, Codex, Gemini CLI. It runs `tg` commands itself. Give
148
+ it the [skill](skills/tg-cli/SKILL.md): instructions for working with `tg`, installed with one
149
+ command ([recipes.md](docs/recipes.md#once-first)).
150
+ - **An agent without a terminal** — Claude Desktop, Cursor and other MCP clients. Connect `tg mcp`;
151
+ `tg mcp config` prints the entry for their settings. It comes with ready prompts: `/catch-up`
152
+ (what is new), `/review` (who owes what), `/reply` (a draft answer) and `/find` (search). The
153
+ profile's `permissions` decide what the agent may do ([mcp.md](docs/mcp.md#what-an-agent-may-do)).
154
+
155
+ ## What it can do
156
+
157
+ - **Read.** Chats, history, one message with its neighbours, other people's unread messages in every
158
+ chat at once (`tg inbox`), everything since the last review (`tg review`), new messages as they
159
+ arrive (`tg watch`), a message's files or a whole chat's, voice messages as text.
160
+ - **Search.** Messages by their text, across the local archive and Telegram by default;
161
+ `--backend archive` keeps search local, and `--sync-first` fetches new messages before searching.
162
+ Use `--regex` for a pattern. Chats by part of their title, contacts by part of a name, a person by phone number.
163
+ - **Write.** Text with Markdown, replies, files, photos, videos and voice messages, silent messages,
164
+ scheduled messages that go out even with this computer off, edits, forwards, pins, reactions,
165
+ polls, deletion — for you or for everyone.
166
+ - **Keep an archive.** Fetch a chat's history into the local store, in the background if it is long;
167
+ keep the store current with `tg serve`, as a systemd or launchd service; export a chat as JSON
168
+ lines or Markdown; back the store up and restore it while it is in use ([archive.md](docs/archive.md)).
169
+ - **One request pace per profile**, shared by every command, job and server at once, so bulk work stays
170
+ under Telegram's limits; long waits stop the run instead of being repeated ([limits.md](docs/limits.md)).
171
+ - **Groups and channels.** Create a group or a channel, join by a link, leave; rename it, add and
172
+ remove members and admins, reset its invite link; who joined and left, forum topics, where an
173
+ invite link leads; moderation rules for links, forwards and floods, applied when you run them
174
+ ([groups.md](docs/groups.md)).
175
+ - **Contacts and the account.** Add, rename, block and import contacts; who you are logged in as,
176
+ and every device and app logged in to the account.
177
+ - **About one person.** Their profile, last seen and when they registered; how many of their
178
+ messages you hold in each shared chat; their latest messages per chat for an agent to summarise;
179
+ and whether the account looks like a bot or a spammer, public spam lists included
180
+ ([people.md](docs/people.md)).
181
+
182
+ ## Why it is good
183
+
184
+ - **It reads without a trace.** Reading marks nothing read: the other side does not see that you
185
+ opened the chat. Mark it read when you want to: `tg chats mark-read`.
186
+ - **An agent cannot write more than you allowed.** A profile can be read-only, allow only some
187
+ actions, send only to the chats on its list, and send at most 30 messages an hour. When a name
188
+ fits two chats, `tg` does not pick one: it shows both ([security.md](docs/security.md#the-send-guard)).
189
+ - **A message is never sent twice.** If the connection breaks while a message is sent, `tg` says
190
+ plainly that it does not know whether it went, and gives the command to repeat it. Telegram
191
+ recognises the repeat and does not create a second message
192
+ ([usage.md](docs/usage.md#when-the-outcome-is-unknown)).
193
+ - **Your own copy of your messages.** Everything read is kept on your computer. Search over it is
194
+ fast, and `--offline` answers from it without connecting at all.
195
+ - **Voice messages as text, on your computer.** Telegram transcribes for Premium accounts; `tg` can
196
+ also run a speech model on this machine, downloaded only when you ask
197
+ ([usage.md](docs/usage.md#voice-messages)).
198
+ - **Other people's text does not control your terminal.** Control characters in names, titles and
199
+ messages are shown as text, and a name is printed on one line
200
+ ([security.md](docs/security.md#other-peoples-text-on-your-screen)).
201
+ - **No secret on the command line.** No command takes a password, a login code or a phone number as
202
+ an argument. The app keys are in the system keyring.
203
+ - **Easy to read for a script and an agent.** With `--json`, a command prints data and nothing else,
204
+ always in the same shape. An error comes separately, with its own exit code
205
+ ([usage.md](docs/usage.md#for-scripts-and-agents)).
206
+ - **Problems can be looked at without your messages.** `--trace` shows each request to Telegram and
207
+ holds no text, names, phone numbers or keys, so it can go into a bug report
208
+ ([diagnostics.md](docs/diagnostics.md)).
209
+
210
+ ## Custom work
211
+
212
+ We build process automation and tools for your task: integrations with Telegram and other
213
+ messengers, AI agents, internal services. Write to [info@neirox.ai](mailto:info@neirox.ai).
214
+
215
+ ## How it differs
216
+
217
+ There are good tools for a Telegram account already. Choose what fits the job:
218
+ [Compared with other tools](docs/compare.md) puts `tg` next to tgcli, telegram-mcp and tdl, feature by
219
+ feature.
220
+
221
+ **Telegram's own apps** are made for a person. `tg` is made for a script and an agent: one operation
222
+ per call, the same shape of answer every time, a limit on what an agent may send, your messages
223
+ searchable offline, and nothing marked read by reading.
224
+
225
+ **Bots.** A Telegram bot, through the [Bot API](https://core.telegram.org/bots/api), sees only the
226
+ chats it was added to and speaks as the bot. `tg` is you: your chats, in your name. `tg bot` drives a bot of
227
+ yours through that API ([bot.md](docs/bot.md)).
228
+
229
+ ## Contents
230
+
231
+ - [The bot](#the-bot)
232
+ - [The personal account](#the-personal-account)
233
+ - [Groups you run](#groups-you-run)
234
+ - [Install](#install)
235
+ - [Log in](#log-in)
236
+ - [Use](#use)
237
+ - [For scripts and agents](#for-scripts-and-agents)
238
+ - [Security](#security)
239
+ - [Documentation](#documentation)
240
+ - [Development](#development)
241
+ - [Roadmap](#roadmap)
242
+ - [Licence](#licence)
243
+ - [Contributing](#contributing)
244
+
245
+ ## Install
246
+
247
+ The package is **`@wirecat/tg-cli`**; the command it installs is **`tg`**.
248
+
249
+ Try it without installing:
250
+
251
+ ```sh
252
+ npx @wirecat/tg-cli --help
253
+ ```
254
+
255
+ Install it:
256
+
257
+ ```sh
258
+ npm install -g --allow-scripts=@wirecat/tg-cli --foreground-scripts @wirecat/tg-cli # or: pnpm add -g @wirecat/tg-cli, bun add -g @wirecat/tg-cli
259
+ tg --version
260
+ tg setup # guided first run; allow about five minutes
261
+ ```
262
+
263
+ For an agent, read `tg skill show` before login and use `tg setup --agent codex`.
264
+ `tg --help` and `tg setup --help` show the next steps.
265
+
266
+ It needs **Node 22.16 or newer**, or **Bun** — CI runs the built command under both — on macOS, Linux
267
+ or Windows. SQLite comes from the
268
+ runtime itself, or from tg's own copy when a Linux Node's system SQLite is too old, so there is
269
+ nothing to compile. `tg doctor` says where its files are and whether a
270
+ session is saved, without connecting; `tg doctor --online` checks the login works. Details, variables and where the files go:
271
+ [docs/installation.md](docs/installation.md).
272
+
273
+ ### Windows installation
274
+
275
+ ```powershell
276
+ & ([scriptblock]::Create((Invoke-RestMethod 'https://wirecat.dev/install.ps1'))) -Tool tg -Agent all
277
+ ```
278
+
279
+ This single installer call saves the npm command folder to user PATH, updates this PowerShell,
280
+ installs the bundled agent skill and verifies bare `tg`. It preserves existing PATH entries,
281
+ works when npm skips lifecycle scripts and leaves PowerShell execution policy unchanged.
282
+ An agent reads `tg skill show` before guiding login. Installation itself contacts no account.
283
+ See [installation](docs/installation.md#windows-one-install-command).
284
+
285
+ ## Log in
286
+
287
+ For a first run, use the guided command in your terminal:
288
+
289
+ ```sh
290
+ tg setup --agent codex # also: cursor, claude, gemini, all or none
291
+ ```
292
+
293
+ Allow about five minutes. It checks local directories, obtains your Telegram app keys, logs in
294
+ by QR code, checks the first five chats and installs the selected agent skill. Without `--agent`,
295
+ it asks at a terminal; machine output defaults to `none`. A repeat run checks the existing session.
296
+ History downloads are a separate step: choose a chat before `tg store fetch <chat> --last 100`.
297
+ If automatic app registration fails, use `tg session start --app browser`, then rerun setup.
298
+
299
+ Every user registers their own Telegram app at [my.telegram.org](https://my.telegram.org/apps).
300
+ `tg session start` asks for it the first time; `--app auto` fills in the site for you.
301
+
302
+ ```sh
303
+ tg session start # a QR code in the terminal: Settings → Devices → Link Desktop Device
304
+ tg session start phone # or a phone number, the code, and your 2FA password
305
+ tg session start --qr-file login.png # the QR code as a picture, for an agent to show you
306
+ tg account show # who you are logged in as
307
+ tg account list # every profile here, and who each is logged in as
308
+ ```
309
+
310
+ Several accounts are several profiles, and the profile is **the first word**, not an option:
311
+
312
+ ```sh
313
+ tg chats list # profile "default"
314
+ tg work chats list # profile "work"
315
+ export TG_PROFILE=work # or for the whole shell session
316
+ ```
317
+
318
+ The app, the session and profiles: [docs/sessions.md](docs/sessions.md).
319
+
320
+ ## Use
321
+
322
+ **A conversation in your name:**
323
+
324
+ ```sh
325
+ tg inbox # unread in every chat, nothing marked read
326
+ tg messages list "Book club" --limit 20
327
+ tg messages send "Book club" "Call at 3?" --reply-to <id>
328
+ tg reactions add "Book club" <id> 👍
329
+ tg messages send me "Call mum" --at-time 2h # a reminder in Saved Messages in two hours
330
+ tg review --since-time 1d # a day of messages: who promised what
331
+ ```
332
+
333
+ **Files and voice:**
334
+
335
+ ```sh
336
+ tg messages send "Book club" "The minutes" --file minutes.pdf
337
+ tg messages download "Book club" <id> --output-dir ~/Downloads
338
+ tg messages transcribe "Book club" <id> # a voice message as text
339
+ ```
340
+
341
+ **Find and keep:**
342
+
343
+ ```sh
344
+ tg search all "contract" # messages, mail and notes kept, without connecting
345
+ tg messages evidence "Project Alpha" --json # bounded evidence for a chat brief
346
+ tg store fetch "Project Alpha" --last 5000 --background
347
+ tg store export "Project Alpha" --format markdown --output alpha.md
348
+ tg server install # keep the store current as a service
349
+ ```
350
+
351
+ Every command answers in JSON with `--json`, and every send goes into a journal — without its text.
352
+
353
+ In full: [docs/usage.md](docs/usage.md). Every command and option:
354
+ [docs/commands.md](docs/commands.md) — generated from the program itself, so it cannot describe a
355
+ version that does not exist.
356
+
357
+ ## For scripts and agents
358
+
359
+ ### A skill for agents with a terminal
360
+
361
+ A skill is a file of instructions an agent reads before it works. The bundled skill is available
362
+ before login through `tg skill show`. It explains setup, reading, permissions and safe sending.
363
+ Guided setup installs it for your chosen agent; an already configured account can install it
364
+ separately:
365
+
366
+ ```sh
367
+ tg setup --agent codex # also cursor, claude, gemini, all or none
368
+ tg skill install --for all # install both supported skill directories, without logging in
369
+ tg skill show # read the complete instructions without installing them
370
+ ```
371
+
372
+ Claude Code uses `~/.claude/skills/tg-cli/`. Codex, Gemini CLI and local Cursor use
373
+ `~/.agents/skills/tg-cli/`. Start a new agent session after installation if it does not see the
374
+ skill. The installed instructions come from the same package version as `tg`.
375
+
376
+ How these agents find skills: [Codex](https://learn.chatgpt.com/docs/build-skills),
377
+ [Gemini CLI](https://geminicli.com/docs/cli/skills/),
378
+ [Cursor](https://cursor.com/docs/skills).
379
+
380
+ ### An MCP server for agents without a terminal
381
+
382
+ Claude Desktop, Cursor and other MCP clients connect to `tg mcp` and work with the same account.
383
+ The profile's `permissions` decide which commands it gets: by default it can send, react, mark
384
+ read and delete your own messages, with no form. Set a level to `readonly` to keep the agent from
385
+ changing it; to see each change first, leave `tg_write` unapproved in your client.
386
+ In full: [docs/mcp.md](docs/mcp.md).
387
+
388
+ ```sh
389
+ claude mcp add tg -- tg mcp # Claude Code
390
+ tg mcp doctor # check the local MCP server
391
+ tg mcp setup codex # add it to Codex
392
+ tg mcp setup claude-code # add it to Claude Code
393
+ tg mcp config # the entry for Claude Desktop, Cursor and others, with full paths
394
+ ```
395
+
396
+ The server's prompts — `/catch-up`, `/review`, `/reply`, `/find` — are ready requests: the agent
397
+ knows which tools to call and what not to do. ChatGPT or Claude in the browser can reach it too,
398
+ through a login proxy and a tunnel: [docs/remote.md](docs/remote.md).
399
+
400
+ ### Answers in JSON
401
+
402
+ ```sh
403
+ tg chats list --json
404
+ ```
405
+
406
+ With `--json` a command prints only data, as one JSON value — no tables, colour or hints. It does
407
+ the same when another program reads its output, as in `tg … | jq`. `--jsonl` prints one object per
408
+ line. Every list comes in one shape:
409
+
410
+ ```json
411
+ { "items": [ … ], "page": 1, "limit": 20, "hasMore": true }
412
+ ```
413
+
414
+ An error comes apart from the data — one line on stderr, while stdout stays empty, so it cannot be
415
+ taken for an empty result:
416
+
417
+ ```json
418
+ {"error":{"code":"authentication_error","message":"…"}}
419
+ ```
420
+
421
+ Every error has a number — the exit code. A script decides what to do next by it: `4` log in, `5`
422
+ the profile may not do this, `6` chat or message not found, `8` a limit, `9` Telegram did not answer
423
+ in time, `14` unknown whether a message went. `tg commands --json` is the whole command tree, with
424
+ every exit code. All codes: [docs/commands.md](docs/commands.md#exit-codes).
425
+
426
+ ## Security
427
+
428
+ - The session is a file readable only by your user, and it is as good as your password: copying it
429
+ copies the login. The app keys are in the system keyring.
430
+ - The local store is readable only by your user. It holds the full text of what was read,
431
+ unencrypted; only whole-disk encryption protects it from a stolen disk. It stays after logging out.
432
+ - Before each send, from a command or over MCP, `tg` checks the profile's limits and writes a line to
433
+ the journal — without the message's text.
434
+ - A level of `ask` in `permissions` asks you in the terminal before a change; over MCP nobody is
435
+ there to answer, so it goes ahead — use `readonly` to stop an agent. `--file` refuses keys and hidden files unless you add
436
+ `--allow-any-file`, and over MCP there is no way around it.
437
+ - The limits protect against an agent talked into sending by a message it read, not against one
438
+ that sets out to get round them: against that you need a boundary outside — a sandbox or a
439
+ separate user.
440
+
441
+ In full — what reaches the disk, what goes over the network and what the tool never does:
442
+ [docs/security.md](docs/security.md).
443
+
444
+ ## Documentation
445
+
446
+ | Page | Answers |
447
+ |---|---|
448
+ | [installation](docs/installation.md) | requirements, where files go, shell completion, upgrade, removal |
449
+ | [usage](docs/usage.md) | profiles, reading, paging, sending, scripts |
450
+ | [sessions](docs/sessions.md) | QR and phone login, the app from my.telegram.org, the keyring, profiles, logout |
451
+ | [archive](docs/archive.md) | the local store: fetch, search, export, `--offline`, `serve` as a service, backup |
452
+ | [groups](docs/groups.md) | groups you run: unanswered questions, newcomers, a weekly report |
453
+ | [people](docs/people.md) | one person: profile, what they said in each chat, does the account look like a bot |
454
+ | [replies](docs/replies.md) | answer messages by your rules, to everyone or only the people you choose |
455
+ | [mcp](docs/mcp.md) | Claude Desktop, Cursor and other clients without a terminal |
456
+ | [remote](docs/remote.md) | ChatGPT or Claude in the browser, through a login proxy and a tunnel |
457
+ | [recipes](docs/recipes.md) | an agent's daily work: summary, who owes what, unanswered, on a schedule |
458
+ | [commands](docs/commands.md) | every command, option and exit code, generated from the program |
459
+ | [configuration](docs/configuration.md) | common setup |
460
+ | [configuration reference](docs/configuration-reference.md) | every key, type, default, scope and variable |
461
+ | [CLI contract](docs/cli-contract.md) | output, errors, bounds and agent execution |
462
+ | [diagnostics](docs/diagnostics.md) | `--trace`, `--record`, `runs`, `doctor report`, and what is never recorded |
463
+ | [troubleshooting](docs/troubleshooting.md) | by symptom: what the screen says, and what to do |
464
+ | [security](docs/security.md) | what reaches the disk and the network; the send guard |
465
+ | [roadmap](docs/roadmap.md) | what is coming |
466
+
467
+ What each version changed: [CHANGELOG.md](CHANGELOG.md).
468
+
469
+ ## Development
470
+
471
+ ```sh
472
+ pnpm install
473
+ pnpm lint && pnpm typecheck && pnpm test
474
+ pnpm build && pnpm smoke:bun # the built command under the second runtime
475
+ pnpm generate # rewrites docs/commands.md from the command tree
476
+ bin/tg session start # everything under .tg/ in this checkout, never the real profile
477
+ bin/tg chats list --limit 5
478
+ ```
479
+
480
+ Everything that is not specific to Telegram — the commands, the store, the send guard, the MCP
481
+ server — lives in [cli-messaging](https://github.com/WireCatLabs/cli-messaging), shared with
482
+ [max-cli](https://github.com/WireCatLabs/max-cli). Telegram-specific code lives only in `src/telegram/`,
483
+ and a lint rule keeps [mtcute](https://mtcute.dev), the Telegram library underneath, there.
484
+
485
+ To work on `cli-messaging` at the same time, point the dependency at a checkout for the length of
486
+ the change — `pnpm add @wirecat/cli-messaging@link:../cli-messaging` — and put the version back
487
+ before the pull request.
488
+
489
+ ## Roadmap
490
+
491
+ What is coming to `tg`, in the order it is likely to arrive. The order can change. Ideas and
492
+ requests are welcome in [issues](https://github.com/WireCatLabs/tg-cli/issues).
493
+
494
+ - **Richer sending** — several photos in one message
495
+ ([usage.md](docs/usage.md#not-in-tg-yet)).
496
+
497
+ What each released version changed is in [CHANGELOG.md](CHANGELOG.md).
498
+
499
+ ## Licence
500
+
501
+ Apache License 2.0 — see [LICENSE](LICENSE).
502
+
503
+ ## Contributing
504
+
505
+ Pull requests, bug reports and ideas are welcome —
506
+ [issues](https://github.com/WireCatLabs/tg-cli/issues). How the code is built and how to test it:
507
+ [docs/dev/ARCHITECTURE.md](docs/dev/ARCHITECTURE.md) and [docs/dev/TESTING.md](docs/dev/TESTING.md).
508
+
509
+ For browser connectors, `tg mcp --http --public-url https://<name>.ts.net` serves behind your tunnel
510
+ with an owner-code login. Profile permissions govern writes; the server has no confirmation forms. See [remote access](docs/remote.md).
511
+ Group activity is available with `tg stats chats show <chat>`; [statistics](docs/groups.md#statistics-for-group-admins).
512
+
513
+ ### Private contact notes and automatic tags
514
+
515
+ `tg contacts alias set <person> <alias>` keeps a display name locally for the selected account;
516
+ `contacts rename` updates the messenger address book. Write your own notes with
517
+ `contacts notes add <person> --file <path>`, then use `list`, `show`, `edit --revision <n>` and
518
+ `remove`. `contacts show --with-notes` includes notes explicitly; `contacts list --search-notes
519
+ <text>` searches them. A contact's notes show in every account that sees the contact; an alias stays in
520
+ its own account. Contact refresh preserves notes and aliases; linking people does not
521
+ combine their private metadata.
522
+
523
+ `tg metadata refresh --chat <id>` caches a group/channel description; `metadata get --chat <id>`
524
+ reads that snapshot. `tags auto --chat <id> --dry-run` previews keyword labels. Use
525
+ `--refresh-metadata` without `--dry-run` for current descriptions. Each run handles at most 500
526
+ chats, 50 by default. Automatic labels preserve manual labels; `tags list|remove --source auto`
527
+ selects generated claims. Classification uses no message text or external model.
@@ -0,0 +1,55 @@
1
+ Third-party material in tg
2
+
3
+ The registration-month table in src/telegram/profile.ts (ID_MONTHS) is fitted to the sign-up dates in
4
+ telegram-id-age, https://github.com/jobians/telegram-id-age, dataset.json at commit
5
+ 86605dcb20ece9f76d7c18a19a70026c9cf268cc
6
+ (https://github.com/jobians/telegram-id-age/blob/86605dcb20ece9f76d7c18a19a70026c9cf268cc/dataset.json).
7
+ The repository has no LICENSE file; its package.json and README declare the MIT License, "MIT License ©
8
+ 2025 JOBIANSTECHIE":
9
+
10
+ MIT License
11
+
12
+ Copyright (c) 2025 JOBIANSTECHIE
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+
32
+ The table's points for 2017-2021, where telegram-id-age has few dates, come from tg-id-mcp,
33
+ https://github.com/barkoszloy/tg-id-mcp, src/tg_id_mcp/server.py (REG_DATE_RANGES):
34
+
35
+ MIT License
36
+
37
+ Copyright (c) 2026 barkoszloy
38
+
39
+ Permission is hereby granted, free of charge, to any person obtaining a copy
40
+ of this software and associated documentation files (the "Software"), to deal
41
+ in the Software without restriction, including without limitation the rights
42
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43
+ copies of the Software, and to permit persons to whom the Software is
44
+ furnished to do so, subject to the following conditions:
45
+
46
+ The above copyright notice and this permission notice shall be included in all
47
+ copies or substantial portions of the Software.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55
+ SOFTWARE.
package/dist/app.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { AppIdentity } from "@wirecat/cli-messaging/cli";
2
+ import { type Configuration } from "@wirecat/cli-messaging/cli";
3
+ export declare const TG: AppIdentity;
4
+ export declare const CONFIG: Configuration;
5
+ export declare const resolveSettings: (flags?: import("@wirecat/cli-messaging/cli").GlobalFlags, options?: import("@wirecat/cli-messaging/cli").ResolveOptions) => import("@wirecat/cli-messaging/cli").Settings & object, configuredProfiles: (options?: import("@wirecat/cli-messaging/cli").ResolveOptions) => string[], changeSetting: (path: string, { profile, setting, value, kind, }: {
6
+ profile: string | undefined;
7
+ setting: string;
8
+ value: string | undefined;
9
+ kind?: import("@wirecat/cli-messaging/cli").ProfileKind | undefined;
10
+ }) => unknown;
11
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,4BAA4B,CAAA;AAK5E,eAAO,MAAM,EAAE,EAAE,WAQhB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,aAAiF,CAAA;AACtG,eAAO,MAAQ,eAAe,uLAAE,kBAAkB,+EAAE,aAAa;;;;;aAAW,CAAA"}
package/dist/app.js ADDED
@@ -0,0 +1,16 @@
1
+ import { settingsFor } from "@wirecat/cli-messaging/cli";
2
+ import * as v from "valibot";
3
+ import { proxySetting } from "./proxy.js";
4
+ import { VERSION } from "./version.js";
5
+ export const TG = {
6
+ command: "tg",
7
+ appName: "tg-cli",
8
+ envPrefix: "TG",
9
+ description: "A personal Telegram account from the command line, for agents and scripts",
10
+ version: VERSION,
11
+ issues: "https://github.com/WireCatLabs/tg-cli/issues/new",
12
+ locale: "en-GB",
13
+ };
14
+ export const CONFIG = settingsFor(TG, { profile: { proxy: v.optional(proxySetting) } });
15
+ export const { resolveSettings, configuredProfiles, changeSetting } = CONFIG;
16
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC5E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,EAAE,GAAgB;IAC7B,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,2EAA2E;IACxF,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,kDAAkD;IAC1D,MAAM,EAAE,OAAO;CAChB,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAkB,WAAW,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAA;AACtG,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,aAAa,EAAE,GAAG,MAAM,CAAA"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=tg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tg.d.ts","sourceRoot":"","sources":["../../src/bin/tg.ts"],"names":[],"mappings":""}
package/dist/bin/tg.js ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { ensureSqlite } from "@wirecat/cli-messaging/sqlite-runtime";
3
+ await ensureSqlite();
4
+ // A static import would load the whole program, and its SQLite, before ensureSqlite could swap it.
5
+ const { run } = await import("../program.js");
6
+ process.exitCode = await run(process.argv.slice(2));
7
+ // A one-shot command exits (project rule 3). Once a download printed its answer and stayed alive for
8
+ // 30 minutes, --timeout or not, and it never happened again; if something is still open, name it and go.
9
+ const lingering = setTimeout(() => {
10
+ if (process.stdout.writableLength > 0) {
11
+ lingering.refresh();
12
+ return;
13
+ }
14
+ process.stderr.write(`tg: finished, but ${process.getActiveResourcesInfo().join(", ")} stayed open — exiting anyway\n`);
15
+ process.exit();
16
+ }, 5_000);
17
+ lingering.unref();
18
+ //# sourceMappingURL=tg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tg.js","sourceRoot":"","sources":["../../src/bin/tg.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAEpE,MAAM,YAAY,EAAE,CAAA;AACpB,mGAAmG;AACnG,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAA;AAC7C,OAAO,CAAC,QAAQ,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAEnD,qGAAqG;AACrG,yGAAyG;AACzG,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;IAChC,IAAI,OAAO,CAAC,MAAM,CAAC,cAAc,GAAG,CAAC,EAAE,CAAC;QACtC,SAAS,CAAC,OAAO,EAAE,CAAA;QACnB,OAAM;IACR,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,qBAAqB,OAAO,CAAC,sBAAsB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,iCAAiC,CAClG,CAAA;IACD,OAAO,CAAC,IAAI,EAAE,CAAA;AAChB,CAAC,EAAE,KAAK,CAAC,CAAA;AACT,SAAS,CAAC,KAAK,EAAE,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { BotAdapter } from "@wirecat/cli-messaging/cli";
2
+ import type { TelegramBotTransport } from "./transport.js";
3
+ /**
4
+ * A Telegram bot behind the shared bot port. Telegram's Bot API reads no history and no single
5
+ * message, so this adapter has neither `history` nor `message`: the shared commands answer those
6
+ * from the bot's own copy. Ids are at most 52 bits, so a number is exact; the port takes strings.
7
+ */
8
+ export declare const telegramBotAdapter: (transport: TelegramBotTransport) => BotAdapter;
9
+ //# sourceMappingURL=adapter.d.ts.map