@addai/node 0.29.0 → 0.29.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.
Files changed (2) hide show
  1. package/dist/tui/run.js +21 -0
  2. package/package.json +1 -1
package/dist/tui/run.js CHANGED
@@ -91,6 +91,9 @@ function createConsole(build, hooks = {}) {
91
91
  function onKeypress(_s, key) {
92
92
  void app.handleKey(key);
93
93
  }
94
+ function onStdinError() {
95
+ teardown();
96
+ }
94
97
  function attachInput() {
95
98
  if (inputAttached)
96
99
  return;
@@ -99,12 +102,20 @@ function createConsole(build, hooks = {}) {
99
102
  process.stdin.setRawMode(true);
100
103
  process.stdin.resume();
101
104
  process.stdin.on('keypress', onKeypress);
105
+ // A terminal can be taken away mid-read: an ssh session drops, a window
106
+ // closes. The read then fails with EIO, and an 'error' with no listener is
107
+ // a thrown exception in node — the process dies without ever running
108
+ // teardown, so raw mode is never turned off and the shell that inherits
109
+ // the terminal reports its own "error on TTY read" afterwards. Treat it as
110
+ // what it is: the terminal is gone, so put it back and leave quietly.
111
+ process.stdin.on('error', onStdinError);
102
112
  inputAttached = true;
103
113
  }
104
114
  function detachInput() {
105
115
  if (!inputAttached)
106
116
  return;
107
117
  process.stdin.off('keypress', onKeypress);
118
+ process.stdin.off('error', onStdinError);
108
119
  if (process.stdin.isTTY)
109
120
  process.stdin.setRawMode(false);
110
121
  process.stdin.pause();
@@ -142,6 +153,16 @@ function createConsole(build, hooks = {}) {
142
153
  draw();
143
154
  }
144
155
  };
156
+ // Backgrounding a TUI is not an error, but reading the terminal from a
157
+ // background process group earns SIGTTIN, and the default action is to STOP
158
+ // the process — which is what "zsh: suspended (tty input)" is. Stopped mid-
159
+ // draw it still holds the terminal in raw mode, so the session it was
160
+ // sharing degrades too. Stop reading and leave instead; the daemon is a
161
+ // separate process and keeps running either way.
162
+ process.on('SIGTTIN', teardown);
163
+ process.on('SIGTTOU', teardown);
164
+ // The terminal went away without the read failing first.
165
+ process.on('SIGHUP', teardown);
145
166
  app.replace(build(app, suspend));
146
167
  return {
147
168
  host: app,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@addai/node",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "description": "Daemon that pairs a machine with your +Ai account and runs Claude / Codex / Kimi / Gemini agents on its behalf. Reachable via Supabase from Vault, Entity Studio, or any other +Ai surface.",
5
5
  "license": "MIT",
6
6
  "keywords": [