git.iko.soy/opencode-android
on e66c7ed help sign in
68 lines 1.8 kB history raw
1package soy.iko.opencode.data.model
3import kotlinx.serialization.SerialName
4import kotlinx.serialization.Serializable
6/** Body for `POST /session/:id/message`. */
7@Serializable
8data class PromptRequest(
9 val parts: List<PromptPart>,
10 val model: ModelRef? = null,
11 val agent: String? = null,
14/**
15 * An input part for a prompt — a discriminated union on `type` (the global class
16 * discriminator). We compose text and file (image/document attachment) parts; the server
17 * models more (agent, subtask) that this client doesn't send.
18 */
19@Serializable
20sealed interface PromptPart
22@Serializable
23@SerialName("text")
24data class TextPromptPart(val text: String) : PromptPart
26/**
27 * A file/image attachment. [url] must be a data URL carrying the base64 payload —
28 * `data:<mime>;base64,<bytes>` — which is how the server embeds media for the model to
29 * see (see opencode's message-v2.ts). [mime] must match the payload; the server forwards
30 * it as the model's mediaType.
31 */
32@Serializable
33@SerialName("file")
34data class FilePromptPart(
35 val mime: String,
36 val url: String,
37 val filename: String? = null,
38) : PromptPart
40/** Body for `POST /session/:id/command`. */
41@Serializable
42data class CommandRequest(
43 val command: String,
44 val arguments: String = "",
45 val agent: String? = null,
48/** Body for `POST /session/:id/revert`. */
49@Serializable
50data class RevertRequest(
51 val messageID: String,
52 val partID: String? = null,
55/** Body for `POST /session/:id/summarize`. */
56@Serializable
57data class SummarizeRequest(
58 val providerID: String,
59 val modelID: String,
62/** Body for `POST /session/:id/shell`. */
63@Serializable
64data class ShellRequest(
65 val agent: String,
66 val command: String,
67 val model: ModelRef? = null,