beast-agent 2.23.0 → 2.23.1

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.23.0",
4
+ "version": "2.23.1",
5
5
  "description": "Ultra-fast local agent shell for Windows.",
6
6
  "author": "algokodcom (AlgoKod)",
7
7
  "license": "MIT",
@@ -2718,7 +2718,13 @@ class Engine {
2718
2718
  }
2719
2719
  this.emit({ type: 'message', sessionId: s.id, message: msg });
2720
2720
  this.emit({ type: 'sessions' });
2721
- this._run(s).catch(() => {});
2721
+ /* sessiz catch YOK: tur kurulumu patlarsa hata UI'ya düşsün —
2722
+ "ajan cvp vermiyor, hata görünmüyor" bu yüzdendi */
2723
+ this._run(s).catch((e) => {
2724
+ try {
2725
+ this.emit({ type: 'error', sessionId: s.id, error: String((e && e.message) || e) });
2726
+ } catch {}
2727
+ });
2722
2728
  return true;
2723
2729
  }
2724
2730
 
@@ -3074,6 +3080,19 @@ class Engine {
3074
3080
 
3075
3081
  /* #17 iş kayıtlarını diske yaz — uygulama kapansa da geçmiş dursun.
3076
3082
  Oturum dosyası silinmiş işler (elle silinmiş) geri yazılmaz. */
3083
+ /* ATOMİK YAZIM: önce .tmp sonra rename — iki instance çakışsın ya da
3084
+ proses yazım ortasında ölse bile dosya ASLA 0 bayt bozulmaz
3085
+ (bg-jobs.json 0 bayt olunca tüm ajanlar kayboluyordu) */
3086
+ _atomicWrite(file, data) {
3087
+ try {
3088
+ const tmp = file + '.tmp';
3089
+ fs.writeFileSync(tmp, data);
3090
+ fs.renameSync(tmp, file);
3091
+ } catch {
3092
+ try { fs.writeFileSync(file, data); } catch {}
3093
+ }
3094
+ }
3095
+
3077
3096
  _saveBgJobs() {
3078
3097
  try {
3079
3098
  const jobs = [];
@@ -3083,7 +3102,7 @@ class Engine {
3083
3102
  delete c._persisted;
3084
3103
  jobs.push(c);
3085
3104
  }
3086
- fs.writeFileSync(this._bgJobsFile, JSON.stringify({ v: 1, jobs }) + '\n');
3105
+ this._atomicWrite(this._bgJobsFile, JSON.stringify({ v: 1, jobs }) + '\n');
3087
3106
  } catch {}
3088
3107
  }
3089
3108
 
@@ -6229,7 +6248,11 @@ Engine.prototype._agentDmSend = function (fromSid, args) {
6229
6248
  if (sid === String(fromSid)) continue;
6230
6249
  if (!s || s.bgJob || s.isBotDm) continue;
6231
6250
  if (s.botId && s.botId !== 'beast') continue;
6232
- const hay = [s.bgTitle, s.title, s.code].map((x) => String(x || '').toLowerCase());
6251
+ /* tam başlık da eşleşir: ajan DM'den gelen "Beast · KOD" başlığıyla
6252
+ cevap verir — fromTitle formatı birebir tanınmalı */
6253
+ const hay = [s.bgTitle, s.title, s.code, s.code ? 'beast · ' + s.code : ''].map((x) =>
6254
+ String(x || '').toLowerCase()
6255
+ );
6233
6256
  if (hay.some((x) => x && x.includes(q))) {
6234
6257
  target = sid;
6235
6258
  break;
@@ -6356,7 +6379,7 @@ Engine.prototype._persistAgentDms = function () {
6356
6379
  try {
6357
6380
  const groups = {};
6358
6381
  for (const [, g] of this._agentGroups || new Map()) groups[g.id] = g;
6359
- fs.writeFileSync(this._agentDmsFile, JSON.stringify({ dms: this._agentDms, groups }, null, 2));
6382
+ this._atomicWrite(this._agentDmsFile, JSON.stringify({ dms: this._agentDms, groups }, null, 2));
6360
6383
  } catch {}
6361
6384
  };
6362
6385