neuro-simulator 0.3.1__tar.gz → 0.3.2__tar.gz
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.
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/PKG-INFO +1 -1
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/api/system.py +4 -1
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/core/application.py +34 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/utils/process.py +8 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator.egg-info/PKG-INFO +1 -1
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/pyproject.toml +1 -1
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/README.md +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/__init__.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/agent/__init__.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/agent/base.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/agent/core.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/agent/factory.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/agent/llm.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/agent/memory/__init__.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/agent/memory/manager.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/agent/tools/__init__.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/agent/tools/core.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/api/__init__.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/api/stream.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/cli.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/core/__init__.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/core/agent_factory.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/core/agent_interface.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/core/config.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/services/__init__.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/services/audience.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/services/audio.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/services/builtin.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/services/letta.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/services/stream.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/utils/__init__.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/utils/logging.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/utils/queue.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/utils/state.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator/utils/websocket.py +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator.egg-info/SOURCES.txt +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator.egg-info/dependency_links.txt +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator.egg-info/entry_points.txt +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator.egg-info/requires.txt +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator.egg-info/top_level.txt +0 -0
- {neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/setup.cfg +0 -0
@@ -6,6 +6,7 @@ import time
|
|
6
6
|
|
7
7
|
from ..core.config import config_manager
|
8
8
|
|
9
|
+
|
9
10
|
router = APIRouter(tags=["System & Utilities"])
|
10
11
|
|
11
12
|
|
@@ -57,4 +58,6 @@ async def root():
|
|
57
58
|
"message": "Neuro-Sama Simulator Backend",
|
58
59
|
"version": "2.0",
|
59
60
|
"api_docs": "/docs",
|
60
|
-
}
|
61
|
+
}
|
62
|
+
|
63
|
+
|
@@ -287,6 +287,10 @@ async def websocket_admin_endpoint(websocket: WebSocket):
|
|
287
287
|
initial_context = await agent.get_message_history()
|
288
288
|
await websocket.send_json({"type": "agent_context", "action": "update", "messages": initial_context})
|
289
289
|
|
290
|
+
# Send initial stream status
|
291
|
+
status = {"is_running": process_manager.is_running, "backend_status": "running" if process_manager.is_running else "stopped"}
|
292
|
+
await websocket.send_json({"type": "stream_status", "payload": status})
|
293
|
+
|
290
294
|
# Main loop for receiving messages from the client and pushing log updates
|
291
295
|
while websocket.client_state == WebSocketState.CONNECTED:
|
292
296
|
# Check for incoming messages
|
@@ -391,17 +395,29 @@ async def handle_admin_ws_message(websocket: WebSocket, data: dict):
|
|
391
395
|
if not process_manager.is_running:
|
392
396
|
process_manager.start_live_processes()
|
393
397
|
response["payload"] = {"status": "success", "message": "Stream started"}
|
398
|
+
# Broadcast stream status update
|
399
|
+
from ..utils.websocket import connection_manager
|
400
|
+
status = {"is_running": process_manager.is_running, "backend_status": "running" if process_manager.is_running else "stopped"}
|
401
|
+
await connection_manager.broadcast_to_admins({"type": "stream_status", "payload": status})
|
394
402
|
|
395
403
|
elif action == "stop_stream":
|
396
404
|
if process_manager.is_running:
|
397
405
|
await process_manager.stop_live_processes()
|
398
406
|
response["payload"] = {"status": "success", "message": "Stream stopped"}
|
407
|
+
# Broadcast stream status update
|
408
|
+
from ..utils.websocket import connection_manager
|
409
|
+
status = {"is_running": process_manager.is_running, "backend_status": "running" if process_manager.is_running else "stopped"}
|
410
|
+
await connection_manager.broadcast_to_admins({"type": "stream_status", "payload": status})
|
399
411
|
|
400
412
|
elif action == "restart_stream":
|
401
413
|
await process_manager.stop_live_processes()
|
402
414
|
await asyncio.sleep(1)
|
403
415
|
process_manager.start_live_processes()
|
404
416
|
response["payload"] = {"status": "success", "message": "Stream restarted"}
|
417
|
+
# Broadcast stream status update
|
418
|
+
from ..utils.websocket import connection_manager
|
419
|
+
status = {"is_running": process_manager.is_running, "backend_status": "running" if process_manager.is_running else "stopped"}
|
420
|
+
await connection_manager.broadcast_to_admins({"type": "stream_status", "payload": status})
|
405
421
|
|
406
422
|
elif action == "get_stream_status":
|
407
423
|
status = {"is_running": process_manager.is_running, "backend_status": "running" if process_manager.is_running else "stopped"}
|
@@ -432,6 +448,24 @@ async def handle_admin_ws_message(websocket: WebSocket, data: dict):
|
|
432
448
|
context = await agent.get_message_history()
|
433
449
|
response["payload"] = context
|
434
450
|
|
451
|
+
elif action == "get_last_prompt":
|
452
|
+
# Check if the agent supports prompt generation introspection
|
453
|
+
agent_instance = getattr(agent, 'agent_instance', None) if hasattr(agent, 'agent_instance') else agent
|
454
|
+
if not hasattr(agent_instance, 'memory_manager') or not hasattr(agent_instance.memory_manager, 'get_recent_chat') or not hasattr(agent_instance, '_build_neuro_prompt'):
|
455
|
+
response["payload"] = {"status": "error", "message": "The active agent does not support prompt generation introspection."}
|
456
|
+
else:
|
457
|
+
recent_history = await agent_instance.memory_manager.get_recent_chat(entries=10)
|
458
|
+
messages_for_prompt = []
|
459
|
+
for entry in recent_history:
|
460
|
+
if entry.get('role') == 'user':
|
461
|
+
parts = entry.get('content', '').split(':', 1)
|
462
|
+
if len(parts) == 2:
|
463
|
+
messages_for_prompt.append({'username': parts[0].strip(), 'text': parts[1].strip()})
|
464
|
+
else:
|
465
|
+
messages_for_prompt.append({'username': 'user', 'text': entry.get('content', '')})
|
466
|
+
prompt = await agent_instance._build_neuro_prompt(messages_for_prompt)
|
467
|
+
response["payload"] = {"prompt": prompt}
|
468
|
+
|
435
469
|
elif action == "reset_agent_memory":
|
436
470
|
await agent.reset_memory()
|
437
471
|
response["payload"] = {"status": "success"}
|
@@ -33,6 +33,7 @@ class ProcessManager:
|
|
33
33
|
from ..core.application import generate_audience_chat_task, neuro_response_cycle, broadcast_events_task
|
34
34
|
from ..utils.queue import clear_all_queues
|
35
35
|
from ..core.agent_factory import create_agent
|
36
|
+
from ..utils.websocket import connection_manager
|
36
37
|
|
37
38
|
asyncio.create_task(create_agent())
|
38
39
|
|
@@ -45,6 +46,9 @@ class ProcessManager:
|
|
45
46
|
self._tasks.append(asyncio.create_task(neuro_response_cycle()))
|
46
47
|
|
47
48
|
self._is_running = True
|
49
|
+
# Broadcast stream status update
|
50
|
+
status = {"is_running": self._is_running, "backend_status": "running" if self._is_running else "stopped"}
|
51
|
+
asyncio.create_task(connection_manager.broadcast_to_admins({"type": "stream_status", "payload": status}))
|
48
52
|
logger.info(f"Core processes started: {len(self._tasks)} tasks.")
|
49
53
|
|
50
54
|
async def stop_live_processes(self):
|
@@ -66,6 +70,10 @@ class ProcessManager:
|
|
66
70
|
|
67
71
|
live_stream_manager.reset_stream_state()
|
68
72
|
|
73
|
+
# Broadcast stream status update
|
74
|
+
status = {"is_running": self._is_running, "backend_status": "running" if self._is_running else "stopped"}
|
75
|
+
await connection_manager.broadcast_to_admins({"type": "stream_status", "payload": status})
|
76
|
+
|
69
77
|
logger.info("All core tasks have been stopped.")
|
70
78
|
|
71
79
|
# Global singleton instance
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{neuro_simulator-0.3.1 → neuro_simulator-0.3.2}/neuro_simulator.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|