feat: new tui based on ink

This commit is contained in:
Brooklyn Nicholson
2026-04-02 19:06:42 -05:00
parent 624ad582a5
commit 2ea5345a7b
13 changed files with 4177 additions and 0 deletions

36
tui_gateway/entry.py Normal file
View File

@@ -0,0 +1,36 @@
import json
import sys
from tui_gateway.server import handle_request, resolve_skin
def _write(obj: dict):
sys.stdout.write(json.dumps(obj) + "\n")
sys.stdout.flush()
def main():
_write({
"jsonrpc": "2.0",
"method": "event",
"params": {"type": "gateway.ready", "payload": {"skin": resolve_skin()}},
})
for raw in sys.stdin:
line = raw.strip()
if not line:
continue
try:
req = json.loads(line)
except json.JSONDecodeError:
_write({"jsonrpc": "2.0", "error": {"code": -32700, "message": "parse error"}, "id": None})
continue
resp = handle_request(req)
if resp is not None:
_write(resp)
if __name__ == "__main__":
main()