@radnine/claude-session-daemon 0.9.5 → 0.9.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radnine/claude-session-daemon",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Node.js daemon for managing Claude CLI sessions",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -557,19 +557,23 @@ class CodexProcess extends EventEmitter {
557
557
 
558
558
  // The child could not be spawned (codex not installed, wrong command). Node
559
559
  // throws an uncaught exception for an unhandled 'error' event, which would
560
- // take the whole daemon down with every other chat on it.
560
+ // take the whole daemon down with every other chat on it. Node also emits
561
+ // 'error' when kill() can't deliver a signal (EPERM); that process is still
562
+ // running, so only a failed spawn, which leaves no pid, marks it stopped.
561
563
  _setupError() {
562
564
  this._child.on('error', (err) => {
563
565
  const message = err && err.code === 'ENOENT'
564
566
  ? `Codex CLI not found: ${this._codexCommand}`
565
567
  : `Codex process error: ${err && err.message}`;
566
568
  this._logger.error(message, { sessionId: this._sessionId, error: err && err.message });
567
- this._state = 'stopped';
568
- const failure = new Error(message);
569
- for (const [id, pending] of this._pending) {
570
- clearTimeout(pending.timer);
571
- pending.reject(failure);
572
- this._pending.delete(id);
569
+ if (!this._child.pid) {
570
+ this._state = 'stopped';
571
+ const failure = new Error(message);
572
+ for (const [id, pending] of this._pending) {
573
+ clearTimeout(pending.timer);
574
+ pending.reject(failure);
575
+ this._pending.delete(id);
576
+ }
573
577
  }
574
578
  if (this.listenerCount('error') > 0) this.emit('error', message);
575
579
  });