beast-agent 1.3.0 → 1.3.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 +1 -1
- package/src/renderer/renderer.js +103 -18
- package/src/renderer/style.css +12 -0
package/package.json
CHANGED
package/src/renderer/renderer.js
CHANGED
|
@@ -2473,7 +2473,7 @@ async function renderWaAllow() {
|
|
|
2473
2473
|
`<select class="perm-select" title="${_t('bot_bind_title')}">` +
|
|
2474
2474
|
`<option value="">${_t('bot_sel_empty')}</option>` +
|
|
2475
2475
|
botChoices
|
|
2476
|
-
.map((bb) => `<option value="${bb.id}" ${cur === bb.id ? 'selected' : ''}>${
|
|
2476
|
+
.map((bb) => `<option value="${bb.id}" ${cur === bb.id ? 'selected' : ''}>${escapeHtml(bb.name)}</option>`)
|
|
2477
2477
|
.join('') +
|
|
2478
2478
|
`</select>`;
|
|
2479
2479
|
wrap.innerHTML = '';
|
|
@@ -2654,7 +2654,7 @@ async function renderWaAllow() {
|
|
|
2654
2654
|
botSel.innerHTML =
|
|
2655
2655
|
`<option value="">${_t('bot_sel_empty')}</option>` +
|
|
2656
2656
|
botChoices
|
|
2657
|
-
.map((bb) => `<option value="${bb.id}">${
|
|
2657
|
+
.map((bb) => `<option value="${bb.id}">${escapeHtml(bb.name)}${bb.admin ? ' (admin)' : ''}</option>`)
|
|
2658
2658
|
.join('');
|
|
2659
2659
|
if (prev) botSel.value = prev; // render'lar arası seçim korunur
|
|
2660
2660
|
}
|
|
@@ -2819,7 +2819,7 @@ async function renderTgAllow() {
|
|
|
2819
2819
|
for (const bb of botChoices) {
|
|
2820
2820
|
const o = document.createElement('option');
|
|
2821
2821
|
o.value = bb.id;
|
|
2822
|
-
o.textContent =
|
|
2822
|
+
o.textContent = bb.name;
|
|
2823
2823
|
if ((typeof entry === 'object' && entry.bot_id) === bb.id) o.selected = true;
|
|
2824
2824
|
sel.appendChild(o);
|
|
2825
2825
|
}
|
|
@@ -2888,7 +2888,7 @@ async function renderTgAllow() {
|
|
|
2888
2888
|
botSel.innerHTML =
|
|
2889
2889
|
`<option value="">${_t('bot_sel_empty')}</option>` +
|
|
2890
2890
|
botChoices
|
|
2891
|
-
.map((bb) => `<option value="${bb.id}">${
|
|
2891
|
+
.map((bb) => `<option value="${bb.id}">${escapeHtml(bb.name)}${bb.admin ? ' (admin)' : ''}</option>`)
|
|
2892
2892
|
.join('');
|
|
2893
2893
|
if (prev) botSel.value = prev;
|
|
2894
2894
|
}
|
|
@@ -3017,7 +3017,7 @@ async function renderDcAllow() {
|
|
|
3017
3017
|
for (const bb of botChoices) {
|
|
3018
3018
|
const o = document.createElement('option');
|
|
3019
3019
|
o.value = bb.id;
|
|
3020
|
-
o.textContent =
|
|
3020
|
+
o.textContent = bb.name;
|
|
3021
3021
|
if ((typeof entry === 'object' && entry.bot_id) === bb.id) o.selected = true;
|
|
3022
3022
|
sel.appendChild(o);
|
|
3023
3023
|
}
|
|
@@ -3084,7 +3084,7 @@ async function renderDcAllow() {
|
|
|
3084
3084
|
botSel.innerHTML =
|
|
3085
3085
|
`<option value="">${_t('bot_sel_empty')}</option>` +
|
|
3086
3086
|
botChoices
|
|
3087
|
-
.map((bb) => `<option value="${bb.id}">${
|
|
3087
|
+
.map((bb) => `<option value="${bb.id}">${escapeHtml(bb.name)}${bb.admin ? ' (admin)' : ''}</option>`)
|
|
3088
3088
|
.join('');
|
|
3089
3089
|
if (prev) botSel.value = prev;
|
|
3090
3090
|
}
|
|
@@ -3118,7 +3118,86 @@ async function renderDcAllow() {
|
|
|
3118
3118
|
Sol panel altında bot kartları; her bot için sohbet geçmişi + sekmeli yönetim.
|
|
3119
3119
|
İlk bot hep Beast (admin, silinemez). Max 5 bot. */
|
|
3120
3120
|
|
|
3121
|
-
|
|
3121
|
+
/* Bot ikonları: tek renkli SVG (stroke: currentColor — monokrom temaya uyar).
|
|
3122
|
+
Anahtar isimler data-ic/bot.icon olarak saklanır; eski botlardaki emoji
|
|
3123
|
+
LEGACY_BOT_ICONS ile otomatik yeni ikona eşlenir (görüntüde de, seçicide de). */
|
|
3124
|
+
const BOT_ICONS = ['lion', 'rocket', 'diamond', 'star', 'flame', 'calc', 'chart', 'robot', 'fox', 'panda', 'target', 'wrench'];
|
|
3125
|
+
const BOT_ICON_PATHS = {
|
|
3126
|
+
lion:
|
|
3127
|
+
'<circle cx="12" cy="12" r="7.2"/>' +
|
|
3128
|
+
'<path d="M12 4.8V2.6M12 21.4v-2.2M4.8 12H2.6M21.4 12h-2.2M6.8 6.8 5.2 5.2M18.8 5.2l-1.6 1.6M6.8 17.2l-1.6 1.6M18.8 18.8l-1.6-1.6"/>' +
|
|
3129
|
+
'<path d="M9.2 10.6h.01M14.8 10.6h.01M12 13.2l-1.2 1.4h2.4z"/>',
|
|
3130
|
+
rocket:
|
|
3131
|
+
'<path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"/>' +
|
|
3132
|
+
'<path d="m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"/>' +
|
|
3133
|
+
'<path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"/>' +
|
|
3134
|
+
'<path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"/>',
|
|
3135
|
+
diamond:
|
|
3136
|
+
'<path d="M6 3h12l4 6-10 13L2 9z"/>' +
|
|
3137
|
+
'<path d="M11 3 8 9l4 13 4-13-3-6"/>' +
|
|
3138
|
+
'<path d="M2 9h20"/>',
|
|
3139
|
+
star: '<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>',
|
|
3140
|
+
flame:
|
|
3141
|
+
'<path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/>',
|
|
3142
|
+
calc:
|
|
3143
|
+
'<rect width="16" height="20" x="4" y="2" rx="2"/>' +
|
|
3144
|
+
'<line x1="8" x2="16" y1="6" y2="6"/>' +
|
|
3145
|
+
'<path d="M16 14h.01M16 18h.01M12 10h.01M12 14h.01M12 18h.01M8 10h.01M8 14h.01M8 18h.01"/>',
|
|
3146
|
+
chart:
|
|
3147
|
+
'<path d="M3 3v18h18"/>' +
|
|
3148
|
+
'<path d="M18 17V9"/>' +
|
|
3149
|
+
'<path d="M13 17V5"/>' +
|
|
3150
|
+
'<path d="M8 17v-3"/>',
|
|
3151
|
+
robot:
|
|
3152
|
+
'<path d="M12 8V4H8"/>' +
|
|
3153
|
+
'<rect width="16" height="12" x="4" y="8" rx="2"/>' +
|
|
3154
|
+
'<path d="M2 14h2"/>' +
|
|
3155
|
+
'<path d="M20 14h2"/>' +
|
|
3156
|
+
'<path d="M15 13v2"/>' +
|
|
3157
|
+
'<path d="M9 13v2"/>',
|
|
3158
|
+
fox:
|
|
3159
|
+
'<path d="M5 4l4 3a6.5 6.5 0 0 1 6 0l4-3v7.5c0 4.6-3.1 8.5-7 8.5s-7-3.9-7-8.5z"/>' +
|
|
3160
|
+
'<path d="M9.4 12.8h.01"/>' +
|
|
3161
|
+
'<path d="M14.6 12.8h.01"/>' +
|
|
3162
|
+
'<path d="M12 15.6l-1.1 1.2h2.2z"/>',
|
|
3163
|
+
panda:
|
|
3164
|
+
'<circle cx="12" cy="13" r="7.4"/>' +
|
|
3165
|
+
'<circle cx="5.2" cy="6" r="2.1"/>' +
|
|
3166
|
+
'<circle cx="18.8" cy="6" r="2.1"/>' +
|
|
3167
|
+
'<ellipse cx="9.4" cy="12.6" rx="1.4" ry="1.8" transform="rotate(-14 9.4 12.6)"/>' +
|
|
3168
|
+
'<ellipse cx="14.6" cy="12.6" rx="1.4" ry="1.8" transform="rotate(14 14.6 12.6)"/>' +
|
|
3169
|
+
'<path d="M12 15.8v1.2"/>' +
|
|
3170
|
+
'<path d="M10.8 18.2c.7.6 1.7.6 2.4 0"/>',
|
|
3171
|
+
target:
|
|
3172
|
+
'<circle cx="12" cy="12" r="9"/>' +
|
|
3173
|
+
'<circle cx="12" cy="12" r="5"/>' +
|
|
3174
|
+
'<circle cx="12" cy="12" r="1.5"/>',
|
|
3175
|
+
wrench:
|
|
3176
|
+
'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/>',
|
|
3177
|
+
};
|
|
3178
|
+
const LEGACY_BOT_ICONS = {
|
|
3179
|
+
'🦁': 'lion', '🚀': 'rocket', '💎': 'diamond', '⭐': 'star', '🔥': 'flame', '🧮': 'calc',
|
|
3180
|
+
'📊': 'chart', '🤖': 'robot', '🦊': 'fox', '🐼': 'panda', '🎯': 'target', '🛠️': 'wrench', '🛠': 'wrench',
|
|
3181
|
+
};
|
|
3182
|
+
|
|
3183
|
+
/* ikon anahtarını normalize et: eski emoji → yeni anahtar; bilinmiyorsa '' */
|
|
3184
|
+
function normIconKey(icon) {
|
|
3185
|
+
const k = String(icon || '').trim();
|
|
3186
|
+
return LEGACY_BOT_ICONS[k] || (BOT_ICON_PATHS[k] ? k : '');
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3189
|
+
/* bot ikonu HTML'i: bilinen anahtar → monokrom SVG; eski/emoji → düz metin (geriye uyum) */
|
|
3190
|
+
function botIconSvg(icon, size = 15) {
|
|
3191
|
+
let key = normIconKey(icon);
|
|
3192
|
+
if (!key && !String(icon || '').trim()) key = 'robot';
|
|
3193
|
+
if (!key) return escapeHtml(String(icon));
|
|
3194
|
+
return (
|
|
3195
|
+
`<svg class="bot-svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" ` +
|
|
3196
|
+
'stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' +
|
|
3197
|
+
BOT_ICON_PATHS[key] +
|
|
3198
|
+
'</svg>'
|
|
3199
|
+
);
|
|
3200
|
+
}
|
|
3122
3201
|
const BOT_SKILLS = [
|
|
3123
3202
|
['email', 'E-posta'],
|
|
3124
3203
|
['browser', 'Dahili tarayıcı'],
|
|
@@ -3164,7 +3243,7 @@ function renderBotCards() {
|
|
|
3164
3243
|
row.className = 'bot-card' + (b.id === activeBotId ? ' active' : '');
|
|
3165
3244
|
row.title = _t('bot_switch_hint');
|
|
3166
3245
|
row.innerHTML =
|
|
3167
|
-
`<span class="bot-ico">${b.icon
|
|
3246
|
+
`<span class="bot-ico">${botIconSvg(b.icon)}</span>` +
|
|
3168
3247
|
`<span class="bot-nm">${escapeHtml(b.name)}</span>` +
|
|
3169
3248
|
`<span class="bot-gear" title="${_t('bot_manage')}">⚙</span>` +
|
|
3170
3249
|
`<span class="bot-tag">${b.admin ? 'ADMIN' : 'BOT'}</span>` +
|
|
@@ -3183,8 +3262,8 @@ function renderBotCards() {
|
|
|
3183
3262
|
function updateBotChip() {
|
|
3184
3263
|
const chip = $('#botChip');
|
|
3185
3264
|
if (!chip) return;
|
|
3186
|
-
const b = botsCache.find((x) => x.id === activeBotId) || { icon: '
|
|
3187
|
-
chip.
|
|
3265
|
+
const b = botsCache.find((x) => x.id === activeBotId) || { icon: 'lion', name: 'Beast' };
|
|
3266
|
+
chip.innerHTML = botIconSvg(b.icon, 14) + ' ' + escapeHtml(b.name);
|
|
3188
3267
|
}
|
|
3189
3268
|
|
|
3190
3269
|
/* BOTLAR ARASI GEÇİŞ: kart tıklaması SADECE aktif botu değiştirir —
|
|
@@ -3216,7 +3295,7 @@ async function switchBot(id) {
|
|
|
3216
3295
|
} catch {}
|
|
3217
3296
|
/* picker, aktif botun kendi modelini göstersin */
|
|
3218
3297
|
applyState();
|
|
3219
|
-
toast(
|
|
3298
|
+
toast(b.name + (b.admin ? '' : ' — ' + _t('bot_switched')));
|
|
3220
3299
|
}
|
|
3221
3300
|
|
|
3222
3301
|
function botOverlaySetOpen(open) {
|
|
@@ -3260,7 +3339,7 @@ function renderBotPage() {
|
|
|
3260
3339
|
}
|
|
3261
3340
|
const b = botsCache.find((x) => x.id === botPageId);
|
|
3262
3341
|
if (!b) { botPageId = null; renderBotPage(); return; }
|
|
3263
|
-
head.querySelector('#botHeadIcon').
|
|
3342
|
+
head.querySelector('#botHeadIcon').innerHTML = botIconSvg(b.icon, 22);
|
|
3264
3343
|
head.querySelector('#botHeadName').textContent = b.name;
|
|
3265
3344
|
$('#botHeadTag').textContent = b.admin ? 'ADMIN' : 'BOT';
|
|
3266
3345
|
/* DM Log sekmesi yalnız admin botta görünür — botlar arası tüm trafiği o izler */
|
|
@@ -3331,7 +3410,7 @@ async function renderBotNotes(pane, b) {
|
|
|
3331
3410
|
const card = document.createElement('div');
|
|
3332
3411
|
card.className = 'notes-card';
|
|
3333
3412
|
card.innerHTML =
|
|
3334
|
-
`<div class="notes-head"><div class="skill-name">${
|
|
3413
|
+
`<div class="notes-head"><div class="skill-name">${botIconSvg(b.icon)} ${escapeHtml(n.code || '?')} — ${escapeHtml(n.title || '')}</div>` +
|
|
3335
3414
|
`<div class="notes-meta">${escapeHtml(when)} · ${n.count || 0} ${_t('bot_stat_msgs')}</div></div>` +
|
|
3336
3415
|
`<div class="notes-body">${escapeHtml(String(n.notes || '').slice(0, 4000))}</div>` +
|
|
3337
3416
|
`<div style="margin-top:8px"><button class="btn ghost notes-del">${_t('notes_del')}</button></div>`;
|
|
@@ -3354,7 +3433,7 @@ function renderBotOverview(pane) {
|
|
|
3354
3433
|
const row = document.createElement('div');
|
|
3355
3434
|
row.className = 'bot-ov-row';
|
|
3356
3435
|
row.innerHTML =
|
|
3357
|
-
`<span class="ico">${b.icon
|
|
3436
|
+
`<span class="ico">${botIconSvg(b.icon, 17)}</span>` +
|
|
3358
3437
|
`<span class="nm">${escapeHtml(b.name)}${b.admin ? ' <span class="bot-tag">ADMIN</span>' : ''}</span>` +
|
|
3359
3438
|
`<span class="m">${_t('bot_stat_numbers')}: ${st.numbers || 0}</span>` +
|
|
3360
3439
|
`<span class="m">${_t('bot_stat_sessions')}: ${st.sessions || 0}</span>` +
|
|
@@ -3429,10 +3508,13 @@ function renderBotSettings(pane, b) {
|
|
|
3429
3508
|
pane.innerHTML = '';
|
|
3430
3509
|
const f = document.createElement('div');
|
|
3431
3510
|
f.className = 'bot-form';
|
|
3432
|
-
const iconBtns = BOT_ICONS.map(
|
|
3511
|
+
const iconBtns = BOT_ICONS.map(
|
|
3512
|
+
(ic) =>
|
|
3513
|
+
`<button type="button" data-ic="${ic}" title="${ic}" class="${normIconKey(b.icon) === ic ? 'on' : ''}">${botIconSvg(ic, 16)}</button>`
|
|
3514
|
+
).join('');
|
|
3433
3515
|
const otherBots = botsCache.filter((x) => x.id !== b.id);
|
|
3434
3516
|
const seeChecks = otherBots
|
|
3435
|
-
.map((x) => `<label><input type="checkbox" data-see="${x.id}" ${((b.seeBots || []).includes(x.id)) ? 'checked' : ''}/> ${x.icon} ${escapeHtml(x.name)}</label>`)
|
|
3517
|
+
.map((x) => `<label><input type="checkbox" data-see="${x.id}" ${((b.seeBots || []).includes(x.id)) ? 'checked' : ''}/> ${botIconSvg(x.icon)} ${escapeHtml(x.name)}</label>`)
|
|
3436
3518
|
.join('') || `<span class="sub">${_t('bot_no_other')}</span>`;
|
|
3437
3519
|
const skillChecks = BOT_SKILLS
|
|
3438
3520
|
.map(([k, lbl]) => `<label><input type="checkbox" data-skill="${k}" ${(b.skills || {})[k] ? 'checked' : ''}/> ${lbl}</label>`)
|
|
@@ -3663,7 +3745,10 @@ function renderBotAdd(pane) {
|
|
|
3663
3745
|
pane.innerHTML = '';
|
|
3664
3746
|
const f = document.createElement('div');
|
|
3665
3747
|
f.className = 'bot-form';
|
|
3666
|
-
const iconBtns = BOT_ICONS.map(
|
|
3748
|
+
const iconBtns = BOT_ICONS.map(
|
|
3749
|
+
(ic, i) =>
|
|
3750
|
+
`<button type="button" data-ic="${ic}" title="${ic}" class="${i === 7 ? 'on' : ''}">${botIconSvg(ic, 16)}</button>`
|
|
3751
|
+
).join('');
|
|
3667
3752
|
f.innerHTML = `
|
|
3668
3753
|
<label class="mem-label">${_t('bot_name')}</label>
|
|
3669
3754
|
<input id="bAddName" class="inp" placeholder="${_t('bot_name_ph')}" maxlength="40"/>
|
|
@@ -3698,7 +3783,7 @@ function renderBotAdd(pane) {
|
|
|
3698
3783
|
if (!name) { toast(_t('bot_name_req')); $('#bAddName').focus(); return; }
|
|
3699
3784
|
/* İLK HARF ZORUNLU: bot adı harf karakteriyle başlamalı */
|
|
3700
3785
|
if (!/^\p{L}/u.test(name)) { toast(_t('bot_name_letter')); $('#bAddName').focus(); return; }
|
|
3701
|
-
const icon = (f.querySelector('#bAddIconPick button.on') || {}).dataset?.ic || '
|
|
3786
|
+
const icon = (f.querySelector('#bAddIconPick button.on') || {}).dataset?.ic || 'robot';
|
|
3702
3787
|
const r = await beast.botsAdd({ name, icon, prompt: $('#bAddPrompt').value });
|
|
3703
3788
|
if (r.ok) {
|
|
3704
3789
|
toast(_t('bot_created') + ' ' + r.bot.name);
|
package/src/renderer/style.css
CHANGED
|
@@ -1857,6 +1857,18 @@ body.browser-open #settingsDialog { width: min(70vw, calc(100vw - var(--bw, 480p
|
|
|
1857
1857
|
}
|
|
1858
1858
|
#botChip:hover { border-color: var(--accent); }
|
|
1859
1859
|
|
|
1860
|
+
/* bot ikonları: tek renkli SVG — currentColor ile temaya uyar */
|
|
1861
|
+
#botChip svg,
|
|
1862
|
+
.bot-ico svg,
|
|
1863
|
+
.ico svg,
|
|
1864
|
+
.skill-name svg,
|
|
1865
|
+
.icon-pick button svg {
|
|
1866
|
+
display: inline-block;
|
|
1867
|
+
vertical-align: -2.5px;
|
|
1868
|
+
}
|
|
1869
|
+
#botHeadIcon svg { vertical-align: -4px; }
|
|
1870
|
+
.icon-pick button svg { display: block; margin: 0 auto; }
|
|
1871
|
+
|
|
1860
1872
|
#botBar {
|
|
1861
1873
|
flex: none;
|
|
1862
1874
|
max-height: 45%;
|