@stevezhou/sisu 0.3.12 → 0.3.13
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/dist/tui.js +9 -3
- package/package.json +1 -1
package/dist/tui.js
CHANGED
|
@@ -36,6 +36,10 @@ function shouldUsePager(deps, env = process.env) {
|
|
|
36
36
|
return false;
|
|
37
37
|
return Boolean(process.stdout.isTTY);
|
|
38
38
|
}
|
|
39
|
+
/** Pager may leave the alt screen / hide the cursor when it exits 10. */
|
|
40
|
+
function restoreInteractiveTerminal(io) {
|
|
41
|
+
io.write('\x1b[?1049l\x1b[?25h\x1b[?2004l\x1b[0m');
|
|
42
|
+
}
|
|
39
43
|
async function playMobiusIntro(io, options = {}) {
|
|
40
44
|
const columns = options.columns ?? process.stdout.columns ?? 80;
|
|
41
45
|
const frames = options.frames ?? 32;
|
|
@@ -207,7 +211,9 @@ async function runTui(io, deps = {}) {
|
|
|
207
211
|
const columns = deps.columns ?? process.stdout.columns ?? 80;
|
|
208
212
|
const animate = deps.animate ?? shouldAnimateSplash();
|
|
209
213
|
try {
|
|
214
|
+
let openedBrowserLogin = false;
|
|
210
215
|
const startWebLogin = async (notify) => {
|
|
216
|
+
openedBrowserLogin = true;
|
|
211
217
|
return webLogin({
|
|
212
218
|
onStart: (info) => {
|
|
213
219
|
notify(`Open ${info.verification_uri_complete}`);
|
|
@@ -299,15 +305,15 @@ async function runTui(io, deps = {}) {
|
|
|
299
305
|
});
|
|
300
306
|
});
|
|
301
307
|
if (deps.spawnGrokPager || ((0, launch_1.findGrokBuildBinary)() && process.stdout.isTTY)) {
|
|
302
|
-
// Login handoff: pager exits 10 → host web login → respawn.
|
|
303
|
-
// If a session is already on disk, do not mint another device code.
|
|
308
|
+
// Login handoff: pager exits 10 → host web login at most once → respawn.
|
|
304
309
|
while (true) {
|
|
305
310
|
const code = await spawnOnce();
|
|
306
311
|
if (code === null)
|
|
307
312
|
break;
|
|
308
313
|
if (code !== exports.SISU_LOGIN_EXIT_CODE)
|
|
309
314
|
return code;
|
|
310
|
-
|
|
315
|
+
restoreInteractiveTerminal(io);
|
|
316
|
+
if (auth() || openedBrowserLogin) {
|
|
311
317
|
io.write('sisu: session already saved; not opening another login page.\n');
|
|
312
318
|
break;
|
|
313
319
|
}
|