beast-agent 2.44.1 → 2.44.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/bin/beast-agent.js +6 -0
- package/package.json +1 -1
- package/src/agent/engine.js +24 -1
- package/src/main.js +69 -43
package/bin/beast-agent.js
CHANGED
|
@@ -37,6 +37,12 @@ if (process.argv[2] === 'uninstall') {
|
|
|
37
37
|
"$d=[Environment]::GetFolderPath('Desktop'); if(Test-Path \"$d\\Beast Agent.lnk\"){ Remove-Item \"$d\\Beast Agent.lnk\" -Force; Write-Host '\u2022 desktop shortcut removed' }"],
|
|
38
38
|
{ stdio: 'inherit' });
|
|
39
39
|
} catch {}
|
|
40
|
+
/* remove the Start Menu shortcut (Windows AUMID registration) */
|
|
41
|
+
try {
|
|
42
|
+
spawnSync('powershell.exe', ['-NoProfile', '-Command',
|
|
43
|
+
"$s=Join-Path $env:APPDATA 'Microsoft\\Windows\\Start Menu\\Programs\\Beast Agent.lnk'; if(Test-Path $s){ Remove-Item $s -Force; Write-Host '\u2022 Start Menu shortcut removed' }"],
|
|
44
|
+
{ stdio: 'inherit' });
|
|
45
|
+
} catch {}
|
|
40
46
|
} else {
|
|
41
47
|
try { spawnSync('pkill', ['-f', 'node_modules/beast-agent'], { stdio: 'ignore' }); } catch {}
|
|
42
48
|
}
|
package/package.json
CHANGED
package/src/agent/engine.js
CHANGED
|
@@ -122,8 +122,28 @@ const FORMAT_RULES =
|
|
|
122
122
|
'ÇIKTI BİÇİMİ (ZORUNLU):\n' +
|
|
123
123
|
'- Yanıtlarında asla # karakteri kullanma (markdown başlık yok).\n' +
|
|
124
124
|
'- Asla * karakteri kullanma (kalın/italik yıldız yok); madde işaretleri için - kullan.\n' +
|
|
125
|
+
'- Uzun tire (em/en dash: — veya –) KULLANMA; cümle aralarını virgül, iki nokta ya da gerekiyorsa kısa çizgi (-) ile ayır.\n' +
|
|
125
126
|
'- Renkli sembol/ikon kullanma (renkli kalp, daire vb. yok); normal sarı emoji kullanabilirsin.\n' +
|
|
126
|
-
'- Kod bloklarında dil gereği # veya * gerekiyorsa kod içinde serbest
|
|
127
|
+
'- Kod bloklarında dil gereği # veya * gerekiyorsa kod içinde serbest.\n' +
|
|
128
|
+
'- Düz, doğal ve insani yaz: kalıplaşmış giriş/kapanış cümleleri, "umarım yardımcı olur" tarzı boş nezaket ve robotik madde listeleri kullanma.';
|
|
129
|
+
|
|
130
|
+
/* Uzun tire (—/–) temizliği: nihai metinden yapay zeka imzası sayılan tireleri
|
|
131
|
+
kaldırır — boşluklu em dash virgüle, en dash ve bitişik em dash kısa çizgiye
|
|
132
|
+
döner; kod blokları ve satır içi kod DOKUNULMADAN korunur. */
|
|
133
|
+
function stripAiDashes(text) {
|
|
134
|
+
const s = String(text == null ? '' : text);
|
|
135
|
+
if (!/[\u2013\u2014]/.test(s)) return s;
|
|
136
|
+
const parts = s.split(/(```[\s\S]*?```|`[^`\n]*`)/);
|
|
137
|
+
for (let i = 0; i < parts.length; i += 2) {
|
|
138
|
+
parts[i] = parts[i]
|
|
139
|
+
.replace(/[ \t]+\u2014[ \t]+/g, ', ')
|
|
140
|
+
.replace(/[ \t]*\u2013[ \t]*/g, '-')
|
|
141
|
+
.replace(/\u2014/g, '-')
|
|
142
|
+
.replace(/,\s*,/g, ',')
|
|
143
|
+
.replace(/[ \t]+([.!?:;])/g, '$1');
|
|
144
|
+
}
|
|
145
|
+
return parts.join('');
|
|
146
|
+
}
|
|
127
147
|
|
|
128
148
|
/* Kişi bazlı granül izin seviyeleri: hangi araçlara erişilebilir */
|
|
129
149
|
const PERM_TOOL_SETS = {
|
|
@@ -865,6 +885,7 @@ class Engine {
|
|
|
865
885
|
costIn: Number(c.costIn) || null,
|
|
866
886
|
costOut: Number(c.costOut) || null,
|
|
867
887
|
};
|
|
888
|
+
if (res && typeof res.content === 'string') res.content = stripAiDashes(res.content);
|
|
868
889
|
return res;
|
|
869
890
|
} catch (e) {
|
|
870
891
|
if (e && (e.name === 'AbortError' || (signal && signal.aborted))) throw e;
|
|
@@ -4934,6 +4955,7 @@ const skills = require('./skills');
|
|
|
4934
4955
|
}),
|
|
4935
4956
|
}
|
|
4936
4957
|
);
|
|
4958
|
+
if (res && typeof res.content === 'string') res.content = stripAiDashes(res.content);
|
|
4937
4959
|
const assistant = { role: 'assistant', content: res.content || '' };
|
|
4938
4960
|
if (res.toolCalls && res.toolCalls.length) assistant.tool_calls = res.toolCalls;
|
|
4939
4961
|
if (res.reasoning) assistant.reasoning_content = res.reasoning; /* thinking geri-besleme */
|
|
@@ -7113,3 +7135,4 @@ module.exports.PERM_TOOL_SETS = PERM_TOOL_SETS;
|
|
|
7113
7135
|
module.exports.PERM_LEVELS = PERM_LEVELS;
|
|
7114
7136
|
module.exports.normalizePerms = normalizePerms;
|
|
7115
7137
|
module.exports.OBSERVE_MARK = OBSERVE_MARK;
|
|
7138
|
+
module.exports.stripAiDashes = stripAiDashes;
|
package/src/main.js
CHANGED
|
@@ -11,7 +11,7 @@ const crypto = require('crypto');
|
|
|
11
11
|
isteklerindeki konuşma-başına kimlik agent/llm.js'te üretilir */
|
|
12
12
|
const OPENCODE_SESSION = 'beast-' + crypto.randomUUID();
|
|
13
13
|
const { spawn } = require('child_process');
|
|
14
|
-
const { Engine, OBSERVE_MARK } = require('./agent/engine');
|
|
14
|
+
const { Engine, OBSERVE_MARK, stripAiDashes } = require('./agent/engine');
|
|
15
15
|
const { loadBeastConfig, parseEnvFile, beastDir } = require('./agent/config');
|
|
16
16
|
const bots = require('./agent/bots');
|
|
17
17
|
const mqueue = require('./agent/mqueue');
|
|
@@ -272,15 +272,21 @@ try {
|
|
|
272
272
|
try { nodemailer = require('nodemailer'); } catch {}
|
|
273
273
|
|
|
274
274
|
const APP_DIR = path.join(app.getPath('appData'), 'beast');
|
|
275
|
-
/* Windows
|
|
276
|
-
AUMID,
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
275
|
+
/* Windows kimliği: görev çubuğu ikonu + toast bildirim adı/işareti için
|
|
276
|
+
AppUserModelID ŞART. Özel AUMID, kayıtlı kısayol yoksa taskbar ikonunu
|
|
277
|
+
electron.exe logosuna düşürür — bu yüzden atama, whenReady'de AUMID'li
|
|
278
|
+
kısayollar (masaüstü + Başlat menüsü) hazırlandıktan SONRA yapılır. */
|
|
279
|
+
const BEAST_AUMID = 'com.quantumalgo.beastagent';
|
|
280
|
+
try { app.setName('Beast Agent'); } catch {}
|
|
281
|
+
function assignAppUserModelId() {
|
|
282
|
+
try {
|
|
283
|
+
const startMenu = path.join(app.getPath('appData'), 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Beast Agent.lnk');
|
|
284
|
+
const desktop = path.join(app.getPath('desktop'), 'Beast Agent.lnk');
|
|
285
|
+
if (app.isPackaged || fs.existsSync(startMenu) || fs.existsSync(desktop)) {
|
|
286
|
+
app.setAppUserModelId(BEAST_AUMID);
|
|
287
|
+
}
|
|
288
|
+
} catch {}
|
|
289
|
+
}
|
|
284
290
|
/* mem0-native embedding modeli whisper ile AYNI cache'i kullanır (src/agent/mem0.js okur) */
|
|
285
291
|
process.env.BEAST_MODELS_DIR = path.join(APP_DIR, 'models');
|
|
286
292
|
|
|
@@ -3583,38 +3589,55 @@ if (!gotLock) {
|
|
|
3583
3589
|
try { showWin(); } catch {}
|
|
3584
3590
|
});
|
|
3585
3591
|
|
|
3586
|
-
/*
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
return
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3592
|
+
/* Kısayol yazıcı: masaüstü + Başlat menüsü kısayolları AUMID, ikon ve
|
|
3593
|
+
çalışma klasörüyle HER AÇILIŞTA tazelenir — eski kısayolda AUMID yoksa
|
|
3594
|
+
Windows görev çubuğunda/toast'ta electron.exe kimliğini gösteriyordu. */
|
|
3595
|
+
function writeBeastShortcut(lnk) {
|
|
3596
|
+
const goodCwd = app.getPath('home');
|
|
3597
|
+
const base = {
|
|
3598
|
+
target: process.execPath,
|
|
3599
|
+
args: app.getAppPath(),
|
|
3600
|
+
cwd: goodCwd,
|
|
3601
|
+
description: 'Beast Agent — fast, light and resourceful',
|
|
3602
|
+
icon: path.join(__dirname, '..', 'assets', 'app.ico'),
|
|
3603
|
+
iconIndex: 0,
|
|
3604
|
+
appUserModelId: BEAST_AUMID,
|
|
3605
|
+
};
|
|
3606
|
+
if (fs.existsSync(lnk)) {
|
|
3607
|
+
/* mevcut kısayolu onar: AUMID + ikon + çalışma klasörü garantiye alınır */
|
|
3608
|
+
try {
|
|
3609
|
+
const cur = shell.readShortcutLink(lnk);
|
|
3610
|
+
return shell.writeShortcutLink(lnk, 'update', {
|
|
3611
|
+
...cur,
|
|
3612
|
+
cwd: goodCwd,
|
|
3613
|
+
icon: base.icon,
|
|
3614
|
+
iconIndex: 0,
|
|
3615
|
+
appUserModelId: BEAST_AUMID,
|
|
3616
|
+
});
|
|
3617
|
+
} catch {}
|
|
3618
|
+
}
|
|
3619
|
+
return shell.writeShortcutLink(lnk, 'create', base);
|
|
3620
|
+
}
|
|
3621
|
+
|
|
3622
|
+
/* npm (global) kurulumda masaüstü + Başlat menüsü kısayolları.
|
|
3623
|
+
(NSIS packaged modda kısayolları electron-builder zaten oluşturur.) */
|
|
3624
|
+
function ensureShortcuts() {
|
|
3625
|
+
try {
|
|
3626
|
+
const desktopLnk = path.join(app.getPath('desktop'), 'Beast Agent.lnk');
|
|
3627
|
+
const okDesktop = writeBeastShortcut(desktopLnk);
|
|
3628
|
+
log.info('main', okDesktop ? 'Masaüstü kısayolu hazır (AUMID + ikon)' : 'Masaüstü kısayolu oluşturulamadı');
|
|
3629
|
+
} catch (e) {
|
|
3630
|
+
log.info('main', 'Masaüstü kısayol hatası: ' + String((e && e.message) || e));
|
|
3631
|
+
}
|
|
3632
|
+
try {
|
|
3633
|
+
/* Başlat menüsü kısayolu: Windows AUMID çözümünü (görev çubuğu ikonu +
|
|
3634
|
+
toast bildirim adı) öncelikle buradan okur */
|
|
3635
|
+
const startDir = path.join(app.getPath('appData'), 'Microsoft', 'Windows', 'Start Menu', 'Programs');
|
|
3636
|
+
fs.mkdirSync(startDir, { recursive: true });
|
|
3637
|
+
const okStart = writeBeastShortcut(path.join(startDir, 'Beast Agent.lnk'));
|
|
3638
|
+
log.info('main', okStart ? 'Başlat menüsü kısayolu hazır (AUMID + ikon)' : 'Başlat menüsü kısayolu oluşturulamadı');
|
|
3616
3639
|
} catch (e) {
|
|
3617
|
-
log.info('main', '
|
|
3640
|
+
log.info('main', 'Başlat menüsü kısayol hatası: ' + String((e && e.message) || e));
|
|
3618
3641
|
}
|
|
3619
3642
|
}
|
|
3620
3643
|
|
|
@@ -3646,8 +3669,11 @@ app.whenReady().then(() => {
|
|
|
3646
3669
|
} catch (e) {
|
|
3647
3670
|
log.error('main', 'Startup kaydı (npm) başarısız: ' + String((e && e.message) || e));
|
|
3648
3671
|
}
|
|
3649
|
-
|
|
3672
|
+
ensureShortcuts();
|
|
3650
3673
|
}
|
|
3674
|
+
/* AUMID ataması kısayollardan SONRA: görev çubuğu ve toast bildirimleri
|
|
3675
|
+
böylece Beast ikonunu/adını çözer (electron.exe kimliği ezilir) */
|
|
3676
|
+
assignAppUserModelId();
|
|
3651
3677
|
reloadBackend();
|
|
3652
3678
|
syncWhitelist(); // bot sistemi: whitelist.json aynası ilk açılışta garanti
|
|
3653
3679
|
try { bots.ensureBotCodes(); } catch {} // her bota benzersiz 5 haneli kod garanti
|
|
@@ -7145,7 +7171,7 @@ function empatiLlmCompose(prompt) {
|
|
|
7145
7171
|
],
|
|
7146
7172
|
temperature: 0.6,
|
|
7147
7173
|
}, { signal: ctrl.signal })
|
|
7148
|
-
.then((r) => String(r.content || '').trim().slice(0, 600))
|
|
7174
|
+
.then((r) => stripAiDashes(String(r.content || '').trim()).slice(0, 600))
|
|
7149
7175
|
.catch(() => '')
|
|
7150
7176
|
.finally(() => clearTimeout(kill));
|
|
7151
7177
|
}
|