claude-threads 1.4.7 → 1.4.8

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/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.4.8] - 2026-03-08
9
+
10
+ ### Fixed
11
+ - **WebSocket not defined on Node.js** - Added compatibility layer for `--target node` builds; bot now works on Node.js <22 and all Bun versions (#263, #283)
12
+ - **Orphaned daemon processes** - Daemon wrapper now traps SIGTERM/SIGINT/SIGHUP, kills child process cleanly, and forwards the actual signal (#258, #282)
13
+ - **Session store crash on malformed file** - `sessions.json` containing `{}` or missing fields no longer crashes; `loadRaw()` validates structure defensively (#258, #284)
14
+ - **!stop ignored in paused sessions** - `!stop`/`!cancel` commands now work in paused sessions instead of being passed as prompts (#258, #285)
15
+
8
16
  ## [1.4.7] - 2026-03-08
9
17
 
10
18
  ### Security
@@ -112,16 +112,40 @@ log "Max restarts: ${MAX_RESTARTS:-unlimited}"
112
112
  log "Restart delay: ${RESTART_DELAY}s"
113
113
  log "Restart on error: $RESTART_ON_ERROR"
114
114
 
115
+ # Signal handler: forward signal to child process and set shutdown flag
116
+ child_pid=0
117
+ shutting_down=false
118
+ cleanup() {
119
+ local sig=$1
120
+ log "Received SIG${sig}, shutting down..."
121
+ shutting_down=true
122
+ if [ $child_pid -ne 0 ]; then
123
+ kill -${sig} $child_pid 2>/dev/null
124
+ wait $child_pid 2>/dev/null
125
+ fi
126
+ }
127
+ trap 'cleanup TERM' SIGTERM
128
+ trap 'cleanup INT' SIGINT
129
+ trap 'cleanup HUP' SIGHUP
130
+
115
131
  while true; do
116
132
  log "Starting claude-threads (restart #$restart_count)..."
117
133
 
118
134
  # Run claude-threads with any remaining arguments
119
135
  # Note: CLAUDE_THREADS_CMD may be "bun /path/to/file.js" so we use eval
120
136
  set +e
121
- eval $CLAUDE_THREADS_CMD '"$@"'
137
+ eval $CLAUDE_THREADS_CMD '"$@"' &
138
+ child_pid=$!
139
+ wait $child_pid
122
140
  exit_code=$?
141
+ child_pid=0
123
142
  set -e
124
143
 
144
+ if [ "$shutting_down" = true ]; then
145
+ log "Signal received, exiting daemon"
146
+ exit 0
147
+ fi
148
+
125
149
  log "claude-threads exited with code $exit_code"
126
150
 
127
151
  # Check if we should restart