nothumanallowed 16.0.24 → 16.0.25
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 +2 -2
- package/src/constants.mjs +1 -1
- package/src/server/routes/webcraft.mjs +103 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "16.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "16.0.25",
|
|
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": {
|
|
7
7
|
"nha": "bin/nha",
|
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.25';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
|
@@ -3442,7 +3442,7 @@ export const _SHIMMED_MODULES = new Set([
|
|
|
3442
3442
|
'pg', 'redis', 'ioredis', 'helmet', 'mongoose', 'sequelize',
|
|
3443
3443
|
'dotenv', 'cors', 'morgan', 'body-parser', 'cookie-parser',
|
|
3444
3444
|
'compression', 'express-rate-limit', 'jsonwebtoken', 'bcryptjs', 'bcrypt',
|
|
3445
|
-
'uuid', 'lodash', 'debug', 'chalk', 'multer', 'axios',
|
|
3445
|
+
'uuid', 'lodash', 'debug', 'chalk', 'multer', 'axios', 'express',
|
|
3446
3446
|
]);
|
|
3447
3447
|
|
|
3448
3448
|
/** Read declared dependencies from package.json (deps + devDeps + peer). */
|
|
@@ -3991,6 +3991,107 @@ multer.diskStorage = (opts) => ({ _kind: 'disk', opts });
|
|
|
3991
3991
|
multer.memoryStorage = () => ({ _kind: 'memory' });
|
|
3992
3992
|
module.exports = multer;
|
|
3993
3993
|
module.exports.default = multer;
|
|
3994
|
+
`;
|
|
3995
|
+
|
|
3996
|
+
// express — minimal HTTP framework shim (route matching, middleware chain,
|
|
3997
|
+
// req.params/query/body, res.json/send/status). Enough to boot a typical
|
|
3998
|
+
// LLM-generated Express app even without express in node_modules.
|
|
3999
|
+
const expressShim = `
|
|
4000
|
+
const http = require('http');
|
|
4001
|
+
const url = require('url');
|
|
4002
|
+
|
|
4003
|
+
function parseBody(req) {
|
|
4004
|
+
return new Promise((resolve) => {
|
|
4005
|
+
let raw = '';
|
|
4006
|
+
req.on('data', (c) => { raw += c; });
|
|
4007
|
+
req.on('end', () => {
|
|
4008
|
+
const ct = req.headers['content-type'] || '';
|
|
4009
|
+
try {
|
|
4010
|
+
if (/json/i.test(ct)) resolve(raw ? JSON.parse(raw) : {});
|
|
4011
|
+
else if (/urlencoded/i.test(ct)) {
|
|
4012
|
+
const o = {};
|
|
4013
|
+
for (const p of raw.split('&')) { const [k, v] = p.split('=').map(decodeURIComponent); if (k) o[k] = v || ''; }
|
|
4014
|
+
resolve(o);
|
|
4015
|
+
} else resolve(raw);
|
|
4016
|
+
} catch { resolve(raw); }
|
|
4017
|
+
});
|
|
4018
|
+
});
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
function compilePath(p) {
|
|
4022
|
+
if (p instanceof RegExp) return { re: p, keys: [] };
|
|
4023
|
+
const keys = [];
|
|
4024
|
+
const re = '^' + String(p).replace(/:([^/]+)/g, (_m, k) => { keys.push(k); return '([^/]+)'; }) + '/?$';
|
|
4025
|
+
return { re: new RegExp(re), keys };
|
|
4026
|
+
}
|
|
4027
|
+
|
|
4028
|
+
function createApp() {
|
|
4029
|
+
const stack = [];
|
|
4030
|
+
const settings = {};
|
|
4031
|
+
function use(arg, ...rest) {
|
|
4032
|
+
if (typeof arg === 'function') stack.push({ method: 'ALL', re: /.*/, keys: [], handlers: [arg, ...rest] });
|
|
4033
|
+
else { const c = compilePath(arg); stack.push({ method: 'ALL', re: c.re, keys: c.keys, handlers: rest.flat() }); }
|
|
4034
|
+
return app;
|
|
4035
|
+
}
|
|
4036
|
+
function addRoute(method) {
|
|
4037
|
+
return (path, ...handlers) => { const c = compilePath(path); stack.push({ method, re: c.re, keys: c.keys, handlers: handlers.flat() }); return app; };
|
|
4038
|
+
}
|
|
4039
|
+
const app = async function (req, res) {
|
|
4040
|
+
const parsed = url.parse(req.url, true);
|
|
4041
|
+
req.path = parsed.pathname;
|
|
4042
|
+
req.query = parsed.query;
|
|
4043
|
+
if (['POST', 'PUT', 'PATCH'].includes(req.method)) req.body = await parseBody(req);
|
|
4044
|
+
if (!res.json) {
|
|
4045
|
+
res.json = function (obj) { this.setHeader('Content-Type', 'application/json'); this.end(JSON.stringify(obj)); return this; };
|
|
4046
|
+
res.send = function (data) { if (typeof data === 'object') return this.json(data); this.end(String(data)); return this; };
|
|
4047
|
+
res.status = function (n) { this.statusCode = n; return this; };
|
|
4048
|
+
res.sendStatus = function (n) { this.statusCode = n; this.end(http.STATUS_CODES[n] || ''); return this; };
|
|
4049
|
+
res.redirect = function (loc) { this.statusCode = 302; this.setHeader('Location', loc); this.end(); return this; };
|
|
4050
|
+
}
|
|
4051
|
+
let i = 0;
|
|
4052
|
+
const next = (err) => {
|
|
4053
|
+
if (err) { res.statusCode = 500; return res.end('Error: ' + (err.message || err)); }
|
|
4054
|
+
while (i < stack.length) {
|
|
4055
|
+
const layer = stack[i++];
|
|
4056
|
+
if (layer.method !== 'ALL' && layer.method !== req.method) continue;
|
|
4057
|
+
const m = req.path.match(layer.re);
|
|
4058
|
+
if (!m) continue;
|
|
4059
|
+
req.params = {};
|
|
4060
|
+
layer.keys.forEach((k, idx) => { req.params[k] = m[idx + 1]; });
|
|
4061
|
+
let hIdx = 0;
|
|
4062
|
+
const runHandlers = (e) => {
|
|
4063
|
+
if (e) return next(e);
|
|
4064
|
+
if (hIdx >= layer.handlers.length) return next();
|
|
4065
|
+
const h = layer.handlers[hIdx++];
|
|
4066
|
+
try { return h.length === 4 ? h(e, req, res, runHandlers) : h(req, res, runHandlers); }
|
|
4067
|
+
catch (err) { return next(err); }
|
|
4068
|
+
};
|
|
4069
|
+
return runHandlers();
|
|
4070
|
+
}
|
|
4071
|
+
res.statusCode = 404;
|
|
4072
|
+
res.end('Cannot ' + req.method + ' ' + req.path);
|
|
4073
|
+
};
|
|
4074
|
+
next();
|
|
4075
|
+
};
|
|
4076
|
+
app.use = use;
|
|
4077
|
+
app.get = addRoute('GET'); app.post = addRoute('POST'); app.put = addRoute('PUT');
|
|
4078
|
+
app.delete = addRoute('DELETE'); app.patch = addRoute('PATCH'); app.options = addRoute('OPTIONS');
|
|
4079
|
+
app.all = (path, ...handlers) => { const c = compilePath(path); stack.push({ method: 'ALL', re: c.re, keys: c.keys, handlers: handlers.flat() }); return app; };
|
|
4080
|
+
app.set = (k, v) => { settings[k] = v; return app; };
|
|
4081
|
+
app.get_setting = (k) => settings[k];
|
|
4082
|
+
app.disable = (k) => { settings[k] = false; return app; };
|
|
4083
|
+
app.enable = (k) => { settings[k] = true; return app; };
|
|
4084
|
+
app.listen = function (port, cb) { const server = http.createServer(app); server.listen(port, cb); return server; };
|
|
4085
|
+
return app;
|
|
4086
|
+
}
|
|
4087
|
+
|
|
4088
|
+
const express = createApp;
|
|
4089
|
+
express.json = function (opts) { return async (req, res, next) => { if (/json/i.test(req.headers['content-type'] || '')) req.body = await parseBody(req); next(); }; };
|
|
4090
|
+
express.urlencoded = function (opts) { return async (req, res, next) => { if (/urlencoded/i.test(req.headers['content-type'] || '')) req.body = await parseBody(req); next(); }; };
|
|
4091
|
+
express.static = function (root) { return (req, res, next) => next(); };
|
|
4092
|
+
express.Router = function () { const r = createApp(); return r; };
|
|
4093
|
+
module.exports = express;
|
|
4094
|
+
module.exports.default = express;
|
|
3994
4095
|
`;
|
|
3995
4096
|
|
|
3996
4097
|
// axios — minimal fetch-based replacement
|
|
@@ -4067,6 +4168,7 @@ module.exports.default = proxy;
|
|
|
4067
4168
|
'chalk.js': chalkShim,
|
|
4068
4169
|
'multer.js': multerShim,
|
|
4069
4170
|
'axios.js': axiosShim,
|
|
4171
|
+
'express.js': expressShim,
|
|
4070
4172
|
'noop.js': noopShim,
|
|
4071
4173
|
};
|
|
4072
4174
|
for (const [name, content] of Object.entries(shimFiles)) {
|