1package soy.iko.opencode.ui.chat
3import androidx.compose.foundation.layout.Column
4import androidx.compose.foundation.layout.fillMaxWidth
5import androidx.compose.material3.AlertDialog
6import androidx.compose.material3.MaterialTheme
7import androidx.compose.material3.Text
8import androidx.compose.material3.TextButton
9import androidx.compose.runtime.Composable
10import androidx.compose.ui.Modifier
11import androidx.compose.ui.text.font.FontFamily
12import soy.iko.opencode.data.model.Permission
13import soy.iko.opencode.data.model.PermissionResponse
16 * Modal asking the user to approve a tool the agent wants to run. The agent run is
17 * paused until one of these responses is sent. Non-dismissable by tap-outside so the
18 * decision is explicit.
22 permission: Permission,
23 onRespond: (PermissionResponse) -> Unit,
26 onDismissRequest = { /* require an explicit choice */ },
27 title = { Text(permission.title ?: "Permission requested") },
30 permission.type?.let {
31 Text(it, style = MaterialTheme.typography.labelLarge, fontFamily = FontFamily.Monospace)
33 permission.patternText?.let {
36 style = MaterialTheme.typography.bodySmall,
37 fontFamily = FontFamily.Monospace,
38 color = MaterialTheme.colorScheme.onSurfaceVariant,
44 Column(modifier = Modifier.fillMaxWidth()) {
45 TextButton(onClick = { onRespond(PermissionResponse.ONCE) }) { Text("Allow once") }
46 TextButton(onClick = { onRespond(PermissionResponse.ALWAYS) }) { Text("Always allow") }
50 TextButton(onClick = { onRespond(PermissionResponse.REJECT) }) {
51 Text("Reject", color = MaterialTheme.colorScheme.error)
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