wormclaude 1.0.124 → 1.0.126
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/inlinetools.js +55 -2
- package/dist/theme.js +1 -1
- package/dist/tui.js +15 -21
- package/package.json +1 -1
package/dist/inlinetools.js
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
// Bu modül o gömülü çağrıları kurtarır — upstream yapısal tool_call vermediğinde YEDEK.
|
|
8
8
|
import { safeJsonParse } from './safejson.js';
|
|
9
9
|
const ARG_KEYS = ['arguments', 'parameters', 'input', 'args', 'params'];
|
|
10
|
+
// Model araç adını JSON DIŞINA koyabiliyor: `Bash {"command":...}` / `Write {"file_path":...}`.
|
|
11
|
+
const _TOOLS = 'Bash|PowerShell|Read|Write|Edit|Glob|Grep|WebFetch|WebSearch|Sleep|TaskOutput';
|
|
12
|
+
const TOOL_PREFIX_RE = new RegExp('(?:^|[\\n>*`\\s])(' + _TOOLS + ')\\s*\\{');
|
|
10
13
|
function toToolCall(obj, i) {
|
|
11
14
|
if (!obj || typeof obj !== 'object')
|
|
12
15
|
return null;
|
|
@@ -73,8 +76,8 @@ function extractTopLevelJsonObjects(text) {
|
|
|
73
76
|
* (<tool_call>, ```json) veya mesajın TAMAMI tek JSON çağrısıysa onu alır. */
|
|
74
77
|
export function recoverInlineToolCalls(text) {
|
|
75
78
|
const t = (text || '').trim();
|
|
76
|
-
// JSON
|
|
77
|
-
if (!t || (!t.includes('"name"') && !t.includes('"tool"') && !t.includes('"function"') && !/AskUserQuestion/i.test(t)))
|
|
79
|
+
// JSON/prose/ToolName{…} çağrısı yoksa erken çık.
|
|
80
|
+
if (!t || (!t.includes('"name"') && !t.includes('"tool"') && !t.includes('"function"') && !/AskUserQuestion/i.test(t) && !TOOL_PREFIX_RE.test(t)))
|
|
78
81
|
return [];
|
|
79
82
|
const out = [];
|
|
80
83
|
const seen = new Set();
|
|
@@ -126,6 +129,20 @@ export function recoverInlineToolCalls(text) {
|
|
|
126
129
|
push({ name: 'AskUserQuestion', arguments: { question, options } });
|
|
127
130
|
}
|
|
128
131
|
}
|
|
132
|
+
// 5) "ToolName { ...args... }" — model araç adını JSON DIŞINA koyuyor (Bash {"command":...}).
|
|
133
|
+
// Args doğrudan obje (arguments sarmalı yok) → {name: ToolName, arguments: {...}}.
|
|
134
|
+
if (!out.length) {
|
|
135
|
+
const re = new RegExp('(' + _TOOLS + ')\\s*(\\{)', 'g');
|
|
136
|
+
let mm;
|
|
137
|
+
while ((mm = re.exec(t)) !== null) {
|
|
138
|
+
const objs = extractTopLevelJsonObjects(t.slice(mm.index + mm[1].length));
|
|
139
|
+
if (objs.length) {
|
|
140
|
+
const args = safeJsonParse(objs[0], null);
|
|
141
|
+
if (args && typeof args === 'object' && !Array.isArray(args))
|
|
142
|
+
push({ name: mm[1], arguments: args });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
129
146
|
return out;
|
|
130
147
|
}
|
|
131
148
|
/** Modelin komut/çıktıyı TEKRAR yazdığı kod-bloklarını siler (```plaintext/bash/http/console…).
|
|
@@ -154,5 +171,41 @@ export function stripInlineToolCalls(text) {
|
|
|
154
171
|
}
|
|
155
172
|
// AskUserQuestion prose biçimi (interaktif seçiciye çevrildi → metni gizle).
|
|
156
173
|
s = s.replace(/AskUserQuestion[\s\S]*?\[[^\]]*\]\s*/gi, '');
|
|
174
|
+
// ToolName {…} biçimi (Bash {"command":...}) — adı + ardından gelen dengeli {…} bloğunu sil.
|
|
175
|
+
{
|
|
176
|
+
const re = new RegExp('(' + _TOOLS + ')\\s*\\{', 'g');
|
|
177
|
+
let mm;
|
|
178
|
+
const spans = [];
|
|
179
|
+
while ((mm = re.exec(s)) !== null) {
|
|
180
|
+
let depth = 0, inStr = false, esc = false, end = -1;
|
|
181
|
+
for (let i = mm.index + mm[0].length - 1; i < s.length; i++) {
|
|
182
|
+
const c = s[i];
|
|
183
|
+
if (inStr) {
|
|
184
|
+
if (esc)
|
|
185
|
+
esc = false;
|
|
186
|
+
else if (c === '\\')
|
|
187
|
+
esc = true;
|
|
188
|
+
else if (c === '"')
|
|
189
|
+
inStr = false;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (c === '"')
|
|
193
|
+
inStr = true;
|
|
194
|
+
else if (c === '{')
|
|
195
|
+
depth++;
|
|
196
|
+
else if (c === '}') {
|
|
197
|
+
depth--;
|
|
198
|
+
if (depth === 0) {
|
|
199
|
+
end = i + 1;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (end > 0)
|
|
205
|
+
spans.push([mm.index, end]);
|
|
206
|
+
}
|
|
207
|
+
for (let i = spans.length - 1; i >= 0; i--)
|
|
208
|
+
s = s.slice(0, spans[i][0]) + s.slice(spans[i][1]);
|
|
209
|
+
}
|
|
157
210
|
return s.trim();
|
|
158
211
|
}
|
package/dist/theme.js
CHANGED
package/dist/tui.js
CHANGED
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
import readline from 'node:readline';
|
|
7
7
|
import stringWidth from 'string-width';
|
|
8
8
|
import { loadConfig, streamChat, fetchAccount } from './api.js';
|
|
9
|
-
import { allToolSchemas, executeToolCalls, executeTool, toolLabel, setToolConfig
|
|
10
|
-
import * as path from 'node:path';
|
|
11
|
-
import * as fs from 'node:fs';
|
|
9
|
+
import { allToolSchemas, executeToolCalls, executeTool, toolLabel, setToolConfig } from './tools.js';
|
|
12
10
|
import { sanitizeOutput } from './errorsan.js';
|
|
13
11
|
import { itemAnsi, markdownAnsi } from './ansi.js';
|
|
14
12
|
import { theme, VERSION } from './theme.js';
|
|
@@ -451,10 +449,10 @@ export async function runTui() {
|
|
|
451
449
|
catch { }
|
|
452
450
|
process.stdout.write('\x1b[?25l'); // gerçek imleci gizle (kendi ▌ bloğumuzu çiziyoruz)
|
|
453
451
|
redrawAll();
|
|
454
|
-
// Açılış:
|
|
452
|
+
// Açılış: Claude tarzı GÜVEN onayı (yol yazdırma yok — cwd zaten kullanıcının açtığı klasör).
|
|
455
453
|
printItem({ kind: 'note', text: getLang() === 'en'
|
|
456
|
-
?
|
|
457
|
-
:
|
|
454
|
+
? `🔒 Accessing workspace:\n ${process.cwd()}\n\n Trust this folder? It's where files will be created. Press Enter to continue · type "no" to exit · /cd <path> to change later.`
|
|
455
|
+
: `🔒 Çalışma alanına erişiliyor:\n ${process.cwd()}\n\n Bu klasöre güveniyor musun? Dosyalar burada oluşturulur. Devam için Enter · çıkmak için "hayır" yaz · sonra değiştirmek için /cd <yol>.` });
|
|
458
456
|
fetchAccount(config).then((a) => { if (a) {
|
|
459
457
|
account = a;
|
|
460
458
|
redrawAll();
|
|
@@ -623,24 +621,20 @@ export async function runTui() {
|
|
|
623
621
|
inputBuf = '';
|
|
624
622
|
inputCur = 0;
|
|
625
623
|
histIdx = -1;
|
|
626
|
-
// Açılış
|
|
624
|
+
// Açılış GÜVEN onayı (Claude tarzı): Enter = onayla, "hayır"/"no" = çık. Yol yazdırma YOK.
|
|
627
625
|
if (awaitingWorkspace) {
|
|
628
626
|
awaitingWorkspace = false;
|
|
629
|
-
const
|
|
630
|
-
if (
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
fs.mkdirSync(abs, { recursive: true });
|
|
634
|
-
process.chdir(abs);
|
|
635
|
-
setBashCwd(abs);
|
|
636
|
-
}
|
|
637
|
-
catch (e) {
|
|
638
|
-
printItem({ kind: 'note', text: (getLang() === 'en' ? 'Folder error: ' : 'Klasör hatası: ') + (e?.message || e) });
|
|
639
|
-
}
|
|
627
|
+
const _low = v.toLowerCase();
|
|
628
|
+
if (['hayır', 'hayir', 'no', 'n', 'q', 'exit', 'quit', 'çık', 'cik'].includes(_low)) {
|
|
629
|
+
quit();
|
|
630
|
+
return;
|
|
640
631
|
}
|
|
641
|
-
printItem({ kind: 'note', text: (getLang() === 'en' ? '
|
|
642
|
-
|
|
643
|
-
|
|
632
|
+
printItem({ kind: 'note', text: '✓ ' + (getLang() === 'en' ? 'Workspace trusted: ' : 'Klasöre güvenildi: ') + process.cwd() });
|
|
633
|
+
if (!v) {
|
|
634
|
+
refresh();
|
|
635
|
+
return;
|
|
636
|
+
} // sadece Enter → onayla, görev bekle
|
|
637
|
+
// görev yazıldıysa → onayla + aşağı düşüp çalıştır
|
|
644
638
|
}
|
|
645
639
|
if (!v) {
|
|
646
640
|
refresh();
|