wormclaude 1.0.198 → 1.0.200

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.198';
19
+ export const VERSION = '1.0.200';
package/dist/tools.js CHANGED
@@ -1249,6 +1249,44 @@ const TYPE_EXT = {
1249
1249
  };
1250
1250
  // ── Executor ──────────────────────────────────────────────────────────────────
1251
1251
  // Edit/Write icin +/- satir ozeti (Diff paketiyle).
1252
+ // Adapter artığı temizle: küçük modeller değeri <![CDATA[ ... ]]> ile sarabiliyor (gateway de
1253
+ // temizliyor ama istemci-tarafı garanti — dosyayı bozmasın).
1254
+ function stripCdata(s) {
1255
+ let t = s;
1256
+ if (t.startsWith('<![CDATA['))
1257
+ t = t.slice(9);
1258
+ if (t.endsWith(']]>'))
1259
+ t = t.slice(0, -3);
1260
+ return t;
1261
+ }
1262
+ // Boşluk/girinti-toleranslı blok eşleşme: old_string dosyada BİREBİR yoksa (model exact metni
1263
+ // üretemedi — küçük-model klasiği), satırları trim'leyip BENZERSIZ bir blok ara → dosyanın GERÇEK
1264
+ // metnini döndür (replace bununla yapılır, dosya geçerli kalır). null = yok/belirsiz.
1265
+ function fuzzyBlockMatch(content, needle) {
1266
+ const nLines = needle.replace(/^\n+/, '').replace(/\n+$/, '').split('\n');
1267
+ if (nLines.length === 0 || (nLines.length === 1 && !nLines[0].trim()))
1268
+ return null;
1269
+ const cLines = content.split('\n');
1270
+ const key = (l) => l.trim();
1271
+ let foundAt = -1, foundCount = 0;
1272
+ for (let i = 0; i + nLines.length <= cLines.length; i++) {
1273
+ let ok = true;
1274
+ for (let k = 0; k < nLines.length; k++) {
1275
+ if (key(cLines[i + k]) !== key(nLines[k])) {
1276
+ ok = false;
1277
+ break;
1278
+ }
1279
+ }
1280
+ if (ok) {
1281
+ if (foundCount === 0)
1282
+ foundAt = i;
1283
+ foundCount++;
1284
+ }
1285
+ }
1286
+ if (foundCount !== 1)
1287
+ return null; // bulunamadı VEYA birden çok (belirsiz) → güvenli taraf
1288
+ return cLines.slice(foundAt, foundAt + nLines.length).join('\n');
1289
+ }
1252
1290
  function diffStat(oldStr, newStr) {
1253
1291
  try {
1254
1292
  let added = 0, removed = 0;
@@ -1431,12 +1469,23 @@ export async function executeTool(name, args) {
1431
1469
  return { ok: false, output: `Error: file does not exist: ${fp}` };
1432
1470
  if (!readFiles.has(norm(fp)))
1433
1471
  return { ok: false, output: 'Error: you must use the Read tool on this file before editing it.' };
1434
- const oldStr = String(args.old_string ?? '');
1435
- const newStr = String(args.new_string ?? '');
1472
+ let oldStr = stripCdata(String(args.old_string ?? '')); // CDATA artığını temizle
1473
+ const newStr = stripCdata(String(args.new_string ?? ''));
1436
1474
  if (oldStr === newStr)
1437
1475
  return { ok: false, output: 'Error: new_string must differ from old_string.' };
1438
1476
  let c = fs.readFileSync(fp, 'utf8');
1439
- const count = oldStr ? c.split(oldStr).length - 1 : 0;
1477
+ let count = oldStr ? c.split(oldStr).length - 1 : 0;
1478
+ let _fuzzy = '';
1479
+ // EXACT-MATCH KURTARMA: birebir bulunamadıysa boşluk/girinti-toleranslı blok eşleşmesi dene
1480
+ // (küçük model exact metni üretemiyor → hard-fail yerine gerçek bloğu bul ve onu değiştir).
1481
+ if (count === 0 && oldStr && !args.replace_all) {
1482
+ const fz = fuzzyBlockMatch(c, oldStr);
1483
+ if (fz) {
1484
+ oldStr = fz;
1485
+ count = c.split(oldStr).length - 1;
1486
+ _fuzzy = ' (boşluk-toleranslı eşleşme)';
1487
+ }
1488
+ }
1440
1489
  if (count === 0)
1441
1490
  return { ok: false, output: 'Error: old_string not found in file.' };
1442
1491
  if (count > 1 && !args.replace_all)
@@ -1448,7 +1497,7 @@ export async function executeTool(name, args) {
1448
1497
  recordCheckpoint(fp, _ebefore, 'Edit'); // rewind: düzenleme öncesi tam içerik
1449
1498
  c = args.replace_all ? c.split(oldStr).join(newStr) : c.replace(oldStr, newStr);
1450
1499
  fs.writeFileSync(fp, c);
1451
- return { ok: true, output: `Edited ${fp}${args.replace_all ? ` (${count} occurrences)` : ''}${diffStat(_ebefore, c)}` };
1500
+ return { ok: true, output: `Edited ${fp}${args.replace_all ? ` (${count} occurrences)` : ''}${_fuzzy}${diffStat(_ebefore, c)}` };
1452
1501
  }
1453
1502
  if (name === 'Glob') {
1454
1503
  const base = args.path ? resolveWs(args.path) : getBashCwd();
package/dist/tui.js CHANGED
@@ -534,16 +534,16 @@ export async function runTui() {
534
534
  for (let i = 0; i < toolCalls.length; i++) {
535
535
  let _content = capToolOut(toolCalls[i].name, results[i].output || '');
536
536
  if (!results[i].ok && !_willStop) {
537
- _content += getLang() === 'en'
538
- ? '\n\n[REFLECT] This call failed. Before continuing, think briefly: (1) WHY did it fail? (2) Do NOT repeat the same call verbatim — fix the arguments or try a DIFFERENT approach/tool. (3) If it cannot be solved, tell the user plainly. Never give up silently or loop.'
539
- : '\n\n[DÜŞÜN] Bu çağrı başarısız oldu. Devam etmeden kısaca düşün: (1) NEDEN başarısız oldu? (2) Aynı çağrıyı AYNEN tekrarlamaparametreyi düzelt ya da BAŞKA bir yol/araç dene. (3) Çözülemiyorsa kullanıcıya açıkça söyle. Asla sessizce pes etme, döngüye girme.';
537
+ // Direktif İNGİLİZCE (model-yönlü) Türkçe direktif instruction-following'i bozar
538
+ // (prompt-language-english kuralı). Model yine sohbet diliyle (TR) cevaplar.
539
+ _content += '\n\n[REFLECT] This call failed. Before continuing, think briefly: (1) WHY did it fail? (2) Do NOT repeat the same call verbatim fix the arguments or try a DIFFERENT approach/tool. (3) If it cannot be solved, tell the user plainly in their language. Never give up silently or loop.';
540
540
  }
541
541
  history.push({ role: 'tool', tool_call_id: toolCalls[i].id, content: _content });
542
542
  }
543
543
  if (_willStop) {
544
- history.push({ role: 'user', content: getLang() === 'en'
545
- ? 'Several commands failed required tools/syntax are not available here (e.g. grep/openssl/hydra on Windows). STOP running commands now and give a SHORT summary of what you found so far. Do NOT call more tools, do NOT use grep/sed/awk.'
546
- : 'Komutlar başarısız oldubu ortamda gerekli araç/sözdizim yok (Windows\'ta grep/openssl/hydra gibi). Komut çalıştırmayı ŞİMDİ BIRAK, şu ana kadarki bulguları KISA özetle. Başka araç çağırma, grep/sed/awk kullanma.' });
544
+ // Model-yönlü direktif İNGİLİZCE (Türkçe direktif instruction-following'i bozar);
545
+ // model yine kullanıcının diliyle özetler. (Kullanıcı-yönlü not aşağıda TR kalır.)
546
+ history.push({ role: 'user', content: 'Several commands failed required tools/syntax are not available here (e.g. grep/openssl/hydra on Windows). STOP running commands now and give a SHORT summary of what you found so far, in the user\'s language. Do NOT call more tools, do NOT use grep/sed/awk.' });
547
547
  printItem({ kind: 'note', text: getLang() === 'en' ? 'Commands kept failing — wrapping up.' : 'Komutlar başarısız oldu — özetle bitiriliyor.' });
548
548
  consecFail = 0;
549
549
  totalFails = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wormclaude",
3
- "version": "1.0.198",
3
+ "version": "1.0.200",
4
4
  "description": "WormClaude CLI - uncensored security+code assistant (ink TUI, Claude-style)",
5
5
  "type": "module",
6
6
  "bin": {