beast-agent 0.23.4 → 0.23.5

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": "0.23.4",
4
+ "version": "0.23.5",
5
5
  "description": "Ultra-fast local agent shell for Windows.",
6
6
  "author": "algokodcom (AlgoKod)",
7
7
  "license": "MIT",
@@ -2325,6 +2325,32 @@ async function renderTgAllow() {
2325
2325
  });
2326
2326
  c.appendChild(sel);
2327
2327
  }
2328
+
2329
+ /* SAHİP rolü — yalnız biri olabilir (WA ile aynı): tıkla → sahiplik devret */
2330
+ const isOwnerEntry = typeof entry === 'object' && !!entry.owner;
2331
+ const ownerBtn = document.createElement('span');
2332
+ ownerBtn.className = 'lk';
2333
+ ownerBtn.style.cssText = 'font-size:11px;padding:1px 6px;' + (isOwnerEntry ? 'color:#c9a227;font-weight:800' : '');
2334
+ ownerBtn.title = isOwnerEntry ? _t('wa_owner_title_on') : _t('wa_owner_title_off');
2335
+ ownerBtn.textContent = isOwnerEntry ? _t('wa_owner_on') : _t('wa_owner_off');
2336
+ ownerBtn.addEventListener('click', async () => {
2337
+ if (isOwnerEntry) return; // sahibi tekrar tıklamayla alma; önce başkasına devret
2338
+ const cur = await beast.tgGetAllow();
2339
+ const next = cur.map((e, i) => {
2340
+ if (typeof e === 'object' && e && e.owner) return { ...e, owner: false };
2341
+ if (i === idx) {
2342
+ const obj = typeof e === 'string' ? { id: e, name: '' } : { ...e };
2343
+ obj.owner = true;
2344
+ return obj;
2345
+ }
2346
+ return e;
2347
+ });
2348
+ const tgt = next[idx];
2349
+ await beast.tgSetAllow(next);
2350
+ renderTgAllow();
2351
+ toast('Sahip: ' + tgLabel(tgt));
2352
+ });
2353
+ c.appendChild(ownerBtn);
2328
2354
  }
2329
2355
  const x = document.createElement('span');
2330
2356
  x.className = 'x';
@@ -2364,7 +2390,13 @@ async function renderTgAllow() {
2364
2390
  v = v.startsWith('@') ? '@' + v.slice(1).replace(/[^\w]/g, '') : v.replace(/[^\d]/g, '');
2365
2391
  if (!v) { toast(_t('it_tg_id_ph')); return; }
2366
2392
  const botId = botSel && botSel.value ? { bot_id: botSel.value } : {};
2367
- await beast.tgSetAllow([...(await beast.tgGetAllow()), { id: v, name, ...botId }]);
2393
+ const next = [...(await beast.tgGetAllow()), { id: v, name, ...botId }];
2394
+ /* İLK EKLENEN KİŞİ OTOMATİK SAHİP — listede sahip yoksa en eski kayıt atanır
2395
+ (sahiplik sonradan chip'teki 'sahip yap' butonundan devredilebilir) */
2396
+ if (!next.some((e) => e && typeof e === 'object' && e.owner)) {
2397
+ if (next.length && typeof next[0] === 'object') next[0].owner = true;
2398
+ }
2399
+ await beast.tgSetAllow(next);
2368
2400
  inp.value = '';
2369
2401
  nameInp.value = '';
2370
2402
  renderTgAllow();