@stevezhou/sisu 0.3.10 → 0.3.11

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.
@@ -8,6 +8,7 @@ exports.assertRuntimeAvailable = assertRuntimeAvailable;
8
8
  exports.grokBuildBinaryCandidates = grokBuildBinaryCandidates;
9
9
  exports.findGrokBuildBinary = findGrokBuildBinary;
10
10
  exports.sisuRuntimeApiBase = sisuRuntimeApiBase;
11
+ exports.purgeXaiEngineAuth = purgeXaiEngineAuth;
11
12
  exports.writeSisuGrokConfig = writeSisuGrokConfig;
12
13
  exports.migrateGrokScratchToEngine = migrateGrokScratchToEngine;
13
14
  exports.purgeChangelogCache = purgeChangelogCache;
@@ -75,10 +76,27 @@ function findGrokBuildBinary() {
75
76
  function sisuRuntimeApiBase(apiBase) {
76
77
  return (0, adapter_1.openaiCompatUrl)(apiBase).replace(/\/chat\/completions$/, '');
77
78
  }
79
+ /** Drop leftover grok.com / auth.x.ai sessions from the pager engine store. */
80
+ function purgeXaiEngineAuth(engine = (0, store_1.sisuEngineHome)()) {
81
+ const file = path_1.default.join(engine, 'auth.json');
82
+ if (!fs_1.default.existsSync(file))
83
+ return file;
84
+ try {
85
+ const raw = fs_1.default.readFileSync(file, 'utf8');
86
+ if (!/auth\.x\.ai|accounts\.x\.ai|grok\.com/i.test(raw))
87
+ return file;
88
+ fs_1.default.writeFileSync(file, '{}\n', { encoding: 'utf8', mode: 0o600 });
89
+ }
90
+ catch {
91
+ // missing / busy — next launch retries
92
+ }
93
+ return file;
94
+ }
78
95
  function writeSisuGrokConfig() {
79
96
  const auth = (0, store_1.readAuth)();
80
97
  const engine = (0, store_1.sisuEngineHome)();
81
98
  fs_1.default.mkdirSync(engine, { recursive: true, mode: 0o700 });
99
+ purgeXaiEngineAuth(engine);
82
100
  const file = path_1.default.join(engine, 'config.toml');
83
101
  const runtimeBase = sisuRuntimeApiBase(auth?.api_base || process.env.SISU_API_BASE || store_1.DEFAULT_API_BASE);
84
102
  const body = [
@@ -207,6 +225,7 @@ function sisuGrokBuildEnv() {
207
225
  email: auth.email || undefined,
208
226
  });
209
227
  }
228
+ purgeXaiEngineAuth(engine);
210
229
  return {
211
230
  ...env,
212
231
  SISU_ACCESS_POINT: '1',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stevezhou/sisu",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "SiSu CLI — 思溯 / SiSu · 思有所溯",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://www.sisu.chat",