beast-agent 0.26.0 → 0.26.2
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 +34 -17
- package/package.json +2 -2
- package/scripts/fix-electron.js +126 -0
- package/src/agent/bots.js +8 -0
- package/src/agent/discord.js +268 -0
- package/src/agent/engine.js +135 -77
- package/src/agent/llm.js +46 -17
- package/src/agent/research.js +133 -0
- package/src/agent/skills.js +8 -1
- package/src/agent/tools.js +53 -14
- package/src/agent/watext.js +4 -0
- package/src/main.js +534 -351
- package/src/preload.js +8 -5
- package/src/renderer/i18n.js +19 -55
- package/src/renderer/index.html +1 -3
- package/src/renderer/renderer.js +336 -155
- package/src/renderer/style.css +1 -60
- package/tests/bg-jobs.test.js +5 -10
- package/tests/llm.test.js +81 -1
- package/tests/python.test.js +3 -2
- package/tests/research.test.js +116 -0
package/src/agent/skills.js
CHANGED
|
@@ -232,14 +232,21 @@ Zorunlu kurallar:
|
|
|
232
232
|
},
|
|
233
233
|
{
|
|
234
234
|
folder: 'pdf',
|
|
235
|
+
force: true,
|
|
235
236
|
body: `---
|
|
236
237
|
name: pdf
|
|
237
238
|
description: PDF işleme rehberi — metin çıkarma (pdf-parse), Türkçe karakterli PDF oluşturma/değiştirme (pdf-lib/pdfkit), sayfa→görsel (pdf-to-img) ve taranmış PDF için OCR (tesseract.js). Kullanıcı bir .pdf dosyasından bahsederse ÖNCE bu skill'i oku.
|
|
238
|
-
version: 1.
|
|
239
|
+
version: 1.1.0
|
|
239
240
|
---
|
|
240
241
|
|
|
241
242
|
# PDF İşleme Rehberi
|
|
242
243
|
|
|
244
|
+
## EN KRİTİK KURALLAR (önce bunlar)
|
|
245
|
+
|
|
246
|
+
1. Türkçe karakterli PDF için pip\u2019ten paket KURMA/KULLANMA (fpdf, fpdf2, markdown-pdf, weasyprint, reportlab vb.) — bunlar ğ ş ı İ karakterlerini bozar. Doğru kit Node\u2019ta ZATEN kurulu: \`pdf-lib\` + \`@pdf-lib/fontkit\` ve \`pdfkit\`. Script\u2019i write_file ile .js yaz, run_command ile \`node script.js\` çalıştır (python_run İLE DEĞİL).
|
|
247
|
+
2. md→pdf çevirici YOKTUR ve kurulmaz — kullanıcıya rapor/özet/belge çıktısı vereceksen .md gönderme; aynı içeriği doğrudan PDF olarak ÜRET ve o dosyayı send_file ile gönder.
|
|
248
|
+
3. \`pdf-parse\` ile \`pdf-to-img\` aynı process\u2019e yüklenmez (aşağıdaki çakışma kuralı).
|
|
249
|
+
|
|
243
250
|
Kurulu paketler ve rolleri:
|
|
244
251
|
|
|
245
252
|
| İstek | Paket |
|
package/src/agent/tools.js
CHANGED
|
@@ -6,6 +6,7 @@ const path = require('path');
|
|
|
6
6
|
const https = require('https');
|
|
7
7
|
const { execFile } = require('child_process');
|
|
8
8
|
const { spawn } = require('child_process');
|
|
9
|
+
const research = require('./research');
|
|
9
10
|
|
|
10
11
|
const MAX_CMD_OUTPUT = 16000;
|
|
11
12
|
const MAX_FILE_CHARS = 200000;
|
|
@@ -500,21 +501,27 @@ async function fetchWithTimeout(url, opts = {}, timeoutMs = 20000, signal) {
|
|
|
500
501
|
async function webSearch(query, { maxResults = 8, signal } = {}) {
|
|
501
502
|
const q = String(query || '').trim().slice(0, 400);
|
|
502
503
|
if (!q) return { ok: false, error: 'boş sorgu' };
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
504
|
+
let res;
|
|
505
|
+
try {
|
|
506
|
+
res = await fetchWithTimeout(
|
|
507
|
+
'https://html.duckduckgo.com/html/',
|
|
508
|
+
{
|
|
509
|
+
method: 'POST',
|
|
510
|
+
headers: {
|
|
511
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
512
|
+
'User-Agent': UA,
|
|
513
|
+
Accept: 'text/html',
|
|
514
|
+
},
|
|
515
|
+
body: new URLSearchParams({ q }).toString(),
|
|
511
516
|
},
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
517
|
+
20000,
|
|
518
|
+
signal
|
|
519
|
+
);
|
|
520
|
+
} catch (e) {
|
|
521
|
+
/* ağ hatası/rate-limit exception fırlatmasın — zincir devam edebilsin */
|
|
522
|
+
return { ok: false, error: 'DDG erişilemedi: ' + String((e && e.message) || e) };
|
|
523
|
+
}
|
|
524
|
+
if (!res.ok) return { ok: false, error: `DDG HTTP ${res.status}` };
|
|
518
525
|
const html = await res.text();
|
|
519
526
|
const results = parseDdgResults(html, Math.min(Math.max(Number(maxResults) || 8, 1), 12));
|
|
520
527
|
if (!results.length) {
|
|
@@ -647,6 +654,28 @@ const definitions = [
|
|
|
647
654
|
},
|
|
648
655
|
},
|
|
649
656
|
},
|
|
657
|
+
{
|
|
658
|
+
type: 'function',
|
|
659
|
+
function: {
|
|
660
|
+
name: 'deep_search',
|
|
661
|
+
description:
|
|
662
|
+
'AGENTIC DEEP RESEARCH — use when web_search is not enough or the answer was NOT found on the first try. Runs 1-4 query variants IN PARALLEL (rephrase, synonyms, Turkish + English spellings of the same question), merges + dedupes results, then AUTOMATICALLY opens and reads the top pages with a HIDDEN real-Chromium browser (JS/SPA pages work; the visible panel is NOT touched) and returns full-text excerpts. Ideal for: multi-angle questions (price comparison, reviews, specs, "find everything about X"), Turkish queries that miss results, pages that need JS rendering. Returns {queries, results[{title,url,snippet}], pages[{url,title,content}]}.',
|
|
663
|
+
parameters: {
|
|
664
|
+
type: 'object',
|
|
665
|
+
properties: {
|
|
666
|
+
queries: {
|
|
667
|
+
type: 'array',
|
|
668
|
+
maxItems: 4,
|
|
669
|
+
items: { type: 'string' },
|
|
670
|
+
description: '1-4 query variants; e.g. ["iphone 16 fiyat", "iphone 16 price turkey", "iphone 16 technosa"]',
|
|
671
|
+
},
|
|
672
|
+
max_results: { type: 'number', description: 'merged result cap, default 16' },
|
|
673
|
+
read_top: { type: 'number', description: 'how many top results to auto-read fully (0-6, default 3); 0 = results only' },
|
|
674
|
+
},
|
|
675
|
+
required: ['queries'],
|
|
676
|
+
},
|
|
677
|
+
},
|
|
678
|
+
},
|
|
650
679
|
{
|
|
651
680
|
type: 'function',
|
|
652
681
|
function: {
|
|
@@ -738,6 +767,16 @@ async function exec(name, args, ctx) {
|
|
|
738
767
|
}
|
|
739
768
|
return JSON.stringify(r);
|
|
740
769
|
}
|
|
770
|
+
case 'deep_search': {
|
|
771
|
+
/* hook'suz bağlamda bile çalışsın: yalnız arama zinciri (sayfa okuma yok).
|
|
772
|
+
Gizli tarayıcı okuması engine.research hook'undan gelir (main process). */
|
|
773
|
+
const r = await research.deepSearch(
|
|
774
|
+
args,
|
|
775
|
+
{ search: (q) => webSearchFast(q, { maxResults: 10, signal: ctx.signal }) },
|
|
776
|
+
ctx.signal
|
|
777
|
+
);
|
|
778
|
+
return JSON.stringify(r);
|
|
779
|
+
}
|
|
741
780
|
case 'python_run': {
|
|
742
781
|
const t0 = Date.now();
|
|
743
782
|
/* önce parametreler — interpreter araması gerektirmeyen hatalar erken dönsün */
|
package/src/agent/watext.js
CHANGED
|
@@ -36,6 +36,10 @@ const TOOL_LABELS = {
|
|
|
36
36
|
write_file: (a) => `Dosya yaz: ${a.path || ''}`,
|
|
37
37
|
list_dir: (a) => `Klasör: ${a.path || '.'}`,
|
|
38
38
|
web_search: (a) => `Web arama: ${String(a.query || '').slice(0, 100)}`,
|
|
39
|
+
deep_search: (a) => {
|
|
40
|
+
const qs = Array.isArray(a.queries) ? a.queries : [a.query || ''];
|
|
41
|
+
return `Derin araştırma (${qs.length} sorgu): ${String(qs[0] || '').slice(0, 80)}`;
|
|
42
|
+
},
|
|
39
43
|
http_fetch: (a) => `Sayfa: ${a.url || ''}`,
|
|
40
44
|
browser_open: (a) => `Tarayıcı aç: ${a.url || ''}`,
|
|
41
45
|
browser_click: (a) => `Tıkla: ${a.ref ?? ''}`,
|