Expand description
Shared API types, crypto, and SQL builders for opensession.io
This crate is the single source of truth for all API request/response types.
TypeScript types are auto-generated via ts-rs and consumed by the frontend.
To regenerate TypeScript types: cargo test -p opensession-api – export_typescript –nocapture
Modules§
- deploy
- Deployment profile flags shared by server and worker runtimes.
- oauth
- Generic OAuth2 provider support.
Structs§
- Agent
- AI agent information
- ApiError
- Legacy JSON error shape
{ "error": "..." }returned by all error responses. - Auth
Register Request - Email + password registration.
- Auth
Token Response - Returned on successful login / register / refresh.
- Capabilities
Response - Returned by
GET /api/capabilities— runtime feature availability. - Change
Password Request - Change password request.
- Content
- Multimodal content container
- Event
- A single event in the flat timeline
- Health
Response - Returned by
GET /api/health— server liveness check. - Login
Request - Email + password login.
- Logout
Request - Logout request (invalidate refresh token).
- OAuth
Link Response - Response for OAuth link initiation (redirect URL).
- OkResponse
- Generic success response for operations that don’t return data.
- Refresh
Request - Refresh token request.
- Regenerate
KeyResponse - Response for API key regeneration.
- Register
Request - Legacy register (nickname-only). Kept for backward compatibility with CLI.
- Register
Response - Returned on successful legacy register (nickname-only, CLI-compatible).
- Session
- Top-level session - the root of a HAIL (Human AI Interaction Log) trace
- Session
Context - Session context metadata
- Session
Detail - Single session detail returned by
GET /api/sessions/:id. - Session
Link - A link between two sessions (e.g., handoff chain).
- Session
List Query - Query parameters for
GET /api/sessions— pagination, filtering, sorting. - Session
List Response - Paginated session listing returned by
GET /api/sessions. - Session
Summary - Flat session summary returned by list/detail endpoints. This is NOT the full HAIL Session — it’s a DB-derived summary.
- Stats
- Aggregate session statistics
- Stream
Events Request - Request body for
POST /api/sessions/:id/events— append live events. - Stream
Events Response - Returned by
POST /api/sessions/:id/events— number of events accepted. - Upload
Request - Request body for
POST /api/sessions— upload a recorded session. - Upload
Response - Returned on successful session upload — contains the new session ID and URL.
- User
Settings Response - Full user profile returned by
GET /api/auth/me. - Verify
Response - Returned by
POST /api/auth/verify— confirms token validity.
Enums§
- Content
Block - Individual content block
- Event
Type - Event type - the core abstraction
- Link
Type - Type of link between two sessions.
- Service
Error - Framework-agnostic service error.
- Sort
Order - Sort order for session listings.
- Time
Range - Time range filter for queries.
Functions§
- saturating_
i64 - Safely convert
u64toi64, saturating ati64::MAXinstead of wrapping.