1package soy.iko.opencode.data.model
3import androidx.compose.runtime.Immutable
4import kotlinx.serialization.SerialName
5import kotlinx.serialization.Serializable
6import kotlinx.serialization.json.JsonElement
7import kotlinx.serialization.json.JsonClassDiscriminator
10 * The state machine of a tool call, discriminated on `status`.
11 * pending -> running -> completed | error
13@OptIn(kotlinx.serialization.ExperimentalSerializationApi::class)
15@JsonClassDiscriminator("status")
16sealed interface ToolState
20data object ToolPending : ToolState
25data class ToolRunning(
26 val input: JsonElement? = null,
27 val title: String? = null,
28 val time: PartTimeInfo? = null,
33@SerialName("completed")
34data class ToolCompleted(
35 val input: JsonElement? = null,
36 val output: String? = null,
37 val title: String? = null,
38 val time: PartTimeInfo? = null,
45 val input: JsonElement? = null,
46 val error: String? = null,
47 val time: PartTimeInfo? = null,
50/** Fallback for an unrecognized `status`. */
52@SerialName("__unknown")
53data object ToolUnknown : ToolState
55/** The raw input arguments carried by a tool call, present on the running/completed/error
56 * states (pending/unknown carry none). */
57fun ToolState.inputElement(): JsonElement? = when (this) {
58 is ToolRunning -> input
59 is ToolCompleted -> input
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list