nothumanallowed 14.1.77 → 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.77",
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.77';
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
 
@@ -466,13 +466,15 @@ async function runWebCraftAgent(config, projectName, message, attachments, emit)
466
466
  const LANG_MAP = { en:'English',it:'Italian',es:'Spanish',fr:'French',de:'German',pt:'Portuguese' };
467
467
  const language = LANG_MAP[(config?.language||'it').slice(0,2)] || 'Italian';
468
468
 
469
- // 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
470
470
  const mentionedFiles = files.filter((f) => message.toLowerCase().includes(f.toLowerCase().split('/').pop() ?? ''));
471
- 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);
472
474
  const fileContents = contextFiles.map((rel) => {
473
475
  try {
474
476
  const content = fs.readFileSync(path.join(dir, rel), 'utf-8');
475
- return `### FILE: ${rel}\n\`\`\`\n${content.slice(0, 6000)}\n\`\`\``;
477
+ return `### FILE: ${rel}\n\`\`\`\n${content.slice(0, 8000)}\n\`\`\``;
476
478
  } catch { return ''; }
477
479
  }).filter(Boolean).join('\n\n');
478
480
 
@@ -519,7 +521,11 @@ RULES:
519
521
  } catch {}
520
522
 
521
523
  const systemPrompt = [
522
- `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.`,
523
529
  `\n\n## PROJECT: ${projectName}`,
524
530
  `\n## FILES:\n${fileIndex}`,
525
531
  skillContext,
@@ -527,7 +533,6 @@ RULES:
527
533
  attachments?.length ? `\n\n## ATTACHMENTS: ${attachments.map((a) => a.name).join(', ')}` : '',
528
534
  `\n\n## CURRENT FILE CONTENTS:\n${fileContents}`,
529
535
  `\n\n${toolSpec}`,
530
- `\n\nIMPORTANT: Be precise, surgical, and explain every change.`,
531
536
  ].join('');
532
537
 
533
538
  // Prepare user content (text + images if any)
@@ -543,7 +548,7 @@ RULES:
543
548
  // Suppress raw <tool> blocks from text stream — only emit visible text
544
549
  const visibleToken = token.replace(/<tool>[\s\S]*?<\/tool>/g, '');
545
550
  if (visibleToken) emit({ type: 'text', token: visibleToken });
546
- }, { max_tokens: 8192 });
551
+ }, { max_tokens: 16384 });
547
552
 
548
553
  // ── Execute all tool calls found in the response ───────────────────────────
549
554
  const toolRegex = /<tool>([\s\S]*?)<\/tool>/g;
@@ -613,17 +618,40 @@ RULES:
613
618
 
614
619
  // ── Generation pipeline (SSE) ─────────────────────────────────────────────────
615
620
 
616
- const FILE_PLAN_SYSTEM = `You are a senior full-stack architect. Design a COMPLETE, PRODUCTION-READY file structure for a web project.
617
- Output ONLY a JSON array: [{"name":"path/to/file.ext","purpose":"what this file does","tokens":N}]
618
- 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).
619
-
620
- MANDATORY rules:
621
- - Generate 20-40 files minimum for any real project a complete site requires many files
622
- - Split large concerns into separate files (separate route files, separate component files, separate util files)
623
- - Always include: package.json, server.js (or index.js), .env.example, README.md
624
- - For full-stack projects: routes/, middleware/, models/, controllers/ directories with individual files per resource
625
- - For frontend: separate CSS files per section (hero, navbar, footer, components), separate JS modules
626
- - 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
627
655
  - No explanation, no markdown, ONLY the JSON array.`;
628
656
 
629
657
  // Token counter — approximate based on character count (1 token ≈ 4 chars)
@@ -760,28 +788,53 @@ Design a COMPLETE production-ready file structure. Include ALL files needed for
760
788
  const fileSpec = filePlan[fi];
761
789
  emit({ type: 'file_start', name: fileSpec.name, fi: fi + 1, total: filePlan.length });
762
790
 
763
- // Include last 4 generated files as context (truncated to avoid token overflow)
764
- const prevContext = generatedFiles.slice(-4)
791
+ // Include last 6 generated files as context for consistency
792
+ const prevContext = generatedFiles.slice(-6)
765
793
  .map((f) => {
766
794
  const ext = f.name.split('.').pop();
767
- const snippet = f.content.slice(0, ext === 'json' ? 600 : 1200);
768
- 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\`\`\``;
769
798
  })
770
799
  .join('\n\n');
771
800
 
772
- // Estimate appropriate max_tokens for this file
801
+ // Generous max_tokens enterprise files are large
773
802
  const estimatedTokens = fileSpec.tokens || 2000;
774
- const maxTokens = Math.min(Math.max(estimatedTokens * 2, 2000), 8192);
775
-
776
- const fileSys = `You are a senior full-stack developer generating a COMPLETE, PRODUCTION-READY file.
777
- CRITICAL RULES:
778
- - Output ONLY the raw file content — zero explanations, zero markdown fences, zero "here is the file:" preamble
779
- - Write COMPLETE, WORKING code — no TODOs, no placeholders, no "add your code here" comments
780
- - Every function must be fully implemented with real logic
781
- - Use modern patterns: async/await, ES6+, proper error handling
782
- - CSS must include responsive design (mobile-first), dark/light variables, smooth animations
783
- - HTML must be complete with proper meta tags, semantic structure, accessible markup
784
- - 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`;
785
838
 
786
839
  const filePrompt = `Project: ${projectName}
787
840
  Description: ${description}