beast-agent 2.7.2 → 2.7.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 +1 -1
- package/src/agent/engine.js +3 -0
- package/src/main.js +54 -9
- package/src/renderer/renderer.js +13 -0
package/package.json
CHANGED
package/src/agent/engine.js
CHANGED
|
@@ -2350,6 +2350,9 @@ class Engine {
|
|
|
2350
2350
|
) {
|
|
2351
2351
|
lastMsg.content = (lastMsg.content + '\n\n' + body).slice(0, USER_MAX);
|
|
2352
2352
|
this._rewriteLastMsg(s.id, lastMsg.content, null, 'assistant');
|
|
2353
|
+
/* UI'ya bildir: birleştirme yeni bubble basmaz — son asistan balonu
|
|
2354
|
+
güncellenir (yoksa proaktif not ekranda hiç görünmezdi) */
|
|
2355
|
+
this.emit({ type: 'message-merge', sessionId: s.id, message: lastMsg });
|
|
2353
2356
|
this.emit({ type: 'sessions' });
|
|
2354
2357
|
return true;
|
|
2355
2358
|
}
|
package/src/main.js
CHANGED
|
@@ -3000,6 +3000,7 @@ function reloadBackend() {
|
|
|
3000
3000
|
emit: (ev) => {
|
|
3001
3001
|
if (win && !win.isDestroyed()) win.webContents.send('agent:event', ev);
|
|
3002
3002
|
try { empatiRememberFromEvent(ev); } catch {} /* empati hafızası: sohbet → kayıt + ilgi öğrenme */
|
|
3003
|
+
empatiFlushInjectsOnDone(ev); /* tur ortasında kuyruğa düşen proaktif bildirimleri iş bitince geçmişe bas */
|
|
3003
3004
|
flushDesktopOnDone(ev); /* biriken desktop mesajlarını sıraya bas */
|
|
3004
3005
|
bcFlushOnDone(ev); /* Beast Code kuyruğunu iş bitiminde boşalt */
|
|
3005
3006
|
stFlushOnDone(ev); /* Beast Studio kuyruğunu iş bitiminde boşalt */
|
|
@@ -6472,11 +6473,51 @@ function empatiSourceLineWa(ev) {
|
|
|
6472
6473
|
return title ? '🔗 ' + cap(title, 80) : '';
|
|
6473
6474
|
}
|
|
6474
6475
|
|
|
6476
|
+
/* Enjeksiyon kuyruğu: oturum TUR ORTASINDAYKEN (ajan bir işle uğraşırken)
|
|
6477
|
+
gelen proaktif bildirimi sessizce DÜŞÜRME — eskisi tam olarak buydu:
|
|
6478
|
+
"bazen ajan konudan haber olmuyor". Metin kuyrukta bekler, oturumun
|
|
6479
|
+
işi bitince ('done'/'error') geçmişe asistan mesajı olarak yazılır;
|
|
6480
|
+
model bir sonraki turda "ben bu bildirimi attım" der, kullanıcı sorusuna
|
|
6481
|
+
hazırdır. */
|
|
6482
|
+
const empatiInjectQueue = new Map(); // sid -> [text]
|
|
6483
|
+
const EMPATI_INJECT_QUEUE_CAP = 20;
|
|
6484
|
+
|
|
6475
6485
|
function empatiInjectToSession(sid, out) {
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6486
|
+
const target = String(sid || '');
|
|
6487
|
+
const body = String(out || '');
|
|
6488
|
+
if (!target || !body.trim()) return;
|
|
6489
|
+
let busy = false;
|
|
6490
|
+
try { busy = engine.isBusy(target); } catch {}
|
|
6491
|
+
if (busy) {
|
|
6492
|
+
let q = empatiInjectQueue.get(target);
|
|
6493
|
+
if (!q) {
|
|
6494
|
+
q = [];
|
|
6495
|
+
empatiInjectQueue.set(target, q);
|
|
6496
|
+
}
|
|
6497
|
+
if (q.length < EMPATI_INJECT_QUEUE_CAP) {
|
|
6498
|
+
q.push(body);
|
|
6499
|
+
empatiLog(`bildirim enjeksiyonu kuyrukta (ajan tur sürüyor) sid=${target} bekleyen=${q.length}`);
|
|
6500
|
+
}
|
|
6501
|
+
return;
|
|
6502
|
+
}
|
|
6503
|
+
try { engine.injectAssistant(target, body); } catch {}
|
|
6504
|
+
}
|
|
6505
|
+
|
|
6506
|
+
/* iş bitince (done/error) biriken proaktif enjeksiyonları geçmişe bas.
|
|
6507
|
+
'done' eventi isBusy temizlenmeden ÖNCE gelir (engine.js: ctrl delete
|
|
6508
|
+
finally bloğunda) — flushDesktopOnDone gibi macrotask'a ertele. */
|
|
6509
|
+
function empatiFlushInjectsOnDone(ev) {
|
|
6510
|
+
if (!ev || !ev.sessionId || (ev.type !== 'done' && ev.type !== 'error')) return;
|
|
6511
|
+
const q = empatiInjectQueue.get(String(ev.sessionId));
|
|
6512
|
+
if (!q || !q.length) return;
|
|
6513
|
+
empatiInjectQueue.delete(String(ev.sessionId));
|
|
6514
|
+
setTimeout(() => {
|
|
6515
|
+
/* empatiInjectToSession üzerinden: arada yeni tur başladıysa yeniden kuyruğa düşer */
|
|
6516
|
+
for (const text of q) {
|
|
6517
|
+
try { empatiInjectToSession(String(ev.sessionId), text); } catch {}
|
|
6518
|
+
}
|
|
6519
|
+
empatiLog(`kuyrukta bekleyen ${q.length} proaktif bildirim geçmişe işlendi sid=${ev.sessionId}`);
|
|
6520
|
+
}, 250);
|
|
6480
6521
|
}
|
|
6481
6522
|
|
|
6482
6523
|
/* kanala giden metin + Beast'in İÇ bağlamı ayrıdır: kullanıcı linki silse bile
|
|
@@ -6635,12 +6676,16 @@ function empatiNotify(text, ev) {
|
|
|
6635
6676
|
for (const fn of senders) {
|
|
6636
6677
|
try { fn(); sent++; } catch {}
|
|
6637
6678
|
}
|
|
6638
|
-
/*
|
|
6639
|
-
|
|
6679
|
+
/* MASAÜSTÜ CHAT UI: entegrasyon kullanılsa da kullanılmasa da proaktif mesaj
|
|
6680
|
+
sohbette MESAJ olarak görünür (asistan balonu) + toast çıkar. Ajan da
|
|
6681
|
+
desktop oturumu geçmişinde attığı bildirimi GÖRÜR — hangi kanala gittiğine
|
|
6682
|
+
bakmaksızın konudan haberdar olur. Kanal oturumlarına ise BAĞLAM'lı `inject`
|
|
6683
|
+
gider (kanal kullanıcısı ham BAĞLAM bloğunu görmez, ajan görür). */
|
|
6640
6684
|
try {
|
|
6641
|
-
if (
|
|
6642
|
-
|
|
6643
|
-
|
|
6685
|
+
if (win && !win.isDestroyed()) {
|
|
6686
|
+
const dsid = empatiDesktopSid();
|
|
6687
|
+
empatiInjectToSession(dsid, out);
|
|
6688
|
+
win.webContents.send('agent:event', { type: 'proactive', sessionId: dsid, id: ev.id, level: ev.level, title: ev.title, text: out });
|
|
6644
6689
|
}
|
|
6645
6690
|
} catch {}
|
|
6646
6691
|
}
|
package/src/renderer/renderer.js
CHANGED
|
@@ -5019,6 +5019,19 @@ function onEvent(ev) {
|
|
|
5019
5019
|
if (!hasTools) closeChatToolGroup();
|
|
5020
5020
|
}
|
|
5021
5021
|
break;
|
|
5022
|
+
case 'message-merge':
|
|
5023
|
+
/* proaktif not son asistan mesajına BİRLEŞTİRİLDİ (injectAssistant) —
|
|
5024
|
+
yeni bubble basma; son asistan balonunun içeriğini güncelle */
|
|
5025
|
+
{
|
|
5026
|
+
const bubbles = els.msgs.querySelectorAll('.msg-assistant .md');
|
|
5027
|
+
const el = bubbles[bubbles.length - 1];
|
|
5028
|
+
const txt = String((ev.message && ev.message.content) || '');
|
|
5029
|
+
if (el && txt) {
|
|
5030
|
+
el.innerHTML = md(txt);
|
|
5031
|
+
scrollDown();
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
break;
|
|
5022
5035
|
case 'token':
|
|
5023
5036
|
ensureStreamBubble();
|
|
5024
5037
|
streamRaw += ev.delta;
|