beast-agent 0.17.0 → 0.18.0
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/bin/beast-agent.js +27 -6
- package/package.json +1 -1
- package/src/main.js +66 -12
- package/src/renderer/i18n.js +4 -2
- package/src/renderer/renderer.js +4 -2
package/bin/beast-agent.js
CHANGED
|
@@ -8,13 +8,34 @@
|
|
|
8
8
|
const { spawn, spawnSync } = require('child_process');
|
|
9
9
|
const path = require('path');
|
|
10
10
|
|
|
11
|
-
/* güncelleme modu:
|
|
11
|
+
/* güncelleme modu: çalışan Beast'i kapat (dosya kilidi EBUSY vermesin) → npm güncelle → yeniden başlat */
|
|
12
12
|
if (process.argv[2] === 'update') {
|
|
13
|
-
const
|
|
14
|
-
console.log(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const isWin = process.platform === 'win32';
|
|
14
|
+
console.log('\u27F3 beast-agent g\u00FCncelleniyor\u2026');
|
|
15
|
+
if (isWin) {
|
|
16
|
+
try {
|
|
17
|
+
spawnSync('powershell.exe', ['-NoProfile', '-Command',
|
|
18
|
+
"Get-Process electron -ErrorAction SilentlyContinue | Where-Object { $_.Path -like '*node_modules*beast-agent*' } | Stop-Process -Force"],
|
|
19
|
+
{ stdio: 'ignore' });
|
|
20
|
+
console.log('\u2022 \u00E7al\u0131\u015Fan Beast kapat\u0131ld\u0131 (varsa)');
|
|
21
|
+
spawnSync('powershell.exe', ['-NoProfile', '-Command', 'Start-Sleep -Seconds 2'], { stdio: 'ignore' });
|
|
22
|
+
} catch {}
|
|
23
|
+
} else {
|
|
24
|
+
try { spawnSync('pkill', ['-f', 'node_modules/beast-agent'], { stdio: 'ignore' }); } catch {}
|
|
25
|
+
}
|
|
26
|
+
const r = spawnSync('npm', ['install', '-g', 'beast-agent@latest'], { stdio: 'inherit', shell: isWin });
|
|
27
|
+
if (r.status !== 0) {
|
|
28
|
+
console.log('\n\u2717 g\u00FCncelleme ba\u015Far\u0131s\u0131z \u2014 elle: npm install -g beast-agent@latest');
|
|
29
|
+
process.exit(r.status || 1);
|
|
30
|
+
}
|
|
31
|
+
console.log('\n\u2713 beast-agent g\u00FCncellendi \u2014 uygulama ba\u015Flat\u0131l\u0131yor\u2026');
|
|
32
|
+
try {
|
|
33
|
+
const electron = require('electron');
|
|
34
|
+
if (typeof electron === 'string') {
|
|
35
|
+
spawn(electron, [path.resolve(__dirname, '..')], { stdio: 'ignore', detached: true }).unref();
|
|
36
|
+
}
|
|
37
|
+
} catch {}
|
|
38
|
+
process.exit(0);
|
|
18
39
|
}
|
|
19
40
|
|
|
20
41
|
const electron = require('electron');
|
package/package.json
CHANGED
package/src/main.js
CHANGED
|
@@ -957,9 +957,11 @@ async function tryWaSlash(jid, rawText, senderNum) {
|
|
|
957
957
|
? `*${cmd === 'deny' ? 'Reddedildi' : 'Onaylandı'}:* ${r.tool}${always ? ' — bu araç için bir daha sorulmayacak' : ''}`
|
|
958
958
|
: 'Bekleyen onay yok.';
|
|
959
959
|
} else if (cmd === 'update') {
|
|
960
|
-
/* /update — sürüm kontrol; /update now — indirileni kur */
|
|
960
|
+
/* /update — sürüm kontrol; /update now — indirileni kur (npm modunda kendini günceller) */
|
|
961
961
|
if (String(arg || '').toLowerCase() === 'now') {
|
|
962
|
-
if (
|
|
962
|
+
if (isNpmMode()) {
|
|
963
|
+
npmUpdateNow(async (text) => { out = text; });
|
|
964
|
+
} else if (updateState.downloaded && autoUpdater) {
|
|
963
965
|
out = `*v${updateState.version} kuruluyor* — uygulama yeniden başlayacak.`;
|
|
964
966
|
setTimeout(() => { try { autoUpdater.quitAndInstall(); } catch {} }, 1200);
|
|
965
967
|
} else {
|
|
@@ -2665,7 +2667,9 @@ ipcMain.handle('agent:send', (_e, { sessionId, text }) => {
|
|
|
2665
2667
|
const a = t.slice(7).trim().toLowerCase();
|
|
2666
2668
|
updateReplies.sids.add(String(sessionId || ''));
|
|
2667
2669
|
if (a === 'now') {
|
|
2668
|
-
if (
|
|
2670
|
+
if (isNpmMode()) {
|
|
2671
|
+
npmUpdateNow((text) => desktopEcho(sessionId, t, text));
|
|
2672
|
+
} else if (updateState.downloaded && autoUpdater) {
|
|
2669
2673
|
desktopEcho(sessionId, t, `*v${updateState.version} kuruluyor* — uygulama yeniden başlayacak.`);
|
|
2670
2674
|
setTimeout(() => { try { autoUpdater.quitAndInstall(); } catch {} }, 1200);
|
|
2671
2675
|
} else {
|
|
@@ -3230,8 +3234,31 @@ ipcMain.handle('update:check', async () => {
|
|
|
3230
3234
|
return out;
|
|
3231
3235
|
});
|
|
3232
3236
|
|
|
3237
|
+
/* npm kurulumunda KENDİ KENDİNİ GÜNCELLEME:
|
|
3238
|
+
detached helper bırakır (uygulama çıkınca npm install + yeniden başlatma), sonra app.quit() */
|
|
3239
|
+
function npmSelfUpdate() {
|
|
3240
|
+
try {
|
|
3241
|
+
const electronExe = process.execPath;
|
|
3242
|
+
const appPath = app.getAppPath();
|
|
3243
|
+
if (process.platform === 'win32') {
|
|
3244
|
+
const ps =
|
|
3245
|
+
'Start-Sleep -Seconds 3;' +
|
|
3246
|
+
'npm install -g beast-agent@latest;' +
|
|
3247
|
+
'Start-Sleep -Seconds 1;' +
|
|
3248
|
+
`Start-Process -FilePath '${electronExe}' -ArgumentList '\"${appPath}\"'`;
|
|
3249
|
+
spawn('powershell.exe', ['-NoProfile', '-Command', ps], { detached: true, stdio: 'ignore', windowsHide: true }).unref();
|
|
3250
|
+
} else {
|
|
3251
|
+
const sh = `sleep 3; npm install -g beast-agent@latest; sleep 1; '${electronExe}' '${appPath}' &`;
|
|
3252
|
+
spawn('sh', ['-c', sh], { detached: true, stdio: 'ignore' }).unref();
|
|
3253
|
+
}
|
|
3254
|
+
log.info('main', 'npm self-update: helper bırakıldı, uygulama kapatılıyor');
|
|
3255
|
+
} catch {}
|
|
3256
|
+
setTimeout(() => { try { app.quit(); } catch {} }, 400);
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3233
3259
|
ipcMain.handle('update:install', () => {
|
|
3234
|
-
if (isNpmMode()
|
|
3260
|
+
if (isNpmMode()) { npmSelfUpdate(); return { ok: true, npm: true }; }
|
|
3261
|
+
if (!autoUpdater) return { ok: false, error: 'updater kullanılamıyor' };
|
|
3235
3262
|
if (!updateState.downloaded) return { ok: false, error: 'indirilmiş sürüm yok — önce /update' };
|
|
3236
3263
|
try { autoUpdater.quitAndInstall(); return { ok: true }; } catch (e) {
|
|
3237
3264
|
return { ok: false, error: String((e && e.message) || e) };
|
|
@@ -3249,18 +3276,45 @@ ipcMain.handle('update:setAuto', (_e, cfg) => {
|
|
|
3249
3276
|
});
|
|
3250
3277
|
|
|
3251
3278
|
/* /update komutu (masaüstü + WA): hedefi kaydet, kontrol başlat */
|
|
3279
|
+
/* npm modunda güncelle-şimdi: sürüm kontrolü + numaralarıyla bildir + kendi kendini güncelle */
|
|
3280
|
+
function npmUpdateNow(reply /* fn(text) */) {
|
|
3281
|
+
const current = app.getVersion();
|
|
3282
|
+
getNpmLatest(true).then((v) => {
|
|
3283
|
+
if (v && isNewerVersion(v, current)) {
|
|
3284
|
+
updateState.available = true;
|
|
3285
|
+
updateState.version = v;
|
|
3286
|
+
reply(`🔄 *Güncelleniyor*\nMevcut: v${current}\nYeni: v${v}\nKapanıp yeniden açılıyorum…`);
|
|
3287
|
+
setTimeout(() => npmSelfUpdate(), 1500);
|
|
3288
|
+
} else {
|
|
3289
|
+
reply(`✅ *Güncelsin* — v${current} zaten en son sürüm.`);
|
|
3290
|
+
}
|
|
3291
|
+
}).catch(() => reply('Sürüm kontrol edilemedi — bağlantıyı kontrol et.'));
|
|
3292
|
+
}
|
|
3293
|
+
|
|
3252
3294
|
async function runUpdateCommand(reply /* fn(text) */) {
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
return;
|
|
3256
|
-
}
|
|
3295
|
+
const current = app.getVersion();
|
|
3296
|
+
if (isNpmMode()) return npmUpdateNow(reply);
|
|
3257
3297
|
if (!autoUpdater) {
|
|
3258
|
-
reply('Updater bu modda kullanılamıyor
|
|
3298
|
+
reply('Updater bu modda kullanılamıyor. Yeni sürüm: github.com/algokodcom/beast-agent/releases');
|
|
3259
3299
|
return;
|
|
3260
3300
|
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3301
|
+
/* önce npm registry'den sürüm bilgisi — kullanıcıya numaraları söyle */
|
|
3302
|
+
const v = await getNpmLatest(true);
|
|
3303
|
+
if (v && isNewerVersion(v, current)) {
|
|
3304
|
+
updateState.available = true;
|
|
3305
|
+
updateState.version = v;
|
|
3306
|
+
emitUpdateEvent();
|
|
3307
|
+
reply(`🔄 *Yeni sürüm bulundu*\nMevcut: v${current}\nYeni: v${v}\nİndiriliyor… (kurulum için: /update now)`);
|
|
3308
|
+
try { await autoUpdater.checkForUpdates(); } catch (e) {
|
|
3309
|
+
reply('İndirme başlatılamadı: ' + String((e && e.message) || e));
|
|
3310
|
+
}
|
|
3311
|
+
} else if (v) {
|
|
3312
|
+
reply(`✅ *Güncelsin* — v${current} en son sürüm.`);
|
|
3313
|
+
} else {
|
|
3314
|
+
reply(`🔍 Kontrol ediliyor (mevcut sürüm v${current})…`);
|
|
3315
|
+
try { await autoUpdater.checkForUpdates(); } catch (e) {
|
|
3316
|
+
reply('Kontrol başarısız: ' + String((e && e.message) || e));
|
|
3317
|
+
}
|
|
3264
3318
|
}
|
|
3265
3319
|
}
|
|
3266
3320
|
|
package/src/renderer/i18n.js
CHANGED
|
@@ -72,7 +72,8 @@
|
|
|
72
72
|
up_uptodate: 'Güncel',
|
|
73
73
|
up_downloading: 'İndiriliyor…',
|
|
74
74
|
up_downloaded: 'İndirildi — kurulum için hazır',
|
|
75
|
-
up_npm_mode: 'npm kurulumu —
|
|
75
|
+
up_npm_mode: 'npm kurulumu — güncellemeler otomatik kontrol edilir',
|
|
76
|
+
up_npm_note: 'Yeni sürüm algılanınca buton aktifleşir: uygulama kapanır, güncellenir ve kendiliğinden yeniden açılır. Terminal komutu: beast-agent update',
|
|
76
77
|
up_auto_check: 'Otomatik sürüm kontrolü (açılış + 6 saatte bir)',
|
|
77
78
|
up_auto_dl: 'Yeni sürümü otomatik indir (kapanışta kurulur)',
|
|
78
79
|
up_check_now: 'Şimdi Kontrol Et',
|
|
@@ -422,7 +423,8 @@
|
|
|
422
423
|
up_uptodate: 'Up to date',
|
|
423
424
|
up_downloading: 'Downloading…',
|
|
424
425
|
up_downloaded: 'Downloaded — ready to install',
|
|
425
|
-
up_npm_mode: 'npm install —
|
|
426
|
+
up_npm_mode: 'npm install — updates are checked automatically',
|
|
427
|
+
up_npm_note: 'The button activates when a new version is detected: the app closes, updates and relaunches by itself. Terminal command: beast-agent update',
|
|
426
428
|
up_auto_check: 'Automatic version check (on startup + every 6 hours)',
|
|
427
429
|
up_auto_dl: 'Auto-download new versions (installed on quit)',
|
|
428
430
|
up_check_now: 'Check Now',
|
package/src/renderer/renderer.js
CHANGED
|
@@ -1582,8 +1582,10 @@ async function renderUpdatePane() {
|
|
|
1582
1582
|
<label class="lock-row"><input type="checkbox" id="upAutoDl" ${st.autoDownload ? 'checked' : ''}/><span>${_t('up_auto_dl')}</span></label>
|
|
1583
1583
|
</div>` +
|
|
1584
1584
|
(st.npm
|
|
1585
|
-
? `<div class="
|
|
1586
|
-
|
|
1585
|
+
? `<div class="form-grid" style="grid-template-columns:auto auto;gap:8px;margin-top:12px">
|
|
1586
|
+
<button id="upInstall" class="btn ghost" ${st.available ? '' : 'disabled style="opacity:.45;cursor:default"'}>${_t('up_install_now')}</button>
|
|
1587
|
+
</div>
|
|
1588
|
+
<div class="sub" style="margin-top:8px">${_t('up_npm_note')}</div>`
|
|
1587
1589
|
: `<div class="form-grid" style="grid-template-columns:auto auto;gap:8px;margin-top:12px">
|
|
1588
1590
|
<button id="upCheck" class="btn ghost">${_t('up_check_now')}</button>
|
|
1589
1591
|
<button id="upInstall" class="btn ghost" ${st.downloaded ? '' : 'disabled style="opacity:.45;cursor:default"'}>${_t('up_install_now')}</button>
|