beast-agent 2.38.4 → 2.40.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.
Files changed (41) hide show
  1. package/package.json +1 -1
  2. package/src/agent/bots.js +66 -0
  3. package/src/agent/customtools.js +52 -2
  4. package/src/agent/defaulttools/mt5_barlar2/run.js +188 -0
  5. package/src/agent/defaulttools/mt5_barlar2/tool.json +23 -0
  6. package/src/agent/defaulttools/mt5_bekleyen/run.js +100 -0
  7. package/src/agent/defaulttools/mt5_bekleyen/tool.json +17 -0
  8. package/src/agent/defaulttools/mt5_durum/run.js +93 -0
  9. package/src/agent/defaulttools/mt5_durum/tool.json +10 -0
  10. package/src/agent/defaulttools/mt5_emir/run.js +98 -0
  11. package/src/agent/defaulttools/mt5_emir/tool.json +17 -0
  12. package/src/agent/defaulttools/mt5_emir_iptal/run.js +90 -0
  13. package/src/agent/defaulttools/mt5_emir_iptal/tool.json +12 -0
  14. package/src/agent/defaulttools/mt5_fiyat/run.js +87 -0
  15. package/src/agent/defaulttools/mt5_fiyat/tool.json +16 -0
  16. package/src/agent/defaulttools/mt5_gecmis/run.js +87 -0
  17. package/src/agent/defaulttools/mt5_gecmis/tool.json +12 -0
  18. package/src/agent/defaulttools/mt5_kapat/run.js +92 -0
  19. package/src/agent/defaulttools/mt5_kapat/tool.json +13 -0
  20. package/src/agent/defaulttools/mt5_m15_m5/m15m5.py +60 -0
  21. package/src/agent/defaulttools/mt5_m15_m5/run.js +73 -0
  22. package/src/agent/defaulttools/mt5_m15_m5/tool.json +10 -0
  23. package/src/agent/defaulttools/mt5_pozisyon_gecmis/run.js +144 -0
  24. package/src/agent/defaulttools/mt5_pozisyon_gecmis/tool.json +12 -0
  25. package/src/agent/defaulttools/mt5_shot/run.js +428 -0
  26. package/src/agent/defaulttools/mt5_shot/tool.json +20 -0
  27. package/src/agent/defaulttools/mt5_sltp/run.js +92 -0
  28. package/src/agent/defaulttools/mt5_sltp/tool.json +14 -0
  29. package/src/agent/engine.js +259 -47
  30. package/src/agent/financetools.js +52 -0
  31. package/src/agent/mt5/BeastFinance.mq5 +427 -0
  32. package/src/agent/mt5/BeastShot.tpl +0 -0
  33. package/src/agent/mt5setup.js +542 -0
  34. package/src/agent/scripts/mt5_bridge.py +112 -0
  35. package/src/agent/seeds/mql5/SKILL.md +27 -2
  36. package/src/agent/seeds/tool-yazma/SKILL.md +6 -4
  37. package/src/main.js +233 -13
  38. package/src/preload.js +1 -0
  39. package/src/renderer/index.html +18 -5
  40. package/src/renderer/renderer.js +170 -37
  41. package/src/renderer/style.css +45 -17
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "mt5_shot",
3
+ "description": "MT5 grafiğinin GERÇEK ekran görüntüsünü alır ve GÖRSELİ ÇAĞIRAN AJANA GÖSTERİR: MT5\\MQL5\\Files\\beast_cmd.json üzerinden BeastFinance EA'ya 'shot' komutu yazar, EA ChartScreenShot ile PNG üretir; PNG hem tool klasörüne hem <kullanıcı>\\beast_shots altına kopyalanır (dönen path send_file'a verilebilir) hem de data URL olarak sonuca gömülür — engine bunu sonraki turda ajana görsel olarak enjekte eder (embed:false kapatır). Aktif grafik istenen sembol/periyot ile aynıysa ondan çekilir (Beast panosu + seviye çizgileri görünür), değilse EA geçici grafik açar (ChartOpen/ChartSetSymbolPeriod + BeastShot.tpl açık tema). Komut id/ts ile yazılır, ack poll edilir ve PNG MQL5\\Files'ta belirene kadar beklenir; hata halinde gövde şu kodu taşır: err = no_terminal|ea_offline|cmd_write_fail|ea_no_ack|ea_error|png_yok|timeout (+ cmdId, filesDir, diagnostic, ping). Grafik analizi/raporu ve ekip paylaşımı için birincil screenshot aracıdır.",
4
+ "parameters": {
5
+ "type": "object",
6
+ "properties": {
7
+ "symbol": { "type": "string", "description": "Boş = aktif grafik sembolü (örn GOLD)" },
8
+ "timeframe": { "type": "string", "description": "M1|M5|M15|M30|H1|H4|D1 (boş = aktif periyot)" },
9
+ "width": { "type": "number", "description": "Görüntü genişliği (varsayılan 1600)" },
10
+ "height": { "type": "number", "description": "Görüntü yüksekliği (varsayılan 900)" },
11
+ "file": { "type": "string", "description": "Opsiyonel dosya adı (varsayılan beast_shot_<id>.png)" },
12
+ "timeoutSec": { "type": "number", "description": "Ack/PNG bekleme süresi sn (varsayılan 20, 5-70)" },
13
+ "outdir": { "type": "string", "description": "PNG'nin kopyalanacağı klasör (varsayılan <kullanıcı>\\beast_shots — send_file buradan gönderebilir)" },
14
+ "diag": { "type": "boolean", "description": "Ack gelmezse teşhis amaçlı ping at (varsayılan true)" },
15
+ "embed": { "type": "boolean", "description": "PNG'yi ajana görsel olarak enjekte et (varsayılan true; false = yalnız dosya yolu döner)" }
16
+ },
17
+ "required": []
18
+ },
19
+ "updatedAt": "2026-09-11T23:15:00.000Z"
20
+ }
@@ -0,0 +1,92 @@
1
+ 'use strict';
2
+ // MT5 SL/TP GUNCELLE — stdin: JSON args · stdout: JSON sonuç
3
+ const { spawn } = require('child_process');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ /* TAŞINABİLİR YOL ÇÖZÜMÜ: Beast gömülü python → sistem python'ları → PATH.
8
+ Köprü dosyası %APPDATA%\beast\finance\mt5_bridge.py'den (veya BEAST_FINANCE_DIR)
9
+ okunur; ortam değişkenleriyle geçersiz kılınabilir. */
10
+ function resolvePython() {
11
+ const cands = [];
12
+ if (process.env.BEAST_PYTHON) cands.push({ exe: String(process.env.BEAST_PYTHON), args: [] });
13
+ if (process.env.APPDATA) cands.push({ exe: path.join(process.env.APPDATA, 'beast', 'py', 'python.exe'), args: [] });
14
+ for (const v of ['314', '313', '312', '311', '310']) cands.push({ exe: 'C:\\Python' + v + '\\python.exe', args: [] });
15
+ cands.push({ exe: 'python', args: [] }, { exe: 'py', args: ['-3'] });
16
+ for (const c of cands) {
17
+ if (c.exe === 'python' || c.exe === 'py') return c;
18
+ try { if (fs.existsSync(c.exe)) return c; } catch (e) {}
19
+ }
20
+ return { exe: 'python', args: [] };
21
+ }
22
+ function resolveBridge() {
23
+ const cands = [];
24
+ if (process.env.BEAST_BRIDGE) cands.push(String(process.env.BEAST_BRIDGE));
25
+ if (process.env.BEAST_FINANCE_DIR) cands.push(path.join(String(process.env.BEAST_FINANCE_DIR), 'mt5_bridge.py'));
26
+ if (process.env.APPDATA) cands.push(path.join(process.env.APPDATA, 'beast', 'finance', 'mt5_bridge.py'));
27
+ for (const p of cands) { try { if (p && fs.existsSync(p)) return p; } catch (e) {} }
28
+ return cands[0] || '';
29
+ }
30
+ const PYSPEC = resolvePython();
31
+ const PY = PYSPEC.exe;
32
+ const PY_ARGS = PYSPEC.args;
33
+ const BRIDGE = resolveBridge();
34
+
35
+ const TIMEOUT = 35000;
36
+
37
+ function call(requests) {
38
+ return new Promise((resolve) => {
39
+ let py;
40
+ try { py = spawn(PY, [...PY_ARGS, BRIDGE], { windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] }); }
41
+ catch (e) { return resolve({ ok: false, error: 'python baslatilamadi: ' + e.message }); }
42
+ const results = {};
43
+ let buf = '';
44
+ let errTail = '';
45
+ let settled = false;
46
+ const finish = (obj) => { if (!settled) { settled = true; clearTimeout(timer); try { py.kill(); } catch (e) {} resolve(obj); } };
47
+ const timer = setTimeout(() => finish({ ok: false, error: 'zaman asimi: MT5 terminali acik ve yanit veriyor mu?' }), TIMEOUT);
48
+ py.stdout.on('data', (d) => {
49
+ buf += d.toString('utf8');
50
+ let i;
51
+ while ((i = buf.indexOf('\n')) >= 0) {
52
+ const line = buf.slice(0, i).trim(); buf = buf.slice(i + 1);
53
+ if (!line) continue;
54
+ let o = null;
55
+ try { o = JSON.parse(line); } catch (e) { continue; }
56
+ if (o && o.event) continue;
57
+ if (o && typeof o.id === 'number' && Object.prototype.hasOwnProperty.call(o, 'ok')) {
58
+ results[o.id] = o;
59
+ if (Object.keys(results).length >= requests.length) {
60
+ const arr = requests.map((_, k) => results[k + 1]);
61
+ finish(arr.length === 1 ? arr[0] : { ok: true, results: arr });
62
+ }
63
+ }
64
+ }
65
+ });
66
+ py.stderr.on('data', (d) => { errTail = (errTail + d.toString('utf8')).slice(-800); });
67
+ py.on('error', (e) => finish({ ok: false, error: 'python baslatilamadi: ' + e.message }));
68
+ py.on('close', (code) => { if (Object.keys(results).length < requests.length) finish({ ok: false, error: 'bridge erken cikti code=' + code + ' ' + errTail }); });
69
+ requests.forEach((r, k) => py.stdin.write(JSON.stringify({ id: k + 1, method: r.method, params: r.params || {} }) + '\n'));
70
+ py.stdin.end();
71
+ });
72
+ }
73
+
74
+ (async function main() {
75
+ let args = {};
76
+ try { args = JSON.parse(fs.readFileSync(0, 'utf8') || '{}'); } catch (e) {}
77
+ const ticket = Number(args.ticket || 0);
78
+ if (!ticket) return console.log(JSON.stringify({ ok: false, error: 'ticket zorunlu' }));
79
+ if (args.sl === undefined && args.tp === undefined) return console.log(JSON.stringify({ ok: false, error: 'sl veya tp vermelisin' }));
80
+ const params = { ticket: ticket, sl: Number(args.sl || 0), tp: Number(args.tp || 0) };
81
+ const r = await call([{ method: 'modify', params: params }]);
82
+ if (r.ok && r.data && r.data.result) {
83
+ const res = r.data.result;
84
+ console.log(JSON.stringify({ ok: true, retcode: res.retcode, comment: res.comment, detay: r.data }));
85
+ } else {
86
+ console.log(JSON.stringify({ ok: false, error: r.error || 'SL/TP guncelleme reddedildi' }));
87
+ }
88
+ })();
89
+
90
+ /* PATCH 2026-09-10b: electron app-mode cocuk prosesi kapanmiyordu (90sn timeout).
91
+ stdout'un boruya bosalmasi icin kisa bekleme, sonra zorla cik. */
92
+ setTimeout(() => process.exit(0), 1500);
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "mt5_sltp",
3
+ "description": "Açık pozisyonun STOP LOSS / TAKE PROFIT seviyelerini günceller: ticket zorunlu, sl ve/veya tp verilir (0 = o seviyeyi kaldir). SL'siz pozisyon bırakmamak için risk yönetiminde kullanılır.",
4
+ "parameters": {
5
+ "type": "object",
6
+ "properties": {
7
+ "ticket": { "type": "number", "description": "Pozisyonun ticket numarasi" },
8
+ "sl": { "type": "number", "description": "Yeni stop loss fiyati (0 = kaldir)" },
9
+ "tp": { "type": "number", "description": "Yeni take profit fiyati (0 = kaldir)" }
10
+ },
11
+ "required": ["ticket"]
12
+ },
13
+ "updatedAt": "2026-09-09T18:48:00.000Z"
14
+ }