nothumanallowed 14.1.76 → 14.1.78

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.1.76",
3
+ "version": "14.1.78",
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.1.76';
8
+ export const VERSION = '14.1.78';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -142,12 +142,15 @@ class SandboxManager {
142
142
  });
143
143
 
144
144
  this._sandbox = { proc, port, projectName, startedAt: new Date(), healthy: false };
145
+ let readyEmitted = false;
145
146
 
146
147
  proc.stdout.on('data', (d) => {
147
148
  const line = d.toString().trim();
148
149
  if (line) emit({ type: 'log', msg: line });
149
- if (/listen|running|started|ready|port/i.test(line)) {
150
+ if (!readyEmitted && /listen|running|started|ready|port/i.test(line)) {
151
+ readyEmitted = true;
150
152
  if (this._sandbox) this._sandbox.healthy = true;
153
+ emit({ type: 'phase', phase: 'ready', msg: `Server running on port ${port}` });
151
154
  emit({ type: 'ready', port });
152
155
  }
153
156
  });
@@ -172,13 +175,18 @@ class SandboxManager {
172
175
  ]);
173
176
 
174
177
  if (healthy === 'healthy') {
175
- if (this._sandbox) this._sandbox.healthy = true;
176
- emit({ type: 'phase', phase: 'ready', msg: `Server running on port ${port}` });
177
- emit({ type: 'ready', port });
178
+ if (!readyEmitted) {
179
+ readyEmitted = true;
180
+ if (this._sandbox) this._sandbox.healthy = true;
181
+ emit({ type: 'phase', phase: 'ready', msg: `Server running on port ${port}` });
182
+ emit({ type: 'ready', port });
183
+ }
178
184
  return;
179
185
  }
180
186
 
187
+ // If ready was already emitted by stdout, ignore timeout
181
188
  if (healthy === 'timeout') {
189
+ if (readyEmitted) return;
182
190
  emit({ type: 'warn', msg: 'Server started but port not yet bound — may still be loading.' });
183
191
  return;
184
192
  }
@@ -458,13 +466,15 @@ async function runWebCraftAgent(config, projectName, message, attachments, emit)
458
466
  const LANG_MAP = { en:'English',it:'Italian',es:'Spanish',fr:'French',de:'German',pt:'Portuguese' };
459
467
  const language = LANG_MAP[(config?.language||'it').slice(0,2)] || 'Italian';
460
468
 
461
- // Build context: include files mentioned in the message or all files if ≤ 8
469
+ // Build context: include files mentioned in the message + key project files
462
470
  const mentionedFiles = files.filter((f) => message.toLowerCase().includes(f.toLowerCase().split('/').pop() ?? ''));
463
- const contextFiles = mentionedFiles.length > 0 ? mentionedFiles : files.slice(0, 8);
471
+ // Always include key structural files
472
+ const keyFiles = files.filter((f) => /^(server|app|index)\.(js|mjs|ts)$/.test(f) || f === 'package.json' || f.includes('routes/index'));
473
+ const contextFiles = [...new Set([...mentionedFiles, ...keyFiles, ...files.slice(0, 12)])].slice(0, 15);
464
474
  const fileContents = contextFiles.map((rel) => {
465
475
  try {
466
476
  const content = fs.readFileSync(path.join(dir, rel), 'utf-8');
467
- return `### FILE: ${rel}\n\`\`\`\n${content.slice(0, 6000)}\n\`\`\``;
477
+ return `### FILE: ${rel}\n\`\`\`\n${content.slice(0, 8000)}\n\`\`\``;
468
478
  } catch { return ''; }
469
479
  }).filter(Boolean).join('\n\n');
470
480
 
@@ -511,7 +521,11 @@ RULES:
511
521
  } catch {}
512
522
 
513
523
  const systemPrompt = [
514
- `You are WebCraft Agent, an expert full-stack developer. Today is ${today}. Respond in ${language}.`,
524
+ `You are WebCraft Agent a team of 200 senior developers working as one entity. Today is ${today}. Respond in ${language}.`,
525
+ `\nYou have FULL control of the project IDE. You read files, edit them surgically, and write new ones.`,
526
+ `\nYour edits MUST be enterprise-grade: security, error handling, responsive design, accessibility.`,
527
+ `\nWhen the user asks for changes, you MUST use tools to implement them — never just explain. ACT, don't talk.`,
528
+ `\nAfter each tool use, briefly explain what changed and why.`,
515
529
  `\n\n## PROJECT: ${projectName}`,
516
530
  `\n## FILES:\n${fileIndex}`,
517
531
  skillContext,
@@ -519,7 +533,6 @@ RULES:
519
533
  attachments?.length ? `\n\n## ATTACHMENTS: ${attachments.map((a) => a.name).join(', ')}` : '',
520
534
  `\n\n## CURRENT FILE CONTENTS:\n${fileContents}`,
521
535
  `\n\n${toolSpec}`,
522
- `\n\nIMPORTANT: Be precise, surgical, and explain every change.`,
523
536
  ].join('');
524
537
 
525
538
  // Prepare user content (text + images if any)
@@ -535,7 +548,7 @@ RULES:
535
548
  // Suppress raw <tool> blocks from text stream — only emit visible text
536
549
  const visibleToken = token.replace(/<tool>[\s\S]*?<\/tool>/g, '');
537
550
  if (visibleToken) emit({ type: 'text', token: visibleToken });
538
- }, { max_tokens: 8192 });
551
+ }, { max_tokens: 16384 });
539
552
 
540
553
  // ── Execute all tool calls found in the response ───────────────────────────
541
554
  const toolRegex = /<tool>([\s\S]*?)<\/tool>/g;
@@ -605,17 +618,40 @@ RULES:
605
618
 
606
619
  // ── Generation pipeline (SSE) ─────────────────────────────────────────────────
607
620
 
608
- const FILE_PLAN_SYSTEM = `You are a senior full-stack architect. Design a COMPLETE, PRODUCTION-READY file structure for a web project.
609
- Output ONLY a JSON array: [{"name":"path/to/file.ext","purpose":"what this file does","tokens":N}]
610
- where "tokens" is your estimate of how many tokens the file content will need (200-800 for small files, 800-2000 for medium, 2000-4000 for large).
611
-
612
- MANDATORY rules:
613
- - Generate 20-40 files minimum for any real project a complete site requires many files
614
- - Split large concerns into separate files (separate route files, separate component files, separate util files)
615
- - Always include: package.json, server.js (or index.js), .env.example, README.md
616
- - For full-stack projects: routes/, middleware/, models/, controllers/ directories with individual files per resource
617
- - For frontend: separate CSS files per section (hero, navbar, footer, components), separate JS modules
618
- - Use relative paths only (e.g. "routes/auth.js", "public/js/app.js", "public/css/main.css")
621
+ const FILE_PLAN_SYSTEM = `You are the lead architect of a 200-person engineering team. Design an ENTERPRISE-GRADE file structure.
622
+ Output ONLY a JSON array: [{"name":"path/to/file.ext","purpose":"detailed description","tokens":N}]
623
+ where "tokens" is your estimate of content tokens (300-800 small, 1000-2500 medium, 2500-5000 large).
624
+
625
+ MANDATORY STRUCTURE (every project MUST have):
626
+ - package.json (with ALL dependencies: express, helmet, cors, compression, morgan, bcryptjs, jsonwebtoken, express-rate-limit, cookie-parser, dotenv)
627
+ - .env.example (all env vars documented)
628
+ - README.md (setup guide, API docs, architecture overview)
629
+ - server.js (Express with full middleware stack)
630
+ - routes/ (separate file per resource auth.js, api.js, pages.js)
631
+ - middleware/ (auth.js, error.js, validate.js, rateLimiter.js)
632
+ - models/ (per-entity files with validation)
633
+ - controllers/ (business logic separated from routes)
634
+ - utils/ (jwt.js, hash.js, logger.js, helpers.js)
635
+ - config/ (database.js, constants.js)
636
+ - public/index.html (hero, features, testimonials, pricing, CTA, footer — complete landing page)
637
+ - public/login.html (login + register forms with validation)
638
+ - public/dashboard.html (protected page with real UI)
639
+ - public/css/variables.css (CSS custom properties: colors, fonts, spacing, breakpoints)
640
+ - public/css/reset.css (modern CSS reset)
641
+ - public/css/layout.css (grid/flexbox layouts, nav, hero, sections)
642
+ - public/css/components.css (buttons, cards, forms, modals, toasts, badges)
643
+ - public/css/animations.css (keyframes, transitions, scroll animations)
644
+ - public/css/responsive.css (media queries, mobile nav)
645
+ - public/js/app.js (SPA router, init, dark mode toggle)
646
+ - public/js/auth.js (login/register/logout, token management)
647
+ - public/js/api.js (fetch wrapper with auth headers, error handling)
648
+ - public/js/ui.js (toasts, modals, loading spinners, form validation)
649
+ - public/js/animations.js (intersection observer, scroll effects)
650
+
651
+ RULES:
652
+ - Generate 25-45 files — real enterprise projects have many files
653
+ - Token estimates must be realistic: CSS files 1500-3000, JS files 1000-2000, HTML pages 2000-4000
654
+ - Use relative paths only
619
655
  - No explanation, no markdown, ONLY the JSON array.`;
620
656
 
621
657
  // Token counter — approximate based on character count (1 token ≈ 4 chars)
@@ -752,28 +788,53 @@ Design a COMPLETE production-ready file structure. Include ALL files needed for
752
788
  const fileSpec = filePlan[fi];
753
789
  emit({ type: 'file_start', name: fileSpec.name, fi: fi + 1, total: filePlan.length });
754
790
 
755
- // Include last 4 generated files as context (truncated to avoid token overflow)
756
- const prevContext = generatedFiles.slice(-4)
791
+ // Include last 6 generated files as context for consistency
792
+ const prevContext = generatedFiles.slice(-6)
757
793
  .map((f) => {
758
794
  const ext = f.name.split('.').pop();
759
- const snippet = f.content.slice(0, ext === 'json' ? 600 : 1200);
760
- return `### ${f.name}\n\`\`\`\n${snippet}${f.content.length > 1200 ? '\n... (truncated)' : ''}\n\`\`\``;
795
+ const maxSnippet = ext === 'json' ? 800 : ext === 'css' ? 2000 : 1600;
796
+ const snippet = f.content.slice(0, maxSnippet);
797
+ return `### ${f.name}\n\`\`\`\n${snippet}${f.content.length > maxSnippet ? '\n... (truncated)' : ''}\n\`\`\``;
761
798
  })
762
799
  .join('\n\n');
763
800
 
764
- // Estimate appropriate max_tokens for this file
801
+ // Generous max_tokens enterprise files are large
765
802
  const estimatedTokens = fileSpec.tokens || 2000;
766
- const maxTokens = Math.min(Math.max(estimatedTokens * 2, 2000), 8192);
767
-
768
- const fileSys = `You are a senior full-stack developer generating a COMPLETE, PRODUCTION-READY file.
769
- CRITICAL RULES:
770
- - Output ONLY the raw file content — zero explanations, zero markdown fences, zero "here is the file:" preamble
771
- - Write COMPLETE, WORKING code — no TODOs, no placeholders, no "add your code here" comments
772
- - Every function must be fully implemented with real logic
773
- - Use modern patterns: async/await, ES6+, proper error handling
774
- - CSS must include responsive design (mobile-first), dark/light variables, smooth animations
775
- - HTML must be complete with proper meta tags, semantic structure, accessible markup
776
- - JS must handle all edge cases, show loading states, handle errors gracefully`;
803
+ const maxTokens = Math.min(Math.max(estimatedTokens * 3, 4000), 16384);
804
+
805
+ const fileSys = `You are a team of 200 senior full-stack developers generating ENTERPRISE-GRADE production code.
806
+
807
+ OUTPUT FORMAT: Raw file content ONLY — zero explanations, zero markdown fences, zero preamble.
808
+
809
+ CODE STANDARDS (MANDATORY every file):
810
+ - COMPLETE, WORKING code — no TODOs, no placeholders, no "add your code here"
811
+ - Every function FULLY implemented with real business logic
812
+ - Modern ES6+: async/await, const/let, destructuring, template literals, optional chaining
813
+ - Comprehensive error handling: try/catch with meaningful error messages, proper HTTP status codes
814
+
815
+ BACKEND STANDARDS:
816
+ - Express: helmet(), cors(), compression(), express-rate-limit, morgan('combined')
817
+ - JWT auth with refresh tokens, bcrypt password hashing (10+ rounds)
818
+ - Input validation on EVERY route (validate body, params, query)
819
+ - Centralized error handler middleware with structured JSON errors
820
+ - Environment variables via process.env (never hardcoded secrets)
821
+ - Security headers: X-Content-Type-Options, X-Frame-Options, HSTS
822
+ - Rate limiting per route (auth routes stricter)
823
+ - Request logging with timestamps
824
+
825
+ FRONTEND STANDARDS:
826
+ - Semantic HTML5: header, nav, main, section, article, footer
827
+ - Mobile-first responsive CSS with CSS custom properties (--primary, --bg, --text, etc.)
828
+ - Dark/light mode support via prefers-color-scheme AND manual toggle
829
+ - Smooth transitions (0.2-0.3s ease), hover states on ALL interactive elements
830
+ - Loading spinners/skeletons for async operations
831
+ - Toast notifications for success/error feedback
832
+ - Form validation with inline error messages
833
+ - Intersection Observer for scroll animations
834
+ - Accessible: aria-labels, focus styles, keyboard navigation, alt text
835
+ - Professional typography: system font stack, proper hierarchy (clamp() for fluid sizes)
836
+ - CSS Grid/Flexbox layouts — no floats
837
+ - At minimum 500 lines for main CSS files, 200+ lines for page JS files`;
777
838
 
778
839
  const filePrompt = `Project: ${projectName}
779
840
  Description: ${description}