wormclaude 1.0.7 → 1.0.9
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 +41 -9
- package/dist/memory.js +19 -0
- package/dist/theme.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ import { tasks } from './tasks.js';
|
|
|
16
16
|
import { connectMcpServers } from './mcp.js';
|
|
17
17
|
import * as usage from './usage.js';
|
|
18
18
|
import { shouldAutoCompact, runCompact, isContextError } from './compact.js';
|
|
19
|
-
import { shouldExtract, triggerMemory } from './memory.js';
|
|
19
|
+
import { shouldExtract, triggerMemory, loadMemoryContext } from './memory.js';
|
|
20
20
|
// --- WORMCLAUDE SUBCOMMANDS (TUI oncesi) ---
|
|
21
21
|
const _arg = (process.argv[2] || '').toLowerCase();
|
|
22
22
|
if (_arg === 'login' || _arg === 'logout' || _arg === 'whoami' || _arg === '--version' || _arg === '-v' || _arg === 'update') {
|
|
@@ -57,9 +57,12 @@ import('./auth.js').then((a) => a.checkForUpdate(VERSION)).then((v) => { _update
|
|
|
57
57
|
process.on('exit', () => { if (_updateLatest)
|
|
58
58
|
process.stdout.write('\n Yeni surum var: ' + VERSION + ' -> ' + _updateLatest + '. Guncelle: wormclaude update\n'); });
|
|
59
59
|
setToolConfig(config); // Agent/alt-agent araçları aynı config'i kullanır
|
|
60
|
-
const MAX_TURNS = Number(process.env.WORMCLAUDE_MAX_TURNS) ||
|
|
60
|
+
const MAX_TURNS = Number(process.env.WORMCLAUDE_MAX_TURNS) || 50; // tur limiti
|
|
61
61
|
setLang(loadLang() ?? 'tr'); // kayıtlı dili yükle (yoksa tr)
|
|
62
62
|
loadSkills(); // .wormclaude/skills/*.md yükle
|
|
63
|
+
// Kalıcı hafıza: açılışta .wormclaude/memory.md + WORMCLAUDE.md'yi context'e yükle
|
|
64
|
+
const _memCtx = loadMemoryContext();
|
|
65
|
+
const _initHistory = () => (_memCtx ? [{ role: 'system', content: _memCtx }] : []);
|
|
63
66
|
// FULLSCREEN (alternate screen) — WormClaude'un yöntemi: tüm ekranı ink yönetir,
|
|
64
67
|
// scrollback YOK, resize'da HER ŞEY yeniden çizilir → sarmalanma/kaskad olmaz.
|
|
65
68
|
// ?1049h alt-screen · ?1007h alternate-scroll (fare tekerleği → ok tuşu; seçim bozulmaz)
|
|
@@ -245,16 +248,29 @@ function WormSpinner({ label, tokens }) {
|
|
|
245
248
|
" tokens") : null));
|
|
246
249
|
}
|
|
247
250
|
function StatusLine({ model, ctxTokens }) {
|
|
248
|
-
const
|
|
251
|
+
const max = Number(process.env.WORMCLAUDE_CTX) || 12288;
|
|
252
|
+
const pct = Math.min(100, Math.round((ctxTokens / max) * 100));
|
|
253
|
+
const filled = Math.round(pct / 10);
|
|
254
|
+
const bar = '█'.repeat(filled) + '░'.repeat(10 - filled);
|
|
255
|
+
const barColor = pct > 85 ? theme.errorRed : pct > 60 ? theme.redBright : theme.grey;
|
|
249
256
|
return (React.createElement(Box, null,
|
|
250
257
|
React.createElement(Text, { color: theme.greyDim },
|
|
251
258
|
' ',
|
|
259
|
+
"WormClaude "),
|
|
260
|
+
React.createElement(Text, { color: theme.red, bold: true },
|
|
261
|
+
"v",
|
|
262
|
+
VERSION),
|
|
263
|
+
React.createElement(Text, { color: theme.greyDim },
|
|
264
|
+
" \u00B7 ",
|
|
252
265
|
model,
|
|
253
|
-
" \u00B7
|
|
254
|
-
|
|
255
|
-
|
|
266
|
+
" \u00B7 "),
|
|
267
|
+
React.createElement(Text, { color: barColor }, bar),
|
|
268
|
+
React.createElement(Text, { color: theme.greyDim },
|
|
269
|
+
" ",
|
|
256
270
|
pct,
|
|
257
|
-
"%
|
|
271
|
+
"% \u00B7 ",
|
|
272
|
+
ctxTokens.toLocaleString(),
|
|
273
|
+
" tok")));
|
|
258
274
|
}
|
|
259
275
|
function App() {
|
|
260
276
|
const { exit } = useApp();
|
|
@@ -284,7 +300,7 @@ function App() {
|
|
|
284
300
|
const allowedToolsRef = useRef(new Set()); // oturum boyu izinli araçlar
|
|
285
301
|
const [ask, setAsk] = useState(null);
|
|
286
302
|
const [askSel, setAskSel] = useState(0); // AskUserQuestion seçimi
|
|
287
|
-
const historyRef = useRef(
|
|
303
|
+
const historyRef = useRef(_initHistory());
|
|
288
304
|
// Acilis: klasore guven sorusu (WormClaude tarzi) — yon tuslari/1-2 sec, Enter onay
|
|
289
305
|
// Dil seçimi (ilk açılış)
|
|
290
306
|
useInput((inp, key) => {
|
|
@@ -470,6 +486,8 @@ function App() {
|
|
|
470
486
|
let done = false;
|
|
471
487
|
let usedWeb = false; // bu turda web aracı kullanıldı mı (öğrenme için)
|
|
472
488
|
let lastAnswer = ''; // modelin son (sentez) cevabı
|
|
489
|
+
let lastToolSig = '';
|
|
490
|
+
let sameToolCount = 0;
|
|
473
491
|
while (iter < MAX_TURNS) {
|
|
474
492
|
if (ac.signal.aborted) {
|
|
475
493
|
push({ kind: 'note', text: t('note.interrupted') });
|
|
@@ -554,6 +572,20 @@ function App() {
|
|
|
554
572
|
done = true;
|
|
555
573
|
break;
|
|
556
574
|
}
|
|
575
|
+
// Takilma korumasi: ayni arac cagrisi 3 kez ust uste gelirse dur
|
|
576
|
+
const _sig = JSON.stringify(toolCalls.map((tc) => tc.name + ':' + (tc.args || '')));
|
|
577
|
+
if (_sig === lastToolSig) {
|
|
578
|
+
sameToolCount++;
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
sameToolCount = 0;
|
|
582
|
+
lastToolSig = _sig;
|
|
583
|
+
}
|
|
584
|
+
if (sameToolCount >= 2) {
|
|
585
|
+
push({ kind: 'note', text: getLang() === 'en' ? 'Same step repeated 3x, stopping to avoid a loop.' : 'Ayni adim 3 kez tekrarlandi, dongu onlemek icin durduruldu.' });
|
|
586
|
+
done = true;
|
|
587
|
+
break;
|
|
588
|
+
}
|
|
557
589
|
// Paralel araç çalıştırma + izin onayı (yazanlar sıralı)
|
|
558
590
|
setThinking(false);
|
|
559
591
|
setPhase(toolCalls.length > 1 ? t('phase.toolsMulti', toolCalls.length) : t('phase.toolRun', toolCalls[0].name));
|
|
@@ -681,7 +713,7 @@ function App() {
|
|
|
681
713
|
setHistory: (h) => { historyRef.current = h; setCtxTokens(Math.round(JSON.stringify(h).length / 4)); },
|
|
682
714
|
note: (text) => push({ kind: 'note', text }),
|
|
683
715
|
assistant: (text) => push({ kind: 'assistant', text }),
|
|
684
|
-
clearConv: () => { setItems([{ kind: 'banner' }]); historyRef.current =
|
|
716
|
+
clearConv: () => { setItems([{ kind: 'banner' }]); historyRef.current = _initHistory(); },
|
|
685
717
|
exit,
|
|
686
718
|
};
|
|
687
719
|
setBusy(true);
|
package/dist/memory.js
CHANGED
|
@@ -133,3 +133,22 @@ export function dreamTimeGatePassed() {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
export function getMemoryPath() { return MEM_FILE; }
|
|
136
|
+
// Kalıcı hafızayı başlangıçta context'e yüklemek için oku.
|
|
137
|
+
// .wormclaude/memory.md (oturumlar arası hafıza) + WORMCLAUDE.md (proje notu).
|
|
138
|
+
export function loadMemoryContext() {
|
|
139
|
+
const parts = [];
|
|
140
|
+
try {
|
|
141
|
+
const proj = path.join(process.cwd(), 'WORMCLAUDE.md');
|
|
142
|
+
const c = fs.readFileSync(proj, 'utf8').trim();
|
|
143
|
+
if (c)
|
|
144
|
+
parts.push('# Proje notu (WORMCLAUDE.md)\n' + c.slice(0, 6000));
|
|
145
|
+
}
|
|
146
|
+
catch { }
|
|
147
|
+
try {
|
|
148
|
+
const c = fs.readFileSync(MEM_FILE, 'utf8').trim();
|
|
149
|
+
if (c)
|
|
150
|
+
parts.push('# Hatırlanan bilgiler — önceki oturumlardan\n' + c.slice(0, 6000));
|
|
151
|
+
}
|
|
152
|
+
catch { }
|
|
153
|
+
return parts.join('\n\n');
|
|
154
|
+
}
|
package/dist/theme.js
CHANGED