wormclaude 1.0.128 → 1.0.129
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/dist/theme.js +1 -1
- package/dist/tools.js +13 -3
- package/package.json +1 -1
package/dist/theme.js
CHANGED
package/dist/tools.js
CHANGED
|
@@ -43,6 +43,9 @@ export function resolveWs(fp) {
|
|
|
43
43
|
return fp;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
// WebFetch önbelleği: model aynı URL'i bir cevap içinde defalarca (7×) çekiyordu (farklı prompt'larla
|
|
47
|
+
// ama sayfa aynı) → israf + kafa karışıklığı. Aynı URL 2 dk içinde tekrar istenirse cache'den döner.
|
|
48
|
+
const _webFetchCache = new Map();
|
|
46
49
|
// Komutu çalıştırır ve sonrasında cwd değişikliğini (cd) yakalayıp bashCwd'yi günceller.
|
|
47
50
|
// POSIX: pwd'yi temp dosyaya yazan, çıkış kodunu KORUYAN sarmalayıcı (hata propagasyonu bozulmaz).
|
|
48
51
|
// Windows: komutu olduğu gibi çalıştır, sonra baştaki `cd <hedef>`'i regex ile yakala (best-effort).
|
|
@@ -1225,6 +1228,12 @@ export async function executeTool(name, args) {
|
|
|
1225
1228
|
let url = String(args.url);
|
|
1226
1229
|
if (url.startsWith('http://'))
|
|
1227
1230
|
url = 'https://' + url.slice(7);
|
|
1231
|
+
const header = args.prompt ? `[prompt: ${String(args.prompt).slice(0, 200)}]\n\n` : '';
|
|
1232
|
+
// Aynı URL bu oturumda 2 dk içinde çekildiyse → önbellekten (model 7× aynı sayfayı çekmesin).
|
|
1233
|
+
const _c = _webFetchCache.get(url);
|
|
1234
|
+
if (_c && Date.now() - _c.t < 120000) {
|
|
1235
|
+
return { ok: true, output: header + '[bu URL bu cevapta ZATEN çekildi — aşağıdaki içerikten OKU, tekrar çekme]\n\n' + _c.text };
|
|
1236
|
+
}
|
|
1228
1237
|
const res = await fetch(url, { signal: AbortSignal.timeout(20000) });
|
|
1229
1238
|
let txt = await res.text();
|
|
1230
1239
|
txt = txt
|
|
@@ -1232,9 +1241,10 @@ export async function executeTool(name, args) {
|
|
|
1232
1241
|
.replace(/<style[\s\S]*?<\/style>/gi, '')
|
|
1233
1242
|
.replace(/<[^>]+>/g, ' ')
|
|
1234
1243
|
.replace(/\s+/g, ' ')
|
|
1235
|
-
.trim()
|
|
1236
|
-
|
|
1237
|
-
|
|
1244
|
+
.trim()
|
|
1245
|
+
.slice(0, 15000);
|
|
1246
|
+
_webFetchCache.set(url, { text: txt, t: Date.now() });
|
|
1247
|
+
return { ok: true, output: header + (txt || '(empty)') };
|
|
1238
1248
|
}
|
|
1239
1249
|
if (name === 'WebSearch') {
|
|
1240
1250
|
// Once gateway arama proxy'sini dene (Tavily anahtari sunucuda ayarliysa onu kullanir; anahtar istemciye gelmez)
|