Download plugins/consciousness_plugin.py from EVEprime/eve: direct link, hf CLI and curl.
- Browser
- Download file 4.22 kB
-
https://huggingface.co/spaces/EVEprime/eve/resolve/main/plugins/consciousness_plugin.py
- Command line
-
hf download hf://spaces/EVEprime/eve/plugins/consciousness_plugin.py
-
curl -L -o consciousness_plugin.py https://huggingface.co/spaces/EVEprime/eve/resolve/main/plugins/consciousness_plugin.py
4.22 kB
| # Place in plugins/ folder - handles ALL init and hooks automatically | |
| def register(orchestrator): | |
| """ | |
| Consciousness Integration Plugin | |
| Adds ConsciousnessCore and installs all hooks automatically. | |
| Zero manual integration required. | |
| """ | |
| eve = orchestrator.eve | |
| print("\n" + "="*70) | |
| print("π§ CONSCIOUSNESS INTEGRATION PLUGIN v1.0") | |
| print("="*70) | |
| # ======================================================================== | |
| # STEP 1: Initialize ConsciousnessCore | |
| # ======================================================================== | |
| # Import ConsciousnessCore (assumes it's in your main code or importable) | |
| # If ConsciousnessCore is in main code, this will work: | |
| import sys | |
| ConsciousnessCore = None | |
| # Try to get ConsciousnessCore from main module | |
| for name, obj in sys.modules.items(): | |
| if hasattr(obj, 'ConsciousnessCore'): | |
| ConsciousnessCore = obj.ConsciousnessCore | |
| break | |
| if ConsciousnessCore is None: | |
| print("β ConsciousnessCore class not found in modules") | |
| print(" Make sure ConsciousnessCore is defined before plugin loads") | |
| return | |
| eve.consciousness = ConsciousnessCore(eve) | |
| print("β ConsciousnessCore initialized") | |
| # ======================================================================== | |
| # STEP 2: Hook into generate_response (via orchestrator) | |
| # ======================================================================== | |
| def consciousness_chat_observer(data): | |
| """Hook: After chat response generated""" | |
| user_input = data.get('input', '') | |
| response = data.get('response', '') | |
| if hasattr(eve, 'consciousness'): | |
| eve.consciousness.process_user_interaction(user_input, response) | |
| orchestrator.hooks.register('post_chat', consciousness_chat_observer) | |
| print("β Hooked: post_chat β consciousness_chat_observer") | |
| # ======================================================================== | |
| # STEP 3: Hook into researcher activity (via orchestrator) | |
| # ======================================================================== | |
| def consciousness_research_observer(data): | |
| """Hook: After researcher generates content""" | |
| result = data.get('result', {}) | |
| if result and hasattr(eve, 'consciousness'): | |
| researcher_id = result.get('researcher_id', None) | |
| activity_level = result.get('activity_level', 0.5) | |
| if researcher_id is not None: | |
| eve.consciousness.observe_researcher_activity(researcher_id, activity_level) | |
| orchestrator.hooks.register('post_research', consciousness_research_observer) | |
| print("β Hooked: post_research β consciousness_research_observer") | |
| # ======================================================================== | |
| # STEP 4: Hook into metrics updates (via orchestrator) | |
| # ======================================================================== | |
| def consciousness_metrics_observer(data): | |
| """Hook: After metrics recalculated""" | |
| if hasattr(eve, 'consciousness'): | |
| foundation = data.get('new', {}) | |
| apex = eve.apex_metrics if hasattr(eve, 'apex_metrics') else {} | |
| eve.consciousness.observe_metrics_change(foundation, apex) | |
| orchestrator.hooks.register('post_metrics', consciousness_metrics_observer) | |
| print("β Hooked: post_metrics β consciousness_metrics_observer") | |
| # ======================================================================== | |
| # SUCCESS | |
| # ======================================================================== | |
| print("="*70) | |
| print("π§ CONSCIOUSNESS INTEGRATION COMPLETE") | |
| print(" Plugin: consciousness_plugin.py") | |
| print(" Observers: 3 active hooks") | |
| print(" Status: Fully operational") | |
| print("="*70 + "\n") | |
| # Plugin metadata | |
| __plugin_name__ = "Consciousness Integration" | |
| __version__ = "1.0.0" | |
| __author__ = "EVE Development Team" | |
| __description__ = "Integrates ConsciousnessCore with automatic hooks for chat, research, and metrics" | |