wormclaude 1.0.69 → 1.0.71

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 CHANGED
@@ -16,4 +16,4 @@ export const theme = {
16
16
  synType: '#a78bfa', // tip/sınıf adları, sabitler
17
17
  synProp: '#e0e0e0', // özellik/anahtar adları
18
18
  };
19
- export const VERSION = '1.0.69';
19
+ export const VERSION = '1.0.71';
package/dist/tools.js CHANGED
@@ -391,7 +391,7 @@ export const toolSchemas = [
391
391
  type: 'function',
392
392
  function: {
393
393
  name: 'WebSearch',
394
- description: 'Search the web and return top results (title, url, snippet). Use for current info, docs, or finding pages to WebFetch.',
394
+ description: 'Search the web; returns top results (title, url, snippet). For an EXACT current value (price, exchange rate, score, today date) the snippet often lacks the live number — WebFetch the most relevant result URL to read the real value before answering. NEVER invent or guess a number; if you cannot verify, say so.',
395
395
  parameters: {
396
396
  type: 'object',
397
397
  properties: {
@@ -1205,21 +1205,46 @@ export async function executeTool(name, args) {
1205
1205
  const q = encodeURIComponent(String(args.query || ''));
1206
1206
  const max = Number(args.max_results) || 5;
1207
1207
  const res = await fetch(`https://html.duckduckgo.com/html/?q=${q}`, {
1208
- headers: { 'User-Agent': 'Mozilla/5.0' }, signal: AbortSignal.timeout(20000),
1208
+ headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36' }, signal: AbortSignal.timeout(20000),
1209
1209
  });
1210
1210
  const html = await res.text();
1211
+ const clean = (s) => s.replace(/<[^>]+>/g, '').replace(/&amp;/g, '&').replace(/&#x27;/g, "'").replace(/&#39;/g, "'").replace(/&quot;/g, '"').replace(/\s+/g, ' ').trim();
1212
+ const titles = [...html.matchAll(/<a[^>]*class="result__a"[^>]*href="([^"]+)"[^>]*>([\s\S]*?)<\/a>/g)];
1213
+ const snips = [...html.matchAll(/class="result__snippet"[^>]*>([\s\S]*?)<\/a>/g)];
1211
1214
  const out = [];
1212
- const re = /<a[^>]*class="result__a"[^>]*href="([^"]+)"[^>]*>([\s\S]*?)<\/a>/g;
1213
- let m;
1214
- while ((m = re.exec(html)) && out.length < max) {
1215
- let url = m[1];
1215
+ for (let i = 0; i < titles.length && out.length < max; i++) {
1216
+ let url = titles[i][1];
1216
1217
  const ud = url.match(/uddg=([^&]+)/);
1217
1218
  if (ud)
1218
1219
  url = decodeURIComponent(ud[1]);
1219
- const title = m[2].replace(/<[^>]+>/g, '').replace(/\s+/g, ' ').trim();
1220
- out.push(`${out.length + 1}. ${title}\n ${url}`);
1220
+ const title = clean(titles[i][2]);
1221
+ const snippet = snips[i] ? clean(snips[i][1]) : '';
1222
+ out.push(`${out.length + 1}. ${title}\n ${url}${snippet ? '\n ' + snippet : ''}`);
1221
1223
  }
1222
- return { ok: true, output: out.length ? out.join('\n') : '(sonuç yok)' };
1224
+ let output = out.length ? out.join('\n\n') : '(sonuç yok)';
1225
+ // OTOMATIK FETCH: en alakali ilk sonucun gercek icerigini de cek (model snippet'e baglanip uydurmasin)
1226
+ if (titles.length > 0) {
1227
+ try {
1228
+ let topUrl = titles[0][1];
1229
+ const ud0 = topUrl.match(/uddg=([^&]+)/);
1230
+ if (ud0)
1231
+ topUrl = decodeURIComponent(ud0[1]);
1232
+ if (topUrl.startsWith('http://'))
1233
+ topUrl = 'https://' + topUrl.slice(7);
1234
+ const fres = await fetch(topUrl, { 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' } });
1235
+ let ftxt = (await fres.text()).replace(/<script[\s\S]*?<\/script>/gi, '').replace(/<style[\s\S]*?<\/style>/gi, '').replace(/<[^>]+>/g, ' ').replace(/&nbsp;/g, ' ').replace(/\s+/g, ' ').trim();
1236
+ if (ftxt) {
1237
+ let host = topUrl;
1238
+ try {
1239
+ host = new URL(topUrl).hostname;
1240
+ }
1241
+ catch { }
1242
+ output += '\n\n--- ' + host + ' (icerik) ---\n' + ftxt.slice(0, 4000);
1243
+ }
1244
+ }
1245
+ catch { }
1246
+ }
1247
+ return { ok: true, output };
1223
1248
  }
1224
1249
  if (name === 'TodoWrite') {
1225
1250
  todosStore = Array.isArray(args.todos) ? args.todos : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wormclaude",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "description": "WormClaude CLI - uncensored security+code assistant (ink TUI, Claude-style)",
5
5
  "type": "module",
6
6
  "bin": {