beast-agent 2.8.2 → 2.8.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/main.js +14 -6
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "beast-agent",
3
3
  "productName": "Beast Agent",
4
- "version": "2.8.2",
4
+ "version": "2.8.3",
5
5
  "description": "Ultra-fast local agent shell for Windows.",
6
6
  "author": "algokodcom (AlgoKod)",
7
7
  "license": "MIT",
package/src/main.js CHANGED
@@ -6205,19 +6205,27 @@ function cronEmit() {
6205
6205
  const cronAnswerPending = new Map();
6206
6206
 
6207
6207
  /* OTOMATİK YENİ SOHBET YOK: cron/izleyici/fallout tetiklendiğinde oturum
6208
- seçimi — kayıtlı id geçerliyse O, değilse EN GÜNCEL oturum kullanılır.
6209
- Hiç oturum yoksa (ilk kurulum) yeni açılır. Böylece soldaki sohbet
6210
- geçmişine "+ Yeni Sohbet" olmadan hayalet sohbetler düşmez. */
6208
+ seçimi — kayıtlı id'nin DOSYASI hâlâ duruyorsa O, değilse EN GÜNCEL
6209
+ (meşgul olmayan) oturum kullanılır; hiç oturum yoksa (ilk kurulum) yeni
6210
+ açılır. Böylece soldaki sohbet geçmişine "+ Yeni Sohbet" olmadan hayalet
6211
+ sohbetler düşmez.
6212
+ DİKKAT: _load(id) silinmiş oturum için bile boş bir hayalet nesne
6213
+ üretip truthy döner — canlılık kontrolü MUTLAKA sessionFileAlive ile
6214
+ yapılır (ensureWa/Tg/DcSession ile aynı kural). Ayrıca meşgul oturuma
6215
+ send() mesajı DÜŞÜRÜR (false döner, cron cevabı kaybolur) — o yüzden
6216
+ meşgul oturumlar da atlanır. */
6211
6217
  function reuseOrLatestSession(preferredId) {
6212
6218
  const sid = String(preferredId || '');
6213
- if (sid) {
6219
+ if (sid && sessionFileAlive(sid)) {
6214
6220
  try {
6215
- if (engine._load(sid)) return sid;
6221
+ if (engine._load(sid) && !engine.isBusy(sid)) return sid;
6216
6222
  } catch {}
6217
6223
  }
6218
6224
  try {
6219
6225
  const list = engine.listSessions(); // updatedAt'e göre yeni→eski sıralı
6220
- if (list.length) return String(list[0].id);
6226
+ for (const v of list) {
6227
+ if (!engine.isBusy(v.id)) return String(v.id);
6228
+ }
6221
6229
  } catch {}
6222
6230
  return engine.createSession().id;
6223
6231
  }