lybic-guiagents 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lybic-guiagents might be problematic. Click here for more details.

gui_agents/__init__.py CHANGED
@@ -37,7 +37,7 @@ from .agents.hardware_interface import HardwareInterface
37
37
  from .store.registry import Registry
38
38
  from .agents.global_state import GlobalState
39
39
 
40
- __version__ = "0.3.0"
40
+ __version__ = "0.4.0"
41
41
 
42
42
  # Primary exports (what users should typically use)
43
43
  __all__ = [
@@ -172,8 +172,6 @@ class AgentS2(UIAgent):
172
172
  else:
173
173
  print(f"Found local knowledge base path: {kb_platform_path}")
174
174
 
175
- self.reset()
176
-
177
175
  def reset(self) -> None:
178
176
  """
179
177
  Reinitialize core components and reset the agent's runtime state.
@@ -219,12 +217,18 @@ class AgentS2(UIAgent):
219
217
  self.subtasks: List[Node] = []
220
218
  self.search_query: str = ""
221
219
  self.subtask_status: str = "Start"
222
- self.global_state: GlobalState = Registry.get("GlobalStateStore") # type: ignore
220
+ # Use task-specific registry if task_id is available, otherwise fall back to global registry
221
+ if self.task_id:
222
+ self.global_state: GlobalState = Registry.get_from_context("GlobalStateStore", self.task_id) # type: ignore
223
+ else:
224
+ self.global_state: GlobalState = Registry.get("GlobalStateStore") # type: ignore
223
225
 
224
226
  # Pass task_id to components
225
- if self.task_id:
226
- self.manager.task_id = self.task_id
227
- self.worker.task_id = self.task_id
227
+ self.manager.set_task_id(self.task_id)
228
+ self.worker.set_task_id(self.task_id)
229
+ # Grounding doesn't have task_id in normal mode, but we set it if available
230
+ if hasattr(self, 'grounding') and hasattr(self.grounding, 'set_task_id'):
231
+ self.grounding.set_task_id(self.task_id)
228
232
 
229
233
  def set_task_id(self, task_id: str) -> None:
230
234
  """
@@ -236,9 +240,9 @@ class AgentS2(UIAgent):
236
240
  self.task_id = task_id
237
241
  # Also set task_id for components if they exist
238
242
  if hasattr(self, 'manager') and self.manager:
239
- self.manager.task_id = task_id
243
+ self.manager.set_task_id(task_id)
240
244
  if hasattr(self, 'worker') and self.worker:
241
- self.worker.task_id = task_id
245
+ self.worker.set_task_id(task_id)
242
246
 
243
247
  def reset_executor_state(self) -> None:
244
248
  """Reset executor and step counter"""
@@ -733,8 +737,6 @@ class AgentSFast(UIAgent):
733
737
  else:
734
738
  print(f"Found local knowledge base path: {kb_platform_path}")
735
739
 
736
- self.reset()
737
-
738
740
  def reset(self) -> None:
739
741
  """
740
742
  Reinitialize the fast-agent components and reset internal runtime state.
@@ -816,19 +818,25 @@ class AgentSFast(UIAgent):
816
818
  # Reset state variables
817
819
  self.step_count: int = 0
818
820
  self.turn_count: int = 0
819
- self.global_state: GlobalState = Registry.get("GlobalStateStore") # type: ignore
821
+ # Use task-specific registry if task_id is available, otherwise fall back to global registry
822
+ if self.task_id:
823
+ self.global_state: GlobalState = Registry.get_from_context("GlobalStateStore", self.task_id) # type: ignore
824
+ else:
825
+ self.global_state: GlobalState = Registry.get("GlobalStateStore") # type: ignore
820
826
  self.latest_action = None
821
827
 
822
- # Pass task_id to tools if available
823
- if self.task_id:
824
- self.fast_action_generator.task_id = self.task_id
825
- if self.enable_reflection and hasattr(self, 'reflection_agent'):
826
- self.reflection_agent.task_id = self.task_id
828
+ # Pass task_id to tools and components if available
829
+ self.fast_action_generator.task_id = self.task_id
830
+ if self.enable_reflection and hasattr(self, 'reflection_agent'):
831
+ self.reflection_agent.task_id = self.task_id
832
+ # Set task_id for grounding component
833
+ if hasattr(self, 'grounding') and hasattr(self.grounding, 'set_task_id'):
834
+ self.grounding.set_task_id(self.task_id)
827
835
 
828
836
  def set_task_id(self, task_id: str) -> None:
829
837
  """
830
838
  Store the task identifier on the agent and propagate it to subcomponents that use it.
831
-
839
+
832
840
  Parameters:
833
841
  task_id (str): Identifier for the active task; assigned to this agent and, if present, to
834
842
  `fast_action_generator` and `reflection_agent`.
@@ -839,6 +847,9 @@ class AgentSFast(UIAgent):
839
847
  self.fast_action_generator.task_id = task_id
840
848
  if hasattr(self, 'reflection_agent') and self.reflection_agent:
841
849
  self.reflection_agent.task_id = task_id
850
+ # Set task_id for grounding component
851
+ if hasattr(self, 'grounding') and hasattr(self.grounding, 'set_task_id'):
852
+ self.grounding.set_task_id(task_id)
842
853
 
843
854
  def predict(self, instruction: str, observation: Dict) -> Tuple[Dict, List[str]]:
844
855
  """
@@ -92,8 +92,13 @@ class Grounding(ACI):
92
92
  self.text_span_agent = Tools()
93
93
  _register(self.text_span_agent, "text_span")
94
94
 
95
- self.global_state: GlobalState = Registry.get(
96
- "GlobalStateStore") # type: ignore
95
+ # GlobalState will be initialized when task_id is set
96
+ self.global_state: GlobalState = None # type: ignore
97
+
98
+ def set_task_id(self, task_id: str) -> None:
99
+ """Set the task identifier and update global state reference"""
100
+ # Update global state reference with task-specific registry
101
+ self.global_state = Registry.get_from_context("GlobalStateStore", task_id) # type: ignore
97
102
 
98
103
  def generate_coords(self, ref_expr: str, obs: Dict) -> List[int]:
99
104
  grounding_start_time = time.time()
@@ -453,8 +458,13 @@ class FastGrounding(ACI):
453
458
  self.height = height
454
459
  self.grounding_width = grounding_width
455
460
  self.grounding_height = grounding_height
456
- self.global_state: GlobalState = Registry.get(
457
- "GlobalStateStore") # type: ignore
461
+ # GlobalState will be initialized when task_id is set
462
+ self.global_state: GlobalState = None # type: ignore
463
+
464
+ def set_task_id(self, task_id: str) -> None:
465
+ """Set the task identifier and update global state reference"""
466
+ # Update global state reference with task-specific registry
467
+ self.global_state = Registry.get_from_context("GlobalStateStore", task_id) # type: ignore
458
468
 
459
469
  def reset_screen_size(self, width: int, height: int):
460
470
  self.width = width
@@ -102,7 +102,8 @@ class Manager:
102
102
  Tools_dict=KB_Tools_dict,
103
103
  )
104
104
 
105
- self.global_state: GlobalState = Registry.get("GlobalStateStore") # type: ignore
105
+ # GlobalState will be initialized in reset() method when task_id is available
106
+ self.global_state: GlobalState = None # type: ignore
106
107
 
107
108
  self.planner_history = []
108
109
 
@@ -118,6 +119,12 @@ class Manager:
118
119
 
119
120
  self.multi_round = multi_round
120
121
 
122
+ def set_task_id(self, task_id: str) -> None:
123
+ """Set the task identifier and update global state reference"""
124
+ self.task_id = task_id
125
+ # Update global state reference with task-specific registry
126
+ self.global_state = Registry.get_from_context("GlobalStateStore", task_id) # type: ignore
127
+
121
128
  def _send_stream_message(self, task_id: str, stage: str, message: str) -> None:
122
129
  """
123
130
  Enqueue a stream message for the given task if a task ID is provided.
@@ -67,8 +67,8 @@ class Worker:
67
67
 
68
68
  self.enable_reflection = enable_reflection
69
69
  self.use_subtask_experience = use_subtask_experience
70
- self.global_state: GlobalState = Registry.get(
71
- "GlobalStateStore") # type: ignore
70
+ # GlobalState will be initialized in reset() method when task_id is available
71
+ self.global_state: GlobalState = None # type: ignore
72
72
  self.reset()
73
73
 
74
74
  def reset(self):
@@ -159,6 +159,12 @@ class Worker:
159
159
  self.max_trajector_length = 8
160
160
  self.task_id = None # Will be set by agent
161
161
 
162
+ def set_task_id(self, task_id: str) -> None:
163
+ """Set the task identifier and update global state reference"""
164
+ self.task_id = task_id
165
+ # Update global state reference with task-specific registry
166
+ self.global_state = Registry.get_from_context("GlobalStateStore", task_id) # type: ignore
167
+
162
168
  def generate_next_action(
163
169
  self,
164
170
  Tu: str,