2.1 KiB
2.1 KiB
core:model
All @Serializable data classes -- domain models, DTOs, request/response wrappers. This is the shared contract between network, data, and feature modules.
What This Module Provides
- Domain models:
User,Conversation,Message,MessageContentPart,Agent,Preset,Prompt,PromptGroup,ConversationTag,SharedLink,FileObject,Balance,StartupConfig,ModelSpec,ServerConnection - Enums:
EModelEndpoint,ContentType,StepType,ToolCallType,FeedbackRating,Provider - StreamEvent sealed hierarchy:
ContentDelta,ToolCallStart,ToolCallComplete,ThinkingDelta,Final,Sync,Error,Created,Step,AttachmentCreated - Request/response wrappers:
LoginRequest,LoginResponse,RegisterRequest,ChatRequest,ConvoUpdateBody,ForkConvoRequest, etc.
Key Patterns
argwrapper for mutation endpoints: The backend readsreq.body.argon conversation update/delete/archive. Request bodies use:{ "arg": { "conversationId": "...", "title": "..." } }. SeeConvoUpdateBody/ConvoDeleteBody.- Nullable fields with defaults: Most fields are nullable with
= nulldefaults. The backend schema is loose (Mongoose + Zod). Always use@SerialNamewhen the JSON key differs from Kotlin naming. ignoreUnknownKeys = true: The server may add new fields at any time. Never assume the response shape is exhaustive.
Directory Convention
- Top-level: domain model classes (Conversation.kt, Message.kt, etc.)
request/: Request body data classes (LoginRequest, ChatRequest, etc.)response/: API response wrappers (LoginResponse, ConversationListResponse, etc.)
Rules
- Pure Kotlin only. NO Android framework dependencies. No
Context, noParcelable. - Only dependency beyond
:core:commoniskotlinx-serialization-json. - Use
@Serializableon every data class. Use@SerialNamefor snake_case JSON fields. - Use
JsonObject/JsonElementfor truly polymorphic/mixed-type fields (e.g.,Agent.avatar,Feedback.tag). - Convention plugins:
librechat.mobile.library+librechat.kotlin.serialization.