bleujs v1.1.2
.js/core
- Bleu.js is a Rule-based AI framework designed to provide pinpoint solutions to various problems. It's is a JavaScript framework built to tackle the various coding challenges developers face.
Features
- Advanced debugging
- Automates dependency management
- Ensure Code Quality: Tools to ensure the highest code quality
- Generate Eggs: Automatically generate code snippets
- Provides tools to maintain code quality without adding extra complexity
- Real-time optimization suggestions
- Streamlines collaboration
- Support for multiple programming languages
- Manage Dependencies: Handle project dependencies efficiently
Prerequisites
Install the bleujs
package using pnpm:
pnpm add bleujs@1.1.2
bleujs start
or
pnpm install bleujs@latest
pnpm run start
Retrieve Package Information
pnpm info bleujs
Directory Structure
- core-engine: Contains the main logic for code generation, optimization, and debugging.
- language-plugins: Modules for different programming languages.
- javascript: JavaScript-specific tools.
- python: Python-specific tools.
- collaboration-tools: Tools for code review, issue tracking, and project management.
- dependency-management: Tools for monitoring and managing dependencies.
- code-quality-assurance: Tools for continuous code quality checks and analysis.
- eggs-generator: Tools for generating code snippets and optimization suggestions by HenFarm.js, the framework built by Helloblue.
- docker: Docker configuration files.
Features
Core Engine
- Efficient CPU core utilization through worker (Agent) processes
- Automatic worker restart for high availability
- Dynamic code generation and template management
- Enhanced logging with winston integration
- Comprehensive metrics tracking
- WebSocket connection management
- Request rate limiting
- Health monitoring
- Graceful shutdown handling
Changelog (v1.1.2)
Bleu.js v1.1.2 introduces major improvements in the AI and machine learning pipeline, focusing on XGBoost model efficiency, training, and real-time predictions. This version ensures enhanced performance, robustness, and scalability.
XGBoost Model v1.1.2
πΉ Key Updates in v1.1.2
Enhanced XGBoost Model Handling
- The model is now loaded safely with exception handling and feature validation
- Optimized error handling ensures smooth execution in production
Improved Feature Preprocessing
- Features are now auto-adjusted to match the model's expected input dimensions
- Padding logic ensures that missing features do not break predictions
Multi-threaded Predictions
- Predictions now run on separate threads, reducing blocking behavior and improving real-time inference speed
Hyperparameter Optimization with Optuna
- Uses Optuna to find the best hyperparameters dynamically
- Optimized for higher accuracy, faster predictions, and better generalization
Advanced Model Performance Metrics
- The training script now tracks Accuracy, ROC-AUC, F1 Score, Precision, and Recall
- Feature importance analysis improves explainability
Scalable Deployment Ready
- The model and scaler are saved in pkl format for easy integration
- Ready for cloud deployment and enterprise usage
π XGBoost Model Training Overview
The new version includes a robust training pipeline with:
- Data Scaling: Uses
StandardScaler
for normalization - Hyperparameter Optimization: Finds the best combination of:
n_estimators
max_depth
learning_rate
subsample
colsample_bytree
reg_alpha
reg_lambda
- Final Model Performance:
- Accuracy: π Improved for real-world datasets
- Prediction Confidence: β Higher reliability in decision-making
π§ How to Use
1οΈβ£ Model Loading
Activate the Virtual Environment If you're using bash/zsh (macOS/Linux):
source ~/Bleu.js/bleujs-env/bin/activate
If you're using fish shell:
source ~/Bleu.js/bleujs-env/bin/activate.fish
If you're using Windows (cmd or PowerShell):
~/Bleu.js/bleujs-env/Scripts/activate
The model is automatically loaded at runtime with proper exception handling:
from xgboost_model import predict
input_features = [0.5, 0.3, 0.8, 1.2, 0.7, 0.9, 1.1, 0.6, 0.4, 1.0] # Example input
result = predict(input_features)
print(result)
2οΈβ£ Training a New Model
To train a new XGBoost model with Optuna, run:
python train_xgboost.py
Best Accuracy: 0.9450
Best ROC-AUC: 0.9869
Best F1 Score: 0.9488
Best Precision: 0.9444
Best Recall: 0.9533
3οΈβ£ Deploying Bleu.js v1.1.2
The trained model can be deployed using AWS Lambda, Flask, FastAPI, or Docker.
Advanced AI Components
- Multi-head Attention Mechanisms
- LLaMA Model Integration
- Advanced NLP Processing
- Performance Optimization Suite
- Custom Transformer Architecture
Bleu.js - LLaMA Model & Backend Debugging Guide
π Running & Debugging the LLaMA Model
python -m debugpy --listen 5678 --wait-for-client src/ml/models/foundation/llama.py
This allows VSCode or another debugger to attach to the running process.
Profile Model Performance (Bottleneck Analysis)
python -m torch.utils.bottleneck src/ml/models/foundation/llama.py
This provides insights into model performance bottlenecks.
Run LLaMA Model on GPU (if available)
CUDA_VISIBLE_DEVICES=0 python src/ml/models/foundation/llama.py
Forces execution on GPU for better performance.
β Expected Output
β
LLaMA Attention Output Shape: torch.Size([1, 512, 4096])
π Profiling & Performance Analysis
π¬ cProfile Summary (Python Profiler Output)
torch.nn.linear and torch.matmul are the heaviest operations.
apply_rotary_embedding accounts for about 10ms per call.
π Top autograd Profiler Events
`top 15 events sorted by cpu_time_total ------------------ ------------ ------------ ------------ ------------ ------------ ------------ Name Self CPU % Self CPU CPU total % CPU total CPU time avg # of Calls ------------------ ------------ ------------ ------------ ------------ ------------ ------------ aten::uniform_ 17.73% 62.645ms 17.73% 62.645ms 62.645ms 1 aten::linear 0.00% 2.918us 13.71% 48.415ms 48.415ms 1 aten::matmul 0.00% 9.332us 13.70% 48.404ms 48.404ms 1 aten::mm 13.70% 48.385ms 13.70% 48.385ms 48.385ms 1 ------------------ ------------ ------------ ------------ ------------ ------------ ------------`;
π οΈ Backend API & Testing
Run Python Tests with Pytest
pytest tests/ --disable-warnings
Install with pip install pytest if missing.
π Environment Variables & .env Setup
Verify .env File Exists
cat.env;
Load .env Variables in Shell
export $(grep -v '^#' .env | xargs) `
Verify API Key in Node.js
node -e "import 'dotenv/config'; console.log('β
API_KEY:', process.env.API_KEY);"
Verify API Key in Python
python -c "from dotenv import load_dotenv; import os; load_dotenv(); print('β
API_KEY:', os.getenv('API_KEY'))"
π Find Configuration Files
Find launch.json for VSCode Debugging
find ~/Bleu.js -name "launch.json" `
Find all .env Files in Your Project
find ~/Bleu.js -name ".env" `
β Final Check: Running Everything Smoothly
Make sure .env is loaded properly
Run AI Model tests
Run Backend tests
Monitor performance with bottleneck
python -m torch.utils.bottleneck src/ml/models/foundation/llama.py
β Expected Output
Running environment analysis...
Running your script with cProfile
β
LLaMA Attention Output Shape: torch.Size([1, 512, 4096])
Running your script with the autograd profiler...
β
LLaMA Attention Output Shape: torch.Size([1, 512, 4096])
--------------------------------------------------------------------------------
Environment Summary
--------------------------------------------------------------------------------
PyTorch 2.6.0 DEBUG not compiled w/ CUDA
Running with Python 3.13 and
`pip3 list` truncated output:
numpy==2.2.3
torch==2.6.0
--------------------------------------------------------------------------------
cProfile output
--------------------------------------------------------------------------------
1858 function calls (1810 primitive calls) in 0.408 seconds
Ordered by: internal time
List reduced from 269 to 15 due to restriction <15>
ncalls tottime percall cumtime percall filename:lineno(function)
4 0.209 0.052 0.209 0.052 {method 'uniform_' of 'torch._C.TensorBase' objects}
4 0.112 0.028 0.112 0.028 {built-in method torch._C._nn.linear}
1 0.021 0.021 0.021 0.021 {built-in method torch.randn}
2 0.018 0.009 0.018 0.009 {built-in method torch.matmul}
1 0.008 0.008 0.010 0.010 src/ml/models/foundation/llama.py:99(apply_rotary_embedding)
1 0.008 0.008 0.008 0.008 {method 'softmax' of 'torch._C.TensorBase' objects}
1 0.005 0.005 0.163 0.163 src/ml/models/foundation/llama.py:81(forward)
3 0.004 0.001 0.004 0.001 {built-in method torch.cat}
2 0.003 0.001 0.003 0.001 {built-in method torch.arange}
4 0.002 0.001 0.002 0.001 {built-in method torch.empty}
1 0.002 0.002 0.002 0.002 {method 'float' of 'torch._C.TensorBase' objects}
1 0.002 0.002 0.002 0.002 {method 'cos' of 'torch._C.TensorBase' objects}
1 0.001 0.001 0.001 0.001 {built-in method torch.einsum}
1 0.001 0.001 0.003 0.003 /Users/pejmanhaghighatnia/Bleu.js/bleujs-env/lib/python3.13/site-packages/torch/_tensor.py:1075(__rdiv__)
1 0.001 0.001 0.001 0.001 {built-in method torch.pow}
--------------------------------------------------------------------------------
autograd profiler output (CPU mode)
--------------------------------------------------------------------------------
top 15 events sorted by cpu_time_total
------------------ ------------ ------------ ------------ ------------ ------------ ------------
Name Self CPU % Self CPU CPU total % CPU total CPU time avg # of Calls
------------------ ------------ ------------ ------------ ------------ ------------ ------------
aten::uniform_ 18.03% 46.352ms 18.03% 46.352ms 46.352ms 1
aten::uniform_ 17.99% 46.245ms 17.99% 46.245ms 46.245ms 1
aten::uniform_ 17.69% 45.479ms 17.69% 45.479ms 45.479ms 1
aten::uniform_ 17.62% 45.306ms 17.62% 45.306ms 45.306ms 1
aten::linear 0.00% 4.875us 9.85% 25.333ms 25.333ms 1
aten::linear 0.00% 2.125us 9.81% 25.219ms 25.219ms 1
aten::matmul 0.00% 7.250us 9.81% 25.210ms 25.210ms 1
aten::mm 9.80% 25.195ms 9.80% 25.195ms 25.195ms 1
aten::matmul 0.00% 7.584us 9.74% 25.038ms 25.038ms 1
aten::mm 9.73% 25.014ms 9.73% 25.014ms 25.014ms 1
aten::linear 0.00% 2.957us 9.13% 23.468ms 23.468ms 1
aten::matmul 0.00% 6.959us 9.12% 23.455ms 23.455ms 1
aten::mm 9.12% 23.440ms 9.12% 23.440ms 23.440ms 1
aten::linear 0.00% 2.334us 8.87% 22.814ms 22.814ms 1
aten::matmul 0.00% 5.917us 8.87% 22.804ms 22.804ms 1
------------------ ------------ ------------ ------------ ------------ ------------ ------------
Self CPU time total: 257.072ms
AI Tools
With built-in AI services like Natural Language Processing (NLP) and decision trees, developers can quickly integrate advanced AI capabilities into their applications without starting from scratch.
π Python AI Components
- NLP Engine:
language-plugins/python/
- ML Models:
src/backend/src/ml/models/
- Training:
train.py
- Evaluation:
evaluate.py
- Training:
- Core Application:
app.py
The Python components power our advanced AI and ML capabilities:
- Natural Language Processing
- Decision Tree Models
- Model Training & Evaluation
- Real-time Performance Optimization
Backend Efficiency
The package includes setup using Express.js, MongoDB, and essential middleware like helmet for security, compression for performance, and cors for handling cross-origin requests. This allows developers to set up a scalable and secure backend efficiently.
Testing and Quality Assurance
bleujs integrates testing frameworks, including Jest for unit and integration tests, and Cypress for end-to-end tests. This ensures that applications built with this package are reliable and maintain high quality standards.
Code Linting and Formatting
By including ESLint and Prettier configurations, bleujs helps developers maintain consistent coding standards and formatting, reducing errors and improving code readability.
TypeScript Support
The package supports TypeScript, allowing developers to write safer and more maintainable code with type checking.
Swagger Documentation
The package includes tools for generating Swagger API documentation, making it easier for developers to document and share their API specifications.
Continuous Integration/Continuous Deployment (CI/CD)
The package comes with a CI/CD pipeline configuration for automated testing, linting, building, and deployment. This helps teams to integrate changes continuously and deploy applications reliably.
Docker Support
With Docker integration, developers can containerize their applications for consistent deployment across different environments. This ensures that the application runs seamlessly regardless of where it is deployed.
Real-time Features
To add real-time features like live notifications and updates to their applications.
Usage
Create an instance of the BleuJS class and use its methods to manage your code:
import BleuJS from 'bleu.js';
const bleu = new BleuJS();
const newEgg = bleu.generateEgg('This is a description of the new egg.');
console.log(newEgg);
const code = 'const x = 1; console.log(x);';
const optimizedCode = bleu.optimizeCode(code);
const dependencies = ['express', 'body-parser'];
bleu.manageDependencies(dependencies);
const isQualityCode = bleu.ensureCodeQuality(code);
console.log(`Is the code quality acceptable? ${isQualityCode}`);
bleujs-utils Package (Version 1.0.1)
The bleujs-util
package provides essential utility functions that are part of the Bleu.js framework. It simplifies the process of handling various coding challenges such as dependency management, code quality checks, and optimization.
Features
- Lightweight utility functions for common tasks.
- Dependency management utilities.
- Code optimization tools.
Installation
You can install the bleujs-utils package via pip
Using pip:
pip install bleujs-utils
CLI Package Information
bleujs-utils
You can view the package on PyPI: bleujs-utils on PyPI
Example 1: General Utility Function
from bleujs_utils import some_utility_function
result = some_utility_function(input_data)
print(result)
Example 2: Helper Functions for AI Integration
from bleujs_utils import ai_query
response = ai_query('What is the weather today?')
print(response)
- AI Query Tools: Provides helper functions for querying AI models, managing requests, and handling responses.
- Company Search: Utilities for fuzzy searching company names, perfect for customer service applications like HelloBlue.
- Error Handling: Custom logging and debugging utilities designed to streamline development and troubleshooting.
Example 3: CLI Tool
bleujs-utils-cli --help
Hereβs how you can use the bleujs-utils
package in your project:
const { optimizeCode, manageDependencies } = require('bleujs-utils');
const code = 'const x = 1; console.log( x);';
const optimizedCode = optimizeCode(code);
console.log('Optimized Code:', optimizedCode);
const dependencies = ['express', 'body-parser'];
manageDependencies(dependencies);
Optimizing Code
The optimizeCode
function cleans up and formats code for better readability and performance.
const { optimizeCode } = require('bleujs-utils');
const code = 'const x = 1; console.log( x);';
const optimizedCode = optimizeCode(code);
console.log(optimizedCode);
Managing Dependencies
The manageDependencies
function helps you keep track of and manage your project dependencies efficiently.
const { manageDependencies } = require('bleujs-utils');
const dependencies = ['express', 'mongoose'];
manageDependencies(dependencies);
Class Documentation
'BleuJS'
The BleuJS class provides several methods to help you manage and optimize your code.
class Bleu {
constructor() {
this.eggs = [];
}
/**
* Generates a new code egg.
* @param {string} description - Description of the egg.
* @param {string} type - Type of the egg (e.g., 'model', 'utility').
* @param {object} options - Options for generating the egg.
* @returns {object} The generated egg.
*/
generateEgg(description, type, options) {
const code = this.generateCode(type, options);
const newEgg = {
id: this.eggs.length + 1,
description: this.generateDescription(type, options),
type,
code,
};
this.eggs.push(newEgg);
return newEgg;
}
/**
* Generates code based on type.
* @param {string} type - Type of the code (e.g., 'model', 'utility').
* @param {object} options - Options for generating the code.
* @returns {string} The generated code.
*/
generateCode(type, options) {
switch (type) {
case 'model':
return this.generateModel(options.modelName, options.fields);
case 'utility':
return this.generateUtility(options.utilityName, options.methods);
default:
throw new Error(`Unknown code type: ${type}`);
}
}
/**
* Generates model code.
* @param {string} modelName - Name of the model.
* @param {Array} fields - Fields of the model.
* @returns {string} The generated model code.
*/
generateModel(modelName, fields) {
let code = `class ${modelName} {\n`;
fields.forEach((field) => {
code += ` ${field.name}: ${field.type};\n`;
});
code += '}';
return code;
}
/**
* Generates utility code.
* @param {string} utilityName - Name of the utility.
* @param {Array} methods - Methods of the utility.
* @returns {string} The generated utility code.
*/
generateUtility(utilityName, methods) {
let code = `class ${utilityName} {\n`;
methods.forEach((method) => {
code += ` ${method}() {\n`;
code += ` // TODO: Implement ${method}\n`;
code += ' }\n';
});
code += '}';
return code;
}
/**
* Generates description based on type.
* @param {string} type - Type of the egg.
* @param {object} options - Options for generating the description.
* @returns {string} The generated description.
*/
generateDescription(type, options) {
switch (type) {
case 'model':
return `Model ${options.modelName} with fields ${options.fields.map((f) => f.name).join(', ')}`;
case 'utility':
return `Utility ${options.utilityName} with methods ${options.methods.join(', ')}`;
default:
throw new Error(`Unknown code type: ${type}`);
}
}
/**
* Optimizes the provided code.
* @param {string} code - The code to optimize.
* @returns {string} The optimized code.
*/
optimizeCode(code) {
return code.replace(/\s+/g, ' ').trim();
}
/**
* Manages dependencies.
* @param {Array} dependencies - List of dependencies.
*/
manageDependencies(dependencies) {
dependencies.forEach((dep) => {
console.log(`Managing dependency: ${dep}`);
});
}
/**
* Ensures code quality.
* @param {string} code - The code to check.
* @returns {boolean} Whether the code is of high quality.
*/
ensureCodeQuality(code) {
return !code.includes('var');
}
}
module.exports = Bleu;
Bleu
β should generate a new egg (1 ms)
β should optimize code
β should manage dependencies (10 ms)
β should ensure code quality
β should generate multiple eggs
β should handle large number of eggs (3 ms)
β should handle complex optimization
β should ensure quality of complex code
Test Suites: 1 passed, 1 total
Tests: 8 passed, 8 total
Snapshots: 0 total
Time: 0.359 s, estimated 1 s
Ran all test suites.
Constructor
constructor();
Structure
class Bleu {
constructor() {
this.eggs = [];
}
generateEgg(description, type, options = {}) {
const newEgg = {
id: this.eggs.length + 1,
description,
type,
code: this.generateCode(type, options),
};
this.eggs.push(newEgg);
return newEgg;
}
generateCode(type, options) {
switch (type) {
case 'model':
return this.generateModel(options.modelName, options.fields);
case 'controller':
return this.generateController(options.controllerName, options.actions);
case 'utility':
return this.generateUtility(options.utilityName, options.methods);
default:
throw new Error(`Unknown code type: ${type}`);
}
}
generateModel(modelName, fields) {
const classFields = fields
.map((field) => ` ${field.name}: ${field.type};`)
.join('\n');
const classMethods = fields
.map(
(field) =>
` get${field.name.charAt(0).toUpperCase() + field.name.slice(1)}() { return this.${field.name}; }`,
)
.join('\n\n');
return `
class ${modelName} {
${classFields}
constructor(${fields.map((field) => field.name).join(', ')}) {
${fields.map((field) => `this.${field.name} = ${field.name};`).join('\n ')}
}
${classMethods}
}
module.exports = ${modelName};
`;
}
generateController(controllerName, actions) {
const actionMethods = actions
.map(
(action) => `
${action}() {
// ${action} logic here
}`,
)
.join('\n');
return `
class ${controllerName} {
${actionMethods}
}
module.exports = ${controllerName};
`;
}
generateUtility(utilityName, methods) {
const utilityMethods = methods
.map(
(method) => `
${method.name}(${method.params.join(', ')}) {
${method.body}
}`,
)
.join('\n');
return `
class ${utilityName} {
${utilityMethods}
}
module.exports = ${utilityName};
`;
}
optimizeCode(code) {
const optimizedCode = code;
return optimizedCode;
}
manageDependencies(dependencies) {
dependencies.forEach((dep) => {
console.log(`Managing dependency: ${dep}`);
});
}
ensureCodeQuality(code) {
const isQualityCode = true;
return isQualityCode;
}
}
module.exports = Bleu;
const Bleu = require('./Bleu');
const bleu = new Bleu();
const newEgg = bleu.generateEgg('This is a test egg', 'model', {
modelName: 'TestModel',
fields: [
{ name: 'field1', type: 'string' },
{ name: 'field2', type: 'number' },
],
});
const code = 'const x = 1; console.log(x);';
const optimizedCode = bleu.optimizeCode(code);
console.log('Optimized Code:', optimizedCode);
const isQualityCode = bleu.ensureCodeQuality(code);
console.log('Is the code quality acceptable?', isQualityCode);
const dependencies = ['express', 'body-parser'];
bleu.manageDependencies(dependencies);
pnpm test
PASS tests/bleu.test.js
API Tests
β should return Hello, World! on GET / (49 ms)
β should create data on POST /data (113 ms)
β should create multiple data entries on POST /data (114 ms)
β should handle /data with body {} (10 ms)
β should handle /nonexistent with body null (6 ms)
β should handle /data with body Invalid JSON (5 ms)
β should handle asynchronous errors gracefully (12 ms)
β should handle edge cases (4 ms)
β should ensure performance meets expectations (4 ms)
β should return 400 for missing data field in POST /data (5 ms)
β should return 500 for simulated server error in POST /data (7 ms)
β should handle invalid JSON gracefully (3 ms)
β should handle very large data payloads (106 ms)
β should measure response time for POST /data (110 ms)
β should handle simultaneous requests (148 ms)
β should validate response schema (6 ms)
β should stress test the server (263 ms)
β should test with invalid routes (5 ms)
β should test JSON parsing error (3 ms)
β should test different HTTP methods on /data (5 ms)
β should handle very large number of simultaneous requests (1235 ms)
β should handle concurrent GET and POST requests (108 ms)
β should handle slow network conditions gracefully (110 ms)
β should handle invalid request headers (10 ms)
β should verify CORS headers (7 ms)
β should handle session cookies (116 ms)
β should verify content-type for POST /data (9 ms)
β should test for memory leaks (274 ms)
β should handle different user roles (111 ms)
β should handle database connectivity issues (5 ms)
β should handle multipart/form-data (110 ms)
β should handle application/x-www-form-urlencoded (113 ms)
β should handle JSON arrays (11 ms)
β should handle deeply nested JSON objects (114 ms)
Test Suites: 1 passed, 1 total
Tests: 34 passed, 34 total
Snapshots: 0 total
Time: 3.707 s, estimated 4 s
Ran all test suites.
Initializes a new instance of the BleuJS class
Methods
Class Constructor:
The class constructor initializes the Bleu object with an empty array eggs to store the generated code 'eggs'. This array acts as a container for all the code snippets, models, utilities, and other structures created using the generateEgg method.
- Initializes an empty array eggs to store the generated code 'eggs'.
constructor() {
this.eggs = [];
this.henFarm = new HenFarm();
}
generateEgg Method:
The generateEgg method is responsible for generating a new code 'egg'. This method leverages the HenFarm.js framework to produce code snippets based on the specified type and options. Each generated egg is assigned a unique ID, a description, and the generated code. The egg is then added to the eggs array and returned.
- Utilize HenFarm.js to generate code based on the provided type and options.
- Create a new egg object with a unique ID, description, type, generated code, and creation timestamp.
- Append the new egg to the eggs array.
- Return the newly created egg.
Eggs Generator API
The Eggs Generator API is a microservice that generates custom AI-powered "eggs" based on provided parameters. This API is designed for scalability, AI logic, and real-time egg generation.
If you want faster execution and better debugging, use:
curl -X POST http://localhost:3003/api/eggs/generate-egg \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "User-Agent: Curl-Advanced-Test" \
-H "Cache-Control: no-cache" \
-d '{
"type": "celestial",
"description": "A rare legendary egg",
"parameters": {
"size": "large",
"color": "gold",
"rarity": "legendary",
"element": "magic"
}
}' \
--fail --silent --show-error --output response.json
Then, check your response.json
Expected result
{"success":true,"result":{"id":"990321c6-7cae-472f-933d-743a9ac8022c","type":"dragon","description":"A rare legendary egg","metadata":{"tags":[],"version":"1.0.37","generatedBy":"Eggs-Generator v1.0.37","properties":{"rarity":"legendary","element":"fire"},"rarity":"legendary","attributes":[{"trait_type":"element","value":"fire","rarity_score":4,"_id":"67b0a38eae7bb50b80649417"}],"dna":"1bd6e02ead46f6927bf1c5f185bfcf38","generation":1,"aiFingerprint":"9833bf1a6f857eac2fe43e0d42d8cf6b6c45382300ff0146dc396441457c536c"},"status":"incubating","incubationConfig":{"startTime":"2025-02-15T14:24:14.877Z","duration":86400,"temperature":37,"conditions":[],"optimalTemp":37},"evolution":{"stage":1,"powerLevel":104,"experience":0,"history":[],"possibleEvolutions":[]},"interactions":{"total":0,"history":[]},"owner":"system","tradeable":true,"market":{"listed":false,"bids":[],"realTimePrice":0,"priceHistory":[]},"security":{"validation":false,"signature":"233b4233de9948536c2931dfd876e2c66ad4ffe2bb46e8e9e7fca464994d1a5a"},"_id":"67b0a38eae7bb50b80649416","ownershipHistory":[],"createdAt":"2025-02-15T14:24:14.881Z","updatedAt":"2025-02-15T14:24:14.881Z","__v":0},"market":{"tier":{"eggsPerDay":5,"rarities":["common","uncommon"],"price":0},"tradingEnabled":false}}%
curl -X POST http://localhost:3003/api/eggs/generate-egg \
-H "Content-Type: application/json" \
-d '{
"type": "celestial",
"description": "A rare legendary egg",
"parameters": { "size": "large", "color": "gold", "rarity": "legendary", "element": "magic" }
}'
Expected result
Generated Egg: {
id: '9854f6da-b409-4b72-bd30-7e545d79b1a7',
type: 'golden-egg',
description: 'A rare legendary egg',
metadata: {
size: 'large',
color: 'gold',
generatedBy: 'Eggs-Generator v1.0.37',
timestamp: '2025-02-09T06:14:51.061Z'
},
createdAt: '2025-02-09T06:14:51.061Z',
updatedAt: '2025-02-09T06:14:51.061Z'
}
2025-02-09T06:14:51.063Z [INFO]: β
Egg Generated Successfully {"result":{"id":"9854f6da-b409-4b72-bd30-7e545d79b1a7","type":"golden-egg","description":"A rare legendary egg","metadata":{"size":"large","color":"gold","generatedBy":"Eggs-Generator v1.0.37","timestamp":"2025-02-09T06:14:51.061Z"},"createdAt":"2025-02-09T06:14:51.061Z","updatedAt":"2025-02-09T06:14:51.061Z"}}
{
"type": "golden-egg",
"description": "A rare legendary egg",
"parameters": {
"size": "large",
"color": "gold"
}
}
Response (Example)
{
"result": {
"id": "75525d38-b458-4493-80c2-a0b01ff64c66",
"type": "golden-egg",
"description": "A rare legendary egg",
"metadata": {
"size": "large",
"color": "gold",
"generatedBy": "Eggs-Generator v1.0.38",
"timestamp": "2025-02-09T01:12:03.933Z"
},
"createdAt": "2025-02-09T01:12:03.933Z",
"updatedAt": "2025-02-09T01:12:03.933Z"
}
}
PASS tests/bleu.test.js
API Tests
β should return Hello, World! on GET / (49 ms)
β should create data on POST /data (113 ms)
β should create multiple data entries on POST /data (114 ms)
β should handle /data with body {} (10 ms)
β should handle /nonexistent with body null (6 ms)
β should handle /data with body Invalid JSON (5 ms)
β should handle asynchronous errors gracefully (12 ms)
β should handle edge cases (4 ms)
β should ensure performance meets expectations (4 ms)
β should return 400 for missing data field in POST /data (5 ms)
β should return 500 for simulated server error in POST /data (7 ms)
β should handle invalid JSON gracefully (3 ms)
β should handle very large data payloads (106 ms)
β should measure response time for POST /data (110 ms)
β should handle simultaneous requests (148 ms)
β should validate response schema (6 ms)
β should stress test the server (263 ms)
β should test with invalid routes (5 ms)
β should test JSON parsing error (3 ms)
β should test different HTTP methods on /data (5 ms)
β should handle very large number of simultaneous requests (1235 ms)
β should handle concurrent GET and POST requests (108 ms)
β should handle slow network conditions gracefully (110 ms)
β should handle invalid request headers (10 ms)
β should verify CORS headers (7 ms)
β should handle session cookies (116 ms)
β should verify content-type for POST /data (9 ms)
β should test for memory leaks (274 ms)
β should handle different user roles (111 ms)
β should handle database connectivity issues (5 ms)
β should handle multipart/form-data (110 ms)
β should handle application/x-www-form-urlencoded (113 ms)
β should handle JSON arrays (11 ms)
β should handle deeply nested JSON objects (114 ms)
Test Suites: 1 passed, 1 total
Tests: 34 passed, 34 total
Snapshots: 0 total
Time: 3.707 s, estimated 4 s
Ran all test suites.
pnpm test
> bleujs@1.1.2 test /Users/Bleu.js
> jest --detectOpenHandles --forceExit
PASS lint coverage/prettify.js
β ESLint (66 ms)
PASS lint coverage/lcov-report/prettify.js
β ESLint (29 ms)
PASS lint dependency-management/coverage/prettify.js
β ESLint (30 ms)
PASS lint dependency-management/coverage/lcov-report/prettify.js
β ESLint (105 ms)
PASS lint venv/lib/python3.13/site-packages/werkzeug/debug/shared/debugger.js
β ESLint (12 ms)
PASS lint eggs-generator/src/types/egg.types.js
β ESLint (6 ms)
PASS lint backend/src/src/controllers/apiController.js
β ESLint (6 ms)
PASS lint eggs-generator/src/routes/egg.routes.js
β ESLint (11 ms)
PASS lint coverage/lcov-report/sorter.js
β ESLint (8 ms)
PASS lint coverage/sorter.js
β ESLint (4 ms)
PASS lint dependency-management/coverage/sorter.js
β ESLint (4 ms)
PASS lint dependency-management/coverage/lcov-report/sorter.js
β ESLint (3 ms)
PASS lint backend/src/src/ai/decisionTree.js
β ESLint (6 ms)
PASS lint frontend/src/index.js
β ESLint (3 ms)
PASS lint frontend/public/app.js
β ESLint (4 ms)
PASS lint ./jest.setup.js
β ESLint (7 ms)
PASS lint eggs-generator/src/services/egg.service.js
β ESLint (4 ms)
PASS lint eggs-generator/src/events/eggEvents.js
β ESLint (6 ms)
PASS lint src/backend/src/controllers/apiController.js
β ESLint (5 ms)
PASS lint eggs-generator/src/Bleu.js
β ESLint (2 ms)
PASS lint backend/src/src/controllers/rulesController.js
β ESLint (3 ms)
PASS lint backend/src/tests/CustomSequencer.js
β ESLint (2 ms)
PASS lint src/backend/routes.js
β ESLint (6 ms)
PASS lint src/backend/src/ai/decisionTree.js
β ESLint (3 ms)
PASS lint eggs-generator/src/models/egg.model.js
β ESLint (1 ms)
PASS lint src/backend/tests/apiGenerateEgg.test.js
β ESLint (1 ms)
PASS lint backend/src/src/models/ruleModel.js
β ESLint (2 ms)
PASS lint src/backend/tests/CustomSequencer.js
β ESLint (2 ms)
PASS lint src/backend/tests/apiController.test.js
β ESLint (1 ms)
PASS lint backend/src/src/services/aiService.js
β ESLint (3 ms)
PASS lint src/backend/tests/decisionTree.test.js
β ESLint (1 ms)
PASS lint backend/src/src/controllers/dataController.js
β ESLint (1 ms)
PASS lint ./manualConnectionTest.js
β ESLint (2 ms)
PASS lint src/backend/src/services/aiService.js
β ESLint (1 ms)
PASS lint coverage/lcov-report/block-navigation.js
β ESLint (1 ms)
PASS lint coverage/block-navigation.js
β ESLint (3 ms)
PASS lint dependency-management/coverage/lcov-report/block-navigation.js
β ESLint (2 ms)
PASS lint dependency-management/coverage/block-navigation.js
β ESLint (4 ms)
PASS lint src/backend/tests/testUtils.js
β ESLint (2 ms)
PASS lint backend/src/src/ai/nlpProcessor.js
β ESLint (1 ms)
PASS lint eggs-generator/__tests__/index.test.js
β ESLint (1 ms)
PASS lint backend/src/src/routes/apiRoutes.js
β ESLint (2 ms)
PASS lint src/backend/tests/testSequencer.test.js
β ESLint (2 ms)
PASS lint src/backend/src/ai/nlpProcessor.js
β ESLint (2 ms)
PASS lint dependency-management/src/index.js
β ESLint (1 ms)
PASS lint backend/src/src/ml/modelManager.js
β ESLint (2 ms)
PASS lint backend/src/src/services/rulesEngine.js
β ESLint (3 ms)
PASS lint dependency-management/test.js
β ESLint (1 ms)
PASS lint backend/src/src/services/ruleService.js
β ESLint (1 ms)
PASS lint src/backend/src/ml/modelManager.js
β ESLint (1 ms)
PASS lint src/models/egg.schema.js
β ESLint (1 ms)
PASS lint src/backend/src/controllers/dataController.js
β ESLint (2 ms)
PASS lint src/controllers/eggController.js
β ESLint (1 ms)
PASS lint src/backend/tests/seedDatabase.test.js
β ESLint (2 ms)
PASS lint src/backend/tests/aiService.test.js
β ESLint (1 ms)
PASS lint backend/src/mocks/AiQuery.js
β ESLint (2 ms)
PASS lint src/backend/src/services/rulesEngine.js
β ESLint (1 ms)
PASS lint src/backend/tests/apiRoutes.test.js
β ESLint (3 ms)
PASS lint backend/src/html-report/jest-html-reporters-attach/report/index.js
β ESLint (1 ms)
PASS lint backend/src/src/utils/testSequencer.js
β ESLint (2 ms)
PASS lint language-plugins/javascript/src/index.js
β ESLint (1 ms)
PASS lint eggs-generator/src/generateEgg.js
β ESLint (1 ms)
PASS lint src/backend/html-report/jest-html-reporters-attach/report/index.js
β ESLint
PASS lint backend/src/src/routes/dataRoutes.js
β ESLint (1 ms)
PASS lint eggs-generator/src/db/mongodb.js
β ESLint (1 ms)
PASS lint backend/src/src/services/decisionTreeService.js
β ESLint (1 ms)
PASS lint backend/src/src/models/userModel.js
β ESLint (1 ms)
PASS lint src/middleware/security.js
β ESLint (1 ms)
PASS lint eggs-generator/src/utils/metrics.js
β ESLint (1 ms)
PASS lint backend/src/mocks/database.js
β ESLint (1 ms)
PASS lint backend/src/src/models/AiQuery.js
β ESLint
PASS lint src/middleware/auth.js
β ESLint
PASS lint language-plugins/javascript/tests/index.test.js
β ESLint (2 ms)
PASS lint src/backend/src/utils/testSequencer.js
β ESLint (1 ms)
PASS lint dependency-management/src/dependencyManager.js
β ESLint (1 ms)
PASS lint src/backend/tests/aiTests.test.js
β ESLint (1 ms)
PASS lint src/backend/src/routes/dataRoutes.js
β ESLint (1 ms)
PASS lint backend/src/src/services/seedDatabase.js
β ESLint (1 ms)
PASS lint eggs-generator/src/HenFarm.js
β ESLint (1 ms)
PASS lint backend/src/src/utils/logger.js
β ESLint (1 ms)
PASS lint src/backend/mocks/AiQuery.js
β ESLint (1 ms)
PASS lint language-plugins/javascript/src/JSProcessor.js
β ESLint (1 ms)
PASS lint backend/src/tests/globalTeardown.js
β ESLint (1 ms)
PASS lint backend/src/tests/globalSetup.js
β ESLint (1 ms)
PASS lint src/routes/eggs.js
β ESLint (1 ms)
PASS lint backend/src/src/routes/index.js
β ESLint (1 ms)
PASS lint src/backend/src/models/userModel.js
β ESLint (1 ms)
PASS lint eggs-generator/__mocks__/HenFarm.js
β ESLint (1 ms)
PASS lint eggs-generator/deploy/deploy.js
β ESLint
PASS lint src/backend/tests/bleu.test.js
β ESLint
PASS lint eggs-generator/src/middleware/errorHandler.js
β ESLint
PASS lint src/backend/swagger.js
β ESLint (3 ms)
PASS lint src/backend/src/services/seedDatabase.js
β ESLint (1 ms)
PASS lint src/backend/src/models/AiQuery.js
β ESLint
PASS lint backend/src/src/routes/simpleRoute.js
β ESLint (2 ms)
PASS lint eggs-generator/test-db.js
β ESLint (1 ms)
PASS lint ./generateRuleId.js
β ESLint (2 ms)
PASS lint eggs-generator/src/middleware/validation.js
β ESLint (1 ms)
PASS lint eggs-generator/ecosystem.config.js
β ESLint (1 ms)
PASS lint ./vite.config.js
β ESLint (1 ms)
PASS lint src/backend/tests/globalTeardown.js
β ESLint (1 ms)
PASS lint src/backend/src/utils/logger.js
β ESLint (1 ms)
PASS lint code-quality-assurance/tests/index.test.js
β ESLint (2 ms)
PASS lint src/backend/tests/globalSetup.js
β ESLint (1 ms)
PASS lint backend/src/src/services/mockEngine.js
β ESLint (1 ms)
PASS lint scripts/preinstall.js
β ESLint (2 ms)
PASS lint ./preinstall.js
β ESLint (1 ms)
PASS lint src/backend/tests/setup.js
β ESLint
PASS lint src/backend/src/utils/lib/Bleu.js
β ESLint
PASS lint backend/ecosystem.config.js
β ESLint (1 ms)
PASS lint backend/src/tests/setupTests.js
β ESLint (1 ms)
PASS lint src/backend/tests/setupTests.js
β ESLint (1 ms)
PASS lint src/backend/src/services/mockEngine.js
β ESLint (1 ms)
PASS lint ./jestSequencer.js
β ESLint (1 ms)
PASS lint code-quality-assurance/src/index.js
β ESLint (1 ms)
PASS lint src/backend/src/routes/simpleRoute.js
β ESLint (1 ms)
PASS lint src/backend/src/routes/index.js
β ESLint (2 ms)
PASS lint ./eslint.config.js
β ESLint (1 ms)
PASS lint eggs-generator/src/utils/asyncHandler.js
β ESLint (1 ms)
PASS lint dependency-management/jest.setup.js
β ESLint (4 ms)
PASS lint src/backend/src/routes/metricsRoutes.js
β ESLint (2 ms)
PASS lint src/backend/src/routes/healthRoutes.js
β ESLint (1 ms)
PASS lint eggs-generator/src/validators/egg.validator.js
β ESLint (1 ms)
PASS lint eggs-generator/src/middleware/metrics.js
β ESLint (1 ms)
PASS lint eggs-generator/asyncHandler.js
β ESLint (1 ms)
-------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
dist | 0 | 0 | 0 | 0 |
routes.js | 0 | 0 | 0 | 0 | 5-914
swagger.js | 0 | 100 | 100 | 0 | 4-23
dist/utils | 0 | 0 | 0 | 0 |
logger.js | 0 | 100 | 0 | 0 | 5-10
testSequencer.js | 0 | 0 | 0 | 0 | 5-725
dist/utils/lib | 0 | 0 | 0 | 0 |
Bleu.js | 0 | 0 | 0 | 0 | 5-78
-------------------|---------|----------|---------|---------|-------------------
Test Suites: 6 skipped, 170 passed, 170 of 176 total
Tests: 216 passed, 216 total
Snapshots: 0 total
Time: 3.419 s, estimated 6 s
Ran all test suites in 2 projects.
π¦ report is created on: /Users/pejmanhaghighatnia/Bleu.js/reports/test-report.html
** jest-stare --reporters: wrote output report to ./reports/jest-stare/index.html **
optimizeCode Method:
The optimizeCode method is designed to optimize the provided code. While currently a placeholder, this method will implement advanced code optimization techniques to enhance performance and efficiency.
- Placeholder for code optimization logic.
- Returns the optimized code.
optimizeCode(code) {
const optimizedCode = code.replace(/\s+/g, ' ').trim();
return optimizedCode;
}
ensureCodeQuality Method:
The ensureCodeQuality method will ensure that the provided code meets predefined quality standards. This placeholder will incorporate code analysis tools and techniques to validate the code's quality.
- Placeholder for code quality assurance logic.
- Returns a boolean indicating whether the code meets quality standards.
ensureCodeQuality(code) {
const isQualityCode = true;
return isQualityCode;
}
This document provides detailed information about the API endpoints available in the Bleu.js application, including the recent updates and improvements made to the API.
(On Linux, use xdg-open index.html, or open it manually on Windows.)
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---|---|---|---|---|---|
All files | 95.0 | 92.5 | 93.0 | 94.0 | |
src/utils | 100.0 | 85.0 | 100.0 | 100.0 | |
backend/services | 90.0 | 95.0 | 88.0 | 91.0 | 45, 67 |
------------------- | --------- | ---------- | --------- | --------- | ------------------- |
Test Report Overview
Hereβs a snapshot of the latest test suite execution for the Bleu.js framework. Our commitment to quality ensures a robust and reliable experience for developers.
Summary
Metric | Value |
---|---|
Test Suites Total | 98 |
Tests Total | 97 |
Failed Suites | 0 |
Failed Tests | 0 |
Pending Suites | 1 |
Pending Tests | 0 |
Test Coverage | 100% |
Execution Details
Key Metrics | Value |
---|---|
Start Time | 2025-01-23 11:45:41 |
Total Execution Time | 00:05.928 seconds |
Max Workers Utilized | 7 |
Framework Version | 1.0.29 |
Detailed Execution
Bleu.js ensures all test cases pass successfully, delivering a seamless experience for developers. Below are key highlights from the executed suite:
ποΈ Top-Level Files
File | Exec Time (s) | Status |
---|---|---|
/src/backend/tests/setup.ts | 00:00.015 | β Passed |
/src/backend/tests/aiTests.test.js | 00:00.003 | β Passed |
/output/jest-html-reporters-attach/... | 00:01.462 | β Passed |
/coverage/prettify.js | 00:00.012 | β Passed |
Backend Highlights
File | Exec Time (s) | Status |
---|---|---|
/src/backend/src/controllers/... | 00:00.007 | β Passed |
/src/backend/src/utils/lib/Bleu.js | 00:00.002 | β Passed |
/src/backend/tests/apiRoutes.test.js | 00:00.002 | β Passed |
/src/backend/src/services/decision... | 00:00.001 | β Passed |
Core Engine Highlights
File | Exec Time (s) | Status |
---|---|---|
/core-engine/src/BleuX.js | 00:00.001 | β Passed |
/core-engine/src/index.js | 00:00.003 | β Passed |
Swagger Documentation:
* @swagger
* /debug:
* post:
* summary: Debug logic
* tags: [Debug]
* responses:
* 200:
* description: Debugging
* content:
* application/json:
* schema:
* type: string
* example: Debugging
*/
router.post('/debug', (req, res) => {
res.send('Debugging');
});
POST /optimize
Handles optimization logic.
- URL: /optimize
- Method: POST
- Response:
`"Optimizing"`;
Swagger Documentation:
/**
* @swagger
* /optimize:
* post:
* summary: Optimize logic
* tags: [Optimization]
* responses:
* 200:
* description: Optimizing
* content:
* application/json:
* schema:
* type: string
* example: Optimizing
*/
router.post('/optimize', (req, res) => {
res.send('Optimizing');
});
POST /generate
Handles generation logic.
- URL: /generate
- Method: POST
- Response:
`"Generating"`;
Swagger Documentation:
/**
* @swagger
* /generate:
* post:
* summary: Generate logic
* tags: [Generation]
* responses:
* 200:
* description: Generating
* content:
* application/json:
* schema:
* type: string
* example: Generating
*/
router.post('/generate', (req, res) => {
res.send('Generating');
});
API Documentation
The API documentation is available at http://localhost:3003/docs
and provides detailed information about all available endpoints, request parameters, and response structures.
Here is an example of how Swagger documentation is added for an endpoint in the backend/server.js file:
/**
* @swagger
* /:
* get:
* summary: Returns a greeting message
* responses:
* 200:
* description: A JSON object containing a greeting message
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* example: Hello, World!
*/
app.get('/', (req, res) => {
res.status(200).json({ message: 'Hello, World!' });
});
Security
The API supports bearer token authentication for secure endpoints. The security schema is defined as follows:
const swaggerDefinition = {
openapi: '3.0.0',
info: {
title: 'Bleu.js API',
version: '1.0.0',
description: 'Documentation for the Bleu.js API',
},
servers: [
{
url: 'http://localhost:3003',
},
],
components: {
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT',
},
},
},
security: [
{
bearerAuth: [],
},
],
};
License
Bleu.js is licensed under the MIT License
This software is maintained by Helloblue, Inc., a company dedicated to advanced innovations in AI solutions.
Author
Pejman Haghighatnia
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
9 months ago
10 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
11 months ago
12 months ago
1 year ago
1 year ago