jh-web-gateway 1.0.0 → 2.0.0

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/README.md CHANGED
@@ -39,6 +39,284 @@ Point any OpenAI-compatible tool at:
39
39
  - Base URL: `http://127.0.0.1:8741/v1`
40
40
  - API Key: printed at startup as `API Key: jh-local-...`
41
41
 
42
+ ## Interactive TUI
43
+
44
+ Run without arguments (or with `tui`) to open the full-screen interactive terminal UI:
45
+
46
+ ```bash
47
+ jh-gateway
48
+ # or
49
+ jh-gateway tui
50
+ ```
51
+
52
+ The TUI guides you through the complete workflow — start the gateway, pick a model, send test messages, and copy connection details — all without leaving the terminal.
53
+
54
+ ---
55
+
56
+ ### Splash Screen
57
+
58
+ On launch, an animated ASCII banner plays. Press any key to skip it and enter the main menu.
59
+
60
+ ```text
61
+ ██╗██╗ ██╗ ██╗ ██╗███████╗██████╗
62
+ ██║██║ ██║ ██║ ██║██╔════╝██╔══██╗
63
+ ██║███████║ ██║ █╗ ██║█████╗ ██████╔╝
64
+ ██ ██║██╔══██║ ██║███╗██║██╔══╝ ██╔══██╗
65
+ ╚█████╔╝██║ ██║ ╚███╔███╔╝███████╗██████╔╝
66
+ ╚════╝ ╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝╚═════╝
67
+
68
+ ██████╗ █████╗ ████████╗███████╗██╗ ██╗ █████╗ ██╗ ██╗
69
+ ██╔════╝ ██╔══██╗╚══██╔══╝██╔════╝██║ ██║██╔══██╗╚██╗ ██╔╝
70
+ ██║ ███╗███████║ ██║ █████╗ ██║ █╗ ██║███████║ ╚████╔╝
71
+ ██║ ██║██╔══██║ ██║ ██╔══╝ ██║███╗██║██╔══██║ ╚██╔╝
72
+ ╚██████╔╝██║ ██║ ██║ ███████╗╚███╔███╔╝██║ ██║ ██║
73
+ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═╝
74
+
75
+ Infinite tokens, for school work of course :)))
76
+ Press any key to continue
77
+ ```
78
+
79
+ ---
80
+
81
+ ### Main Menu
82
+
83
+ The header shows the gateway status at all times. Use arrow keys to navigate and `Enter` to select.
84
+
85
+ ```text
86
+ ┌─────────────────────────────────────────────────────────────┐
87
+ │ jh-gateway ● Gateway: stopped │
88
+ ├─────────────────────────────────────────────────────────────┤
89
+ │ │
90
+ │ Main Menu │
91
+ │ │
92
+ │ > Start Gateway │
93
+ │ Model │
94
+ │ Chat │
95
+ │ Server Info │
96
+ │ Settings │
97
+ │ Quit │
98
+ │ │
99
+ │ Launch Chrome, authenticate, and start the HTTP server │
100
+ │ │
101
+ ├─────────────────────────────────────────────────────────────┤
102
+ │ [↑↓] Navigate [Enter] Select [q/Esc] Quit │
103
+ └─────────────────────────────────────────────────────────────┘
104
+ ```
105
+
106
+ | Key | Action |
107
+ |-----|--------|
108
+ | `↑` / `↓` | Move between items |
109
+ | `Enter` | Open the highlighted panel |
110
+ | `q` / `Esc` | Quit jh-gateway |
111
+
112
+ ---
113
+
114
+ ### Gateway Panel
115
+
116
+ Select **Start Gateway** to launch Chrome, authenticate, and start the server. A live phase tracker shows progress:
117
+
118
+ ```text
119
+ ┌─────────────────────────────────────────────────────────────┐
120
+ │ jh-gateway ● Gateway: starting │
121
+ ├─────────────────────────────────────────────────────────────┤
122
+ │ │
123
+ │ Gateway Control │
124
+ │ │
125
+ │ Starting gateway… │
126
+ │ │
127
+ │ ● Connecting to Chrome │
128
+ │ ◌ Waiting for login ← active phase │
129
+ │ ○ Starting server │
130
+ │ │
131
+ │ ╭──────────────────────────────────────────╮ │
132
+ │ │ Please log in via the Chrome window │ │
133
+ │ ╰──────────────────────────────────────────╯ │
134
+ │ │
135
+ └─────────────────────────────────────────────────────────────┘
136
+ ```
137
+
138
+ Once all phases complete the gateway is live:
139
+
140
+ ```text
141
+ ┌─────────────────────────────────────────────────────────────┐
142
+ │ jh-gateway ● Gateway: running │
143
+ ├─────────────────────────────────────────────────────────────┤
144
+ │ │
145
+ │ Gateway Control │
146
+ │ │
147
+ │ ● Running [Enter] Stop │
148
+ │ │
149
+ │ ● Connecting to Chrome │
150
+ │ ● Waiting for login │
151
+ │ ● Starting server │
152
+ │ │
153
+ │ Gateway running on http://127.0.0.1:8741 │
154
+ │ │
155
+ │ [b/Esc] Back (gateway keeps running) │
156
+ └─────────────────────────────────────────────────────────────┘
157
+ ```
158
+
159
+ | Symbol | Meaning |
160
+ |--------|---------|
161
+ | `○` | Pending |
162
+ | `◌` | Active (in progress) |
163
+ | `●` | Done |
164
+ | `✗` | Error |
165
+
166
+ | Key | Action |
167
+ |-----|--------|
168
+ | `Enter` | Start / Stop the gateway |
169
+ | `b` / `Esc` | Back to menu (gateway continues running in the background) |
170
+
171
+ ---
172
+
173
+ ### Model Selector
174
+
175
+ Choose the AI model for all requests. The currently active model is marked with a filled circle (`●`).
176
+
177
+ ```text
178
+ ┌─────────────────────────────────────────────────────────────┐
179
+ │ jh-gateway ● Gateway: running │
180
+ ├─────────────────────────────────────────────────────────────┤
181
+ │ │
182
+ │ Select Model │
183
+ │ │
184
+ │ > ● claude-opus-4.5 ← active model │
185
+ │ ○ claude-sonnet-4.5 │
186
+ │ ○ claude-haiku-4.5 │
187
+ │ ○ gpt-4.1 │
188
+ │ ○ gpt-5 │
189
+ │ ○ gpt-5.1 │
190
+ │ ○ o3 │
191
+ │ ○ o3-mini │
192
+ │ ○ llama3-3-70b-instruct │
193
+ │ │
194
+ │ [↑↓] Navigate [Enter] Select [b/Esc] Back │
195
+ └─────────────────────────────────────────────────────────────┘
196
+ ```
197
+
198
+ The selection is saved to `~/.jh-gateway/config.json` as `defaultModel` immediately on press.
199
+
200
+ ---
201
+
202
+ ### Chat Panel
203
+
204
+ Send a quick test message from inside the TUI — no external tool required. The panel shows the last exchange and streams a response from the running gateway.
205
+
206
+ ```text
207
+ ┌─────────────────────────────────────────────────────────────┐
208
+ │ jh-gateway ● Gateway: running │
209
+ ├─────────────────────────────────────────────────────────────┤
210
+ │ │
211
+ │ Chat Model: claude-opus-4.5 │
212
+ │ │
213
+ │ You: Explain quicksort │
214
+ │ │
215
+ │ Assistant: Quicksort is a divide-and-conquer algorithm… │
216
+ │ │
217
+ │ ╭─────────────────────────────────────────────────────╮ │
218
+ │ │ Type a message and press Enter… █ │ │
219
+ │ ╰─────────────────────────────────────────────────────╯ │
220
+ │ │
221
+ │ [Enter] Send [b/Esc] Back │
222
+ └─────────────────────────────────────────────────────────────┘
223
+ ```
224
+
225
+ > If the gateway is not yet running, the panel will prompt you to start it first.
226
+
227
+ | Key | Action |
228
+ |-----|--------|
229
+ | Type | Compose your message |
230
+ | `Enter` | Send the message |
231
+ | `Backspace` | Delete last character |
232
+ | `b` / `Esc` | Back to menu |
233
+
234
+ ---
235
+
236
+ ### Server Info Panel
237
+
238
+ Displays the live base URL and API key. Use one-key shortcuts to copy them directly to the clipboard.
239
+
240
+ ```text
241
+ ┌─────────────────────────────────────────────────────────────┐
242
+ │ jh-gateway ● Gateway: running │
243
+ ├─────────────────────────────────────────────────────────────┤
244
+ │ │
245
+ │ Server Info │
246
+ │ │
247
+ │ ╭───────────────────────────────────────────────────╮ │
248
+ │ │ Base URL: http://127.0.0.1:8741 │ │
249
+ │ │ API Key: jh-local-xxxxxxxxxxxxxxxxxxxxxxxx │ │
250
+ │ ╰───────────────────────────────────────────────────╯ │
251
+ │ │
252
+ │ Copied URL! │
253
+ │ │
254
+ │ [c] Copy URL [k] Copy Key [b/Esc] Back │
255
+ └─────────────────────────────────────────────────────────────┘
256
+ ```
257
+
258
+ | Key | Action |
259
+ |-----|--------|
260
+ | `c` | Copy base URL to clipboard |
261
+ | `k` | Copy API key to clipboard |
262
+ | `b` / `Esc` | Back to menu |
263
+
264
+ ---
265
+
266
+ ### Settings Panel
267
+
268
+ Edit gateway configuration inline — no config file edits needed. Navigate to a field and press `Enter` to edit; `Enter` again to confirm, `Esc` to cancel.
269
+
270
+ ```text
271
+ ┌─────────────────────────────────────────────────────────────┐
272
+ │ jh-gateway ● Gateway: running │
273
+ ├─────────────────────────────────────────────────────────────┤
274
+ │ │
275
+ │ Settings │
276
+ │ │
277
+ │ > Port: 8741 │
278
+ │ CDP URL: http://127.0.0.1:9222 │
279
+ │ Default Model: claude-opus-4.5 │
280
+ │ Auth Mode: bearer │
281
+ │ │
282
+ │ [↑↓] Navigate [Enter] Edit [b/Esc] Back │
283
+ └─────────────────────────────────────────────────────────────┘
284
+ ```
285
+
286
+ While editing a field the cursor is visible and input is echoed live:
287
+
288
+ ```text
289
+ > Port: 9000█
290
+ ```
291
+
292
+ Changes are validated and written to `~/.jh-gateway/config.json` on confirm.
293
+
294
+ | Key | Action |
295
+ |-----|--------|
296
+ | `↑` / `↓` | Move between fields |
297
+ | `Enter` | Start / confirm editing |
298
+ | `Esc` | Cancel editing |
299
+ | `b` / `Esc` | Back to menu (when not editing) |
300
+
301
+ ---
302
+
303
+ ### TUI keyboard shortcuts at a glance
304
+
305
+ | Key | Context | Action |
306
+ |-----|---------|--------|
307
+ | `↑` / `↓` | Menu, Model, Settings | Navigate items |
308
+ | `Enter` | Main Menu | Open selected panel |
309
+ | `Enter` | Gateway Panel | Start / Stop gateway |
310
+ | `Enter` | Chat | Send message |
311
+ | `Enter` | Settings | Begin / confirm editing a field |
312
+ | `b` / `Esc` | Any panel | Return to main menu |
313
+ | `c` | Server Info | Copy base URL to clipboard |
314
+ | `k` | Server Info | Copy API key to clipboard |
315
+ | `q` / `Esc` | Main Menu | Quit |
316
+ | `Ctrl+C` | Anywhere | Force quit |
317
+
318
+ ---
319
+
42
320
  ## Usage
43
321
 
44
322
  ### curl