Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
fix(android): links pick their tab even on a cold start, and the desktop says Retry after a failed model list
leepokai209b18e869fc
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/ComputerRosterTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/ComputerRosterTest.ktindex 7801ea6b..407fcf73 100644--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/ComputerRosterTest.kt+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/ComputerRosterTest.kt@@ -74,7 +74,7 @@ class ComputerRosterTest {// The account's own state, as the app shows it: Back clears it there.compose.setContent {val live by accounts.state.collectAsState()- Hosted { MainTabs(live, listOf(state(mac, "Mac bot")), accounts, {}, {}, {}, {}, {}, { _, _ -> }, {}, covered = true) {} }+ Hosted { MainTabs(live, listOf(state(mac, "Mac bot")), accounts, {}, {}, {}, {}, {}, { _, _ -> }, {}, AppTab.Bots, {}, covered = true) {} }}compose.onNodeWithText("This computer was removed").assertIsDisplayed()compose.onNodeWithContentDescription("Back").performClick()diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/LayoutTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/LayoutTest.ktindex c43f3917..33f2451c 100644--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/LayoutTest.kt+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/LayoutTest.kt@@ -1,6 +1,7 @@package com.codync.androidimport androidx.compose.runtime.CompositionLocalProvider+import androidx.compose.runtime.mutableStateOfimport androidx.compose.ui.platform.LocalDensityimport androidx.compose.ui.graphics.asAndroidBitmapimport androidx.test.platform.app.InstrumentationRegistry@@ -63,6 +64,22 @@ class LayoutTest {compose.onNodeWithText("Bot 5").assertIsDisplayed()}+ @Test fun aLinkPicksItsTabEvenWhenItArrivesWithTheTabs() = compose.withPreviewAccounts(computer) { accounts ->+ // A cold start: the link is counted while the account loads, before the tabs first show.+ val context = mutableStateOf(app.copy(loading = true))+ compose.setContent { Hosted { CodyncApp(context.value, mapOf(computer.id to state), accounts) } }+ // The State tab's widget previews never stop moving: step the clock by hand.+ compose.mainClock.autoAdvance = false+ compose.runOnUiThread { context.value = app.copy(navigationRequest = 1, navigationPage = LinkPage.Usage) }+ compose.mainClock.advanceTimeBy(1_000)+ compose.onNode(tab("State")).assertIsSelected()+ compose.runOnUiThread { context.value = app.copy(navigationRequest = 2, navigationPage = LinkPage.Computers) }+ compose.mainClock.advanceTimeBy(1_000)+ compose.mainClock.autoAdvance = true+ compose.onNode(tab("Bots")).assertIsSelected()+ compose.onNodeWithText("Computer management").assertIsDisplayed()+ }+@Test fun largerTextKeepsTheHeaderControlsAndUnreadBadgeAccessible() = compose.withPreviewAccounts(computer) { accounts ->compose.setContent {val density = LocalDensity.currentdiff --git a/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt b/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.ktindex cf260b32..5243e2f5 100644--- a/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt+++ b/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt@@ -72,9 +72,10 @@ private enum class PickerStage { Closed, Agents, Models, Settings }val modelName = if (value.isEmpty()) "Default" else modelChoices.firstOrNull { it.first == value }?.second ?: valueval levels = modelOptions.mapNotNull { option -> option.values.firstOrNull { it.id == (options[option.id] ?: option.default) }?.name }val summary = (listOf(agentName, modelName) + levels + if (fastMode) listOf("Fast") else emptyList()).joinToString(" · ")+ val unfold = tr(if (stage == PickerStage.Closed) "Collapsed" else "Expanded")Column(Modifier.fillMaxWidth().animateContentSize(Motion.layoutSize), verticalArrangement = Arrangement.spacedBy(8.dp)) {Row(Modifier.fillMaxWidth().clickable { open(if (stage == PickerStage.Closed) PickerStage.Models else PickerStage.Closed) }- .semantics { stateDescription = if (stage == PickerStage.Closed) "Collapsed" else "Expanded" }.padding(vertical = 8.dp),+ .semantics { stateDescription = unfold }.padding(vertical = 8.dp),verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {Crossfade(summary, Modifier.weight(1f), animationSpec = Motion.fade(), label = "Agent summary") { text ->Text(text, style = Type.subheadline, color = Palette.text)diff --git a/apps/android/app/src/main/kotlin/com/codync/android/CodyncApp.kt b/apps/android/app/src/main/kotlin/com/codync/android/CodyncApp.ktindex 0943c984..93bb442e 100644--- a/apps/android/app/src/main/kotlin/com/codync/android/CodyncApp.kt+++ b/apps/android/app/src/main/kotlin/com/codync/android/CodyncApp.kt@@ -56,7 +56,9 @@ private data class Editing<T>(val computerId: String, val draft: T)var access by remember { mutableStateOf<CloudComputer?>(null) }var editor by remember { mutableStateOf<Editing<BotDraft>?>(null) }var groupEditor by remember { mutableStateOf<Editing<GroupDraft>?>(null) }- var handledNavigation by rememberSaveable { mutableIntStateOf(app.navigationRequest) }+ var tab by rememberSaveable { mutableStateOf(AppTab.Bots) }+ // The last link shown, and the store that counted it: requests count from 0 again in each generation and each process.+ var handledNavigation by rememberSaveable { mutableStateOf(accounts.activityOwnerId to 0) }var handledGeneration by rememberSaveable { mutableIntStateOf(app.generation) }fun closeAll() {showAccount = false; showComputers = false; showPairing = false; marketplace = null@@ -64,14 +66,17 @@ private data class Editing<T>(val computerId: String, val draft: T)}// A new account or a fresh start drops whatever was open for the old one.LaunchedEffect(app.generation) { if (handledGeneration != app.generation) { closeAll(); showUsage = false; handledGeneration = app.generation } }- // A notification, widget or link: close everything, then maybe show usage, the computers or extensions.+ // A notification, widget or link: close everything, then pick the tab as the iPhone does (usage on State, the rest over Bots)+ // and maybe show usage, the computers or extensions.LaunchedEffect(app.navigationRequest) {- if (handledNavigation != app.navigationRequest) {+ val handled = handledNavigation.second.takeIf { handledNavigation.first == accounts.activityOwnerId } ?: 0+ if (handled != app.navigationRequest) {closeAll()+ tab = if (app.navigationPage == LinkPage.Usage) AppTab.State else AppTab.BotsshowUsage = app.navigationPage == LinkPage.UsageshowComputers = app.navigationPage == LinkPage.Computersif (app.navigationPage == LinkPage.Extensions) marketplace = app.currentComputerId- handledNavigation = app.navigationRequest+ handledNavigation = accounts.activityOwnerId to app.navigationRequest}}val signedIn = app.account.userId != null@@ -109,7 +114,7 @@ private data class Editing<T>(val computerId: String, val draft: T)}Root.Tabs -> MainTabs(app, states, accounts, account = { showAccount = true }, manage = { showComputers = true }, usage = { showUsage = true },newBot = { creating = NewTarget(group = false, computerId = it) }, newGroup = { creating = NewTarget(group = true, computerId = it) },- edit = edit, extensions = openMarketplace, covered = showAccount || showComputers || showPairing || showUsage ||+ edit = edit, extensions = openMarketplace, tab = tab, onTab = { tab = it }, covered = showAccount || showComputers || showPairing || showUsage ||marketplace != null || creating != null || access != null || editor != null || groupEditor != null || app.error != null) { chat ->// A conversation, talking to the computer the bot lives on.accounts.store(chat.computer.id)?.let { store -> ChatScreen(chat, store) { bot -> edit(chat.computer.id, bot) } }diff --git a/apps/android/app/src/main/kotlin/com/codync/android/MainTabs.kt b/apps/android/app/src/main/kotlin/com/codync/android/MainTabs.ktindex b571e932..7cd91995 100644--- a/apps/android/app/src/main/kotlin/com/codync/android/MainTabs.kt+++ b/apps/android/app/src/main/kotlin/com/codync/android/MainTabs.kt@@ -19,9 +19,7 @@ import androidx.compose.runtime.Composableimport androidx.compose.runtime.getValueimport androidx.compose.runtime.keyimport androidx.compose.runtime.remember-import androidx.compose.runtime.mutableIntStateOfimport androidx.compose.runtime.mutableStateOf-import androidx.compose.runtime.saveable.rememberSaveableimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier@@ -36,7 +34,7 @@ import com.codync.android.core.Botimport com.codync.android.core.ReviewCancellationimport com.codync.android.design.*-private enum class AppTab { Bots, State, Settings }+internal enum class AppTab { Bots, State, Settings }/*** The system tab bar over Bots, State and Settings, as iOS `RootView.tabs`: every tab stays alive, the bar@@ -44,17 +42,11 @@ private enum class AppTab { Bots, State, Settings }*/@Composable internal fun MainTabs(app: AccountContext, states: List<AppState>, accounts: AccountStore, account: () -> Unit, manage: () -> Unit,usage: () -> Unit, newBot: (String) -> Unit, newGroup: (String) -> Unit, edit: (String, Bot) -> Unit, extensions: (String) -> Unit,- covered: Boolean, chat: @Composable (AppState) -> Unit) {- var tab by rememberSaveable { mutableStateOf(AppTab.Bots) }+ tab: AppTab, onTab: (AppTab) -> Unit, covered: Boolean, chat: @Composable (AppState) -> Unit) {// The open chat, on whichever computer it lives (one at a time).val open = states.firstOrNull { it.selectedBot != null }// Opening a bot (notification, widget, link) always lands on the Bots tab.- if (open != null && tab != AppTab.Bots) tab = AppTab.Bots- // Other links pick the tab as on the iPhone: usage on State, the computers and extensions over Bots; another account starts on Bots.- var handledLink by rememberSaveable { mutableIntStateOf(app.navigationRequest) }- if (handledLink != app.navigationRequest) { handledLink = app.navigationRequest; tab = if (app.navigationPage == LinkPage.Usage) AppTab.State else AppTab.Bots }- var handledAccount by rememberSaveable { mutableIntStateOf(app.generation) }- if (handledAccount != app.generation) { handledAccount = app.generation; tab = AppTab.Bots }+ if (open != null && tab != AppTab.Bots) onTab(AppTab.Bots)// Leaving a chat whose answer was read may invite a rating, once the roster has stayed clear (iOS `RootView`).val context = LocalContext.currentReviewOnReturn(open?.let { "${app.contextId}/${it.computer.id}/${it.selectedBot}" })@@ -88,7 +80,7 @@ private enum class AppTab { Bots, State, Settings }ScrollEdge(Edge.Bottom, barSpace)GlassTabBar(tab, listOf(TabItem(AppTab.Bots, "Bots", "bubble.left.and.bubble.right.fill", 33.dp),TabItem(AppTab.State, "State", "rectangle.stack.fill"), TabItem(AppTab.Settings, "Settings", "gearshape")),- { tab = it }, Modifier.padding(bottom = maxOf(bottom - 4.dp, 12.dp)))+ onTab, Modifier.padding(bottom = maxOf(bottom - 4.dp, 12.dp)))}}}) {diff --git a/apps/android/design/src/main/kotlin/com/codync/android/design/Menus.kt b/apps/android/design/src/main/kotlin/com/codync/android/design/Menus.ktindex e01d06d1..82877387 100644--- a/apps/android/design/src/main/kotlin/com/codync/android/design/Menus.kt+++ b/apps/android/design/src/main/kotlin/com/codync/android/design/Menus.kt@@ -8,14 +8,17 @@ import androidx.compose.animation.fadeOutimport androidx.compose.animation.togetherWithimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickable+import androidx.compose.foundation.focusableimport androidx.compose.foundation.gestures.awaitEachGestureimport androidx.compose.foundation.gestures.awaitFirstDownimport androidx.compose.foundation.gestures.awaitLongPressOrCancellationimport androidx.compose.foundation.gestures.drag-import androidx.compose.foundation.gestures.waitForUpOrCancellation-import androidx.compose.ui.input.pointer.AwaitPointerEventScope+import androidx.compose.ui.input.key.Key+import androidx.compose.ui.input.key.KeyEventType+import androidx.compose.ui.input.key.key+import androidx.compose.ui.input.key.onKeyEvent+import androidx.compose.ui.input.key.typeimport androidx.compose.ui.input.pointer.PointerEventPass-import androidx.compose.ui.input.pointer.PointerEventTimeoutCancellationExceptionimport androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.ui.input.pointer.positionChangeimport androidx.compose.foundation.interaction.MutableInteractionSource@@ -62,6 +65,7 @@ import androidx.compose.ui.layout.layoutimport androidx.compose.ui.layout.onGloballyPositionedimport androidx.compose.ui.platform.LocalDensityimport androidx.compose.ui.platform.LocalHapticFeedback+import androidx.compose.ui.platform.LocalViewConfigurationimport androidx.compose.ui.semantics.Roleimport androidx.compose.ui.semantics.contentDescriptionimport androidx.compose.ui.semantics.semantics@@ -125,6 +129,7 @@ class ContextDrag(val start: () -> Unit, val move: (Float) -> Unit, val end: ()haptics.performHapticFeedback(HapticFeedbackType.LongPress)open = true}+ val longPress = LocalViewConfiguration.current.longPressTimeoutMillis// One gesture for tap, hold and drag: a click detector would swallow the move after the hold.// A message reads as one node with its actions, as a clickable would merge it; a row that reorders keeps its own.val gestures = Modifier.semantics(mergeDescendants = reorder == null) {@@ -132,15 +137,21 @@ class ContextDrag(val start: () -> Unit, val move: (Float) -> Unit, val end: ()}.pointerInput(reorder, enabled) {if (!enabled) return@pointerInputawaitEachGesture {- if (reorder == null) { tapOrHold(tap, hold); return@awaitEachGesture }- val down = awaitFirstDown()+ // A message's hold counts on its links and buttons too, as the iPhone's context menu: even a press a child took.+ val down = awaitFirstDown(requireUnconsumed = reorder != null)val held = awaitLongPressOrCancellation(down.id)if (held == null) {+ // Not an unconsumed up: a child (a link, a button) took the tap, or the press became a scroll.val up = currentEvent.changes.firstOrNull { it.id == down.id }if (up != null && up.changedToUp() && !up.isConsumed) { up.consume(); tap?.invoke() }return@awaitEachGesture}hold()+ if (reorder == null) {+ // The rest of the press is kept from the child, so a held link opens the menu, not the page.+ do { awaitPointerEvent(PointerEventPass.Initial).changes.forEach { it.consume() } } while (currentEvent.changes.any { it.pressed })+ return@awaitEachGesture+ }var moved = 0fvar started = false// finally: a cancelled gesture (the row left the list, the handler restarted) still ends the drag.@@ -157,26 +168,14 @@ class ContextDrag(val start: () -> Unit, val move: (Float) -> Unit, val end: ()}}}- return onGloballyPositioned { anchor = it.boundsInRoot() }.then(gestures)-}--/**- * A tap, or a hold anywhere on the content, its links and buttons included, as the iPhone's context menu: the press counts- * even when a child took it, and after a hold the rest of it is kept from the child, so a held link opens the menu, not the page.- */-private suspend fun AwaitPointerEventScope.tapOrHold(tap: (() -> Unit)?, hold: () -> Unit) {- awaitFirstDown(requireUnconsumed = false)- try {- val up = withTimeout(viewConfiguration.longPressTimeoutMillis) { waitForUpOrCancellation() }- // null: a child (a link, a button) took the tap, or the press became a scroll.- if (up != null) { up.consume(); tap?.invoke() }- } catch (_: PointerEventTimeoutCancellationException) {- hold()- do {- val event = awaitPointerEvent(PointerEventPass.Initial)- event.changes.forEach { it.consume() }- } while (event.changes.any { it.pressed })- }+ // Keys as a clickable takes them (a row that reorders has none): Enter taps, a held Enter or the Menu key opens the menu.+ val keys = if (reorder != null || !enabled) Modifier else Modifier.onKeyEvent { event ->+ if (event.key !in listOf(Key.Enter, Key.NumPadEnter, Key.DirectionCenter, Key.Menu)) return@onKeyEvent false+ val key = event.nativeKeyEvent+ if (event.type == KeyEventType.KeyUp) { if (event.key == Key.Menu || key.eventTime - key.downTime >= longPress) hold() else tap?.invoke() }+ true+ }.focusable()+ return onGloballyPositioned { anchor = it.boundsInRoot() }.then(gestures).then(keys)}/** The menu panel and its placement around `anchor`. `cover`: grow over the anchor (pull-down menus). */diff --git a/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsx b/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsxindex 9f67a38d..1228b3b3 100644--- a/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsx+++ b/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsx@@ -79,7 +79,7 @@ export function AgentModelPicker({ backend, models, selection, onChange, options<HStack gap={6} className="agent-picker-search">{stage === 'models' && onAgentChange ? <IconButton title="Back" icon="chevron.left" onClick={() => open('agents')} /> : <Icon name="magnifyingglass" size={14} />}<input aria-label={tr(stage === 'agents' ? 'Search agents' : 'Search models')} placeholder={tr(stage === 'agents' ? 'Search agents' : 'Search models')} value={query} onChange={(e) => setQuery(e.target.value)} />- {loading ? <Spinner size={12} /> : <IconButton title="Refresh model list" icon="arrow.clockwise" onClick={models.reload} />}+ {loading ? <Spinner size={12} /> : <IconButton title={failure ? 'Retry model list' : 'Refresh model list'} icon="arrow.clockwise" onClick={models.reload} />}</HStack><div className="agent-picker-list">{choices.map((o) => <button key={o.id} className="agent-picker-item" aria-pressed={o.id === (stage === 'agents' ? backend : value)} onClick={() => pick(o.id)}>