Skip to content

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.

fix(apps): unhide bots everywhere and keep corrected connector keys

leepokaif8cb3ed81068
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/AccountScreenTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/AccountScreenTest.kt
index e888e37b..2a507822 100644
--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/AccountScreenTest.kt
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/AccountScreenTest.kt
@@ -43,7 +43,7 @@ class AccountScreenTest {
compose.onNodeWithText("Account").assertIsDisplayed()
val scan = compose.onNodeWithText("Scan a computer's code").assertIsDisplayed().fetchSemanticsNode().boundsInRoot
val identity = compose.onNodeWithText(first.email).assertIsDisplayed().fetchSemanticsNode().boundsInRoot
- val computers = compose.onNodeWithText("Computers").assertIsDisplayed().fetchSemanticsNode().boundsInRoot
+ val computers = compose.onNodeWithText("Computers & settings").assertIsDisplayed().fetchSemanticsNode().boundsInRoot
assertTrue(scan.bottom < identity.top)
assertTrue(identity.bottom < computers.top)
compose.onNodeWithContentDescription(first.email).assertIsSelected().assertIsNotEnabled()
@@ -54,7 +54,7 @@ class AccountScreenTest {
compose.onNodeWithText("Start over").assertDoesNotExist()
snapshot("signed-in")
compose.onNodeWithText("Scan a computer's code").performClick()
- compose.onNodeWithText("Computers").performClick()
+ compose.onNodeWithText("Computers & settings").performClick()
compose.onNodeWithContentDescription("Close").performClick()
assertTrue(scanned && settings && closed)
}
@@ -95,7 +95,7 @@ class AccountScreenTest {
compose.onNodeWithText("QR pairing only in this build").assertIsDisplayed()
compose.onNodeWithText("Continue with Apple").assertDoesNotExist()
compose.onNodeWithText("Scan a computer's code").assertIsDisplayed()
- compose.onNodeWithText("Computers").assertIsDisplayed()
+ compose.onNodeWithText("Computers & settings").assertIsDisplayed()
snapshot("pairing-only")
}
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/ScreenPresentationTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/ScreenPresentationTest.kt
index 472d33a9..d9291f4f 100644
--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/ScreenPresentationTest.kt
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/ScreenPresentationTest.kt
@@ -37,12 +37,12 @@ class ScreenPresentationTest {
compose.onNodeWithContentDescription("Switch account").performClick()
compose.onNodeWithText("Account").assertIsDisplayed()
snapshot("account-sheet")
- compose.onNodeWithText("Computers").performClick()
- compose.onNodeWithText("Computers & settings").assertIsDisplayed()
+ compose.onNodeWithText("Computers & settings").performClick()
+ compose.onNodeWithText("Pair a computer").performScrollTo().assertIsDisplayed()
back()
- compose.onNodeWithText("Computers & settings").assertDoesNotExist()
+ compose.onNodeWithText("Pair a computer").assertDoesNotExist()
compose.onNodeWithText("Account").assertIsDisplayed()
- compose.onNodeWithText("Computers").performClick()
+ compose.onNodeWithText("Computers & settings").performClick()
compose.onNodeWithText("Pair a computer").performScrollTo().performClick()
compose.onNodeWithText("Install Codync", substring = true).assertIsDisplayed()
back()
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/AccountSwitcherView.kt b/apps/android/app/src/main/kotlin/com/codync/android/AccountSwitcherView.kt
index 6254800d..3a523fec 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/AccountSwitcherView.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/AccountSwitcherView.kt
@@ -80,7 +80,7 @@ import com.kyant.shapes.RoundedRectangle
exit = fadeOut(Motion.fade()) + shrinkVertically(Motion.layoutSize)) { SignInButtons(state, store) }
}
CardSection {
- row { RowLabel("Computers", "desktopcomputer", chevron = true, modifier = Modifier.plainButton(action = showSettings)) }
+ row { RowLabel("Computers & settings", "gearshape", chevron = true, modifier = Modifier.plainButton(action = showSettings)) }
if (current != null) row {
RowLabel("Sign out", "rectangle.portrait.and.arrow.right", Palette.danger,
modifier = Modifier.plainButton(enabled = !busy) { confirmSignOut = true })
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/ConnectorSheets.kt b/apps/android/app/src/main/kotlin/com/codync/android/ConnectorSheets.kt
index 4489a402..e24e88dd 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/ConnectorSheets.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/ConnectorSheets.kt
@@ -43,8 +43,8 @@ import kotlinx.coroutines.launch
saving = true; error = null
scope.launch {
try {
- val connector = installed?.let { known -> store.installedConnectors().firstOrNull { it.id == known.id } ?: known }
- ?: store.installConnector(item, choice, values).also { installed = it; values = emptyMap() }
+ // The host keeps the connector a try saved unless new values or another way to run it come in.
+ val connector = store.installConnector(item, choice, values).also { installed = it; values = emptyMap() }
if (connector.needsSignIn) {
// The store finishes a chat's request itself once the sign-in comes back.
signingIn = true
@@ -59,7 +59,8 @@ import kotlinx.coroutines.launch
}
// Nothing to fill in: it adds itself.
LaunchedEffect(item.name) { if (item.options.size == 1 && item.options[0].inputs.isEmpty()) install() }
- val ready = installed != null || option?.complete(values) == true
+ // After a try that failed, Add with nothing typed tries the connector it saved again.
+ val ready = option?.complete(values) == true || (installed != null && values.values.all { it.isEmpty() })
Column(Modifier.fillMaxSize().background(Palette.background)) {
ModalHeader("Add connector") {
if (saving) Box(Modifier.size(36.dp), contentAlignment = Alignment.Center) { Spinner() }
diff --git a/apps/desktop/src/renderer/store/app-model.ts b/apps/desktop/src/renderer/store/app-model.ts
index 31ff010e..aa400ee5 100644
--- a/apps/desktop/src/renderer/store/app-model.ts
+++ b/apps/desktop/src/renderer/store/app-model.ts
@@ -152,11 +152,20 @@ export class AppModel extends Observable {
/** Every computer's visible bots, computer by computer, each in its roster order. */
get roster(): RosterItem[] {
+ return this.botsOnEveryComputer((store) => store.roster)
+ }
+
+ /** Every computer's bots hidden from the roster, computer by computer, by name. */
+ get hiddenBots(): RosterItem[] {
+ return this.botsOnEveryComputer((store) => store.hiddenBots)
+ }
+
+ private botsOnEveryComputer(bots: (store: BotStore) => Bot[]): RosterItem[] {
const items: RosterItem[] = []
for (const computer of this.computers) {
const store = this.stores.get(computer.id)
if (!store) continue
- for (const bot of store.roster) items.push({ ref: { computerId: computer.id, botId: bot.id }, bot, computer: store.computer, store })
+ for (const bot of bots(store)) items.push({ ref: { computerId: computer.id, botId: bot.id }, bot, computer: store.computer, store })
}
return items
}
diff --git a/apps/desktop/src/renderer/views/marketplace/ConnectorSheets.tsx b/apps/desktop/src/renderer/views/marketplace/ConnectorSheets.tsx
index 196dd144..0f922c08 100644
--- a/apps/desktop/src/renderer/views/marketplace/ConnectorSheets.tsx
+++ b/apps/desktop/src/renderer/views/marketplace/ConnectorSheets.tsx
@@ -21,6 +21,8 @@ export function InstallConnectorSheet({ item, requestId, done }: { item: MarketC
const started = useRef(false)
const option = item.options.find((o) => o.id === optionId) ?? item.options[0]
const value = (input: MarketInput) => values[input.name] ?? ''
+ // After a try that failed, Add with nothing typed tries the connector it saved again.
+ const retrying = installed !== null && !Object.values(values).some((v) => v !== '')
const install = async () => {
if (!option) return
@@ -28,13 +30,10 @@ export function InstallConnectorSheet({ item, requestId, done }: { item: MarketC
setError(null)
try {
const client = await store.ready()
- let c: InstalledConnector
- if (installed) c = (await market.connectors(client)).find((x) => x.id === installed.id) ?? installed
- else {
- c = await plugins.installConnector(item, option.id, values)
- setInstalled(c)
- setValues({})
- }
+ // The host keeps the connector a try saved unless new values or another way to run it come in.
+ const c = await plugins.installConnector(item, option.id, values)
+ setInstalled(c)
+ setValues({})
if (needsSignIn(c)) await plugins.signIn(c.id)
if (requestId) await market.finishConnectionRequest(client, requestId, { connectorId: c.id })
else await market.verifyConnector(client, c.id)
@@ -61,7 +60,7 @@ export function InstallConnectorSheet({ item, requestId, done }: { item: MarketC
<ModalHeader
icon="point.3.connected.trianglepath.dotted"
title={tr(`Add connector`)}
- trailing={saving ? <Spinner /> : <IconButton title="Add" icon="plus" disabled={installed === null && missing} onClick={() => void install()} />}
+ trailing={saving ? <Spinner /> : <IconButton title="Add" icon="plus" disabled={missing && !retrying} onClick={() => void install()} />}
/>
<CardForm>
<CardSection>
diff --git a/apps/desktop/src/renderer/views/settings/HiddenBotsSection.tsx b/apps/desktop/src/renderer/views/settings/HiddenBotsSection.tsx
new file mode 100644
index 00000000..1a83df00
--- /dev/null
+++ b/apps/desktop/src/renderer/views/settings/HiddenBotsSection.tsx
@@ -0,0 +1,31 @@
+import { BotAvatar } from '../../components/Avatar'
+import { CardSection, IconButton } from '../../components/Controls'
+import { VStack } from '../../components/Stack'
+import { Text } from '../../components/Text'
+import { useModels } from '../../lib/observable'
+import { refKey } from '../../store/app-model'
+import { useApp } from '../../store/context'
+import { Reveal } from './parts'
+
+/** Bots hidden from the sidebar on every computer, each with Unhide (the iPhone's Hidden bots). */
+export function HiddenBotsSection() {
+ const app = useApp()
+ useModels([...app.stores.values()])
+ const hidden = app.hiddenBots
+ return (
+ <Reveal show={hidden.length > 0}>
+ <CardSection title="Hidden bots">
+ {hidden.map(({ ref, bot, store }) => (
+ <div key={refKey(ref)} className="settings-row">
+ <BotAvatar bot={bot} size={28} animated={false} />
+ <VStack grow className="settings-stack">
+ <Text truncate>{bot.name}</Text>
+ <Text size="caption" tone="tertiary">{store.hostName}</Text>
+ </VStack>
+ <IconButton title="Unhide" icon="eye" onClick={() => store.setHidden(bot, false)} />
+ </div>
+ ))}
+ </CardSection>
+ </Reveal>
+ )
+}
diff --git a/apps/desktop/src/renderer/views/settings/SettingsView.tsx b/apps/desktop/src/renderer/views/settings/SettingsView.tsx
index 51e89a37..739d530e 100644
--- a/apps/desktop/src/renderer/views/settings/SettingsView.tsx
+++ b/apps/desktop/src/renderer/views/settings/SettingsView.tsx
@@ -24,6 +24,7 @@ import { VoiceChatSettingsView } from './VoiceChatSettingsView'
import { ComputerAccessView } from '../computer-access/ComputerAccessView'
import { FormSheet } from '../marketplace/pieces'
import { AnalyticsSheet } from './AnalyticsSheet'
+import { HiddenBotsSection } from './HiddenBotsSection'
/** The chat window's Settings: pages in a sidebar, ChatGPT's settings layout. */
export type SettingsPage = 'general' | 'computers' | 'access' | 'voice' | 'usage' | 'updates'
@@ -217,6 +218,7 @@ function GeneralSettings() {
</Switch>
</CardSection>
<PrivacySettings />
+ <HiddenBotsSection />
</CardForm>
)
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Marketplace/InstallConnectorSheet.swift b/apps/ios/Kit/Sources/CodyncUI/Marketplace/InstallConnectorSheet.swift
index 25d5b6eb..159db25c 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Marketplace/InstallConnectorSheet.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Marketplace/InstallConnectorSheet.swift
@@ -21,6 +21,13 @@ struct InstallConnectorSheet: View {
item.options.first { $0.id == optionId } ?? item.options.first
}
+ private var missing: Bool {
+ option?.inputs.contains { $0.required && (values[$0.name] ?? $0.default ?? "").isEmpty } ?? true
+ }
+
+ /// After a try that failed, Add with nothing typed tries the connector it saved again.
+ private var retrying: Bool { installed != nil && !values.values.contains { !$0.isEmpty } }
+
var body: some View {
VStack(spacing: 0) {
ModalHeader("Add connector") {
@@ -28,7 +35,7 @@ struct InstallConnectorSheet: View {
Spinner()
} else {
IconButton("Add", systemImage: "plus") { install() }
- .disabled(installed == nil && (option?.inputs.contains { $0.required && (values[$0.name] ?? $0.default ?? "").isEmpty } ?? true))
+ .disabled(missing && !retrying)
}
}
form
@@ -108,13 +115,10 @@ struct InstallConnectorSheet: View {
Task {
do {
guard let client = model.client else { return }
- let c: InstalledConnector
- if let installed { c = try await client.connectors().first(where: { $0.id == installed.id }) ?? installed }
- else {
- c = try await model.installConnector(item, option: option.id, inputs: values)
- installed = c
- values.removeAll()
- }
+ // The host keeps the connector a try saved unless new values or another way to run it come in.
+ let c = try await model.installConnector(item, option: option.id, inputs: values)
+ installed = c
+ values.removeAll()
if c.needsSignIn {
try await ConnectorSignInFlow(model: model, webAuthenticationSession: webAuthenticationSession, openURL: openURL).signIn(c.id)
}
diff --git a/apps/ios/Views/AccountSwitcherView.swift b/apps/ios/Views/AccountSwitcherView.swift
index 54af2e4b..0bd4cd3c 100644
--- a/apps/ios/Views/AccountSwitcherView.swift
+++ b/apps/ios/Views/AccountSwitcherView.swift
@@ -55,7 +55,7 @@ struct AccountSwitcherView: View {
CardSection {
Button { showSettings = true } label: {
- RowLabel("Computers", systemImage: "desktopcomputer", chevron: true)
+ RowLabel("Computers & settings", systemImage: "gearshape", chevron: true)
}
.buttonStyle(.plain)
if account.isSignedIn {
diff --git a/docs/features/connector-credentials.md b/docs/features/connector-credentials.md
index a2c06702..82da9336 100644
--- a/docs/features/connector-credentials.md
+++ b/docs/features/connector-credentials.md
@@ -49,6 +49,12 @@ and stops the check process. It never invokes a business tool. Failures and a
90-second timeout remain visible and retryable. Package acquisition is performed
by the configured runtime (npx, uvx, Docker, etc.), so that runtime must be present.
+Installing a registry connector that is already installed (Add again after a failed
+check, or Connect on a request card) keeps it as it is when nothing new is typed and
+it would run the same way, so its sign-in survives. New values or another way to run
+it (package runtime or hosted) rebuild it in place, under the same id, so each bot
+keeps it on or off as before (`install_server` in `host/src/market/install.rs`).
+
## Conversation requests
The built-in `connectors` MCP offers search_connectors, list_connectors,
diff --git a/docs/guides/connector-verification.md b/docs/guides/connector-verification.md
index 75b85e3f..e4ec0ea7 100644
--- a/docs/guides/connector-verification.md
+++ b/docs/guides/connector-verification.md
@@ -65,12 +65,10 @@ iOS, Electron or terminal installation UI, log into real provider accounts,
exercise the phone's OAuth deep link, Composio, 1Password, Linux Secret Service,
or the older separate GET-stream/POST-message SSE transport.
-Source inspection on 2026-10-05 found these outstanding UI/workflow issues:
+Source inspection on 2026-10-05 found this outstanding workflow issue (the install
+forms' retry, which kept the connector saved with the first values, was fixed in 2.25.0:
+the host now rebuilds an installed registry connector when new values come in):
-- The iOS and desktop registry install forms retain the installed connector after
- verification fails. Retrying reads that saved connector and ignores changed
- setup input. The credential settings API tested here can correct existing
- fields, but that does not fix the install form.
- Custom/import installation on iOS and desktop, and marketplace installation in
the terminal, can finish without running `connectorVerify`. The host enables
newly installed connectors before readiness is verified. Saving successfully
diff --git a/host/src/market/install.rs b/host/src/market/install.rs
index a5b3d0d6..ef783b9b 100644
--- a/host/src/market/install.rs
+++ b/host/src/market/install.rs
@@ -145,18 +145,45 @@ pub(super) fn package_reference(p: &Value) -> Result<String> {
Ok(if p["registryType"] == "pypi" { format!("{id}=={version}") } else { format!("{id}@{version}") })
}
+/// The command that runs a registry package.
+fn package_command(p: &Value) -> Option<&'static str> {
+ match p["registryType"].as_str()? {
+ "npm" => Some("npx"),
+ "pypi" => Some("uvx"),
+ "oci" => Some("docker"),
+ "nuget" => Some("dnx"),
+ _ => None,
+ }
+}
+
/// Installs a registry server with the user's inputs (`{NAME: value}`).
pub async fn install_connector(store: &crate::store::Store, name: &str, option: &str, inputs: &Value) -> Result<Value> {
- let server = registry_server(name).await?;
+ install_server(store, &registry_server(name).await?, name, option, inputs).await
+}
+
+/// A server that's installed already stays as it is when the call brings no values and runs it the
+/// same way (Add again after its sign-in or check failed); otherwise it's rebuilt with the new ones.
+async fn install_server(
+ store: &crate::store::Store,
+ server: &Value,
+ name: &str,
+ option: &str,
+ inputs: &Value,
+) -> Result<Value> {
let input = |k: &str| inputs[k].as_str().filter(|v| !v.is_empty()).map(str::to_owned);
let (kind, index) = option.split_once(':').ok_or_else(|| anyhow!("unknown install option"))?;
let index: usize = index.parse()?;
let all = connectors(store)?;
- if let Some(c) = all.iter().find(|c| c.registry_name.as_deref() == Some(name)) {
+ let typed = inputs.as_object().is_some_and(|m| m.values().any(|v| v.as_str().is_some_and(|s| !s.is_empty())));
+ let command = if kind == "package" { package_command(&server["packages"][index]) } else { None };
+ if let Some(c) = all.iter().find(|c| c.registry_name.as_deref() == Some(name))
+ && !typed
+ && c.command.as_deref() == command
+ {
return Ok(c.public());
}
let title =
- listing(&server, &all).and_then(|l| l["title"].as_str().map(str::to_owned)).unwrap_or_else(|| name.into());
+ listing(server, &all).and_then(|l| l["title"].as_str().map(str::to_owned)).unwrap_or_else(|| name.into());
let mut c = Connector {
id: unique_id(&title, &all.iter().map(|c| c.id.clone()).collect::<Vec<_>>()),
name: title,
@@ -185,18 +212,17 @@ pub async fn install_connector(store: &crate::store::Store, name: &str, option:
}
let runtime = arguments(&p["runtimeArguments"], &input)?;
let package = arguments(&p["packageArguments"], &input)?;
- let (command, mut args) = match p["registryType"].as_str() {
- Some("npm") => ("npx", vec!["-y".to_owned()]),
- Some("pypi") => ("uvx", vec![]),
- Some("oci") => {
+ let command = command.ok_or_else(|| anyhow!("this package type isn't supported"))?;
+ let mut args = match command {
+ "npx" => vec!["-y".to_owned()],
+ "docker" => {
let mut args = vec!["run".to_owned(), "-i".into(), "--rm".into()];
for k in c.env.keys() {
args.extend(["-e".into(), k.clone()]);
}
- ("docker", args)
+ args
}
- Some("nuget") => ("dnx", vec![]),
- _ => bail!("this package type isn't supported"),
+ _ => vec![],
};
// Runtime arguments come before the package; skip flags we already pass.
for a in runtime {
@@ -365,6 +391,30 @@ pub fn remove_connector(store: &crate::store::Store, id: &str) -> Result<()> {
mod tests {
use super::*;
+ #[tokio::test]
+ async fn installing_again_with_new_values_rebuilds_the_connector_in_place() {
+ let store = crate::store::Store::open(std::path::Path::new(":memory:")).expect("store");
+ let package = |kind: &str| {
+ json!({"registryType": kind, "identifier": "server", "version": "1.0.0",
+ "environmentVariables": [{"name": "API_KEY", "isRequired": kind == "npm"}]})
+ };
+ let name = "io.example/server";
+ let server = json!({"name": name, "packages": [package("npm"), package("pypi")]});
+ let only = || connectors(&store).expect("read").pop().expect("one connector");
+ let first =
+ install_server(&store, &server, name, "package:0", &json!({"API_KEY": "wrong"})).await.expect("add");
+ install_server(&store, &server, name, "package:0", &json!({"API_KEY": "right"})).await.expect("new key");
+ // Add again with nothing typed keeps it (and its sign-in) as it is.
+ install_server(&store, &server, name, "package:0", &json!({"API_KEY": ""})).await.expect("retry");
+ assert_eq!(
+ (only().id, only().env["API_KEY"].clone()),
+ (first["id"].as_str().expect("id").to_owned(), "right".into())
+ );
+ install_server(&store, &server, name, "package:1", &json!({})).await.expect("another runtime");
+ assert_eq!(only().command.as_deref(), Some("uvx"));
+ assert_eq!(connectors(&store).expect("read").len(), 1);
+ }
+
#[test]
fn oci_references_do_not_need_a_separate_package_version() {
for id in [
diff --git a/host/src/market/mod.rs b/host/src/market/mod.rs
index a9c4c3a0..e1d2358f 100644
--- a/host/src/market/mod.rs
+++ b/host/src/market/mod.rs
@@ -264,9 +264,12 @@ pub fn update_connectors<T>(
fn add_connector(store: &crate::store::Store, mut c: Connector) -> Result<Value> {
update_connectors(store, |all| {
+ // A registry server is installed once: installing it again replaces it under the id the bots know.
if let Some(name) = c.registry_name.as_deref()
- && let Some(existing) = all.iter().find(|x| x.registry_name.as_deref() == Some(name))
+ && let Some(existing) = all.iter_mut().find(|x| x.registry_name.as_deref() == Some(name))
{
+ c.id.clone_from(&existing.id);
+ *existing = c;
return Ok(existing.public());
}
c.id = unique_id(&c.name, &all.iter().map(|c| c.id.clone()).collect::<Vec<_>>());
diff --git a/host/src/tui/app/overlay_keys.rs b/host/src/tui/app/overlay_keys.rs
index 307a9def..4d74b82f 100644
--- a/host/src/tui/app/overlay_keys.rs
+++ b/host/src/tui/app/overlay_keys.rs
@@ -24,6 +24,12 @@ impl App {
});
let mut items: Vec<GotoItem> = bots.into_iter().map(|b| GotoItem::Bot(b.id.clone())).collect();
if want.is_none() {
+ // First among the actions, so they show without scrolling past the long list.
+ let unhide = super::super::l10n::tr("Unhide");
+ let mut hidden: Vec<&Bot> =
+ self.bots.values().filter(|b| b.hidden && fuzzy(q, &[&b.name, "Unhide", unhide.as_ref()])).collect();
+ hidden.sort_by(|a, b| a.name.cmp(&b.name));
+ items.extend(hidden.into_iter().map(|b| GotoItem::Unhide(b.id.clone())));
items.extend(
ACTIONS
.iter()
@@ -161,6 +167,9 @@ impl App {
self.start_typing();
}
Some(GotoItem::Action(a)) => self.run_action(*a),
+ Some(GotoItem::Unhide(id)) => {
+ self.call("updateBot", json!({"id": id, "hidden": false}), After::Nothing);
+ }
None => {}
}
return None;
@@ -238,3 +247,28 @@ impl App {
}
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::super::{Bot, Editor, Goto, GotoItem, test_app};
+ use serde_json::json;
+
+ #[tokio::test]
+ async fn the_palette_offers_to_unhide_hidden_bots() {
+ let mut app = test_app();
+ for (id, hidden) in [("shown", false), ("hidden", true)] {
+ let bot = Bot::parse(&json!({"id": id, "name": id, "hidden": hidden})).expect("a bot with an id parses");
+ app.bots.insert(id.into(), bot);
+ }
+ let g = Goto { query: Editor::default(), filter: 0, cursor: 0 };
+ let unhide: Vec<String> = app
+ .goto_items(&g)
+ .into_iter()
+ .filter_map(|i| match i {
+ GotoItem::Unhide(id) => Some(id),
+ _ => None,
+ })
+ .collect();
+ assert_eq!(unhide, ["hidden"]);
+ }
+}
diff --git a/host/src/tui/app/ui.rs b/host/src/tui/app/ui.rs
index f3514011..6ed84f95 100644
--- a/host/src/tui/app/ui.rs
+++ b/host/src/tui/app/ui.rs
@@ -84,6 +84,8 @@ pub const ACTIONS: [(&str, &str, Action); 16] = [
pub enum GotoItem {
Bot(String),
Action(Action),
+ /// Shows a hidden bot in the roster again.
+ Unhide(String),
}
pub struct Goto {
diff --git a/host/src/tui/view/goto.rs b/host/src/tui/view/goto.rs
index aa1bf665..e7a3a6df 100644
--- a/host/src/tui/view/goto.rs
+++ b/host/src/tui/view/goto.rs
@@ -2,7 +2,7 @@
use ratatui::buffer::Buffer;
use ratatui::layout::Rect;
-use ratatui::style::Modifier;
+use ratatui::style::{Modifier, Style};
use super::super::app::{ACTIONS, Action, App, Click, FILTERS, GotoItem, Mark};
use super::super::l10n::tr;
@@ -70,28 +70,16 @@ pub(super) fn goto(buf: &mut Buffer, area: Rect, app: &mut App, g: &super::super
let room = inner.width.saturating_sub(47);
put(buf, inner.x + 47, y, room, &truncate(&pv, usize::from(room)), ps.patch(base));
}
+ GotoItem::Unhide(id) => {
+ let style = action_row(buf, inner, list_top, &mut y, &mut shown_actions, sel);
+ let name = app.bots.get(id).map_or("", |b| b.name.as_str());
+ put(buf, inner.x + 2, y, inner.width, &format!("{} {name}", tr("Unhide")), style);
+ }
GotoItem::Action(a) => {
- if !shown_actions {
- shown_actions = true;
- if y > list_top {
- y += 1;
- }
- put(
- buf,
- inner.x,
- y,
- inner.width,
- tr("ACTIONS").as_ref(),
- t.dim.patch(t.panel).add_modifier(Modifier::BOLD),
- );
- y += 1;
- }
- if sel {
- restyle(buf, Rect::new(inner.x - 1, y, inner.width + 2, 1), t.sel);
- }
+ let style = action_row(buf, inner, list_top, &mut y, &mut shown_actions, sel);
if let Some((label, key, _)) = ACTIONS.iter().find(|x| x.2 == *a) {
let shown = tr(label);
- put(buf, inner.x + 2, y, inner.width, &shown, if sel { t.bold } else { t.secondary }.patch(base));
+ put(buf, inner.x + 2, y, inner.width, &shown, style);
let language = super::super::l10n::language_title();
let hint = match (a, app.analytics) {
(Action::Analytics, Some(true)) => "on",
@@ -133,3 +121,23 @@ pub(super) fn goto(buf: &mut Buffer, area: Rect, app: &mut App, g: &super::super
t.dim.patch(t.panel),
);
}
+
+/// Starts an ACTIONS row: the section's title above the first one, the selection behind it.
+/// Returns the label's style.
+fn action_row(buf: &mut Buffer, inner: Rect, list_top: u16, y: &mut u16, titled: &mut bool, sel: bool) -> Style {
+ let t = theme();
+ if !*titled {
+ *titled = true;
+ if *y > list_top {
+ *y += 1;
+ }
+ put(buf, inner.x, *y, inner.width, tr("ACTIONS").as_ref(), t.dim.patch(t.panel).add_modifier(Modifier::BOLD));
+ *y += 1;
+ }
+ if sel {
+ restyle(buf, Rect::new(inner.x - 1, *y, inner.width + 2, 1), t.sel);
+ t.bold.patch(t.sel)
+ } else {
+ t.secondary.patch(t.panel)
+ }
+}