Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

The server's link catalogue knows Settings' and Admin's new tabs

Simon Flackfa5a97db21b5
diff --git a/core/switch_core/deeplinks.py b/core/switch_core/deeplinks.py
index ec5179b0d..426532692 100644
--- a/core/switch_core/deeplinks.py
+++ b/core/switch_core/deeplinks.py
@@ -149,11 +149,15 @@ class ConsolePage:
`name` is how the page is named in words, for a reader who cannot click
through; `tabs` maps each tab the page has to its own name.
+ `former_tabs` maps tabs the page had before to the tab each became, so a
+ link an agent wrote from older instructions still reads (`formerTabs` in
+ Switch Console's catalogue).
"""
name: str
has_id: bool = False
tabs: Mapping[str, str] = field(default_factory=dict)
+ former_tabs: Mapping[str, str] = field(default_factory=dict)
# Switch Console's link catalogue (`CONSOLE_PAGES` in
@@ -199,18 +203,28 @@ CONSOLE_PAGES: Mapping[str, ConsolePage] = {
"admin": ConsolePage(
"the workspace's admin page",
tabs={
+ "messaging-apps": "the workspace's messaging apps",
"connectors": "the connectors the workspace offers",
+ "switch-trust": "the server's Switch Trust guardrails",
"apps": "the apps connectors sign in through",
},
),
"settings": ConsolePage(
"Switch Console's settings",
tabs={
- "general": "Switch Console's general settings",
- "clis-models": "Switch Console's CLIs and models settings",
- "remote-hosts": "Switch Console's remote hosts settings",
+ "preferences": "Switch Console's preferences",
+ "messaging-apps": "your messaging app accounts",
+ "clis-models": "Switch Console's agent providers",
+ "api-keys": "your API keys",
+ "devices": "your devices",
"managed-agents": "Switch Console's managed agents settings",
- "interface": "Switch Console's interface settings",
+ "status": "the system status",
+ "account": "your account",
+ },
+ former_tabs={
+ "general": "preferences",
+ "interface": "preferences",
+ "remote-hosts": "devices",
},
),
}
@@ -234,7 +248,7 @@ class ConsoleLink:
def page_name(self) -> str:
spec = CONSOLE_PAGES[self.page]
if self.tab is not None:
- return spec.tabs[self.tab]
+ return spec.tabs[spec.former_tabs.get(self.tab, self.tab)]
return spec.name
@property
@@ -268,7 +282,8 @@ def parse_console_link_path(path: str, query: str) -> ConsoleLink | None:
return None
tabs = parse_qs(query, keep_blank_values=True).get("tab")
tab = tabs[0] if tabs else None
- if tab is not None and tab not in CONSOLE_PAGES[page].tabs:
+ spec = CONSOLE_PAGES[page]
+ if tab is not None and tab not in spec.tabs and tab not in spec.former_tabs:
return None
return ConsoleLink(page=page, id=page_id, tab=tab, query=query)
diff --git a/core/tests/switch_core/test_deeplinks.py b/core/tests/switch_core/test_deeplinks.py
index dd15fe53c..ba38732fb 100644
--- a/core/tests/switch_core/test_deeplinks.py
+++ b/core/tests/switch_core/test_deeplinks.py
@@ -204,6 +204,13 @@ class TestConsoleCatalogue:
class TestParseConsoleLink:
"""The same rules Switch Console reads a link by (`parseConsoleLink`)."""
+ def test_reads_a_tab_the_page_had_before_as_the_one_it_became(self) -> None:
+ link = parse_console_link("switchdash://open/settings?tab=remote-hosts")
+ assert link is not None
+ assert link.tab == "remote-hosts"
+ assert link.page_name == "your devices"
+ assert parse_console_link("switchdash://open/settings?tab=browser") is None
+
def test_reads_a_page_its_id_and_its_tab(self) -> None:
link = parse_console_link("switchdash://open/agent/a-1?tab=settings&server=x")
assert link is not None