git.iko.soy/opencode-android
on d518ef7 help sign in
37 lines 1.3 kB history raw
1package soy.iko.opencode.data.model
3import androidx.compose.runtime.Immutable
4import kotlinx.serialization.Serializable
6/** Entry from `GET /agent`. */
7@Immutable
8@Serializable
9data class Agent(
10 // Defaulted so one name-less element in GET /agent doesn't fail the whole list decode
11 // (emptying the agent picker) — matches the resilient-decoding philosophy. A blank name is
12 // degraded but recoverable; a thrown decode is not.
13 val name: String = "",
14 val description: String? = null,
15 val mode: String? = null,
16 val builtIn: Boolean = false,
17 val prompt: String? = null,
18) {
19 val isPrimary: Boolean get() = mode == "primary"
20 val displayDescription: String get() = description?.takeIf { it.isNotBlank() } ?: "Custom agent"
23/** Entry from `GET /command`. */
24@Immutable
25@Serializable
26data class Command(
27 // Defaulted so one name-less element in GET /command doesn't fail the whole list decode
28 // (emptying the command picker) — matches the resilient-decoding philosophy.
29 val name: String = "",
30 val description: String? = null,
31 val agent: String? = null,
32 val model: String? = null,
33 val template: String = "",
34 val subtask: Boolean = false,
35) {
36 val displayDescription: String get() = description?.takeIf { it.isNotBlank() } ?: template.take(80)