wormclaude 1.0.116 → 1.0.118

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/cli.js CHANGED
@@ -35,7 +35,7 @@ function loadSession() {
35
35
  }
36
36
  import { theme, VERSION } from './theme.js';
37
37
  import { loadConfig, streamChat, fetchAccount } from './api.js';
38
- import { stripInlineToolCalls } from './inlinetools.js';
38
+ import { stripInlineToolCalls, stripEchoBlocks } from './inlinetools.js';
39
39
  import { newTrace, flushTelemetry } from './telemetry.js';
40
40
  import { tier } from './program.js';
41
41
  import { allToolSchemas, executeToolCalls, executeTool, toolLabel, setToolConfig, setBashCwd } from './tools.js';
@@ -782,7 +782,7 @@ function App() {
782
782
  // Canlı akışta da gömülü tool-call JSON'unu gizle: model uzun çok-adımlı mesaj yazarken
783
783
  // ham {"name":"Bash",...} görünmesin. (stripInlineToolCalls "name" yoksa hemen döner →
784
784
  // düz metinde maliyet yok.) Tamamlanmamış son blok doğal olarak kalır, sonra temizlenir.
785
- const cleaned = stripInlineToolCalls(cleanModelText(assistantText));
785
+ const cleaned = stripEchoBlocks(stripInlineToolCalls(cleanModelText(assistantText)));
786
786
  const tail = cleaned.length > TAIL_CHARS ? cleaned.slice(-TAIL_CHARS) : cleaned;
787
787
  setStreaming(tail);
788
788
  setTokens(Math.round(assistantText.length / 4));
@@ -815,7 +815,7 @@ function App() {
815
815
  assistantText = cleanModelText(assistantText);
816
816
  // Model araç çağrısını metne gömdüyse (gömülü JSON / AskUserQuestion prose) → gösterim+
817
817
  // geçmişten temizle. HER ZAMAN çalıştır: recovery kaçsa bile ham JSON ekrana sızmasın.
818
- assistantText = stripInlineToolCalls(assistantText);
818
+ assistantText = stripEchoBlocks(stripInlineToolCalls(assistantText));
819
819
  // Reactive compact: bağlam taştıysa bir kez özetle ve turu tekrar dene
820
820
  if (gotCtxError && !reactiveRetried) {
821
821
  reactiveRetried = true;
package/dist/compact.js CHANGED
@@ -7,7 +7,9 @@ import { approxTokens } from './usage.js';
7
7
  // Model tavanı değişirse bu değer de güncellenmeli (ya da WORMCLAUDE_CONTEXT_WINDOW ile override).
8
8
  const CONTEXT_WINDOW = Number(process.env.WORMCLAUDE_CONTEXT_WINDOW) || 32768;
9
9
  const SUMMARY_RESERVE = 4000; // özet çıktısı için rezerv (CC: ~20K büyük modellerde)
10
- const AUTOCOMPACT_BUFFER = 2000;
10
+ // Erken tetikle (~%69): geç tetiklenince tek bir turun büyük çıktısı (grep/curl) pencereyi
11
+ // taşırıp "token bitti → yazılmıyor"a sokuyordu. Erken tazeleme = kesilme yok.
12
+ const AUTOCOMPACT_BUFFER = 6000;
11
13
  export function autoCompactThreshold() {
12
14
  return CONTEXT_WINDOW - SUMMARY_RESERVE - AUTOCOMPACT_BUFFER;
13
15
  }
@@ -128,6 +128,17 @@ export function recoverInlineToolCalls(text) {
128
128
  }
129
129
  return out;
130
130
  }
131
+ /** Modelin komut/çıktıyı TEKRAR yazdığı kod-bloklarını siler (```plaintext/bash/http/console…).
132
+ * Zayıf 32B araç çıktısını (SSL handshake, header'lar, curl gövdesi) cevabında reproduce edip
133
+ * context'i şişiriyor + ekranı kirletiyor. Bunlar narrasyon — tool zaten çalıştı, sonucu kompakt
134
+ * gösteriliyor. NOT: python/js/ts/css gibi GERÇEK kod dilleri korunur (build çıktısı bozulmasın). */
135
+ const _ECHO_LANGS = /^(plaintext|plain|text|txt|http|https|console|bash|sh|shell|zsh|cmd|powershell|ps1|output|log|raw)$/i;
136
+ export function stripEchoBlocks(text) {
137
+ let s = text || '';
138
+ // Yalnız AÇIK echo-dilli blokları sil (dilsiz/python/js/html korunur → build çıktısı bozulmaz).
139
+ s = s.replace(/```([a-zA-Z0-9_+-]+)[ \t]*\r?\n([\s\S]*?)```/g, (blk, lang) => (_ECHO_LANGS.test(lang) ? '' : blk));
140
+ return s.replace(/\n{3,}/g, '\n\n').trim();
141
+ }
131
142
  /** Kurtarılan çağrı bloklarını GÖRÜNTÜ/geçmiş metninden temizler (çirkin JSON kalmasın). */
132
143
  export function stripInlineToolCalls(text) {
133
144
  let s = text || '';
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.116';
19
+ export const VERSION = '1.0.118';
package/dist/tools.js CHANGED
@@ -1137,7 +1137,9 @@ export async function executeTool(name, args) {
1137
1137
  const showLineNo = args['-n'] !== false; // content modunda varsayılan true
1138
1138
  const after = Number(args['-A'] ?? args['-C'] ?? args.context ?? 0);
1139
1139
  const before = Number(args['-B'] ?? args['-C'] ?? args.context ?? 0);
1140
- const headLimit = args.head_limit === 0 ? Infinity : Number(args.head_limit) || 250;
1140
+ // Varsayılan 60 eşleşme: yüzlerce satırlık çıktı context'i şişirip modeli tekrar-döngüsüne
1141
+ // (sahte link üretimi) sokuyordu. Model gerekirse head_limit ile artırabilir.
1142
+ const headLimit = args.head_limit === 0 ? Infinity : Number(args.head_limit) || 60;
1141
1143
  const offset = Number(args.offset) || 0;
1142
1144
  const reset = () => { rx.lastIndex = 0; return rx; };
1143
1145
  const entries = [];
@@ -1206,7 +1208,7 @@ export async function executeTool(name, args) {
1206
1208
  if (!sliced.length)
1207
1209
  return { ok: true, output: '(no matches)' };
1208
1210
  const note = entries.length > sliced.length ? `\n(${entries.length - sliced.length} more, raise head_limit to see)` : '';
1209
- return { ok: true, output: sliced.join('\n').slice(0, 30000) + note + `\n\n[${fileCount} file(s) with matches]` };
1211
+ return { ok: true, output: sliced.join('\n').slice(0, 6000) + note + `\n\n[${fileCount} file(s) with matches]` };
1210
1212
  }
1211
1213
  if (name === 'WebFetch') {
1212
1214
  let url = String(args.url);
package/dist/tui.js CHANGED
@@ -11,14 +11,14 @@ import { sanitizeOutput } from './errorsan.js';
11
11
  import { itemAnsi, markdownAnsi } from './ansi.js';
12
12
  import { theme, VERSION } from './theme.js';
13
13
  import { cleanModelText } from './textclean.js';
14
- import { stripInlineToolCalls } from './inlinetools.js';
14
+ import { stripInlineToolCalls, stripEchoBlocks } from './inlinetools.js';
15
15
  import { COMMANDS, runSlashCommand } from './commands.js';
16
16
  import { cmdDesc, t, setLang, loadLang, getLang } from './i18n.js';
17
17
  import { getSkill, getSkills, buildSkillPrompt } from './skills.js';
18
18
  import { getExtCommand, getExtCommands, buildExtCommandPrompt } from './extensions.js';
19
19
  import { resolveAtMentions } from './atmention.js';
20
20
  import { loadMemoryContext, shouldExtract, triggerMemory } from './memory.js';
21
- import { shouldAutoCompact, runCompact } from './compact.js';
21
+ import { shouldAutoCompact, runCompact, isContextError } from './compact.js';
22
22
  import { recordLearned } from './learn.js';
23
23
  import { connectMcpServers } from './mcp.js';
24
24
  // Komut çıktılarını context'e eklerken KIS: curl/scan gürültüsü (handshake, tüm header'lar)
@@ -288,6 +288,7 @@ export async function runTui() {
288
288
  refresh(); }, 120);
289
289
  let lastSig = '', sameCount = 0, usedWeb = false, lastAnswer = '';
290
290
  let consecFail = 0, totalFails = 0; // devre-kesici: olmayan araç/sözdizimi döngüsünü kır
291
+ let reactiveRetried = false; // bağlam taşmasında bir kez compact+retry
291
292
  try {
292
293
  for (let iter = 0; iter < 25; iter++) {
293
294
  streamChars = 0;
@@ -327,7 +328,7 @@ export async function runTui() {
327
328
  return;
328
329
  // Gömülü araç-çağrısı JSON'unu (```json {"name":...}```) stdout'a YAZMADAN gizle —
329
330
  // stdout append-only, sonradan silinemez. Kesimler fence-güvenli → tam blok burada.
330
- const chunk = stripInlineToolCalls(cleanModelText(answer.slice(committed, cut))).replace(/\n+$/, '');
331
+ const chunk = stripEchoBlocks(stripInlineToolCalls(cleanModelText(answer.slice(committed, cut)))).replace(/\n+$/, '');
331
332
  committed = cut;
332
333
  if (!chunk && !final)
333
334
  return;
@@ -337,6 +338,7 @@ export async function runTui() {
337
338
  process.stdout.write(out); // imleç içerik bölgesinde → aşağı akar, taşınca scrollback'e
338
339
  refresh(); // footer'ı dibe yeniden sabitle
339
340
  };
341
+ let gotCtxErr = false;
340
342
  for await (const ev of streamChat(history, allToolSchemas(), config)) {
341
343
  if (ev.type === 'text') {
342
344
  answer += ev.text;
@@ -350,12 +352,26 @@ export async function runTui() {
350
352
  ctxUsed = u.input;
351
353
  }
352
354
  else if (ev.type === 'error') {
355
+ if (isContextError(ev.error))
356
+ gotCtxErr = true;
353
357
  answer += `\n[hata: ${ev.error}]`;
354
358
  flushStream(false);
355
359
  }
356
360
  }
357
361
  flushStream(true); // kalan yarım satırı bas
358
- answer = stripInlineToolCalls(cleanModelText(answer)).trim();
362
+ // Reactive compact: bağlam taştıysa bir kez özetle ve turu tekrarla → "token bitti, yazılmıyor" olmaz.
363
+ if (gotCtxErr && !reactiveRetried) {
364
+ reactiveRetried = true;
365
+ printItem({ kind: 'note', text: t('tui.autoCompacted') });
366
+ try {
367
+ const { history: nh } = await runCompact(history, config);
368
+ history.length = 0;
369
+ history.push(...nh);
370
+ }
371
+ catch { }
372
+ continue; // tur sayılmaz, kaldığı yerden devam
373
+ }
374
+ answer = stripEchoBlocks(stripInlineToolCalls(cleanModelText(answer))).trim();
359
375
  const am = { role: 'assistant', content: answer || '' };
360
376
  if (toolCalls.length)
361
377
  am.tool_calls = toolCalls.map((t) => ({ id: t.id, type: 'function', function: { name: t.name, arguments: t.args || '{}' } }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wormclaude",
3
- "version": "1.0.116",
3
+ "version": "1.0.118",
4
4
  "description": "WormClaude CLI - uncensored security+code assistant (ink TUI, Claude-style)",
5
5
  "type": "module",
6
6
  "bin": {