nothumanallowed 13.5.147 → 13.5.148
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/commands/ui.mjs +51 -27
- package/src/constants.mjs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.148",
|
|
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/commands/ui.mjs
CHANGED
|
@@ -5869,39 +5869,61 @@ REGOLE CRITICHE:
|
|
|
5869
5869
|
// Parse and execute tool calls from response
|
|
5870
5870
|
// Sanitize JSON from LLM: replace literal newlines and invalid escape sequences inside JSON strings
|
|
5871
5871
|
// Models often write multiline strings without escaping, or use \s \d \w in regex inside content
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5872
|
+
// Robust JSON string extractor: reads a JSON string value starting at position i (after the opening ")
|
|
5873
|
+
// Returns { value, end } where end is the index after the closing "
|
|
5874
|
+
const extractJsonString = (s, i) => {
|
|
5875
5875
|
let out = '';
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
const ch = raw[ci];
|
|
5880
|
-
if (escaped) {
|
|
5881
|
-
escaped = false;
|
|
5882
|
-
// If this is not a valid JSON escape char, double the backslash
|
|
5883
|
-
if (!validEscapes.has(ch)) {
|
|
5884
|
-
out += '\\\\' + ch;
|
|
5885
|
-
} else {
|
|
5886
|
-
out += ch;
|
|
5887
|
-
}
|
|
5888
|
-
continue;
|
|
5889
|
-
}
|
|
5876
|
+
const validEscapes = new Set(['"', '\\', '/', 'b', 'f', 'n', 'r', 't', 'u']);
|
|
5877
|
+
while (i < s.length) {
|
|
5878
|
+
const ch = s[i];
|
|
5890
5879
|
if (ch === '\\') {
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5880
|
+
const next = s[i + 1];
|
|
5881
|
+
if (next === undefined) { out += '\\\\'; i++; break; }
|
|
5882
|
+
if (validEscapes.has(next)) {
|
|
5883
|
+
// valid escape — keep as-is, but handle \u specially
|
|
5884
|
+
if (next === 'u') {
|
|
5885
|
+
const hex = s.slice(i + 2, i + 6);
|
|
5886
|
+
if (/^[0-9a-fA-F]{4}$/.test(hex)) {
|
|
5887
|
+
out += s.slice(i, i + 6); i += 6;
|
|
5888
|
+
} else {
|
|
5889
|
+
out += '\\\\u'; i += 2;
|
|
5890
|
+
}
|
|
5891
|
+
} else {
|
|
5892
|
+
out += s.slice(i, i + 2); i += 2;
|
|
5893
|
+
}
|
|
5894
5894
|
} else {
|
|
5895
|
-
|
|
5895
|
+
// invalid escape (e.g. \s \d \w \( \. \n written as literal) — escape the backslash
|
|
5896
|
+
out += '\\\\' + next; i += 2;
|
|
5896
5897
|
}
|
|
5897
5898
|
continue;
|
|
5898
5899
|
}
|
|
5899
|
-
if (ch === '"') {
|
|
5900
|
-
if (
|
|
5901
|
-
|
|
5902
|
-
|
|
5900
|
+
if (ch === '"') { i++; break; } // closing quote
|
|
5901
|
+
if (ch === '\n') { out += '\\n'; i++; continue; }
|
|
5902
|
+
if (ch === '\r') { out += '\\r'; i++; continue; }
|
|
5903
|
+
if (ch === '\t') { out += '\\t'; i++; continue; }
|
|
5904
|
+
// other control chars
|
|
5905
|
+
if (ch.charCodeAt(0) < 0x20) { out += '\\u' + ch.charCodeAt(0).toString(16).padStart(4, '0'); i++; continue; }
|
|
5906
|
+
out += ch; i++;
|
|
5907
|
+
}
|
|
5908
|
+
return { value: out, end: i };
|
|
5909
|
+
};
|
|
5910
|
+
|
|
5911
|
+
const sanitizeToolJson = (raw) => {
|
|
5912
|
+
// Rebuild the JSON char-by-char, using extractJsonString for string values
|
|
5913
|
+
let out = '';
|
|
5914
|
+
let i = 0;
|
|
5915
|
+
let inStr = false;
|
|
5916
|
+
while (i < raw.length) {
|
|
5917
|
+
if (!inStr && raw[i] === '"') {
|
|
5918
|
+
// Start of a JSON string — extract it robustly
|
|
5919
|
+
out += '"';
|
|
5920
|
+
i++;
|
|
5921
|
+
const { value, end } = extractJsonString(raw, i);
|
|
5922
|
+
out += value + '"';
|
|
5923
|
+
i = end;
|
|
5924
|
+
} else {
|
|
5925
|
+
out += raw[i++];
|
|
5903
5926
|
}
|
|
5904
|
-
out += ch;
|
|
5905
5927
|
}
|
|
5906
5928
|
return out;
|
|
5907
5929
|
};
|
|
@@ -5982,9 +6004,11 @@ Rispondi SOLO con il contenuto completo del file corretto, senza markdown fence,
|
|
|
5982
6004
|
} else if (toolCall.op === 'write') {
|
|
5983
6005
|
const fp = path.join(sandboxDir, toolCall.path.replace(/^\/+/, ''));
|
|
5984
6006
|
fs.mkdirSync(path.dirname(fp), { recursive: true });
|
|
6007
|
+
const oldContent = fs.existsSync(fp) ? fs.readFileSync(fp, 'utf8') : '';
|
|
5985
6008
|
fs.writeFileSync(fp, toolCall.content || '', 'utf8');
|
|
5986
6009
|
toolResults.push({ op: 'write', path: toolCall.path, ok: true });
|
|
5987
|
-
sendEv({ type: 'tool', op: 'write', path: toolCall.path, result: 'ok'
|
|
6010
|
+
sendEv({ type: 'tool', op: 'write', path: toolCall.path, result: 'ok',
|
|
6011
|
+
oldSnippet: oldContent.slice(0, 300), newSnippet: (toolCall.content || '').slice(0, 300) });
|
|
5988
6012
|
}
|
|
5989
6013
|
}
|
|
5990
6014
|
|
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 = '13.5.
|
|
8
|
+
export const VERSION = '13.5.148';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|