claude-tg 1.1.1 → 1.1.2

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/package.json +1 -1
  2. package/src/hooks/stop.js +11 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-tg",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Control Claude Code from Telegram — approve permissions, answer questions, reply to idle sessions, send files, all from your phone",
5
5
  "bin": {
6
6
  "claude-tg": "bin/claude-tg"
package/src/hooks/stop.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // Stop hook for Claude Code.
4
- // Fires every time Claude finishes a response turn.
5
- // Sends a notification to the daemon so Telegram gets notified immediately.
4
+ // Only notifies when Claude is truly done and waiting for user input.
5
+ // Skips intermediate tool turns and subagent completions.
6
6
 
7
7
  const http = require('http');
8
8
  const fs = require('fs');
@@ -78,12 +78,19 @@ function postToDaemon(body) {
78
78
  }
79
79
 
80
80
  async function main() {
81
- hookLog('Hook called');
82
81
  try {
83
82
  const input = await readStdin();
84
83
  const hookInput = input.hookInput || input;
85
- const ttyPath = findTty();
86
84
 
85
+ // Only notify when Claude is truly done and waiting for user input.
86
+ // stop_hook_active is false during intermediate tool turns and subagent runs.
87
+ if (!hookInput.stop_hook_active) {
88
+ hookLog(`Skipped (not active) session=${hookInput.session_id}`);
89
+ process.exit(0);
90
+ return;
91
+ }
92
+
93
+ const ttyPath = findTty();
87
94
  hookLog(`session=${hookInput.session_id} tty=${ttyPath}`);
88
95
 
89
96
  await postToDaemon({