gestalt-mobile 0.62.3 → 0.62.4

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.
@@ -16,10 +16,37 @@ export function launchCodexAppServer(input) {
16
16
  });
17
17
  const rpc = new JsonRpcClient(child.stdout, child.stdin);
18
18
  child.once('error', (error) => rpc.fail(error));
19
+ child.stdin.on('error', (error) => rpc.fail(error));
20
+ // App-server diagnostics are not protocol output. Drain them without retaining
21
+ // potentially sensitive contents or letting a full stderr pipe block shutdown.
22
+ child.stderr.resume();
23
+ let closing = false;
24
+ let shutdownTimer;
25
+ child.once('exit', () => {
26
+ clearTimeout(shutdownTimer);
27
+ child.stdin.destroy();
28
+ });
29
+ // close follows stdout drainage; exit alone can precede a final RPC response.
30
+ child.once('close', () => rpc.fail(new Error('CODEX_APP_SERVER_EXITED')));
19
31
  return {
20
32
  child,
21
33
  rpc,
22
- close: () => child.kill('SIGTERM'),
34
+ close: () => {
35
+ if (closing)
36
+ return;
37
+ closing = true;
38
+ rpc.fail(new Error('CODEX_APP_SERVER_CLOSED'));
39
+ // EOF also releases older managed proxies blocked in a filesystem read.
40
+ child.stdin.end();
41
+ if (!child.pid || child.exitCode !== null || child.signalCode !== null)
42
+ return;
43
+ child.kill('SIGTERM');
44
+ shutdownTimer = setTimeout(() => {
45
+ if (child.exitCode === null && child.signalCode === null)
46
+ child.kill('SIGKILL');
47
+ }, 3_000);
48
+ shutdownTimer.unref();
49
+ },
23
50
  onExit: (listener) => {
24
51
  child.once('exit', listener);
25
52
  return () => child.off('exit', listener);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gestalt-mobile",
3
- "version": "0.62.3",
3
+ "version": "0.62.4",
4
4
  "description": "Mobile-first web relay for durable Codex development sessions",
5
5
  "keywords": [
6
6
  "codex",