wormclaude 1.0.111 → 1.0.112
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 +54 -0
- package/dist/commands.js +1 -0
- package/dist/theme.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4,6 +4,35 @@ import { render, Box, Text, useApp, useInput } from 'ink';
|
|
|
4
4
|
import LineEditor from './lineeditor.js';
|
|
5
5
|
import * as path from 'node:path';
|
|
6
6
|
import * as fs from 'node:fs';
|
|
7
|
+
import * as os from 'node:os';
|
|
8
|
+
// ── Oturum kalıcılığı (resume): her tur sonunda geçmişi diske yazar; CLI çökerse/çıkarsa
|
|
9
|
+
// /resume ile kaldığı yerden devam edilir. Workspace (cwd) başına ayrı dosya.
|
|
10
|
+
const _sessionFile = () => {
|
|
11
|
+
const key = Buffer.from(process.cwd()).toString('base64').replace(/[^a-zA-Z0-9]/g, '').slice(0, 32) || 'default';
|
|
12
|
+
return path.join(os.homedir(), '.wormclaude', 'sessions', `${key}.json`);
|
|
13
|
+
};
|
|
14
|
+
function saveSession(history) {
|
|
15
|
+
try {
|
|
16
|
+
if (!history || history.length <= 1)
|
|
17
|
+
return; // sadece sistem mesajı varsa kaydetme
|
|
18
|
+
const f = _sessionFile();
|
|
19
|
+
fs.mkdirSync(path.dirname(f), { recursive: true });
|
|
20
|
+
fs.writeFileSync(f, JSON.stringify({ cwd: process.cwd(), time: 0, history }));
|
|
21
|
+
}
|
|
22
|
+
catch { /* yok say */ }
|
|
23
|
+
}
|
|
24
|
+
function loadSession() {
|
|
25
|
+
try {
|
|
26
|
+
const f = _sessionFile();
|
|
27
|
+
if (!fs.existsSync(f))
|
|
28
|
+
return null;
|
|
29
|
+
const d = JSON.parse(fs.readFileSync(f, 'utf8'));
|
|
30
|
+
return Array.isArray(d.history) && d.history.length > 1 ? d.history : null;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
7
36
|
import { theme, VERSION } from './theme.js';
|
|
8
37
|
import { loadConfig, streamChat, fetchAccount } from './api.js';
|
|
9
38
|
import { stripInlineToolCalls } from './inlinetools.js';
|
|
@@ -635,6 +664,15 @@ function App() {
|
|
|
635
664
|
setTrustLevel(a.trustLevel); }).catch(() => { });
|
|
636
665
|
return () => { alive = false; };
|
|
637
666
|
}, [started]);
|
|
667
|
+
// Açılışta bu klasörde kayıtlı oturum varsa /resume ipucu göster (kesinti/çökme sonrası devam)
|
|
668
|
+
useEffect(() => {
|
|
669
|
+
if (!started)
|
|
670
|
+
return;
|
|
671
|
+
if (loadSession()) {
|
|
672
|
+
push({ kind: 'note', text: getLang() === 'en' ? 'Previous session found for this folder — type /resume to continue where you left off.' : 'Bu klasörde önceki oturum bulundu — kaldığın yerden devam için /resume yaz.' });
|
|
673
|
+
}
|
|
674
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
675
|
+
}, [started]);
|
|
638
676
|
const push = (it) => setItems((prev) => [...prev, it]);
|
|
639
677
|
// Arka plan görevlerini izle → footer pill
|
|
640
678
|
useEffect(() => {
|
|
@@ -888,6 +926,8 @@ function App() {
|
|
|
888
926
|
if (recordLearned(userText, lastAnswer, sources, config)) {
|
|
889
927
|
}
|
|
890
928
|
}
|
|
929
|
+
// Resume: tur bitti, geçmişi diske yaz (CLI çökerse /resume ile devam).
|
|
930
|
+
saveSession(historyRef.current);
|
|
891
931
|
// Oto-hafıza: eşik geçildiyse arka planda hafızayı güncelle
|
|
892
932
|
if (shouldExtract(historyRef.current))
|
|
893
933
|
triggerMemory(historyRef.current, config);
|
|
@@ -984,6 +1024,20 @@ function App() {
|
|
|
984
1024
|
}
|
|
985
1025
|
return;
|
|
986
1026
|
}
|
|
1027
|
+
// /resume — bu klasördeki önceki oturumu (kesinti/çökme sonrası) geri yükle
|
|
1028
|
+
if (tok === '/resume' || tok === '/devam') {
|
|
1029
|
+
const en = getLang() === 'en';
|
|
1030
|
+
const h = loadSession();
|
|
1031
|
+
if (!h) {
|
|
1032
|
+
push({ kind: 'note', text: en ? 'No saved session for this folder.' : 'Bu klasörde kayıtlı oturum yok.' });
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
historyRef.current = h;
|
|
1036
|
+
setCtxTokens(Math.round(JSON.stringify(h).length / 4));
|
|
1037
|
+
const _n = h.filter((m) => m.role === 'user' || m.role === 'assistant').length;
|
|
1038
|
+
push({ kind: 'note', text: en ? `✓ Resumed previous session (${_n} messages). Continue where you left off.` : `✓ Önceki oturum yüklendi (${_n} mesaj). Kaldığın yerden devam edebilirsin.` });
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
987
1041
|
// /agent ve /multi-agent — tek / çoklu alt-agent
|
|
988
1042
|
if (tok === '/agent' || tok === '/multi-agent') {
|
|
989
1043
|
const task = v.slice(tok.length).trim();
|
package/dist/commands.js
CHANGED
|
@@ -21,6 +21,7 @@ export const COMMANDS = [
|
|
|
21
21
|
{ name: '/clear', desc: 'sohbeti ve geçmişi temizle' },
|
|
22
22
|
{ name: '/kopyala', desc: 'son yanıtı panoya kopyala (/kopyala hepsi · tüm sohbet)' },
|
|
23
23
|
{ name: '/cd', desc: 'çalışma klasörünü değiştir — dosyalar buraya yazılır: /cd <yol>' },
|
|
24
|
+
{ name: '/resume', desc: 'bu klasördeki önceki oturumu geri yükle (kesinti/çökme sonrası devam)' },
|
|
24
25
|
{ name: '/compact', desc: 'geçmişi modelle özetleyip bağlamı küçült' },
|
|
25
26
|
{ name: '/context', desc: 'bağlam / token kullanımını göster' },
|
|
26
27
|
{ name: '/cost', desc: 'oturum token tahminini göster' },
|
package/dist/theme.js
CHANGED