mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
chore(server): rename Session to WebSession (#10565)
This commit is contained in:
parent
55a6bbd9a4
commit
81d6341f9d
@ -34,7 +34,7 @@ from openhands.server.data_models.agent_loop_info import AgentLoopInfo
|
||||
from openhands.server.monitoring import MonitoringListener
|
||||
from openhands.server.session.conversation import ServerConversation
|
||||
from openhands.server.session.conversation_init_data import ConversationInitData
|
||||
from openhands.server.session.session import Session
|
||||
from openhands.server.session.session import WebSession as Session
|
||||
from openhands.storage.conversation.conversation_store import ConversationStore
|
||||
from openhands.storage.data_models.conversation_metadata import ConversationMetadata
|
||||
from openhands.storage.data_models.conversation_status import ConversationStatus
|
||||
|
||||
@ -23,7 +23,7 @@ from openhands.server.data_models.agent_loop_info import AgentLoopInfo
|
||||
from openhands.server.monitoring import MonitoringListener
|
||||
from openhands.server.session.agent_session import WAIT_TIME_BEFORE_CLOSE, AgentSession
|
||||
from openhands.server.session.conversation import ServerConversation
|
||||
from openhands.server.session.session import Session
|
||||
from openhands.server.session.session import WebSession as Session
|
||||
from openhands.storage.conversation.conversation_store import ConversationStore
|
||||
from openhands.storage.data_models.conversation_metadata import ConversationMetadata
|
||||
from openhands.storage.data_models.conversation_status import ConversationStatus
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
from openhands.server.session.session import Session
|
||||
# Backward-compatible import for the web server-bound session wrapper.
|
||||
# The canonical name is WebSession; Session is an alias to be removed later.
|
||||
from openhands.server.session.session import WebSession
|
||||
from openhands.server.session.session import WebSession as Session
|
||||
|
||||
__all__ = ['Session']
|
||||
__all__ = ['WebSession', 'Session']
|
||||
|
||||
@ -37,7 +37,28 @@ from openhands.storage.data_models.settings import Settings
|
||||
from openhands.storage.files import FileStore
|
||||
|
||||
|
||||
class Session:
|
||||
class WebSession:
|
||||
"""Web server-bound session wrapper.
|
||||
|
||||
This was previously named `Session`. We keep `Session` as a compatibility alias
|
||||
(see openhands.server.session.__init__) so downstream imports/tests continue to
|
||||
work. The class manages a single web client connection and orchestrates the
|
||||
AgentSession lifecycle for that conversation.
|
||||
|
||||
Attributes:
|
||||
sid: Stable conversation id across transports.
|
||||
sio: Socket.IO server used to emit events to the web client.
|
||||
last_active_ts: Unix timestamp of last successful send.
|
||||
is_alive: Whether the web connection is still alive.
|
||||
agent_session: Core agent session coordinating runtime/LLM.
|
||||
loop: The asyncio loop associated with the session.
|
||||
config: Effective OpenHands configuration for this conversation.
|
||||
llm_registry: Registry responsible for LLM access and retry hooks.
|
||||
file_store: File storage interface for this conversation.
|
||||
user_id: Optional multi-tenant user identifier.
|
||||
logger: Logger with session context.
|
||||
"""
|
||||
|
||||
sid: str
|
||||
sio: socketio.AsyncServer | None
|
||||
last_active_ts: int = 0
|
||||
@ -427,3 +448,8 @@ class Session:
|
||||
asyncio.run_coroutine_threadsafe(
|
||||
self._send_status_message(msg_type, runtime_status, message), self.loop
|
||||
)
|
||||
|
||||
|
||||
# Backward-compatible alias for external imports that still reference
|
||||
# openhands.server.session.session import Session
|
||||
Session = WebSession
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user