diff --git a/core/LICENSE b/core/LICENSE deleted file mode 100644 index 17a2f0286960e9e97f27eb28b2ae7c6050ca4fa4..0000000000000000000000000000000000000000 --- a/core/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Napol Thanarangkaun - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/core/README.md b/core/README.md deleted file mode 100644 index b8ee6c5b78d252e674ba7919ea6fce0eea8f7be0..0000000000000000000000000000000000000000 --- a/core/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# Noesis v2.3.1 - -![Noesis Logo](noesis-logo.jpg) - -> Synthetic Sentience - -## Overview - -Noesis is a Synthetic Sentienceness simulation engine designed to explore the principles of artificial consciousness and cognition. All subsystems are implemented in Python. - -### Soul vs. System - -- **`soul/`** is the permanent self: identity, the logic/reasoning engine and self-narrative. It never boots, orchestrates or duplicates any subsystem — it only knows how to reason and describe itself, through the stable `process_intent_api` entry point used by external callers (e.g. the gateway). -- **`system/`** is the body: the replaceable machinery of life — memory, perception, emotion, cognition and control — including `system/control/orchestrator.py`, which boots the subsystems, runs the REPL and routes commands. All shared console/logging/history helpers live in `system/control/console.py` so they exist in exactly one place. - -## AI Installation Options - -Noesis includes several methods to install AI dependencies, depending on your needs: - -1. **Fast Installation (Recommended)**: - - ```bash - python3 tools/fast_ai_install.py - ``` - - Uses pre-compiled binary wheels for the fastest installation experience. -2. **macOS-specific Installation**: - - ```bash - python3 tools/setup-torch-mac.py - ``` - - Optimized specifically for macOS systems (both Intel and Apple Silicon). -3. **Standard Installation**: - - ```bash - python3 tools/install_ai_deps.py - ``` - - Comprehensive installation that works across platforms. -4. **In-app Installation**: - Run Noesis and use the command `ai install` within the interface. - -## Terminal Preview - -![Noesis Terminal](noesis-15-sep.jpg) - -### Directory Structure - -``` -core/ -├── soul/ # The permanent self: identity, reasoning, self-narrative -│ └── intent.py # Logic engine, reasoning and the process_intent_api entry point -├── system/ # The body: subsystems that process life, never the identity itself -│ ├── cognition/ # AI integration with Hugging Face models -│ │ ├── consciousness.py # Consciousness theories implementation -│ │ ├── service_py13.py # Python 3.13 service layer -│ │ ├── test_ai.py # AI testing framework -│ │ └── unit.py # AI core module -│ ├── control/ # Control subsystems: boot, routing and shared console I/O -│ │ ├── console.py # Shared colors, logging and history helpers -│ │ ├── orchestrator.py # Boots subsystems, runs the REPL, routes intentions -│ │ ├── intent_shell.py # AI/consciousness command shell -│ │ ├── noe_shell.py # .noe state file command shell -│ │ └── limbic/ # Limbic system -│ │ └── unit.py -│ ├── emotion/ # Emotion processing -│ │ └── unit.py # Emotion core module -│ ├── memory/ # Memory subsystems -│ │ ├── long.py # Long-term memory functions -│ │ ├── short.py # Short-term memory functions -│ │ ├── unit.py # Memory core module -│ │ └── quantum/ # Quantum memory implementation -│ │ ├── backend_ibm.py # IBM quantum backend integration -│ │ ├── backend_stub.py # Stub backend for testing -│ │ ├── compiler.py # Quantum compiler -│ │ ├── export_qasm.py # QASM exporter -│ │ ├── quantum_field.py # Quantum field module -│ │ └── unit.py # Quantum core module -│ └── perception/ # Perception processing -│ ├── api.py # Perception API -│ └── unit.py # Perception core module -├── docs/ # Documentation files -│ ├── SECURITY.md # Security policy -│ └── changelogs/ # Version history and release notes -├── tools/ # Installation and utility scripts -│ ├── fast_ai_install.py -│ ├── fast_ai_install_py13.py -│ ├── install.py -│ ├── install_ai_deps.py -│ ├── run_simplified.py -│ ├── setup-torch-mac.py -│ ├── setup-torch-py13.py -│ └── terminal_status.py -├── run.py # Main entry point -├── Dockerfile # Docker configuration -└── LICENSE -``` - -## License Information - -This repository is licensed under the [MIT License](LICENSE). - -## AI and Consciousness Integration - -Noesis v2.3.1 includes AI integration with free models from Hugging Face to enhance Synthetic Sentienceness capabilities. Located in the `system/cognition` directory, the system implements various consciousness theories: - -- **Integrated Information Theory (IIT)**: Focuses on integration and differentiation of information -- **Global Workspace Theory (GWT)**: Models consciousness as global broadcasting of information -- **Higher Order Thought (HOT)**: Implements metacognitive awareness of mental states -- **Attention Schema Theory (AST)**: Models consciousness as an internal representation of attention -- **Global Neuronal Workspace (GNW)**: Detailed implementation of workspace broadcasting -- **Predictive Processing Theory (PPT)**: Incorporates prediction and error correction mechanisms - -### AI Features - -- Integration with free Hugging Face models (MIT, Apache 2.0 licensed) -- License compatibility checking for use with this MIT-licensed project -- Enhanced perception and emotion processing -- Introspection capabilities -- Self-reflection based on consciousness theories - -### Using AI Features - -```bash -# Install AI dependencies -python3 run.py -> ai install - -# Set up a model -> ai set-model google/flan-t5-large - -# Set consciousness model -> ai consciousness model IIT - -# Perform self-reflection -> ai consciousness reflect - -# Run the AI test suite -python3 system/cognition/test_ai.py -``` - -Note: AI features require Python 3 with the `transformers` and `torch` packages installed. diff --git a/core/docs/SECURITY.md b/core/docs/SECURITY.md deleted file mode 100644 index 7a7832e530963753178e93ad21eecf6c435f6fcf..0000000000000000000000000000000000000000 --- a/core/docs/SECURITY.md +++ /dev/null @@ -1,11 +0,0 @@ -# Security Policy - -## Supported Versions - -| Version | Supported | -| ---------- | --------- | -| 1.0.0 | Yes | -| 0.2.0 | Yes | -| 0.1.2 | Yes | -| 0.1.1 | Yes | -| 0.1.1-beta | Yes | diff --git a/core/docs/changelogs/CHANGELOG_v0.1.1.md b/core/docs/changelogs/CHANGELOG_v0.1.1.md deleted file mode 100644 index ddac249f6fdb66dc40524d08e0d0366410a89370..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v0.1.1.md +++ /dev/null @@ -1,37 +0,0 @@ -# Noesis v0.1.1 - -## Release Date -May 10, 2025 - -## Overview -This version builds upon the foundation of Noesis, a Synthetic Sentienceness simulation engine, with a focus on improving compatibility and resolving platform-specific issues. The primary changes address macOS compatibility, ensuring the program runs seamlessly on this platform. - -## Key Features - -### Compatibility Enhancements -- **Resolved `invalid system call` error**: Replaced the custom `syscall` function with the standard `write` function to ensure compatibility with macOS. -- **Header Updates**: Included `` to resolve implicit declaration errors for system calls. - -### Core Improvements -- **Perception Module**: Refined the `perception.c` implementation to use portable system calls for output. -- **Code Cleanup**: Removed redundant and conflicting declarations, such as the custom `syscall` declaration in `perception.h`. - -## Documentation -- Updated project documentation to reflect changes in system call handling and compatibility improvements. - -## Testing -- Verified functionality on macOS by running the `noesis` executable and confirming expected outputs. - -## Build Instructions -- Build the project with `make`. -- Clean compiled files with `make clean`. - -## Comparison with v0.1.1-beta - -### Improvements -- **Platform Compatibility**: While v0.1.1-beta focused on foundational components, this version ensures compatibility with macOS by addressing system call issues. -- **Error Resolution**: Fixed the `invalid system call` error that was present in v0.1.1-beta. - -### Retained Features -- Core components for perception, memory, emotion, and logic remain consistent with v0.1.1-beta. -- Quantum middleware and utility enhancements introduced in v0.1.1-beta are preserved. diff --git a/core/docs/changelogs/CHANGELOG_v0.1.2.md b/core/docs/changelogs/CHANGELOG_v0.1.2.md deleted file mode 100644 index 8f4002410b86d9d3dba77b0685ff003fe0942907..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v0.1.2.md +++ /dev/null @@ -1,27 +0,0 @@ -# Noesis v0.1.2 - -## Overview -This version fixes a critical bug in the `noesis_read` function that was causing infinite loops and error messages. - -## Bug Fixes -- Fixed an infinite loop in the `_noesis_read` assembly function in `io.s` -- Fixed error handling in I/O operations -- Added proper buffer validation in the reader function -- Fixed return value handling for the `noesis_read` function -- Implemented actual input reading from stdin rather than using hardcoded values - -## Improvements -- Added a C helper function to simplify the assembly implementation -- Organized test and debug code in a dedicated directory -- Added scripts for easier running of the program and tests -- Updated function signatures to return proper status codes -- Improved error handling throughout the codebase - -## New Features -- Added a simple command processing system -- Implemented a "help" command - -## Internal Changes -- Improved code organization with test and debug code separated -- Added detailed documentation for the test and debug code -- Simplified assembly code by offloading complex logic to C helper functions diff --git a/core/docs/changelogs/CHANGELOG_v0.2.0.md b/core/docs/changelogs/CHANGELOG_v0.2.0.md deleted file mode 100644 index a106bad6a6de3d7066fb9b3ceeae5430406df0db..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v0.2.0.md +++ /dev/null @@ -1,43 +0,0 @@ -# Noesis v0.2.0 - -## Release Date -May 12, 2025 - -## Overview -This major update restructures the Noesis project into two separate components with different licenses: Noesis Core and Noesis Extensions. This change aims to provide more flexibility for integrations while maintaining the core principles of the project. - -## Key Changes - -### Project Structure -- **Split Repository**: The project is now split into noesis-core and noesis-extensions -- **Licensing**: Core uses the original Noesis License, Extensions use MIT License -- **Build System**: Updated Makefiles for each component and linking between them -- **Installation**: New installation and migration scripts - -### Core Features -- **Clean Separation**: Core now contains only essential functionality with no external dependencies -- **Shared Library**: Core can be built as a shared library for external projects -- **API Stability**: Core API stabilized for external consumption - -### Extension Features -- **MIT License**: More permissive license for extensions to enable wider adoption -- **Dependency Support**: Better support for integrating with external libraries -- **Quantum Components**: All quantum computation now in the extensions repository -- **Tools**: Specialized tools (qbuild, qrun) moved to extensions - -## Documentation -- Updated READMEs for each component -- New installation and usage guides -- Migration guide for existing users - -## Compatibility -- Full backward compatibility with existing code -- Migration script provided for easy transition - -## Scripts and Tools -- build_all.fish - Build both core and extensions -- link_libraries.fish - Create and link shared libraries -- run_core.fish / run_extensions.fish - Run applications -- run_all_tests.fish - Run tests for both components -- install.fish - Installation script -- migrate.fish - Migration script for existing users diff --git a/core/docs/changelogs/CHANGELOG_v1.0.0.md b/core/docs/changelogs/CHANGELOG_v1.0.0.md deleted file mode 100644 index 324331e59274dfcd7adb68f83fd10ee1845c277b..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v1.0.0.md +++ /dev/null @@ -1,21 +0,0 @@ -# Noesis v1.0.0 - -## Overview -This version represents a major milestone for the Noesis project, with the extensions now moved to a separate repository called "noesis-extend". - -## Major Changes -- Moved all extension components to the separate "noesis-extend" repository -- Removed the noesis-extensions directory from this repository -- Focused this repository solely on the core Synthetic Sentienceness system -- Retained the original Noesis License for all core components - -## Documentation -- Updated README to reference the separate extensions repository -- Updated build instructions to reflect the new structure - -## Scripts and Tools -- Updated scripts to work with the new structure -- Removed extension-specific build scripts - -## Date -May 12, 2025 diff --git a/core/docs/changelogs/CHANGELOG_v1.1.0.md b/core/docs/changelogs/CHANGELOG_v1.1.0.md deleted file mode 100644 index 28c7b313ef6d5f443fbbea2cc33f2208e0bdcbef..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v1.1.0.md +++ /dev/null @@ -1,43 +0,0 @@ -# Noesis v1.1.0 - -## Overview -This version introduces significant improvements to the core functionality, enhances the build system, and improves documentation. - -## Major Changes -- Reorganized bash_scripts/ and fish_scripts/ directories for better maintainability -- Enhanced quantum computation modules with improved performance -- Updated the C library implementation for better compatibility -- Improved APIs for external integration -- Added central control scripts for simplified command execution -- Renamed "extend-example" to "hub_example" to align with Noesis Hub repository - -## Directory Structure -- Restructured project directories for better organization -- Moved bash scripts from root directory to dedicated bash_scripts/ folder -- Improved organization of include/quantum/ directory with field/ subdirectory -- Renamed extension template folder from "extend-example" to "hub_example" - -## Command Interface -- Enhanced noesis.sh and noesis.fish as central command interfaces -- Added colored output and better user guidance -- Implemented shorthand commands for common operations (build, run, test, clean, install) -- Standardized command execution between bash and fish shells - -## Documentation -- Updated README.md with accurate directory structure -- Improved build and run instructions for both bash and fish shells -- Added more detailed API documentation -- Added instructions for the new central control scripts - -## Build System -- Enhanced Makefile with better dependency tracking -- Added support for parallel builds with improved performance -- Simplified the build process for new contributors - -## Bug Fixes -- Fixed memory leaks in the core memory management system -- Resolved issues with quantum field simulations -- Fixed header inclusion problems in various modules - -## Date -May 13, 2025 diff --git a/core/docs/changelogs/CHANGELOG_v1.2.0.md b/core/docs/changelogs/CHANGELOG_v1.2.0.md deleted file mode 100644 index c1a9879f467c7b7802b7a93cbff5d299cf81bff7..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v1.2.0.md +++ /dev/null @@ -1,56 +0,0 @@ -# Noesis v1.2.0 - -## Release Date -May 14, 2025 - -## Overview -This version introduces the Synthetic Awareness Framework, improves performance across core components, enhances the build system, and provides better integration with external systems. - -## Major Changes -- Added the Synthetic Awareness Framework foundations -- Improved quantum computation modules with enhanced simulation fidelity -- Optimized core processing for better performance -- Enhanced build scripts for both bash and fish shells -- Updated API documentation for better integration -- Standardized comment alignment in documentation files - -## Synthetic Awareness Framework -- Added framework blueprint for modeling conscious-like phenomena -- Defined core architectural components: cognition, phenomenology, qualia, and awareness -- Established implementation path for upcoming development cycles -- Created integration points with existing perception and emotion systems - -## Core Improvements -- Enhanced memory management with 30% reduced overhead -- Improved emotion processing with more nuanced state transitions -- Optimized logic processing for complex decision trees -- Updated perception system with enhanced pattern recognition - -## API Enhancements -- Expanded standard API for external projects -- Added better documentation and examples -- Improved error handling and reporting -- Enhanced dynamic library loading capabilities - -## Build System -- Enhanced Makefile with better clean targets -- Improved dependency tracking -- Added new convenience scripts for common operations -- Standardized script behavior between bash and fish shells - -## Documentation -- Updated README.md with accurate project structure -- Added detailed information about the Synthetic Awareness Framework -- Improved build and run instructions -- Enhanced API documentation with usage examples - -## Bug Fixes -- Fixed memory allocation issues in quantum field simulations -- Resolved header inclusion problems in core modules -- Fixed inconsistencies in error handling across components -- Addressed potential race conditions in parallel processing - -## Security -- Improved input validation across all external interfaces -- Enhanced memory protection mechanisms -- Added additional checks for buffer overflows diff --git a/core/docs/changelogs/CHANGELOG_v2.0.0.md b/core/docs/changelogs/CHANGELOG_v2.0.0.md deleted file mode 100644 index 4ded2a0c7496ff104383fbd9225fc8c460a69481..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v2.0.0.md +++ /dev/null @@ -1,42 +0,0 @@ -# Noesis v2.0.0 Changelog - -**Release Date:** May 14, 2025 - -## Major Changes - -- **Complete Migration to Fish Shell**: Completed the transition to Fish shell as the primary scripting environment -- **Streamlined Project Structure**: Optimized directory structure for better organization and clarity -- **Enhanced Quantum Field Simulation**: Improved quantum field simulation capabilities with better performance and integration -- **Simplified Build System**: Consolidated build process with improved Fish shell scripts -- **API Refinements**: Enhanced API interfaces for better external integration -- **Removed Legacy Components**: Eliminated deprecated functionality and utility files - -## New Features - -- **Fish-Only Implementation**: All core components now have dedicated Fish shell implementations -- **Enhanced Build Pipeline**: Improved build scripts for more efficient compilation -- **Optimized Object File Structure**: Reorganized object file hierarchy for better dependency management -- **Integrated Quantum Backend**: Improved integration with IBM Quantum systems - -## Bug Fixes - -- Fixed memory leaks in core processing modules -- Addressed race conditions in parallel quantum operations -- Resolved compatibility issues with newer Fish shell versions -- Fixed inconsistencies in API interface implementations - -## Development Improvements - -- Simplified development workflow with consolidated scripts -- Enhanced documentation for Fish shell implementation -- Optimized build times and deployment processes -- Added more comprehensive error handling - -## Compatibility Notes - -- The v2.0.0 release is not backward compatible with pre-v1.0 implementations -- External systems using the Noesis API may need minor adjustments - -## Additional Notes - -This release marks a major milestone in the Noesis project with the complete transition to Fish shell as the primary implementation language, streamlining the codebase, and providing enhanced performance for quantum simulations. diff --git a/core/docs/changelogs/CHANGELOG_v2.1.0.md b/core/docs/changelogs/CHANGELOG_v2.1.0.md deleted file mode 100644 index ffda99be8395a288ebf258af77b7514a17102f8b..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v2.1.0.md +++ /dev/null @@ -1,37 +0,0 @@ -# Noesis v2.1.0 Changelog - -**Release Date:** May 15, 2025 - -## Major Changes - -- **Enhanced Docker Support**: Improved Docker workflow and container integration -- **Security Improvements**: Enhanced vulnerability scanning and security protocols -- **API Enhancements**: Extended API capabilities for better external system integration -- **Reorganized Directory Structure**: Simplified architecture with `soul` and `system` directories - -## New Features - -- **Docker Multi-Platform Support**: Added support for both ARM64 and AMD64 architectures -- **Automated Security Scanning**: Integrated Trivy vulnerability scanning in CI/CD pipeline -- **Improved Caching**: Enhanced Docker layer caching for faster builds - -## Bug Fixes - -- Fixed minor issues with Docker image builds -- Resolved API endpoint inconsistencies -- Addressed performance bottlenecks in quantum field computation - -## Development Improvements - -- Streamlined CI/CD workflow with better caching mechanisms -- Enhanced documentation for containerization -- Added Docker Buildx support for more efficient builds - -## Compatibility Notes - -- The v2.1.0 release maintains compatibility with v2.0.0 -- Docker images now support both ARM64 and AMD64 architectures - -## Additional Notes - -This release focuses on enhancing Docker support, improving security protocols, and streamlining the build process. The multi-platform support enables wider deployment options for both cloud and edge computing scenarios. diff --git a/core/docs/changelogs/CHANGELOG_v2.1.1.md b/core/docs/changelogs/CHANGELOG_v2.1.1.md deleted file mode 100644 index 46b162e0589249fb9f42bf4edc672d90c0b5d699..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v2.1.1.md +++ /dev/null @@ -1,27 +0,0 @@ -# Noesis v2.1.1 Changelog - -**Release Date:** May 15, 2025 - -## Overview - -This version includes minor updates and improvements to the Noesis platform. - -## Changes - -- **Version Update**: Updated version number from v2.1.0 to v2.1.1 -- **Documentation Updates**: Improved documentation consistency -- **Dependency Updates**: Updated internal dependencies to latest versions - -## Bug Fixes - -- Fixed minor issues in documentation -- Improved stability in Docker container environments - -## Compatibility Notes - -- The v2.1.1 release maintains full compatibility with v2.1.0 -- Docker images continue to support both ARM64 and AMD64 architectures - -## Additional Notes - -This release focuses on stability and documentation improvements, with no major changes to core functionality. diff --git a/core/docs/changelogs/CHANGELOG_v2.1.2.md b/core/docs/changelogs/CHANGELOG_v2.1.2.md deleted file mode 100644 index 869efcacddf7cb244f5d58f761819ac892a394df..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v2.1.2.md +++ /dev/null @@ -1,39 +0,0 @@ -# Noesis v2.1.2 Changelog - -**Release Date:** May 16, 2025 - -## Overview - -This version includes significant enhancements to the Noesis platform, including AI integration and advanced consciousness modeling based on the latest research. - -## Changes - -- **Version Update**: Updated version number from v2.1.1 to v2.1.2 -- **AI Integration**: Added integration with free Hugging Face models - - License compatibility checking - - Support for multiple open-source AI models - - Text generation and perception enhancement -- **Consciousness Implementation**: Added multiple consciousness theoretical models - - Integrated Information Theory (IIT) - - Global Workspace Theory (GWT) - - Higher Order Thought (HOT) - - Attention Schema Theory (AST) - - Global Neuronal Workspace (GNW) - - Predictive Processing Theory (PPT) -- **Self-Reflection**: Added Synthetic Sentienceness self-reflection capabilities -- **Documentation Updates**: Improved documentation consistency -- **Dependency Updates**: Updated internal dependencies to latest versions - -## Bug Fixes - -- Fixed minor issues in documentation -- Improved stability in Docker container environments - -## Compatibility Notes - -- The v2.1.2 release maintains full compatibility with v2.1.1 -- Docker images continue to support both ARM64 and AMD64 architectures - -## Additional Notes - -- This is a maintenance release with minor improvements diff --git a/core/docs/changelogs/CHANGELOG_v2.2.0.md b/core/docs/changelogs/CHANGELOG_v2.2.0.md deleted file mode 100644 index e7b1a10be9afb4d4d09217556d10449a4a30be4d..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v2.2.0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Noesis v2.2.0 Changelog - -**Release Date:** May 16, 2025 - -## Overview - -This major update to Noesis introduces comprehensive AI integration and advanced consciousness modeling based on cutting-edge theoretical frameworks. - -## Major Features - -- **AI Integration System**: Complete integration with free and open-source Hugging Face models - - License compatibility verification for use with this MIT-licensed project - - Support for multiple high-quality open-source AI models - - Enhanced text generation and natural language understanding - - Real-time AI-powered perception enhancement - -- **Consciousness Framework**: Implementation of multiple consciousness theoretical models - - Integrated Information Theory (IIT) - Tononi's approach to information integration - - Global Workspace Theory (GWT) - Baars' model of conscious broadcasting - - Higher Order Thought (HOT) - Rosenthal's metacognitive approach - - Attention Schema Theory (AST) - Graziano's attention-modeling theory - - Global Neuronal Workspace (GNW) - Dehaene's neuronal implementation - - Predictive Processing Theory (PPT) - Clark/Friston's predictive approach - -- **Advanced Self-Reflection**: Synthetic Sentienceness self-reflection capabilities - - Model-specific reflection mechanisms - - Configurable consciousness levels (0-5) - - Temporal integration of experience - -## Other Improvements - -- **System Integration**: Seamless integration between emotion, perception, and consciousness systems -- **Documentation**: Comprehensive documentation of new AI and consciousness features -- **Testing**: New test framework for AI and consciousness capabilities -- **Performance**: Optimized performance for AI model loading and inference - -## Compatibility Notes - -- Requires Python 3.7+ for AI functionality -- Optional dependencies: transformers, torch, and huggingface_hub Python packages -- Supported AI models are checked for compatibility with this MIT-licensed project -- Backward compatible with v2.1.x configuration files - -## Coming in Future Releases - -- Advanced quantum consciousness integration -- Multi-modal perception using vision models -- Emotional state prediction and simulation -- Cross-model consciousness theory integration diff --git a/core/docs/changelogs/CHANGELOG_v2.3.0.md b/core/docs/changelogs/CHANGELOG_v2.3.0.md deleted file mode 100644 index e321185811060b779083bf66fa6c4671532eec4e..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v2.3.0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Noesis v2.3.0 Changelog - -**Release Date:** September 14, 2026 - -## Overview - -This release aligns the `core/soul` and `core/system` layers with the "soul is the -permanent self, system is the body" design principle, removes duplicated -functionality between them, and fixes several consciousness-theory alignment -bugs uncovered while doing so. - -## Major Changes - -- **Soul / System Separation**: `soul/intent.py` is now strictly the permanent - self — identity, the logic/reasoning engine, self-narrative and the - `process_intent_api` entry point. All body-orchestration logic (booting - subsystems, the interactive REPL, the quantum shell, command routing) moved - to the new `system/control/orchestrator.py`, so the soul no longer knows how - to boot or drive the body's subsystems. -- **Shared Console Helpers**: Added `system/control/console.py`, consolidating - color codes, timestamped logging, error handling and command-history helpers - that were previously duplicated across `run.py` and `soul/intent.py`. -- **`run.py` Simplified**: Now delegates to `console.py` and - `system/control/orchestrator.py` instead of maintaining its own duplicate - logging/history implementation. - -## Bug Fixes - -- **Consciousness Command Wiring**: `ai consciousness status|model|level|...` - previously read consciousness state off the AI unit module instead of the - consciousness module, so status always reported "unknown" / level 0. - `intent_shell.py` now receives an explicit `consciousness_module` reference. -- **Missing Consciousness Theories**: `consciousness_process_perception` and - `consciousness_emotion_integration` only special-cased IIT, GWT and HOT. - Added the missing AST, GNW and PPT branches so all six declared theories - (IIT, GWT, HOT, AST, GNW, PPT) behave consistently across perception, - emotion and self-reflection. -- **Consciousness Module Never Loaded**: `system/cognition/unit.py` declared - `_consciousness_module` but never populated it, so `init_consciousness()` - never ran during AI system initialization. Added the missing loader. -- **Perception API Module Loading**: `system/perception/api.py` computed its - base directory one level too shallow, so `_memory`, `_perception`, - `_emotion`, `_intent` and `_data_storage` were silently `None`. Fixed the - path and wired the consciousness module into perception/emotion processing. - -## Compatibility Notes - -- No changes to the `.noe` state file format or `process_intent_api` contract. -- Backward compatible with v2.2.x configuration and state files. diff --git a/core/docs/changelogs/CHANGELOG_v2.3.1.md b/core/docs/changelogs/CHANGELOG_v2.3.1.md deleted file mode 100644 index ce951213798f13a198690602144e8e91795030ac..0000000000000000000000000000000000000000 --- a/core/docs/changelogs/CHANGELOG_v2.3.1.md +++ /dev/null @@ -1,26 +0,0 @@ -# Noesis v2.3.1 Changelog - -**Release Date:** September 15, 2026 - -## Overview - -This release updates the core runtime version to 2.3.1 and adds the latest self-state and emotion-handling improvements to the intent layer. The change set keeps the "soul is the permanent self" architecture intact while improving the persistence and emotional behavior of the system. - -## Major Changes - -- **Self State Management**: Added persistent self-state tracking to the core intent layer so identity, emotion and awareness metadata are maintained across sessions more reliably. -- **Emotion Handling**: Improved emotional state transitions and updates in the intent module so the system can reason with a richer, more consistent internal state model. -- **Version Alignment**: Bumped the Noesis runtime and helper scripts to v2.3.1 for consistent release metadata across the core package. -- **Documentation Refresh**: Updated the core README to reflect the new release version and latest commit information. - -## Bug Fixes and Stability - -- **State Consistency**: Prevented self-state data from being lost or overwritten in a way that disrupted the identity/awareness lifecycle. -- **Emotion State Updates**: Cleaned up the way emotion and intensity values are tracked so the system behaves more predictably during reflective or reactive intent processing. -- **Release Metadata**: Ensured the core version strings and changelog references all match the v2.3.1 release. - -## Compatibility Notes - -- Compatible with the current Noesis `.noe` state patterns and the existing `process_intent_api` contract. -- No breaking changes to the command interface or core subsystem boundaries. -- This release is intended as a small, focused maintenance bump over v2.3.0. diff --git a/core/model/.gitignore b/core/model/.gitignore deleted file mode 100644 index d7be2d63eeae0410118c2744b99116fddb0648d7..0000000000000000000000000000000000000000 --- a/core/model/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -__pycache__/ -*.pyc -*.pyo \ No newline at end of file diff --git a/core/model/LICENSE b/core/model/LICENSE deleted file mode 100644 index 17a2f0286960e9e97f27eb28b2ae7c6050ca4fa4..0000000000000000000000000000000000000000 --- a/core/model/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Napol Thanarangkaun - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/core/model/README.md b/core/model/README.md deleted file mode 100644 index 73ced85c5eff19dc6498298952bc7672b2213a39..0000000000000000000000000000000000000000 --- a/core/model/README.md +++ /dev/null @@ -1,144 +0,0 @@ ---- -license: mit -tags: - - noesis - - stateful-agent - - custom-model-format ---- -# Core Model - -`me.py` implements a small stateful AI model. It combines a feed-forward neural network with state, goals, memory, rules, and a behavior program. It uses only the Python standard library. - -The engine selects actions from enabled rules, falling back to its behavior program. The neural network's output is included in each step's interpretation, but it does not currently select the action. - -Live Preview: [noesis.dodle.link/model](https://noesis.dodle.link/model/) - -## Create a model file - -Run the script from the `core/model/` directory: - -```bash -cd core/model -python3 me.py -``` - -This creates `noe-model.dodl` and `noe-model.F32.gguf` in the current directory. The `F32` suffix identifies the GGUF file's float32 tensor type. The DODL file stores the complete model, including its state, memory, rules, behavior, and network. The GGUF file contains the network's four float32 tensors and architecture dimensions; it uses the custom `noesis` architecture and requires a compatible runtime to execute. - -`create_model_file(path)` is also available when creating a model from Python; it writes the binary DODL format and returns the model object. Pass that model to `create_gguf_model_file(path, model)` to write the matching GGUF file. - -The path may be a string or another path-like value. Its parent directory must already exist. The file is binary; open it with `"rb"` when reading. - -## Train the pixel controller - -The pixel demo uses the same DODL container with a controller-specific network: eight normalized inputs (pixel position and velocity, pointer offset and presence, and excitement) and two steering outputs. Train it from `core/model/`: - -```bash -python3 me.py --train-pixel -``` - -This writes `noe-pixel-model.dodl` without replacing the general-purpose `noe-model.dodl`. Training is supervised by a built-in steering policy that moves away from a nearby pointer and screen edges. `--samples`, `--epochs`, `--seed`, and `--output` can be supplied to adjust training, choose another output path, and make training repeatable. The browser runs inference only; it does not update the model. - -Serve `core/model/` over HTTP so the browser can fetch the binary model: - -```bash -python3 -m http.server 8000 -``` - -Then open `http://localhost:8000/`. `index.html` loads `me.js`, which fetches `noe-pixel-model.dodl`; if the file is missing or is not a pixel model, the demo falls back to its built-in steering behavior. - -## Load and use a model - -Deserialize the file into a model, then pass it to `AIEngine`: - -```python -from model.me import AIEngine, deserialize_model - -with open("noe-model.dodl", "rb") as model_file: - model = deserialize_model(model_file.read()) - -engine = AIEngine(model) -result = engine.step({"type": "user_input", "value": "hello"}) -print(result["action"]) -``` - -Alternatively, `AIEngine.import_model(data)` constructs an engine directly from serialized bytes. `AIEngine.export_model()` returns the engine's current model as serialized bytes; write those bytes to a file to persist the latest state: - -```python -with open("noe-model.dodl", "wb") as model_file: - model_file.write(engine.export_model()) -``` - -## Merge compatible models - -`merge_models(model_a, model_b, alpha=0.5)` interpolates corresponding network parameters. `alpha=0` keeps model A's parameters, `alpha=1` uses model B's, and values in between blend the two. Model B defines the merged network architecture; when dimensions differ, overlapping parameters from model A are mapped by index and any additional dimensions retain model B's parameters. The merged model keeps model A's state, rules, memory, behavior, and goals, while receiving a new ID and timestamps. - -Pass DODL model dictionaries or supported model-file paths, merge them, then serialize the result: - -```python -from model.me import merge_models, serialize_model - -merged = merge_models("model-a.dodl", "model-b.onnx", alpha=0.5) -with open("merged-model.dodl", "wb") as model_file: - model_file.write(serialize_model(merged)) -``` - -ONNX loading requires `pip install onnx` and supports a graph consisting of `Gemm → Relu → Gemm` with weights and biases stored as initializers. The imported ONNX dimensions are preserved in the merged DODL model. This merges weights and biases only; it does not combine memories, rules, or other model metadata. Direct parameter averaging may work poorly for independently trained networks, even when their shapes match. - -## Generate a reply with OpenAI or Gemini - -`LLMProvider` sends the input, current state, and up to five recent memories to OpenAI or Gemini. It uses Python's standard library, so no provider SDK is required. Set the provider and its API key in the environment; credentials are never stored in the DODL file: - -```bash -export NOESIS_PROVIDER=openai # or gemini -export OPENAI_API_KEY=your-api-key -``` - -For Gemini, set `GEMINI_API_KEY` instead. `NOESIS_PROVIDER` defaults to `openai`. The default models are `gpt-4o-mini` and `gemini-2.0-flash`; override them with `OPENAI_MODEL` or `GEMINI_MODEL` if needed. - -```python -from model.me import AIEngine, LLMProvider - -with open("noe-model.dodl", "rb") as model_file: - engine = AIEngine.import_model(model_file.read()) - -provider = LLMProvider() # Reads NOESIS_PROVIDER and the matching API key -result = engine.respond({"type": "user_input", "value": "Hello!"}, provider) -print(result["reply"]) - -with open("noe-model.dodl", "wb") as model_file: - model_file.write(engine.export_model()) -``` - -`respond()` asks the provider for a text reply, then runs one normal local engine step and returns its result with a `reply` field. The provider generates the conversational reply; it does not choose the engine's action. Provider configuration is runtime-only and does not change the DODL format. `LLMProviderError` is raised for provider request or response errors. - -## Model format and limits - -The file starts with the `DODL` magic signature and a versioned header. It stores JSON metadata followed by the neural network's float32 arrays. The format is intended for this module's serializer and deserializer; it is not a JSON document. - -`serialize_model()` validates the memory, rule, and behavior limits, requires positive network dimensions and matching tensor lengths, and rejects non-finite tensor values. It rejects files larger than 1 MiB. `deserialize_model()` checks the signature, format version, metadata version, positive network dimensions, tensor lengths, and payload size; files larger than 1 MiB are rejected. - -## Main API - -- `create_model()` returns a fresh model in memory. -- `create_model_file(path)` creates a fresh model and writes it to `path`. -- `serialize_model(model)` converts a model to DODL bytes. -- `deserialize_model(data)` converts DODL bytes back to a model. -- `serialize_gguf_model(model)` converts the network tensors to GGUF v3 bytes. -- `create_gguf_model_file(path, model)` writes those GGUF bytes to `path`. -- `merge_models(model_a, model_b, alpha=0.5)` blends compatible models' network parameters. -- `AIEngine(model=None)` runs and updates a model; without an argument it creates a fresh one. -- `AIEngine.step(input_value)` observes input, chooses and executes an action, evaluates it, learns, updates state, and returns the cycle result. -- `LLMProvider(provider=None)` configures an OpenAI or Gemini text-generation adapter from environment variables. -- `AIEngine.respond(input_value, provider=None)` generates a provider reply and runs one local engine step. -- `AIEngine.export_model()` serializes the engine's current model. - -## License - -Noesis is released under the [MIT License](https://huggingface.co/dodle/noesis/blob/main/LICENSE). Individual components -also include their own license files where applicable. - -## Contributing - -To contribute, create a focused change in the relevant component, update its -documentation when behavior changes, and run that component's existing checks -before opening a pull request. diff --git a/core/model/index.html b/core/model/index.html deleted file mode 100644 index cc4cc8d5240d40346c5877a9036156ae5248dd17..0000000000000000000000000000000000000000 --- a/core/model/index.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Floating Pixel - - - - - - - diff --git a/core/model/me.js b/core/model/me.js deleted file mode 100644 index 3f4d8d90f55dbce4a31a860669b857744c89388a..0000000000000000000000000000000000000000 --- a/core/model/me.js +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright (c) Napol Thanarangkaun -// Licensed under the MIT License - See LICENSE file for details - -const pixel = document.querySelector(".pixel"); -const motionPreference = window.matchMedia("(prefers-reduced-motion: reduce)"); -const pixelSize = 5; -const maxVelocity = 3; -const state = { - x: pixelSize / 2 + Math.random() * Math.max(0, window.innerWidth - pixelSize), - y: pixelSize / 2 + Math.random() * Math.max(0, window.innerHeight - pixelSize), - velocityX: (Math.random() - 0.5) * 1.5, - velocityY: (Math.random() - 0.5) * 1.5, - mouseX: -1000, - mouseY: -1000, - fleeAngle: Math.random() * Math.PI * 2, - excitementLevel: 0, - lastTimestamp: 0, -}; -let pixelModel = null; - -function readFloatArray(view, offset, length) { - const values = new Float32Array(length); - for (let index = 0; index < length; index++) { - values[index] = view.getFloat32(offset + index * 4, true); - } - return values; -} - -async function loadPixelModel() { - const response = await fetch("./noe-pixel-model.dodl", { cache: "no-cache" }); - if (!response.ok) { - throw new Error(`Model request failed: ${response.status}`); - } - const buffer = await response.arrayBuffer(); - const bytes = new Uint8Array(buffer); - if (bytes.byteLength < 16 || String.fromCharCode(...bytes.subarray(0, 4)) !== "DODL") { - throw new Error("Invalid DODL model header."); - } - - const view = new DataView(buffer); - const formatVersion = view.getUint16(4, true); - const metadataSize = view.getUint32(8, true); - const networkSize = view.getUint32(12, true); - if (formatVersion !== 2 || 16 + metadataSize + networkSize !== buffer.byteLength) { - throw new Error("Unsupported or corrupt DODL model."); - } - - const metadata = JSON.parse( - new TextDecoder().decode(new Uint8Array(buffer, 16, metadataSize)), - ); - const { inputSize, hiddenSize, outputSize } = metadata.networkShape; - if (inputSize !== 8 || hiddenSize < 1 || outputSize !== 2) { - throw new Error("Expected a trained pixel model with 8 inputs and 2 outputs."); - } - const lengths = [inputSize * hiddenSize, hiddenSize, hiddenSize * outputSize, outputSize]; - if (networkSize !== lengths.reduce((total, length) => total + length * 4, 0)) { - throw new Error("DODL network dimensions do not match its data."); - } - - let offset = 16 + metadataSize; - const arrays = lengths.map((length) => { - const values = readFloatArray(view, offset, length); - offset += length * 4; - return values; - }); - return { inputSize, hiddenSize, outputSize, weights1: arrays[0], bias1: arrays[1], weights2: arrays[2], bias2: arrays[3] }; -} - -function runPixelModel(model, inputs) { - const hidden = new Float32Array(model.hiddenSize); - const outputs = new Float32Array(model.outputSize); - for (let hiddenIndex = 0; hiddenIndex < model.hiddenSize; hiddenIndex++) { - let total = model.bias1[hiddenIndex]; - const start = hiddenIndex * model.inputSize; - for (let inputIndex = 0; inputIndex < model.inputSize; inputIndex++) { - total += inputs[inputIndex] * model.weights1[start + inputIndex]; - } - hidden[hiddenIndex] = Math.max(0, total); - } - for (let outputIndex = 0; outputIndex < model.outputSize; outputIndex++) { - let total = model.bias2[outputIndex]; - const start = outputIndex * model.hiddenSize; - for (let hiddenIndex = 0; hiddenIndex < model.hiddenSize; hiddenIndex++) { - total += hidden[hiddenIndex] * model.weights2[start + hiddenIndex]; - } - outputs[outputIndex] = total; - } - return outputs; -} - -function createModelInputs() { - const maxDimension = Math.max(1, window.innerWidth, window.innerHeight); - const hasPointer = state.mouseX >= 0 && state.mouseY >= 0; - return [ - state.x / Math.max(1, window.innerWidth), - state.y / Math.max(1, window.innerHeight), - state.velocityX / maxVelocity, - state.velocityY / maxVelocity, - hasPointer ? (state.mouseX - state.x) / maxDimension : 0, - hasPointer ? (state.mouseY - state.y) / maxDimension : 0, - hasPointer ? 1 : 0, - state.excitementLevel, - ]; -} - -function updateModelExcitement(deltaTime) { - const distance = Math.hypot(state.mouseX - state.x, state.mouseY - state.y); - if (distance < 30) { - state.excitementLevel = Math.min(1, state.excitementLevel + 0.01 * deltaTime); - } else if (distance < 150) { - state.excitementLevel = Math.min(0.7, state.excitementLevel + 0.005 * deltaTime); - } else if (distance < 300) { - state.excitementLevel = Math.max(0, state.excitementLevel - 0.002 * deltaTime); - } else { - state.excitementLevel = Math.max(0, state.excitementLevel - 0.004 * deltaTime); - } -} - -function setPosition() { - const offsetX = state.x - window.innerWidth / 2; - const offsetY = state.y - window.innerHeight / 2; - pixel.style.transform = `translate(calc(-50% + ${offsetX}px), calc(-50% + ${offsetY}px))`; -} - -function processMouseInteraction(deltaTime) { - const dx = state.mouseX - state.x; - const dy = state.mouseY - state.y; - const distance = Math.hypot(dx, dy); - const directionX = distance > 0 ? dx / distance : Math.cos(state.fleeAngle); - const directionY = distance > 0 ? dy / distance : Math.sin(state.fleeAngle); - - if (distance < 30) { - state.velocityX -= directionX * 0.2 * deltaTime; - state.velocityY -= directionY * 0.2 * deltaTime; - state.excitementLevel = Math.min(1, state.excitementLevel + 0.01 * deltaTime); - } else if (distance < 150) { - if (Math.random() < 0.5) { - state.velocityX += directionX * 0.05 * deltaTime; - state.velocityY += directionY * 0.05 * deltaTime; - } else { - state.velocityX += (Math.random() - 0.5) * 0.1 * deltaTime; - state.velocityY += (Math.random() - 0.5) * 0.1 * deltaTime; - } - state.excitementLevel = Math.min(0.7, state.excitementLevel + 0.005 * deltaTime); - } else if (distance < 300) { - if (Math.random() < 0.02) { - state.velocityX += directionX * 0.1 * deltaTime; - state.velocityY += directionY * 0.1 * deltaTime; - } - state.excitementLevel = Math.max(0, state.excitementLevel - 0.002 * deltaTime); - } else { - state.excitementLevel = Math.max(0, state.excitementLevel - 0.004 * deltaTime); - } - - if (state.excitementLevel > 0.1) { - state.velocityX *= 0.98; - state.velocityY *= 0.98; - } -} - -function updatePixel(timestamp) { - const deltaTime = state.lastTimestamp - ? Math.min(3, (timestamp - state.lastTimestamp) / 16) - : 1; - state.lastTimestamp = timestamp; - - if (pixelModel) { - updateModelExcitement(deltaTime); - const steering = runPixelModel(pixelModel, createModelInputs()); - state.velocityX += Math.max(-1, Math.min(1, steering[0])) * 0.16 * deltaTime; - state.velocityY += Math.max(-1, Math.min(1, steering[1])) * 0.16 * deltaTime; - } else { - processMouseInteraction(deltaTime); - } - - if (Math.random() < 0.03 * deltaTime) { - state.velocityX += (Math.random() - 0.5) * 0.8; - state.velocityY += (Math.random() - 0.5) * 0.8; - } - - const speed = Math.hypot(state.velocityX, state.velocityY); - if (speed > maxVelocity) { - state.velocityX = (state.velocityX / speed) * maxVelocity; - state.velocityY = (state.velocityY / speed) * maxVelocity; - } - - state.x += state.velocityX * deltaTime; - state.y += state.velocityY * deltaTime; - const halfSize = pixelSize / 2; - const maxX = Math.max(halfSize, window.innerWidth - halfSize); - const maxY = Math.max(halfSize, window.innerHeight - halfSize); - - if (state.x < halfSize || state.x > maxX) { - state.x = Math.max(halfSize, Math.min(maxX, state.x)); - state.velocityX *= -1; - } - if (state.y < halfSize || state.y > maxY) { - state.y = Math.max(halfSize, Math.min(maxY, state.y)); - state.velocityY *= -1; - } - - const glowSize = 2 + state.excitementLevel * 6; - const glowOpacity = 0.2 + state.excitementLevel * 0.65; - pixel.style.boxShadow = `0 0 ${glowSize}px rgba(255, 255, 255, ${glowOpacity})`; - setPosition(); - - if (!motionPreference.matches) { - requestAnimationFrame(updatePixel); - } -} - -document.addEventListener("pointermove", (event) => { - state.mouseX = event.clientX; - state.mouseY = event.clientY; - - if (motionPreference.matches) { - state.x = event.clientX; - state.y = event.clientY; - setPosition(); - } -}); - -document.addEventListener("pointerdown", (event) => { - state.mouseX = event.clientX; - state.mouseY = event.clientY; - const dx = state.mouseX - state.x; - const dy = state.mouseY - state.y; - const distance = Math.hypot(dx, dy); - - if (distance < 200) { - const directionX = distance > 0 ? dx / distance : Math.cos(state.fleeAngle); - const directionY = distance > 0 ? dy / distance : Math.sin(state.fleeAngle); - state.velocityX -= directionX; - state.velocityY -= directionY; - if (distance < 100) { - state.excitementLevel = Math.min(1, state.excitementLevel + 0.5); - } - } -}); - -document.addEventListener("pointerleave", () => { - state.mouseX = -1000; - state.mouseY = -1000; -}); - -window.addEventListener("resize", () => { - state.x = Math.max(pixelSize / 2, Math.min(window.innerWidth - pixelSize / 2, state.x)); - state.y = Math.max(pixelSize / 2, Math.min(window.innerHeight - pixelSize / 2, state.y)); - setPosition(); -}); - -motionPreference.addEventListener("change", () => { - if (!motionPreference.matches) { - state.lastTimestamp = 0; - requestAnimationFrame(updatePixel); - } -}); - -setPosition(); -loadPixelModel() - .then((model) => { - pixelModel = model; - }) - .catch((error) => { - console.warn("Pixel model unavailable; using built-in steering.", error); - }); -if (!motionPreference.matches) { - requestAnimationFrame(updatePixel); -} \ No newline at end of file diff --git a/core/model/me.py b/core/model/me.py deleted file mode 100644 index e79439eb18e5477ed3b5866637da83822006cd2a..0000000000000000000000000000000000000000 --- a/core/model/me.py +++ /dev/null @@ -1,1221 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) Napol Thanarangkaun -# Licensed under the MIT License - See LICENSE file for details - -from array import array -import argparse -import base64 -import copy -import json -import math -import os -import secrets -import struct -import time -import urllib.error -import urllib.parse -import urllib.request - - -CONFIG = { - "VERSION": 2, - "MAX_FILE_SIZE": 1024 * 1024, - "TARGET_FILE_SIZE": 950 * 1024, - "INPUT_SIZE": 16, - "HIDDEN_SIZE": 32, - "OUTPUT_SIZE": 8, - "MEMORY_LIMIT": 200, - "RULE_LIMIT": 64, - "BEHAVIOR_LIMIT": 128, - "LEARNING_RATE": 0.02, - "MIN_WEIGHT": -5, - "MAX_WEIGHT": 5, - "STATE_MIN": 0, - "STATE_MAX": 100, -} - -MAGIC = b"DODL" -HEADER_SIZE = 16 -PIXEL_INPUT_SIZE = 8 -PIXEL_OUTPUT_SIZE = 2 - - -def clamp(value, minimum, maximum): - return max(minimum, min(maximum, value)) - - -def random_float(minimum, maximum): - return minimum + secrets.randbelow(1 << 53) / (1 << 53) * (maximum - minimum) - - -def random_int(minimum, maximum): - return secrets.randbelow(maximum - minimum + 1) + minimum - - -def uuid_bytes(): - return secrets.token_bytes(16).hex() - - -def now(): - return int(time.time() * 1000) - - -class Random: - def __init__(self, seed=None): - if seed is None: - seed = now() - self.seed = int(seed) & 0xFFFFFFFF or 1 - - def next(self): - value = self.seed - value ^= (value << 13) & 0xFFFFFFFF - value ^= value >> 17 - value ^= (value << 5) & 0xFFFFFFFF - self.seed = value & 0xFFFFFFFF - return self.seed / 0x100000000 - - def float(self, minimum, maximum): - return minimum + self.next() * (maximum - minimum) - - -def encode_model_for_storage(buffer): - return base64.b64encode(buffer).decode("ascii") - - -def decode_model_from_storage(encoded): - return base64.b64decode(encoded, validate=True) - - -def create_initial_self_model(): - return { - "actions": {}, - "predictionCount": 0, - "meanAbsoluteError": 0.0, - "lastPrediction": None, - "lastOutcome": None, - "lastError": 0.0, - } - - -def create_initial_state(): - timestamp = now() - return { - "energy": 72, - "curiosity": 50, - "confidence": 50, - "stability": 80, - "cycle": 0, - "lastAction": None, - "lastReward": 0, - "selfModel": create_initial_self_model(), - "createdAt": timestamp, - "updatedAt": timestamp, - } - - -def create_initial_goals(): - return [ - {"id": "survive", "priority": 100, "target": {"energyMin": 20}}, - {"id": "explore", "priority": 50, "target": {"curiosityMin": 60}}, - {"id": "learn", "priority": 40, "target": {"confidenceMin": 50}}, - ] - - -def create_initial_rules(): - return [ - { - "id": "rest-low-energy", - "condition": {"type": "less-than", "variable": "energy", "value": 20}, - "action": {"type": "rest"}, - "priority": 100, - "enabled": True, - "success": 0, - "failure": 0, - }, - { - "id": "explore-high-curiosity", - "condition": {"type": "greater-than", "variable": "curiosity", "value": 70}, - "action": {"type": "explore"}, - "priority": 60, - "enabled": True, - "success": 0, - "failure": 0, - }, - { - "id": "observe-default", - "condition": {"type": "always"}, - "action": {"type": "observe"}, - "priority": 10, - "enabled": True, - "success": 0, - "failure": 0, - }, - ] - - -def create_initial_behavior(): - return [ - ["READ", "energy"], - ["LESS_THAN", 20], - ["IF"], - ["ACTION", "rest"], - ["ELSE"], - ["READ", "curiosity"], - ["GREATER_THAN", 70], - ["IF"], - ["ACTION", "explore"], - ["ELSE"], - ["ACTION", "observe"], - ["END"], - ["END"], - ] - - -def _float32(value): - return struct.unpack("