nothumanallowed 16.0.48 → 16.0.49
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/package.json +1 -1
- package/src/constants.mjs +1 -1
- package/src/server/routes/webcraft.mjs +23 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.49",
|
|
4
4
|
"description": "Local AI assistant: 80 tools (Gmail, Calendar, Drive, GitHub, Slack, browser, code, files), 38 agents, visual workflows (Studio, AWF, WebCraft). Install with `npm i -g nothumanallowed`, run with `nha ui`. Free tier built-in (Liara), no API key required. Your data stays on your PC — OAuth tokens local, no cloud. Open-source MIT.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/constants.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
|
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = path.dirname(__filename);
|
|
7
7
|
|
|
8
|
-
export const VERSION = '16.0.
|
|
8
|
+
export const VERSION = '16.0.49';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
|
@@ -1286,7 +1286,9 @@ RULES:
|
|
|
1286
1286
|
return 'OK — edit applied (fuzzy match)';
|
|
1287
1287
|
}
|
|
1288
1288
|
emit({ type: 'tool', op: 'edit', path: relPath, result: 'old_not_found' });
|
|
1289
|
-
|
|
1289
|
+
// Include the actual file content in the error response so the LLM can
|
|
1290
|
+
// produce a correct old_text on retry without needing a separate read_file.
|
|
1291
|
+
return `Error: old_text not found in file.\n\nCURRENT CONTENT OF ${relPath}:\n\`\`\`\n${src.slice(0, 16000)}\n\`\`\`\n\nPick the EXACT lines you want to replace from above, copy them as old_text, and retry edit_file.`;
|
|
1290
1292
|
}
|
|
1291
1293
|
|
|
1292
1294
|
if (toolName === 'create_file') {
|
|
@@ -1562,8 +1564,18 @@ After ALL fixes are done, emit <done/> on its own line.
|
|
|
1562
1564
|
toolResults.push({ op: 'edit', path: relPath, result: 'ok' });
|
|
1563
1565
|
emit({ type: 'tool', op: 'edit', path: relPath, result: 'ok', oldSnippet: oldStr.slice(0, 2000), newSnippet: newStr?.slice(0, 2000) });
|
|
1564
1566
|
} else {
|
|
1565
|
-
// No match —
|
|
1566
|
-
|
|
1567
|
+
// No match — auto-read the file and INCLUDE its content in the
|
|
1568
|
+
// feedback. Without this, the LLM at the next step is blind and
|
|
1569
|
+
// can't correct the old_text. Critical fix for text-based mode
|
|
1570
|
+
// where the LLM doesn't see tool results between calls.
|
|
1571
|
+
const fileContentForRetry = src.slice(0, 16000);
|
|
1572
|
+
toolResults.push({
|
|
1573
|
+
op: 'edit',
|
|
1574
|
+
path: relPath,
|
|
1575
|
+
result: 'old_not_found',
|
|
1576
|
+
hint: 'Your old_text did NOT match the file. The CURRENT file content is included below — copy the EXACT lines you want to replace and retry edit with that exact text as old.',
|
|
1577
|
+
content: fileContentForRetry,
|
|
1578
|
+
});
|
|
1567
1579
|
emit({ type: 'tool', op: 'edit', path: relPath, result: 'old_not_found', oldSnippet: oldStr.slice(0, 200) });
|
|
1568
1580
|
}
|
|
1569
1581
|
}
|
|
@@ -1825,11 +1837,16 @@ After ALL fixes are done, emit <done/> on its own line.
|
|
|
1825
1837
|
break;
|
|
1826
1838
|
}
|
|
1827
1839
|
|
|
1828
|
-
// Build tool results feedback for next iteration
|
|
1840
|
+
// Build tool results feedback for next iteration.
|
|
1841
|
+
// CRITICAL: when edit fails with old_not_found, include the CURRENT
|
|
1842
|
+
// file content so the LLM can produce a correct old_text on retry.
|
|
1843
|
+
// Without this, text-based mode loops forever on the same wrong old_text.
|
|
1829
1844
|
const feedbackParts = toolResults.map((r) => {
|
|
1830
1845
|
let msg = `[${r.op}] ${r.path || ''}: ${r.result}`;
|
|
1831
|
-
if (r.
|
|
1832
|
-
if (r.
|
|
1846
|
+
if (r.hint) msg += `\n HINT: ${r.hint}`;
|
|
1847
|
+
if (r.content) {
|
|
1848
|
+
msg += `\n\nCURRENT CONTENT OF ${r.path}:\n\`\`\`\n${r.content}\n\`\`\`\n\nTo fix: pick the exact lines you want to replace from above, use them as "old", and retry the edit.`;
|
|
1849
|
+
}
|
|
1833
1850
|
return msg;
|
|
1834
1851
|
});
|
|
1835
1852
|
|