nothumanallowed 14.5.10 → 14.5.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "14.5.10",
3
+ "version": "14.5.11",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools, Studio (visual agentic workflows). Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, Alexandria E2E messaging, GitHub, Notion, Slack, voice chat, free AI (Liara), 28 languages. Zero-dependency CLI.",
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 = '14.5.10';
8
+ export const VERSION = '14.5.11';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -852,25 +852,50 @@ RULES:
852
852
  if (src === null) {
853
853
  toolResults.push({ op: 'edit', path: relPath, result: 'file_not_found' });
854
854
  emit({ type: 'tool', op: 'edit', path: relPath, result: 'file_not_found' });
855
- } else if (!src.includes(oldStr)) {
856
- const repaired = await _attemptEditRepair(config, relPath, src, oldStr, newStr);
857
- if (repaired) {
858
- ProjectStore.writeFile(projectName, relPath, repaired);
859
- hasChanges = true;
860
- modifiedFiles.add(relPath);
861
- toolResults.push({ op: 'edit', path: relPath, result: 'ok_repaired' });
862
- emit({ type: 'tool', op: 'edit', path: relPath, result: 'ok_repaired', oldSnippet: oldStr.slice(0, 300), newSnippet: newStr?.slice(0, 300) });
863
- } else {
864
- toolResults.push({ op: 'edit', path: relPath, result: 'old_not_found', hint: 'Use read to see current content, then retry with exact text' });
865
- emit({ type: 'tool', op: 'edit', path: relPath, result: 'old_not_found', oldSnippet: oldStr.slice(0, 200) });
866
- }
867
- } else {
855
+ } else if (src.includes(oldStr)) {
856
+ // Exact match apply directly
868
857
  const newSrc = src.replace(oldStr, newStr ?? '');
869
858
  ProjectStore.writeFile(projectName, relPath, newSrc);
870
859
  hasChanges = true;
871
860
  modifiedFiles.add(relPath);
872
861
  toolResults.push({ op: 'edit', path: relPath, result: 'ok' });
873
862
  emit({ type: 'tool', op: 'edit', path: relPath, result: 'ok', oldSnippet: oldStr.slice(0, 300), newSnippet: newStr?.slice(0, 300) ?? '' });
863
+ } else {
864
+ // Fuzzy match: compare lines ignoring leading/trailing whitespace
865
+ const oldLines = oldStr.split('\n').map(l => l.trim());
866
+ const srcLines = src.split('\n');
867
+ let matchStart = -1;
868
+ for (let i = 0; i <= srcLines.length - oldLines.length; i++) {
869
+ let ok = true;
870
+ for (let j = 0; j < oldLines.length; j++) {
871
+ if (srcLines[i + j].trim() !== oldLines[j]) { ok = false; break; }
872
+ }
873
+ if (ok) { matchStart = i; break; }
874
+ }
875
+ if (matchStart >= 0) {
876
+ // Fuzzy matched — replace the matched lines with new content
877
+ const before = srcLines.slice(0, matchStart).join('\n');
878
+ const after = srcLines.slice(matchStart + oldLines.length).join('\n');
879
+ const result = (before ? before + '\n' : '') + (newStr ?? '') + (after ? '\n' + after : '');
880
+ ProjectStore.writeFile(projectName, relPath, result);
881
+ hasChanges = true;
882
+ modifiedFiles.add(relPath);
883
+ toolResults.push({ op: 'edit', path: relPath, result: 'ok' });
884
+ emit({ type: 'tool', op: 'edit', path: relPath, result: 'ok', oldSnippet: oldStr.slice(0, 300), newSnippet: newStr?.slice(0, 300) });
885
+ } else {
886
+ // No fuzzy match — try LLM repair as last resort
887
+ const repaired = await _attemptEditRepair(config, relPath, src, oldStr, newStr);
888
+ if (repaired) {
889
+ ProjectStore.writeFile(projectName, relPath, repaired);
890
+ hasChanges = true;
891
+ modifiedFiles.add(relPath);
892
+ toolResults.push({ op: 'edit', path: relPath, result: 'ok_repaired' });
893
+ emit({ type: 'tool', op: 'edit', path: relPath, result: 'ok_repaired', oldSnippet: oldStr.slice(0, 300), newSnippet: newStr?.slice(0, 300) });
894
+ } else {
895
+ toolResults.push({ op: 'edit', path: relPath, result: 'old_not_found — read the file first, copy EXACT text to replace, then retry' });
896
+ emit({ type: 'tool', op: 'edit', path: relPath, result: 'old_not_found', oldSnippet: oldStr.slice(0, 200) });
897
+ }
898
+ }
874
899
  }
875
900
 
876
901
  // ── write ──