opentui(phase3): launcher integration — HERMES_TUI_ENGINE dual-engine
hermes --tui launches the native OpenTUI engine (Bun) when HERMES_TUI_ENGINE=opentui (env) or display.tui_engine=opentui (config); Ink stays the default and the shipping path is untouched. - _resolve_tui_engine() (env > config > ink); refuses opentui on Windows/Termux (no Bun) -> falls back to ink with a notice. - _make_opentui_argv() -> [bun, src/entry.real.tsx] (no build step). - _bun_bin() with HERMES_BUN override. - Branch at top of _make_tui_argv BEFORE _ensure_tui_node (Bun-only host must not bootstrap Node). - Gate _launch_tui NODE_OPTIONS/--max-old-space-size on engine==ink (Bun is JSC; the V8 flag errors/ignores). Verified end-to-end via tmux: real hermes --tui -> Bun -> OpenTUI -> real Python gateway streamed a real reply. No-flag default still ink.
This commit is contained in:
@@ -8,7 +8,6 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
|
||||
@@ -212,75 +211,6 @@ class TestPtyBridgeClose:
|
||||
break
|
||||
assert reaped, f"pid {pid} still running after close()"
|
||||
|
||||
def test_close_signals_child_process_group(self, monkeypatch):
|
||||
sent: list[tuple[int, signal.Signals]] = []
|
||||
|
||||
class _FakeProc:
|
||||
pid = 12345
|
||||
fd = -1
|
||||
|
||||
def __init__(self):
|
||||
self.alive = True
|
||||
|
||||
def isalive(self):
|
||||
return self.alive
|
||||
|
||||
def kill(self, sig):
|
||||
raise AssertionError(f"single-process kill used: {sig}")
|
||||
|
||||
def close(self, force=False):
|
||||
self.closed = force
|
||||
|
||||
fake = _FakeProc()
|
||||
|
||||
def fake_killpg(pgid, sig):
|
||||
sent.append((pgid, sig))
|
||||
fake.alive = False
|
||||
|
||||
monkeypatch.setattr(os, "getpgid", lambda pid: 67890)
|
||||
monkeypatch.setattr(os, "killpg", fake_killpg)
|
||||
|
||||
bridge = PtyBridge.__new__(PtyBridge)
|
||||
bridge._proc = fake
|
||||
bridge._fd = -1
|
||||
bridge._closed = False
|
||||
|
||||
bridge.close()
|
||||
|
||||
assert sent == [(67890, signal.SIGHUP)]
|
||||
assert bridge._closed is True
|
||||
|
||||
def test_close_falls_back_to_single_process_signal_when_group_unknown(self, monkeypatch):
|
||||
sent: list[signal.Signals] = []
|
||||
|
||||
class _FakeProc:
|
||||
pid = 12345
|
||||
fd = -1
|
||||
|
||||
def __init__(self):
|
||||
self.alive = True
|
||||
|
||||
def isalive(self):
|
||||
return self.alive
|
||||
|
||||
def kill(self, sig):
|
||||
sent.append(sig)
|
||||
self.alive = False
|
||||
|
||||
def close(self, force=False):
|
||||
self.closed = force
|
||||
|
||||
monkeypatch.setattr(os, "getpgid", lambda pid: (_ for _ in ()).throw(OSError()))
|
||||
|
||||
bridge = PtyBridge.__new__(PtyBridge)
|
||||
bridge._proc = _FakeProc()
|
||||
bridge._fd = -1
|
||||
bridge._closed = False
|
||||
|
||||
bridge.close()
|
||||
|
||||
assert sent == [signal.SIGHUP]
|
||||
|
||||
|
||||
@skip_on_windows
|
||||
class TestPtyBridgeEnv:
|
||||
|
||||
Reference in New Issue
Block a user