yera.dev.routers.session

Session resource router: create session, stream, add interaction.

Symbols

def add_interaction — Add a user interaction to a session.
def create_session — Create a new session for streaming an app.
def stream_session — Start streaming conversation events for a session via Server-Sent Events (SSE).

add_interaction

add_interaction(
    session_id: str = FastAPIPath(description='Session identifier'),
    interaction: UserInteraction = Body(description='User interaction data'),
    session_service: SessionService = Depends(get_session_service),
) → AddInteractionResponse

Add a user interaction to a session.

Parameters

session_id
type: str = FastAPIPath(description='Session identifier')

Session identifier from the URL path

interaction
type: UserInteraction = Body(description='User interaction data')

User interaction data with blockId, value, and blockType

session_service
type: SessionService = Depends(get_session_service)

Injected session service.

Returns

type: AddInteractionResponse

Response indicating interaction was received

Raises

HTTPException

404 if session not found

create_session

create_session(
    request: SessionCreateRequest = Body(...),
    app_service: AppService = Depends(get_app_service),
    session_service: SessionService = Depends(get_session_service),
) → CreateSessionResponse

Create a new session for streaming an app.

Parameters

request
type: SessionCreateRequest = Body(...)

Session creation request with app_id

app_service
type: AppService = Depends(get_app_service)

Injected app service.

session_service
type: SessionService = Depends(get_session_service)

Injected session service.

Returns

type: CreateSessionResponse

Response with session_id

Raises

HTTPException

404 if app not found

stream_session

stream_session(
    session_id: str = FastAPIPath(description='Session identifier for streaming'),
    session_service: SessionService = Depends(get_session_service),
) → StreamingResponse

Start streaming conversation events for a session via Server-Sent Events (SSE).

Parameters

session_id
type: str = FastAPIPath(description='Session identifier for streaming')

Session identifier from the URL path.

session_service
type: SessionService = Depends(get_session_service)

Injected session service.

Returns

type: StreamingResponse

StreamingResponse with text/event-stream content type

Raises

HTTPException

404 if session not found