@avemeva/agent-telegram 0.1.10 → 0.1.12
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.
- package/README.md +160 -0
- package/package.json +11 -9
- package/postinstall.mjs +12 -0
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# agent-telegram
|
|
2
|
+
|
|
3
|
+
Telegram CLI for AI agents. Read messages, send messages, search, download media, manage chats — all from the terminal. JSON output, designed for automation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### npm (all platforms)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @avemeva/agent-telegram
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Homebrew (macOS)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
brew install avemeva/tap/agent-telegram
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### curl (macOS/Linux)
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
curl -fsSL https://raw.githubusercontent.com/avemeva/kurier/main/install | bash
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Verify
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
agent-telegram --version
|
|
29
|
+
agent-telegram doctor
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Authentication
|
|
33
|
+
|
|
34
|
+
agent-telegram connects to your **real Telegram account** — it reads and sends actual messages, not a sandbox. Authenticate before first use:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
agent-telegram auth phone +1234567890 # Your phone number
|
|
38
|
+
agent-telegram auth code 12345 # Code from Telegram
|
|
39
|
+
agent-telegram auth password <pass> # 2FA password (if enabled)
|
|
40
|
+
agent-telegram me # Verify connection
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## How It Works
|
|
45
|
+
|
|
46
|
+
A background daemon manages the TDLib connection and auto-starts on first command. TDLib caches your chats, messages, and user data locally, so most reads are instant (~0.2s) without hitting Telegram's servers. The daemon shuts down after 10 minutes of inactivity.
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
agent-telegram me # Current user info
|
|
52
|
+
agent-telegram chats list --limit 10 # Recent chats
|
|
53
|
+
agent-telegram msg list @username --limit 5 # Message history
|
|
54
|
+
agent-telegram action send @username "hello" # Send a message
|
|
55
|
+
agent-telegram msg search "keyword" # Search across all chats
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Commands
|
|
59
|
+
|
|
60
|
+
### Identity
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
agent-telegram me # Current user info
|
|
64
|
+
agent-telegram info <id|username|phone|link> # Detailed entity info
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Chats
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
agent-telegram chats list [--limit N] [--unread] [--type user|group|channel]
|
|
71
|
+
agent-telegram chats search "query" [--type chat|bot|group|channel] [--global]
|
|
72
|
+
agent-telegram chats members <chat> [--limit N] [--type bot|admin|recent]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Messages
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
agent-telegram msg list <chat> [--limit N] [--filter photo|video|document|voice]
|
|
79
|
+
agent-telegram msg get <chat> <msgId>
|
|
80
|
+
agent-telegram msg search "query" [--chat <id>] [--type private|group|channel]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Actions
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
agent-telegram action send <chat> "text" [--html] [--md] [--reply-to N] [--silent]
|
|
87
|
+
agent-telegram action edit <chat> <msgId> "text" [--html]
|
|
88
|
+
agent-telegram action delete <chat> <msgId...> [--revoke]
|
|
89
|
+
agent-telegram action forward <from> <to> <msgId...>
|
|
90
|
+
agent-telegram action pin <chat> <msgId>
|
|
91
|
+
agent-telegram action react <chat> <msgId> <emoji>
|
|
92
|
+
agent-telegram action click <chat> <msgId> <button>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Media
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
agent-telegram media download <chat> <msgId> [--output path]
|
|
99
|
+
agent-telegram media transcribe <chat> <msgId>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Real-time Streaming
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
agent-telegram listen --type user # Stream events as NDJSON
|
|
106
|
+
agent-telegram listen --chat 12345 # Stream specific chat
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Daemon
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
agent-telegram daemon start | stop | status | log
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Auth
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
agent-telegram auth # Check auth state
|
|
119
|
+
agent-telegram auth phone <number> # Submit phone number
|
|
120
|
+
agent-telegram auth code <code> # Submit verification code
|
|
121
|
+
agent-telegram auth password <password> # Submit 2FA password
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Advanced
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
agent-telegram eval '<javascript>' # Run JS with connected TDLib client
|
|
128
|
+
agent-telegram doctor # Verify installation health
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Entity Arguments
|
|
132
|
+
|
|
133
|
+
All commands accepting `<chat>` support:
|
|
134
|
+
- Numeric ID: `12345678`, `-1001234567890`
|
|
135
|
+
- Username: `@username` or `username`
|
|
136
|
+
- Phone: `+1234567890`
|
|
137
|
+
- Link: `t.me/username`
|
|
138
|
+
- Special: `me` or `self`
|
|
139
|
+
|
|
140
|
+
## Output
|
|
141
|
+
|
|
142
|
+
All output is JSON to stdout. Errors and warnings go to stderr. Pipe through `jq` for processing:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
agent-telegram chats list --unread | jq '.[].title'
|
|
146
|
+
agent-telegram msg search "meeting" | jq '.messages[].content'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Pagination
|
|
150
|
+
|
|
151
|
+
List commands return `hasMore` and `nextOffset`. Pass the offset back to paginate:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
agent-telegram msg list <chat> --limit 50
|
|
155
|
+
agent-telegram msg list <chat> --limit 50 --offset-id <nextOffset>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avemeva/agent-telegram",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.12",
|
|
4
|
+
"description": "Telegram CLI for AI agents",
|
|
5
5
|
"bin": {
|
|
6
6
|
"agent-telegram": "./bin/agent-telegram.js"
|
|
7
7
|
},
|
|
@@ -9,15 +9,17 @@
|
|
|
9
9
|
"postinstall": "node ./postinstall.mjs"
|
|
10
10
|
},
|
|
11
11
|
"optionalDependencies": {
|
|
12
|
-
"@avemeva/agent-telegram-win32-x64": "0.1.
|
|
13
|
-
"@avemeva/agent-telegram-darwin-x64": "0.1.
|
|
14
|
-
"@avemeva/agent-telegram-linux-arm64": "0.1.
|
|
15
|
-
"@avemeva/agent-telegram-darwin-arm64": "0.1.
|
|
16
|
-
"@avemeva/agent-telegram-linux-x64": "0.1.
|
|
12
|
+
"@avemeva/agent-telegram-win32-x64": "0.1.12",
|
|
13
|
+
"@avemeva/agent-telegram-darwin-x64": "0.1.12",
|
|
14
|
+
"@avemeva/agent-telegram-linux-arm64": "0.1.12",
|
|
15
|
+
"@avemeva/agent-telegram-darwin-arm64": "0.1.12",
|
|
16
|
+
"@avemeva/agent-telegram-linux-x64": "0.1.12"
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "https://github.com/avemeva/kurier"
|
|
22
|
-
|
|
21
|
+
"url": "https://github.com/avemeva/kurier",
|
|
22
|
+
"directory": "apps/cli"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/avemeva/kurier/tree/main/apps/cli#readme"
|
|
23
25
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -65,6 +65,18 @@ try {
|
|
|
65
65
|
|
|
66
66
|
console.log(`tg: binary linked for ${platform}-${arch}`);
|
|
67
67
|
|
|
68
|
+
// Copy tdl.node prebuilds next to the hardlinked binary so node-gyp-build finds them
|
|
69
|
+
const prebuildsSrc = path.join(path.dirname(binaryPath), 'prebuilds');
|
|
70
|
+
if (fs.existsSync(prebuildsSrc)) {
|
|
71
|
+
const prebuildsTarget = path.join(binDir, 'prebuilds');
|
|
72
|
+
try {
|
|
73
|
+
fs.cpSync(prebuildsSrc, prebuildsTarget, { recursive: true });
|
|
74
|
+
console.log(`tg: tdl.node prebuilds installed`);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
console.log(`tg: could not copy prebuilds (${e.message})`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
68
80
|
// Copy libtdjson to ~/.local/lib/agent-telegram/ so the daemon can find it
|
|
69
81
|
const libSrcDir = path.join(path.dirname(binaryPath), '..', 'lib');
|
|
70
82
|
const tdjsonNames = { darwin: 'libtdjson.dylib', linux: 'libtdjson.so', win32: 'tdjson.dll' };
|