neuro-simulator 0.4.0__py3-none-any.whl → 0.4.1__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.
@@ -69,10 +69,22 @@ class MemoryManager:
69
69
  async def _save_init_memory(self):
70
70
  with open(self.init_memory_file, 'w', encoding='utf-8') as f:
71
71
  json.dump(self.init_memory, f, ensure_ascii=False, indent=2)
72
-
73
- async def update_init_memory(self, new_memory: Dict[str, Any]):
74
- self.init_memory.update(new_memory)
72
+
73
+ async def replace_init_memory(self, new_memory: Dict[str, Any]):
74
+ """Replaces the entire init memory with a new object."""
75
+ self.init_memory = new_memory
76
+ await self._save_init_memory()
77
+
78
+ async def update_init_memory_item(self, key: str, value: Any):
79
+ """Updates or adds a single key-value pair in init memory."""
80
+ self.init_memory[key] = value
75
81
  await self._save_init_memory()
82
+
83
+ async def delete_init_memory_key(self, key: str):
84
+ """Deletes a key from init memory."""
85
+ if key in self.init_memory:
86
+ del self.init_memory[key]
87
+ await self._save_init_memory()
76
88
 
77
89
  async def _save_core_memory(self):
78
90
  with open(self.core_memory_file, 'w', encoding='utf-8') as f:
@@ -93,6 +105,13 @@ class MemoryManager:
93
105
  if len(self.temp_memory) > 20:
94
106
  self.temp_memory = self.temp_memory[-20:]
95
107
  await self._save_temp_memory()
108
+
109
+ async def delete_temp_memory_item(self, item_id: str):
110
+ """Deletes an item from temp memory by its ID."""
111
+ initial_len = len(self.temp_memory)
112
+ self.temp_memory = [item for item in self.temp_memory if item.get("id") != item_id]
113
+ if len(self.temp_memory) < initial_len:
114
+ await self._save_temp_memory()
96
115
 
97
116
  async def get_core_memory_blocks(self) -> Dict[str, Any]:
98
117
  return self.core_memory.get("blocks", {})
@@ -341,6 +341,10 @@ async def handle_admin_ws_message(websocket: WebSocket, data: dict):
341
341
  blocks = await agent.get_memory_blocks()
342
342
  response["payload"] = blocks
343
343
 
344
+ elif action == "get_core_memory_block":
345
+ block = await agent.get_memory_block(**payload)
346
+ response["payload"] = block
347
+
344
348
  elif action == "create_core_memory_block":
345
349
  block_id = await agent.create_memory_block(**payload)
346
350
  response["payload"] = {"status": "success", "block_id": block_id}
@@ -373,6 +377,12 @@ async def handle_admin_ws_message(websocket: WebSocket, data: dict):
373
377
  updated_temp_mem = await agent.get_temp_memory()
374
378
  await connection_manager.broadcast_to_admins({"type": "temp_memory_updated", "payload": updated_temp_mem})
375
379
 
380
+ elif action == "delete_temp_memory_item":
381
+ await agent.delete_temp_memory_item(**payload)
382
+ response["payload"] = {"status": "success"}
383
+ updated_temp_mem = await agent.get_temp_memory()
384
+ await connection_manager.broadcast_to_admins({"type": "temp_memory_updated", "payload": updated_temp_mem})
385
+
376
386
  elif action == "clear_temp_memory":
377
387
  await agent.clear_temp_memory()
378
388
  response["payload"] = {"status": "success"}
@@ -390,6 +400,18 @@ async def handle_admin_ws_message(websocket: WebSocket, data: dict):
390
400
  updated_init_mem = await agent.get_init_memory()
391
401
  await connection_manager.broadcast_to_admins({"type": "init_memory_updated", "payload": updated_init_mem})
392
402
 
403
+ elif action == "update_init_memory_item":
404
+ await agent.update_init_memory_item(**payload)
405
+ response["payload"] = {"status": "success"}
406
+ updated_init_mem = await agent.get_init_memory()
407
+ await connection_manager.broadcast_to_admins({"type": "init_memory_updated", "payload": updated_init_mem})
408
+
409
+ elif action == "delete_init_memory_key":
410
+ await agent.delete_init_memory_key(**payload)
411
+ response["payload"] = {"status": "success"}
412
+ updated_init_mem = await agent.get_init_memory()
413
+ await connection_manager.broadcast_to_admins({"type": "init_memory_updated", "payload": updated_init_mem})
414
+
393
415
  # Tool Actions
394
416
  elif action == "get_all_tools":
395
417
  agent_instance = getattr(agent, 'agent_instance', agent)
@@ -66,7 +66,17 @@ class BuiltinAgentWrapper(BaseAgent):
66
66
  return self.agent_instance.memory_manager.init_memory
67
67
 
68
68
  async def update_init_memory(self, memory: Dict[str, Any]):
69
- await self.agent_instance.memory_manager.update_init_memory(memory)
69
+ await self.agent_instance.memory_manager.replace_init_memory(memory)
70
+ updated_init_mem = await self.get_init_memory()
71
+ await connection_manager.broadcast_to_admins({"type": "init_memory_updated", "payload": updated_init_mem})
72
+
73
+ async def update_init_memory_item(self, key: str, value: Any):
74
+ await self.agent_instance.memory_manager.update_init_memory_item(key, value)
75
+ updated_init_mem = await self.get_init_memory()
76
+ await connection_manager.broadcast_to_admins({"type": "init_memory_updated", "payload": updated_init_mem})
77
+
78
+ async def delete_init_memory_key(self, key: str):
79
+ await self.agent_instance.memory_manager.delete_init_memory_key(key)
70
80
  updated_init_mem = await self.get_init_memory()
71
81
  await connection_manager.broadcast_to_admins({"type": "init_memory_updated", "payload": updated_init_mem})
72
82
 
@@ -79,6 +89,11 @@ class BuiltinAgentWrapper(BaseAgent):
79
89
  updated_temp_mem = await self.get_temp_memory()
80
90
  await connection_manager.broadcast_to_admins({"type": "temp_memory_updated", "payload": updated_temp_mem})
81
91
 
92
+ async def delete_temp_memory_item(self, item_id: str):
93
+ await self.agent_instance.memory_manager.delete_temp_memory_item(item_id)
94
+ updated_temp_mem = await self.get_temp_memory()
95
+ await connection_manager.broadcast_to_admins({"type": "temp_memory_updated", "payload": updated_temp_mem})
96
+
82
97
  async def clear_temp_memory(self):
83
98
  await self.agent_instance.memory_manager.reset_temp_memory()
84
99
  updated_temp_mem = await self.get_temp_memory()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuro_simulator
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Neuro Simulator Server
5
5
  Author-email: Moha-Master <hongkongreporter@outlook.com>
6
6
  License-Expression: MIT
@@ -6,7 +6,7 @@ neuro_simulator/agent/llm.py,sha256=xPBEXpZ19WOt7YkERNaY9rscNI-ePASTjIt-_sZV7UI,
6
6
  neuro_simulator/agent/memory_prompt.txt,sha256=wdpdnbOYhMKgPJnnGlcSejGdt2uItrXzDgz9_8cKnqw,824
7
7
  neuro_simulator/agent/neuro_prompt.txt,sha256=WSN5Fa6AwVnJaSFhz98fQTb2EtQ35U6w2qga_C-s1Go,1438
8
8
  neuro_simulator/agent/memory/__init__.py,sha256=YJ7cynQJI6kD7vjyv3rKc-CZqmoYSuGQtRZl_XdGEps,39
9
- neuro_simulator/agent/memory/manager.py,sha256=tnwxxAlpS0wEd0jfX2MG9hnyAcuhUiZOIP7mz9LCPh8,5388
9
+ neuro_simulator/agent/memory/manager.py,sha256=R9OsPTt8lXsc2Z95lYRJCmKAOghOtHARzpOtqOnU_Wg,6214
10
10
  neuro_simulator/agent/tools/__init__.py,sha256=1WZy6PADfi6o1avyy1y-ThWBFAPJ_bBqtkobyYpf5ao,38
11
11
  neuro_simulator/agent/tools/add_temp_memory.py,sha256=R6K-iVMD6ykd7pS3uI811dZIkuuAf7nPn9c6xCzqiHc,2127
12
12
  neuro_simulator/agent/tools/add_to_core_memory_block.py,sha256=dt7y3w-qr379gS79mdata9w3hHG45wxdVIDXPnROO1Y,2306
@@ -24,13 +24,13 @@ neuro_simulator/api/system.py,sha256=OJT6m6HIYATMCAKrgeBRhficaiUjIDl9f-WyUT-RoBw
24
24
  neuro_simulator/core/__init__.py,sha256=-ojq25c8XA0CU25b0OxcGjH4IWFEDHR-HXSRSZIuKe8,57
25
25
  neuro_simulator/core/agent_factory.py,sha256=p3IKT6sNzSpUojQjvbZJu0pbmyyb258sGn_YNSJlqwI,1717
26
26
  neuro_simulator/core/agent_interface.py,sha256=ZXUCtkQUvsBQ5iCb0gTILJaShn5KmSrEgKhd7PK18HE,2794
27
- neuro_simulator/core/application.py,sha256=oJUuKW3U8Uadr1IlzZThef8CgNoW1zncW_U94OFOUPQ,25518
27
+ neuro_simulator/core/application.py,sha256=mW5SlqonSn5oQvb5xuGR8FTZ_-sEx3OUTXwfC_N_-2c,26703
28
28
  neuro_simulator/core/config.py,sha256=QRbkm0h_FBTtYd-z5RRauSa1B0cp0LkNHVLqGBOBTYY,15324
29
29
  neuro_simulator/core/path_manager.py,sha256=hfjI4s8-WXlgwvPWDSLYMQ2d0OaXPOMYWWlP5xe5NLg,2954
30
30
  neuro_simulator/services/__init__.py,sha256=s3ZrAHg5TpJakadAAGY1h0wDw_xqN4Je4aJwJyRBmk4,61
31
31
  neuro_simulator/services/audience.py,sha256=sAmvkz1ip1MNqaw7t-9abqfnmp0yh8EdG5bS5KYR-Us,4999
32
32
  neuro_simulator/services/audio.py,sha256=EElBue80njZY8_CKQhVtZEcGchJUdmS4EDOvJEEu_LY,2909
33
- neuro_simulator/services/builtin.py,sha256=NrdQhf4BuB8_evxnz8m6wiY9DgLwhY3l7Yp5TnmHGYo,5156
33
+ neuro_simulator/services/builtin.py,sha256=7b5F2StGX2ZT1jMiAAuqov0mx5OMHvUYheo8E1c9fjQ,6097
34
34
  neuro_simulator/services/letta.py,sha256=OEM4qYeRRPoj8qY645YZwCHmMfg1McLp0eTbSAu3KL0,11976
35
35
  neuro_simulator/services/stream.py,sha256=eueAaxhAwX_n0mT1W0W4YOVCe7fH5uPoMdRf2o0wQMI,5937
36
36
  neuro_simulator/utils/__init__.py,sha256=xSEFzjT827W81mNyQ_DLtr00TgFlttqfFgpz9pSxFXQ,58
@@ -39,8 +39,8 @@ neuro_simulator/utils/process.py,sha256=9OYWx8fzaJZqmFUcjQX37AnBhl7YWvrLxDWBa30v
39
39
  neuro_simulator/utils/queue.py,sha256=bg-mIFF8ycClwmmfcKSPjAXtvjImzTKf6z7xZc2VX20,2196
40
40
  neuro_simulator/utils/state.py,sha256=DdBqSAYfjOFtJfB1hEGhYPh32r1ZvFuVlN_-29_-luA,664
41
41
  neuro_simulator/utils/websocket.py,sha256=fjC-qipzjgM_e7XImP12DFmLhvxkMOSr2GnUWws7esE,2058
42
- neuro_simulator-0.4.0.dist-info/METADATA,sha256=n3zf_b6P5veJQ-VPxlqlCsxCfZXTd2-loTHn6XB4N3w,8643
43
- neuro_simulator-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
44
- neuro_simulator-0.4.0.dist-info/entry_points.txt,sha256=qVd5ypnRRgU8Cw7rWfZ7o0OXyS9P9hgY-cRoN_mgz9g,51
45
- neuro_simulator-0.4.0.dist-info/top_level.txt,sha256=V8awSKpcrFnjJDiJxSfy7jtOrnuE2BgAR9hLmfMDWK8,16
46
- neuro_simulator-0.4.0.dist-info/RECORD,,
42
+ neuro_simulator-0.4.1.dist-info/METADATA,sha256=CGD8xcQwXRwCPdWX7jsgI0jVNeUNev2S0uQZv7D8Qwk,8643
43
+ neuro_simulator-0.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
44
+ neuro_simulator-0.4.1.dist-info/entry_points.txt,sha256=qVd5ypnRRgU8Cw7rWfZ7o0OXyS9P9hgY-cRoN_mgz9g,51
45
+ neuro_simulator-0.4.1.dist-info/top_level.txt,sha256=V8awSKpcrFnjJDiJxSfy7jtOrnuE2BgAR9hLmfMDWK8,16
46
+ neuro_simulator-0.4.1.dist-info/RECORD,,