wormclaude 1.0.39 → 1.0.41
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 +1 -1
- package/dist/tui.js +41 -6
- package/package.json +1 -1
package/dist/theme.js
CHANGED
package/dist/tui.js
CHANGED
|
@@ -41,7 +41,14 @@ const vis = (s) => stringWidth(s.replace(/\x1b\[[0-9;]*m/g, ''));
|
|
|
41
41
|
export async function runTui() {
|
|
42
42
|
const config = loadConfig();
|
|
43
43
|
let account = { plan: '', email: '', name: '' };
|
|
44
|
-
|
|
44
|
+
// Ortam bağlamı (Windows/cwd) — model DOĞRU yol/komut kullansın (yoksa /home/user gibi yanlış yol yazar).
|
|
45
|
+
const _plat = process.platform === 'win32' ? 'Windows' : process.platform === 'darwin' ? 'macOS' : 'Linux';
|
|
46
|
+
const _winNote = process.platform === 'win32'
|
|
47
|
+
? ' This is WINDOWS. Write files to the CURRENT directory (relative paths) or under C:\\Users\\... — NEVER use /home/user or other Unix paths. The Bash tool runs via cmd.exe (use Windows commands).'
|
|
48
|
+
: ' Use POSIX paths.';
|
|
49
|
+
const history = [
|
|
50
|
+
{ role: 'system', content: `ENVIRONMENT: The user machine runs ${_plat}. Current working directory: ${process.cwd()}.${_winNote}` },
|
|
51
|
+
];
|
|
45
52
|
const displayItems = [{ kind: 'banner' }];
|
|
46
53
|
let inputBuf = '', busy = false, streamChars = 0, spin = 0;
|
|
47
54
|
const SPIN = ['·', '✢', '✳', '✶', '✻', '✽', '✶', '✳', '✢'];
|
|
@@ -50,6 +57,8 @@ export async function runTui() {
|
|
|
50
57
|
// İzin (araç onayı) durumu
|
|
51
58
|
let perm = null;
|
|
52
59
|
const allowAll = new Set(); // "Tümüne izin" denen araçlar (oturum boyu)
|
|
60
|
+
const inputHistory = []; // gönderilen mesajlar (↑/↓ ile geri çağrılır)
|
|
61
|
+
let histIdx = -1; // -1 = geçmişte gezinmiyor
|
|
53
62
|
// ── Claude tarzı başlık (model/plan/mail/cwd) — responsive ──
|
|
54
63
|
function headerLines(W) {
|
|
55
64
|
const a = paint(' WormClaude ', theme.greyDim) + paint('v' + VERSION, theme.red, true)
|
|
@@ -71,7 +80,7 @@ export async function runTui() {
|
|
|
71
80
|
let body;
|
|
72
81
|
if (perm) {
|
|
73
82
|
// İzin dialogu: araç adı + Evet/Tümü/Hayır
|
|
74
|
-
const q = paint('
|
|
83
|
+
const q = paint(' İZİN ', theme.redBright, true) + paint(perm.label, theme.white) + paint(' çalıştırılsın mı?', theme.grey);
|
|
75
84
|
const opts = paint(' [E] Evet', theme.redBright, true) + paint(' · ', theme.greyDim)
|
|
76
85
|
+ paint('[T] Tümüne izin', theme.grey) + paint(' · ', theme.greyDim) + paint('[H] Hayır', theme.grey);
|
|
77
86
|
body = [line, q, opts, line];
|
|
@@ -82,10 +91,11 @@ export async function runTui() {
|
|
|
82
91
|
if (vis(shown) > avail)
|
|
83
92
|
shown = '…' + shown.slice(-(avail - 1));
|
|
84
93
|
const inputLine = paint('❯ ', theme.redBright, true) + paint(shown, theme.white) + paint('▌', theme.greyDim);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
// Durum satırı KUTUNUN ÜSTÜNDE (en altta değil): çalışırken spinner, boştayken ipucu.
|
|
95
|
+
const status = busy
|
|
96
|
+
? paint(` ${SPIN[spin % SPIN.length]} çalışıyor…${streamChars ? ' ' + streamChars + ' karakter' : ''}`, theme.grey)
|
|
97
|
+
: paint(' /kopyala · /help komutlar · ↑↓ geçmiş · Ctrl+C çıkış', theme.greyDim);
|
|
98
|
+
body = [status, line, inputLine, line];
|
|
89
99
|
}
|
|
90
100
|
let out = '\x1b7'; // imleci kaydet
|
|
91
101
|
body.forEach((l, i) => { out += `\x1b[${start + i};1H\x1b[2K` + fit(l, W); });
|
|
@@ -239,15 +249,40 @@ export async function runTui() {
|
|
|
239
249
|
if (key && key.ctrl && key.name === 'd') {
|
|
240
250
|
quit();
|
|
241
251
|
}
|
|
252
|
+
// ↑/↓ — geçmiş mesajlarda gezin (shell tarzı komut geçmişi)
|
|
253
|
+
if (key && key.name === 'up') {
|
|
254
|
+
if (inputHistory.length) {
|
|
255
|
+
histIdx = histIdx < 0 ? inputHistory.length - 1 : Math.max(0, histIdx - 1);
|
|
256
|
+
inputBuf = inputHistory[histIdx];
|
|
257
|
+
drawFooter();
|
|
258
|
+
}
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (key && key.name === 'down') {
|
|
262
|
+
if (histIdx >= 0) {
|
|
263
|
+
histIdx++;
|
|
264
|
+
if (histIdx >= inputHistory.length) {
|
|
265
|
+
histIdx = -1;
|
|
266
|
+
inputBuf = '';
|
|
267
|
+
}
|
|
268
|
+
else
|
|
269
|
+
inputBuf = inputHistory[histIdx];
|
|
270
|
+
drawFooter();
|
|
271
|
+
}
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
242
274
|
if (key && key.name === 'return') {
|
|
243
275
|
if (busy)
|
|
244
276
|
return; // tur sürerken Enter beklemede; yazılan metin durur (type-ahead)
|
|
245
277
|
const v = inputBuf.trim();
|
|
246
278
|
inputBuf = '';
|
|
279
|
+
histIdx = -1;
|
|
247
280
|
if (!v) {
|
|
248
281
|
drawFooter();
|
|
249
282
|
return;
|
|
250
283
|
}
|
|
284
|
+
if (v)
|
|
285
|
+
inputHistory.push(v); // geçmişe ekle (↑ ile geri çağrılır)
|
|
251
286
|
if (v === '/cikis' || v === '/exit' || v === '/quit') {
|
|
252
287
|
quit();
|
|
253
288
|
}
|