beast-agent 2.8.1 → 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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "beast-agent",
3
3
  "productName": "Beast Agent",
4
- "version": "2.8.1",
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
  }
@@ -317,9 +317,13 @@ function onNetEvent(ev) {
317
317
  }
318
318
 
319
319
  const TODO_GLYPH = { done: '✓', active: '▸', pending: '○' };
320
+ const TODO_DONE_HIDE_MS = 2500; /* tüm görevler bitince liste bu kadar sonra otomatik kapanır */
321
+ let todoHideTimer = null;
320
322
 
321
323
  function renderTodos(items) {
322
324
  const list = Array.isArray(items) ? items : [];
325
+ clearTimeout(todoHideTimer);
326
+ todoHideTimer = null;
323
327
  if (!list.length) { els.todoPanel.hidden = true; els.todoPanel.innerHTML = ''; return; }
324
328
  const done = list.filter((t) => t.status === 'done').length;
325
329
  const rows = list
@@ -333,10 +337,23 @@ function renderTodos(items) {
333
337
  `<span class="td-right"><span class="td-count">${done}/${list.length}</span>` +
334
338
  `<button class="td-x" title="${_t('td_hide')}">×</button></span></div>` + rows;
335
339
  els.todoPanel.hidden = false;
340
+ /* tüm görevler bitti → kullanıcı tamamlanan listeyi görsün diye kısa beklet,
341
+ sonra panel otomatik kapanır; yeni görev gelirse zamanlayıcı iptal olur */
342
+ if (done === list.length) {
343
+ todoHideTimer = setTimeout(() => {
344
+ todoHideTimer = null;
345
+ els.todoPanel.hidden = true;
346
+ els.todoPanel.innerHTML = '';
347
+ }, TODO_DONE_HIDE_MS);
348
+ }
336
349
  /* X yalnız BU listeyi gizler — kalıcı kapanma yok: bir sonraki görev
337
350
  güncellemesi (yeni görev eklendi / görev yapıldı) paneli yeniden gösterir */
338
351
  const x = els.todoPanel.querySelector('.td-x');
339
- if (x) x.addEventListener('click', () => { els.todoPanel.hidden = true; });
352
+ if (x) x.addEventListener('click', () => {
353
+ clearTimeout(todoHideTimer);
354
+ todoHideTimer = null;
355
+ els.todoPanel.hidden = true;
356
+ });
340
357
  }
341
358
  function setBusy(b) {
342
359
  busy = b;
@@ -8504,9 +8521,12 @@ function bcToolBoxEnd(callId, ok, result, diff) {
8504
8521
  /* ---------- Beast Code todo kartı ----------
8505
8522
  Inputun (chat) hemen üstünde ortalı kompakt kutu; #bcTodoWrap içinde yaşar,
8506
8523
  scroll'lu çıktı akışını kirletmez. */
8524
+ let bcTodoHideTimer = null;
8507
8525
  function bcRenderTodos(todos) {
8508
8526
  const list = Array.isArray(todos) ? todos : [];
8509
8527
  if (!els.bcTodoWrap) return;
8528
+ clearTimeout(bcTodoHideTimer);
8529
+ bcTodoHideTimer = null;
8510
8530
  bcFlushStream();
8511
8531
  if (!list.length) {
8512
8532
  bcHideTodos();
@@ -8531,9 +8551,18 @@ function bcRenderTodos(todos) {
8531
8551
  row.querySelector('.bc-todotext').textContent = String(t.title || '');
8532
8552
  wrap.appendChild(row);
8533
8553
  }
8554
+ /* tüm görevler bitti → kısa görün, sonra kart otomatik kapanır */
8555
+ if (done === list.length) {
8556
+ bcTodoHideTimer = setTimeout(() => {
8557
+ bcTodoHideTimer = null;
8558
+ bcHideTodos();
8559
+ }, TODO_DONE_HIDE_MS);
8560
+ }
8534
8561
  }
8535
8562
 
8536
8563
  function bcHideTodos() {
8564
+ clearTimeout(bcTodoHideTimer);
8565
+ bcTodoHideTimer = null;
8537
8566
  if (els.bcTodoWrap) {
8538
8567
  els.bcTodoWrap.hidden = true;
8539
8568
  els.bcTodoWrap.innerHTML = '';
@@ -8961,9 +8990,12 @@ function stNoteStream(delta) {
8961
8990
  return true;
8962
8991
  }
8963
8992
 
8993
+ let stTodoHideTimer = null;
8964
8994
  function stRenderTodos(todos) {
8965
8995
  const list = Array.isArray(todos) ? todos : [];
8966
8996
  if (!els.stTodoWrap) return;
8997
+ clearTimeout(stTodoHideTimer);
8998
+ stTodoHideTimer = null;
8967
8999
  stFlushStream();
8968
9000
  if (!list.length) {
8969
9001
  stHideTodos();
@@ -8988,9 +9020,18 @@ function stRenderTodos(todos) {
8988
9020
  row.querySelector('.bc-todotext').textContent = String(t.title || '');
8989
9021
  wrap.appendChild(row);
8990
9022
  }
9023
+ /* tüm görevler bitti → kısa görün, sonra kart otomatik kapanır */
9024
+ if (done === list.length) {
9025
+ stTodoHideTimer = setTimeout(() => {
9026
+ stTodoHideTimer = null;
9027
+ stHideTodos();
9028
+ }, TODO_DONE_HIDE_MS);
9029
+ }
8991
9030
  }
8992
9031
 
8993
9032
  function stHideTodos() {
9033
+ clearTimeout(stTodoHideTimer);
9034
+ stTodoHideTimer = null;
8994
9035
  if (els.stTodoWrap) {
8995
9036
  els.stTodoWrap.hidden = true;
8996
9037
  els.stTodoWrap.innerHTML = '';