yr.ManagedSessionObj#
- class yr.ManagedSessionObj(session_id: str, session_json: str)[source]#
Bases:
objectManaged Session Object.
Session Data Structure:
{ "sessionID": "s-123", "histories": ["user: hello", "assistant: hi"] }
Note
Internally holds sessionId and the latest sessionData JSON string
get_histories() returns a copy to prevent users from directly modifying internal list and bypassing sync
set_histories() immediately calls bridge to sync to libruntime, runtime auto-persists at request end
Multiple load_session() calls with same sessionId return the same managed object
Construct managed Session Object.
- Parameters:
session_id – Session ID
session_json – JSON string of Session data
Methods
Construct managed Session Object.
Get history list (copy).
Get Session ID.
Whether this session has been interrupted (e.g. cancellation).
Send notify payload to the session wait/notify channel (UTF-8 JSON bytes to native).
Set history list and immediately sync to libruntime.
Block until notify arrives for this session or timeout.