wormclaude 1.0.72 → 1.0.74
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 +28 -4
- package/package.json +1 -1
package/dist/theme.js
CHANGED
package/dist/tools.js
CHANGED
|
@@ -1202,6 +1202,25 @@ export async function executeTool(name, args) {
|
|
|
1202
1202
|
return { ok: true, output: header + (txt || '(empty)').slice(0, 15000) };
|
|
1203
1203
|
}
|
|
1204
1204
|
if (name === 'WebSearch') {
|
|
1205
|
+
// Once gateway arama proxy'sini dene (Tavily anahtari sunucuda ayarliysa onu kullanir; anahtar istemciye gelmez)
|
|
1206
|
+
try {
|
|
1207
|
+
const C = cfg();
|
|
1208
|
+
if (C.baseUrl && C.apiKey) {
|
|
1209
|
+
const sres = await fetch(`${C.baseUrl.replace(/\/$/, '')}/search`, {
|
|
1210
|
+
method: 'POST',
|
|
1211
|
+
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${C.apiKey}` },
|
|
1212
|
+
body: JSON.stringify({ query: String(args.query || ''), max_results: Number(args.max_results) || 5 }),
|
|
1213
|
+
signal: AbortSignal.timeout(25000),
|
|
1214
|
+
});
|
|
1215
|
+
if (sres.ok) {
|
|
1216
|
+
const sj = await sres.json();
|
|
1217
|
+
if (sj && sj.ok && sj.output)
|
|
1218
|
+
return { ok: true, output: sj.output };
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
catch { }
|
|
1223
|
+
// Yedek: yerel ucretsiz DuckDuckGo + otomatik fetch
|
|
1205
1224
|
const q = encodeURIComponent(String(args.query || ''));
|
|
1206
1225
|
const max = Number(args.max_results) || 5;
|
|
1207
1226
|
const res = await fetch(`https://html.duckduckgo.com/html/?q=${q}`, {
|
|
@@ -1237,19 +1256,24 @@ export async function executeTool(name, args) {
|
|
|
1237
1256
|
const fres = await fetch(u, { signal: AbortSignal.timeout(12000), headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36' } });
|
|
1238
1257
|
let ftxt = (await fres.text()).replace(/<script[\s\S]*?<\/script>/gi, '').replace(/<style[\s\S]*?<\/style>/gi, '').replace(/<[^>]+>/g, ' ').replace(/ /g, ' ').replace(/\s+/g, ' ').trim();
|
|
1239
1258
|
if (!ftxt)
|
|
1240
|
-
return
|
|
1259
|
+
return null;
|
|
1241
1260
|
let host = u;
|
|
1242
1261
|
try {
|
|
1243
1262
|
host = new URL(u).hostname;
|
|
1244
1263
|
}
|
|
1245
1264
|
catch { }
|
|
1246
|
-
return '\n\n--- ' + host + ' (' + u + ') ---\n' + ftxt.slice(0, 2800);
|
|
1265
|
+
return { url: u, host, block: '\n\n--- ' + host + ' (' + u + ') ---\n' + ftxt.slice(0, 2800) };
|
|
1247
1266
|
}
|
|
1248
1267
|
catch {
|
|
1249
|
-
return
|
|
1268
|
+
return null;
|
|
1250
1269
|
}
|
|
1251
1270
|
}));
|
|
1252
|
-
|
|
1271
|
+
const okFetched = fetched.filter((f) => !!f);
|
|
1272
|
+
output += okFetched.map((f) => f.block).join('');
|
|
1273
|
+
// GROUND-TRUTH KAYNAKLAR: model bu gercek URL'leri oldugu gibi kopyalar, asla uydurmaz
|
|
1274
|
+
if (okFetched.length) {
|
|
1275
|
+
output += '\n\n[KAYNAKLAR] (bu turda gercekten cekilen sayfalar — cevapta bunlari OLDUGU GIBI goster, URL uydurma):\n' + okFetched.map((f) => '- ' + f.host + ': ' + f.url).join('\n');
|
|
1276
|
+
}
|
|
1253
1277
|
return { ok: true, output };
|
|
1254
1278
|
}
|
|
1255
1279
|
if (name === 'TodoWrite') {
|