nothumanallowed 14.0.4 → 14.1.1

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.0.4",
3
+ "version": "14.1.1",
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.0.4';
8
+ export const VERSION = '14.1.1';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -151,6 +151,23 @@ class Router {
151
151
  if (r.method !== method) continue;
152
152
  if (typeof r.pattern === 'string') {
153
153
  if (r.pattern === pathname) return { handler: r.handler, params: {} };
154
+ // Express-style param segments: /api/foo/:id/bar
155
+ if (r.pattern.includes('/:')) {
156
+ const patParts = r.pattern.split('/');
157
+ const urlParts = pathname.split('/');
158
+ if (patParts.length === urlParts.length) {
159
+ const params = {};
160
+ let ok = true;
161
+ for (let i = 0; i < patParts.length; i++) {
162
+ if (patParts[i].startsWith(':')) {
163
+ params[patParts[i].slice(1)] = decodeURIComponent(urlParts[i]);
164
+ } else if (patParts[i] !== urlParts[i]) {
165
+ ok = false; break;
166
+ }
167
+ }
168
+ if (ok) return { handler: r.handler, params };
169
+ }
170
+ }
154
171
  } else if (r.pattern instanceof RegExp) {
155
172
  const m = pathname.match(r.pattern);
156
173
  if (m) return { handler: r.handler, params: m.groups || {}, match: m };
@@ -89,12 +89,14 @@ export function register(router) {
89
89
 
90
90
  try {
91
91
  const agentSlug = body.agent?.toLowerCase();
92
- let sysProm = 'You are a helpful AI assistant.';
92
+ const LANG_MAP = { it:'Italian', en:'English', es:'Spanish', fr:'French', de:'German', pt:'Portuguese', nl:'Dutch', pl:'Polish', ru:'Russian', zh:'Chinese', ja:'Japanese', ko:'Korean', ar:'Arabic', hi:'Hindi', tr:'Turkish', sv:'Swedish', da:'Danish', fi:'Finnish', cs:'Czech' };
93
+ const lang = LANG_MAP[(config?.language || config?.lang || 'en').slice(0,2)] || 'English';
94
+ let sysProm = `You are a helpful AI assistant. Always respond in ${lang}.`;
93
95
  if (agentSlug) {
94
96
  const af = path.join(AGENTS_DIR, `${agentSlug}.mjs`);
95
97
  if (fs.existsSync(af)) {
96
98
  const parsed = parseAgentFile(fs.readFileSync(af, 'utf-8'), agentSlug);
97
- if (parsed.systemPrompt) sysProm = parsed.systemPrompt;
99
+ if (parsed.systemPrompt) sysProm = `${parsed.systemPrompt}\n\nIMPORTANT: Always respond in ${lang}.`;
98
100
  }
99
101
  }
100
102
  await callLLMStream(config, sysProm, body.message, (tok) => sse('token', { content: tok }));
@@ -200,6 +200,13 @@ export function register(router) {
200
200
  try { const m = buildMemoryContext('chat', effectiveMsg); if (m) enrichedPrompt = enrichedPrompt + m; } catch {}
201
201
  try { const ic = await getImapAccountsContext(); if (ic) enrichedPrompt += ic; } catch {}
202
202
 
203
+ // Inject language instruction — always respects user's lang setting
204
+ const LANG_MAP = { it:'Italian', en:'English', es:'Spanish', fr:'French', de:'German', pt:'Portuguese', nl:'Dutch', pl:'Polish', ru:'Russian', zh:'Chinese', ja:'Japanese', ko:'Korean', ar:'Arabic', hi:'Hindi', tr:'Turkish', sv:'Swedish', da:'Danish', fi:'Finnish', cs:'Czech' };
205
+ const userLang = LANG_MAP[(config?.language || config?.lang || 'en').slice(0,2)] || 'English';
206
+ if (!enrichedPrompt.toLowerCase().includes('respond in') && !enrichedPrompt.toLowerCase().includes('rispondi in')) {
207
+ enrichedPrompt += `\n\nIMPORTANT: Always respond in ${userLang}.`;
208
+ }
209
+
203
210
  // Rolling context window
204
211
  const rawHistory = (body.history || []).map(h => ({
205
212
  role: h.role,
@@ -16,7 +16,10 @@ export function register(router) {
16
16
  const { listRepos } = await import('../../services/github.mjs');
17
17
  const config = loadConfig();
18
18
  sendJSON(res, 200, { repos: await listRepos(config) });
19
- } catch (e) { sendError(res, 500, e.message); }
19
+ } catch (e) {
20
+ if (e.message?.includes('token') || e.message?.includes('not configured')) return sendJSON(res, 200, { repos: [], authRequired: true });
21
+ sendError(res, 500, e.message);
22
+ }
20
23
  });
21
24
 
22
25
  router.get('/api/github', async (req, res) => {
@@ -24,7 +27,10 @@ export function register(router) {
24
27
  const { getNotifications } = await import('../../services/github.mjs');
25
28
  const config = loadConfig();
26
29
  sendJSON(res, 200, { notifications: await getNotifications(config) });
27
- } catch (e) { sendError(res, 500, e.message); }
30
+ } catch (e) {
31
+ if (e.message?.includes('token') || e.message?.includes('not configured')) return sendJSON(res, 200, { notifications: [], authRequired: true });
32
+ sendError(res, 500, e.message);
33
+ }
28
34
  });
29
35
 
30
36
  router.get('/api/github/issues', async (req, res) => {
@@ -33,7 +39,10 @@ export function register(router) {
33
39
  const config = loadConfig();
34
40
  const url = new URL(req.url, 'http://localhost');
35
41
  sendJSON(res, 200, { issues: await listIssues(config, url.searchParams.get('repo')) });
36
- } catch (e) { sendError(res, 500, e.message); }
42
+ } catch (e) {
43
+ if (e.message?.includes('token') || e.message?.includes('not configured')) return sendJSON(res, 200, { issues: [], authRequired: true });
44
+ sendError(res, 500, e.message);
45
+ }
37
46
  });
38
47
 
39
48
  router.get('/api/github/prs', async (req, res) => {
@@ -42,7 +51,10 @@ export function register(router) {
42
51
  const config = loadConfig();
43
52
  const url = new URL(req.url, 'http://localhost');
44
53
  sendJSON(res, 200, { prs: await listPRs(config, url.searchParams.get('repo')) });
45
- } catch (e) { sendError(res, 500, e.message); }
54
+ } catch (e) {
55
+ if (e.message?.includes('token') || e.message?.includes('not configured')) return sendJSON(res, 200, { prs: [], authRequired: true });
56
+ sendError(res, 500, e.message);
57
+ }
46
58
  });
47
59
 
48
60
  router.post('/api/github/mark-read', async (req, res) => {
@@ -350,6 +362,46 @@ export function register(router) {
350
362
  }
351
363
  });
352
364
 
365
+ // ── Microsoft To Do ───────────────────────────────────────────────────
366
+
367
+ router.get('/api/mstodo', async (_req, res) => {
368
+ try {
369
+ const { listTasks } = await import('../../services/microsoft-todo.mjs');
370
+ const config = loadConfig();
371
+ const tasks = await listTasks(config, 'defaultList');
372
+ sendJSON(res, 200, { tasks });
373
+ } catch (e) {
374
+ if (e.message?.includes('token') || e.message?.includes('auth') || e.message?.includes('Microsoft') || e.message?.includes('authenticated')) {
375
+ return sendJSON(res, 200, { tasks: [], authRequired: true });
376
+ }
377
+ sendError(res, 500, e.message);
378
+ }
379
+ });
380
+
381
+ router.post('/api/mstodo', async (req, res) => {
382
+ try {
383
+ const { createTask } = await import('../../services/microsoft-todo.mjs');
384
+ const body = await parseBody(req);
385
+ const config = loadConfig();
386
+ if (!body.title) return sendError(res, 400, 'title required');
387
+ const task = await createTask(config, body.listId || 'defaultList', body.title, body.body, body.dueDate, body.importance);
388
+ sendJSON(res, 201, { task });
389
+ } catch (e) { sendError(res, 500, e.message); }
390
+ });
391
+
392
+ router.post(/^\/api\/mstodo\/(?<id>[^/?]+)\/complete$/, async (req, res) => {
393
+ try {
394
+ const { completeTask } = await import('../../services/microsoft-todo.mjs');
395
+ const body = await parseBody(req);
396
+ const config = loadConfig();
397
+ const taskId = req.params?.id || req.url.match(/\/api\/mstodo\/([^/]+)\/complete/)?.[1];
398
+ if (!taskId) return sendError(res, 400, 'task id required');
399
+ const listId = body.listId || 'defaultList';
400
+ const task = await completeTask(config, listId, taskId);
401
+ sendJSON(res, 200, { task });
402
+ } catch (e) { sendError(res, 500, e.message); }
403
+ });
404
+
353
405
  // ── Connectors — workflow persistence ────────────────────────────────
354
406
 
355
407
  const workflowsFile = path.join(NHA_DIR, 'workflows.json');