kiro-telegram-bot 1.5.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.
- package/.env.example +104 -0
- package/LICENSE +21 -0
- package/README.md +517 -0
- package/bin/kiro-tg.mjs +21 -0
- package/docs/INSTALL.md +143 -0
- package/docs/ops/RELEASE_CHECKLIST.md +39 -0
- package/package.json +70 -0
- package/scripts/mq.ts +25 -0
- package/scripts/setup.mjs +78 -0
- package/src/acp/client.ts +456 -0
- package/src/acp/server-handlers.ts +85 -0
- package/src/acp/transport.ts +50 -0
- package/src/acp/types.ts +136 -0
- package/src/agents/catalog.ts +44 -0
- package/src/app/json-store.ts +54 -0
- package/src/app/reasoning.ts +30 -0
- package/src/app/settings-store.ts +31 -0
- package/src/app/stt.ts +53 -0
- package/src/app/types.ts +48 -0
- package/src/app/usage.ts +32 -0
- package/src/bot/auth.ts +27 -0
- package/src/bot/bot.ts +154 -0
- package/src/bot/chat-controller.ts +251 -0
- package/src/bot/commands.ts +48 -0
- package/src/bot/deps.ts +47 -0
- package/src/bot/handlers/control.ts +94 -0
- package/src/bot/handlers/history.ts +58 -0
- package/src/bot/handlers/kill.ts +69 -0
- package/src/bot/handlers/mcp.ts +205 -0
- package/src/bot/handlers/menu.ts +204 -0
- package/src/bot/handlers/message.ts +93 -0
- package/src/bot/handlers/photo.ts +108 -0
- package/src/bot/handlers/projects.ts +83 -0
- package/src/bot/handlers/running.ts +104 -0
- package/src/bot/handlers/session-card.ts +65 -0
- package/src/bot/handlers/sessions.ts +131 -0
- package/src/bot/handlers/system.ts +51 -0
- package/src/bot/handlers/tasks.ts +223 -0
- package/src/bot/handlers/usage.ts +33 -0
- package/src/bot/handlers/voice.ts +53 -0
- package/src/bot/image-return.ts +69 -0
- package/src/bot/menu/keyboard.ts +47 -0
- package/src/bot/menu/refresh.ts +13 -0
- package/src/bot/menu/status-panel.ts +78 -0
- package/src/bot/permission-service.ts +149 -0
- package/src/bot/prompt-content.ts +49 -0
- package/src/bot/prompt-retry.ts +70 -0
- package/src/bot/registry.ts +178 -0
- package/src/bot/session-runtime.ts +670 -0
- package/src/bot/telegram-io.ts +109 -0
- package/src/bot/typing.ts +35 -0
- package/src/bot/wizard/task-wizard.ts +214 -0
- package/src/cli.ts +125 -0
- package/src/config.ts +190 -0
- package/src/index.ts +74 -0
- package/src/logger.ts +78 -0
- package/src/mcp/config.ts +103 -0
- package/src/mcp/probe.ts +218 -0
- package/src/mcp/types.ts +68 -0
- package/src/projects/manager.ts +88 -0
- package/src/render/chunk.ts +57 -0
- package/src/render/diff.ts +48 -0
- package/src/render/escape.ts +22 -0
- package/src/render/markdown.ts +126 -0
- package/src/render/subagent.ts +75 -0
- package/src/render/tool-call.ts +102 -0
- package/src/service/index.ts +24 -0
- package/src/service/linux.ts +83 -0
- package/src/service/macos.ts +91 -0
- package/src/service/platform.ts +59 -0
- package/src/service/types.ts +34 -0
- package/src/service/windows.ts +103 -0
- package/src/sessions/history.ts +181 -0
- package/src/sessions/store.ts +133 -0
- package/src/sessions/tail.ts +86 -0
- package/src/sessions/types.ts +26 -0
- package/src/stream/streamer.ts +167 -0
- package/src/tasks/runner.ts +82 -0
- package/src/tasks/schedule.ts +142 -0
- package/src/tasks/scheduler.ts +53 -0
- package/src/tasks/store.ts +80 -0
- package/src/tasks/types.ts +33 -0
- package/tsconfig.json +19 -0
package/.env.example
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
+
# Kiro Telegram Bot — configuration
|
|
3
|
+
# Copy this file to .env and fill in the values, or run: npm run setup
|
|
4
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
|
|
6
|
+
# REQUIRED — Telegram bot token from @BotFather (https://t.me/BotFather)
|
|
7
|
+
TELEGRAM_BOT_TOKEN=
|
|
8
|
+
|
|
9
|
+
# RECOMMENDED — comma-separated Telegram user IDs allowed to use the bot.
|
|
10
|
+
# Get yours from @userinfobot. If empty, ANYONE can use the bot (unsafe).
|
|
11
|
+
ALLOWED_USERS=
|
|
12
|
+
|
|
13
|
+
# Path to the kiro-cli binary. Leave blank to use "kiro-cli" from PATH.
|
|
14
|
+
# Windows example: C:\Users\you\AppData\Local\Kiro-Cli\kiro-cli.exe
|
|
15
|
+
KIRO_CLI_PATH=
|
|
16
|
+
|
|
17
|
+
# Default workspace directory used when you start without picking a project.
|
|
18
|
+
# Defaults to the current working directory.
|
|
19
|
+
KIRO_WORKSPACE=
|
|
20
|
+
|
|
21
|
+
# Optional custom Kiro agent name (from .kiro/agents/*.json).
|
|
22
|
+
# KIRO_AGENT=
|
|
23
|
+
|
|
24
|
+
# Pass --trust-all-tools to kiro-cli acp so tool calls run without prompts.
|
|
25
|
+
# Set to false to get inline Approve/Deny buttons in Telegram before Kiro runs
|
|
26
|
+
# risky tools (file writes, shell commands).
|
|
27
|
+
KIRO_TRUST_ALL_TOOLS=true
|
|
28
|
+
|
|
29
|
+
# Comma-separated roots the /projects browser is allowed to list.
|
|
30
|
+
# Supports ~ for home directory. Defaults to KIRO_WORKSPACE's parent + home.
|
|
31
|
+
# Example: H:\Lucru\Domains,C:\Lucru\Domains
|
|
32
|
+
PROJECT_ROOTS=
|
|
33
|
+
|
|
34
|
+
# ── Rendering / streaming ────────────────────────────────────────────────────
|
|
35
|
+
# How often (ms) to edit the streaming message while the agent is typing.
|
|
36
|
+
# The whole turn is combined into one message and edited at most this often
|
|
37
|
+
# (keeps under Telegram's ~1 msg/sec limit and prevents spam / 429s).
|
|
38
|
+
STREAM_THROTTLE_MS=1500
|
|
39
|
+
|
|
40
|
+
# Coalesce rapid consecutive text messages into a single prompt. A long message
|
|
41
|
+
# that Telegram splits at 4096 chars arrives as several parts back-to-back;
|
|
42
|
+
# within this window they're combined into one prompt (one submission, one
|
|
43
|
+
# confirmation) instead of separate queued turns. 0 = disable (send each).
|
|
44
|
+
MESSAGE_BATCH_MS=800
|
|
45
|
+
|
|
46
|
+
# Show tool-call status messages (file reads/writes, commands). true/false
|
|
47
|
+
SHOW_TOOL_CALLS=true
|
|
48
|
+
|
|
49
|
+
# Show unified diffs for file edits. true/false
|
|
50
|
+
SHOW_EDIT_DIFFS=true
|
|
51
|
+
|
|
52
|
+
# Max lines of a diff to show inline before truncating.
|
|
53
|
+
DIFF_MAX_LINES=120
|
|
54
|
+
|
|
55
|
+
# Send images the agent produces this turn (screenshots, diagrams) back to
|
|
56
|
+
# Telegram automatically. true/false, and a per-turn cap.
|
|
57
|
+
SEND_AGENT_IMAGES=true
|
|
58
|
+
AGENT_IMAGES_MAX=8
|
|
59
|
+
|
|
60
|
+
# Show subagent ("crew") activity while the main agent waits on its subagents,
|
|
61
|
+
# so the chat isn't silent during delegated/parallel work. true/false
|
|
62
|
+
SHOW_SUBAGENTS=true
|
|
63
|
+
|
|
64
|
+
# ── MCP servers (/mcp) ───────────────────────────────────────────────────────
|
|
65
|
+
# /mcp lists configured MCP servers, toggles them on/off, and runs a live
|
|
66
|
+
# health-check (a real MCP `initialize` handshake) against each enabled server.
|
|
67
|
+
# Per-server probe timeout (ms) and how many probes run at once. Slow stdio
|
|
68
|
+
# servers (heavy cold starts) may show as a timeout — raise this if needed.
|
|
69
|
+
# MCP_PROBE_TIMEOUT_MS=8000
|
|
70
|
+
# MCP_PROBE_CONCURRENCY=6
|
|
71
|
+
|
|
72
|
+
# Log level: debug | info | warn | error
|
|
73
|
+
LOG_LEVEL=info
|
|
74
|
+
|
|
75
|
+
# ── Daemon / background service ──────────────────────────────────────────────
|
|
76
|
+
# Auto-restart the Kiro agent with backoff if it exits (recommended for 24/7).
|
|
77
|
+
ACP_AUTO_RESTART=true
|
|
78
|
+
|
|
79
|
+
# Quiet mode (default true): send all messages silently (no notification sound),
|
|
80
|
+
# EXCEPT turn completions, task results, and permission prompts which still ring.
|
|
81
|
+
QUIET_NOTIFICATIONS=true
|
|
82
|
+
|
|
83
|
+
# Give up on a running turn only after this many ms with NO streaming activity
|
|
84
|
+
# (long, actively-streaming turns never time out). Default 900000 = 15 min.
|
|
85
|
+
# PROMPT_IDLE_TIMEOUT_MS=900000
|
|
86
|
+
|
|
87
|
+
# Auto-retry a prompt up to N times when the agent returns a transient error
|
|
88
|
+
# (e.g. "high volume of traffic" / -32603 "Internal error") *before any output
|
|
89
|
+
# streamed*, with exponential backoff: 6s, 12s, 24s, 48s, capped at 60s. The
|
|
90
|
+
# real error is shown on every attempt; a summary is shown after the last. 0 = off.
|
|
91
|
+
# PROMPT_RETRY_ATTEMPTS=5
|
|
92
|
+
|
|
93
|
+
# Where to write the log file. Defaults to <project>/logs/kiro-telegram-bot.log
|
|
94
|
+
# LOG_DIR=
|
|
95
|
+
# LOG_FILE=
|
|
96
|
+
|
|
97
|
+
# ── Voice messages (speech-to-text) ──────────────────────────────────────────
|
|
98
|
+
# Point at any OpenAI/Whisper-compatible transcription endpoint to enable voice
|
|
99
|
+
# notes. Leave STT_LANGUAGE blank for automatic language detection (works for
|
|
100
|
+
# English, Russian, Romanian/Moldovan, and ~100 more).
|
|
101
|
+
# STT_API_URL=https://api.openai.com/v1
|
|
102
|
+
# STT_API_KEY=
|
|
103
|
+
# STT_MODEL=whisper-1
|
|
104
|
+
# STT_LANGUAGE=
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kiro Telegram Bot contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
# Kiro Telegram Bot 🤖
|
|
2
|
+
|
|
3
|
+
> **Control [Kiro CLI](https://kiro.dev/cli/) from Telegram.** Your AI coding
|
|
4
|
+
> assistant in your pocket — switch projects, resume and attach to live coding
|
|
5
|
+
> sessions, stream answers with diffs, queue follow-ups, and run it 24/7 as a
|
|
6
|
+
> background service on Windows, Linux, and macOS.
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
A professional Telegram bridge for the **Agent Client Protocol (ACP)** that
|
|
14
|
+
turns Kiro CLI into a mobile, always-on AI pair programmer. Send a message from
|
|
15
|
+
anywhere and watch Kiro read files, run commands, and edit code on your machine
|
|
16
|
+
— with live typing indicators, clean Telegram markdown, and unified edit diffs.
|
|
17
|
+
|
|
18
|
+
Inspired by [`ajitnk-lab/kiro-acp-telegram-bot`](https://github.com/ajitnk-lab/kiro-acp-telegram-bot)
|
|
19
|
+
and extended into a full multi-session client.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## ✨ Features
|
|
24
|
+
|
|
25
|
+
| Capability | What it does |
|
|
26
|
+
|---|---|
|
|
27
|
+
| 🗂 **Projects** | `/projects` browses your folders and runs Kiro in the one you pick. |
|
|
28
|
+
| ♻️ **Resume sessions** | `/sessions` lists recent Kiro sessions; tap to resume via ACP `session/load`. |
|
|
29
|
+
| 🟢 **Connect to live sessions** | `/active` shows sessions running **right now** on your PC. Watch them live, or continue them — see below. |
|
|
30
|
+
| 📡 **Live watch** | Follow a running session read-only in real time (tails its event log). |
|
|
31
|
+
| 🧭 **Always-visible menu** | A persistent keyboard plus a pinned status panel that always shows your current **project, agent, reasoning effort, model, session and queue**. |
|
|
32
|
+
| ⏰ **Scheduled tasks** | Create prompts that run on a schedule (once / daily / weekly / monthly / every-N-minutes) in a chosen project, delivered back to your chat. |
|
|
33
|
+
| 🖼 **Multi-image prompts** | Send one or many photos (albums included) with a caption — all attached to the prompt for the agent to analyze. |
|
|
34
|
+
| 📜 **History** | `/history` shows the latest messages of any session. |
|
|
35
|
+
| 🧩 **MCP control** | `/mcp` lists MCP servers, **health-checks** them (which connected / failed and why), and **enables/disables** them — then restarts the agent to apply. |
|
|
36
|
+
| 👥 **Subagent visibility** | When Kiro delegates to subagents and waits on them, you see each one **start / work / finish** plus a live `🤖 N running` summary — and subagent permission prompts route to your chat. |
|
|
37
|
+
| ⌨️ **Typing indicator** | Stays on for the whole turn, even through long tool chains. |
|
|
38
|
+
| 📥 **Queued follow-ups** | Message while Kiro is busy — it's queued and runs next. `/btw` queues explicitly; `/flush` runs now. |
|
|
39
|
+
| ✏️ **Edit diffs** | File edits show as unified `diff` blocks with `+N -M` stats. |
|
|
40
|
+
| 💬 **Quality markdown** | Converts agent markdown to Telegram **MarkdownV2** with safe escaping and code-fence-aware splitting. |
|
|
41
|
+
| 🔁 **Self-healing** | Auto-restarts the Kiro agent with backoff and re-binds your session. |
|
|
42
|
+
| 🖥 **Runs 24/7** | 1-click install as a background service that starts on boot — Windows, Linux, macOS, auto-detected. |
|
|
43
|
+
| 🔒 **Access control** | Restrict to specific Telegram user IDs. |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 📊 How it compares
|
|
48
|
+
|
|
49
|
+
| Capability | **This bot** | Other Kiro Telegram bots |
|
|
50
|
+
|---|:---:|:---:|
|
|
51
|
+
| Connect Kiro CLI to Telegram (ACP) | ✅ | ✅ |
|
|
52
|
+
| Switch between projects | ✅ | ❌ |
|
|
53
|
+
| Resume saved sessions | ✅ | ❌ |
|
|
54
|
+
| Attach to **live** PC sessions (watch / fork) | ✅ | ❌ |
|
|
55
|
+
| Multiple isolated sessions | ✅ | ❌ (single shared) |
|
|
56
|
+
| Queued follow-ups while busy | ✅ | ❌ |
|
|
57
|
+
| **Scheduled tasks** (cron-like) | ✅ | ❌ |
|
|
58
|
+
| **Multi-image** prompts (albums) | ✅ | ❌ |
|
|
59
|
+
| Unified **edit diffs** | ✅ | ❌ |
|
|
60
|
+
| Persistent menu + live status panel | ✅ | ❌ |
|
|
61
|
+
| Agent / reasoning / model menus | ✅ | ❌ |
|
|
62
|
+
| Combined, throttled output (no spam) | ✅ | ❌ |
|
|
63
|
+
| Auto-restart + session re-bind | ✅ | ❌ |
|
|
64
|
+
| 24/7 cross-platform service | ✅ | ❌ |
|
|
65
|
+
| 1-click install | ✅ | ❌ |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## ⚡ Install from npm
|
|
70
|
+
|
|
71
|
+
The fastest way — one command installs the global **`kiro-tg`** CLI (ships with
|
|
72
|
+
the `tsx` runtime, no build step):
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install -g kiro-telegram-bot
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Everything operates on the **current folder** (its `.env`, `logs/`, `data/`), so
|
|
79
|
+
keep one folder per bot:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
mkdir my-bot && cd my-bot
|
|
83
|
+
kiro-tg setup # auto-detects kiro-cli, writes ./.env
|
|
84
|
+
# edit .env: set TELEGRAM_BOT_TOKEN and ALLOWED_USERS
|
|
85
|
+
kiro-tg run # foreground …
|
|
86
|
+
kiro-tg install # … or install as a 24/7 background service
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Startup options: `kiro-tg setup | run | install | status | logs [n] | stop |
|
|
90
|
+
restart | uninstall`. Or try it without installing: `npx kiro-telegram-bot
|
|
91
|
+
setup`. See **[docs/INSTALL.md](./docs/INSTALL.md)** for the full guide.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 🚀 1-click install
|
|
96
|
+
|
|
97
|
+
Clone or download, then run the installer for your OS. It installs
|
|
98
|
+
dependencies, auto-detects `kiro-cli`, writes `.env`, asks for your bot token,
|
|
99
|
+
and optionally sets up the background service.
|
|
100
|
+
|
|
101
|
+
**Windows** — double-click `install.cmd` (or in a terminal):
|
|
102
|
+
|
|
103
|
+
```powershell
|
|
104
|
+
.\install.cmd
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Linux / macOS**:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
chmod +x install.sh && ./install.sh
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Prerequisites
|
|
114
|
+
|
|
115
|
+
- **Kiro CLI** installed and authenticated — run `kiro-cli chat` once to confirm.
|
|
116
|
+
- **Node.js 20+**.
|
|
117
|
+
- A **bot token** from [@BotFather](https://t.me/BotFather).
|
|
118
|
+
- Your **Telegram user ID** from [@userinfobot](https://t.me/userinfobot).
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 🧑💻 Manual setup
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npm install
|
|
126
|
+
npm run setup # auto-detects kiro-cli + project roots, writes .env
|
|
127
|
+
# edit .env: set TELEGRAM_BOT_TOKEN and ALLOWED_USERS
|
|
128
|
+
npm start
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
No build step — TypeScript runs directly via `tsx`.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 🛠 Run as a background service (daemon)
|
|
136
|
+
|
|
137
|
+
The bot installs as a **user-level** service that starts automatically on boot.
|
|
138
|
+
The platform is auto-detected:
|
|
139
|
+
|
|
140
|
+
| OS | Mechanism | Starts on |
|
|
141
|
+
|---|---|---|
|
|
142
|
+
| Windows | Hidden Scheduled Task | logon |
|
|
143
|
+
| Linux | systemd **user** service (+ linger) | boot |
|
|
144
|
+
| macOS | launchd LaunchAgent | login |
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npm run install:service # install + start, enable autostart
|
|
148
|
+
npm run service -- status # show install + running state
|
|
149
|
+
npm run service -- stop
|
|
150
|
+
npm run service -- restart
|
|
151
|
+
npm run service -- logs 200 # tail the log file
|
|
152
|
+
npm run uninstall:service # stop + remove
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Or use the `kiro-tg` command (if linked): `kiro-tg install | status | logs`.
|
|
156
|
+
|
|
157
|
+
Logs are written to `logs/kiro-telegram-bot.log` (rotated at 5 MB).
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## 💬 Commands
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
/menu Show the persistent menu keyboard
|
|
165
|
+
/projects List projects · /projects <q> search · /projects new <name>
|
|
166
|
+
/sessions List & resume sessions (active first) · /sessions <q> to filter
|
|
167
|
+
/active Sessions running now on the PC
|
|
168
|
+
/running Sessions this chat controls — switch between them
|
|
169
|
+
/killall Kill all active sessions on the PC (with confirm)
|
|
170
|
+
/mcp Inspect MCP servers · health-check · enable/disable
|
|
171
|
+
/tasks Manage scheduled tasks
|
|
172
|
+
/newtask Create a scheduled task (wizard)
|
|
173
|
+
/history Show recent conversation history
|
|
174
|
+
/new Start a fresh session here
|
|
175
|
+
/status Current session, project & queue
|
|
176
|
+
/usage Account info & current context usage
|
|
177
|
+
/btw <text> Queue a follow-up to run after the current task
|
|
178
|
+
/flush Send queued follow-ups now
|
|
179
|
+
/queue Show queued follow-ups
|
|
180
|
+
/clearqueue Clear the queue
|
|
181
|
+
/cancel Stop the current turn
|
|
182
|
+
/unwatch Stop following a live session
|
|
183
|
+
/model <id> Switch the model for this session
|
|
184
|
+
/restart Restart the Kiro agent
|
|
185
|
+
/help Show help
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Anything that isn't a command is sent to Kiro as a prompt. While a turn is
|
|
189
|
+
running, your messages are queued and sent automatically when it finishes.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 🧭 The menu & status panel
|
|
194
|
+
|
|
195
|
+
A tiny **persistent bar** sits under the message box — **☰ Menu · 🧭 Running ·
|
|
196
|
+
⏹ Stop** — so common actions are one tap away without clutter. Tap **☰ Menu**
|
|
197
|
+
(or `/menu`) to open a clean, grouped **inline menu**: Project · New · Running ·
|
|
198
|
+
Sessions · Agent · Model · Reasoning · Tasks · Status · Usage · Stop · Kill all.
|
|
199
|
+
The bar can be hidden (🙈) and restored (⌨️ Show bar or `/menu`).
|
|
200
|
+
|
|
201
|
+
A **pinned status panel** at the top of the chat always shows your current
|
|
202
|
+
**project, agent, reasoning effort, model, session id, context %, activity and
|
|
203
|
+
queue** (and how many sessions the chat controls), updating live. Pick **Agent**,
|
|
204
|
+
**Reasoning** or **Model** from the inline menu (reasoning steers how thoroughly
|
|
205
|
+
the agent works: Minimal → Max).
|
|
206
|
+
|
|
207
|
+
## ⏰ Scheduled tasks
|
|
208
|
+
|
|
209
|
+
A task is a **prompt + a project + a schedule**. When it fires, the bot opens a
|
|
210
|
+
session in that project, runs the prompt, and delivers the result to your chat.
|
|
211
|
+
|
|
212
|
+
- **/newtask** (or the ➕ button) launches a guided wizard: name → prompt →
|
|
213
|
+
project → schedule → confirm.
|
|
214
|
+
- **Schedules**: `once` at a date/time, `daily` at HH:MM, `weekly` (e.g. `Mon 09:00`),
|
|
215
|
+
`monthly` (e.g. `15 09:00`), or `interval` (every N minutes).
|
|
216
|
+
- **/tasks** lists everything with buttons to **run now, enable/disable, edit**
|
|
217
|
+
(rename, prompt, project, reschedule) and **delete**.
|
|
218
|
+
|
|
219
|
+
Tasks are stored in `data/tasks.json` and survive restarts; the scheduler runs
|
|
220
|
+
them whether you're online or not (great with the 24/7 service).
|
|
221
|
+
|
|
222
|
+
## 🖼 Sending images
|
|
223
|
+
|
|
224
|
+
Send one or several photos — including a Telegram **album** — with an optional
|
|
225
|
+
caption. The bot downloads them and attaches them all to the prompt as image
|
|
226
|
+
content blocks, so the agent can analyze them together. Images sent while Kiro
|
|
227
|
+
is busy are queued with your next turn.
|
|
228
|
+
|
|
229
|
+
**Images come back too:** when the agent produces images during a turn (e.g.
|
|
230
|
+
takes screenshots while testing an app), the bot detects the freshly-written
|
|
231
|
+
files and sends them back to Telegram automatically (`SEND_AGENT_IMAGES`).
|
|
232
|
+
|
|
233
|
+
## 🎙 Sending voice
|
|
234
|
+
|
|
235
|
+
Send a voice note (or audio file) and the bot transcribes it and runs it as a
|
|
236
|
+
prompt. Configure any OpenAI/Whisper-compatible endpoint via `STT_API_URL` in
|
|
237
|
+
`.env`; leave `STT_LANGUAGE` blank for automatic detection (English, Russian,
|
|
238
|
+
Romanian/Moldovan, and ~100 more).
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 🧭 Working on several sessions at once
|
|
243
|
+
|
|
244
|
+
One chat can drive **multiple Kiro sessions** and switch between them. Start a
|
|
245
|
+
session (📁 Project / 🆕 New), and each becomes a "controlled" session. Tap
|
|
246
|
+
**🧭 Running** (or `/running`) to switch: the foreground session streams live
|
|
247
|
+
while the others keep working quietly. When you switch to a session you see its
|
|
248
|
+
recent context and **every message that arrived while you were away** (its
|
|
249
|
+
unread, recovered from the session log). Leave a task running in A, hop to B,
|
|
250
|
+
reply, and come back to A to read what it did. Close a session with ✖ (it isn't
|
|
251
|
+
killed — see `/killall` for that).
|
|
252
|
+
|
|
253
|
+
## 🔗 Connecting to live sessions
|
|
254
|
+
|
|
255
|
+
Kiro keeps an **exclusive lock** on a session while it's running, so a second
|
|
256
|
+
client cannot hijack a session that's open in another window. This bot handles
|
|
257
|
+
that honestly:
|
|
258
|
+
|
|
259
|
+
- **📡 Watch** — follow the running session's output live (read-only) by tailing
|
|
260
|
+
its event log. Stop with `/unwatch`.
|
|
261
|
+
- **Continue (fork)** — tapping a live session opens a **linked continuation** in
|
|
262
|
+
the same project, primed with the recent transcript, so you can keep
|
|
263
|
+
interacting from Telegram without disturbing the original.
|
|
264
|
+
|
|
265
|
+
Resuming an **idle** session loads it directly so you continue the exact thread.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## ⚙️ Configuration (`.env`)
|
|
270
|
+
|
|
271
|
+
| Variable | Required | Default | Description |
|
|
272
|
+
|---|---|---|---|
|
|
273
|
+
| `TELEGRAM_BOT_TOKEN` | **yes** | — | Bot token from @BotFather. |
|
|
274
|
+
| `ALLOWED_USERS` | recommended | *(all)* | Comma-separated Telegram user IDs. Empty = anyone (unsafe). |
|
|
275
|
+
| `KIRO_CLI_PATH` | no | auto / `kiro-cli` | Path to the `kiro-cli` binary. |
|
|
276
|
+
| `KIRO_WORKSPACE` | no | cwd | Default working directory. |
|
|
277
|
+
| `KIRO_AGENT` | no | — | Custom agent from `.kiro/agents/`. |
|
|
278
|
+
| `KIRO_TRUST_ALL_TOOLS` | no | `true` | Run tools without prompts. |
|
|
279
|
+
| `PROJECT_ROOTS` | no | workspace parent + home | Roots for `/projects`. |
|
|
280
|
+
| `STREAM_THROTTLE_MS` | no | `1200` | Live-edit interval while streaming. |
|
|
281
|
+
| `MESSAGE_BATCH_MS` | no | `800` | Window to coalesce rapid text messages (e.g. a long message Telegram split at 4096 chars) into one prompt. `0` disables. |
|
|
282
|
+
| `SHOW_TOOL_CALLS` | no | `true` | Show tool-call status messages. |
|
|
283
|
+
| `SHOW_EDIT_DIFFS` | no | `true` | Show unified diffs for edits. |
|
|
284
|
+
| `DIFF_MAX_LINES` | no | `120` | Max diff lines shown inline. |
|
|
285
|
+
| `SHOW_SUBAGENTS` | no | `true` | Stream subagent (crew) start/work/finish while the main agent waits. |
|
|
286
|
+
| `MCP_PROBE_TIMEOUT_MS` | no | `8000` | Per-server timeout for the `/mcp` live health-check. |
|
|
287
|
+
| `MCP_PROBE_CONCURRENCY` | no | `6` | How many MCP health probes run at once. |
|
|
288
|
+
| `ACP_AUTO_RESTART` | no | `true` | Auto-restart the agent if it exits. |
|
|
289
|
+
| `PROMPT_RETRY_ATTEMPTS` | no | `5` | Max retries for a transient agent error (e.g. high-traffic / `Internal error`) before any output streamed, with `6s → 12s → 24s → 48s → 60s` backoff. The real error shows each attempt; a summary after the last. `0` disables. |
|
|
290
|
+
| `LOG_LEVEL` | no | `info` | `debug` \| `info` \| `warn` \| `error`. |
|
|
291
|
+
| `LOG_DIR` / `LOG_FILE` | no | `<project>/logs/…` | Log location. |
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 🧩 How it works
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
Telegram ──HTTPS──▶ Bot (grammY)
|
|
299
|
+
│ spawns once
|
|
300
|
+
▼
|
|
301
|
+
kiro-cli acp ◀── JSON-RPC 2.0 over stdio ──▶ Bot
|
|
302
|
+
│
|
|
303
|
+
├─ session/new / session/load (projects, resume)
|
|
304
|
+
├─ session/prompt (your messages)
|
|
305
|
+
└─ session/update notifications (streamed text, tools)
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
One `kiro-cli acp` process multiplexes many sessions (one per chat/project).
|
|
309
|
+
Streamed `agent_message_chunk` updates are assembled into a live, throttled
|
|
310
|
+
message; `tool_call` updates render as professional status lines with diffs.
|
|
311
|
+
|
|
312
|
+
Kiro persists sessions to `~/.kiro/sessions/cli/`:
|
|
313
|
+
`<id>.json` (metadata), `<id>.jsonl` (history, used by `/history` and live
|
|
314
|
+
watch), and `<id>.lock` (`{ pid }`, used to detect active sessions).
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## 📁 Project layout
|
|
319
|
+
|
|
320
|
+
```
|
|
321
|
+
src/
|
|
322
|
+
├── index.ts Entry point, daemon-friendly logging, shutdown
|
|
323
|
+
├── cli.ts CLI: run / install / start / stop / status / logs
|
|
324
|
+
├── config.ts .env loading, paths, daemon options
|
|
325
|
+
├── logger.ts Leveled logger with file output
|
|
326
|
+
├── acp/ ACP client, transport, server-side handlers, types
|
|
327
|
+
├── sessions/ Session discovery, history parser, live tail watcher
|
|
328
|
+
├── projects/ Project directory discovery
|
|
329
|
+
├── mcp/ MCP config (list/toggle) + live health probe
|
|
330
|
+
├── render/ Markdown→MarkdownV2, diffs, tool formatting, chunking
|
|
331
|
+
├── stream/ Incremental edit-streaming
|
|
332
|
+
├── service/ Cross-platform daemon (windows/linux/macos + selector)
|
|
333
|
+
└── bot/ grammY bot, per-chat runtime, handlers
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## ❓ FAQ
|
|
339
|
+
|
|
340
|
+
**Can I run the Kiro Telegram bot 24/7 on a server?** Yes — `npm run install:service`
|
|
341
|
+
installs a user-level service (systemd/launchd/Scheduled Task) that starts on
|
|
342
|
+
boot and auto-restarts on crash.
|
|
343
|
+
|
|
344
|
+
**How do I control Kiro from my phone?** Set up the bot, message it on Telegram,
|
|
345
|
+
and pick a project with `/projects`. Every message becomes a Kiro prompt.
|
|
346
|
+
|
|
347
|
+
**Can multiple people use one bot?** Add their IDs to `ALLOWED_USERS`. Each chat
|
|
348
|
+
gets its own session.
|
|
349
|
+
|
|
350
|
+
**Why can't I take over a session that's already running?** Kiro locks active
|
|
351
|
+
sessions exclusively. The bot lets you **watch** it live or **fork** a linked
|
|
352
|
+
continuation instead. See "Connecting to live sessions".
|
|
353
|
+
|
|
354
|
+
**Does it support custom agents and MCP servers?** Yes — set `KIRO_AGENT`, and
|
|
355
|
+
the bot inherits whatever MCP servers Kiro CLI is configured with.
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## 🔐 Inline approvals
|
|
360
|
+
|
|
361
|
+
The bot implements ACP `session/request_permission`: when Kiro asks the client
|
|
362
|
+
to approve a risky tool call, it appears in Telegram with **Approve / Approve
|
|
363
|
+
always / Deny** buttons and your choice is sent back (unanswered prompts time
|
|
364
|
+
out and are denied).
|
|
365
|
+
|
|
366
|
+
> Note: Kiro CLI 2.8.1 resolves tool permissions internally (via
|
|
367
|
+
> `~/.kiro/settings/permissions.yaml` and agent config) and does **not** yet
|
|
368
|
+
> delegate them over ACP, so these prompts stay dormant on current Kiro. The
|
|
369
|
+
> wiring is forward-compatible and activates automatically when Kiro emits
|
|
370
|
+
> permission requests. Today, use the live tool stream + **⏹ Stop** to
|
|
371
|
+
> intervene, and `permissions.yaml` to govern what Kiro may do.
|
|
372
|
+
|
|
373
|
+
## 🔐 Security
|
|
374
|
+
|
|
375
|
+
This bot lets authorized Telegram users run commands and edit files on the host.
|
|
376
|
+
**Always set `ALLOWED_USERS`**, keep `.env` private, and run as a non-privileged
|
|
377
|
+
user. See [SECURITY.md](./SECURITY.md) for the full model.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## 🗺 Roadmap
|
|
382
|
+
|
|
383
|
+
- [x] Projects, resume & attach to live sessions
|
|
384
|
+
- [x] Queued follow-ups, edit diffs, quality MarkdownV2
|
|
385
|
+
- [x] Persistent menu + live status panel (project / agent / reasoning / model)
|
|
386
|
+
- [x] Scheduled tasks (once / daily / weekly / monthly / interval)
|
|
387
|
+
- [x] Multi-image prompts (albums)
|
|
388
|
+
- [x] Combined, throttled output (anti-spam)
|
|
389
|
+
- [x] 24/7 cross-platform background service
|
|
390
|
+
- [x] Voice messages → speech-to-text → prompt (multi-language)
|
|
391
|
+
- [x] Context-usage % in the status panel
|
|
392
|
+
- [x] Inline approvals — approve/deny risky tools from buttons (non trust-all mode)
|
|
393
|
+
- [x] Account & context usage (`/usage`)
|
|
394
|
+
- [x] Release automation — downloadable zip + CHANGELOG-driven notes on tag push
|
|
395
|
+
- [x] README community sections — Contributors, Top Contributors, Stars, StarMapper
|
|
396
|
+
- [ ] **Token & cost meter** — per-session token counts and an estimated spend tally
|
|
397
|
+
- [ ] **Text-to-speech replies** — optionally speak answers back as voice notes
|
|
398
|
+
- [ ] **Scheduled-task chaining & conditions** — run task B after A, or only if a command/file check passes
|
|
399
|
+
- [ ] **Team mode** — multiple authorized users with per-user sessions, roles, and an audit log
|
|
400
|
+
- [ ] Localized bot UI (i18n)
|
|
401
|
+
- [ ] Docker image with `kiro-cli` preinstalled
|
|
402
|
+
- [ ] Webhook mode for serverless deployment
|
|
403
|
+
|
|
404
|
+
Have an idea? Open a [feature request](../../issues/new/choose).
|
|
405
|
+
|
|
406
|
+
## 🤝 Contributing
|
|
407
|
+
|
|
408
|
+
Contributions are very welcome! See **[CONTRIBUTING.md](./CONTRIBUTING.md)** to get
|
|
409
|
+
started — no build step is required (`npm run dev`), and `npm run typecheck` must
|
|
410
|
+
pass.
|
|
411
|
+
|
|
412
|
+
New here? Look for issues labeled
|
|
413
|
+
[**good first issue**](../../issues?q=is%3Aopen+label%3A%22good+first+issue%22)
|
|
414
|
+
and [**help wanted**](../../issues?q=is%3Aopen+label%3A%22help+wanted%22).
|
|
415
|
+
|
|
416
|
+
By participating you agree to the [Code of Conduct](./CODE_OF_CONDUCT.md).
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## 👥 Contributors
|
|
421
|
+
|
|
422
|
+
[](https://github.com/artickc/kiro-telegram-bot/graphs/contributors)
|
|
423
|
+
|
|
424
|
+
### How to Contribute
|
|
425
|
+
|
|
426
|
+
1. Fork the repository
|
|
427
|
+
2. Create your feature branch (`git checkout -b feat/amazing-feature`)
|
|
428
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
429
|
+
4. Push to the branch (`git push origin feat/amazing-feature`)
|
|
430
|
+
5. Open a Pull Request
|
|
431
|
+
|
|
432
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines.
|
|
433
|
+
|
|
434
|
+
### Releasing a New Version
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
# Bump the version, update CHANGELOG.md, then push a tag.
|
|
438
|
+
# The release workflow builds a downloadable zip and publishes notes automatically.
|
|
439
|
+
npm version minor # or: patch / major — updates package.json + commits
|
|
440
|
+
git push --follow-tags # pushing the v* tag triggers .github/workflows/release.yml
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## ⭐ Top Contributors
|
|
446
|
+
|
|
447
|
+
> This project is built and maintained in the open. These people have made the
|
|
448
|
+
> contributions that shape its quality, stability, and reach. **Thank you.**
|
|
449
|
+
|
|
450
|
+
<table>
|
|
451
|
+
<tr>
|
|
452
|
+
<td align="center" width="180">
|
|
453
|
+
<a href="https://github.com/artickc">
|
|
454
|
+
<img src="https://github.com/artickc.png?size=100" width="80" height="80" style="border-radius:50%" alt="artickc"/><br/>
|
|
455
|
+
<sub><b>artickc</b></sub>
|
|
456
|
+
</a><br/>
|
|
457
|
+
🥇 Maintainer<br/>
|
|
458
|
+
<sub>Created the bot: ACP client, multi-session<br/>runtime, scheduler, daemon & renderer</sub>
|
|
459
|
+
</td>
|
|
460
|
+
</tr>
|
|
461
|
+
</table>
|
|
462
|
+
|
|
463
|
+
> 🙏 Every pull request, bug report, and idea matters. Open source is built by
|
|
464
|
+
> people like them — see the full list under [Contributors](#-contributors).
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
## 📊 Stars
|
|
469
|
+
|
|
470
|
+
<a href="https://www.star-history.com/?repos=artickc%2Fkiro-telegram-bot&type=date&legend=top-left">
|
|
471
|
+
<picture>
|
|
472
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=artickc/kiro-telegram-bot&type=Date&theme=dark&legend=top-left" />
|
|
473
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=artickc/kiro-telegram-bot&type=Date&legend=top-left" />
|
|
474
|
+
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=artickc/kiro-telegram-bot&type=Date&legend=top-left" />
|
|
475
|
+
</picture>
|
|
476
|
+
</a>
|
|
477
|
+
|
|
478
|
+
If this project helps you, please consider giving it a ⭐ — it really helps!
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
## 🌍 StarMapper
|
|
483
|
+
|
|
484
|
+
> See where in the world this project's stargazers live — an interactive map of
|
|
485
|
+
> the community.
|
|
486
|
+
|
|
487
|
+
<a href="https://starmapper.bruniaux.com/artickc/kiro-telegram-bot">
|
|
488
|
+
<picture>
|
|
489
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://starmapper.bruniaux.com/api/map-image/artickc/kiro-telegram-bot?theme=dark" />
|
|
490
|
+
<source media="(prefers-color-scheme: light)" srcset="https://starmapper.bruniaux.com/api/map-image/artickc/kiro-telegram-bot?theme=light" />
|
|
491
|
+
<img alt="StarMapper — where this project's stargazers live" src="https://starmapper.bruniaux.com/api/map-image/artickc/kiro-telegram-bot" />
|
|
492
|
+
</picture>
|
|
493
|
+
</a>
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
## 📦 Download & Releases
|
|
498
|
+
|
|
499
|
+
Grab the latest packaged build from the
|
|
500
|
+
[**Releases**](https://github.com/artickc/kiro-telegram-bot/releases) page — each
|
|
501
|
+
release ships a clean `kiro-telegram-bot-<version>.zip` (no `node_modules` or
|
|
502
|
+
secrets) plus GitHub's source archives. See [CHANGELOG.md](./CHANGELOG.md) for
|
|
503
|
+
what changed in each version, and **[docs/INSTALL.md](./docs/INSTALL.md)** for the
|
|
504
|
+
full 1-click install guide.
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## 📄 License
|
|
509
|
+
|
|
510
|
+
[MIT](./LICENSE) — see also [CONTRIBUTING](./CONTRIBUTING.md) and
|
|
511
|
+
[Code of Conduct](./CODE_OF_CONDUCT.md).
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
<sub>Keywords: Kiro CLI Telegram bot, ACP Agent Client Protocol, AI coding
|
|
516
|
+
assistant on Telegram, mobile AI pair programming, remote coding agent, run AI
|
|
517
|
+
agent as a service, Windows/Linux/macOS daemon, ChatOps for developers.</sub>
|
package/bin/kiro-tg.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `kiro-tg` launcher — runs the TypeScript CLI through the tsx loader so the
|
|
4
|
+
* project needs no build step.
|
|
5
|
+
*/
|
|
6
|
+
import { spawnSync } from "node:child_process";
|
|
7
|
+
import { dirname, join } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
|
|
10
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
11
|
+
const cli = join(root, "src", "cli.ts");
|
|
12
|
+
|
|
13
|
+
const result = spawnSync(process.execPath, ["--import", "tsx", cli, ...process.argv.slice(2)], {
|
|
14
|
+
stdio: "inherit",
|
|
15
|
+
cwd: root,
|
|
16
|
+
// Run the code from the package dir (so `tsx` + sources resolve), but tell the
|
|
17
|
+
// bot to keep its .env/logs/data in the user's actual working directory.
|
|
18
|
+
env: { ...process.env, KIRO_TG_CWD: process.env.KIRO_TG_CWD || process.cwd() },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
process.exit(result.status ?? 0);
|