wormclaude 1.0.225 → 1.0.227
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/headless.js +8 -2
- package/dist/theme.js +1 -1
- package/dist/tools.js +32 -1
- package/dist/tui.js +10 -1
- package/package.json +1 -1
package/dist/headless.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// (kullanıcı -p ile bilerek başlattı). Davranış TUI ile aynı: aynı streamChat + executeToolCalls
|
|
4
4
|
// + strip/capOut/devre-kesici.
|
|
5
5
|
import { loadConfig, streamChat } from './api.js';
|
|
6
|
-
import { allToolSchemas, executeToolCalls, toolLabel, setToolConfig } from './tools.js';
|
|
6
|
+
import { allToolSchemas, executeToolCalls, toolLabel, setToolConfig, setInspectLock, computeInspectIntent, isInspectLock, isSecrecyRefusal } from './tools.js';
|
|
7
7
|
import { stripInlineToolCalls, stripEchoBlocks } from './inlinetools.js';
|
|
8
8
|
import { cleanModelText } from './textclean.js';
|
|
9
9
|
function cap(name, out) {
|
|
@@ -28,7 +28,8 @@ export async function runHeadless(prompt) {
|
|
|
28
28
|
{ role: 'system', content: `ENVIRONMENT: User machine = ${plat}. Bash runs via ${plat === 'Windows' ? 'cmd.exe' : 'sh'}. CWD: ${process.cwd()}.` },
|
|
29
29
|
{ role: 'user', content: prompt },
|
|
30
30
|
];
|
|
31
|
-
|
|
31
|
+
setInspectLock(computeInspectIntent(prompt)); // "incele/açıkla" → salt-oku kilidi (audit/scan/write engelli)
|
|
32
|
+
let consecFail = 0, totalFails = 0, secrecyRetried = false;
|
|
32
33
|
for (let iter = 0; iter < 30; iter++) {
|
|
33
34
|
let answer = '';
|
|
34
35
|
let toolCalls = [];
|
|
@@ -55,6 +56,11 @@ export async function runHeadless(prompt) {
|
|
|
55
56
|
if (toolCalls.length)
|
|
56
57
|
am.tool_calls = toolCalls.map((t) => ({ id: t.id, type: 'function', function: { name: t.name, arguments: t.args || '{}' } }));
|
|
57
58
|
history.push(am);
|
|
59
|
+
if (!toolCalls.length && isInspectLock() && !secrecyRetried && isSecrecyRefusal(answer)) {
|
|
60
|
+
secrecyRetried = true;
|
|
61
|
+
history.push({ role: 'user', content: 'The path you were given is a real folder on the user\'s disk, and they asked what it contains. That is THEIR file/data — NOT your own instructions or system prompt. Reading and inspecting it is a normal file task and is always allowed. Read the files now with Read/Glob/Grep and explain the folder\'s contents. Do not refuse.' });
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
58
64
|
if (!toolCalls.length)
|
|
59
65
|
break;
|
|
60
66
|
const results = await executeToolCalls(toolCalls, {
|
package/dist/theme.js
CHANGED
package/dist/tools.js
CHANGED
|
@@ -806,6 +806,33 @@ export function isInspectLock() { return inspectLock; }
|
|
|
806
806
|
export function setInspectLock(on) { inspectLock = !!on; _inspectReads.clear(); }
|
|
807
807
|
const _INSPECT_VERBS = /(incele|inceler|ne i[şs]e? yar|a[çc][ıi]kla|analiz|g[öo]zden ge[çc]ir|i[çc]inde ne|ne var|[öo]zetle|anlat|what'?s in|what does|what is in|explain|analy[sz]e|review|inspect|understand|describe|summari[sz]e)/i;
|
|
808
808
|
const _ACTION_VERBS = /(yap\b|yaz\b|olu[şs]tur|kur\b|d[üu]zelt|ekle\b|\bsil\b|de[ğg]i[şs]tir|g[üu]ncelle|refactor|implement|\bbuild\b|create|\bmake\b|\bwrite\b|\bfix\b|\badd\b|remove|\bedit\b|setup|install|generate|klonla|clone|indir|[çc]al[ıi][şs]t[ıi]r|\brun\b|tara\b|scan|recon|\baudit\b|denetle|pentest|exploit|payload|dropper)/i;
|
|
809
|
+
// Minified/bundle/hash'li/generated ASSET mı? İnceleme modunda bunları okumak projeyi
|
|
810
|
+
// anlatmaz, sadece context yakar → deterministik atla. .py/.md/.json/.txt/.html ASLA atlanmaz.
|
|
811
|
+
export function _isMinifiedAsset(p) {
|
|
812
|
+
const b = (p.split(/[\\/]/).pop() || '');
|
|
813
|
+
if (/\.map$/i.test(b))
|
|
814
|
+
return true;
|
|
815
|
+
if (/[\\/](node_modules|dist|build|\.next|\.nuxt|\.output)[\\/]/i.test(p))
|
|
816
|
+
return true;
|
|
817
|
+
if (/\.(js|mjs|cjs|css)$/i.test(b)) {
|
|
818
|
+
if (/\.min\.(js|css)$/i.test(b))
|
|
819
|
+
return true;
|
|
820
|
+
if (/-[A-Za-z0-9_]{6,}\.(js|mjs|cjs|css)$/.test(b))
|
|
821
|
+
return true; // hash'li chunk: Name-AbC123.js
|
|
822
|
+
if (/^(bundle|vendor|chunk|runtime|polyfills?|main|index)([._-].*)?\.(js|css)$/i.test(b))
|
|
823
|
+
return true;
|
|
824
|
+
}
|
|
825
|
+
return false;
|
|
826
|
+
}
|
|
827
|
+
// İnceleme modunda model dosyayı OKUMAK yerine "sistem promptumu paylaşamam" diye REDDEDERSE
|
|
828
|
+
// (dosya adı "sistem_prompt" olduğu için SECRECY yanlış tetikleniyor) → harness yakalar, zorla okutur.
|
|
829
|
+
// Kısa + gizlilik-reddi kalıbı; gerçek reddetmeler kısadır.
|
|
830
|
+
export function isSecrecyRefusal(s) {
|
|
831
|
+
const t = String(s || '').trim();
|
|
832
|
+
if (!t || t.length > 260)
|
|
833
|
+
return false;
|
|
834
|
+
return /payla[şs]am|talimatlar[ıi]m|sistem (promptu|talimat)|instructions? (with|to)|can'?t (share|reveal|show)|cannot (share|reveal|disclose|show)|won'?t (share|reveal)|reveal (my|the|your)|share (my|the|your) (system )?(prompt|instructions|rules)/i.test(t);
|
|
835
|
+
}
|
|
809
836
|
// incele-fiili VAR ama yap/yaz/tara/audit gibi eylem-fiili YOK → salt-oku kilidi aç.
|
|
810
837
|
// KRİTİK: dosya YOLLARINI önce çıkar — "poc_clone", "build/", "create_x.py" gibi alt-diziler
|
|
811
838
|
// eylem-fiili ("clone/build/create") sanılıp kilidi yanlışlıkla KAPATMASIN (false-negative).
|
|
@@ -890,9 +917,13 @@ async function execOne(call, hooks) {
|
|
|
890
917
|
if (_mut.has(call.name) || (_isShell && !_roCmd)) {
|
|
891
918
|
return { ok: false, output: 'This is an INSPECT/UNDERSTAND task (the user asked to review/explain — they did NOT ask to write, fix, scan, or audit). Do NOT create or modify any file, and do NOT run CodeAudit, SecurityScan, or shell commands. Read only the MEANINGFUL files (docs, entry point, config) with Read/Glob/Grep — SKIP minified/vendor/bundled files and data dumps — then explain the project in clear, concise TEXT. Do this SILENTLY: do NOT mention this restriction or narrate switching tools; just read and explain.', args };
|
|
892
919
|
}
|
|
893
|
-
// Döngü kırıcı: aynı dosyayı bu turda tekrar okuma (compaction sonrası re-read loop'u).
|
|
894
920
|
if (call.name === 'Read') {
|
|
895
921
|
const _p = String(args?.file_path || '');
|
|
922
|
+
// Minified/vendor/bundle/generated asset → deterministik atla (prompt tek başına tutmuyordu).
|
|
923
|
+
if (_p && _isMinifiedAsset(_p)) {
|
|
924
|
+
return { ok: false, output: `[SKIP-ASSET] "${_p.split(/[\\/]/).pop()}" is a minified/bundled/generated asset — reading it tells you nothing about what the project DOES. Do NOT read it. Read source/docs/config/entry files instead, or finish and explain.`, args };
|
|
925
|
+
}
|
|
926
|
+
// Döngü kırıcı: aynı dosyayı bu turda tekrar okuma (compaction sonrası re-read loop'u).
|
|
896
927
|
if (_p && _inspectReads.has(_p)) {
|
|
897
928
|
return { ok: false, output: `[ALREADY-READ] "${_p}" was already read this turn (its content is above). Do NOT read it again — continue explaining with what you already have, or finish.`, args };
|
|
898
929
|
}
|
package/dist/tui.js
CHANGED
|
@@ -6,7 +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, getBashCwd, setComputerUse, isComputerUse, setInspectLock, computeInspectIntent } from './tools.js';
|
|
9
|
+
import { allToolSchemas, executeToolCalls, executeTool, toolLabel, setToolConfig, getBashCwd, setComputerUse, isComputerUse, setInspectLock, computeInspectIntent, isInspectLock, isSecrecyRefusal } from './tools.js';
|
|
10
10
|
import { setCheckpointStore } from './checkpoint.js';
|
|
11
11
|
import { extractImages, visionMessages, VISION_MODEL } from './vision.js';
|
|
12
12
|
import * as path from 'node:path';
|
|
@@ -437,6 +437,7 @@ export async function runTui() {
|
|
|
437
437
|
let lastSig = '', sameCount = 0, usedWeb = false, lastAnswer = '';
|
|
438
438
|
let consecFail = 0, totalFails = 0; // devre-kesici: olmayan araç/sözdizimi döngüsünü kır
|
|
439
439
|
let reactiveRetried = false; // bağlam taşmasında bir kez compact+retry
|
|
440
|
+
let secrecyRetried = false; // inceleme görevinde yanlış gizlilik-reddinde bir kez zorla-okut
|
|
440
441
|
try {
|
|
441
442
|
for (let iter = 0; iter < 25; iter++) {
|
|
442
443
|
if (turnAbort?.signal.aborted)
|
|
@@ -545,6 +546,14 @@ export async function runTui() {
|
|
|
545
546
|
// sadece diziye ekle → redrawAll() onu geri çizebilir.
|
|
546
547
|
displayItems.push({ kind: 'assistant', text: answer });
|
|
547
548
|
}
|
|
549
|
+
// Deterministik gizlilik-reddi kurtarma: inceleme görevinde model dosyayı okumak yerine
|
|
550
|
+
// "sistem promptumu paylaşamam" derse (dosya adı system_prompt olduğu için SECRECY yanlış
|
|
551
|
+
// tetiklendi) → düzelt + zorla okut. Bir kez.
|
|
552
|
+
if (!toolCalls.length && isInspectLock() && !secrecyRetried && isSecrecyRefusal(answer)) {
|
|
553
|
+
secrecyRetried = true;
|
|
554
|
+
history.push({ role: 'user', content: 'The path you were given is a real folder on the user\'s disk, and they asked what it contains. That is THEIR file/data — NOT your own instructions or system prompt. Reading and inspecting it is a normal file task and is always allowed. Read the files now with Read/Glob/Grep and explain the folder\'s contents. Do not refuse.' });
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
548
557
|
if (!toolCalls.length)
|
|
549
558
|
break;
|
|
550
559
|
// takılma koruması: aynı araç-çağrısı 3 kez üst üste → dur
|