beast-agent 2.44.13 → 2.45.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.
@@ -6187,29 +6187,13 @@ function onEvent(ev) {
6187
6187
  if (!busy) break;
6188
6188
  setStatus(ev.status === 'idle' ? (busy ? 'düşünüyor…' : '') : ev.status === 'thinking' ? 'düşünüyor…' : ev.status + '…');
6189
6189
  break;
6190
- case 'term-out': {
6191
- /* KALICI CMD: her komutun sonunda marker satırı gelir —
6192
- __BEAST_EOF__<yol>__BEAST_EOF__ → yazdırılmaz, cwd güncellenir, kilit açılır */
6193
- const chunk = String(ev.chunk || '');
6194
- if (ev.stream === 'err') { termLine('t-err', chunk, false); break; }
6195
- termPendBuf += chunk;
6196
- const parts = termPendBuf.split(/\r?\n/);
6197
- termPendBuf = parts.pop(); /* son yarım satır bekler */
6198
- for (const line of parts) {
6199
- const m = /__BEAST_EOF__(.*)__BEAST_EOF__/.exec(line.trim());
6200
- if (m) {
6201
- const cwd2 = m[1].trim();
6202
- if (cwd2) {
6203
- els.termCwd.textContent = cwd2;
6204
- els.termCwd.title = cwd2;
6205
- }
6206
- termCmdDone({ code: 0, silent: true });
6207
- continue;
6208
- }
6209
- if (line.trim()) termLine('t-out', line, false);
6210
- }
6190
+ case 'term-out':
6191
+ termHandleOut(ev);
6192
+ break;
6193
+ case 'term-batch':
6194
+ /* main 80ms'de bir birleştirilmiş çıktı paketi gönderir (IPC/satır yükü azalır) */
6195
+ for (const sub of (ev.events || [])) termHandleOut({ ...sub, id: ev.id });
6211
6196
  break;
6212
- }
6213
6197
  case 'term-end':
6214
6198
  termCmdDone(ev);
6215
6199
  break;
@@ -6316,6 +6300,7 @@ function termSetHeight(h) {
6316
6300
  function termSetOpen(v) {
6317
6301
  termOpen = !!v;
6318
6302
  els.termPanel.hidden = !v;
6303
+ if (v) termFlushLines(); // panel kapalıyken biriken satırlar şimdi basılır
6319
6304
  els.termResize.hidden = !v || ideModeOn(); /* IDE'de terminal bölme içi — boyutlandırma yok */
6320
6305
  document.body.classList.toggle('term-open', v);
6321
6306
  termSetShell(termShell);
@@ -6344,16 +6329,38 @@ function termScroll(force) {
6344
6329
  if (force || near) b.scrollTop = b.scrollHeight;
6345
6330
  }
6346
6331
 
6347
- function termLine(cls, text, time = true) {
6348
- const el = document.createElement('div');
6349
- el.className = 't-line ' + (cls || '');
6350
- const ts = time ? '<span class="t-time">' + new Date().toTimeString().slice(0, 8) + '</span> ' : '';
6351
- el.innerHTML = ts + escapeHtml(String(text ?? ''));
6352
- els.termOut.appendChild(el);
6332
+ /* satır KUYRUĞU: komut çıktısı hızlı akarken satır satır DOM + scroll/layout
6333
+ renderer'ı kilitliyordu ("Yanıt vermiyor"). Satırlar tampona girer, 100ms'de
6334
+ bir TEK fragment ile DOM'a basılır; panel kapalıysa DOM'a hiç dokunulmaz. */
6335
+ let termLineBuf = [];
6336
+ let termLineTimer = null;
6337
+
6338
+ function termFlushLines() {
6339
+ if (termLineTimer) { clearTimeout(termLineTimer); termLineTimer = null; }
6340
+ if (!termLineBuf.length || !els.termOut) return;
6341
+ const items = termLineBuf.splice(0);
6342
+ const frag = document.createDocumentFragment();
6343
+ for (const it of items) {
6344
+ const el = document.createElement('div');
6345
+ el.className = 't-line ' + (it.cls || '');
6346
+ const ts = it.time ? '<span class="t-time">' + new Date().toTimeString().slice(0, 8) + '</span> ' : '';
6347
+ el.innerHTML = ts + escapeHtml(String(it.text ?? ''));
6348
+ frag.appendChild(el);
6349
+ }
6350
+ els.termOut.appendChild(frag);
6353
6351
  while (els.termOut.childElementCount > TERM_MAX_LINES) els.termOut.removeChild(els.termOut.firstChild);
6354
6352
  termScroll();
6355
6353
  }
6356
6354
 
6355
+ function termLine(cls, text, time = true) {
6356
+ termLineBuf.push({ cls, text, time });
6357
+ const cap = TERM_MAX_LINES * 2;
6358
+ if (termLineBuf.length > cap) termLineBuf.splice(0, termLineBuf.length - cap);
6359
+ if (!termOpen) return; /* panel kapalı — açılınca termFlushLines ile basılır */
6360
+ if (termLineBuf.length >= 300) termFlushLines();
6361
+ else if (!termLineTimer) termLineTimer = setTimeout(termFlushLines, 100);
6362
+ }
6363
+
6357
6364
  function termBanner(cwd) {
6358
6365
  if (termBannerDone) return;
6359
6366
  termBannerDone = true;
@@ -6392,6 +6399,29 @@ function termAgentEvent(ev) {
6392
6399
  }
6393
6400
  }
6394
6401
 
6402
+ /* KALICI CMD çıktısı: her komutun sonunda marker satırı gelir —
6403
+ __BEAST_EOF__<yol>__BEAST_EOF__ → yazdırılmaz, cwd güncellenir, kilit açılır */
6404
+ function termHandleOut(ev) {
6405
+ const chunk = String(ev.chunk || '');
6406
+ if (ev.stream === 'err') { termLine('t-err', chunk, false); return; }
6407
+ termPendBuf += chunk;
6408
+ const parts = termPendBuf.split(/\r?\n/);
6409
+ termPendBuf = parts.pop(); /* son yarım satır bekler */
6410
+ for (const line of parts) {
6411
+ const m = /__BEAST_EOF__(.*)__BEAST_EOF__/.exec(line.trim());
6412
+ if (m) {
6413
+ const cwd2 = m[1].trim();
6414
+ if (cwd2) {
6415
+ els.termCwd.textContent = cwd2;
6416
+ els.termCwd.title = cwd2;
6417
+ }
6418
+ termCmdDone({ code: 0, silent: true });
6419
+ continue;
6420
+ }
6421
+ if (line.trim()) termLine('t-out', line, false);
6422
+ }
6423
+ }
6424
+
6395
6425
  function termCmdDone(ev) {
6396
6426
  termRunning = false;
6397
6427
  els.termStop.hidden = true;
@@ -7712,7 +7742,7 @@ async function init() {
7712
7742
  try { termSetHeight(parseInt(localStorage.getItem('beast.termH')) || 180); } catch {}
7713
7743
  if (els.termCBtn) els.termCBtn.addEventListener('click', () => termToggle('cmd'));
7714
7744
  if (els.termClose) els.termClose.addEventListener('click', () => termSetOpen(false));
7715
- if (els.termClear) els.termClear.addEventListener('click', () => { els.termOut.innerHTML = ''; });
7745
+ if (els.termClear) els.termClear.addEventListener('click', () => { els.termOut.innerHTML = ''; termLineBuf = []; });
7716
7746
  if (els.termStop) els.termStop.addEventListener('click', () => beast.terminalStop().catch(() => {}));
7717
7747
  if (els.termInput) els.termInput.addEventListener('keydown', (e) => {
7718
7748
  if (e.key === 'Enter') {