diff --git a/layers/AgentModelLayer.py b/layers/AgentModelLayer.py index 37d8e7a..5f128e2 100644 --- a/layers/AgentModelLayer.py +++ b/layers/AgentModelLayer.py @@ -1,5 +1,6 @@ from .CognitiveLayer import CognitiveLayer from resource_manager import CurrencyResource +import time class AgentModelLayer(CognitiveLayer): """ @@ -75,4 +76,15 @@ def update_capabilities(self): def learn(self): """This method could be used to incorporate new knowledge into the agent's belief system.""" - pass \ No newline at end of file + pass + + def main_loop(self): + """Basic execution loop for the layer.""" + while True: + try: + self.process_input("loop") + self.execute() + except Exception as e: + self.logger.error(f"Main loop error: {e}") + break + time.sleep(0.1) diff --git a/layers/AspirationalLayer.py b/layers/AspirationalLayer.py index a5fc9d9..bff2bcf 100644 --- a/layers/AspirationalLayer.py +++ b/layers/AspirationalLayer.py @@ -1,6 +1,7 @@ from .CognitiveLayer import CognitiveLayer from resource_manager import CurrencyResource from capability_manager import EthicalDecisionMakingCapability +import time class AspirationalLayer(CognitiveLayer): """ @@ -75,4 +76,15 @@ def align_with_values(self): def assess_ethics(self): """This method could be used to evaluate the ethical implications of a proposed action or decision.""" - pass \ No newline at end of file + pass + + def main_loop(self): + """Basic execution loop for the layer.""" + while True: + try: + self.process_input("loop") + self.execute() + except Exception as e: + self.logger.error(f"Main loop error: {e}") + break + time.sleep(0.1) diff --git a/layers/CognitiveControlLayer.py b/layers/CognitiveControlLayer.py index d7b4bf4..7f21a98 100644 --- a/layers/CognitiveControlLayer.py +++ b/layers/CognitiveControlLayer.py @@ -1,5 +1,6 @@ from .CognitiveLayer import CognitiveLayer from resource_manager import CurrencyResource +import time class CognitiveControlLayer(CognitiveLayer): @@ -76,3 +77,15 @@ def handle_frustration(self): """This method could be used to implement strategies for managing frustration, such as switching tasks or seeking help.""" pass + + def main_loop(self): + """Basic execution loop for the layer.""" + while True: + try: + self.process_input("loop") + self.execute() + except Exception as e: + self.logger.error(f"Main loop error: {e}") + break + time.sleep(0.1) + diff --git a/layers/ExecutiveFunctionLayer.py b/layers/ExecutiveFunctionLayer.py index e7c3ec4..17dd579 100644 --- a/layers/ExecutiveFunctionLayer.py +++ b/layers/ExecutiveFunctionLayer.py @@ -1,6 +1,7 @@ from .CognitiveLayer import CognitiveLayer from resource_manager import CurrencyResource import capability_manager +import time class ExecutiveFunctionLayer(CognitiveLayer): """ @@ -78,4 +79,15 @@ def allocate_resources(self): def forecast(self): """This method could be used to make predictions about future events or states, which can then be used in planning.""" - pass \ No newline at end of file + pass + + def main_loop(self): + """Basic execution loop for the layer.""" + while True: + try: + self.process_input("loop") + self.execute() + except Exception as e: + self.logger.error(f"Main loop error: {e}") + break + time.sleep(0.1) diff --git a/layers/GlobalStrategyLayer.py b/layers/GlobalStrategyLayer.py index 04ec3ab..ccd16cf 100644 --- a/layers/GlobalStrategyLayer.py +++ b/layers/GlobalStrategyLayer.py @@ -1,5 +1,6 @@ from .CognitiveLayer import CognitiveLayer from resource_manager import CurrencyResource +import time class GlobalStrategyLayer(CognitiveLayer): """ @@ -73,4 +74,15 @@ def update_goals(self): def assess_global_context(self): """This method could be used to evaluate the current global context and modify the strategy accordingly.""" - pass \ No newline at end of file + pass + + def main_loop(self): + """Basic execution loop for the layer.""" + while True: + try: + self.process_input("loop") + self.execute() + except Exception as e: + self.logger.error(f"Main loop error: {e}") + break + time.sleep(0.1) diff --git a/layers/TaskProsecutionLayer.py b/layers/TaskProsecutionLayer.py index 45d0410..747ec94 100644 --- a/layers/TaskProsecutionLayer.py +++ b/layers/TaskProsecutionLayer.py @@ -1,5 +1,6 @@ from .CognitiveLayer import CognitiveLayer from resource_manager.built_in_resources import CurrencyResource +import time class TaskProsecutionLayer(CognitiveLayer): @@ -71,3 +72,15 @@ def handle_failure(self): def handle_success(self): pass + + def main_loop(self): + """Basic execution loop for the layer.""" + while True: + try: + self.process_input("loop") + self.execute() + except Exception as e: + self.logger.error(f"Main loop error: {e}") + break + time.sleep(0.1) + diff --git a/orchestration/CognitiveArchitecture.py b/orchestration/CognitiveArchitecture.py index 2fdf4ab..53d5038 100644 --- a/orchestration/CognitiveArchitecture.py +++ b/orchestration/CognitiveArchitecture.py @@ -92,8 +92,8 @@ def _check_thread_status(self): Check the status of all threads. """ # Method to aid debug by checking on status of all threads - for key, thread in self.threads: - print(f'{key}: running={thread.running()}, done={thread.done()}') + for key, thread in self.threads.items(): + print(f"{key}: alive={thread.is_alive()}") def start_execution(self): """ diff --git a/orchestration/__init__.py b/orchestration/__init__.py index 9e662d8..45bb437 100644 --- a/orchestration/__init__.py +++ b/orchestration/__init__.py @@ -1,2 +1,7 @@ from .CognitiveArchitecture import CognitiveArchitecture -from .LayerHierarchy import LayerHierarchy \ No newline at end of file +from .LayerHierarchy import LayerHierarchy + +__all__ = [ + "CognitiveArchitecture", + "LayerHierarchy", +]