nothumanallowed 13.5.146 → 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 +58 -28
- 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
|
@@ -5244,9 +5244,15 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
|
|
|
5244
5244
|
[/require\(['"]\.\/config\/redis['"]\)/g, "require('../services/cache')"],
|
|
5245
5245
|
[/require\(['"]\.\.\/services\/redis['"]\)/g, "require('../services/cache')"],
|
|
5246
5246
|
[/require\(['"]\.\/services\/redis['"]\)/g, "require('../services/cache')"],
|
|
5247
|
-
// email utils: LLM puts utils/email but file is
|
|
5247
|
+
// email utils: LLM puts utils/email or services/emailService but file is services/email
|
|
5248
5248
|
[/require\(['"]\.\.\/utils\/email['"]\)/g, "require('../services/email')"],
|
|
5249
5249
|
[/require\(['"]\.\/utils\/email['"]\)/g, "require('./services/email')"],
|
|
5250
|
+
[/require\(['"]\.\.\/services\/emailService['"]\)/g, "require('../services/email')"],
|
|
5251
|
+
[/require\(['"]\.\/services\/emailService['"]\)/g, "require('./services/email')"],
|
|
5252
|
+
[/require\(['"]\.\.\/services\/mailer['"]\)/g, "require('../services/email')"],
|
|
5253
|
+
[/require\(['"]\.\/services\/mailer['"]\)/g, "require('./services/email')"],
|
|
5254
|
+
[/require\(['"]\.\.\/utils\/mailer['"]\)/g, "require('../services/email')"],
|
|
5255
|
+
[/require\(['"]\.\/utils\/mailer['"]\)/g, "require('./services/email')"],
|
|
5250
5256
|
// config module: LLM generates require('../../config') or require('../config')
|
|
5251
5257
|
[/require\(['"]\.\.\/\.\.\/config['"]\)/g, "{env:process.env}"],
|
|
5252
5258
|
[/require\(['"]\.\.\/config['"]\)/g, "{env:process.env}"],
|
|
@@ -5863,39 +5869,61 @@ REGOLE CRITICHE:
|
|
|
5863
5869
|
// Parse and execute tool calls from response
|
|
5864
5870
|
// Sanitize JSON from LLM: replace literal newlines and invalid escape sequences inside JSON strings
|
|
5865
5871
|
// Models often write multiline strings without escaping, or use \s \d \w in regex inside content
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
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) => {
|
|
5869
5875
|
let out = '';
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
const ch = raw[ci];
|
|
5874
|
-
if (escaped) {
|
|
5875
|
-
escaped = false;
|
|
5876
|
-
// If this is not a valid JSON escape char, double the backslash
|
|
5877
|
-
if (!validEscapes.has(ch)) {
|
|
5878
|
-
out += '\\\\' + ch;
|
|
5879
|
-
} else {
|
|
5880
|
-
out += ch;
|
|
5881
|
-
}
|
|
5882
|
-
continue;
|
|
5883
|
-
}
|
|
5876
|
+
const validEscapes = new Set(['"', '\\', '/', 'b', 'f', 'n', 'r', 't', 'u']);
|
|
5877
|
+
while (i < s.length) {
|
|
5878
|
+
const ch = s[i];
|
|
5884
5879
|
if (ch === '\\') {
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
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
|
+
}
|
|
5888
5894
|
} else {
|
|
5889
|
-
|
|
5895
|
+
// invalid escape (e.g. \s \d \w \( \. \n written as literal) — escape the backslash
|
|
5896
|
+
out += '\\\\' + next; i += 2;
|
|
5890
5897
|
}
|
|
5891
5898
|
continue;
|
|
5892
5899
|
}
|
|
5893
|
-
if (ch === '"') {
|
|
5894
|
-
if (
|
|
5895
|
-
|
|
5896
|
-
|
|
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++];
|
|
5897
5926
|
}
|
|
5898
|
-
out += ch;
|
|
5899
5927
|
}
|
|
5900
5928
|
return out;
|
|
5901
5929
|
};
|
|
@@ -5976,9 +6004,11 @@ Rispondi SOLO con il contenuto completo del file corretto, senza markdown fence,
|
|
|
5976
6004
|
} else if (toolCall.op === 'write') {
|
|
5977
6005
|
const fp = path.join(sandboxDir, toolCall.path.replace(/^\/+/, ''));
|
|
5978
6006
|
fs.mkdirSync(path.dirname(fp), { recursive: true });
|
|
6007
|
+
const oldContent = fs.existsSync(fp) ? fs.readFileSync(fp, 'utf8') : '';
|
|
5979
6008
|
fs.writeFileSync(fp, toolCall.content || '', 'utf8');
|
|
5980
6009
|
toolResults.push({ op: 'write', path: toolCall.path, ok: true });
|
|
5981
|
-
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) });
|
|
5982
6012
|
}
|
|
5983
6013
|
}
|
|
5984
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
|
|