Skip to main content

Crate opensession_api_types

Crate opensession_api_types 

Source
Expand description

Shared API types 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-types – export_typescript –nocapture

Modules§

crypto
Cryptographic helpers for authentication.
db
Shared database schema and query definitions. Used by: Axum server, Cloudflare Worker, TUI local DB.
oauth
Generic OAuth2 provider support.
service
Shared business logic — framework-agnostic pure functions.

Structs§

AcceptInvitationResponse
Returned by POST /api/invitations/:id/accept — confirms team join.
AddMemberRequest
Request body for POST /api/teams/:id/members — add a member by nickname.
Agent
AI agent information
ApiError
Legacy JSON error shape { "error": "..." } returned by all error responses.
AuthRegisterRequest
Email + password registration.
AuthTokenResponse
Returned on successful login / register / refresh.
ChangePasswordRequest
Change password request.
ConfigSyncResponse
Team-level configuration synced to CLI clients.
Content
Multimodal content container
CreateTeamRequest
Request body for POST /api/teams — create a new team.
Event
A single event in the flat timeline
HealthResponse
Returned by GET /api/health — server liveness check.
InvitationResponse
Single invitation record returned by list and detail endpoints.
InviteRequest
Request body for POST /api/teams/:id/invite — invite a user by email or OAuth identity.
ListInvitationsResponse
Returned by GET /api/invitations — pending invitations for the current user.
ListMembersResponse
Returned by GET /api/teams/:id/members.
ListTeamsResponse
Returned by GET /api/teams — teams the authenticated user belongs to.
LoginRequest
Email + password login.
LogoutRequest
Logout request (invalidate refresh token).
MemberResponse
Single team member record.
OAuthLinkResponse
Response for OAuth link initiation (redirect URL).
OkResponse
Generic success response for operations that don’t return data.
RefreshRequest
Refresh token request.
RegenerateKeyResponse
Response for API key regeneration.
RegisterRequest
Legacy register (nickname-only). Kept for backward compatibility with CLI.
RegisterResponse
Returned on successful legacy register (nickname-only, CLI-compatible).
Session
Top-level session - the root of a HAIL (Human AI Interaction Log) trace
SessionContext
Session context metadata
SessionDetail
Single session detail returned by GET /api/sessions/:id.
SessionLink
A link between two sessions (e.g., handoff chain).
SessionListQuery
Query parameters for GET /api/sessions — pagination, filtering, sorting.
SessionListResponse
Paginated session listing returned by GET /api/sessions.
SessionSummary
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
StreamEventsRequest
Request body for POST /api/sessions/:id/events — append live events.
StreamEventsResponse
Returned by POST /api/sessions/:id/events — number of events accepted.
SyncPullQuery
Query parameters for GET /api/sync/pull — cursor-based session sync.
SyncPullResponse
Returned by GET /api/sync/pull — paginated session data with cursor.
SyncedPrivacyConfig
Privacy settings synced from the team — controls what data is recorded.
SyncedWatcherConfig
Watcher toggle settings synced from the team — which tools to monitor.
TeamDetailResponse
Returned by GET /api/teams/:id — team info with member count and recent sessions.
TeamResponse
Single team record returned by list and detail endpoints.
TeamStatsQuery
Query parameters for GET /api/teams/:id/stats.
TeamStatsResponse
Returned by GET /api/teams/:id/stats — aggregated team statistics.
TeamStatsTotals
Aggregate totals across all sessions in a team.
ToolStats
Per-tool aggregated statistics within a team.
UpdateTeamRequest
Request body for PUT /api/teams/:id — partial team update.
UploadRequest
Request body for POST /api/sessions — upload a recorded session.
UploadResponse
Returned on successful session upload — contains the new session ID and URL.
UserSettingsResponse
Full user profile returned by GET /api/auth/me.
UserStats
Per-user aggregated statistics within a team.
VerifyResponse
Returned by POST /api/auth/verify — confirms token validity.

Enums§

ContentBlock
Individual content block
EventType
Event type - the core abstraction
ServiceError
Framework-agnostic service error.