@stevezhou/sisu 0.3.11 → 0.3.12

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.
@@ -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
- /** B-full only when the host env flag is on or the installed pager stamp matches this package. */
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 this release; other paths (SISU_GROK_BIN / cargo) are dev. */
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
@@ -257,7 +257,7 @@ async function runTui(io, deps = {}) {
257
257
  io.write(`${(0, logo_1.sisuSplash)(columns, true)}\n`);
258
258
  }
259
259
  }
260
- if (usePager && !deps.pager) {
260
+ if (usePager && (deps.spawnGrokPager || !deps.pager)) {
261
261
  const spawnOnce = deps.spawnGrokPager ??
262
262
  (() => {
263
263
  const grokBin = (0, launch_1.findGrokBuildBinary)();
@@ -300,12 +300,17 @@ async function runTui(io, deps = {}) {
300
300
  });
301
301
  if (deps.spawnGrokPager || ((0, launch_1.findGrokBuildBinary)() && process.stdout.isTTY)) {
302
302
  // Login handoff: pager exits 10 → host web login → respawn.
303
+ // If a session is already on disk, do not mint another device code.
303
304
  while (true) {
304
305
  const code = await spawnOnce();
305
306
  if (code === null)
306
307
  break;
307
308
  if (code !== exports.SISU_LOGIN_EXIT_CODE)
308
309
  return code;
310
+ if (auth()) {
311
+ io.write('sisu: session already saved; not opening another login page.\n');
312
+ break;
313
+ }
309
314
  try {
310
315
  const email = await startWebLogin((line) => io.write(`${line}\n`));
311
316
  io.write(`logged in as ${email}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stevezhou/sisu",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "SiSu CLI — 思溯 / SiSu · 思有所溯",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://www.sisu.chat",