claude-telegram-mirror 0.2.24 → 0.2.26

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 (2) hide show
  1. package/README.md +25 -12
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -137,20 +137,33 @@ Approval buttons only appear in normal mode, not with `--dangerously-skip-permis
137
137
  ## Architecture
138
138
 
139
139
  ```
140
- ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
141
- │ Claude Code │────▶│ ctm daemon │────▶│ Telegram │
142
- │ CLI │◀────│ (Rust binary) │◀────│ Bot
143
- └─────────────────┘ └─────────────────┘ └─────────────────┘
144
-
145
- │ hooks │ Unix socket
146
- ▼ ▼
147
- ┌─────────────────┐ ┌─────────────────┐
148
- │ ctm hook │────▶│ Socket Server │
149
- (same binary, │◀────│ (bidirectional)│
150
- hook mode)
151
- └─────────────────┘ └─────────────────┘
140
+ OUTBOUND (CLI → Telegram) — Claude Code mirrors all activity out:
141
+
142
+ ┌─────────────┐ fires ┌──────────┐ NDJSON over ┌──────────────┐ Bot API ┌──────────────┐
143
+ │ Claude Code │ hook │ ctm hook │ Unix socket │ ctm daemon │ sendMsg │ Telegram │
144
+ CLI (tmux) ───────▶ │ (binary) │ ────────────▶ │ (event loop) │ ─────────▶ │ forum topic │
145
+ └─────────────┘ └──────────┘ └──────────────┘ └──────────────┘
146
+
147
+ INBOUND (Telegram → CLI) — daemon injects into the live pane:
148
+
149
+ ┌─────────────┐ tmux send-keys ┌──────────────┐ getUpdates long poll ┌──────────────┐
150
+ Claude Code ◀─────────────── ctm daemon ◀─────────────────────── │ Telegram │
151
+ │ CLI (tmux) │ -t <pane> │ InputInjector│ text & button callbacks │ forum topic │
152
+ └─────────────┘ └──────────────┘ └──────────────┘
153
+
154
+ Approvals (PreToolUse): the hook blocks on the Unix socket for an approval_response;
155
+ the daemon shows inline buttons in Telegram and writes the verdict back to the hook.
156
+
157
+ ctm daemon = tokio event loop · Unix SocketServer · SessionManager (SQLite) + per-session tmux cache
158
+ · TelegramBot (Bot API) · InputInjector (tmux) · pending approval / question state
152
159
  ```
153
160
 
161
+ > The `ctm hook` and the daemon are the **same binary** in different modes. Outbound rides
162
+ > hook → Unix socket → daemon → Bot API; inbound rides daemon long-poll → `InputInjector`
163
+ > (`tmux send-keys`) into the live CLI pane. The daemon resolves a session's tmux pane from
164
+ > its cache then SQLite, and **fails closed** if that session never reported one (ROUTING-001) —
165
+ > it never guesses a pane, to avoid misrouting keystrokes into another session.
166
+
154
167
  **Flow:**
155
168
  1. Claude Code hooks invoke `ctm hook`, which reads the event from stdin
156
169
  2. PreToolUse: for tool approvals, sends an approval request via socket and blocks for the Telegram response. **AskUserQuestion is *not* intercepted here** — the hook returns fast so Claude renders its native widget in the CLI; the daemon mirrors the question to Telegram from the standard `tool_start` event (ADR-015)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-telegram-mirror",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "description": "Bidirectional Telegram integration for Claude Code CLI - monitor and control your Claude Code sessions from Telegram",
5
5
  "bin": {
6
6
  "claude-telegram-mirror": "./scripts/ctm-wrapper.cjs",
@@ -49,10 +49,10 @@
49
49
  "access": "public"
50
50
  },
51
51
  "optionalDependencies": {
52
- "@agidreams/ctm-linux-x64": "0.2.24",
53
- "@agidreams/ctm-linux-arm64": "0.2.24",
54
- "@agidreams/ctm-darwin-arm64": "0.2.24",
55
- "@agidreams/ctm-darwin-x64": "0.2.24"
52
+ "@agidreams/ctm-linux-x64": "0.2.26",
53
+ "@agidreams/ctm-linux-arm64": "0.2.26",
54
+ "@agidreams/ctm-darwin-arm64": "0.2.26",
55
+ "@agidreams/ctm-darwin-x64": "0.2.26"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=18.0.0"