@stevezhou/sisu 0.3.11 → 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/runtime/launch.js +11 -6
- package/dist/tui.js +13 -2
- package/package.json +1 -1
package/dist/runtime/launch.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RuntimeUnavailable = void 0;
|
|
6
|
+
exports.MIN_PAGER_STAMP = exports.RuntimeUnavailable = void 0;
|
|
7
7
|
exports.assertRuntimeAvailable = assertRuntimeAvailable;
|
|
8
8
|
exports.grokBuildBinaryCandidates = grokBuildBinaryCandidates;
|
|
9
9
|
exports.findGrokBuildBinary = findGrokBuildBinary;
|
|
@@ -185,15 +185,17 @@ function pagerStampMeetsRelease(stamped = installedPagerStamp(), release = clien
|
|
|
185
185
|
return false;
|
|
186
186
|
return comparePagerStamp(stamped, release) >= 0;
|
|
187
187
|
}
|
|
188
|
-
/**
|
|
188
|
+
/** First pager that speaks the access-point contract. Host patches may ship ahead of a rebuild. */
|
|
189
|
+
exports.MIN_PAGER_STAMP = '0.3.11';
|
|
190
|
+
/** B-full when the host env flag is on or the installed pager is at least MIN_PAGER_STAMP. */
|
|
189
191
|
function accessPointBfullEnabled() {
|
|
190
|
-
return process.env.SISU_ACCESS_POINT_BFULL === '1' || pagerStampMeetsRelease();
|
|
192
|
+
return process.env.SISU_ACCESS_POINT_BFULL === '1' || pagerStampMeetsRelease(installedPagerStamp(), exports.MIN_PAGER_STAMP);
|
|
191
193
|
}
|
|
192
|
-
/** Installed ~/.sisu/bin pager must be
|
|
194
|
+
/** Installed ~/.sisu/bin pager must be the access-point contract; other paths (SISU_GROK_BIN / cargo) are dev. */
|
|
193
195
|
function pagerStampAllowsSpawn(binary) {
|
|
194
196
|
if (path_1.default.resolve(binary) !== path_1.default.resolve(installedPagerPath()))
|
|
195
197
|
return true;
|
|
196
|
-
return pagerStampMeetsRelease(installedPagerStamp(binary));
|
|
198
|
+
return pagerStampMeetsRelease(installedPagerStamp(binary), exports.MIN_PAGER_STAMP);
|
|
197
199
|
}
|
|
198
200
|
function sisuGrokBuildEnv() {
|
|
199
201
|
const auth = (0, store_1.readAuth)();
|
|
@@ -205,6 +207,10 @@ function sisuGrokBuildEnv() {
|
|
|
205
207
|
delete env.GROK_CODE_XAI_API_KEY;
|
|
206
208
|
delete env.GROK_DEFAULT_MODEL;
|
|
207
209
|
delete env.SISU_TOKEN;
|
|
210
|
+
// Must not set GROK_DISABLE_API_KEY_AUTH: AuthManager.vet_cached hides
|
|
211
|
+
// auth_mode=api_key snapshots, so the pager thinks there is no session
|
|
212
|
+
// and exits 10 (host login) in a loop.
|
|
213
|
+
delete env.GROK_DISABLE_API_KEY_AUTH;
|
|
208
214
|
if (accessPointBfullEnabled()) {
|
|
209
215
|
delete env.XAI_API_KEY;
|
|
210
216
|
env.SISU_TOKEN = auth?.token || '';
|
|
@@ -246,7 +252,6 @@ function sisuGrokBuildEnv() {
|
|
|
246
252
|
GROK_DISABLE_CLI_CHAT_PROXY: '1',
|
|
247
253
|
GROK_TELEMETRY_ENABLED: '0',
|
|
248
254
|
GROK_CHANGELOG_OFFLINE: '1',
|
|
249
|
-
GROK_DISABLE_API_KEY_AUTH: '1',
|
|
250
255
|
};
|
|
251
256
|
}
|
|
252
257
|
function launchGrokBuildHeadless(prompt, cwd) {
|
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}`);
|
|
@@ -257,7 +263,7 @@ async function runTui(io, deps = {}) {
|
|
|
257
263
|
io.write(`${(0, logo_1.sisuSplash)(columns, true)}\n`);
|
|
258
264
|
}
|
|
259
265
|
}
|
|
260
|
-
if (usePager && !deps.pager) {
|
|
266
|
+
if (usePager && (deps.spawnGrokPager || !deps.pager)) {
|
|
261
267
|
const spawnOnce = deps.spawnGrokPager ??
|
|
262
268
|
(() => {
|
|
263
269
|
const grokBin = (0, launch_1.findGrokBuildBinary)();
|
|
@@ -299,13 +305,18 @@ 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.
|
|
308
|
+
// Login handoff: pager exits 10 → host web login at most once → respawn.
|
|
303
309
|
while (true) {
|
|
304
310
|
const code = await spawnOnce();
|
|
305
311
|
if (code === null)
|
|
306
312
|
break;
|
|
307
313
|
if (code !== exports.SISU_LOGIN_EXIT_CODE)
|
|
308
314
|
return code;
|
|
315
|
+
restoreInteractiveTerminal(io);
|
|
316
|
+
if (auth() || openedBrowserLogin) {
|
|
317
|
+
io.write('sisu: session already saved; not opening another login page.\n');
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
309
320
|
try {
|
|
310
321
|
const email = await startWebLogin((line) => io.write(`${line}\n`));
|
|
311
322
|
io.write(`logged in as ${email}\n`);
|