wormclaude 1.0.76 → 1.0.78
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/cli.js +32 -1
- package/dist/theme.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -71,8 +71,25 @@ if (!process.env.WORMCLAUDE_SKIP_UPDATE && !process.env.WORMCLAUDE_BASE_URL) {
|
|
|
71
71
|
catch { /* güncelleme kontrolü best-effort — başarısızsa normal başla */ }
|
|
72
72
|
}
|
|
73
73
|
const config = loadConfig();
|
|
74
|
-
|
|
74
|
+
// Giriş gerekli mi? Anahtar YOKSA veya VARSA ama gateway'de GEÇERSİZSE (401) → login.
|
|
75
|
+
let _needLogin = !config.apiKey;
|
|
76
|
+
if (config.apiKey && !process.env.WORMCLAUDE_BASE_URL) {
|
|
77
|
+
// Açılışta anahtarı doğrula: geçersiz/iptal edilmişse kullanıcıyı 401 duvarına çarptırma.
|
|
78
|
+
try {
|
|
79
|
+
const _base = config.baseUrl || 'https://api.wormclaude.ai/v1';
|
|
80
|
+
const _ac = new AbortController();
|
|
81
|
+
const _to = setTimeout(() => _ac.abort(), 8000);
|
|
82
|
+
const _r = await fetch(`${_base}/account`, { headers: { Authorization: `Bearer ${config.apiKey}` }, signal: _ac.signal });
|
|
83
|
+
clearTimeout(_to);
|
|
84
|
+
if (_r.status === 401 || _r.status === 403)
|
|
85
|
+
_needLogin = true;
|
|
86
|
+
}
|
|
87
|
+
catch { /* ağ hatası → çevrimdışı toleransı: mevcut anahtarla devam et */ }
|
|
88
|
+
}
|
|
89
|
+
if (_needLogin) {
|
|
75
90
|
const _a = await import('./auth.js');
|
|
91
|
+
if (config.apiKey)
|
|
92
|
+
_a.clearStored(); // eski/geçersiz anahtarı temizle
|
|
76
93
|
const _choice = await _a.promptLoginMenu();
|
|
77
94
|
if (_choice !== 'login')
|
|
78
95
|
process.exit(0);
|
|
@@ -83,6 +100,20 @@ if (!config.apiKey) {
|
|
|
83
100
|
config.model = _fresh.model;
|
|
84
101
|
if (!config.apiKey)
|
|
85
102
|
process.exit(0);
|
|
103
|
+
// Login akışı terminal girişini (stdin raw-mode) kirletiyor → TUI'de mesaj kutusuna yazı gitmiyor.
|
|
104
|
+
// Çözüm: temiz durumla OTOMATİK yeniden başlat (güncelleme akışıyla aynı desen). Kullanıcı elle restart yapmaz.
|
|
105
|
+
{
|
|
106
|
+
process.stdout.write('\n ✓ Giris yapildi, baslatiliyor...\n\n');
|
|
107
|
+
const { spawn } = await import('node:child_process');
|
|
108
|
+
const _cmd = process.platform === 'win32' ? 'wormclaude.cmd' : 'wormclaude';
|
|
109
|
+
const _child = spawn(_cmd, process.argv.slice(2), {
|
|
110
|
+
stdio: 'inherit', shell: true,
|
|
111
|
+
env: { ...process.env, WORMCLAUDE_SKIP_UPDATE: '1' },
|
|
112
|
+
});
|
|
113
|
+
_child.on('exit', (code) => process.exit(code ?? 0));
|
|
114
|
+
_child.on('error', () => { process.stdout.write(' Giris tamam. Lutfen "wormclaude" komutunu tekrar calistir.\n'); process.exit(0); });
|
|
115
|
+
await new Promise(() => { }); // çocuk süreci devralana kadar bekle (ana akışa düşme)
|
|
116
|
+
}
|
|
86
117
|
}
|
|
87
118
|
setToolConfig(config); // Agent/alt-agent araçları aynı config'i kullanır
|
|
88
119
|
const MAX_TURNS = Number(process.env.WORMCLAUDE_MAX_TURNS) || 50; // tur limiti
|
package/dist/theme.js
CHANGED