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 +1 -1
- package/src/constants.mjs +1 -1
- package/src/server/routes/webcraft.mjs +86 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "14.1.
|
|
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.
|
|
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
|
|
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
|
-
|
|
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,
|
|
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
|
|
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:
|
|
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
|
|
617
|
-
Output ONLY a JSON array: [{"name":"path/to/file.ext","purpose":"
|
|
618
|
-
where "tokens" is your estimate of
|
|
619
|
-
|
|
620
|
-
MANDATORY
|
|
621
|
-
-
|
|
622
|
-
-
|
|
623
|
-
-
|
|
624
|
-
-
|
|
625
|
-
-
|
|
626
|
-
-
|
|
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
|
|
764
|
-
const prevContext = generatedFiles.slice(-
|
|
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
|
|
768
|
-
|
|
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
|
-
//
|
|
801
|
+
// Generous max_tokens — enterprise files are large
|
|
773
802
|
const estimatedTokens = fileSpec.tokens || 2000;
|
|
774
|
-
const maxTokens = Math.min(Math.max(estimatedTokens *
|
|
775
|
-
|
|
776
|
-
const fileSys = `You are a senior full-stack
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
-
|
|
782
|
-
-
|
|
783
|
-
-
|
|
784
|
-
-
|
|
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}
|