feat(webui): unify the Apps catalog (#6700)

* feat(webui): unify the Apps catalog

* fix(webui): serve all channel branding locally

* fix(webui): refine Apps navigation and sidebar
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-18 15:05:57 +08:00
1 parent 5997a714f2
commit 2b232c9133
89 files changed
+1576 -1024

No files matched your search

-1
View File
@@ -3,7 +3,6 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://img.alicdn.com/imgextra/i3/O1CN01WMvMRG1ks3Ixc9x1v_!!6000000004738-55-tps-32-32.svg",
displayName: "DingTalk", displayName: "DingTalk",
initials: "DT", initials: "DT",
color: "#1677FF", color: "#1677FF",
+1 -1
View File
@@ -3,7 +3,7 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://discord.com/favicon.ico", logoUrl: "/brand/channels/discord.svg",
displayName: "Discord", displayName: "Discord",
initials: "DC", initials: "DC",
color: "#5865F2", color: "#5865F2",
-2
View File
@@ -18,8 +18,6 @@ export default {
}, },
}, },
presentation: { presentation: {
logoUrl: "https://www.larksuite.com/favicon.ico",
logoLayout: "tile",
displayName: "Feishu", displayName: "Feishu",
initials: "FS", initials: "FS",
color: "#3370FF", color: "#3370FF",
+1 -2
View File
@@ -18,8 +18,7 @@ export default {
displayName: "Linear", displayName: "Linear",
initials: "LI", initials: "LI",
color: "#5E6AD2", color: "#5E6AD2",
logoUrl: "https://linear.app/favicon.ico", logoUrl: "/brand/channels/linear.svg",
logoLayout: "tile",
setup: { setup: {
mode: "connect", mode: "connect",
docsUrl: chatAppGuideUrl("linear"), docsUrl: chatAppGuideUrl("linear"),
+1 -1
View File
@@ -3,7 +3,7 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://matrix.org/favicon.ico", logoUrl: "/brand/channels/matrix.svg",
displayName: "Matrix", displayName: "Matrix",
initials: "MX", initials: "MX",
color: "#0DBD8B", color: "#0DBD8B",
+1 -1
View File
@@ -3,7 +3,7 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://mattermost.com/favicon.ico", logoUrl: "/brand/channels/mattermost.svg",
displayName: "Mattermost", displayName: "Mattermost",
initials: "MM", initials: "MM",
color: "#1C58D9", color: "#1C58D9",
-1
View File
@@ -3,7 +3,6 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://mochat.io/favicon.ico",
displayName: "MoChat", displayName: "MoChat",
initials: "MC", initials: "MC",
color: "#111827", color: "#111827",
-1
View File
@@ -3,7 +3,6 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://teams.public.onecdn.static.microsoft/evergreen-assets/icons/microsoft_teams_logo_refresh_v2025.ico",
displayName: "Microsoft Teams", displayName: "Microsoft Teams",
initials: "MS", initials: "MS",
color: "#6264A7", color: "#6264A7",
-1
View File
@@ -3,7 +3,6 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://napneko.github.io/assets/newnewlogo.png",
displayName: "NapCat", displayName: "NapCat",
initials: "NC", initials: "NC",
color: "#F97316", color: "#F97316",
+1 -2
View File
@@ -11,8 +11,7 @@ export default {
ConnectFlow: QQConnectFlow, ConnectFlow: QQConnectFlow,
canConnectBeforeConfigured: true, canConnectBeforeConfigured: true,
presentation: { presentation: {
logoUrl: "https://static-res.qq.com/static-res/imqq/qq-logo.png", logoUrl: "/brand/channels/qq.svg",
logoFallbackUrl: "https://im.qq.com/favicon.ico",
displayName: "QQ", displayName: "QQ",
initials: "QQ", initials: "QQ",
color: "#12B7F5", color: "#12B7F5",
+1 -1
View File
@@ -3,7 +3,7 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://signal.org/favicon.ico", logoUrl: "/brand/channels/signal.svg",
displayName: "Signal", displayName: "Signal",
initials: "SG", initials: "SG",
color: "#3A76F0", color: "#3A76F0",
-1
View File
@@ -40,7 +40,6 @@ settings:
export default { export default {
presentation: { presentation: {
logoUrl: "https://slack.com/favicon.ico",
displayName: "Slack", displayName: "Slack",
initials: "SL", initials: "SL",
color: "#4A154B", color: "#4A154B",
+1 -1
View File
@@ -3,7 +3,7 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://telegram.org/favicon.ico", logoUrl: "/brand/channels/telegram.svg",
displayName: "Telegram", displayName: "Telegram",
initials: "TG", initials: "TG",
color: "#229ED9", color: "#229ED9",
-1
View File
@@ -3,7 +3,6 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://work.weixin.qq.com/favicon.ico",
displayName: "WeCom", displayName: "WeCom",
initials: "WC", initials: "WC",
color: "#2F7DFF", color: "#2F7DFF",
+1 -1
View File
@@ -25,7 +25,7 @@ export default {
wechat: {}, wechat: {},
}, },
presentation: { presentation: {
logoUrl: "https://weixin.qq.com/favicon.ico", logoUrl: "/brand/channels/wechat.svg",
displayName: "WeChat", displayName: "WeChat",
initials: "WX", initials: "WX",
color: "#07C160", color: "#07C160",
+1 -1
View File
@@ -7,7 +7,7 @@ import { WhatsAppConnectFlow } from "./WhatsAppConnectFlow";
export default { export default {
presentation: { presentation: {
logoUrl: "https://static.whatsapp.net/rsrc.php/y1/r/FJbTMJqMap7.svg", logoUrl: "/brand/channels/whatsapp.svg",
displayName: "WhatsApp", displayName: "WhatsApp",
initials: "WA", initials: "WA",
color: "#25D366", color: "#25D366",
@@ -5,7 +5,7 @@ import { chatAppGuideUrl } from "@/channel-plugins/catalog";
export default { export default {
presentation: { presentation: {
logoUrl: "https://static.whatsapp.net/rsrc.php/y1/r/FJbTMJqMap7.svg", logoUrl: "/brand/channels/whatsapp.svg",
displayName: "WhatsApp Agent Platform", displayName: "WhatsApp Agent Platform",
initials: "WA", initials: "WA",
color: "#25D366", color: "#25D366",
+2
View File
@@ -29,6 +29,8 @@ Every channel registration has a preview. Channels with shared configuration for
Channel fixture fields, defaults, and requirements come from the Python channel setup contracts. Regenerate `src/dev/gallery/channel-fixtures.ts` with `python webui/src/dev/gallery/generate_channel_fixtures.py` from the repository root after changing those contracts; add `--check` to verify the snapshot. This developer command loads channel descriptors without starting a gateway. Running the gallery uses the committed snapshot and requires no Python process. Channel fixture fields, defaults, and requirements come from the Python channel setup contracts. Regenerate `src/dev/gallery/channel-fixtures.ts` with `python webui/src/dev/gallery/generate_channel_fixtures.py` from the repository root after changing those contracts; add `--check` to verify the snapshot. This developer command loads channel descriptors without starting a gateway. Running the gallery uses the committed snapshot and requires no Python process.
Bundled channel marks in `public/brand/channels/` use the SVG paths and brand colors from [Simple Icons v16.38.0](https://github.com/simple-icons/simple-icons/tree/16.38.0) ([CC0](https://github.com/simple-icons/simple-icons/blob/16.38.0/LICENSE.md); trademarks belong to their respective owners). Channel packages select a bundled mark or keep their built-in icon or initials. Channel branding does not fetch remote favicons; account avatars supplied by a connected service are separate.
## Where components belong ## Where components belong
| Location | Ownership | Examples | | Location | Ownership | Examples |
+1 -1
View File
@@ -45,7 +45,7 @@ export function AppsFixture() {
return <main className="mx-auto max-w-4xl p-6" style={connectionLayout ? { maxWidth: 800 } : undefined}><AppsCatalogSettings return <main className="mx-auto max-w-4xl p-6" style={connectionLayout ? { maxWidth: 800 } : undefined}><AppsCatalogSettings
cliApps={{ apps: [], installed_count: 0 }} cliApps={{ apps: [], installed_count: 0 }}
mcpPresets={{ presets, installed_count: connectionLayout ? Number(parameters.has("runtime")) : managing ? 0 : 3 }} mcpPresets={{ presets, installed_count: connectionLayout ? Number(parameters.has("runtime")) : managing ? 0 : 3 }}
cliAppsLoading={false} mcpPresetsLoading={false} query="" filter={managing || connectionLayout ? "mcp" : "ready"} cliAppsLoading={false} mcpPresetsLoading={false} query="" filter={{ kind: managing || connectionLayout ? "mcp" : "all", status: managing || connectionLayout ? "all" : "ready" }}
cliActionKey={null} mcpActionKey={null} cliActionKey={null} mcpActionKey={null}
mcpOAuthFlow={connecting ? { flow_id: "fixture", name: "linear", status: "authorization_required", expires_in: 300 } : null} mcpOAuthFlow={connecting ? { flow_id: "fixture", name: "linear", status: "authorization_required", expires_in: 300 } : null}
mcpOAuthPopupBlocked={false} mcpOAuthPopupBlocked={false}
+22 -9
View File
@@ -1,8 +1,10 @@
import { useState } from "react"; import { useState } from "react";
import { useTranslation } from "react-i18next";
import { FilePreviewPanelView } from "@/components/FilePreviewPanelView"; import { FilePreviewPanelView } from "@/components/FilePreviewPanelView";
import { SkillsCatalogSettings } from "@/components/settings/SkillsCatalogSettings"; import { SkillsCatalogSettings } from "@/components/settings/SkillsCatalogSettings";
import { SkillsMarketplace } from "@/components/settings/SkillsMarketplace"; import { MarketplaceProviderFilter, SkillsMarketplace } from "@/components/settings/SkillsMarketplace";
import { CatalogControls, CatalogSearch, CatalogToolbar } from "@/components/settings/shared/CatalogToolbar";
import { ModelIdPicker } from "@/components/settings/shared/ModelControls"; import { ModelIdPicker } from "@/components/settings/shared/ModelControls";
import { AppsCatalogSettings, DEFAULT_CUSTOM_MCP_FORM } from "@/components/settings/system/AppsSettings"; import { AppsCatalogSettings, DEFAULT_CUSTOM_MCP_FORM } from "@/components/settings/system/AppsSettings";
import { ChannelsSettings } from "@/components/settings/system/ChannelsSettings"; import { ChannelsSettings } from "@/components/settings/system/ChannelsSettings";
@@ -11,7 +13,7 @@ import { WorkspaceProjectPicker } from "@/components/thread/WorkspaceControls";
import { settings } from "@/dev/gallery/settings"; import { settings } from "@/dev/gallery/settings";
import { useReadingTypography } from "@/hooks/useReadingTypography"; import { useReadingTypography } from "@/hooks/useReadingTypography";
import { fetchWorkspaceDirectories } from "@/lib/api"; import { fetchWorkspaceDirectories } from "@/lib/api";
import type { McpPresetInfo, NanobotFeatureInfo } from "@/lib/types"; import type { MarketplaceProvider, McpPresetInfo, NanobotFeatureInfo } from "@/lib/types";
const noop = () => {}; const noop = () => {};
const names = ["Search documentation", "Read repository", "List projects", "Inspect changes", "Review results", "Write notes"]; const names = ["Search documentation", "Read repository", "List projects", "Inspect changes", "Review results", "Write notes"];
@@ -24,6 +26,9 @@ const preset: McpPresetInfo = {
export function SkeletonFixture({ surface, loading }: { surface: string; loading: boolean }) { export function SkeletonFixture({ surface, loading }: { surface: string; loading: boolean }) {
useReadingTypography(); useReadingTypography();
const { t } = useTranslation();
const [query, setQuery] = useState("");
const [provider, setProvider] = useState<MarketplaceProvider>("all");
const [model, setModel] = useState(""); const [model, setModel] = useState("");
const [previewLoading, setPreviewLoading] = useState(loading); const [previewLoading, setPreviewLoading] = useState(loading);
const feature: NanobotFeatureInfo = { const feature: NanobotFeatureInfo = {
@@ -42,7 +47,7 @@ export function SkeletonFixture({ surface, loading }: { surface: string; loading
available: false, status: "not_installed", skill_installed: false, available: false, status: "not_installed", skill_installed: false,
})) : [], installed_count: 0 }} })) : [], installed_count: 0 }}
mcpPresets={loading ? null : { presets: names.map((name, index) => ({ ...preset, name: `docs-${index}`, display_name: name })), installed_count: 6 }} mcpPresets={loading ? null : { presets: names.map((name, index) => ({ ...preset, name: `docs-${index}`, display_name: name })), installed_count: 6 }}
cliAppsLoading={loading} mcpPresetsLoading={loading} query="" filter={surface === "cli" ? "cli" : "mcp"} cliAppsLoading={loading} mcpPresetsLoading={loading} query="" filter={{ kind: surface === "cli" ? "cli" : "mcp", status: "all" }}
cliActionKey={null} mcpActionKey={null} mcpOAuthFlow={null} mcpOAuthPopupBlocked={false} cliActionKey={null} mcpActionKey={null} mcpOAuthFlow={null} mcpOAuthPopupBlocked={false}
mcpOAuthCallbackUrl="" mcpOAuthCompleting={false} mcpOAuthCallbackError={null} mcpOAuthCallbackUrl="" mcpOAuthCompleting={false} mcpOAuthCallbackError={null}
cliMessage={null} cliError={null} cliFocusName={null} mcpMessage={null} mcpError={null} cliMessage={null} cliError={null} cliFocusName={null} mcpMessage={null} mcpError={null}
@@ -53,13 +58,21 @@ export function SkeletonFixture({ surface, loading }: { surface: string; loading
onMcpOAuthCallbackUrlChange={noop} onMcpOAuthComplete={noop} onDismissStatus={noop} onMcpOAuthCallbackUrlChange={noop} onMcpOAuthComplete={noop} onDismissStatus={noop}
onBackToChat={noop} onMcpFieldChange={noop} onCustomMcpFormChange={noop} onBackToChat={noop} onMcpFieldChange={noop} onCustomMcpFormChange={noop}
onMcpConfigImportChange={noop} onSaveCustomMcp={noop} onImportMcpConfig={noop} onMcpToolsChange={noop} onMcpConfigImportChange={noop} onSaveCustomMcp={noop} onImportMcpConfig={noop} onMcpToolsChange={noop}
/> : surface === "channels" ? <ChannelsSettings /> : surface === "channels" ? <div className="apps-catalog-layout">
token="fixture" nanobotFeatures={loading ? null : { features: names.map((name, index) => ({ ...feature, name: `channel-${index}`, display_name: name })), enabled_count: 6, requires_restart: false }} <CatalogSearch type="search" value={query} onChange={(event) => setQuery(event.target.value)} placeholder={t("settings.channels.search")} />
loading={loading} actionKey={null} showBrandLogos={false} error={null} requiresRestartPending={false} <ChannelsSettings query={query}
onAction={noop} onFeaturesUpdate={noop} onDismissStatus={noop} token="fixture" nanobotFeatures={loading ? null : { features: names.map((name, index) => ({ ...feature, name: `channel-${index}`, display_name: name })), enabled_count: 6, requires_restart: false }}
/> : surface === "skills" ? <SkillsCatalogSettings loading={loading} skills={loading ? [] : names.map((name) => ({ loading={loading} actionKey={null} showBrandLogos={false} error={null} requiresRestartPending={false}
onAction={noop} onFeaturesUpdate={noop} onDismissStatus={noop}
/>
</div> : surface === "skills" ? <SkillsCatalogSettings loading={loading} skills={loading ? [] : names.map((name) => ({
name, description: "Search, inspect and maintain the project.", source: "builtin", available: true, enabled: true, name, description: "Search, inspect and maintain the project.", source: "builtin", available: true, enabled: true,
}))} /> : surface === "marketplace" ? <SkillsMarketplace installedSkills={[]} installing="" onInstallingChange={noop} /> }))} /> : surface === "marketplace" ? <div className="catalog-section">
<CatalogToolbar search={{ value: query, onChange: (event) => setQuery(event.target.value), placeholder: t("settings.skills.marketplaceSearchPlaceholder") }}>
<CatalogControls><MarketplaceProviderFilter value={provider} onChange={setProvider} /></CatalogControls>
</CatalogToolbar>
<SkillsMarketplace query={query} provider={provider} installedSkills={[]} installing="" onInstallingChange={noop} />
</div>
: surface === "models" || surface === "models-compact" ? <ModelIdPicker token="fixture" : surface === "models" || surface === "models-compact" ? <ModelIdPicker token="fixture"
settings={{ ...settings, providers: settings.providers.map((provider) => provider.name === "openai" ? { ...provider, model_catalog: "official" } : provider) }} settings={{ ...settings, providers: settings.providers.map((provider) => provider.name === "openai" ? { ...provider, model_catalog: "official" } : provider) }}
provider={surface === "models-compact" ? "openai" : "anthropic"} provider={surface === "models-compact" ? "openai" : "anthropic"}
+9 -2
View File
@@ -51,6 +51,9 @@ for (const width of [390, 1440]) {
for (const [surface, [loadedSelector, loadingSelector]] of Object.entries(catalogRows)) { for (const [surface, [loadedSelector, loadingSelector]] of Object.entries(catalogRows)) {
await page.goto(fixture(surface)); await page.goto(fixture(surface));
const loaded = page.locator(loadedSelector).first(); const loaded = page.locator(loadedSelector).first();
const search = await box(page.locator(".catalog-search input"));
const toolbarControls = page.locator(".catalog-controls");
const controls = await box(toolbarControls);
const row = await box(loaded); const row = await box(loaded);
const icon = await box(surface === "channels" ? loaded.locator('[data-testid^="channel-logo"]') const icon = await box(surface === "channels" ? loaded.locator('[data-testid^="channel-logo"]')
: loaded.locator(surface === "apps" ? ":scope > :first-child > :first-child" : ":scope > :first-child")); : loaded.locator(surface === "apps" ? ":scope > :first-child > :first-child" : ":scope > :first-child"));
@@ -58,6 +61,8 @@ for (const width of [390, 1440]) {
const action = width === 1440 || surface !== "skills" ? await box(loaded.locator(":scope > :last-child")) : null; const action = width === 1440 || surface !== "skills" ? await box(loaded.locator(":scope > :last-child")) : null;
await page.goto(fixture(surface, true)); await page.goto(fixture(surface, true));
const skeleton = status(page).locator(loadingSelector).first(); const skeleton = status(page).locator(loadingSelector).first();
sameBox(await box(page.locator(".catalog-search input")), search);
sameBox(await box(toolbarControls), controls);
sameBox(await box(skeleton), row); sameBox(await box(skeleton), row);
sameBox(await box(skeleton.locator(surface === "apps" ? ":scope > :first-child > :first-child" : ":scope > :first-child")), icon); sameBox(await box(skeleton.locator(surface === "apps" ? ":scope > :first-child > :first-child" : ":scope > :first-child")), icon);
const placeholder = await box(skeleton.locator(surface === "apps" const placeholder = await box(skeleton.locator(surface === "apps"
@@ -88,8 +93,10 @@ for (const width of [390, 1440]) {
const requested = page.waitForRequest(view === "search" ? "**/api/webui/skills/search?**" : "**/api/webui/skills/trending?**"); const requested = page.waitForRequest(view === "search" ? "**/api/webui/skills/search?**" : "**/api/webui/skills/trending?**");
try { try {
await page.goto(fixture("marketplace")); await page.goto(fixture("marketplace"));
if (view === "single") await page.getByRole("tab", { name: "skills.sh", exact: true }).click(); if (view === "single") {
if (view === "search") await page.locator("input").fill("project"); await page.getByRole("radio", { name: "skills.sh", exact: true }).locator("..").click();
}
if (view === "search") await page.getByRole("textbox").fill("project");
await requested; await requested;
const skeletons = status(page).locator(".py-3\\.5"); const skeletons = status(page).locator(".py-3\\.5");
const count = view === "single" ? 5 : 10; const count = view === "single" ? 5 : 10;
+14 -3
View File
@@ -3,16 +3,27 @@ import { expect, test } from "@playwright/test";
for (const width of [412, 1440]) { for (const width of [412, 1440]) {
test.describe(`${width}px document startup skeleton`, () => { test.describe(`${width}px document startup skeleton`, () => {
test.use({ viewport: { width, height: 922 }, reducedMotion: "reduce" }); test.use({ viewport: { width, height: 922 }, reducedMotion: "reduce" });
for (const surface of ["skills", "apps", "channels", "automations", "settings", "chat"]) { for (const route of ["skills", "apps", "channels", "apps?section=skills", "apps?section=channels", "automations", "settings", "chat"]) {
test(`${surface} paints before the application and stylesheet download`, async ({ page }) => { const surface = route.includes("section=") ? route.split("section=")[1] : route;
test(`${route} paints before the application and stylesheet download`, async ({ page }) => {
await page.addInitScript(() => localStorage.setItem("nanobot.locale", "en")); await page.addInitScript(() => localStorage.setItem("nanobot.locale", "en"));
// Neither React nor the app stylesheet may supply this first paint. // Neither React nor the app stylesheet may supply this first paint.
await page.route(/\/(?:src\/main\.tsx|assets\/index-[^/]+\.(?:js|css))$/, (route) => route.abort()); await page.route(/\/(?:src\/main\.tsx|assets\/index-[^/]+\.(?:js|css))$/, (route) => route.abort());
await page.goto(`/#/${surface === "chat" ? "chat/websocket%3Aexample" : surface}`, { waitUntil: "domcontentloaded" }); await page.goto(`/#/${surface === "chat" ? "chat/websocket%3Aexample" : route}`, { waitUntil: "domcontentloaded" });
const shell = page.locator(".startup-shell"); const shell = page.locator(".startup-shell");
await expect(shell).toHaveAttribute("data-startup-surface", surface); await expect(shell).toHaveAttribute("data-startup-surface", surface);
await expect(shell).toHaveAttribute("aria-busy", "true"); await expect(shell).toHaveAttribute("aria-busy", "true");
await expect(shell.locator(surface === "chat" ? ".startup-composer" : ".startup-page")).toBeVisible(); await expect(shell.locator(surface === "chat" ? ".startup-composer" : ".startup-page")).toBeVisible();
if (["apps", "skills", "channels"].includes(surface)) {
const search = (await shell.locator(".startup-search").boundingBox())!;
const controls = (await shell.locator(".startup-controls").boundingBox())!;
const tabs = (await shell.locator(".startup-tabs").boundingBox())!;
expect(search.x).toBe(tabs.x);
expect(search.y).toBe(controls.y + controls.height + (width === 1440 ? 12 : 8));
expect(search.width).toBe(controls.x + controls.width - tabs.x);
if (width === 1440) expect(controls.y).toBe(tabs.y);
else expect(tabs.width).toBe(search.width);
}
const blocks = shell.locator(".startup-block:visible"); const blocks = shell.locator(".startup-block:visible");
expect(await blocks.count()).toBeGreaterThan(5); expect(await blocks.count()).toBeGreaterThan(5);
const box = await blocks.first().boundingBox(); const box = await blocks.first().boundingBox();
+3 -3
View File
@@ -63,11 +63,11 @@ function ThemeChatFixture({ theme, toggle }: { theme: "light" | "dark"; toggle:
if (new URLSearchParams(location.search).has("split")) panes.push({ key: "theme-secondary", title: "Secondary chat" }); if (new URLSearchParams(location.search).has("split")) panes.push({ key: "theme-secondary", title: "Secondary chat" });
return <main data-theme-surface className="flex bg-background" style={{ height: "100vh" }}> return <main data-theme-surface className="flex bg-background" style={{ height: "100vh" }}>
<aside className="hidden w-64 shrink-0 sm:block"> <aside className="hidden w-64 shrink-0 sm:block">
<Sidebar sessions={sessions} activeKey={activeKey} onSelect={setActiveKey} loading={false} newChatActive={false} <Sidebar sessions={sessions} activeKey={activeKey} onSelect={setActiveKey} loading={false}
onNewChat={noop} onRequestDelete={noop} onTogglePin={noop} onRequestRename={async () => {}} onNewChat={noop} onRequestDelete={noop} onTogglePin={noop} onRequestRename={async () => {}}
onToggleArchive={noop} onToggleGroup={noop} onRequestRenameProject={noop} onNewChatInProject={noop} onToggleArchive={noop} onToggleGroup={noop} onRequestRenameProject={noop} onNewChatInProject={noop}
onOpenSettings={noop} onOpenApps={noop} onOpenSkills={noop} onOpenAutomations={noop} onOpenSettings={noop} onOpenApps={noop} onOpenAutomations={noop}
onOpenChannels={noop} onOpenSearch={noop} onToggleArchived={noop} /> onOpenSearch={noop} onToggleArchived={noop} />
</aside> </aside>
<div className="min-w-0 flex-1"> <div className="min-w-0 flex-1">
<PaneWorkbench panes={panes} activePaneKey="theme" layout="columns" <PaneWorkbench panes={panes} activePaneKey="theme" layout="columns"
+11 -3
View File
@@ -1,6 +1,8 @@
import { useState } from "react"; import { useState } from "react";
import { SettingsView } from "@/components/settings/SettingsView"; import { SettingsView } from "@/components/settings/SettingsView";
import { StartupSkeleton } from "@/components/StartupSkeleton";
import "@/components/startup-skeleton.css";
import { settings } from "@/dev/gallery/settings"; import { settings } from "@/dev/gallery/settings";
export function installToolsCatalogPreviewApi() { export function installToolsCatalogPreviewApi() {
@@ -12,14 +14,20 @@ export function installToolsCatalogPreviewApi() {
export function ToolsCatalogFixture() { export function ToolsCatalogFixture() {
const [open, setOpen] = useState(true); const [open, setOpen] = useState(true);
return <main> const params = new URLSearchParams(location.search);
<button onClick={() => setOpen(value => !value)}>{open ? "Leave settings" : "Open settings"}</button> const requested = params.get("section");
const section = requested === "skills" || requested === "channels" || requested === "automations" ? requested : "apps";
if (params.has("startup")) return <StartupSkeleton embedded surface={section} sidebarExpanded={false} />;
return <main className={params.has("layout") ? "h-dvh" : undefined}>
{!params.has("layout") && <button onClick={() => setOpen(value => !value)}>{open ? "Leave settings" : "Open settings"}</button>}
{open && <SettingsView {open && <SettingsView
initialSection="apps" initialSection={section}
initialSettings={settings} initialSettings={settings}
showSidebar={false}
themePreference="light" themePreference="light"
onChangeTheme={() => {}} onChangeTheme={() => {}}
onModelNameChange={() => {}} onModelNameChange={() => {}}
onStartAutomationChat={section === "automations" ? () => {} : undefined}
onBackToChat={() => setOpen(false)} onBackToChat={() => setOpen(false)}
/>} />}
</main>; </main>;
+334 -24
View File
@@ -1,6 +1,25 @@
import { expect, test } from "@playwright/test"; import { expect, test, type Page } from "@playwright/test";
async function selectRadio(page: Page, group: string, name: string) {
const radio = page.getByRole("radiogroup", { name: group }).getByRole("radio", { name, exact: true });
await radio.locator("..").click();
await expect(radio).toBeChecked();
await expect(radio).toBeFocused();
}
async function selectToolType(page: Page, name: string) {
await selectRadio(page, "Tool type", name);
}
async function showAllTools(page: Page) {
const readyOnly = page.getByRole("switch", { name: "Ready only" });
if (await readyOnly.isChecked()) await readyOnly.click();
await expect(readyOnly).not.toBeChecked();
}
test("settings reentry reuses tools immediately and refreshes expired catalogs without hiding rows", async ({ page }) => { test("settings reentry reuses tools immediately and refreshes expired catalogs without hiding rows", async ({ page }) => {
const clockStart = Date.now();
await page.clock.setFixedTime(clockStart);
const counts = { cli: 0, mcp: 0 }; const counts = { cli: 0, mcp: 0 };
let refresh = false; let refresh = false;
let release!: () => void; let release!: () => void;
@@ -26,57 +45,126 @@ test("settings reentry reuses tools immediately and refreshes expired catalogs w
}); });
await page.goto("/browser/fixture.html?case=tools-catalog"); await page.goto("/browser/fixture.html?case=tools-catalog");
await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toBeVisible(); await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toBeVisible();
await expect(page.getByRole("button", { name: "Ready", exact: true })).toHaveAttribute("aria-pressed", "true"); await expect(page.getByRole("switch", { name: "Ready only" })).toBeChecked();
await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toHaveCount(0); await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toHaveCount(0);
await page.getByRole("button", { name: "CLI Apps", exact: true }).click(); await selectToolType(page, "CLI Apps");
await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toBeVisible(); await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toBeVisible();
await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toHaveCount(0); await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toHaveCount(0);
await page.getByRole("button", { name: "Agent Plugins", exact: true }).click(); await selectToolType(page, "Agent Plugins");
await showAllTools(page);
await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toBeVisible(); await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toBeVisible();
await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toHaveCount(0); await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toHaveCount(0);
expect(counts).toEqual({ cli: 1, mcp: 1 });
await page.getByRole("button", { name: "Leave settings", exact: true }).click(); await page.getByRole("button", { name: "Leave settings", exact: true }).click();
await page.getByRole("button", { name: "Open settings", exact: true }).click(); await page.getByRole("button", { name: "Open settings", exact: true }).click();
await page.getByRole("button", { name: "Agent Plugins", exact: true }).click(); await selectToolType(page, "Agent Plugins");
await showAllTools(page);
await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toBeVisible(); await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toBeVisible();
expect(counts).toEqual({ cli: 1, mcp: 1 }); expect(counts).toEqual({ cli: 1, mcp: 1 });
await page.getByRole("button", { name: "Leave settings", exact: true }).click(); await page.getByRole("button", { name: "Leave settings", exact: true }).click();
refresh = true; refresh = true;
await page.clock.setFixedTime(new Date(Date.now() + 31_000)); await page.clock.setFixedTime(clockStart + 31_000);
await page.getByRole("button", { name: "Open settings", exact: true }).click(); await page.getByRole("button", { name: "Open settings", exact: true }).click();
await page.getByRole("button", { name: "Agent Plugins", exact: true }).click(); await selectToolType(page, "Agent Plugins");
await showAllTools(page);
await expect.poll(() => counts).toEqual({ cli: 2, mcp: 2 }); await expect.poll(() => counts).toEqual({ cli: 2, mcp: 2 });
await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toBeVisible(); await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toBeVisible();
await expect(page.getByRole("status", { name: "Loading apps…", exact: true })).toHaveCount(0); await expect(page.getByRole("status", { name: "Loading apps…", exact: true })).toHaveCount(0);
release(); release();
await expect(page.getByRole("heading", { name: "Updated plugin", exact: true })).toBeVisible(); await expect(page.getByRole("heading", { name: "Updated plugin", exact: true })).toBeVisible();
await page.getByRole("button", { name: "CLI Apps", exact: true }).click(); await selectToolType(page, "CLI Apps");
await expect(page.getByRole("heading", { name: "Updated CLI", exact: true })).toBeVisible(); await expect(page.getByRole("heading", { name: "Updated CLI", exact: true })).toBeVisible();
}); });
test("shows all category labels on narrow screens in each locale", async ({ page }) => { test("reveals MCP tools hidden by Ready only without switching tool type", async ({ page }) => {
await page.setViewportSize({ width: 320, height: 800 }); await page.route("**/api/settings/cli-apps", route => route.fulfill({ json: { apps: [{
name: "fixture-cli", display_name: "Fixture CLI", category: "tools", description: "Fixture app",
requires: "", source: "catalog", entry_point: "fixture-cli", install_supported: true,
installed: true, available: true, status: "installed", skill_installed: false,
}], installed_count: 1 } }));
await page.route("**/api/settings/mcp-presets", route => route.fulfill({ json: { presets: [{
name: "fixture-mcp", display_name: "Fixture MCP", category: "tools", description: "Fixture MCP tool",
requires: "", transport: "stdio", source: "builtin", install_supported: true,
installed: true, configured: true, enabled: false, available: false, status: "disabled",
required_fields: [], docs_url: "", note: "", connection_summary: "",
}], installed_count: 1 } }));
await page.goto("/browser/fixture.html?case=tools-catalog&layout&lang=zh-CN");
await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toBeVisible();
const ready = page.getByRole("switch", { name: "仅显示就绪" });
await expect(ready).toBeChecked();
await selectRadio(page, "工具类型", "MCP");
await expect(page.getByText("还没有就绪的工具", { exact: true })).toBeVisible();
const search = page.getByRole("textbox", { name: "搜索工具" });
await search.fill("fixture");
await ready.click();
await expect(search).toHaveValue("fixture");
await expect(ready).not.toBeChecked();
await expect(page.getByRole("radio", { name: "MCP", exact: true })).toBeChecked();
await expect(page.getByRole("heading", { name: "Fixture MCP", exact: true })).toBeVisible();
await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toHaveCount(0);
});
test("keeps Apps section controls usable on narrow screens in each locale", async ({ page }) => {
const width = 320;
await page.setViewportSize({ width, height: 800 });
await page.route("**/api/settings/cli-apps", route => route.fulfill({ json: { apps: [], installed_count: 0 } })); await page.route("**/api/settings/cli-apps", route => route.fulfill({ json: { apps: [], installed_count: 0 } }));
await page.route("**/api/settings/mcp-presets", route => route.fulfill({ json: { presets: [], installed_count: 0 } })); await page.route("**/api/settings/mcp-presets", route => route.fulfill({ json: { presets: [], installed_count: 0 } }));
for (const locale of ["en", "es", "fr", "id", "ja", "ko", "pt-BR", "vi", "zh-CN", "zh-TW"]) { await page.route("**/api/settings/nanobot-features", route => route.fulfill({ json: { features: [], enabled_count: 0 } }));
await page.goto(`/browser/fixture.html?case=tools-catalog&lang=${locale}`); await page.route("**/api/webui/skills/trending?**", route => route.fulfill({ json: { skills: [] } }));
const control = page.locator(".segmented-control").filter({ has: page.getByRole("button", { name: "CLI Apps", exact: true }) }); const controls = page.locator(".catalog-controls");
await expect(control).toBeVisible(); async function expectControlsFit(locale: string, count: number) {
const geometry = await control.evaluate(element => { const targets = page.locator(".catalog-tabs > button, .catalog-controls label");
await expect(targets).toHaveCount(count);
const geometry = await targets.evaluateAll(elements => elements.map(element => {
const bounds = element.getBoundingClientRect(); const bounds = element.getBoundingClientRect();
return { return {
label: element.textContent,
left: bounds.left, left: bounds.left,
right: bounds.right, right: bounds.right,
buttons: Array.from(element.querySelectorAll("button"), button => ({ fits: element.scrollWidth <= element.clientWidth
text: button.textContent, && (!element.matches("button") || element.scrollHeight <= element.clientHeight),
fits: button.scrollWidth <= button.clientWidth,
})),
}; };
}); }));
expect(geometry.left, locale).toBeGreaterThanOrEqual(0); expect(geometry.filter(item => item.left < 0 || item.right > width || !item.fits), locale).toEqual([]);
expect(geometry.right, locale).toBeLessThanOrEqual(320); }
expect(geometry.buttons, locale).toHaveLength(4); for (const locale of ["en", "es", "fr", "id", "ja", "ko", "pt-BR", "vi", "zh-CN", "zh-TW"]) {
expect(geometry.buttons.every(button => button.fits), locale).toBe(true); await page.goto(`/browser/fixture.html?case=tools-catalog&lang=${locale}`);
const types = page.getByRole("radiogroup").getByRole("radio");
const status = controls.getByRole("switch");
await expect(types).toHaveCount(4);
await expect(status).not.toBeChecked();
await expectControlsFit(locale, 8);
const cli = types.nth(1);
await cli.locator("..").click();
await expect(cli).toBeChecked();
await expect(cli).toBeFocused();
await page.keyboard.press("ArrowRight");
await expect(types.nth(2)).toBeChecked();
await expect(types.nth(2)).toBeFocused();
await page.keyboard.press("Tab");
await expect(status).toBeFocused();
await page.keyboard.press("Space");
await expect(status).toBeChecked();
await status.locator("..").locator(":scope > span").click();
await expect(status).not.toBeChecked();
await expect(status).toBeFocused();
const sections = page.locator(".catalog-tabs").getByRole("button");
await sections.nth(1).click();
await expectControlsFit(locale, 8);
const marketplace = controls.getByRole("radio").nth(1);
await marketplace.locator("..").click();
await expect(marketplace).toBeFocused();
await expect(marketplace).toBeChecked();
await expectControlsFit(locale, 8);
await sections.nth(2).click();
await expectControlsFit(locale, 4);
await status.locator("..").locator(":scope > span").click();
await expect(status).toBeChecked();
await expect(status).toBeFocused();
} }
}); });
@@ -100,3 +188,225 @@ test("opens the generated plugin from its CLI app", async ({ page }) => {
await expect(page.getByRole("dialog", { name: "Generated plugin" })).toBeVisible(); await expect(page.getByRole("dialog", { name: "Generated plugin" })).toBeVisible();
await expect(page.getByRole("dialog").getByRole("button", { name: "Disable" })).toBeVisible(); await expect(page.getByRole("dialog").getByRole("button", { name: "Disable" })).toBeVisible();
}); });
test("keeps navigation, control slots and full-width search stable when switching Apps sections", async ({ page }) => {
await page.route("**/api/settings/cli-apps", route => route.fulfill({ json: { apps: [], installed_count: 0 } }));
await page.route("**/api/settings/mcp-presets", route => route.fulfill({ json: { presets: [], installed_count: 0 } }));
await page.route("**/api/settings/nanobot-features", route => route.fulfill({ json: { features: [], enabled_count: 0 } }));
await page.goto("/browser/fixture.html?case=tools-catalog");
await page.route("**/api/webui/skills/trending?**", route => route.fulfill({ json: { skills: [] } }));
const sections = page.getByRole("group", { name: "Apps" });
const selected = sections.getByRole("button", { pressed: true });
const tools = sections.getByRole("button", { name: "Tools" });
await tools.focus();
for (const key of ["ArrowRight", "ArrowLeft"]) {
await page.keyboard.press(key);
await expect(tools).toBeFocused();
await expect(tools).toHaveAttribute("aria-pressed", "true");
}
const field = page.locator(".catalog-search input");
await expect(field).toBeVisible();
const searchNode = (await field.elementHandle())!;
for (const width of [1440, 800, 375, 320]) {
await page.setViewportSize({ width, height: 900 });
await tools.click();
const wide = width >= 800;
let toolsSearch: Awaited<ReturnType<typeof catalogGeometry>>[0] | undefined;
const names = ["Tools", "Skills", "Channels"];
for (const [index, name] of names.entries()) {
await expect(selected).toHaveText(name);
await expect(selected).toBeFocused();
await expect(field).toBeVisible();
expect(await searchNode.evaluate(element => element === document.querySelector(".catalog-search input"))).toBe(true);
await page.locator("[data-testid=settings-section-transition]").evaluate(async element => {
await Promise.all(element.getAnimations().map(animation => animation.finished));
});
const geometry = await catalogGeometry(page);
const [search, controls] = geometry;
const navigation = (await sections.boundingBox())!;
expect(search.x).toBe(navigation.x);
expect(search.x + search.width).toBe(controls.x + controls.width);
expect(search.y).toBe(controls.y + controls.height + (wide ? 12 : 8));
if (name === "Tools") toolsSearch = search;
else if (wide || name === "Skills") expect(search, `${width}px ${name}`).toEqual(toolsSearch);
else {
expect(controls.height).toBe(36);
expect(search.y).toBeLessThan(toolsSearch!.y);
}
if (wide) expect(controls.y).toBe(navigation.y);
else expect(navigation.width).toBe(search.width);
expect(search.height).toBe(36);
expect(search.radius).toBe("12px");
expect(geometry.every(control => control.x >= 0 && control.x + control.width <= width)).toBe(true);
if (name === "Skills") {
await selectRadio(page, "Skills views", "Marketplace");
const sources = page.getByRole("radiogroup", { name: "Skill source" });
await expect(sources.getByRole("radio", { name: "All", exact: true })).toBeChecked();
await page.keyboard.press("Tab");
await expect(sources.getByRole("radio", { name: "All", exact: true })).toBeFocused();
await page.keyboard.press("ArrowRight");
await expect(sources.getByRole("radio", { name: "skills.sh" })).toBeFocused();
await expect(sources.getByRole("radio", { name: "skills.sh" })).toBeChecked();
await selectRadio(page, "Skill source", "All");
expect(await catalogGeometry(page)).toEqual(geometry);
expect(await searchNode.evaluate(element => element === document.querySelector(".catalog-search input"))).toBe(true);
await selectRadio(page, "Skills views", "Installed");
await selected.focus();
}
const next = names[index + 1];
if (next) {
await page.keyboard.press("Tab");
await expect(sections.getByRole("button", { name: next })).toBeFocused();
await page.keyboard.press("Enter");
}
}
}
});
test("keeps channel names, local marks and click focus on a narrow viewport", async ({ page, baseURL }) => {
await page.setViewportSize({ width: 320, height: 800 });
const origin = new URL(baseURL!).origin;
const externalImages: string[] = [];
await page.route(url => url.origin !== origin, route => {
if (route.request().resourceType() === "image") externalImages.push(route.request().url());
return route.abort();
});
await page.route("**/api/settings/nanobot-features", route => route.fulfill({ json: {
enabled_count: 1,
features: [{
name: "whatsapp_agent", display_name: "WhatsApp Agent Platform", type: "channel",
enabled: true, installed: true, runtime_status: "failed", status: "enabled",
install_supported: false, requires_restart: false,
}, {
name: "telegram", display_name: "Telegram", type: "channel",
enabled: false, installed: false, status: "not_installed",
install_supported: true, requires_dependencies: true, requires_restart: false,
}, {
name: "email", display_name: "Email", type: "channel",
enabled: false, installed: true, configured: false, status: "not_enabled",
install_supported: false, requires_restart: false,
}, ...[
["linear", "Linear"], ["mattermost", "Mattermost"], ["qq", "QQ"], ["slack", "Slack"],
].map(([name, display_name]) => ({
name, display_name, type: "channel",
enabled: false, installed: true, status: "not_enabled",
install_supported: false, requires_restart: false,
}))],
} }));
await page.goto("/browser/fixture.html?case=tools-catalog&layout&section=channels");
const name = page.getByRole("heading", { name: "WhatsApp Agent Platform", exact: true });
await expect(name).toBeVisible();
const settings = page.getByRole("button", { name: /View WhatsApp Agent Platform/ });
await expect(settings).toHaveAccessibleDescription("Failed");
expect(await name.evaluate(element => element.scrollWidth <= element.clientWidth && element.scrollHeight <= element.clientHeight)).toBe(true);
const mark = page.locator("[data-testid=channel-logo-whatsapp_agent] img");
await expect.poll(() => mark.evaluate(image => (image as HTMLImageElement).naturalWidth)).toBeGreaterThan(0);
const dialog = page.getByRole("dialog", { name: "Channels" });
await settings.click();
await expect(dialog).toBeFocused();
await dialog.getByRole("button", { name: "Close", exact: true }).click();
await expect(settings).toBeFocused();
const enabledOnly = page.getByRole("switch", { name: "Enabled only" });
await expect(enabledOnly).toBeChecked();
await enabledOnly.click();
await expect(enabledOnly).not.toBeChecked();
await expect(enabledOnly).toBeFocused();
for (const channel of ["linear", "mattermost", "qq"]) {
const image = page.getByTestId(`channel-logo-${channel}`).locator("img");
await image.scrollIntoViewIfNeeded();
await expect(image).toHaveAttribute("src", `/brand/channels/${channel}.svg`);
await expect.poll(() => image.evaluate(element => (element as HTMLImageElement).naturalWidth)).toBeGreaterThan(0);
}
const slackMark = page.getByTestId("channel-logo-slack");
await slackMark.scrollIntoViewIfNeeded();
await expect(slackMark).toHaveText("SL");
const emailSwitch = page.getByRole("switch", { name: /Email/ });
await emailSwitch.click();
await expect(dialog).toBeFocused();
await page.keyboard.press("Escape");
await expect(emailSwitch).toBeFocused();
const telegram = page.getByRole("button", { name: /View Telegram/ });
const install = page.getByRole("button", { name: "Install Telegram" });
await telegram.click();
await expect(telegram).toBeFocused();
await page.keyboard.press("Enter");
await expect(install).toBeFocused();
const skills = page.getByRole("group", { name: "Apps" }).getByRole("button", { name: "Skills" });
await skills.click();
await expect(page.getByLabel("Search installed skills")).toBeVisible();
await expect(skills).toBeFocused();
expect(externalImages).toEqual([]);
});
async function catalogGeometry(page: Page, startup = false) {
const selectors = startup
? [".startup-search", ".startup-controls"]
: [".catalog-search input", ".catalog-controls"];
return Promise.all(selectors.map(selector => page.locator(selector).evaluate(element => {
const rect = element.getBoundingClientRect();
return { x: rect.x, y: rect.y, width: rect.width, height: rect.height, radius: getComputedStyle(element).borderRadius };
})));
}
for (const width of [390, 1440]) test(`Apps startup skeleton shares the loaded toolbar geometry at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 900 });
await page.emulateMedia({ reducedMotion: "reduce" });
await page.route("**/api/settings/cli-apps", route => route.fulfill({ json: { apps: [], installed_count: 0 } }));
await page.route("**/api/settings/mcp-presets", route => route.fulfill({ json: { presets: [], installed_count: 0 } }));
await page.route("**/api/settings/nanobot-features", route => route.fulfill({ json: { features: [], enabled_count: 0 } }));
for (const section of ["apps", "skills", "channels"]) {
const url = `/browser/fixture.html?case=tools-catalog&layout&section=${section}`;
await page.goto(url);
await expect(page.locator(".catalog-search input")).toBeVisible();
const loaded = await catalogGeometry(page);
await page.goto(`${url}&startup`);
await expect(page.locator(".startup-search")).toBeVisible();
expect(await catalogGeometry(page, true), section).toEqual(loaded);
}
});
for (const width of [390, 1440]) test(`Apps and Automations share the conversation column at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 900 });
await page.emulateMedia({ reducedMotion: "reduce" });
await page.route("**/api/settings/cli-apps", route => route.fulfill({ json: { apps: [], installed_count: 0 } }));
await page.route("**/api/settings/mcp-presets", route => route.fulfill({ json: { presets: [], installed_count: 0 } }));
await page.route("**/api/webui/automations", route => route.fulfill({ json: { jobs: [] } }));
const bounds = async (selector: string) => {
const target = page.locator(selector);
await expect(target).toBeVisible();
const { x, width } = (await target.boundingBox())!;
return { x, width };
};
const fixture = "/browser/fixture.html?case=tools-catalog&layout";
await page.goto(fixture);
const apps = await bounds(".catalog-search input");
await page.goto(`${fixture}&section=automations`);
expect(await bounds(".automation-panel")).toEqual(apps);
expect(await bounds(".automation-create-composer .thread-composer-surface")).toEqual(apps);
await expect(page.locator(width === 1440 ? ".automation-calendar-grid" : ".automation-calendar-agenda")).toBeVisible();
await page.goto(`${fixture}&section=automations&startup`);
expect(await bounds(".startup-calendar")).toEqual(apps);
if (width === 1440) {
await page.route("**/api/commands", route => route.fulfill({ json: { commands: [] } }));
await page.route("**/api/sessions/*/webui-thread?*", route => route.fulfill({ json: {
schemaVersion: 3, projection: "events", events: [], has_more: false,
} }));
await page.routeWebSocket("**/answer-order-socket", route => route.onMessage(raw => {
const frame = JSON.parse(String(raw));
if (frame.type !== "attach") return;
route.send(JSON.stringify({ event: "attached", chat_id: frame.chat_id }));
route.send(JSON.stringify({ event: "user_message", chat_id: frame.chat_id,
turn_id: "layout-turn", text: "An existing conversation", starts_turn: true,
}));
}));
await page.goto("/browser/fixture.html?case=answer-order");
expect(await bounds('[data-layout="thread"] .thread-composer-surface')).toEqual(apps);
}
});
+1
View File
@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Discord</title><path fill="#5865F2" d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"/></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

+1
View File
@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Linear</title><path fill="#5E6AD2" d="M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z"/></svg>

After

Width:  |  Height:  |  Size: 469 B

+1
View File
@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Matrix</title><path fill="#000000" d="M.632.55v22.9H2.28V24H0V0h2.28v.55zm7.043 7.26v1.157h.033c.309-.443.683-.784 1.117-1.024.433-.245.936-.365 1.5-.365.54 0 1.033.107 1.481.314.448.208.785.582 1.02 1.108.254-.374.6-.706 1.034-.992.434-.287.95-.43 1.546-.43.453 0 .872.056 1.26.167.388.11.716.286.993.53.276.245.489.559.646.951.152.392.23.863.23 1.417v5.728h-2.349V11.52c0-.286-.01-.559-.032-.812a1.755 1.755 0 0 0-.18-.66 1.106 1.106 0 0 0-.438-.448c-.194-.11-.457-.166-.785-.166-.332 0-.6.064-.803.189a1.38 1.38 0 0 0-.48.499 1.946 1.946 0 0 0-.231.696 5.56 5.56 0 0 0-.06.785v4.768h-2.35v-4.8c0-.254-.004-.503-.018-.752a2.074 2.074 0 0 0-.143-.688 1.052 1.052 0 0 0-.415-.503c-.194-.125-.476-.19-.854-.19-.111 0-.259.024-.439.074-.18.051-.36.143-.53.282-.171.138-.319.337-.439.595-.12.259-.18.6-.18 1.02v4.966H5.46V7.81zm15.693 15.64V.55H21.72V0H24v24h-2.28v-.55z"/></svg>

After

Width:  |  Height:  |  Size: 955 B

@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Mattermost</title><path fill="#0058CC" d="M12.081 0C7.048-.034 2.339 3.125.637 8.153c-2.125 6.276 1.24 13.086 7.516 15.21 6.276 2.125 13.086-1.24 15.21-7.516 1.727-5.1-.172-10.552-4.311-13.557l.126 2.547c2.065 2.282 2.88 5.512 1.852 8.549-1.534 4.532-6.594 6.915-11.3 5.321-4.708-1.593-7.28-6.559-5.745-11.092 1.031-3.046 3.655-5.121 6.694-5.67l1.642-1.94A4.87 4.87 0 0 0 12.08 0zm3.528 1.094a.284.284 0 0 0-.123.024l-.004.001a.33.33 0 0 0-.109.071c-.145.142-.657.828-.657.828L13.6 3.4l-1.3 1.585-2.232 2.776s-1.024 1.278-.798 2.851c.226 1.574 1.396 2.34 2.304 2.648.907.307 2.302.408 3.438-.704 1.135-1.112 1.098-2.75 1.098-2.75l-.087-3.56-.07-2.05-.047-1.775s.01-.856-.02-1.057a.33.33 0 0 0-.035-.107l-.006-.012-.007-.011a.277.277 0 0 0-.229-.14z"/></svg>

After

Width:  |  Height:  |  Size: 836 B

+1
View File
@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>QQ</title><path fill="#1EBAFC" d="M21.395 15.035a40 40 0 0 0-.803-2.264l-1.079-2.695c.001-.032.014-.562.014-.836C19.526 4.632 17.351 0 12 0S4.474 4.632 4.474 9.241c0 .274.013.804.014.836l-1.08 2.695a39 39 0 0 0-.802 2.264c-1.021 3.283-.69 4.643-.438 4.673.54.065 2.103-2.472 2.103-2.472 0 1.469.756 3.387 2.394 4.771-.612.188-1.363.479-1.845.835-.434.32-.379.646-.301.778.343.578 5.883.369 7.482.189 1.6.18 7.14.389 7.483-.189.078-.132.132-.458-.301-.778-.483-.356-1.233-.646-1.846-.836 1.637-1.384 2.393-3.302 2.393-4.771 0 0 1.563 2.537 2.103 2.472.251-.03.581-1.39-.438-4.673"/></svg>

After

Width:  |  Height:  |  Size: 666 B

+1
View File
@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Signal</title><path fill="#3B45FD" d="M12 0q-.934 0-1.83.139l.17 1.111a11 11 0 0 1 3.32 0l.172-1.111A12 12 0 0 0 12 0M9.152.34A12 12 0 0 0 5.77 1.742l.584.961a10.8 10.8 0 0 1 3.066-1.27zm5.696 0-.268 1.094a10.8 10.8 0 0 1 3.066 1.27l.584-.962A12 12 0 0 0 14.848.34M12 2.25a9.75 9.75 0 0 0-8.539 14.459c.074.134.1.292.064.441l-1.013 4.338 4.338-1.013a.62.62 0 0 1 .441.064A9.7 9.7 0 0 0 12 21.75c5.385 0 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25m-7.092.068a12 12 0 0 0-2.59 2.59l.909.664a11 11 0 0 1 2.345-2.345zm14.184 0-.664.909a11 11 0 0 1 2.345 2.345l.909-.664a12 12 0 0 0-2.59-2.59M1.742 5.77A12 12 0 0 0 .34 9.152l1.094.268a10.8 10.8 0 0 1 1.269-3.066zm20.516 0-.961.584a10.8 10.8 0 0 1 1.27 3.066l1.093-.268a12 12 0 0 0-1.402-3.383M.138 10.168A12 12 0 0 0 0 12q0 .934.139 1.83l1.111-.17A11 11 0 0 1 1.125 12q0-.848.125-1.66zm23.723.002-1.111.17q.125.812.125 1.66c0 .848-.042 1.12-.125 1.66l1.111.172a12.1 12.1 0 0 0 0-3.662M1.434 14.58l-1.094.268a12 12 0 0 0 .96 2.591l-.265 1.14 1.096.255.36-1.539-.188-.365a10.8 10.8 0 0 1-.87-2.35m21.133 0a10.8 10.8 0 0 1-1.27 3.067l.962.584a12 12 0 0 0 1.402-3.383zm-1.793 3.848a11 11 0 0 1-2.345 2.345l.664.909a12 12 0 0 0 2.59-2.59zm-19.959 1.1L.357 21.48a1.8 1.8 0 0 0 2.162 2.161l1.954-.455-.256-1.095-1.953.455a.675.675 0 0 1-.81-.81l.454-1.954zm16.832 1.769a10.8 10.8 0 0 1-3.066 1.27l.268 1.093a12 12 0 0 0 3.382-1.402zm-10.94.213-1.54.36.256 1.095 1.139-.266c.814.415 1.683.74 2.591.961l.268-1.094a10.8 10.8 0 0 1-2.35-.869zm3.634 1.24-.172 1.111a12.1 12.1 0 0 0 3.662 0l-.17-1.111q-.812.125-1.66.125a11 11 0 0 1-1.66-.125"/></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

+1
View File
@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Telegram</title><path fill="#26A5E4" d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/></svg>

After

Width:  |  Height:  |  Size: 758 B

+1
View File
@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>WeChat</title><path fill="#07C160" d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

+1
View File
@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>WhatsApp</title><path fill="#25D366" d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

+42 -50
View File
@@ -6,6 +6,7 @@ import {
useMemo, useMemo,
useRef, useRef,
useState, useState,
type CSSProperties,
type ReactNode, type ReactNode,
} from "react"; } from "react";
import { ArrowRight, ChevronDown, Eye, EyeOff } from "lucide-react"; import { ArrowRight, ChevronDown, Eye, EyeOff } from "lucide-react";
@@ -28,7 +29,7 @@ import { ComposerDraftStore, clearStoredComposerDrafts } from "@/lib/composer-dr
import { activateReloadCache, clearReloadCache } from "@/lib/reload-cache"; import { activateReloadCache, clearReloadCache } from "@/lib/reload-cache";
import { webuiThreadCache } from "@/lib/webui-thread-cache"; import { webuiThreadCache } from "@/lib/webui-thread-cache";
import { ThreadVisibilityContext } from "@/hooks/useThreadVisibility"; import { ThreadVisibilityContext } from "@/hooks/useThreadVisibility";
import type { SettingsExitGuard, SettingsFocusTarget } from "@/components/settings/contracts"; import { isAppsSection, type SettingsExitGuard, type SettingsFocusTarget } from "@/components/settings/contracts";
import { PaneWorkbench } from "@/components/workbench/PaneWorkbench"; import { PaneWorkbench } from "@/components/workbench/PaneWorkbench";
import { transitionSession } from "@/components/thread/session-transition"; import { transitionSession } from "@/components/thread/session-transition";
import { import {
@@ -137,7 +138,7 @@ const SIDEBAR_RAIL_WIDTH = 56;
const MOBILE_SIDEBAR_WIDTH = `min(${SIDEBAR_WIDTH}px, calc(100vw - 0.75rem))`; const MOBILE_SIDEBAR_WIDTH = `min(${SIDEBAR_WIDTH}px, calc(100vw - 0.75rem))`;
const TOKEN_REFRESH_MARGIN_MS = 30_000; const TOKEN_REFRESH_MARGIN_MS = 30_000;
const TOKEN_REFRESH_MIN_DELAY_MS = 5_000; const TOKEN_REFRESH_MIN_DELAY_MS = 5_000;
type ShellView = "chat" | "settings" | "apps" | "automations" | "skills" | "channels" | "remote"; type ShellView = "chat" | "settings" | "apps" | "automations" | "remote";
type ShellRoute = { type ShellRoute = {
view: ShellView; view: ShellView;
activeKey: string | null; activeKey: string | null;
@@ -195,7 +196,8 @@ function defaultShellRoute(): ShellRoute {
} }
function shellViewForSettingsSection(section: SettingsSectionKey): ShellView { function shellViewForSettingsSection(section: SettingsSectionKey): ShellView {
if (section === "apps" || section === "automations" || section === "skills" || section === "channels") return section; if (isAppsSection(section)) return "apps";
if (section === "automations") return "automations";
return "settings"; return "settings";
} }
@@ -272,19 +274,19 @@ function readShellRoute(): ShellRoute {
}; };
} }
if (path === "/apps") { if (path === "/apps") {
return { view: "apps", activeKey, temporary, settingsSection: "apps" }; return { view: "apps", activeKey, temporary, settingsSection: isAppsSection(settingsSection) ? settingsSection : "apps" };
} }
if (path === "/automations") { if (path === "/automations") {
return { view: "automations", activeKey, temporary, settingsSection: "automations" }; return { view: "automations", activeKey, temporary, settingsSection: "automations" };
} }
if (path === "/channels") { if (path === "/channels") {
return { view: "channels", activeKey, temporary, settingsSection: "channels" }; return { view: "apps", activeKey, temporary, settingsSection: "channels" };
} }
if (path === "/remote") { if (path === "/remote") {
return { view: "remote", activeKey, temporary, settingsSection: "overview" }; return { view: "remote", activeKey, temporary, settingsSection: "overview" };
} }
if (path === "/skills") { if (path === "/skills") {
return { view: "skills", activeKey, temporary, settingsSection: "skills" }; return { view: "apps", activeKey, temporary, settingsSection: "skills" };
} }
if (path.startsWith("/temporary/")) { if (path.startsWith("/temporary/")) {
const encoded = path.slice("/temporary/".length); const encoded = path.slice("/temporary/".length);
@@ -331,6 +333,9 @@ function shellRouteHash(route: ShellRoute): string {
params.set("section", route.settingsSection); params.set("section", route.settingsSection);
if (route.settingsSection === "advanced" && route.settingsFocus) params.set("focus", route.settingsFocus); if (route.settingsSection === "advanced" && route.settingsFocus) params.set("focus", route.settingsFocus);
} }
if (route.view === "apps" && route.settingsSection !== "apps") {
params.set("section", route.settingsSection);
}
const query = params.toString(); const query = params.toString();
return `#/${route.view}${query ? `?${query}` : ""}`; return `#/${route.view}${query ? `?${query}` : ""}`;
} }
@@ -897,8 +902,7 @@ function Shell({
const [settingsInitialSection, setSettingsInitialSection] = const [settingsInitialSection, setSettingsInitialSection] =
useState<SettingsSectionKey>(initialRouteRef.current.settingsSection); useState<SettingsSectionKey>(initialRouteRef.current.settingsSection);
const [settingsFocus, setSettingsFocus] = useState<SettingsFocusTarget | undefined>(initialRouteRef.current.settingsFocus); const [settingsFocus, setSettingsFocus] = useState<SettingsFocusTarget | undefined>(initialRouteRef.current.settingsFocus);
const [hostSidebarOpen, setHostSidebarOpen] = const [preferredSidebarOpen, setPreferredSidebarOpen] = useState(readSidebarOpen);
useState<boolean>(readSidebarOpen);
const [sidebarWidth, setSidebarWidth] = useState(readSidebarWidth); const [sidebarWidth, setSidebarWidth] = useState(readSidebarWidth);
const [sidebarDragging, setSidebarDragging] = useState(false); const [sidebarDragging, setSidebarDragging] = useState(false);
const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false); const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false);
@@ -988,6 +992,14 @@ function Shell({
)), )),
[temporarySessions], [temporarySessions],
); );
// Start each confirmed empty period collapsed without overwriting the saved preference.
const [emptySidebarOpen, setEmptySidebarOpen] = useState<boolean | null>(null);
const hasSessions = sessions.length > 0 || temporarySessionList.length > 0;
if (hasSessions && emptySidebarOpen !== null) setEmptySidebarOpen(null);
if (!hasSessions && sessionsLoaded && emptySidebarOpen === null) setEmptySidebarOpen(false);
const hostSidebarOpen = emptySidebarOpen ?? preferredSidebarOpen;
const setHostSidebarOpen = emptySidebarOpen === null ? setPreferredSidebarOpen : setEmptySidebarOpen;
const temporaryChatIds = useMemo( const temporaryChatIds = useMemo(
() => temporarySessionList.map((session) => session.chatId), () => temporarySessionList.map((session) => session.chatId),
[temporarySessionList], [temporarySessionList],
@@ -1128,7 +1140,7 @@ function Shell({
try { try {
window.localStorage.setItem( window.localStorage.setItem(
SIDEBAR_STORAGE_KEY, SIDEBAR_STORAGE_KEY,
hostSidebarOpen ? "1" : "0", preferredSidebarOpen ? "1" : "0",
); );
} catch { } catch {
// ignore storage errors (private mode, etc.) // ignore storage errors (private mode, etc.)
@@ -1138,7 +1150,7 @@ function Shell({
} catch { } catch {
// Storage can be unavailable in private browsing. // Storage can be unavailable in private browsing.
} }
}, [hostSidebarOpen, sidebarWidth]); }, [preferredSidebarOpen, sidebarWidth]);
useEffect(() => { useEffect(() => {
writeSessionUpdateChatIds(updatedChatIds); writeSessionUpdateChatIds(updatedChatIds);
@@ -1329,7 +1341,7 @@ function Shell({
const openHostSidebar = useCallback(() => { const openHostSidebar = useCallback(() => {
setHostSidebarOpen(true); setHostSidebarOpen(true);
}, []); }, [setHostSidebarOpen]);
const closeMobileSidebar = useCallback(() => { const closeMobileSidebar = useCallback(() => {
setMobileSidebarOpen(false); setMobileSidebarOpen(false);
@@ -1340,11 +1352,11 @@ function Shell({
typeof window !== "undefined" && typeof window !== "undefined" &&
window.matchMedia("(min-width: 1024px)").matches; window.matchMedia("(min-width: 1024px)").matches;
if (isNativeHost) { if (isNativeHost) {
setHostSidebarOpen((v) => !v); setHostSidebarOpen(!hostSidebarOpen);
} else { } else {
setMobileSidebarOpen((v) => !v); setMobileSidebarOpen((v) => !v);
} }
}, []); }, [hostSidebarOpen, setHostSidebarOpen]);
const applyWorkspaceScope = useCallback( const applyWorkspaceScope = useCallback(
(scope: WorkspaceScopePayload) => { (scope: WorkspaceScopePayload) => {
@@ -1814,21 +1826,9 @@ function Shell({
setMobileSidebarOpen(false); setMobileSidebarOpen(false);
}, [activeKey, navigate]); }, [activeKey, navigate]);
const onOpenChannels = useCallback(() => {
setSessionSearchOpen(false);
navigate({ view: "channels", activeKey, settingsSection: "channels" });
setMobileSidebarOpen(false);
}, [activeKey, navigate]);
const onOpenSkills = useCallback(() => {
setSessionSearchOpen(false);
navigate({ view: "skills", activeKey, settingsSection: "skills" });
setMobileSidebarOpen(false);
}, [activeKey, navigate]);
useEffect(() => { useEffect(() => {
const actions = { newChat: onNewChat, search: onOpenSessionSearch, apps: onOpenApps, const actions = { newChat: onNewChat, search: onOpenSessionSearch, apps: onOpenApps,
skills: onOpenSkills, automations: onOpenAutomations, channels: onOpenChannels, settings: () => onOpenSettings() }; automations: onOpenAutomations, settings: () => onOpenSettings() };
const handleKeyDown = (event: globalThis.KeyboardEvent) => { const handleKeyDown = (event: globalThis.KeyboardEvent) => {
if (!localActive) return; if (!localActive) return;
const action = matchSidebarShortcut(event); const action = matchSidebarShortcut(event);
@@ -1838,7 +1838,7 @@ function Shell({
}; };
window.addEventListener("keydown", handleKeyDown); window.addEventListener("keydown", handleKeyDown);
return () => window.removeEventListener("keydown", handleKeyDown); return () => window.removeEventListener("keydown", handleKeyDown);
}, [localActive, onNewChat, onOpenSessionSearch, onOpenApps, onOpenSkills, onOpenAutomations, onOpenChannels, onOpenSettings]); }, [localActive, onNewChat, onOpenSessionSearch, onOpenApps, onOpenAutomations, onOpenSettings]);
const onSettingsSectionChange = useCallback( const onSettingsSectionChange = useCallback(
(section: SettingsSectionKey) => { (section: SettingsSectionKey) => {
@@ -2317,20 +2317,10 @@ function Shell({
}); });
return; return;
} }
if (view === "channels") {
document.title = t("app.documentTitle.chat", { title: t("settings.nav.channels") });
return;
}
if (view === "remote") { if (view === "remote") {
document.title = t("app.documentTitle.chat", { title: t("remote.title") }); document.title = t("app.documentTitle.chat", { title: t("remote.title") });
return; return;
} }
if (view === "skills") {
document.title = t("app.documentTitle.chat", {
title: t("settings.nav.skills", { defaultValue: "Skills" }),
});
return;
}
document.title = activeSession document.title = activeSession
? t("app.documentTitle.chat", { title: headerTitle }) ? t("app.documentTitle.chat", { title: headerTitle })
: t("app.documentTitle.base"); : t("app.documentTitle.base");
@@ -2364,7 +2354,6 @@ function Shell({
: null, : null,
loading: loading || sidebarStateLoading, loading: loading || sidebarStateLoading,
initialLoading: sessionsInitialLoading || sidebarStateLoading, initialLoading: sessionsInitialLoading || sidebarStateLoading,
newChatActive: !managingConnections && view === "chat" && activeKey === null,
onNewChat, onNewChat,
onSelect: onSelectSidebarItem, onSelect: onSelectSidebarItem,
onCloseTemporaryChat, onCloseTemporaryChat,
@@ -2393,11 +2382,9 @@ function Shell({
: undefined, : undefined,
onOpenApps, onOpenApps,
onOpenAutomations, onOpenAutomations,
onOpenChannels,
onOpenSkills,
onSettingsIntent, onSettingsIntent,
onOpenSearch: onOpenSessionSearch, onOpenSearch: onOpenSessionSearch,
activeUtility: !managingConnections && (view === "apps" || view === "automations" || view === "skills" || view === "channels") ? view : null, activeUtility: !managingConnections && (view === "apps" || view === "automations") ? view : null,
onToggleArchived, onToggleArchived,
pinnedKeys: sidebarPinnedTabKeys, pinnedKeys: sidebarPinnedTabKeys,
archivedKeys: sidebarArchivedTabKeys, archivedKeys: sidebarArchivedTabKeys,
@@ -2460,29 +2447,34 @@ function Shell({
<aside <aside
data-testid="host-sidebar-flow" data-testid="host-sidebar-flow"
data-resizing={sidebarDragging || undefined} data-resizing={sidebarDragging || undefined}
data-collapsed={!hostSidebarOpen || undefined}
id="main-sidebar" id="main-sidebar"
className={cn( className={cn(
"group/sidebar relative z-20 hidden shrink-0 overflow-hidden lg:block", "sidebar-dock-frame group/sidebar relative z-20 hidden shrink-0 overflow-hidden bg-background lg:block",
sidebarDragging ? "select-none" : "transition-[width] duration-300 ease-out motion-reduce:transition-none", sidebarDragging && "select-none",
)} )}
data-theme-surface
style={{ style={{
width: hostSidebarFlowWidth, width: hostSidebarFlowWidth,
}} "--sidebar-open-width": `${sidebarWidth}px`,
} as CSSProperties}
> >
<div <div
aria-hidden
data-theme-surface data-theme-surface
className={cn( className={cn(
"absolute inset-y-0 left-0 h-full w-full overflow-hidden", "sidebar-dock-surface pointer-events-none absolute inset-0",
showHostChrome showHostChrome ? "host-sidebar-glass" : "bg-sidebar",
? "host-sidebar-glass"
: "bg-sidebar",
)} )}
> />
<div className="absolute inset-0">
<Sidebar <Sidebar
{...sidebarProps} {...sidebarProps}
collapsed={!hostSidebarOpen} collapsed={!hostSidebarOpen}
hostChromeInset={showHostChrome} hostChromeInset={showHostChrome}
onExpand={openHostSidebar} onExpand={openHostSidebar}
onCollapse={() => setHostSidebarOpen(false)}
desktopDock
/> />
</div> </div>
<SidebarResizeHandle <SidebarResizeHandle
@@ -2716,7 +2708,7 @@ function Shell({
mainNavigationExpanded={showMainSidebar && hostSidebarOpen} mainNavigationExpanded={showMainSidebar && hostSidebarOpen}
hostChromeInset={showHostChrome} hostChromeInset={showHostChrome}
onBackToChat={onBackToChat} onBackToChat={onBackToChat}
/> : <Suspense fallback={<StartupShell embedded surface={view} sidebarExpanded={hostSidebarOpen} />}> /> : <Suspense fallback={<StartupShell embedded surface={view === "apps" && isAppsSection(settingsInitialSection) ? settingsInitialSection : view} sidebarExpanded={hostSidebarOpen} />}>
<SettingsView <SettingsView
registerExitGuard={registerSettingsExitGuard} registerExitGuard={registerSettingsExitGuard}
themePreference={themePreference} themePreference={themePreference}
+1 -5
View File
@@ -5,11 +5,7 @@ export type ChannelPresentation = {
initials: string; initials: string;
color: string; color: string;
icon?: ComponentType<{ className?: string; strokeWidth?: string | number }>; icon?: ComponentType<{ className?: string; strokeWidth?: string | number }>;
logoUrl?: string; logoUrl?: `/brand/${string}`;
/** Official site favicon to use when the primary asset is hosted on a CDN. */
logoFallbackUrl?: string;
/** The primary asset already includes its own background and safe area. */
logoLayout?: "tile";
setup?: ChannelCatalogSetupPresentation; setup?: ChannelCatalogSetupPresentation;
}; };
+1 -9
View File
@@ -266,7 +266,6 @@ interface ChatListProps {
actionMenuPortalContainer?: HTMLElement | null; actionMenuPortalContainer?: HTMLElement | null;
loading?: boolean; loading?: boolean;
initialLoading?: boolean; initialLoading?: boolean;
emptyLabel?: string;
} }
export const ChatList = memo(function ChatList({ export const ChatList = memo(function ChatList({
@@ -309,7 +308,6 @@ export const ChatList = memo(function ChatList({
actionMenuPortalContainer, actionMenuPortalContainer,
loading, loading,
initialLoading = loading, initialLoading = loading,
emptyLabel,
}: ChatListProps) { }: ChatListProps) {
const { t } = useTranslation(); const { t } = useTranslation();
const [visibleLimit, setVisibleLimit] = useState(INITIAL_VISIBLE_SESSIONS); const [visibleLimit, setVisibleLimit] = useState(INITIAL_VISIBLE_SESSIONS);
@@ -638,13 +636,7 @@ export const ChatList = memo(function ChatList({
); );
} }
if (sessions.length === 0 && temporarySessions.length === 0) { if (sessions.length === 0 && temporarySessions.length === 0) return null;
return (
<div className="px-3 py-6 text-[12px] leading-5 text-sidebar-muted-foreground">
{emptyLabel ?? t("chat.noSessions")}
</div>
);
}
const running = new Set(runningChatIds); const running = new Set(runningChatIds);
const updated = new Set(updatedChatIds); const updated = new Set(updatedChatIds);
+155 -150
View File
@@ -1,21 +1,13 @@
import { import {
ArchiveIcon, ArchiveIcon,
SkillsIcon,
AutomationsIcon, AutomationsIcon,
ChannelsIcon,
SearchIcon, SearchIcon,
SettingsIcon, SettingsIcon,
NewChatIcon,
ComposeIcon, ComposeIcon,
AppsIcon, AppsIcon,
} from "@/components/icons/product-icons"; } from "@/components/icons/product-icons";
import { import { type ReactNode, useLayoutEffect, useRef, useState } from "react";
type ReactNode, import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
type RefObject,
useRef,
useState,
} from "react";
import { PanelLeftClose } from "lucide-react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import {
@@ -39,6 +31,7 @@ import type {
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import type { UpdateMethod } from "@/lib/api"; import type { UpdateMethod } from "@/lib/api";
import { sidebarShortcutAria, sidebarShortcutLabel } from "@/lib/sidebar-shortcuts"; import { sidebarShortcutAria, sidebarShortcutLabel } from "@/lib/sidebar-shortcuts";
import "./sidebar-dock.css";
interface SidebarProps { interface SidebarProps {
sessions: ChatSummary[]; sessions: ChatSummary[];
@@ -46,7 +39,6 @@ interface SidebarProps {
activeKey: string | null; activeKey: string | null;
loading: boolean; loading: boolean;
initialLoading?: boolean; initialLoading?: boolean;
newChatActive: boolean;
onNewChat: () => void; onNewChat: () => void;
onSelect: (key: string) => void; onSelect: (key: string) => void;
onCloseTemporaryChat?: (key: string) => void; onCloseTemporaryChat?: (key: string) => void;
@@ -73,12 +65,10 @@ interface SidebarProps {
onOpenUpdates?: () => void; onOpenUpdates?: () => void;
availableUpdate?: { version: string; onDismiss: () => void; onRequestUpdate?: () => void; installationMethod?: UpdateMethod | null }; availableUpdate?: { version: string; onDismiss: () => void; onRequestUpdate?: () => void; installationMethod?: UpdateMethod | null };
onOpenApps: () => void; onOpenApps: () => void;
onOpenSkills: () => void;
onOpenAutomations: () => void; onOpenAutomations: () => void;
onOpenChannels: () => void;
onSettingsIntent?: () => void; onSettingsIntent?: () => void;
onOpenSearch: () => void; onOpenSearch: () => void;
activeUtility?: "apps" | "skills" | "automations" | "channels" | null; activeUtility?: "apps" | "automations" | null;
onToggleArchived: () => void; onToggleArchived: () => void;
onCollapse?: () => void; onCollapse?: () => void;
onExpand?: () => void; onExpand?: () => void;
@@ -100,6 +90,7 @@ interface SidebarProps {
archivedCount?: number; archivedCount?: number;
defaultWorkspacePath?: string | null; defaultWorkspacePath?: string | null;
hostChromeInset?: boolean; hostChromeInset?: boolean;
desktopDock?: boolean;
} }
type NavigatorWithUserAgentData = Navigator & { type NavigatorWithUserAgentData = Navigator & {
@@ -119,36 +110,31 @@ export function Sidebar(props: SidebarProps) {
const [menuPortalContainer, setMenuPortalContainer] = const [menuPortalContainer, setMenuPortalContainer] =
useState<HTMLElement | null>(null); useState<HTMLElement | null>(null);
const collapsed = Boolean(props.collapsed); const collapsed = Boolean(props.collapsed);
const canExpand = collapsed && Boolean(props.onExpand);
const expandButton = useRef<HTMLButtonElement>(null);
const collapseButton = useRef<HTMLButtonElement>(null);
const restoreToggleFocus = useRef(false);
useLayoutEffect(() => {
if (!restoreToggleFocus.current) return;
restoreToggleFocus.current = false;
(collapsed ? expandButton : collapseButton).current?.focus();
}, [collapsed]);
const toggleLabel = t("thread.header.toggleSidebar"); const toggleLabel = t("thread.header.toggleSidebar");
const collapseLabel = t("sidebar.collapse");
const apple = isApplePlatform(); const apple = isApplePlatform();
const activeActionRef = useRef<HTMLButtonElement>(null); const activeUtilityId = props.activeUtility ? `utility:${props.activeUtility}` : null;
const activeActionId = collapsed && props.newChatActive const { desktopDock } = props;
? "new-chat" const footerActionProps = { collapsed, dockLabel: desktopDock, onIntent: props.onSettingsIntent, tooltipSide: "top" } as const;
: props.activeUtility
? `utility:${props.activeUtility}`
: null;
const newChatButton = (
<SidebarActionButton
collapsed={collapsed}
label={t("sidebar.newChat")}
iconOnly
className={collapsed ? undefined : "rounded-full border border-border/70 bg-background/80 shadow-sm settings-hover"}
onClick={props.onNewChat}
active={props.newChatActive}
selectionRef={collapsed ? activeActionRef : undefined}
icon={collapsed ? <NewChatIcon className="h-4 w-4" /> : <ComposeIcon className="h-4 w-4" />}
shortcut={sidebarShortcutLabel("newChat", apple)}
ariaKeyShortcuts={sidebarShortcutAria("newChat")}
/>
);
const searchButton = ( const searchButton = (
<SidebarActionButton <SidebarActionButton
collapsed={collapsed} collapsed={collapsed}
label={t("sidebar.searchAria")} label={t("sidebar.searchAria")}
shortcut={sidebarShortcutLabel("search", apple)} shortcut={sidebarShortcutLabel("search", apple)}
ariaKeyShortcuts={sidebarShortcutAria("search")} ariaKeyShortcuts={sidebarShortcutAria("search")}
iconOnly iconOnly={!desktopDock}
dockLabel={desktopDock}
onClick={props.onOpenSearch} onClick={props.onOpenSearch}
icon={<SearchIcon className="h-4 w-4" />} icon={<SearchIcon className="h-4 w-4" />}
/> />
@@ -161,134 +147,119 @@ export function Sidebar(props: SidebarProps) {
data-theme-ink data-theme-ink
ref={props.containActionMenus ? setMenuPortalContainer : undefined} ref={props.containActionMenus ? setMenuPortalContainer : undefined}
aria-label={t("sidebar.navigation")} aria-label={t("sidebar.navigation")}
data-sidebar-collapsed={desktopDock ? collapsed : undefined}
className={cn( className={cn(
"flex h-full w-full min-w-0 flex-col text-sidebar-content", "flex h-full w-full min-w-0 flex-col text-sidebar-content",
props.hostChromeInset ? "bg-transparent" : "bg-sidebar", desktopDock || collapsed || props.hostChromeInset ? "bg-transparent" : "bg-sidebar",
)} )}
> >
<div <div
data-testid="sidebar-brand-row" data-testid="sidebar-brand-row"
className={cn( className={cn(
"flex items-start gap-1 pb-4 pt-3", "flex items-start justify-between gap-1 pb-4 ps-3 pt-3",
collapsed ? "w-14 justify-start px-3" : "justify-between ps-4 pe-2", collapsed ? "w-14 pe-3" : "pe-2",
)} )}
> >
<button <HoverHint enabled={canExpand} content={toggleLabel} side="right">
data-testid="sidebar-brand-mark" <Button
type="button" ref={expandButton}
aria-label={collapsed ? toggleLabel : undefined} data-testid="sidebar-brand-mark"
aria-hidden={collapsed ? undefined : true} type="button"
title={collapsed ? toggleLabel : undefined} size="icon"
onClick={collapsed ? props.onExpand : undefined} variant={canExpand ? "icon" : null}
tabIndex={collapsed ? 0 : -1} aria-label={canExpand ? toggleLabel : undefined}
className={cn( aria-expanded={canExpand ? false : undefined}
"host-no-drag relative flex h-8 w-8 shrink-0 items-center justify-center rounded-control transition-colors", aria-hidden={canExpand ? undefined : true}
props.hostChromeInset && "mt-5", onClick={canExpand ? (event) => {
!collapsed && "pointer-events-none", restoreToggleFocus.current = event.detail === 0 && Boolean(props.onCollapse);
)} props.onExpand?.();
> } : undefined}
<img tabIndex={canExpand ? 0 : -1}
src="/brand/nanobot_mark.svg" className={cn(
alt="" "host-no-drag group/brand relative h-8 w-8 shrink-0",
className="theme-art h-8 w-8 select-none object-contain dark:opacity-0" props.hostChromeInset && "mt-5",
draggable={false} !canExpand && "pointer-events-none",
/> )}
<img >
src="/brand/nanobot_mark_night.svg" <span className={cn("relative h-8 w-8", canExpand && "media-hover:group-hover/brand:opacity-0 group-focus-visible/brand:opacity-0")}>
alt="" <img
className="theme-art absolute inset-0 h-8 w-8 select-none object-contain opacity-0 dark:opacity-100" src="/brand/nanobot_mark.svg"
draggable={false} alt=""
/> className="theme-art h-8 w-8 select-none object-contain dark:opacity-0"
</button> draggable={false}
/>
<img
src="/brand/nanobot_mark_night.svg"
alt=""
className="theme-art absolute inset-0 h-8 w-8 select-none object-contain opacity-0 dark:opacity-100"
draggable={false}
/>
</span>
{canExpand && <PanelLeftOpen aria-hidden className="absolute inset-2 h-4 w-4 opacity-0 media-hover:group-hover/brand:opacity-100 group-focus-visible/brand:opacity-100" />}
</Button>
</HoverHint>
{!collapsed && ( {!collapsed && (
<div className={cn("flex min-w-0 flex-1 items-center justify-end gap-1", props.hostChromeInset && "mt-5")}> <div className={cn("flex min-w-0 flex-1 items-center justify-end gap-1", props.hostChromeInset && "mt-5")}>
{searchButton} {!desktopDock && searchButton}
{newChatButton}
{props.onCollapse && ( {props.onCollapse && (
<SidebarActionButton collapsed={false} label={t("sidebar.collapse")} iconOnly <HoverHint content={collapseLabel} side="right">
onClick={props.onCollapse} icon={<PanelLeftClose className="h-4 w-4" />} /> <Button
ref={collapseButton}
type="button"
size="icon"
variant="icon"
className="host-no-drag h-8 w-8 shrink-0 text-sidebar-content"
aria-label={collapseLabel}
aria-expanded={props.onExpand ? true : undefined}
onClick={(event) => {
restoreToggleFocus.current = event.detail === 0 && Boolean(props.onExpand);
props.onCollapse?.();
}}
>
<PanelLeftClose aria-hidden className="h-4 w-4" />
</Button>
</HoverHint>
)} )}
</div> </div>
)} )}
</div> </div>
<SidebarSelectionHighlight <div className={cn("flex flex-col gap-0.5 pb-1", desktopDock || collapsed ? "px-3" : "px-2")}>
targetRef={activeActionRef}
activeId={activeActionId}
scope="actions"
className={cn(
"relative gap-0.5 pb-1",
collapsed ? "flex w-14 flex-col items-center px-0" : "flex flex-col px-2",
)}
>
{collapsed && <>{newChatButton}{searchButton}</>}
<SidebarActionButton <SidebarActionButton
collapsed={collapsed} collapsed={collapsed}
label={t("sidebar.apps")} label={t("sidebar.newChat")}
shortcut={sidebarShortcutLabel("apps", apple)} dockLabel={desktopDock}
ariaKeyShortcuts={sidebarShortcutAria("apps")} onClick={props.onNewChat}
onClick={props.onOpenApps} icon={<ComposeIcon className="h-4 w-4" />}
onIntent={props.onSettingsIntent} shortcut={sidebarShortcutLabel("newChat", apple)}
active={props.activeUtility === "apps"} ariaKeyShortcuts={sidebarShortcutAria("newChat")}
selectionRef={activeActionRef}
icon={<AppsIcon className="h-4 w-4" />}
/>
<SidebarActionButton
collapsed={collapsed}
label={t("sidebar.skills.title")}
shortcut={sidebarShortcutLabel("skills", apple)}
ariaKeyShortcuts={sidebarShortcutAria("skills")}
onClick={props.onOpenSkills}
onIntent={props.onSettingsIntent}
active={props.activeUtility === "skills"}
selectionRef={activeActionRef}
icon={<SkillsIcon className="h-4 w-4" />}
/>
<SidebarActionButton
collapsed={collapsed}
label={t("sidebar.automations", { defaultValue: "Automations" })}
shortcut={sidebarShortcutLabel("automations", apple)}
ariaKeyShortcuts={sidebarShortcutAria("automations")}
onClick={props.onOpenAutomations}
onIntent={props.onSettingsIntent}
active={props.activeUtility === "automations"}
selectionRef={activeActionRef}
icon={<AutomationsIcon className="h-4 w-4" />}
/>
<SidebarActionButton
collapsed={collapsed}
label={t("settings.nav.channels")}
shortcut={sidebarShortcutLabel("channels", apple)}
ariaKeyShortcuts={sidebarShortcutAria("channels")}
onClick={props.onOpenChannels}
onIntent={props.onSettingsIntent}
active={props.activeUtility === "channels"}
selectionRef={activeActionRef}
icon={<ChannelsIcon className="h-4 w-4" />}
/> />
{(desktopDock || collapsed) && searchButton}
{props.archivedCount ? ( {props.archivedCount ? (
<SidebarActionButton <SidebarActionButton
collapsed={collapsed} collapsed={collapsed}
dockLabel={desktopDock}
label={props.showArchived ? t("chat.hideArchived") : t("chat.showArchived")} label={props.showArchived ? t("chat.hideArchived") : t("chat.showArchived")}
onClick={props.onToggleArchived} onClick={props.onToggleArchived}
icon={<ArchiveIcon className="h-4 w-4" />} icon={<ArchiveIcon className="h-4 w-4" />}
/> />
) : null} ) : null}
</SidebarSelectionHighlight> </div>
<div <div
aria-hidden={collapsed || undefined}
{...(collapsed ? { inert: "" } : {})}
className={cn( className={cn(
"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden transition-opacity duration-200", "flex min-h-0 flex-1 flex-col overflow-hidden",
collapsed && "pointer-events-none opacity-0", desktopDock ? "sidebar-dock-history" : "min-w-0",
)} )}
> >
{!collapsed && ( {(desktopDock || !collapsed) && (
<ChatList <ChatList
sessions={props.sessions} sessions={props.sessions}
temporarySessions={props.temporarySessions} temporarySessions={props.temporarySessions}
activeKey={props.activeKey} activeKey={props.activeKey}
loading={props.loading} loading={props.loading}
initialLoading={props.initialLoading} initialLoading={props.initialLoading}
emptyLabel={t("chat.noSessions")}
onSelect={props.onSelect} onSelect={props.onSelect}
onCloseTemporaryChat={props.onCloseTemporaryChat} onCloseTemporaryChat={props.onCloseTemporaryChat}
onRequestDelete={props.onRequestDelete} onRequestDelete={props.onRequestDelete}
@@ -334,24 +305,56 @@ export function Sidebar(props: SidebarProps) {
onRequestUpdate={props.availableUpdate.onRequestUpdate} installationMethod={props.availableUpdate.installationMethod} /> onRequestUpdate={props.availableUpdate.onRequestUpdate} installationMethod={props.availableUpdate.installationMethod} />
)} )}
<div <div
data-testid="sidebar-footer"
data-theme-surface data-theme-surface
className={cn( className={cn(
"flex items-center justify-between gap-1 px-2.5 py-3 text-xs", "flex shrink-0 flex-col gap-0.5 px-2 py-3 text-xs",
props.hostChromeInset && "bg-sidebar/55", desktopDock && "px-3",
collapsed && "w-14 flex-col px-0", props.hostChromeInset && !desktopDock && !collapsed && "bg-sidebar/55",
collapsed && !desktopDock && "w-14 px-0",
)} )}
> >
<SidebarActionButton <SidebarSelectionHighlight
collapsed={collapsed} targetSelector=':scope > button[aria-current="page"]'
label={t("sidebar.settings")} activeId={activeUtilityId}
iconOnly scope="actions"
shortcut={sidebarShortcutLabel("settings", apple)} className={cn("relative flex flex-col gap-0.5", collapsed && !desktopDock && "items-center")}
ariaKeyShortcuts={sidebarShortcutAria("settings")} >
onClick={props.onOpenSettings} <SidebarActionButton
onIntent={props.onSettingsIntent} {...footerActionProps}
icon={<SettingsIcon className="h-4 w-4" />} label={t("sidebar.apps")}
/> shortcut={sidebarShortcutLabel("apps", apple)}
<HostSwitcher collapsed={collapsed} portalContainer={props.containActionMenus ? menuPortalContainer : undefined} /> ariaKeyShortcuts={sidebarShortcutAria("apps")}
onClick={props.onOpenApps}
active={props.activeUtility === "apps"}
icon={<AppsIcon className="h-4 w-4" />}
/>
<SidebarActionButton
{...footerActionProps}
label={t("sidebar.automations", { defaultValue: "Automations" })}
shortcut={sidebarShortcutLabel("automations", apple)}
ariaKeyShortcuts={sidebarShortcutAria("automations")}
onClick={props.onOpenAutomations}
active={props.activeUtility === "automations"}
icon={<AutomationsIcon className="h-4 w-4" />}
/>
</SidebarSelectionHighlight>
<div className={cn("flex min-w-0 items-center gap-1", desktopDock ? "sidebar-dock-footer-row" : collapsed && "flex-col")}>
<SidebarActionButton
{...footerActionProps}
className={desktopDock ? "sidebar-dock-settings" : collapsed ? undefined : "w-auto max-w-[60%] shrink-0"}
label={t("sidebar.settings")}
shortcut={sidebarShortcutLabel("settings", apple)}
ariaKeyShortcuts={sidebarShortcutAria("settings")}
onClick={props.onOpenSettings}
icon={<SettingsIcon className="h-4 w-4" />}
/>
{desktopDock ? (
<div className="sidebar-dock-host flex min-w-0 items-center">
<HostSwitcher />
</div>
) : <HostSwitcher collapsed={collapsed} portalContainer={props.containActionMenus ? menuPortalContainer : undefined} />}
</div>
</div> </div>
</nav> </nav>
); );
@@ -360,6 +363,7 @@ export function Sidebar(props: SidebarProps) {
function SidebarActionButton({ function SidebarActionButton({
collapsed, collapsed,
iconOnly = false, iconOnly = false,
dockLabel = false,
label, label,
icon, icon,
onClick, onClick,
@@ -368,10 +372,11 @@ function SidebarActionButton({
shortcut, shortcut,
ariaKeyShortcuts, ariaKeyShortcuts,
onIntent, onIntent,
selectionRef, tooltipSide,
}: { }: {
collapsed: boolean; collapsed: boolean;
iconOnly?: boolean; iconOnly?: boolean;
dockLabel?: boolean;
label: string; label: string;
icon: ReactNode; icon: ReactNode;
onClick: () => void; onClick: () => void;
@@ -380,13 +385,12 @@ function SidebarActionButton({
shortcut?: string; shortcut?: string;
ariaKeyShortcuts?: string; ariaKeyShortcuts?: string;
onIntent?: () => void; onIntent?: () => void;
selectionRef?: RefObject<HTMLButtonElement>; tooltipSide?: "top" | "bottom";
}) { }) {
const compact = collapsed || iconOnly; const compact = collapsed || iconOnly;
const button = ( const button = (
<Button <Button
ref={active ? selectionRef : undefined}
type="button" type="button"
variant={compact ? "icon" : null} variant={compact ? "icon" : null}
aria-label={label} aria-label={label}
@@ -398,10 +402,9 @@ function SidebarActionButton({
className={cn( className={cn(
"touch-target group h-8 min-w-0 gap-2 overflow-hidden rounded-control font-normal", "touch-target group h-8 min-w-0 gap-2 overflow-hidden rounded-control font-normal",
SIDEBAR_SELECTION_ACTION_ITEM_CLASS, SIDEBAR_SELECTION_ACTION_ITEM_CLASS,
collapsed dockLabel || !compact
? "w-8 justify-center gap-0 px-0" ? "w-full justify-start gap-2 px-2 text-[13px] leading-5 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:stroke-[1.75]"
: iconOnly ? "w-8 shrink-0 justify-center gap-0 rounded-control px-0" : "w-8 shrink-0 justify-center gap-0 rounded-control px-0",
: "w-full justify-start gap-2 px-2 text-[13px] leading-5 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:stroke-[1.75]",
active active
? "text-sidebar-accent-foreground" ? "text-sidebar-accent-foreground"
: compact : compact
@@ -413,13 +416,15 @@ function SidebarActionButton({
<span className="flex shrink-0 items-center justify-center" aria-hidden> <span className="flex shrink-0 items-center justify-center" aria-hidden>
{icon} {icon}
</span> </span>
{!compact && <span className="min-w-0 max-w-[12rem] truncate whitespace-nowrap"> {(dockLabel || !compact) && (
{label} <span aria-hidden={dockLabel || undefined} className={cn("min-w-0 max-w-48 truncate", dockLabel && "sidebar-dock-label")}>
</span>} {label}
</span>
)}
</Button> </Button>
); );
return compact || shortcut ? ( return compact || shortcut ? (
<HoverHint side={collapsed ? "right" : "bottom"} contentClassName="flex items-center gap-4" content={<> <HoverHint side={collapsed ? "right" : tooltipSide ?? "bottom"} contentClassName="flex items-center gap-4" content={<>
<span>{label}</span> <span>{label}</span>
{shortcut ? <kbd className="whitespace-nowrap font-sans text-muted-foreground">{shortcut}</kbd> : null} {shortcut ? <kbd className="whitespace-nowrap font-sans text-muted-foreground">{shortcut}</kbd> : null}
</>}> </>}>
+1 -1
View File
@@ -37,7 +37,7 @@ export function SidebarResizeHandle({ width, open, onResize, onDraggingChange }:
aria-valuemin={56} aria-valuemin={56}
aria-valuemax={SIDEBAR_MAX_WIDTH} aria-valuemax={SIDEBAR_MAX_WIDTH}
aria-valuenow={open ? width : 56} aria-valuenow={open ? width : 56}
className="host-no-drag absolute inset-y-0 right-0 z-30 w-3 cursor-grab active:cursor-grabbing touch-none select-none outline-none after:absolute after:top-1/2 after:right-1 after:h-12 after:w-1 after:-translate-y-1/2 after:rounded-full after:bg-transparent hover:after:bg-orange-500/70 active:after:bg-orange-500 focus-visible:after:bg-orange-500" className="host-no-drag absolute inset-y-0 right-0 z-30 w-3 cursor-col-resize touch-none select-none outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-muted-foreground/60"
onPointerDown={(event) => { onPointerDown={(event) => {
if (event.button !== 0) return; if (event.button !== 0) return;
event.preventDefault(); event.preventDefault();
+10 -5
View File
@@ -21,7 +21,8 @@ export function readStartupLayout() {
} }
const [path, query = ""] = hash.split("?", 2); const [path, query = ""] = hash.split("?", 2);
const section = new URLSearchParams(query).get("section") || "overview"; const section = new URLSearchParams(query).get("section") || "overview";
const page = path === "/settings" ? section : path.slice(1); const page = path === "/settings" || (path === "/apps" && (section === "skills" || section === "channels"))
? section : path.slice(1);
let surface: StartupSurface = "chat"; let surface: StartupSurface = "chat";
if (page === "skills" || page === "apps" || page === "channels" || page === "automations" || page === "remote") surface = page; if (page === "skills" || page === "apps" || page === "channels" || page === "automations" || page === "remote") surface = page;
else if (path === "/settings") surface = "settings"; else if (path === "/settings") surface = "settings";
@@ -90,10 +91,14 @@ export function StartupSkeleton({
<div className="startup-scroll"> <div className="startup-scroll">
<div className="startup-page"> <div className="startup-page">
<div className="startup-page-header"><div className="startup-back"><Block /></div><div className="startup-title"><Block /></div></div> <div className="startup-page-header"><div className="startup-back"><Block /></div><div className="startup-title"><Block /></div></div>
<div className="startup-tabs"><Block /></div> <div className="startup-panel apps-catalog-layout">
<div className="startup-panel"> <div className="catalog-tabs startup-tabs"><Block /><Block /><Block /></div>
<div className="startup-toolbar"><Block className="startup-search" /><Block className="startup-filters" /></div> <div className="catalog-controls startup-controls">
<div className="startup-catalog-frame"> <div className="catalog-choices startup-primary-choices"><Block /><Block /><Block /><Block /></div>
<div className="catalog-choices startup-secondary-choices"><Block /><Block /><Block /></div>
</div>
<Block className="catalog-search startup-search" />
<div className="catalog-body startup-catalog-frame">
<div className="startup-catalog-heading"><Block /></div> <div className="startup-catalog-heading"><Block /></div>
<div className="startup-catalog"> <div className="startup-catalog">
<div className="startup-catalog-group"><Block /></div> <div className="startup-catalog-group"><Block /></div>
+3
View File
@@ -0,0 +1,3 @@
:root {
--content-column-width: 49.5rem;
}
@@ -22,7 +22,6 @@ export const SearchIcon = productIcon("search", <><circle cx="10.5" cy="10.5" r=
export const AppsIcon = productIcon("apps", <><rect x="3.5" y="3.5" width="6.5" height="6.5" rx="1.75" /><rect x="14" y="3.5" width="6.5" height="6.5" rx="1.75" /><rect x="3.5" y="14" width="6.5" height="6.5" rx="1.75" /><rect x="14" y="14" width="6.5" height="6.5" rx="1.75" /></>); export const AppsIcon = productIcon("apps", <><rect x="3.5" y="3.5" width="6.5" height="6.5" rx="1.75" /><rect x="14" y="3.5" width="6.5" height="6.5" rx="1.75" /><rect x="3.5" y="14" width="6.5" height="6.5" rx="1.75" /><rect x="14" y="14" width="6.5" height="6.5" rx="1.75" /></>);
export const SkillsIcon = productIcon("skills", <path d="M8 6.5H5.5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V16h1a2.5 2.5 0 0 0 0-5h-1V8.5a2 2 0 0 0-2-2H13v-1a2.5 2.5 0 0 0-5 0Z" />); export const SkillsIcon = productIcon("skills", <path d="M8 6.5H5.5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V16h1a2.5 2.5 0 0 0 0-5h-1V8.5a2 2 0 0 0-2-2H13v-1a2.5 2.5 0 0 0-5 0Z" />);
export const AutomationsIcon = productIcon("automations", <><rect x="3.5" y="3.5" width="17" height="17" rx="3" /><path d="M12 7.5V12l3 2" /></>); export const AutomationsIcon = productIcon("automations", <><rect x="3.5" y="3.5" width="17" height="17" rx="3" /><path d="M12 7.5V12l3 2" /></>);
export const ChannelsIcon = productIcon("channels", <path d="M6.5 3.5h11a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H9l-4 2v-2.4a3 3 0 0 1-1.5-2.6v-9a3 3 0 0 1 3-3Z" />);
export const ArchiveIcon = productIcon("archive", <><rect x="3" y="3.5" width="18" height="4.5" rx="1.5" /><path d="M4.5 8v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V8M9 12h6" /></>); export const ArchiveIcon = productIcon("archive", <><rect x="3" y="3.5" width="18" height="4.5" rx="1.5" /><path d="M4.5 8v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V8M9 12h6" /></>);
export const SettingsIcon = productIcon("settings", <><path d="M10 3h4l.6 2.4 2.1 1.2 2.4-.7 2 3.5-1.8 1.7v1.8l1.8 1.7-2 3.5-2.4-.7-2.1 1.2L14 21h-4l-.6-2.4-2.1-1.2-2.4.7-2-3.5 1.8-1.7v-1.8L2.9 9.4l2-3.5 2.4.7 2.1-1.2L10 3Z" /><circle cx="12" cy="12" r="3" /></>); export const SettingsIcon = productIcon("settings", <><path d="M10 3h4l.6 2.4 2.1 1.2 2.4-.7 2 3.5-1.8 1.7v1.8l1.8 1.7-2 3.5-2.4-.7-2.1 1.2L14 21h-4l-.6-2.4-2.1-1.2-2.4.7-2-3.5 1.8-1.7v-1.8L2.9 9.4l2-3.5 2.4.7 2.1-1.2L10 3Z" /><circle cx="12" cy="12" r="3" /></>);
export const OverviewIcon = productIcon("overview", <><rect x="3" y="3" width="18" height="18" rx="3" /><path d="M3 9h18M9 9v12m4-4v-3m4 3v-5" /><path d="M6 6h.01" /></>); export const OverviewIcon = productIcon("overview", <><rect x="3" y="3" width="18" height="18" rx="3" /><path d="M3 9h18M9 9v12m4-4v-3m4 3v-5" /><path d="M6 6h.01" /></>);
@@ -6,7 +6,6 @@ import { channelUiPresentation } from "@/channel-plugins/registry";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { floatingSurfaceElevationClassName } from "@/components/ui/floating-surface"; import { floatingSurfaceElevationClassName } from "@/components/ui/floating-surface";
import { useLogoFallback } from "@/hooks/useLogoFallback"; import { useLogoFallback } from "@/hooks/useLogoFallback";
import { logoFallbackUrls } from "@/lib/provider-brand";
import type { PairingRequestInfo } from "@/lib/types"; import type { PairingRequestInfo } from "@/lib/types";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
@@ -190,11 +189,8 @@ function PairingChannelBadge({ channel }: { channel: string }) {
const presentation = pairingChannelPresentation(channel); const presentation = pairingChannelPresentation(channel);
const initials = presentation.initials; const initials = presentation.initials;
const color = presentation.color; const color = presentation.color;
const logoUrls = useMemo( const brandLogoUrl = presentation.logoUrl;
() => logoFallbackUrls(presentation?.logoUrl), const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(brandLogoUrl ? [brandLogoUrl] : undefined);
[presentation?.logoUrl],
);
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(logoUrls);
return ( return (
<div <div
@@ -138,7 +138,7 @@ export function HostSwitcherView({ picker, status, collapsed = false, portalCont
: remote ? <Server className="h-4 w-4" /> : <Laptop className="h-4 w-4" />} : remote ? <Server className="h-4 w-4" /> : <Laptop className="h-4 w-4" />}
{!waiting && !failed && <span aria-hidden className={cn("absolute -bottom-0.5 -right-0.5 h-1.5 w-1.5 rounded-full ring-2 ring-sidebar", currentStatus === "open" ? "bg-emerald-500" : "bg-muted-foreground")} />} {!waiting && !failed && <span aria-hidden className={cn("absolute -bottom-0.5 -right-0.5 h-1.5 w-1.5 rounded-full ring-2 ring-sidebar", currentStatus === "open" ? "bg-emerald-500" : "bg-muted-foreground")} />}
</span> </span>
{!collapsed && <><span className="truncate">{label}</span><ChevronUp className="ml-auto h-3 w-3 shrink-0 opacity-60" /></>} {!collapsed && <><span className="truncate" data-sidebar-host-label>{label}</span><ChevronUp className="ml-auto h-3 w-3 shrink-0 opacity-60" data-sidebar-host-label /></>}
<span className="sr-only" role="status">{detail}</span> <span className="sr-only" role="status">{detail}</span>
</Button>; </Button>;
const trigger = <TooltipTrigger asChild>{button}</TooltipTrigger>; const trigger = <TooltipTrigger asChild>{button}</TooltipTrigger>;
+42 -14
View File
@@ -3,13 +3,15 @@ import { useCallback, useEffect, useRef, useState, type ReactNode } from "react"
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogLayoutContext, DialogTitle } from "@/components/ui/dialog"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogLayoutContext, DialogTitle } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import type { SettingsExitGuard, SettingsFocusTarget } from "@/components/settings/contracts"; import type { SettingsExitGuard, SettingsFocusTarget } from "@/components/settings/contracts";
import { isCapabilitySection, type SettingsSectionKey } from "@/components/settings/contracts"; import { isAppsSection, isCapabilitySection, type AppsSectionKey, type SettingsSectionKey } from "@/components/settings/contracts";
import { SegmentedControl } from "@/components/ui/segmented-control";
import { SettingsFeature } from "@/components/settings/shared/SettingsFeature"; import { SettingsFeature } from "@/components/settings/shared/SettingsFeature";
import type { EditCompletion } from "@/components/settings/shared/useEditCompletion"; import type { EditCompletion } from "@/components/settings/shared/useEditCompletion";
import { SharedProxySetupDialog } from "@/components/settings/shared/SharedProxySetupDialog"; import { SharedProxySetupDialog } from "@/components/settings/shared/SharedProxySetupDialog";
import { SettingsSectionSkeleton } from "@/components/settings/shared/SettingsSectionSkeleton"; import { SettingsSectionSkeleton } from "@/components/settings/shared/SettingsSectionSkeleton";
import { SkillsCatalogSettings } from "@/components/settings/SkillsCatalogSettings"; import { SkillsCatalogPage, useSkillsCatalogSearch } from "@/components/settings/SkillsCatalogSettings";
import { CatalogSearch } from "@/components/settings/shared/CatalogToolbar";
import { ImageGenerationSettings } from "@/components/settings/capabilities/ImageGenerationSettings"; import { ImageGenerationSettings } from "@/components/settings/capabilities/ImageGenerationSettings";
import { AdvancedSettings } from "@/components/settings/capabilities/SecuritySettings"; import { AdvancedSettings } from "@/components/settings/capabilities/SecuritySettings";
import { TranscriptionSettings } from "@/components/settings/capabilities/TranscriptionSettings"; import { TranscriptionSettings } from "@/components/settings/capabilities/TranscriptionSettings";
@@ -99,6 +101,8 @@ export function SettingsPage({
const { client, webuiCapabilities } = useClient(); const { client, webuiCapabilities } = useClient();
const [dialogLayoutAnchor, setDialogLayoutAnchor] = useState<HTMLDivElement | null>(null); const [dialogLayoutAnchor, setDialogLayoutAnchor] = useState<HTMLDivElement | null>(null);
const [mcpSetupName, setMcpSetupName] = useState<string | null>(null); const [mcpSetupName, setMcpSetupName] = useState<string | null>(null);
const [channelsQuery, setChannelsQuery] = useState("");
const skillsSearch = useSkillsCatalogSearch();
const presetDeletedCallback = useRef<(() => void) | null>(null); const presetDeletedCallback = useRef<(() => void) | null>(null);
const [providerPanel, setProviderPanel] = useState<ProviderSettingsEntry | null>(null); const [providerPanel, setProviderPanel] = useState<ProviderSettingsEntry | null>(null);
const [proxySetupOpen, setProxySetupOpen] = useState(false); const [proxySetupOpen, setProxySetupOpen] = useState(false);
@@ -494,6 +498,7 @@ export function SettingsPage({
case "channels": case "channels":
return ( return (
<ChannelsSettings <ChannelsSettings
query={channelsQuery}
onBeforeCloseChange={registerChannelCompletion} onBeforeCloseChange={registerChannelCompletion}
onConfigureMcp={(name) => { onConfigureMcp={(name) => {
setMcpSetupName(name); setMcpSetupName(name);
@@ -519,7 +524,6 @@ export function SettingsPage({
); );
case "apps": case "apps":
return ( return (
<div className="settings-stack">
<AppsCatalogPage <AppsCatalogPage
onConfigureProxy={configureProxy} onConfigureProxy={configureProxy}
setupName={mcpSetupName} setupName={mcpSetupName}
@@ -581,7 +585,6 @@ export function SettingsPage({
onRestart={restartViaSettingsSurface} onRestart={restartViaSettingsSurface}
isRestarting={restartInProgress} isRestarting={restartInProgress}
/> />
</div>
); );
case "automations": case "automations":
return ( return (
@@ -612,12 +615,24 @@ export function SettingsPage({
</div> </div>
); );
case "skills": case "skills":
return <SkillsCatalogSettings skills={skills} loading={skillsLoading} error={skillsError} />; return <SkillsCatalogPage skills={skills} loading={skillsLoading} error={skillsError} searchState={skillsSearch} />;
default: default:
return renderSettingsSection(section, embedded); return renderSettingsSection(section, embedded);
} }
}; };
// Appearance reads only browser-local preferences, not the gateway settings snapshot. // Appearance reads only browser-local preferences, not the gateway settings snapshot.
const appsSection = isAppsSection(activeSection);
const catalogSearch = activeSection === "skills" ? skillsSearch.search
: activeSection === "channels" ? {
type: "search",
value: channelsQuery,
onChange: (event: React.ChangeEvent<HTMLInputElement>) => setChannelsQuery(event.target.value),
placeholder: t("settings.channels.search"),
} : activeSection === "apps" ? {
value: systemState.appsQuery,
onChange: (event: React.ChangeEvent<HTMLInputElement>) => systemState.setAppsQuery(event.target.value),
placeholder: t("settings.apps.searchPlaceholder"),
} : null;
const localSection = activeSection === "appearance"; const localSection = activeSection === "appearance";
const sectionReady = localSection || settings !== null || activeSection === "skills" || activeSection === "apps" const sectionReady = localSection || settings !== null || activeSection === "skills" || activeSection === "apps"
|| activeSection === "channels" || activeSection === "automations"; || activeSection === "channels" || activeSection === "automations";
@@ -731,12 +746,12 @@ export function SettingsPage({
<div <div
className={cn( className={cn(
"min-w-0 flex-1 bg-settings-canvas [scrollbar-gutter:stable]", "min-w-0 flex-1 overflow-y-auto bg-settings-canvas [scrollbar-gutter:stable]",
"overflow-y-auto", !showSidebar && (appsSection || activeSection === "automations") && "sm:[scrollbar-gutter:stable_both-edges]",
)} )}
> >
<div <div
key={activeSection} key={appsSection ? "apps" : activeSection}
data-testid="settings-section-transition" data-testid="settings-section-transition"
ref={setDialogLayoutAnchor} ref={setDialogLayoutAnchor}
data-settings-section={activeSection} data-settings-section={activeSection}
@@ -747,7 +762,6 @@ export function SettingsPage({
"settings-grid", "settings-grid",
activeSection === "about" && "flex min-h-full flex-col", activeSection === "about" && "flex min-h-full flex-col",
!showSidebar && "settings-feature-page", !showSidebar && "settings-feature-page",
!showSidebar && activeSection === "automations" && "settings-automations-grid",
hostChromeInset && "pt-[4.25rem] sm:pt-[4.25rem] lg:pt-[4.75rem]", hostChromeInset && "pt-[4.25rem] sm:pt-[4.25rem] lg:pt-[4.75rem]",
)} )}
> >
@@ -762,7 +776,7 @@ export function SettingsPage({
{t("settings.backToChat")} {t("settings.backToChat")}
</button> </button>
{activeSection !== "automations" ? <h1 className="text-[24px] font-normal leading-tight tracking-normal text-foreground sm:text-[28px]"> {activeSection !== "automations" ? <h1 className="text-[24px] font-normal leading-tight tracking-normal text-foreground sm:text-[28px]">
{t(`settings.nav.${activeSection}`, { {t(`settings.nav.${appsSection ? "apps" : activeSection}`, {
defaultValue: standaloneSectionTitle(activeSection), defaultValue: standaloneSectionTitle(activeSection),
})} })}
</h1> : null} </h1> : null}
@@ -781,17 +795,31 @@ export function SettingsPage({
) : sectionReady ? ( ) : sectionReady ? (
<div <div
className={cn( className={cn(
"settings-stack", appsSection ? "apps-catalog-layout" : "settings-stack",
activeSection === "about" && "flex flex-1 flex-col", activeSection === "about" && "flex flex-1 flex-col",
activeSection === "channels" &&
"flex min-h-0 flex-1 flex-col xl:overflow-hidden",
)} )}
> >
{error && (!localSection || settings !== null) ? ( {error && (!localSection || settings !== null) ? (
<div className="rounded-floating border border-destructive/20 bg-destructive/5 px-4 py-3 text-[13px] text-destructive"> <div className="col-span-full rounded-floating border border-destructive/20 bg-destructive/5 px-4 py-3 text-[13px] text-destructive">
{error} {error}
</div> </div>
) : null} ) : null}
{appsSection && !showSidebar ? (
<SegmentedControl<AppsSectionKey>
value={activeSection}
onChange={selectSection}
ariaLabel={t("settings.nav.apps")}
className="catalog-tabs min-h-9 shrink-0 rounded-control"
itemClassName="min-h-7 rounded-compact px-3 py-0"
indicatorClassName="rounded-compact"
options={[
{ value: "apps", label: t("settings.apps.featured") },
{ value: "skills", label: t("settings.nav.skills") },
{ value: "channels", label: t("settings.nav.channels") },
]}
/>
) : null}
{catalogSearch && <CatalogSearch {...catalogSearch} />}
{renderSection(isCapabilitySection(activeSection) ? "capabilities" : activeSection)} {renderSection(isCapabilitySection(activeSection) ? "capabilities" : activeSection)}
</div> </div>
) : null} ) : null}
@@ -7,7 +7,6 @@ import {
KeyRound, KeyRound,
PowerOff, PowerOff,
RefreshCw, RefreshCw,
Search,
Terminal, Terminal,
Trash2, Trash2,
} from "lucide-react"; } from "lucide-react";
@@ -26,33 +25,55 @@ import {
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Disclosure } from "@/components/ui/disclosure"; import { Disclosure } from "@/components/ui/disclosure";
import { ExpandableText } from "@/components/ui/expandable-text"; import { ExpandableText } from "@/components/ui/expandable-text";
import { SearchInput } from "@/components/ui/input"; import { CatalogControls, CatalogFilter, CatalogToolbar } from "@/components/settings/shared/CatalogToolbar";
import { SegmentedControl } from "@/components/ui/segmented-control";
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@/components/ui/sheet"; import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@/components/ui/sheet";
import { SkillsMarketplace } from "@/components/settings/SkillsMarketplace"; import { MarketplaceProviderFilter, SkillsMarketplace } from "@/components/settings/SkillsMarketplace";
import { CatalogSkeleton } from "@/components/settings/shared/CatalogSkeleton"; import { CatalogSkeleton } from "@/components/settings/shared/CatalogSkeleton";
import { SkeletonStatus } from "@/components/settings/shared/SkeletonStatus"; import { SkeletonStatus } from "@/components/settings/shared/SkeletonStatus";
import { ToggleButton } from "@/components/ui/toggle-button"; import { ToggleButton } from "@/components/ui/toggle-button";
import { deleteSkill, fetchSkillDetail, updateSkillEnabled } from "@/lib/api"; import { deleteSkill, fetchSkillDetail, updateSkillEnabled } from "@/lib/api";
import { notifySkillsChanged, requestSkillsRefresh } from "@/lib/skill-events"; import { notifySkillsChanged, requestSkillsRefresh } from "@/lib/skill-events";
import type { SkillDetail, SkillSummary } from "@/lib/types"; import type { MarketplaceProvider, SkillDetail, SkillSummary } from "@/lib/types";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { useClient } from "@/providers/ClientProvider"; import { useClient } from "@/providers/ClientProvider";
export function SkillsCatalogSettings({ skills, loading = false, error = false }: { export function useSkillsCatalogSearch() {
const { t } = useTranslation();
const [view, setView] = useState<"installed" | "discover">("installed");
const [installedQuery, setInstalledQuery] = useState("");
const [marketplaceQuery, setMarketplaceQuery] = useState("");
return { view, setView, search: {
value: view === "installed" ? installedQuery : marketplaceQuery,
onChange: (event: React.ChangeEvent<HTMLInputElement>) =>
(view === "installed" ? setInstalledQuery : setMarketplaceQuery)(event.target.value),
placeholder: t(view === "installed" ? "settings.skills.searchInstalled" : "settings.skills.marketplaceSearchPlaceholder"),
} };
}
type SkillsCatalogProps = {
skills: SkillSummary[]; skills: SkillSummary[];
loading?: boolean; loading?: boolean;
error?: boolean; error?: boolean;
};
export function SkillsCatalogSettings(props: SkillsCatalogProps) {
const searchState = useSkillsCatalogSearch();
return <SkillsCatalogPage {...props} searchState={searchState} showSearch />;
}
export function SkillsCatalogPage({ skills, loading = false, error = false, searchState, showSearch }: SkillsCatalogProps & {
searchState: ReturnType<typeof useSkillsCatalogSearch>;
showSearch?: boolean;
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
const { view, setView, search } = searchState;
const [selectedSkill, setSelectedSkill] = useState<SkillSummary | null>(null); const [selectedSkill, setSelectedSkill] = useState<SkillSummary | null>(null);
const [view, setView] = useState<"installed" | "discover">("installed");
const [installingSkill, setInstallingSkill] = useState(""); const [installingSkill, setInstallingSkill] = useState("");
const [installedQuery, setInstalledQuery] = useState(""); const [marketplaceProvider, setMarketplaceProvider] = useState<MarketplaceProvider>("all");
const [installedFilter, setInstalledFilter] = useState<"all" | "enabled" | "disabled">( const [installedFilter, setInstalledFilter] = useState<"all" | "enabled" | "disabled">(
"all", "all",
); );
const normalizedQuery = installedQuery.trim().toLowerCase(); const normalizedQuery = view === "installed" ? search.value.trim().toLowerCase() : "";
const filteredSkills = skills.filter((skill) => { const filteredSkills = skills.filter((skill) => {
const enabled = skill.enabled !== false; const enabled = skill.enabled !== false;
if (installedFilter === "enabled" && !enabled) return false; if (installedFilter === "enabled" && !enabled) return false;
@@ -85,73 +106,29 @@ export function SkillsCatalogSettings({ skills, loading = false, error = false }
const disabledCount = skills.filter((skill) => skill.enabled === false).length; const disabledCount = skills.filter((skill) => skill.enabled === false).length;
return ( return (
<div className="settings-stack"> <div className="catalog-section">
<SegmentedControl <CatalogToolbar search={showSearch ? search : undefined}>
value={view} <CatalogControls>
mode="tabs" <CatalogFilter label={t("settings.skills.views")} value={view} onChange={setView}
ariaLabel={t("settings.skills.views", { defaultValue: "Skills views" })} options={[
className="w-fit text-[13px]" { value: "installed", label: t("settings.skills.installedTab") },
itemClassName="px-3.5" { value: "discover", label: t("settings.skills.discoverTab") },
options={[ ]} />
{ {view === "installed" ? (
value: "installed", <CatalogFilter label={t("settings.apps.statusFilter")} value={installedFilter} onChange={setInstalledFilter}
label: t("settings.skills.installedTab", { defaultValue: "Installed" }),
},
{
value: "discover",
label: t("settings.skills.discoverTab", { defaultValue: "Discover" }),
},
]}
onChange={setView}
/>
{view === "installed" ? (
<section className="overflow-hidden rounded-panel bg-settings-surface">
<div className="flex flex-col gap-3 px-4 pb-2 pt-4 sm:flex-row sm:items-center sm:justify-between">
<div className="relative w-full sm:max-w-[320px]">
<Search
className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"
aria-hidden
/>
<SearchInput
value={installedQuery}
onChange={(event) => setInstalledQuery(event.target.value)}
placeholder={t("settings.skills.searchInstalled", {
defaultValue: "Search installed skills",
})}
aria-label={t("settings.skills.searchInstalled", {
defaultValue: "Search installed skills",
})}
className="h-9 bg-background pl-9 text-[13px]"
/>
</div>
<SegmentedControl
value={installedFilter}
className="sm:w-auto"
itemClassName="px-2.5 text-[11px]"
options={([ options={([
["all", t("settings.skills.filterAll", { defaultValue: "All" }), skills.length], ["all", t("settings.skills.filterAll"), skills.length],
[ ["enabled", t("settings.skills.filterEnabled"), skills.length - disabledCount],
"enabled", ["disabled", t("settings.skills.filterDisabled"), disabledCount],
t("settings.skills.filterEnabled", { defaultValue: "Enabled" }),
skills.length - disabledCount,
],
[
"disabled",
t("settings.skills.filterDisabled", { defaultValue: "Disabled" }),
disabledCount,
],
] as const).map(([value, label, count]) => ({ ] as const).map(([value, label, count]) => ({
value, value,
label: ( label: <><span>{label}</span><span className="tabular-nums opacity-65">{loading || error ? "—" : count}</span></>,
<> }))} />
{label} <span className="ml-0.5 tabular-nums opacity-65">{loading || error ? "—" : count}</span> ) : <MarketplaceProviderFilter value={marketplaceProvider} onChange={setMarketplaceProvider} />}
</> </CatalogControls>
), </CatalogToolbar>
}))} {view === "installed" ? (
onChange={setInstalledFilter} <section className="overflow-hidden rounded-panel bg-settings-surface pt-3">
/>
</div>
{loading ? ( {loading ? (
<CatalogSkeleton label={t("settings.skills.loading")} layout="skills" /> <CatalogSkeleton label={t("settings.skills.loading")} layout="skills" />
) : error ? ( ) : error ? (
@@ -193,6 +170,8 @@ export function SkillsCatalogSettings({ skills, loading = false, error = false }
</section> </section>
) : ( ) : (
<SkillsMarketplace <SkillsMarketplace
query={search.value}
provider={marketplaceProvider}
installedSkills={skills} installedSkills={skills}
installing={installingSkill} installing={installingSkill}
onInstallingChange={setInstallingSkill} onInstallingChange={setInstallingSkill}
@@ -5,7 +5,6 @@ import {
ExternalLink, ExternalLink,
Loader2, Loader2,
PackagePlus, PackagePlus,
Search,
ShieldAlert, ShieldAlert,
} from "lucide-react"; } from "lucide-react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -22,8 +21,7 @@ import {
AlertDialogTitle, AlertDialogTitle,
} from "@/components/ui/alert-dialog"; } from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { SearchInput } from "@/components/ui/input"; import { CatalogFilter } from "@/components/settings/shared/CatalogToolbar";
import { SegmentedControl } from "@/components/ui/segmented-control";
import { import {
ApiError, ApiError,
fetchMarketplaceSkillTrends, fetchMarketplaceSkillTrends,
@@ -41,17 +39,20 @@ import { cn } from "@/lib/utils";
import { useClient } from "@/providers/ClientProvider"; import { useClient } from "@/providers/ClientProvider";
export function SkillsMarketplace({ export function SkillsMarketplace({
query,
provider,
installedSkills, installedSkills,
installing, installing,
onInstallingChange, onInstallingChange,
}: { }: {
query: string;
provider: MarketplaceProvider;
installedSkills: SkillSummary[]; installedSkills: SkillSummary[];
installing: string; installing: string;
onInstallingChange: (skillId: string) => void; onInstallingChange: (skillId: string) => void;
}) { }) {
const { client, getToken } = useClient(); const { client, getToken } = useClient();
const { t } = useTranslation(); const { t } = useTranslation();
const [query, setQuery] = useState("");
const [results, setResults] = useState<MarketplaceSkillSummary[]>([]); const [results, setResults] = useState<MarketplaceSkillSummary[]>([]);
const [trending, setTrending] = useState<MarketplaceSkillSummary[]>([]); const [trending, setTrending] = useState<MarketplaceSkillSummary[]>([]);
const [trends, setTrends] = useState<Record<string, number[]>>({}); const [trends, setTrends] = useState<Record<string, number[]>>({});
@@ -59,7 +60,6 @@ export function SkillsMarketplace({
const [trendingLoading, setTrendingLoading] = useState(true); const [trendingLoading, setTrendingLoading] = useState(true);
const [error, setError] = useState(""); const [error, setError] = useState("");
const [installError, setInstallError] = useState(""); const [installError, setInstallError] = useState("");
const [provider, setProvider] = useState<MarketplaceProvider>("all");
const [selected, setSelected] = useState<MarketplaceSkillSummary | null>(null); const [selected, setSelected] = useState<MarketplaceSkillSummary | null>(null);
const installTrigger = useRef<HTMLElement | null>(null); const installTrigger = useRef<HTMLElement | null>(null);
const selectSkill = (skill: MarketplaceSkillSummary) => { const selectSkill = (skill: MarketplaceSkillSummary) => {
@@ -196,38 +196,8 @@ export function SkillsMarketplace({
}; };
return ( return (
<section className="space-y-4"> <section className="grid gap-4">
<div className="space-y-2"> {loading ? <span className="sr-only" role="status">{t("settings.skills.marketplaceSearching")}</span> : null}
<div className="relative">
<Search
className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"
aria-hidden
/>
<SearchInput
value={query}
onChange={(event) => setQuery(event.target.value)}
placeholder={t("settings.skills.marketplaceSearchPlaceholder", {
defaultValue: "Search skills",
})}
aria-label={t("settings.skills.marketplaceSearchLabel", {
defaultValue: "Search skills",
})}
className="h-11 rounded-full bg-settings-surface pl-9"
/>
{loading ? (
<span
className="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground"
role="status"
aria-label={t("settings.skills.marketplaceSearching", {
defaultValue: "Searching",
})}
>
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" aria-hidden />
</span>
) : null}
</div>
<ProviderFilter value={provider} onChange={setProvider} />
</div>
{error || installError ? ( {error || installError ? (
<div role="alert" className="rounded-control bg-destructive/10 px-3 py-2.5 text-[13px] text-destructive"> <div role="alert" className="rounded-control bg-destructive/10 px-3 py-2.5 text-[13px] text-destructive">
@@ -361,7 +331,7 @@ export function SkillsMarketplace({
); );
} }
function ProviderFilter({ export function MarketplaceProviderFilter({
value, value,
onChange, onChange,
}: { }: {
@@ -371,24 +341,12 @@ function ProviderFilter({
const { t } = useTranslation(); const { t } = useTranslation();
const providers: MarketplaceProvider[] = ["all", "skills_sh", "skillhub"]; const providers: MarketplaceProvider[] = ["all", "skills_sh", "skillhub"];
return ( return (
<SegmentedControl <CatalogFilter
value={value} value={value}
mode="tabs" label={t("settings.skills.marketplaceProviderFilter")}
ariaLabel={t("settings.skills.marketplaceProviderFilter", {
defaultValue: "Skill source",
})}
className="w-fit bg-settings-surface"
itemClassName="inline-flex h-7 items-center gap-1.5"
options={providers.map((provider) => ({ options={providers.map((provider) => ({
value: provider, value: provider,
label: ( label: provider === "all" ? t("settings.skills.marketplaceProviderAll") : providerLabel(provider),
<>
{provider !== "all" ? <ProviderDot provider={provider} /> : null}
{provider === "all"
? t("settings.skills.marketplaceProviderAll", { defaultValue: "All" })
: providerLabel(provider)}
</>
),
}))} }))}
onChange={onChange} onChange={onChange}
/> />
@@ -1,4 +1,4 @@
import { useEffect, useRef, useState } from "react"; import { useEffect, useId, useRef, useState } from "react";
import { Download, Loader2, RotateCcw } from "lucide-react"; import { Download, Loader2, RotateCcw } from "lucide-react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -16,6 +16,8 @@ import { Button } from "@/components/ui/button";
import type { NanobotFeatureInfo } from "@/lib/types"; import type { NanobotFeatureInfo } from "@/lib/types";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
const CHANNEL_ACTION_CLASS = "relative h-7 w-[38px] min-w-0 shrink-0 rounded-full border-border/70 bg-background p-0 after:absolute after:left-1/2 after:top-1/2 after:h-11 after:w-11 after:-translate-x-1/2 after:-translate-y-1/2 after:content-['']";
export function ChannelCatalogRow({ export function ChannelCatalogRow({
feature, feature,
showBrandLogos, showBrandLogos,
@@ -28,7 +30,7 @@ export function ChannelCatalogRow({
}: { }: {
feature: NanobotFeatureInfo; feature: NanobotFeatureInfo;
showBrandLogos: boolean; showBrandLogos: boolean;
onSelect: (connect?: boolean) => void; onSelect: (trigger: HTMLButtonElement | null, connect?: boolean) => void;
actionKey: string | null; actionKey: string | null;
restartRequired?: boolean; restartRequired?: boolean;
onAction: ChannelFeatureAction; onAction: ChannelFeatureAction;
@@ -47,6 +49,9 @@ export function ChannelCatalogRow({
const actionsDisabled = restartRequired || isRestarting; const actionsDisabled = restartRequired || isRestarting;
const showInstallRestartHint = feature.install_supported && actionsDisabled; const showInstallRestartHint = feature.install_supported && actionsDisabled;
const installButtonRef = useRef<HTMLButtonElement | null>(null); const installButtonRef = useRef<HTMLButtonElement | null>(null);
const toggleRef = useRef<HTMLButtonElement | null>(null);
const statusId = useId();
const failed = feature.runtime_status === "failed";
const [installHint, setInstallHint] = useState(false); const [installHint, setInstallHint] = useState(false);
useEffect(() => { useEffect(() => {
@@ -55,17 +60,18 @@ export function ChannelCatalogRow({
return () => window.clearTimeout(timeout); return () => window.clearTimeout(timeout);
}, [installHint]); }, [installHint]);
const pointToInstall = () => {
setInstallHint(true);
installButtonRef.current?.focus();
};
const channelIdentity = ( const channelIdentity = (
<> <>
<ChannelLogo feature={feature} showBrandLogos={showBrandLogos} /> <ChannelLogo feature={feature} showBrandLogos={showBrandLogos} />
<div className="min-w-0 flex-1"> <div className="min-w-0 flex-1">
<h3 className="truncate text-[14px] font-semibold leading-5 text-foreground"> <h3 className="text-[14px] font-semibold leading-5 text-foreground [overflow-wrap:anywhere]">
{displayName} {displayName}
</h3> </h3>
{failed ? (
<div id={statusId} className="mt-0.5">
<ChannelStatusBadge status="failed">{channelStatusLabel(feature, tx)}</ChannelStatusBadge>
</div>
) : null}
</div> </div>
</> </>
); );
@@ -86,22 +92,23 @@ export function ChannelCatalogRow({
name: displayName, name: displayName,
defaultValue: "View {{name}} settings", defaultValue: "View {{name}} settings",
})} })}
aria-haspopup="dialog" aria-haspopup={feature.installed ? "dialog" : undefined}
aria-describedby={failed ? statusId : undefined}
disabled={actionsDisabled} disabled={actionsDisabled}
onClick={() => feature.installed ? onSelect() : pointToInstall()} onClick={(event) => {
if (feature.installed) {
onSelect(event.currentTarget);
} else {
setInstallHint(true);
if (event.detail === 0) installButtonRef.current?.focus({ preventScroll: true });
}
}}
className="group flex min-w-0 flex-1 select-none items-center gap-3 rounded-control text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border/80" className="group flex min-w-0 flex-1 select-none items-center gap-3 rounded-control text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border/80"
> >
{channelIdentity} {channelIdentity}
</button> </button>
)} )}
{feature.runtime_status === "failed" ? ( <div className="flex w-11 shrink-0 items-center justify-center">
<div className="min-w-0 shrink truncate">
<ChannelStatusBadge status={feature.runtime_status}>
{channelStatusLabel(feature, tx)}
</ChannelStatusBadge>
</div>
) : null}
<div className="flex w-16 shrink-0 items-center justify-center">
{!feature.installed ? ( {!feature.installed ? (
<HoverHint enabled={showInstallRestartHint} <HoverHint enabled={showInstallRestartHint}
content={t(isRestarting ? "app.system.restarting" : "settings.channels.restartBeforeInstall")}> content={t(isRestarting ? "app.system.restarting" : "settings.channels.restartBeforeInstall")}>
@@ -111,7 +118,7 @@ export function ChannelCatalogRow({
className="inline-flex rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"> className="inline-flex rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2">
<Button ref={installButtonRef} type="button" variant="outline" size="icon" <Button ref={installButtonRef} type="button" variant="outline" size="icon"
className={cn( className={cn(
"h-[22px] w-[38px] min-w-0 shrink-0 rounded-full border-border/70 bg-background p-0", CHANNEL_ACTION_CLASS,
installHint && "border-[#2997FF]/60 bg-[#2997FF]/10 text-[#087FE7] ring-2 ring-[#2997FF]/25 ring-offset-2", installHint && "border-[#2997FF]/60 bg-[#2997FF]/10 text-[#087FE7] ring-2 ring-[#2997FF]/25 ring-offset-2",
)} )}
disabled={actionsDisabled || anyActionBusy || !feature.install_supported} disabled={actionsDisabled || anyActionBusy || !feature.install_supported}
@@ -130,7 +137,7 @@ export function ChannelCatalogRow({
) : feature.restart_pending ? ( ) : feature.restart_pending ? (
<HoverHint content={t("settings.channels.restartRequired")}> <HoverHint content={t("settings.channels.restartRequired")}>
<Button type="button" variant="outline" size="icon" <Button type="button" variant="outline" size="icon"
className="h-[22px] w-[38px] min-w-0 shrink-0 rounded-full border-border/70 bg-background p-0" className={CHANNEL_ACTION_CLASS}
aria-label={t("app.system.restart")} aria-label={t("app.system.restart")}
aria-busy={isRestarting} aria-busy={isRestarting}
disabled={isRestarting || anyActionBusy || !onRestart} disabled={isRestarting || anyActionBusy || !onRestart}
@@ -141,12 +148,12 @@ export function ChannelCatalogRow({
</Button> </Button>
</HoverHint> </HoverHint>
) : ( ) : (
<ToggleButton checked={checked} <ToggleButton ref={toggleRef} checked={checked}
label={checked ? tx("settings.values.on", "On") : tx("settings.values.off", "Off")} label={checked ? tx("settings.values.on", "On") : tx("settings.values.off", "Off")}
disabled={alwaysEnabled || actionsDisabled || anyActionBusy} disabled={alwaysEnabled || actionsDisabled || anyActionBusy}
ariaLabel={t("settings.channels.toggleChannel", { name: displayName, defaultValue: "{{name}} channel" })} ariaLabel={t("settings.channels.toggleChannel", { name: displayName, defaultValue: "{{name}} channel" })}
onChange={(enabled) => { onChange={(enabled) => {
if (enabled && feature.configured === false) onSelect(true); if (enabled && feature.configured === false) onSelect(toggleRef.current, true);
else onAction(enabled ? "enable" : "disable", feature.name); else onAction(enabled ? "enable" : "disable", feature.name);
}} /> }} />
)} )}
@@ -1,5 +1,5 @@
import i18n from "i18next"; import i18n from "i18next";
import { useMemo, type ReactNode } from "react"; import type { ReactNode } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import {
@@ -19,7 +19,6 @@ import type {
import { channelValidationMessage } from "@/components/settings/channels/validationMessages"; import { channelValidationMessage } from "@/components/settings/channels/validationMessages";
import { useLogoFallback } from "@/hooks/useLogoFallback"; import { useLogoFallback } from "@/hooks/useLogoFallback";
import { normalizeLocale } from "@/i18n/config"; import { normalizeLocale } from "@/i18n/config";
import { logoFallbackUrls } from "@/lib/provider-brand";
import type { ChannelRuntimeStatus, NanobotFeatureInfo } from "@/lib/types"; import type { ChannelRuntimeStatus, NanobotFeatureInfo } from "@/lib/types";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
@@ -154,23 +153,17 @@ export function ChannelLogo({
?? channelUiPresentation(feature.name); ?? channelUiPresentation(feature.name);
const initials = presentation?.initials ?? feature.display_name.slice(0, 2).toUpperCase(); const initials = presentation?.initials ?? feature.display_name.slice(0, 2).toUpperCase();
const Icon = presentation?.icon; const Icon = presentation?.icon;
const logoUrls = useMemo(() => { const brandLogoUrl = presentation?.logoUrl;
const fallbackUrls = logoFallbackUrls(presentation?.logoFallbackUrl ?? presentation?.logoUrl); const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(brandLogoUrl ? [brandLogoUrl] : undefined);
return presentation?.logoUrl && presentation.logoFallbackUrl const showLogo = showBrandLogos && Boolean(logoUrl);
? [...new Set([presentation.logoUrl, ...fallbackUrls])] const showLoadedLogo = showLogo && logoLoaded;
: fallbackUrls;
}, [presentation?.logoUrl, presentation?.logoFallbackUrl]);
const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(logoUrls);
const showRemoteLogo = showBrandLogos && Boolean(logoUrl);
const showLoadedLogo = showRemoteLogo && logoLoaded;
const isLogoTile = presentation?.logoLayout === "tile" && logoUrl === presentation.logoUrl;
return ( return (
<span <span
data-testid={`channel-logo-${feature.name}`} data-testid={`channel-logo-${feature.name}`}
className={cn( className={cn(
"relative grid h-8 w-8 shrink-0 place-items-center overflow-hidden rounded-[9px] text-[11px] font-semibold text-muted-foreground", "relative grid h-8 w-8 shrink-0 place-items-center overflow-hidden rounded-[9px] text-[11px] font-semibold text-muted-foreground",
showLoadedLogo ? (isLogoTile ? "bg-transparent" : "bg-white") : "bg-muted", showLoadedLogo ? "bg-white" : "bg-muted",
)} )}
aria-hidden aria-hidden
> >
@@ -180,7 +173,7 @@ export function ChannelLogo({
)}> )}>
{Icon ? <Icon className="h-6 w-6" strokeWidth={2} /> : initials} {Icon ? <Icon className="h-6 w-6" strokeWidth={2} /> : initials}
</span> </span>
{showRemoteLogo ? <img {showLogo ? <img
src={logoUrl} src={logoUrl}
alt="" alt=""
decoding="async" decoding="async"
@@ -188,8 +181,7 @@ export function ChannelLogo({
referrerPolicy="no-referrer" referrerPolicy="no-referrer"
draggable={false} draggable={false}
className={cn( className={cn(
"absolute object-contain transition-opacity duration-150 motion-reduce:transition-none", "absolute h-6 w-6 object-contain transition-opacity duration-150 motion-reduce:transition-none",
isLogoTile ? "h-8 w-8" : "h-6 w-6",
logoLoaded ? "opacity-100" : "opacity-0", logoLoaded ? "opacity-100" : "opacity-0",
)} )}
onLoad={onLogoLoad} onLoad={onLogoLoad}
@@ -23,7 +23,6 @@ import {
} from "@/components/settings/channels/ChannelIdentity"; } from "@/components/settings/channels/ChannelIdentity";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { useLogoFallback } from "@/hooks/useLogoFallback"; import { useLogoFallback } from "@/hooks/useLogoFallback";
import { logoFallbackUrls } from "@/lib/provider-brand";
import type { import type {
NanobotChannelInstanceInfo, NanobotChannelInstanceInfo,
NanobotFeatureInfo, NanobotFeatureInfo,
@@ -344,8 +343,8 @@ function ChannelInstanceAvatar({
}) { }) {
const presentation = channelUiPresentation(feature.name, feature.webui); const presentation = channelUiPresentation(feature.name, feature.webui);
const [avatarFailed, setAvatarFailed] = useState(false); const [avatarFailed, setAvatarFailed] = useState(false);
const fallbackLogoUrls = useMemo(() => logoFallbackUrls(presentation?.logoUrl), [presentation?.logoUrl]); const brandLogoUrl = presentation?.logoUrl;
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(fallbackLogoUrls); const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(brandLogoUrl ? [brandLogoUrl] : undefined);
const remoteAvatarUrl = !avatarFailed ? instance.avatar_url?.trim() : ""; const remoteAvatarUrl = !avatarFailed ? instance.avatar_url?.trim() : "";
const imageUrl = remoteAvatarUrl || (showBrandLogos ? logoUrl : ""); const imageUrl = remoteAvatarUrl || (showBrandLogos ? logoUrl : "");
const Icon = presentation?.icon; const Icon = presentation?.icon;
@@ -20,6 +20,12 @@ export type SettingsSectionKey =
| "runtime" | "runtime"
| "advanced"; | "advanced";
export type AppsSectionKey = "apps" | "skills" | "channels";
export function isAppsSection(section: SettingsSectionKey): section is AppsSectionKey {
return section === "apps" || section === "skills" || section === "channels";
}
export function isCapabilitySection(section: SettingsSectionKey): boolean { export function isCapabilitySection(section: SettingsSectionKey): boolean {
return ["capabilities", "image", "voice", "browser", "memory"].includes(section); return ["capabilities", "image", "voice", "browser", "memory"].includes(section);
} }
@@ -47,7 +47,7 @@ export function CatalogSkeleton({ label, layout, appActionLabel }: {
</div> </div>
) : <>{icon}{text}</>} ) : <>{icon}{text}</>}
<div className={cn("flex shrink-0 items-center justify-center", <div className={cn("flex shrink-0 items-center justify-center",
channels && "w-16", skills && "hidden h-[16.5px] w-[92px] justify-end sm:flex", channels && "w-11", skills && "hidden h-[16.5px] w-[92px] justify-end sm:flex",
appActionLabel && "ml-auto")}> appActionLabel && "ml-auto")}>
{appActionLabel ? <div className={cn(block, "flex h-8 items-center gap-1.5 rounded-full px-3 text-[12px] font-semibold")}> {appActionLabel ? <div className={cn(block, "flex h-8 items-center gap-1.5 rounded-full px-3 text-[12px] font-semibold")}>
<span className="h-4 w-4 shrink-0" /> <span className="h-4 w-4 shrink-0" />
@@ -0,0 +1,67 @@
import { useId, type ComponentPropsWithRef, type ReactNode } from "react";
import { Search } from "lucide-react";
import { SearchInput } from "@/components/ui/input";
import { ToggleButton } from "@/components/ui/toggle-button";
import { SETTINGS_SEARCH_INPUT_CLASS } from "@/components/settings/shared/SettingsControls";
import { cn } from "@/lib/utils";
type CatalogSearchProps = Omit<ComponentPropsWithRef<typeof SearchInput>, "className">;
export function CatalogSearch(props: CatalogSearchProps) {
return (
<div className="catalog-search">
<Search className="pointer-events-none absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden />
<SearchInput aria-label={props.placeholder} {...props}
className={cn("h-9 rounded-control ps-9 text-ui-label", SETTINGS_SEARCH_INPUT_CLASS)} />
</div>
);
}
export function CatalogToolbar({ search, children }: { search?: CatalogSearchProps; children: ReactNode }) {
return (
<div className="catalog-toolbar">
{children}
{search && <CatalogSearch {...search} />}
</div>
);
}
export function CatalogControls({ children }: { children: ReactNode }) {
return <div className="catalog-controls text-ui-label">{children}</div>;
}
export function CatalogToggle({ label, checked, onChange }: {
label: string;
checked: boolean;
onChange: (checked: boolean) => void;
}) {
return (
<label className="catalog-toggle cursor-pointer text-muted-foreground hover:text-foreground">
<span>{label}</span>
<ToggleButton label={label} checked={checked} onChange={onChange} />
</label>
);
}
export function CatalogFilter<T extends string>({ label, value, options, onChange }: {
label: string;
value: T;
options: ReadonlyArray<{ value: T; label: ReactNode }>;
onChange: (value: T) => void;
}) {
const name = useId();
return (
<div className="catalog-choices" role="radiogroup" aria-label={label}>
{options.map((option) => (
<label key={option.value} className="relative cursor-pointer">
<input className="peer sr-only" type="radio" name={name} value={option.value}
checked={value === option.value} onChange={() => onChange(option.value)} />
<span className="flex min-h-8 items-center gap-1 rounded-compact px-2 text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground peer-checked:bg-muted peer-checked:text-foreground peer-focus-visible:ring-2 peer-focus-visible:ring-inset peer-focus-visible:ring-ring">
{option.label}
</span>
</label>
))}
</div>
);
}
@@ -0,0 +1,62 @@
/* Shared with the document's first paint; keep catalog geometry independent of loaded data. */
.apps-catalog-layout, .catalog-toolbar {
display: grid;
grid-template-columns: minmax(0, 1fr);
align-items: center;
gap: 12px;
min-inline-size: 0;
}
.apps-catalog-layout > .catalog-section,
.apps-catalog-layout > .catalog-section > .catalog-toolbar { display: contents; }
.apps-catalog-layout { reading-flow: grid-rows; }
.apps-catalog-layout > .catalog-tabs { justify-self: start; }
.apps-catalog-layout > .catalog-search { order: 1; }
.apps-catalog-layout > .catalog-section > :not(.catalog-toolbar),
.apps-catalog-layout > .catalog-body {
grid-column: 1 / -1;
order: 2;
min-inline-size: 0;
margin-block-start: 8px;
}
.catalog-search { position: relative; grid-column: 1 / -1; min-inline-size: 0; }
.catalog-controls, .catalog-choices, .catalog-toggle {
display: flex;
align-items: center;
min-block-size: 36px;
min-inline-size: 0;
}
.catalog-controls { justify-self: end; justify-content: flex-end; gap: 12px; inline-size: 100%; }
.catalog-choices { flex-wrap: wrap; gap: 2px; }
.catalog-toggle { flex: none; gap: 8px; padding-inline-end: 4px; }
@container (min-width: 24rem) {
.catalog-controls:not(.startup-controls) .catalog-choices + .catalog-choices { position: relative; }
.catalog-controls:not(.startup-controls) .catalog-choices + .catalog-choices::before {
content: "";
position: absolute;
inset-inline-start: -6px;
inset-block-start: 10px;
block-size: 16px;
border-inline-start: 1px solid hsl(var(--border));
pointer-events: none;
}
}
@container (width < 40rem) {
.apps-catalog-layout, .catalog-toolbar { gap: 8px; }
.apps-catalog-layout > .catalog-tabs { inline-size: 100%; }
.catalog-tabs > button { flex: 1 1 auto; }
.catalog-controls > :last-child { margin-inline-start: auto; }
}
@container (width < 24rem) {
.catalog-tabs > button {
padding-inline: 0.25rem;
white-space: normal;
overflow-wrap: anywhere;
line-height: 1.25;
}
.catalog-controls { flex-direction: column; align-items: start; gap: 4px; }
.catalog-controls > :last-child { align-self: end; }
}
@container (min-width: 40rem) {
.apps-catalog-layout { grid-template-columns: minmax(0, 1fr) 24.5rem; }
.apps-catalog-layout .catalog-controls { grid-column: 2; }
}
@@ -26,19 +26,18 @@ import {
PauseCircle, PauseCircle,
PlayCircle, PlayCircle,
Plus, Plus,
Search,
TriangleAlert, TriangleAlert,
Trash2, Trash2,
} from "lucide-react"; } from "lucide-react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { CatalogSkeleton } from "@/components/settings/shared/CatalogSkeleton"; import { CatalogSkeleton } from "@/components/settings/shared/CatalogSkeleton";
import { CatalogControls, CatalogFilter, CatalogToggle, CatalogToolbar } from "@/components/settings/shared/CatalogToolbar";
import { ProxySettingsControl } from "@/components/settings/shared/ProxySettingsControl"; import { ProxySettingsControl } from "@/components/settings/shared/ProxySettingsControl";
import { import {
DismissibleStatusMessage, DismissibleStatusMessage,
RestartRequiredNotice, RestartRequiredNotice,
SETTINGS_SEARCH_INPUT_CLASS,
SettingsSectionTitle, SettingsSectionTitle,
} from "@/components/settings/shared/SettingsControls"; } from "@/components/settings/shared/SettingsControls";
import { AgentPluginDialog } from "@/components/settings/system/AgentPluginDialog"; import { AgentPluginDialog } from "@/components/settings/system/AgentPluginDialog";
@@ -53,7 +52,7 @@ import {
DropdownMenuItem, DropdownMenuItem,
DropdownMenuTrigger, DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"; } from "@/components/ui/dropdown-menu";
import { Input, SearchInput } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { SegmentedControl } from "@/components/ui/segmented-control"; import { SegmentedControl } from "@/components/ui/segmented-control";
import { Textarea } from "@/components/ui/textarea"; import { Textarea } from "@/components/ui/textarea";
import { SettingsTextEditor } from "@/components/settings/shared/SettingsTextEditor"; import { SettingsTextEditor } from "@/components/settings/shared/SettingsTextEditor";
@@ -68,7 +67,10 @@ import type {
} from "@/lib/types"; } from "@/lib/types";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
export type AppsKindFilter = "ready" | "cli" | "plugins" | "mcp"; export type AppsCatalogFilter = {
kind: "all" | "cli" | "plugins" | "mcp";
status: "all" | "ready";
};
type AppsCatalogItem = type AppsCatalogItem =
| { id: string; kind: "cli"; app: CliAppInfo } | { id: string; kind: "cli"; app: CliAppInfo }
| { id: string; kind: "mcp"; preset: McpPresetInfo }; | { id: string; kind: "mcp"; preset: McpPresetInfo };
@@ -104,20 +106,20 @@ export const DEFAULT_CUSTOM_MCP_FORM: CustomMcpForm = {
}; };
export function AppsCatalogPage(props: Omit<ComponentProps<typeof AppsCatalogSettings>, "filter" | "onFilterChange">) { export function AppsCatalogPage(props: Omit<ComponentProps<typeof AppsCatalogSettings>, "filter" | "onFilterChange">) {
const [selection, setSelection] = useState<AppsKindFilter | null>(() => props.setupName ? "mcp" : null); const [selection, setSelection] = useState<AppsCatalogFilter | null>(() => props.setupName ? { kind: "mcp", status: "all" } : null);
const hasReady = Boolean( const hasReady = Boolean(
props.cliApps?.apps.some((app) => app.installed) || props.mcpPresets?.presets.some(mcpPresetReady), props.cliApps?.apps.some((app) => app.installed) || props.mcpPresets?.presets.some(mcpPresetReady),
); );
const waiting = (props.cliAppsLoading && !props.cliApps) || (props.mcpPresetsLoading && !props.mcpPresets); const waiting = (props.cliAppsLoading && !props.cliApps) || (props.mcpPresetsLoading && !props.mcpPresets);
const filter = selection ?? (hasReady || waiting ? "ready" : "cli"); const filter: AppsCatalogFilter = selection ?? { kind: "all", status: hasReady || waiting ? "ready" : "all" };
useEffect(() => { useEffect(() => {
if (selection === null && (hasReady || (props.cliApps && props.mcpPresets))) { if (selection === null && (hasReady || (props.cliApps && props.mcpPresets))) {
setSelection(hasReady ? "ready" : "cli"); setSelection({ kind: "all", status: hasReady ? "ready" : "all" });
} }
}, [selection, hasReady, props.cliApps, props.mcpPresets]); }, [selection, hasReady, props.cliApps, props.mcpPresets]);
return <AppsCatalogSettings {...props} filter={filter} onFilterChange={setSelection} />; return <AppsCatalogSettings {...props} filter={filter} onFilterChange={setSelection} showSearch={false} />;
} }
export function AppsCatalogSettings({ export function AppsCatalogSettings({
@@ -129,6 +131,7 @@ export function AppsCatalogSettings({
cliAppsLoading, cliAppsLoading,
mcpPresetsLoading, mcpPresetsLoading,
query, query,
showSearch = true,
filter, filter,
cliActionKey, cliActionKey,
mcpActionKey, mcpActionKey,
@@ -175,7 +178,8 @@ export function AppsCatalogSettings({
cliAppsLoading: boolean; cliAppsLoading: boolean;
mcpPresetsLoading: boolean; mcpPresetsLoading: boolean;
query: string; query: string;
filter: AppsKindFilter; showSearch?: boolean;
filter: AppsCatalogFilter;
cliActionKey: string | null; cliActionKey: string | null;
mcpActionKey: string | null; mcpActionKey: string | null;
mcpOAuthFlow: McpOAuthFlowPayload | null; mcpOAuthFlow: McpOAuthFlowPayload | null;
@@ -194,7 +198,7 @@ export function AppsCatalogSettings({
showBrandLogos: boolean; showBrandLogos: boolean;
requiresRestartPending: boolean; requiresRestartPending: boolean;
onQueryChange: (value: string) => void; onQueryChange: (value: string) => void;
onFilterChange: (value: AppsKindFilter) => void; onFilterChange: (value: AppsCatalogFilter) => void;
onCliAction: (action: "install" | "update" | "uninstall" | "test", name: string) => void; onCliAction: (action: "install" | "update" | "uninstall" | "test", name: string) => void;
onMcpAction: (action: "enable" | "disable" | "remove" | "test" | "reconnect" | "proxy", name: string, values?: Record<string, string>) => void; onMcpAction: (action: "enable" | "disable" | "remove" | "test" | "reconnect" | "proxy", name: string, values?: Record<string, string>) => void;
onMcpOAuthConnect: (name: string, reset?: boolean, values?: Record<string, string>) => void; onMcpOAuthConnect: (name: string, reset?: boolean, values?: Record<string, string>) => void;
@@ -215,12 +219,12 @@ export function AppsCatalogSettings({
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
const tx = (key: string, fallback: string) => t(key, { defaultValue: fallback }); const tx = (key: string, fallback: string) => t(key, { defaultValue: fallback });
const filterOptions = [ const kindOptions = [
{ value: "ready", label: tx("settings.apps.filterAll", "Ready") }, { value: "all", label: t("settings.apps.allTypes") },
{ value: "cli", label: tx("settings.apps.filterCli", "CLI Apps") }, { value: "cli", label: tx("settings.apps.filterCli", "CLI Apps") },
{ value: "plugins", label: tx("settings.apps.filterPlugins", "Plugins") }, { value: "plugins", label: tx("settings.apps.filterPlugins", "Plugins") },
{ value: "mcp", label: tx("settings.apps.filterMcp", "MCP") }, { value: "mcp", label: tx("settings.apps.filterMcp", "MCP") },
]; ] as const;
const normalizedQuery = query.trim().toLowerCase(); const normalizedQuery = query.trim().toLowerCase();
const installedCliNames = new Set((cliApps?.apps ?? []).filter((app) => app.installed).map((app) => app.name)); const installedCliNames = new Set((cliApps?.apps ?? []).filter((app) => app.installed).map((app) => app.name));
const managedPlugins = new Map( const managedPlugins = new Map(
@@ -228,50 +232,39 @@ export function AppsCatalogSettings({
.filter((preset) => preset.source === "agent-plugin" && preset.managed_by_cli) .filter((preset) => preset.source === "agent-plugin" && preset.managed_by_cli)
.map((preset) => [preset.managed_by_cli!, preset]), .map((preset) => [preset.managed_by_cli!, preset]),
); );
const items: AppsCatalogItem[] = [ const catalogItems: AppsCatalogItem[] = [
...(cliApps?.apps ?? []).map((app) => ({ id: `cli:${app.name}`, kind: "cli" as const, app })), ...(cliApps?.apps ?? []).map((app) => ({ id: `cli:${app.name}`, kind: "cli" as const, app })),
...(mcpPresets?.presets ?? []) ...(mcpPresets?.presets ?? [])
.filter((preset) => !preset.managed_by_cli || !installedCliNames.has(preset.managed_by_cli)) .filter((preset) => !preset.managed_by_cli || !installedCliNames.has(preset.managed_by_cli))
.map((preset) => ({ id: `mcp:${preset.name}`, kind: "mcp" as const, preset })), .map((preset) => ({ id: `mcp:${preset.name}`, kind: "mcp" as const, preset })),
] ];
.filter((item) => { const matches = catalogItems.filter((item) => {
const matchesFilter = filter === "ready" const matchesKind = filter.kind === "all" || (filter.kind === "cli"
? appsReady(item) ? item.kind === "cli"
: filter === "cli" : filter.kind === "plugins"
? item.kind === "cli" ? item.kind === "mcp" && item.preset.source === "agent-plugin"
: filter === "plugins" : item.kind === "mcp" && item.preset.source !== "agent-plugin");
? item.kind === "mcp" && item.preset.source === "agent-plugin" return matchesKind && (!normalizedQuery || appsSearchText(item).includes(normalizedQuery));
: item.kind === "mcp" && item.preset.source !== "agent-plugin"; });
return matchesFilter && (!normalizedQuery || appsSearchText(item).includes(normalizedQuery)); const items = (filter.status === "ready" ? matches.filter(appsReady) : matches).sort((left, right) => {
}) const rank = Number(!appsReady(left)) - Number(!appsReady(right));
.sort((left, right) => { return rank || appsTitle(left).localeCompare(appsTitle(right));
const rank = Number(!appsReady(left)) - Number(!appsReady(right)); });
return rank || appsTitle(left).localeCompare(appsTitle(right)); const hiddenByReadyFilter = matches.length > items.length;
});
const focusedApp = cliFocusName const focusedApp = cliFocusName
? (cliApps?.apps ?? []).find((app) => app.name === cliFocusName && app.installed) ? (cliApps?.apps ?? []).find((app) => app.name === cliFocusName && app.installed)
: null; : null;
const loading = (mcpPresetsLoading && !mcpPresets) const loading = (mcpPresetsLoading && !mcpPresets)
|| (filter !== "mcp" && cliAppsLoading && !cliApps); || (filter.kind !== "mcp" && cliAppsLoading && !cliApps);
const cliAppCount = cliApps?.apps.length ?? 0; const emptyTitle = hiddenByReadyFilter
const emptyTitle = normalizedQuery ? tx("settings.apps.emptyReady", "No tools are ready yet")
? tx("settings.apps.empty", "No tools match your search.") : normalizedQuery
: filter === "cli" ? tx("settings.apps.empty", "No tools match your search")
? tx("settings.apps.emptyApps", "No apps available.") : filter.kind === "plugins"
: filter === "plugins" ? tx("settings.apps.emptyPlugins", "No Agent Plugins installed")
? tx("settings.apps.emptyPlugins", "No Agent Plugins installed.") : filter.kind === "mcp"
: filter === "mcp" ? tx("settings.apps.emptyIntegrations", "No MCP tools available")
? tx("settings.apps.emptyIntegrations", "No MCP tools available.") : tx("settings.apps.emptyApps", "No tools available");
: tx("settings.apps.emptyReady", "No tools are ready yet.");
const emptyBrowseTarget: AppsKindFilter | null = normalizedQuery || filter === "plugins"
? null
: filter === "cli"
? "mcp"
: filter === "mcp"
? (cliAppCount ? "cli" : null)
: cliAppCount
? "cli"
: "mcp";
const statusMessage = const statusMessage =
cliError || cliError ||
mcpError || mcpError ||
@@ -286,30 +279,20 @@ export function AppsCatalogSettings({
) )
: ""; : "";
return ( return (
<div className="settings-stack"> <div className="catalog-section">
<CatalogToolbar search={showSearch ? {
value: query,
onChange: (event) => onQueryChange(event.target.value),
placeholder: t("settings.apps.searchPlaceholder"),
} : undefined}>
<CatalogControls>
<CatalogFilter label={t("settings.apps.typeFilter")} value={filter.kind} options={kindOptions}
onChange={(kind) => onFilterChange({ ...filter, kind })} />
<CatalogToggle label={t("settings.apps.readyOnly")} checked={filter.status === "ready"}
onChange={(ready) => onFilterChange({ ...filter, status: ready ? "ready" : "all" })} />
</CatalogControls>
</CatalogToolbar>
<div role="status" className="sr-only">{oauthStatusAnnouncement}</div> <div role="status" className="sr-only">{oauthStatusAnnouncement}</div>
<section className="space-y-4">
<div className="flex flex-col gap-3 lg:flex-row lg:items-center">
<div className="relative flex-1">
<Search className="pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden />
<SearchInput
value={query}
onChange={(event) => onQueryChange(event.target.value)}
placeholder={tx("settings.apps.searchPlaceholder", "Search Apps")}
className={cn(
"h-12 pl-11 text-[15px]",
SETTINGS_SEARCH_INPUT_CLASS,
)}
/>
</div>
<SegmentedControl
value={filter}
options={filterOptions}
onChange={(value) => onFilterChange(value as AppsKindFilter)}
className="max-[480px]:grid max-[480px]:w-full max-[480px]:grid-cols-2 max-[480px]:rounded-2xl"
/>
</div>
</section>
{statusMessage ? ( {statusMessage ? (
<DismissibleStatusMessage <DismissibleStatusMessage
@@ -334,9 +317,9 @@ export function AppsCatalogSettings({
<section className="rounded-panel bg-settings-surface px-3 py-3 sm:px-4"> <section className="rounded-panel bg-settings-surface px-3 py-3 sm:px-4">
<div className="settings-section-heading border-b border-border/45 pb-2"> <div className="settings-section-heading border-b border-border/45 pb-2">
<SettingsSectionTitle> <SettingsSectionTitle>
{filter === "mcp" {filter.kind === "mcp"
? tx("settings.apps.mcpTools", "MCP tools") ? tx("settings.apps.mcpTools", "MCP tools")
: filter === "plugins" : filter.kind === "plugins"
? tx("settings.apps.filterPlugins", "Plugins") ? tx("settings.apps.filterPlugins", "Plugins")
: tx("settings.apps.featured", "Tools")} : tx("settings.apps.featured", "Tools")}
</SettingsSectionTitle> </SettingsSectionTitle>
@@ -373,7 +356,7 @@ export function AppsCatalogSettings({
oauthCompleting={mcpOAuthCompleting} oauthCompleting={mcpOAuthCompleting}
oauthCallbackError={mcpOAuthCallbackError} oauthCallbackError={mcpOAuthCallbackError}
showBrandLogos={showBrandLogos} showBrandLogos={showBrandLogos}
showTypeBadge={filter !== "mcp"} showTypeBadge={filter.kind !== "mcp"}
onFieldChange={onMcpFieldChange} onFieldChange={onMcpFieldChange}
onAction={onMcpAction} onAction={onMcpAction}
onOAuthConnect={onMcpOAuthConnect} onOAuthConnect={onMcpOAuthConnect}
@@ -389,11 +372,11 @@ export function AppsCatalogSettings({
) : null} ) : null}
{loading ? ( {loading ? (
<CatalogSkeleton label={tx("settings.apps.loading", "Loading apps…")} layout="apps" <CatalogSkeleton label={tx("settings.apps.loading", "Loading apps…")} layout="apps"
appActionLabel={filter === "cli" ? undefined : tx("settings.mcp.manage", "Manage")} /> appActionLabel={filter.kind === "cli" ? undefined : tx("settings.mcp.manage", "Manage")} />
) : !items.length && !statusIsError ? ( ) : !items.length && !statusIsError ? (
<div className="px-3 py-12 text-center text-sm text-muted-foreground"> <div className="px-3 py-12 text-center text-sm text-muted-foreground">
<p>{emptyTitle}</p> <p>{emptyTitle}</p>
{normalizedQuery ? ( {hiddenByReadyFilter ? null : normalizedQuery ? (
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
@@ -402,29 +385,18 @@ export function AppsCatalogSettings({
> >
{tx("settings.apps.clearSearch", "Clear search")} {tx("settings.apps.clearSearch", "Clear search")}
</Button> </Button>
) : emptyBrowseTarget ? ( ) : filter.kind === "mcp" || filter.kind === "plugins" ? (
<Button
type="button"
variant="outline"
className="mt-4 rounded-full"
onClick={() => onFilterChange(emptyBrowseTarget)}
>
{emptyBrowseTarget === "cli"
? tx("settings.apps.browseApps", "Browse apps")
: tx("settings.apps.browseIntegrations", "Browse MCP tools")}
</Button>
) : (
<p className="mx-auto mt-2 max-w-[28rem] text-[12px] leading-5"> <p className="mx-auto mt-2 max-w-[28rem] text-[12px] leading-5">
{filter === "plugins" {filter.kind === "mcp"
? tx("settings.apps.emptyPluginsHint", "Add a plugin to the workspace plugins directory to enable it here.") ? tx("settings.apps.emptyIntegrationsHint", "Add a custom MCP server below")
: tx("settings.apps.emptyIntegrationsHint", "Add a custom MCP server below.")} : tx("settings.apps.emptyPluginsHint", "Add a plugin to the workspace plugins directory to enable it here")}
</p> </p>
)} ) : null}
</div> </div>
) : null} ) : null}
</section> </section>
{filter === "mcp" ? ( {filter.kind === "mcp" ? (
<McpCustomServerPanel <McpCustomServerPanel
onConfigureProxy={onConfigureProxy} onConfigureProxy={onConfigureProxy}
form={customMcpForm} form={customMcpForm}
@@ -1,10 +1,8 @@
import { useCallback, useLayoutEffect, useRef, useState } from "react"; import { useCallback, useLayoutEffect, useRef, useState } from "react";
import { Search, X } from "lucide-react"; import { X } from "lucide-react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { SearchInput } from "@/components/ui/input"; import { CatalogControls, CatalogToggle, CatalogToolbar } from "@/components/settings/shared/CatalogToolbar";
import { SegmentedControl } from "@/components/ui/segmented-control";
import { SETTINGS_SEARCH_INPUT_CLASS } from "@/components/settings/shared/SettingsControls";
import { CatalogSkeleton } from "@/components/settings/shared/CatalogSkeleton"; import { CatalogSkeleton } from "@/components/settings/shared/CatalogSkeleton";
import type { ChannelFeatureAction } from "@/channel-plugins/types"; import type { ChannelFeatureAction } from "@/channel-plugins/types";
import { ChannelCatalogRow } from "@/components/settings/channels/ChannelCatalogRow"; import { ChannelCatalogRow } from "@/components/settings/channels/ChannelCatalogRow";
@@ -18,7 +16,7 @@ import { Dialog, DialogClose, DialogContent, DialogTitle } from "@/components/ui
type ChannelFilter = "all" | "enabled"; type ChannelFilter = "all" | "enabled";
export function ChannelsSettings({ export function ChannelsSettings({
token, nanobotFeatures, loading, actionKey, chatAppsDocsUrl, showBrandLogos, token, nanobotFeatures, loading, actionKey, chatAppsDocsUrl, showBrandLogos, query,
error, requiresRestartPending, onAction, onFeaturesUpdate, onDismissStatus, error, requiresRestartPending, onAction, onFeaturesUpdate, onDismissStatus,
onRestart, isRestarting, onConfigureMcp, onBeforeCloseChange, onRestart, isRestarting, onConfigureMcp, onBeforeCloseChange,
}: { }: {
@@ -28,6 +26,7 @@ export function ChannelsSettings({
actionKey: string | null; actionKey: string | null;
chatAppsDocsUrl?: string; chatAppsDocsUrl?: string;
showBrandLogos: boolean; showBrandLogos: boolean;
query: string;
error: string | null; error: string | null;
requiresRestartPending: boolean; requiresRestartPending: boolean;
onAction: ChannelFeatureAction; onAction: ChannelFeatureAction;
@@ -40,11 +39,10 @@ export function ChannelsSettings({
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
const [selectedChannelName, setSelectedChannelName] = useState<string | null>(null); const [selectedChannelName, setSelectedChannelName] = useState<string | null>(null);
const [query, setQuery] = useState("");
const [filter, setFilter] = useState<ChannelFilter>("enabled"); const [filter, setFilter] = useState<ChannelFilter>("enabled");
const [connectRequestId, setConnectRequestId] = useState(0); const [connectRequestId, setConnectRequestId] = useState(0);
const filterInitializedRef = useRef(false); const filterInitializedRef = useRef(false);
const triggerRef = useRef<HTMLElement | null>(null); const triggerRef = useRef<HTMLButtonElement | null>(null);
const dialogRef = useRef<HTMLDivElement | null>(null); const dialogRef = useRef<HTMLDivElement | null>(null);
const beforeCloseRef = useRef<(() => Promise<boolean>) | null>(null); const beforeCloseRef = useRef<(() => Promise<boolean>) | null>(null);
const closePendingRef = useRef(false); const closePendingRef = useRef(false);
@@ -103,23 +101,16 @@ export function ChannelsSettings({
); );
return ( return (
<div className="settings-stack"> <div className="catalog-section">
<div className="flex flex-col gap-3 sm:flex-row sm:items-center"> <CatalogToolbar>
<div className="relative min-w-0 flex-1"> <CatalogControls>
<Search className="pointer-events-none absolute start-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden /> <CatalogToggle label={t("settings.channels.enabledOnly")} checked={filter === "enabled"}
<SearchInput type="search" value={query} onChange={(event) => setQuery(event.target.value)} onChange={(enabled) => {
aria-label={t("settings.channels.search")} filterInitializedRef.current = true;
placeholder={t("settings.channels.search")} setFilter(enabled ? "enabled" : "all");
className={`h-12 ps-11 text-[15px] ${SETTINGS_SEARCH_INPUT_CLASS}`} /> }} />
</div> </CatalogControls>
<SegmentedControl value={filter} onChange={(value) => { </CatalogToolbar>
filterInitializedRef.current = true;
setFilter(value);
}} options={[
{ value: "all", label: t("settings.channels.filterAll") },
{ value: "enabled", label: t("settings.channels.filterEnabled") },
]} />
</div>
{error && !selectedChannel ? <DismissibleStatusMessage message={error} isError onDismiss={onDismissStatus} /> : null} {error && !selectedChannel ? <DismissibleStatusMessage message={error} isError onDismiss={onDismissStatus} /> : null}
{restartRequired && !hasPendingChannelRestart ? ( {restartRequired && !hasPendingChannelRestart ? (
<RestartRequiredNotice message={t("settings.channels.restartRequired")} <RestartRequiredNotice message={t("settings.channels.restartRequired")}
@@ -146,8 +137,8 @@ export function ChannelsSettings({
<ChannelCatalogRow key={feature.name} feature={feature} showBrandLogos={showBrandLogos} <ChannelCatalogRow key={feature.name} feature={feature} showBrandLogos={showBrandLogos}
actionKey={actionKey} restartRequired={restartRequired} onAction={onAction} actionKey={actionKey} restartRequired={restartRequired} onAction={onAction}
onRestart={onRestart} isRestarting={isRestarting} onRestart={onRestart} isRestarting={isRestarting}
onSelect={(connect = false) => { onSelect={(trigger, connect = false) => {
triggerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null; triggerRef.current = trigger;
beforeCloseRef.current = null; beforeCloseRef.current = null;
setConnectRequestId(connect ? 1 : 0); setConnectRequestId(connect ? 1 : 0);
setSelectedChannelName(feature.name); setSelectedChannelName(feature.name);
@@ -168,7 +159,10 @@ export function ChannelsSettings({
event.preventDefault(); event.preventDefault();
dialogRef.current?.focus({ preventScroll: true }); dialogRef.current?.focus({ preventScroll: true });
}} }}
onCloseAutoFocus={(event) => { event.preventDefault(); triggerRef.current?.focus(); }}> onCloseAutoFocus={(event) => {
event.preventDefault();
triggerRef.current?.focus({ preventScroll: true });
}}>
<DialogTitle className="sr-only">{t("settings.nav.channels")}</DialogTitle> <DialogTitle className="sr-only">{t("settings.nav.channels")}</DialogTitle>
<div className="max-h-[85dvh] min-h-0 overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"> <div className="max-h-[85dvh] min-h-0 overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
<div className="relative"> <div className="relative">
+46
View File
@@ -0,0 +1,46 @@
/* The width clips one sidebar, while its panel paint and labels fade to the rail. */
.sidebar-dock-frame {
--sidebar-dock-duration: 300ms;
--sidebar-dock-ease: cubic-bezier(0, 0, 0.2, 1);
transition: width var(--sidebar-dock-duration) var(--sidebar-dock-ease);
}
.sidebar-dock-frame[data-resizing] { --sidebar-dock-duration: 0ms; }
@media (prefers-reduced-motion: reduce) {
.sidebar-dock-frame { --sidebar-dock-duration: 0ms; }
}
.sidebar-dock-surface,
.sidebar-dock-history,
.sidebar-dock-label,
.sidebar-dock-host [data-sidebar-host-label] {
transition: opacity var(--sidebar-dock-duration) var(--sidebar-dock-ease),
visibility var(--sidebar-dock-duration) var(--sidebar-dock-ease);
}
.sidebar-dock-history {
/* Keep the rows at their open width until they are clipped out of sight. */
min-width: var(--sidebar-open-width);
}
.sidebar-dock-frame[data-collapsed] .sidebar-dock-surface,
[data-sidebar-collapsed="true"] :is(.sidebar-dock-history, .sidebar-dock-label, .sidebar-dock-host [data-sidebar-host-label]) {
opacity: 0;
visibility: hidden;
}
.sidebar-dock-footer-row {
--sidebar-settings-width: max(5.5rem, 36%);
position: relative;
padding-block-end: 0;
transition: padding-block-end var(--sidebar-dock-duration) var(--sidebar-dock-ease);
}
.sidebar-dock-footer-row > .sidebar-dock-settings {
width: var(--sidebar-settings-width);
}
.sidebar-dock-host {
position: absolute;
inset-block-end: 0;
inset-inline-end: 0;
inset-inline-start: calc(var(--sidebar-settings-width) + 0.25rem);
transition: inset-inline-start var(--sidebar-dock-duration) var(--sidebar-dock-ease);
}
.sidebar-dock-host [data-host-switcher] { overflow: hidden; }
[data-sidebar-collapsed="true"] .sidebar-dock-footer-row { padding-block-end: 2.25rem; }
[data-sidebar-collapsed="true"] .sidebar-dock-footer-row > .sidebar-dock-settings { width: 100%; }
[data-sidebar-collapsed="true"] .sidebar-dock-host { inset-inline-start: 0; }
+18 -26
View File
@@ -5,24 +5,31 @@ html.dark .startup-shell { --startup-fill: hsl(0 0% 72% / .2); --startup-surface
.startup-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } .startup-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.startup-block { height: 14px; border-radius: 4px; background: var(--startup-fill); } .startup-block { height: 14px; border-radius: 4px; background: var(--startup-fill); }
.startup-navigation { display: none; flex: 0 0 var(--startup-sidebar-width); padding: 20px 12px; background: var(--startup-nav); overflow: hidden; } .startup-navigation { display: none; flex: 0 0 var(--startup-sidebar-width); padding: 20px 12px; background: var(--startup-nav); overflow: hidden; }
.startup-shell[data-sidebar-expanded="false"] .startup-navigation { background: transparent; }
.startup-nav-brand { width: 32px; height: 32px; margin-bottom: 28px; border-radius: 10px; } .startup-nav-brand { width: 32px; height: 32px; margin-bottom: 28px; border-radius: 10px; }
.startup-nav-row { display: flex; height: 40px; align-items: center; gap: 12px; padding: 0 8px; } .startup-nav-row { display: flex; height: 40px; align-items: center; gap: 12px; padding: 0 8px; }
.startup-nav-icon { flex: 0 0 16px; height: 16px; } .startup-nav-icon { flex: 0 0 16px; height: 16px; }
.startup-nav-label { width: 96px; height: 12px; } .startup-nav-label { width: 96px; height: 12px; }
.startup-content { flex: 1; min-width: 0; height: 100%; } .startup-content { flex: 1; min-width: 0; height: 100%; }
.startup-scroll { height: 100%; overflow-y: auto; scrollbar-gutter: stable; scrollbar-width: thin; } .startup-scroll { height: 100%; overflow-y: auto; scrollbar-gutter: stable; scrollbar-width: thin; }
.startup-page { width: 100%; max-width: 816px; padding: 24px 12px; margin: 0 auto; } .startup-page { --startup-page-gutter: 0.75rem; container-type: inline-size; width: 100%; max-width: calc(var(--content-column-width) + 2 * var(--startup-page-gutter)); padding: 24px var(--startup-page-gutter); margin: 0 auto; }
.startup-page-header { margin-bottom: 28px; } .startup-page-header { margin-bottom: 28px; }
.startup-back { display: flex; align-items: center; height: 30px; margin-bottom: 16px; padding-left: 10px; } .startup-back { display: flex; align-items: center; height: 30px; margin-bottom: 16px; padding-left: 10px; }
@media (pointer: coarse) { .startup-back { height: 44px; } } @media (pointer: coarse) { .startup-back { height: 44px; } }
.startup-back .startup-block { width: 96px; height: 12px; } .startup-back .startup-block { width: 96px; height: 12px; }
.startup-title { display: flex; align-items: center; height: 30px; } .startup-title { display: flex; align-items: center; height: 30px; }
.startup-title .startup-block { width: 112px; height: 24px; } .startup-title .startup-block { width: 112px; height: 24px; }
.startup-tabs { display: none; height: 35.5px; margin-bottom: 20px; } .startup-tabs { display: flex; gap: 4px; width: 208px; height: 36px; padding: 4px; border-radius: 12px; background: var(--startup-surface); }
.startup-tabs .startup-block { width: 174px; height: 100%; border-radius: 9999px; } .startup-tabs .startup-block { flex: 1; height: 28px; border-radius: 8px; }
.startup-toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; } .startup-search { height: 36px; border-radius: 12px; }
.startup-search { flex: 1; height: 48px; min-height: 48px; border-radius: 9999px; } .startup-shell[data-startup-surface="skills"] .startup-primary-choices > :nth-child(n+3),
.startup-filters { width: 100%; height: 34px; border-radius: 9999px; } .startup-shell[data-startup-surface="channels"] .startup-primary-choices,
.startup-shell:not([data-startup-surface="skills"]) .startup-secondary-choices > :nth-child(3) { display: none; }
.startup-controls .catalog-choices .startup-block { width: 38px; height: 20px; margin-inline: 4px; border-radius: 8px; }
.startup-controls .catalog-choices .startup-block:nth-child(2) { width: 52px; }
.startup-controls .catalog-choices .startup-block:nth-child(3) { width: 64px; }
.startup-shell:not([data-startup-surface="skills"]) .startup-secondary-choices .startup-block:first-child { width: 52px; height: 12px; }
.startup-shell:not([data-startup-surface="skills"]) .startup-secondary-choices .startup-block:nth-child(2) { width: 36px; border-radius: 9999px; }
.startup-catalog-heading { display: none; height: 29px; align-items: start; padding: 3px 16px 8px; border-bottom: 1px solid var(--startup-fill); } .startup-catalog-heading { display: none; height: 29px; align-items: start; padding: 3px 16px 8px; border-bottom: 1px solid var(--startup-fill); }
.startup-catalog-heading .startup-block { width: 40px; } .startup-catalog-heading .startup-block { width: 40px; }
.startup-shell[data-startup-surface="apps"] .startup-catalog-frame { padding: 12px; border-radius: 22px; background: var(--startup-surface); } .startup-shell[data-startup-surface="apps"] .startup-catalog-frame { padding: 12px; border-radius: 22px; background: var(--startup-surface); }
@@ -37,11 +44,7 @@ html.dark .startup-shell { --startup-fill: hsl(0 0% 72% / .2); --startup-surface
.startup-catalog-copy .startup-block + .startup-block { width: 80%; height: 12px; opacity: .6; margin: 4px 0; } .startup-catalog-copy .startup-block + .startup-block { width: 80%; height: 12px; opacity: .6; margin: 4px 0; }
.startup-catalog-action { flex: 0 0 36px; height: 36px; border-radius: 9999px; } .startup-catalog-action { flex: 0 0 36px; height: 36px; border-radius: 9999px; }
.startup-catalog-row:nth-child(odd) .startup-catalog-copy .startup-block:first-child { width: 50%; } .startup-catalog-row:nth-child(odd) .startup-catalog-copy .startup-block:first-child { width: 50%; }
.startup-shell[data-startup-surface="skills"] .startup-tabs { display: block; } .startup-shell[data-startup-surface="skills"] .startup-catalog-frame { overflow: hidden; padding-top: 12px; border-radius: 22px; background: var(--startup-surface); }
.startup-shell[data-startup-surface="skills"] .startup-panel { overflow: hidden; border-radius: 22px; background: var(--startup-surface); }
.startup-shell[data-startup-surface="skills"] .startup-toolbar { padding: 16px 16px 8px; margin: 0; }
.startup-shell[data-startup-surface="skills"] .startup-search { height: 36px; min-height: 36px; }
.startup-shell[data-startup-surface="skills"] .startup-filters { height: 32.5px; }
.startup-shell[data-startup-surface="skills"] .startup-catalog { display: block; padding: 8px 12px 12px; } .startup-shell[data-startup-surface="skills"] .startup-catalog { display: block; padding: 8px 12px 12px; }
.startup-shell[data-startup-surface="skills"] .startup-catalog-group { display: flex; } .startup-shell[data-startup-surface="skills"] .startup-catalog-group { display: flex; }
.startup-shell[data-startup-surface="skills"] .startup-catalog-row { margin-top: 4px; padding-inline: 8px; } .startup-shell[data-startup-surface="skills"] .startup-catalog-row { margin-top: 4px; padding-inline: 8px; }
@@ -50,11 +53,10 @@ html.dark .startup-shell { --startup-fill: hsl(0 0% 72% / .2); --startup-surface
.startup-shell[data-startup-surface="channels"] .startup-catalog { padding: 0; column-gap: 16px; } .startup-shell[data-startup-surface="channels"] .startup-catalog { padding: 0; column-gap: 16px; }
.startup-shell[data-startup-surface="channels"] .startup-catalog-row { height: 60px; padding: 10px 16px; } .startup-shell[data-startup-surface="channels"] .startup-catalog-row { height: 60px; padding: 10px 16px; }
.startup-shell[data-startup-surface="channels"] .startup-catalog-icon { flex-basis: 32px; height: 32px; border-radius: 9px; } .startup-shell[data-startup-surface="channels"] .startup-catalog-icon { flex-basis: 32px; height: 32px; border-radius: 9px; }
.startup-shell[data-startup-surface="channels"] .startup-catalog-action { flex-basis: 38px; height: 20px; margin-inline: 13px; } .startup-shell[data-startup-surface="channels"] .startup-catalog-action { flex-basis: 38px; height: 20px; margin-inline: 3px; }
.startup-shell[data-startup-surface="channels"] .startup-catalog-copy .startup-block + .startup-block { display: none; } .startup-shell[data-startup-surface="channels"] .startup-catalog-copy .startup-block + .startup-block { display: none; }
.startup-automation, .startup-settings, .startup-chat { display: none; } .startup-automation, .startup-settings, .startup-chat { display: none; }
.startup-shell:is([data-startup-surface="automations"], [data-startup-surface="settings"], [data-startup-surface="remote"]) .startup-panel { display: none; } .startup-shell:is([data-startup-surface="automations"], [data-startup-surface="settings"], [data-startup-surface="remote"]) .startup-panel { display: none; }
.startup-shell[data-startup-surface="automations"] .startup-page { max-width: 984px; }
.startup-shell[data-startup-surface="automations"] .startup-automation { display: block; } .startup-shell[data-startup-surface="automations"] .startup-automation { display: block; }
.startup-automation-composer { display: flex; align-items: center; height: 110px; margin-bottom: 20px; padding: 16px; border: 1px solid var(--startup-fill); border-radius: 28px; } .startup-automation-composer { display: flex; align-items: center; height: 110px; margin-bottom: 20px; padding: 16px; border: 1px solid var(--startup-fill); border-radius: 28px; }
.startup-automation-composer .startup-block { width: 60%; } .startup-automation-composer .startup-block { width: 60%; }
@@ -123,7 +125,7 @@ html.dark .startup-composer-surface { background: hsl(0 0% 22%); box-shadow: ins
.startup-shell[data-existing-chat="true"] .startup-header-title { display: block; width: 96px; height: 12px; } .startup-shell[data-existing-chat="true"] .startup-header-title { display: block; width: 96px; height: 12px; }
.startup-shell[data-existing-chat="true"] .startup-chat-layout { display: flex; flex-direction: column; } .startup-shell[data-existing-chat="true"] .startup-chat-layout { display: flex; flex-direction: column; }
.startup-shell[data-existing-chat="true"] .startup-messages { display: block; } .startup-shell[data-existing-chat="true"] .startup-messages { display: block; }
.startup-shell[data-existing-chat="true"] .startup-composer { max-width: 792px; margin-top: auto; } .startup-shell[data-existing-chat="true"] .startup-composer { max-width: var(--content-column-width); margin-top: auto; }
.startup-shell[data-existing-chat="true"] :is(.startup-chat-empty, .startup-workspace-row) { display: none; } .startup-shell[data-existing-chat="true"] :is(.startup-chat-empty, .startup-workspace-row) { display: none; }
@media (min-width: 640px) { @media (min-width: 640px) {
.startup-chat-layout { grid-template-rows: minmax(min-content, 1fr) auto 1fr; padding: 48px 16px; } .startup-chat-layout { grid-template-rows: minmax(min-content, 1fr) auto 1fr; padding: 48px 16px; }
@@ -131,21 +133,14 @@ html.dark .startup-composer-surface { background: hsl(0 0% 22%); box-shadow: ins
.startup-composer-input { padding-inline: 20px; } .startup-composer-input { padding-inline: 20px; }
.startup-composer-footer { padding-inline: 16px; } .startup-composer-footer { padding-inline: 16px; }
.startup-workspace-row { padding-inline-end: 12px; } .startup-workspace-row { padding-inline-end: 12px; }
.startup-page { max-width: 824px; padding: 32px 16px; } .startup-page { --startup-page-gutter: 1rem; padding-block: 32px; }
.startup-shell:is([data-startup-surface="apps"], [data-startup-surface="skills"], [data-startup-surface="channels"], [data-startup-surface="automations"]) .startup-scroll { scrollbar-gutter: stable both-edges; }
.startup-title { height: 35px; } .startup-title { height: 35px; }
.startup-toolbar { flex-direction: row; align-items: center; }
.startup-filters { width: 174px; }
.startup-shell[data-startup-surface="apps"] .startup-toolbar { flex-direction: column; align-items: stretch; }
.startup-shell[data-startup-surface="apps"] .startup-filters { width: 100%; }
.startup-shell[data-startup-surface="apps"] .startup-catalog-frame { padding-inline: 16px; } .startup-shell[data-startup-surface="apps"] .startup-catalog-frame { padding-inline: 16px; }
.startup-shell[data-startup-surface="skills"] .startup-filters { width: 233px; }
.startup-shell[data-startup-surface="skills"] .startup-search { max-width: 320px; }
.startup-shell[data-startup-surface="skills"] .startup-toolbar { justify-content: space-between; }
.startup-shell[data-startup-surface="skills"] .startup-catalog { padding-inline: 16px; } .startup-shell[data-startup-surface="skills"] .startup-catalog { padding-inline: 16px; }
.startup-shell[data-startup-surface="skills"] .startup-catalog-action { display: block; flex-basis: 80px; height: 12px; margin-left: 12px; } .startup-shell[data-startup-surface="skills"] .startup-catalog-action { display: block; flex-basis: 80px; height: 12px; margin-left: 12px; }
.startup-shell[data-startup-surface="channels"] .startup-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); } .startup-shell[data-startup-surface="channels"] .startup-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.startup-shell[data-startup-surface="settings"] .startup-page { padding-inline: 32px; } .startup-shell[data-startup-surface="settings"] .startup-page { padding-inline: 32px; }
.startup-shell[data-startup-surface="automations"] .startup-page { max-width: 992px; }
} }
@media (min-width: 1024px) { @media (min-width: 1024px) {
.startup-header-menu { display: none; } .startup-header-menu { display: none; }
@@ -156,9 +151,6 @@ html.dark .startup-composer-surface { background: hsl(0 0% 22%); box-shadow: ins
.startup-page { padding-top: 48px; } .startup-page { padding-top: 48px; }
.startup-back { display: none; } .startup-back { display: none; }
.startup-shell[data-sidebar-expanded="true"]:not([data-startup-surface="settings"]) .startup-page-header { display: none; } .startup-shell[data-sidebar-expanded="true"]:not([data-startup-surface="settings"]) .startup-page-header { display: none; }
.startup-shell[data-startup-surface="apps"] .startup-toolbar { flex-direction: row; align-items: center; }
.startup-shell[data-startup-surface="apps"][data-sidebar-expanded="true"] .startup-toolbar { margin-top: 20px; }
.startup-shell[data-startup-surface="apps"] .startup-filters { width: 156px; }
.startup-automation-composer { height: 62px; } .startup-automation-composer { height: 62px; }
} }
@media (min-width: 1280px) { @media (min-width: 1280px) {
+13 -10
View File
@@ -1,22 +1,25 @@
import type { ComponentProps } from "react"; import { forwardRef, type ComponentProps } from "react";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
export function ToggleButton({ type ToggleButtonProps = {
checked: boolean;
disabled?: boolean;
onChange: (checked: boolean) => void;
ariaLabel?: string;
label: string;
} & Pick<ComponentProps<"button">, "id" | "aria-describedby" | "aria-invalid">;
export const ToggleButton = forwardRef<HTMLButtonElement, ToggleButtonProps>(function ToggleButton({
checked, checked,
disabled, disabled,
onChange, onChange,
ariaLabel, ariaLabel,
label, label,
...accessibility ...accessibility
}: { }, ref) {
checked: boolean;
disabled?: boolean;
onChange: (checked: boolean) => void;
ariaLabel?: string;
label: string;
} & Pick<ComponentProps<"button">, "id" | "aria-describedby" | "aria-invalid">) {
return ( return (
<button <button
ref={ref}
{...accessibility} {...accessibility}
type="button" type="button"
role="switch" role="switch"
@@ -48,4 +51,4 @@ export function ToggleButton({
<span className="sr-only">{label}</span> <span className="sr-only">{label}</span>
</button> </button>
); );
} });
+9 -4
View File
@@ -1,3 +1,6 @@
@import "./components/content-column.css";
@import "./components/settings/shared/catalog-layout.css";
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
@@ -19,7 +22,7 @@
} }
.thread-composer-stack { .thread-composer-stack {
--composer-content-width: 49.5rem; --composer-content-width: var(--content-column-width);
} }
.thread-composer-stack.is-hero { .thread-composer-stack.is-hero {
--composer-content-width: 58rem; --composer-content-width: 58rem;
@@ -133,7 +136,6 @@
--radius-prominent: 1.75rem; --radius-prominent: 1.75rem;
--radius-pill: 9999px; --radius-pill: 9999px;
--corner-shape: superellipse(1.5); --corner-shape: superellipse(1.5);
--content-column-width: 49.5rem;
--sidebar: 40 8% 96.8%; --sidebar: 40 8% 96.8%;
--sidebar-foreground: 0 0% 3.9%; --sidebar-foreground: 0 0% 3.9%;
--sidebar-content: 240 3% 30%; --sidebar-content: 240 3% 30%;
@@ -1468,8 +1470,10 @@
--settings-margin: 0.75rem; --settings-margin: 0.75rem;
max-inline-size: calc(var(--content-column-width) + 2 * var(--settings-margin)); max-inline-size: calc(var(--content-column-width) + 2 * var(--settings-margin));
} }
.settings-grid.settings-feature-page.settings-automations-grid { .catalog-section {
max-inline-size: calc(60rem + 2 * var(--settings-margin)); display: grid;
min-inline-size: 0;
gap: var(--settings-module-gap, 20px);
} }
.automations-page { .automations-page {
--settings-inset: 1rem; --settings-inset: 1rem;
@@ -1495,6 +1499,7 @@
} }
.automation-create-composer .thread-composer-collapsible-layout { .automation-create-composer .thread-composer-collapsible-layout {
padding-block-start: 0; padding-block-start: 0;
padding-inline: 0;
} }
/* Match the main sidebar's lg visibility; its collapsed rail has no labels. */ /* Match the main sidebar's lg visibility; its collapsed rail has no labels. */
@media (min-width: 1024px) { @media (min-width: 1024px) {
+14 -17
View File
@@ -454,10 +454,7 @@
"ariaLabel": "Change language" "ariaLabel": "Change language"
}, },
"apps": "Apps", "apps": "Apps",
"automations": "Automations", "automations": "Automations"
"skills": {
"title": "Skills"
}
}, },
"settings": { "settings": {
"timezoneNoMatches": "No matching timezones.", "timezoneNoMatches": "No matching timezones.",
@@ -1438,12 +1435,15 @@
"enable": "Enable tracing" "enable": "Enable tracing"
}, },
"apps": { "apps": {
"allTypes": "All",
"typeFilter": "Tool type",
"statusFilter": "Status",
"description": "Manage CLI Apps, Agent Plugins, and MCP tools.", "description": "Manage CLI Apps, Agent Plugins, and MCP tools.",
"cliLabel": "CLI App", "cliLabel": "CLI App",
"mcpLabel": "MCP", "mcpLabel": "MCP",
"channelLabel": "Channel", "channelLabel": "Channel",
"featureLabel": "Feature", "featureLabel": "Feature",
"filterAll": "Ready", "readyOnly": "Ready only",
"filterPlugins": "Agent Plugins", "filterPlugins": "Agent Plugins",
"filterCli": "CLI Apps", "filterCli": "CLI Apps",
"filterMcp": "MCP", "filterMcp": "MCP",
@@ -1452,17 +1452,15 @@
"featured": "Tools", "featured": "Tools",
"mcpTools": "MCP tools", "mcpTools": "MCP tools",
"loading": "Loading apps…", "loading": "Loading apps…",
"empty": "No tools match your search.", "empty": "No tools match your search",
"emptyApps": "No CLI Apps available.", "emptyApps": "No tools available",
"emptyIntegrations": "No MCP tools available.", "emptyIntegrations": "No MCP tools available",
"emptyReady": "No tools are ready yet.", "emptyReady": "No tools are ready yet",
"clearSearch": "Clear search", "clearSearch": "Clear search",
"browseApps": "Browse CLI Apps", "emptyIntegrationsHint": "Add a custom MCP server below",
"browseIntegrations": "Browse MCP tools",
"emptyIntegrationsHint": "Add a custom MCP server below.",
"restartRequired": "Restart nanobot to apply updated apps and MCP tools.", "restartRequired": "Restart nanobot to apply updated apps and MCP tools.",
"emptyPlugins": "No Agent Plugins installed.", "emptyPlugins": "No Agent Plugins installed",
"emptyPluginsHint": "Add a plugin to the workspace plugins directory to enable it here.", "emptyPluginsHint": "Add a plugin to the workspace plugins directory to enable it here",
"pluginPermissions": "Declared permissions", "pluginPermissions": "Declared permissions",
"pluginServers": "MCP servers", "pluginServers": "MCP servers",
"pluginTrustNotice": "Plugins run with nanobot’s operating-system permissions. Declared permissions do not sandbox them.", "pluginTrustNotice": "Plugins run with nanobot’s operating-system permissions. Declared permissions do not sandbox them.",
@@ -1501,7 +1499,7 @@
"configuredInstances": "{{count}} instances configured", "configuredInstances": "{{count}} instances configured",
"connectPreview": "Run the command below in your terminal to connect.", "connectPreview": "Run the command below in your terminal to connect.",
"copyCommand": "Copy command", "copyCommand": "Copy command",
"filterAll": "All", "enabledOnly": "Enabled only",
"filterOff": "Not running", "filterOff": "Not running",
"filterOn": "Running", "filterOn": "Running",
"helperCopied": "{{name}} copied.", "helperCopied": "{{name}} copied.",
@@ -1807,7 +1805,7 @@
"description": "Choose skills available in chat.", "description": "Choose skills available in chat.",
"views": "Skills views", "views": "Skills views",
"installedTab": "Installed", "installedTab": "Installed",
"discoverTab": "Discover", "discoverTab": "Marketplace",
"customGroup": "Custom", "customGroup": "Custom",
"builtinGroup": "Built-in", "builtinGroup": "Built-in",
"otherGroup": "Other", "otherGroup": "Other",
@@ -1844,7 +1842,6 @@
"marketplaceSearchFailed": "Could not search skill marketplaces.", "marketplaceSearchFailed": "Could not search skill marketplaces.",
"marketplaceInstallFailed": "Could not install this skill.", "marketplaceInstallFailed": "Could not install this skill.",
"marketplaceSearchPlaceholder": "Search skills", "marketplaceSearchPlaceholder": "Search skills",
"marketplaceSearchLabel": "Search skills",
"marketplaceSearching": "Searching", "marketplaceSearching": "Searching",
"marketplaceProviderFilter": "Skill source", "marketplaceProviderFilter": "Skill source",
"marketplaceProviderAll": "All", "marketplaceProviderAll": "All",
+14 -17
View File
@@ -454,10 +454,7 @@
"ariaLabel": "Cambiar idioma" "ariaLabel": "Cambiar idioma"
}, },
"apps": "Aplicaciones", "apps": "Aplicaciones",
"automations": "Automatizaciones", "automations": "Automatizaciones"
"skills": {
"title": "Habilidades"
}
}, },
"settings": { "settings": {
"timezoneNoMatches": "No hay zonas horarias que coincidan.", "timezoneNoMatches": "No hay zonas horarias que coincidan.",
@@ -1256,12 +1253,15 @@
"thirdPartyBrands": "Los nombres, logotipos y marcas de productos pertenecen a sus respectivos propietarios. Su uso es solo identificativo y no implica respaldo." "thirdPartyBrands": "Los nombres, logotipos y marcas de productos pertenecen a sus respectivos propietarios. Su uso es solo identificativo y no implica respaldo."
}, },
"apps": { "apps": {
"allTypes": "Todos",
"typeFilter": "Tipo de herramienta",
"statusFilter": "Estado",
"description": "Gestiona aplicaciones CLI, Agent Plugins y herramientas MCP.", "description": "Gestiona aplicaciones CLI, Agent Plugins y herramientas MCP.",
"cliLabel": "CLI App", "cliLabel": "CLI App",
"mcpLabel": "MCP", "mcpLabel": "MCP",
"channelLabel": "Canal", "channelLabel": "Canal",
"featureLabel": "Función", "featureLabel": "Función",
"filterAll": "Disponibles", "readyOnly": "Solo disponibles",
"filterPlugins": "Agent Plugins", "filterPlugins": "Agent Plugins",
"filterCli": "CLI Apps", "filterCli": "CLI Apps",
"filterMcp": "MCP", "filterMcp": "MCP",
@@ -1270,17 +1270,15 @@
"featured": "Herramientas", "featured": "Herramientas",
"mcpTools": "Herramientas MCP", "mcpTools": "Herramientas MCP",
"loading": "Cargando aplicaciones...", "loading": "Cargando aplicaciones...",
"empty": "Ninguna herramienta coincide con tu búsqueda.", "empty": "Ninguna herramienta coincide con tu búsqueda",
"emptyApps": "No hay aplicaciones CLI disponibles.", "emptyApps": "No hay herramientas disponibles",
"emptyIntegrations": "No hay herramientas MCP disponibles.", "emptyIntegrations": "No hay herramientas MCP disponibles",
"emptyReady": "Todavía no hay herramientas listas.", "emptyReady": "Todavía no hay herramientas listas",
"clearSearch": "Borrar búsqueda", "clearSearch": "Borrar búsqueda",
"browseApps": "Explorar aplicaciones CLI", "emptyIntegrationsHint": "Añade un servidor MCP personalizado abajo",
"browseIntegrations": "Explorar herramientas MCP",
"emptyIntegrationsHint": "Añade un servidor MCP personalizado abajo.",
"restartRequired": "Reinicia nanobot para aplicar las aplicaciones y herramientas MCP actualizadas.", "restartRequired": "Reinicia nanobot para aplicar las aplicaciones y herramientas MCP actualizadas.",
"emptyPlugins": "No hay Agent Plugins instalados.", "emptyPlugins": "No hay Agent Plugins instalados",
"emptyPluginsHint": "Añade un plugin al directorio plugins del espacio de trabajo para activarlo aquí.", "emptyPluginsHint": "Añade un plugin al directorio plugins del espacio de trabajo para activarlo aquí",
"pluginPermissions": "Permisos declarados", "pluginPermissions": "Permisos declarados",
"pluginServers": "Servidores MCP", "pluginServers": "Servidores MCP",
"pluginTrustNotice": "Los plugins se ejecutan con los permisos del sistema de nanobot. Los permisos declarados no los aíslan.", "pluginTrustNotice": "Los plugins se ejecutan con los permisos del sistema de nanobot. Los permisos declarados no los aíslan.",
@@ -1321,7 +1319,7 @@
"configuredInstances": "{{count}} instancias configuradas", "configuredInstances": "{{count}} instancias configuradas",
"connectPreview": "El siguiente paso es la conexión en el navegador. Por ahora, ejecuta el comando siguiente.", "connectPreview": "El siguiente paso es la conexión en el navegador. Por ahora, ejecuta el comando siguiente.",
"copyCommand": "Copiar comando", "copyCommand": "Copiar comando",
"filterAll": "Todos", "enabledOnly": "Solo activados",
"filterOff": "Detenidos", "filterOff": "Detenidos",
"filterOn": "En ejecución", "filterOn": "En ejecución",
"helperCopied": "{{name}} copiado.", "helperCopied": "{{name}} copiado.",
@@ -1625,7 +1623,7 @@
"description": "Elige las habilidades disponibles en el chat.", "description": "Elige las habilidades disponibles en el chat.",
"views": "Vistas de habilidades", "views": "Vistas de habilidades",
"installedTab": "Instaladas", "installedTab": "Instaladas",
"discoverTab": "Descubrir", "discoverTab": "Mercado de habilidades",
"customGroup": "Personalizadas", "customGroup": "Personalizadas",
"builtinGroup": "Integradas", "builtinGroup": "Integradas",
"otherGroup": "Otras", "otherGroup": "Otras",
@@ -1662,7 +1660,6 @@
"marketplaceSearchFailed": "No se pudo buscar en los catálogos de habilidades.", "marketplaceSearchFailed": "No se pudo buscar en los catálogos de habilidades.",
"marketplaceInstallFailed": "No se pudo instalar esta habilidad.", "marketplaceInstallFailed": "No se pudo instalar esta habilidad.",
"marketplaceSearchPlaceholder": "Buscar habilidades", "marketplaceSearchPlaceholder": "Buscar habilidades",
"marketplaceSearchLabel": "Buscar habilidades",
"marketplaceSearching": "Buscando", "marketplaceSearching": "Buscando",
"marketplaceProviderFilter": "Origen de la habilidad", "marketplaceProviderFilter": "Origen de la habilidad",
"marketplaceProviderAll": "Todos", "marketplaceProviderAll": "Todos",
+14 -17
View File
@@ -454,10 +454,7 @@
"ariaLabel": "Changer de langue" "ariaLabel": "Changer de langue"
}, },
"apps": "Applications", "apps": "Applications",
"automations": "Automatisations", "automations": "Automatisations"
"skills": {
"title": "Compétences"
}
}, },
"settings": { "settings": {
"timezoneNoMatches": "Aucun fuseau horaire correspondant.", "timezoneNoMatches": "Aucun fuseau horaire correspondant.",
@@ -1256,12 +1253,15 @@
"thirdPartyBrands": "Les noms, logos et marques de produits appartiennent à leurs propriétaires respectifs. Leur utilisation sert uniquement à l'identification et n'implique aucune approbation." "thirdPartyBrands": "Les noms, logos et marques de produits appartiennent à leurs propriétaires respectifs. Leur utilisation sert uniquement à l'identification et n'implique aucune approbation."
}, },
"apps": { "apps": {
"allTypes": "Tous",
"typeFilter": "Type d’outil",
"statusFilter": "État",
"description": "Gérez les applications CLI, les Agent Plugins et les outils MCP.", "description": "Gérez les applications CLI, les Agent Plugins et les outils MCP.",
"cliLabel": "CLI App", "cliLabel": "CLI App",
"mcpLabel": "MCP", "mcpLabel": "MCP",
"channelLabel": "Canal", "channelLabel": "Canal",
"featureLabel": "Fonction", "featureLabel": "Fonction",
"filterAll": "Prêts", "readyOnly": "Prêts uniquement",
"filterPlugins": "Agent Plugins", "filterPlugins": "Agent Plugins",
"filterCli": "CLI Apps", "filterCli": "CLI Apps",
"filterMcp": "MCP", "filterMcp": "MCP",
@@ -1270,17 +1270,15 @@
"featured": "Outils", "featured": "Outils",
"mcpTools": "Outils MCP", "mcpTools": "Outils MCP",
"loading": "Chargement des applications...", "loading": "Chargement des applications...",
"empty": "Aucun outil ne correspond à votre recherche.", "empty": "Aucun outil ne correspond à votre recherche",
"emptyApps": "Aucune application CLI disponible.", "emptyApps": "Aucun outil disponible",
"emptyIntegrations": "Aucun outil MCP disponible.", "emptyIntegrations": "Aucun outil MCP disponible",
"emptyReady": "Aucun outil n’est encore prêt.", "emptyReady": "Aucun outil n’est encore prêt",
"clearSearch": "Effacer la recherche", "clearSearch": "Effacer la recherche",
"browseApps": "Parcourir les applications CLI", "emptyIntegrationsHint": "Ajoutez un serveur MCP personnalisé ci-dessous",
"browseIntegrations": "Parcourir les outils MCP",
"emptyIntegrationsHint": "Ajoutez un serveur MCP personnalisé ci-dessous.",
"restartRequired": "Redémarrez nanobot pour appliquer les applications et outils MCP mis à jour.", "restartRequired": "Redémarrez nanobot pour appliquer les applications et outils MCP mis à jour.",
"emptyPlugins": "Aucun Agent Plugin installé.", "emptyPlugins": "Aucun Agent Plugin installé",
"emptyPluginsHint": "Ajoutez un plugin au dossier plugins de l’espace de travail pour l’activer ici.", "emptyPluginsHint": "Ajoutez un plugin au dossier plugins de l’espace de travail pour l’activer ici",
"pluginPermissions": "Autorisations déclarées", "pluginPermissions": "Autorisations déclarées",
"pluginServers": "Serveurs MCP", "pluginServers": "Serveurs MCP",
"pluginTrustNotice": "Les plugins s’exécutent avec les permissions système de nanobot. Les autorisations déclarées ne les isolent pas.", "pluginTrustNotice": "Les plugins s’exécutent avec les permissions système de nanobot. Les autorisations déclarées ne les isolent pas.",
@@ -1321,7 +1319,7 @@
"configuredInstances": "{{count}} instances configurées", "configuredInstances": "{{count}} instances configurées",
"connectPreview": "La connexion dans le navigateur est la prochaine étape. Pour l'instant, exécutez la commande ci-dessous.", "connectPreview": "La connexion dans le navigateur est la prochaine étape. Pour l'instant, exécutez la commande ci-dessous.",
"copyCommand": "Copier la commande", "copyCommand": "Copier la commande",
"filterAll": "Tous", "enabledOnly": "Activés uniquement",
"filterOff": "À l’arrêt", "filterOff": "À l’arrêt",
"filterOn": "En cours d’exécution", "filterOn": "En cours d’exécution",
"helperCopied": "{{name}} copié.", "helperCopied": "{{name}} copié.",
@@ -1625,7 +1623,7 @@
"description": "Choisissez les compétences disponibles dans les discussions.", "description": "Choisissez les compétences disponibles dans les discussions.",
"views": "Vues des compétences", "views": "Vues des compétences",
"installedTab": "Installées", "installedTab": "Installées",
"discoverTab": "Découvrir", "discoverTab": "Catalogue de compétences",
"customGroup": "Personnalisées", "customGroup": "Personnalisées",
"builtinGroup": "Intégrées", "builtinGroup": "Intégrées",
"otherGroup": "Autres", "otherGroup": "Autres",
@@ -1662,7 +1660,6 @@
"marketplaceSearchFailed": "Impossible de rechercher dans les catalogues de compétences.", "marketplaceSearchFailed": "Impossible de rechercher dans les catalogues de compétences.",
"marketplaceInstallFailed": "Impossible d’installer cette compétence.", "marketplaceInstallFailed": "Impossible d’installer cette compétence.",
"marketplaceSearchPlaceholder": "Rechercher des compétences", "marketplaceSearchPlaceholder": "Rechercher des compétences",
"marketplaceSearchLabel": "Rechercher des compétences",
"marketplaceSearching": "Recherche en cours", "marketplaceSearching": "Recherche en cours",
"marketplaceProviderFilter": "Source des compétences", "marketplaceProviderFilter": "Source des compétences",
"marketplaceProviderAll": "Toutes", "marketplaceProviderAll": "Toutes",
+14 -17
View File
@@ -454,10 +454,7 @@
"ariaLabel": "Ganti bahasa" "ariaLabel": "Ganti bahasa"
}, },
"apps": "Aplikasi", "apps": "Aplikasi",
"automations": "Otomasi", "automations": "Otomasi"
"skills": {
"title": "Keterampilan"
}
}, },
"settings": { "settings": {
"timezoneNoMatches": "Tidak ada zona waktu yang cocok.", "timezoneNoMatches": "Tidak ada zona waktu yang cocok.",
@@ -1256,12 +1253,15 @@
"thirdPartyBrands": "Nama produk, logo, dan merek adalah milik pemiliknya masing-masing. Penggunaan hanya untuk identifikasi dan tidak menyiratkan dukungan." "thirdPartyBrands": "Nama produk, logo, dan merek adalah milik pemiliknya masing-masing. Penggunaan hanya untuk identifikasi dan tidak menyiratkan dukungan."
}, },
"apps": { "apps": {
"allTypes": "Semua",
"typeFilter": "Jenis alat",
"statusFilter": "Status",
"description": "Kelola CLI Apps, Agent Plugins, dan alat MCP.", "description": "Kelola CLI Apps, Agent Plugins, dan alat MCP.",
"cliLabel": "CLI App", "cliLabel": "CLI App",
"mcpLabel": "MCP", "mcpLabel": "MCP",
"channelLabel": "Kanal", "channelLabel": "Kanal",
"featureLabel": "Fitur", "featureLabel": "Fitur",
"filterAll": "Siap", "readyOnly": "Hanya yang siap",
"filterPlugins": "Agent Plugins", "filterPlugins": "Agent Plugins",
"filterCli": "CLI Apps", "filterCli": "CLI Apps",
"filterMcp": "MCP", "filterMcp": "MCP",
@@ -1270,17 +1270,15 @@
"featured": "Alat", "featured": "Alat",
"mcpTools": "Alat MCP", "mcpTools": "Alat MCP",
"loading": "Memuat aplikasi...", "loading": "Memuat aplikasi...",
"empty": "Tidak ada alat yang cocok dengan pencarian Anda.", "empty": "Tidak ada alat yang cocok dengan pencarian Anda",
"emptyApps": "Tidak ada CLI App yang tersedia.", "emptyApps": "Tidak ada alat yang tersedia",
"emptyIntegrations": "Tidak ada alat MCP yang tersedia.", "emptyIntegrations": "Tidak ada alat MCP yang tersedia",
"emptyReady": "Belum ada alat yang siap.", "emptyReady": "Belum ada alat yang siap",
"clearSearch": "Hapus pencarian", "clearSearch": "Hapus pencarian",
"browseApps": "Jelajahi CLI Apps", "emptyIntegrationsHint": "Tambahkan server MCP khusus di bawah",
"browseIntegrations": "Jelajahi alat MCP",
"emptyIntegrationsHint": "Tambahkan server MCP khusus di bawah.",
"restartRequired": "Mulai ulang nanobot untuk menerapkan aplikasi dan alat MCP yang diperbarui.", "restartRequired": "Mulai ulang nanobot untuk menerapkan aplikasi dan alat MCP yang diperbarui.",
"emptyPlugins": "Belum ada Agent Plugin yang terpasang.", "emptyPlugins": "Belum ada Agent Plugin yang terpasang",
"emptyPluginsHint": "Tambahkan plugin ke direktori plugins ruang kerja untuk mengaktifkannya di sini.", "emptyPluginsHint": "Tambahkan plugin ke direktori plugins ruang kerja untuk mengaktifkannya di sini",
"pluginPermissions": "Izin yang dinyatakan", "pluginPermissions": "Izin yang dinyatakan",
"pluginServers": "Server MCP", "pluginServers": "Server MCP",
"pluginTrustNotice": "Plugin berjalan dengan izin sistem operasi nanobot. Izin yang dinyatakan tidak mengisolasinya.", "pluginTrustNotice": "Plugin berjalan dengan izin sistem operasi nanobot. Izin yang dinyatakan tidak mengisolasinya.",
@@ -1321,7 +1319,7 @@
"configuredInstances": "{{count}} instans dikonfigurasi", "configuredInstances": "{{count}} instans dikonfigurasi",
"connectPreview": "Langkah berikutnya adalah koneksi di browser. Untuk saat ini, jalankan perintah di bawah.", "connectPreview": "Langkah berikutnya adalah koneksi di browser. Untuk saat ini, jalankan perintah di bawah.",
"copyCommand": "Salin perintah", "copyCommand": "Salin perintah",
"filterAll": "Semua", "enabledOnly": "Hanya yang aktif",
"filterOff": "Berhenti", "filterOff": "Berhenti",
"filterOn": "Berjalan", "filterOn": "Berjalan",
"helperCopied": "{{name}} disalin.", "helperCopied": "{{name}} disalin.",
@@ -1625,7 +1623,7 @@
"description": "Pilih skill yang tersedia di chat.", "description": "Pilih skill yang tersedia di chat.",
"views": "Tampilan keterampilan", "views": "Tampilan keterampilan",
"installedTab": "Terpasang", "installedTab": "Terpasang",
"discoverTab": "Temukan", "discoverTab": "Pasar keterampilan",
"customGroup": "Kustom", "customGroup": "Kustom",
"builtinGroup": "Bawaan", "builtinGroup": "Bawaan",
"otherGroup": "Lainnya", "otherGroup": "Lainnya",
@@ -1662,7 +1660,6 @@
"marketplaceSearchFailed": "Tidak dapat mencari marketplace keterampilan.", "marketplaceSearchFailed": "Tidak dapat mencari marketplace keterampilan.",
"marketplaceInstallFailed": "Tidak dapat memasang keterampilan ini.", "marketplaceInstallFailed": "Tidak dapat memasang keterampilan ini.",
"marketplaceSearchPlaceholder": "Cari keterampilan", "marketplaceSearchPlaceholder": "Cari keterampilan",
"marketplaceSearchLabel": "Cari keterampilan",
"marketplaceSearching": "Mencari", "marketplaceSearching": "Mencari",
"marketplaceProviderFilter": "Sumber keterampilan", "marketplaceProviderFilter": "Sumber keterampilan",
"marketplaceProviderAll": "Semua", "marketplaceProviderAll": "Semua",
+14 -17
View File
@@ -454,10 +454,7 @@
"ariaLabel": "言語を変更" "ariaLabel": "言語を変更"
}, },
"apps": "アプリ", "apps": "アプリ",
"automations": "自動タスク", "automations": "自動タスク"
"skills": {
"title": "スキル"
}
}, },
"settings": { "settings": {
"timezoneNoMatches": "一致するタイムゾーンがありません。", "timezoneNoMatches": "一致するタイムゾーンがありません。",
@@ -1256,12 +1253,15 @@
"thirdPartyBrands": "製品名、ロゴ、ブランドはそれぞれの所有者に帰属します。使用は識別のみを目的とし、承認を意味するものではありません。" "thirdPartyBrands": "製品名、ロゴ、ブランドはそれぞれの所有者に帰属します。使用は識別のみを目的とし、承認を意味するものではありません。"
}, },
"apps": { "apps": {
"allTypes": "すべて",
"typeFilter": "ツールの種類",
"statusFilter": "状態",
"description": "CLI Apps、Agent Plugins、MCP ツールを管理します。", "description": "CLI Apps、Agent Plugins、MCP ツールを管理します。",
"cliLabel": "CLI App", "cliLabel": "CLI App",
"mcpLabel": "MCP", "mcpLabel": "MCP",
"channelLabel": "チャンネル", "channelLabel": "チャンネル",
"featureLabel": "機能", "featureLabel": "機能",
"filterAll": "使用可能", "readyOnly": "使用可能のみ",
"filterPlugins": "Agent プラグイン", "filterPlugins": "Agent プラグイン",
"filterCli": "CLI Apps", "filterCli": "CLI Apps",
"filterMcp": "MCP", "filterMcp": "MCP",
@@ -1270,17 +1270,15 @@
"featured": "ツール", "featured": "ツール",
"mcpTools": "MCP ツール", "mcpTools": "MCP ツール",
"loading": "アプリを読み込み中...", "loading": "アプリを読み込み中...",
"empty": "検索条件に一致するツールはありません。", "empty": "検索条件に一致するツールはありません",
"emptyApps": "利用できる CLI App はありません。", "emptyApps": "利用できるツールはありません",
"emptyIntegrations": "利用できる MCP ツールはありません。", "emptyIntegrations": "利用できる MCP ツールはありません",
"emptyReady": "使用可能なツールはまだありません。", "emptyReady": "使用可能なツールはまだありません",
"clearSearch": "検索をクリア", "clearSearch": "検索をクリア",
"browseApps": "CLI Apps を見る", "emptyIntegrationsHint": "下からカスタム MCP サーバーを追加できます",
"browseIntegrations": "MCP ツールを見る",
"emptyIntegrationsHint": "下からカスタム MCP サーバーを追加できます。",
"restartRequired": "更新したアプリと MCP ツールを反映するには nanobot を再起動してください。", "restartRequired": "更新したアプリと MCP ツールを反映するには nanobot を再起動してください。",
"emptyPlugins": "Agent プラグインはインストールされていません。", "emptyPlugins": "Agent プラグインはインストールされていません",
"emptyPluginsHint": "ワークスペースの plugins ディレクトリにプラグインを追加すると、ここで有効にできます。", "emptyPluginsHint": "ワークスペースの plugins ディレクトリにプラグインを追加すると、ここで有効にできます",
"pluginPermissions": "宣言された権限", "pluginPermissions": "宣言された権限",
"pluginServers": "MCP サーバー", "pluginServers": "MCP サーバー",
"pluginTrustNotice": "プラグインは nanobot の OS 権限で実行されます。宣言された権限によってサンドボックス化されるわけではありません。", "pluginTrustNotice": "プラグインは nanobot の OS 権限で実行されます。宣言された権限によってサンドボックス化されるわけではありません。",
@@ -1321,7 +1319,7 @@
"configuredInstances": "{{count}} 個のインスタンスを設定済み", "configuredInstances": "{{count}} 個のインスタンスを設定済み",
"connectPreview": "次の手順でブラウザー内接続を行います。今は下のコマンドを実行してください。", "connectPreview": "次の手順でブラウザー内接続を行います。今は下のコマンドを実行してください。",
"copyCommand": "コマンドをコピー", "copyCommand": "コマンドをコピー",
"filterAll": "すべて", "enabledOnly": "有効のみ",
"filterOff": "停止中", "filterOff": "停止中",
"filterOn": "実行中", "filterOn": "実行中",
"helperCopied": "{{name}} をコピーしました。", "helperCopied": "{{name}} をコピーしました。",
@@ -1625,7 +1623,7 @@
"description": "チャットで使えるスキルを選びます。", "description": "チャットで使えるスキルを選びます。",
"views": "スキル表示", "views": "スキル表示",
"installedTab": "インストール済み", "installedTab": "インストール済み",
"discoverTab": "見つける", "discoverTab": "スキルマーケット",
"customGroup": "カスタム", "customGroup": "カスタム",
"builtinGroup": "組み込み", "builtinGroup": "組み込み",
"otherGroup": "その他", "otherGroup": "その他",
@@ -1662,7 +1660,6 @@
"marketplaceSearchFailed": "スキルマーケットを検索できませんでした。", "marketplaceSearchFailed": "スキルマーケットを検索できませんでした。",
"marketplaceInstallFailed": "このスキルをインストールできませんでした。", "marketplaceInstallFailed": "このスキルをインストールできませんでした。",
"marketplaceSearchPlaceholder": "スキルを検索", "marketplaceSearchPlaceholder": "スキルを検索",
"marketplaceSearchLabel": "スキルを検索",
"marketplaceSearching": "検索中", "marketplaceSearching": "検索中",
"marketplaceProviderFilter": "スキルの提供元", "marketplaceProviderFilter": "スキルの提供元",
"marketplaceProviderAll": "すべて", "marketplaceProviderAll": "すべて",
+14 -17
View File
@@ -454,10 +454,7 @@
"ariaLabel": "언어 변경" "ariaLabel": "언어 변경"
}, },
"apps": "앱", "apps": "앱",
"automations": "자동화", "automations": "자동화"
"skills": {
"title": "스킬"
}
}, },
"settings": { "settings": {
"timezoneNoMatches": "일치하는 시간대가 없습니다.", "timezoneNoMatches": "일치하는 시간대가 없습니다.",
@@ -1256,12 +1253,15 @@
"thirdPartyBrands": "제품 이름, 로고 및 브랜드는 각 소유자의 자산입니다. 사용은 식별 목적일 뿐 보증이나 제휴를 의미하지 않습니다." "thirdPartyBrands": "제품 이름, 로고 및 브랜드는 각 소유자의 자산입니다. 사용은 식별 목적일 뿐 보증이나 제휴를 의미하지 않습니다."
}, },
"apps": { "apps": {
"allTypes": "전체",
"typeFilter": "도구 유형",
"statusFilter": "상태",
"description": "CLI Apps, Agent Plugins 및 MCP 도구를 관리합니다.", "description": "CLI Apps, Agent Plugins 및 MCP 도구를 관리합니다.",
"cliLabel": "CLI App", "cliLabel": "CLI App",
"mcpLabel": "MCP", "mcpLabel": "MCP",
"channelLabel": "채널", "channelLabel": "채널",
"featureLabel": "기능", "featureLabel": "기능",
"filterAll": "사용 가능", "readyOnly": "사용 가능만",
"filterPlugins": "Agent 플러그인", "filterPlugins": "Agent 플러그인",
"filterCli": "CLI Apps", "filterCli": "CLI Apps",
"filterMcp": "MCP", "filterMcp": "MCP",
@@ -1270,17 +1270,15 @@
"featured": "도구", "featured": "도구",
"mcpTools": "MCP 도구", "mcpTools": "MCP 도구",
"loading": "앱을 불러오는 중...", "loading": "앱을 불러오는 중...",
"empty": "검색과 일치하는 도구가 없습니다.", "empty": "검색과 일치하는 도구가 없습니다",
"emptyApps": "사용 가능한 CLI App이 없습니다.", "emptyApps": "사용 가능한 도구가 없습니다",
"emptyIntegrations": "사용 가능한 MCP 도구가 없습니다.", "emptyIntegrations": "사용 가능한 MCP 도구가 없습니다",
"emptyReady": "아직 준비된 도구가 없습니다.", "emptyReady": "아직 준비된 도구가 없습니다",
"clearSearch": "검색 지우기", "clearSearch": "검색 지우기",
"browseApps": "CLI Apps 둘러보기", "emptyIntegrationsHint": "아래에서 사용자 지정 MCP 서버를 추가하세요",
"browseIntegrations": "MCP 도구 둘러보기",
"emptyIntegrationsHint": "아래에서 사용자 지정 MCP 서버를 추가하세요.",
"restartRequired": "업데이트된 앱과 MCP 도구를 적용하려면 nanobot을 다시 시작하세요.", "restartRequired": "업데이트된 앱과 MCP 도구를 적용하려면 nanobot을 다시 시작하세요.",
"emptyPlugins": "설치된 Agent 플러그인이 없습니다.", "emptyPlugins": "설치된 Agent 플러그인이 없습니다",
"emptyPluginsHint": "워크스페이스의 plugins 디렉터리에 플러그인을 추가하면 여기에서 활성화할 수 있습니다.", "emptyPluginsHint": "워크스페이스의 plugins 디렉터리에 플러그인을 추가하면 여기에서 활성화할 수 있습니다",
"pluginPermissions": "선언된 권한", "pluginPermissions": "선언된 권한",
"pluginServers": "MCP 서버", "pluginServers": "MCP 서버",
"pluginTrustNotice": "플러그인은 nanobot의 운영체제 권한으로 실행됩니다. 선언된 권한은 플러그인을 격리하지 않습니다.", "pluginTrustNotice": "플러그인은 nanobot의 운영체제 권한으로 실행됩니다. 선언된 권한은 플러그인을 격리하지 않습니다.",
@@ -1321,7 +1319,7 @@
"configuredInstances": "인스턴스 {{count}}개 설정됨", "configuredInstances": "인스턴스 {{count}}개 설정됨",
"connectPreview": "다음 단계에서 브라우저 내 연결을 진행합니다. 지금은 아래 명령을 실행하세요.", "connectPreview": "다음 단계에서 브라우저 내 연결을 진행합니다. 지금은 아래 명령을 실행하세요.",
"copyCommand": "명령 복사", "copyCommand": "명령 복사",
"filterAll": "전체", "enabledOnly": "활성화된 항목만",
"filterOff": "중지됨", "filterOff": "중지됨",
"filterOn": "실행 중", "filterOn": "실행 중",
"helperCopied": "{{name}}을(를) 복사했습니다.", "helperCopied": "{{name}}을(를) 복사했습니다.",
@@ -1625,7 +1623,7 @@
"description": "채팅에서 사용할 스킬을 선택하세요.", "description": "채팅에서 사용할 스킬을 선택하세요.",
"views": "스킬 보기", "views": "스킬 보기",
"installedTab": "설치됨", "installedTab": "설치됨",
"discoverTab": "탐색", "discoverTab": "스킬 마켓",
"customGroup": "사용자 지정", "customGroup": "사용자 지정",
"builtinGroup": "기본 제공", "builtinGroup": "기본 제공",
"otherGroup": "기타", "otherGroup": "기타",
@@ -1662,7 +1660,6 @@
"marketplaceSearchFailed": "스킬 마켓을 검색할 수 없습니다.", "marketplaceSearchFailed": "스킬 마켓을 검색할 수 없습니다.",
"marketplaceInstallFailed": "이 스킬을 설치할 수 없습니다.", "marketplaceInstallFailed": "이 스킬을 설치할 수 없습니다.",
"marketplaceSearchPlaceholder": "스킬 검색", "marketplaceSearchPlaceholder": "스킬 검색",
"marketplaceSearchLabel": "스킬 검색",
"marketplaceSearching": "검색 중", "marketplaceSearching": "검색 중",
"marketplaceProviderFilter": "스킬 출처", "marketplaceProviderFilter": "스킬 출처",
"marketplaceProviderAll": "전체", "marketplaceProviderAll": "전체",
+14 -17
View File
@@ -454,10 +454,7 @@
"ariaLabel": "Trocar idioma" "ariaLabel": "Trocar idioma"
}, },
"apps": "Aplicativos", "apps": "Aplicativos",
"automations": "Automações", "automations": "Automações"
"skills": {
"title": "Habilidades"
}
}, },
"settings": { "settings": {
"timezoneNoMatches": "Nenhum fuso horário encontrado.", "timezoneNoMatches": "Nenhum fuso horário encontrado.",
@@ -1258,12 +1255,15 @@
"enable": "Ativar rastreamento" "enable": "Ativar rastreamento"
}, },
"apps": { "apps": {
"allTypes": "Todos",
"typeFilter": "Tipo de ferramenta",
"statusFilter": "Status",
"description": "Gerencie aplicativos CLI, Agent Plugins e ferramentas MCP.", "description": "Gerencie aplicativos CLI, Agent Plugins e ferramentas MCP.",
"cliLabel": "CLI App", "cliLabel": "CLI App",
"mcpLabel": "MCP", "mcpLabel": "MCP",
"channelLabel": "Canal", "channelLabel": "Canal",
"featureLabel": "Recurso", "featureLabel": "Recurso",
"filterAll": "Disponíveis", "readyOnly": "Só disponíveis",
"filterPlugins": "Agent Plugins", "filterPlugins": "Agent Plugins",
"filterCli": "CLI Apps", "filterCli": "CLI Apps",
"filterMcp": "MCP", "filterMcp": "MCP",
@@ -1272,17 +1272,15 @@
"featured": "Ferramentas", "featured": "Ferramentas",
"mcpTools": "Ferramentas MCP", "mcpTools": "Ferramentas MCP",
"loading": "Carregando aplicativos...", "loading": "Carregando aplicativos...",
"empty": "Nenhuma ferramenta corresponde à sua busca.", "empty": "Nenhuma ferramenta corresponde à sua busca",
"emptyApps": "Nenhum aplicativo CLI disponível.", "emptyApps": "Nenhuma ferramenta disponível",
"emptyIntegrations": "Nenhuma ferramenta MCP disponível.", "emptyIntegrations": "Nenhuma ferramenta MCP disponível",
"emptyReady": "Ainda não há ferramentas prontas.", "emptyReady": "Ainda não há ferramentas prontas",
"clearSearch": "Limpar busca", "clearSearch": "Limpar busca",
"browseApps": "Explorar aplicativos CLI", "emptyIntegrationsHint": "Adicione um servidor MCP personalizado abaixo",
"browseIntegrations": "Explorar ferramentas MCP",
"emptyIntegrationsHint": "Adicione um servidor MCP personalizado abaixo.",
"restartRequired": "Reinicie o nanobot para aplicar os aplicativos e ferramentas MCP atualizados.", "restartRequired": "Reinicie o nanobot para aplicar os aplicativos e ferramentas MCP atualizados.",
"emptyPlugins": "Nenhum Agent Plugin instalado.", "emptyPlugins": "Nenhum Agent Plugin instalado",
"emptyPluginsHint": "Adicione um plugin ao diretório plugins do espaço de trabalho para ativá-lo aqui.", "emptyPluginsHint": "Adicione um plugin ao diretório plugins do espaço de trabalho para ativá-lo aqui",
"pluginPermissions": "Permissões declaradas", "pluginPermissions": "Permissões declaradas",
"pluginServers": "Servidores MCP", "pluginServers": "Servidores MCP",
"pluginTrustNotice": "Os plugins são executados com as permissões de sistema do nanobot. As permissões declaradas não os isolam.", "pluginTrustNotice": "Os plugins são executados com as permissões de sistema do nanobot. As permissões declaradas não os isolam.",
@@ -1323,7 +1321,7 @@
"configuredInstances": "{{count}} instâncias configuradas", "configuredInstances": "{{count}} instâncias configuradas",
"connectPreview": "A próxima etapa é a conexão no navegador. Por enquanto, execute o comando abaixo.", "connectPreview": "A próxima etapa é a conexão no navegador. Por enquanto, execute o comando abaixo.",
"copyCommand": "Copiar comando", "copyCommand": "Copiar comando",
"filterAll": "Todos", "enabledOnly": "Só ativados",
"filterOff": "Parados", "filterOff": "Parados",
"filterOn": "Em execução", "filterOn": "Em execução",
"helperCopied": "{{name}} copiado.", "helperCopied": "{{name}} copiado.",
@@ -1627,7 +1625,7 @@
"description": "Escolha as habilidades disponíveis nas conversas.", "description": "Escolha as habilidades disponíveis nas conversas.",
"views": "Visualizações de habilidades", "views": "Visualizações de habilidades",
"installedTab": "Instaladas", "installedTab": "Instaladas",
"discoverTab": "Descobrir", "discoverTab": "Mercado de habilidades",
"customGroup": "Personalizadas", "customGroup": "Personalizadas",
"builtinGroup": "Integradas", "builtinGroup": "Integradas",
"otherGroup": "Outras", "otherGroup": "Outras",
@@ -1664,7 +1662,6 @@
"marketplaceSearchFailed": "Não foi possível pesquisar nos mercados de habilidades.", "marketplaceSearchFailed": "Não foi possível pesquisar nos mercados de habilidades.",
"marketplaceInstallFailed": "Não foi possível instalar esta habilidade.", "marketplaceInstallFailed": "Não foi possível instalar esta habilidade.",
"marketplaceSearchPlaceholder": "Pesquisar habilidades", "marketplaceSearchPlaceholder": "Pesquisar habilidades",
"marketplaceSearchLabel": "Pesquisar habilidades",
"marketplaceSearching": "Pesquisando", "marketplaceSearching": "Pesquisando",
"marketplaceProviderFilter": "Origem da habilidade", "marketplaceProviderFilter": "Origem da habilidade",
"marketplaceProviderAll": "Todas", "marketplaceProviderAll": "Todas",
+14 -17
View File
@@ -454,10 +454,7 @@
"ariaLabel": "Đổi ngôn ngữ" "ariaLabel": "Đổi ngôn ngữ"
}, },
"apps": "Ứng dụng", "apps": "Ứng dụng",
"automations": "Tự động hóa", "automations": "Tự động hóa"
"skills": {
"title": "Kỹ năng"
}
}, },
"settings": { "settings": {
"timezoneNoMatches": "Không tìm thấy múi giờ phù hợp.", "timezoneNoMatches": "Không tìm thấy múi giờ phù hợp.",
@@ -1256,12 +1253,15 @@
"thirdPartyBrands": "Tên sản phẩm, logo và thương hiệu thuộc về chủ sở hữu tương ứng. Việc sử dụng chỉ nhằm nhận diện và không ngụ ý được xác nhận." "thirdPartyBrands": "Tên sản phẩm, logo và thương hiệu thuộc về chủ sở hữu tương ứng. Việc sử dụng chỉ nhằm nhận diện và không ngụ ý được xác nhận."
}, },
"apps": { "apps": {
"allTypes": "Tất cả",
"typeFilter": "Loại công cụ",
"statusFilter": "Trạng thái",
"description": "Quản lý CLI Apps, Agent Plugins và công cụ MCP.", "description": "Quản lý CLI Apps, Agent Plugins và công cụ MCP.",
"cliLabel": "CLI App", "cliLabel": "CLI App",
"mcpLabel": "MCP", "mcpLabel": "MCP",
"channelLabel": "Kênh", "channelLabel": "Kênh",
"featureLabel": "Tính năng", "featureLabel": "Tính năng",
"filterAll": "Sẵn sàng", "readyOnly": "Chỉ mục sẵn sàng",
"filterPlugins": "Agent Plugins", "filterPlugins": "Agent Plugins",
"filterCli": "CLI Apps", "filterCli": "CLI Apps",
"filterMcp": "MCP", "filterMcp": "MCP",
@@ -1270,17 +1270,15 @@
"featured": "Công cụ", "featured": "Công cụ",
"mcpTools": "Công cụ MCP", "mcpTools": "Công cụ MCP",
"loading": "Đang tải ứng dụng...", "loading": "Đang tải ứng dụng...",
"empty": "Không có công cụ phù hợp với tìm kiếm của bạn.", "empty": "Không có công cụ phù hợp với tìm kiếm của bạn",
"emptyApps": "Không có CLI App nào.", "emptyApps": "Không có công cụ nào",
"emptyIntegrations": "Không có công cụ MCP nào.", "emptyIntegrations": "Không có công cụ MCP nào",
"emptyReady": "Chưa có công cụ nào sẵn sàng.", "emptyReady": "Chưa có công cụ nào sẵn sàng",
"clearSearch": "Xóa tìm kiếm", "clearSearch": "Xóa tìm kiếm",
"browseApps": "Xem CLI Apps", "emptyIntegrationsHint": "Thêm máy chủ MCP tùy chỉnh ở bên dưới",
"browseIntegrations": "Xem công cụ MCP",
"emptyIntegrationsHint": "Thêm máy chủ MCP tùy chỉnh ở bên dưới.",
"restartRequired": "Khởi động lại nanobot để áp dụng ứng dụng và công cụ MCP đã cập nhật.", "restartRequired": "Khởi động lại nanobot để áp dụng ứng dụng và công cụ MCP đã cập nhật.",
"emptyPlugins": "Chưa cài đặt Agent Plugin nào.", "emptyPlugins": "Chưa cài đặt Agent Plugin nào",
"emptyPluginsHint": "Thêm plugin vào thư mục plugins của không gian làm việc để bật tại đây.", "emptyPluginsHint": "Thêm plugin vào thư mục plugins của không gian làm việc để bật tại đây",
"pluginPermissions": "Quyền đã khai báo", "pluginPermissions": "Quyền đã khai báo",
"pluginServers": "Máy chủ MCP", "pluginServers": "Máy chủ MCP",
"pluginTrustNotice": "Plugin chạy với quyền hệ điều hành của nanobot. Các quyền đã khai báo không cô lập plugin.", "pluginTrustNotice": "Plugin chạy với quyền hệ điều hành của nanobot. Các quyền đã khai báo không cô lập plugin.",
@@ -1321,7 +1319,7 @@
"configuredInstances": "Đã thiết lập {{count}} cấu hình kênh", "configuredInstances": "Đã thiết lập {{count}} cấu hình kênh",
"connectPreview": "Bước tiếp theo là kết nối trong trình duyệt. Hiện tại, hãy chạy lệnh bên dưới.", "connectPreview": "Bước tiếp theo là kết nối trong trình duyệt. Hiện tại, hãy chạy lệnh bên dưới.",
"copyCommand": "Sao chép lệnh", "copyCommand": "Sao chép lệnh",
"filterAll": "Tất cả", "enabledOnly": "Chỉ mục đã bật",
"filterOff": "Đã dừng", "filterOff": "Đã dừng",
"filterOn": "Đang chạy", "filterOn": "Đang chạy",
"helperCopied": "Đã sao chép {{name}}.", "helperCopied": "Đã sao chép {{name}}.",
@@ -1625,7 +1623,7 @@
"description": "Chọn kỹ năng có thể dùng trong trò chuyện.", "description": "Chọn kỹ năng có thể dùng trong trò chuyện.",
"views": "Chế độ xem kỹ năng", "views": "Chế độ xem kỹ năng",
"installedTab": "Đã cài đặt", "installedTab": "Đã cài đặt",
"discoverTab": "Khám phá", "discoverTab": "Chợ kỹ năng",
"customGroup": "Tùy chỉnh", "customGroup": "Tùy chỉnh",
"builtinGroup": "Tích hợp sẵn", "builtinGroup": "Tích hợp sẵn",
"otherGroup": "Khác", "otherGroup": "Khác",
@@ -1662,7 +1660,6 @@
"marketplaceSearchFailed": "Không thể tìm kiếm trong các kho kỹ năng.", "marketplaceSearchFailed": "Không thể tìm kiếm trong các kho kỹ năng.",
"marketplaceInstallFailed": "Không thể cài đặt kỹ năng này.", "marketplaceInstallFailed": "Không thể cài đặt kỹ năng này.",
"marketplaceSearchPlaceholder": "Tìm kiếm kỹ năng", "marketplaceSearchPlaceholder": "Tìm kiếm kỹ năng",
"marketplaceSearchLabel": "Tìm kiếm kỹ năng",
"marketplaceSearching": "Đang tìm kiếm", "marketplaceSearching": "Đang tìm kiếm",
"marketplaceProviderFilter": "Nguồn kỹ năng", "marketplaceProviderFilter": "Nguồn kỹ năng",
"marketplaceProviderAll": "Tất cả", "marketplaceProviderAll": "Tất cả",
+15 -18
View File
@@ -454,10 +454,7 @@
"ariaLabel": "切换语言" "ariaLabel": "切换语言"
}, },
"apps": "应用", "apps": "应用",
"automations": "自动任务", "automations": "任务"
"skills": {
"title": "技能"
}
}, },
"settings": { "settings": {
"timezoneNoMatches": "没有匹配的时区。", "timezoneNoMatches": "没有匹配的时区。",
@@ -822,7 +819,7 @@
"runtime": "系统", "runtime": "系统",
"advanced": "高级", "advanced": "高级",
"apps": "应用", "apps": "应用",
"automations": "自动任务", "automations": "任务",
"skills": "技能", "skills": "技能",
"memory": "记忆" "memory": "记忆"
}, },
@@ -1438,12 +1435,15 @@
"enable": "启用追踪" "enable": "启用追踪"
}, },
"apps": { "apps": {
"allTypes": "全部",
"typeFilter": "工具类型",
"statusFilter": "状态",
"description": "管理 CLI Apps、Agent Plugins 和 MCP 工具。", "description": "管理 CLI Apps、Agent Plugins 和 MCP 工具。",
"cliLabel": "CLI App", "cliLabel": "CLI App",
"mcpLabel": "MCP", "mcpLabel": "MCP",
"channelLabel": "聊天平台", "channelLabel": "聊天平台",
"featureLabel": "功能", "featureLabel": "功能",
"filterAll": "已就绪", "readyOnly": "仅显示就绪",
"filterPlugins": "Agent 插件", "filterPlugins": "Agent 插件",
"filterCli": "CLI Apps", "filterCli": "CLI Apps",
"filterMcp": "MCP", "filterMcp": "MCP",
@@ -1452,17 +1452,15 @@
"featured": "工具", "featured": "工具",
"mcpTools": "MCP 工具", "mcpTools": "MCP 工具",
"loading": "正在加载应用...", "loading": "正在加载应用...",
"empty": "没有与搜索条件匹配的工具。", "empty": "没有与搜索条件匹配的工具",
"emptyApps": "暂无可用的 CLI App。", "emptyApps": "暂无可用的工具",
"emptyIntegrations": "暂无可用 MCP 工具。", "emptyIntegrations": "暂无可用 MCP 工具",
"emptyReady": "还没有就绪的工具。", "emptyReady": "还没有就绪的工具",
"clearSearch": "清除搜索", "clearSearch": "清除搜索",
"browseApps": "浏览 CLI Apps", "emptyIntegrationsHint": "可在下方添加自定义 MCP 服务器",
"browseIntegrations": "浏览 MCP 工具",
"emptyIntegrationsHint": "可在下方添加自定义 MCP 服务器。",
"restartRequired": "重启 nanobot 以应用更新后的应用和 MCP 工具。", "restartRequired": "重启 nanobot 以应用更新后的应用和 MCP 工具。",
"emptyPlugins": "尚未安装 Agent 插件。", "emptyPlugins": "尚未安装 Agent 插件",
"emptyPluginsHint": "将插件添加到工作区的 plugins 目录,即可在此启用。", "emptyPluginsHint": "将插件添加到工作区的 plugins 目录,即可在此启用",
"pluginPermissions": "声明的权限", "pluginPermissions": "声明的权限",
"pluginServers": "MCP 服务器", "pluginServers": "MCP 服务器",
"pluginTrustNotice": "插件以 nanobot 的操作系统权限运行;声明的权限不会隔离插件。", "pluginTrustNotice": "插件以 nanobot 的操作系统权限运行;声明的权限不会隔离插件。",
@@ -1503,7 +1501,7 @@
"configuredInstances": "已配置 {{count}} 个实例", "configuredInstances": "已配置 {{count}} 个实例",
"connectPreview": "请先在终端运行下方命令,完成连接。", "connectPreview": "请先在终端运行下方命令,完成连接。",
"copyCommand": "复制命令", "copyCommand": "复制命令",
"filterAll": "全部", "enabledOnly": "仅显示已启用",
"filterOff": "未运行", "filterOff": "未运行",
"filterOn": "运行中", "filterOn": "运行中",
"helperCopied": "已复制 {{name}}。", "helperCopied": "已复制 {{name}}。",
@@ -1807,7 +1805,7 @@
"description": "选择对话中可用的技能", "description": "选择对话中可用的技能",
"views": "技能视图", "views": "技能视图",
"installedTab": "已安装", "installedTab": "已安装",
"discoverTab": "发现", "discoverTab": "技能市场",
"customGroup": "自定义", "customGroup": "自定义",
"builtinGroup": "内置", "builtinGroup": "内置",
"otherGroup": "其他", "otherGroup": "其他",
@@ -1844,7 +1842,6 @@
"marketplaceSearchFailed": "暂时无法搜索技能市场。", "marketplaceSearchFailed": "暂时无法搜索技能市场。",
"marketplaceInstallFailed": "无法安装此技能。", "marketplaceInstallFailed": "无法安装此技能。",
"marketplaceSearchPlaceholder": "搜索技能", "marketplaceSearchPlaceholder": "搜索技能",
"marketplaceSearchLabel": "搜索技能",
"marketplaceSearching": "正在搜索", "marketplaceSearching": "正在搜索",
"marketplaceProviderFilter": "技能来源", "marketplaceProviderFilter": "技能来源",
"marketplaceProviderAll": "全部", "marketplaceProviderAll": "全部",
+15 -18
View File
@@ -454,10 +454,7 @@
"ariaLabel": "切換語言" "ariaLabel": "切換語言"
}, },
"apps": "應用程式", "apps": "應用程式",
"automations": "自動任務", "automations": "任務"
"skills": {
"title": "技能"
}
}, },
"settings": { "settings": {
"timezoneNoMatches": "沒有符合的時區。", "timezoneNoMatches": "沒有符合的時區。",
@@ -643,7 +640,7 @@
"cliApps": "CLI 應用", "cliApps": "CLI 應用",
"mcp": "MCP", "mcp": "MCP",
"apps": "應用程式", "apps": "應用程式",
"automations": "自動任務", "automations": "任務",
"skills": "技能" "skills": "技能"
}, },
"sections": { "sections": {
@@ -1256,12 +1253,15 @@
"thirdPartyBrands": "產品名稱、Logo 與品牌均為各自擁有者的財產。僅供識別之用,不代表任何形式的背書。" "thirdPartyBrands": "產品名稱、Logo 與品牌均為各自擁有者的財產。僅供識別之用,不代表任何形式的背書。"
}, },
"apps": { "apps": {
"allTypes": "全部",
"typeFilter": "工具類型",
"statusFilter": "狀態",
"description": "管理 CLI Apps、Agent Plugins 和 MCP 工具。", "description": "管理 CLI Apps、Agent Plugins 和 MCP 工具。",
"cliLabel": "CLI App", "cliLabel": "CLI App",
"mcpLabel": "MCP", "mcpLabel": "MCP",
"channelLabel": "通訊管道", "channelLabel": "通訊管道",
"featureLabel": "功能", "featureLabel": "功能",
"filterAll": "就緒", "readyOnly": "僅顯示就緒",
"filterPlugins": "Agent 外掛", "filterPlugins": "Agent 外掛",
"filterCli": "CLI Apps", "filterCli": "CLI Apps",
"filterMcp": "MCP", "filterMcp": "MCP",
@@ -1270,17 +1270,15 @@
"featured": "工具", "featured": "工具",
"mcpTools": "MCP 工具", "mcpTools": "MCP 工具",
"loading": "正在載入應用程式…", "loading": "正在載入應用程式…",
"empty": "沒有符合搜尋條件的工具。", "empty": "沒有符合搜尋條件的工具",
"emptyApps": "沒有可用的 CLI App。", "emptyApps": "沒有可用的工具",
"emptyIntegrations": "沒有可用的 MCP 工具。", "emptyIntegrations": "沒有可用的 MCP 工具",
"emptyReady": "尚無就緒的工具。", "emptyReady": "尚無就緒的工具",
"clearSearch": "清除搜尋", "clearSearch": "清除搜尋",
"browseApps": "瀏覽 CLI Apps", "emptyIntegrationsHint": "可在下方新增自訂 MCP 伺服器",
"browseIntegrations": "瀏覽 MCP 工具",
"emptyIntegrationsHint": "可在下方新增自訂 MCP 伺服器。",
"restartRequired": "重新啟動 nanobot 以套用更新後的應用程式與 MCP 工具。", "restartRequired": "重新啟動 nanobot 以套用更新後的應用程式與 MCP 工具。",
"emptyPlugins": "尚未安裝 Agent 外掛。", "emptyPlugins": "尚未安裝 Agent 外掛",
"emptyPluginsHint": "將外掛新增至工作區的 plugins 目錄,即可在此啟用。", "emptyPluginsHint": "將外掛新增至工作區的 plugins 目錄,即可在此啟用",
"pluginPermissions": "宣告的權限", "pluginPermissions": "宣告的權限",
"pluginServers": "MCP 伺服器", "pluginServers": "MCP 伺服器",
"pluginTrustNotice": "外掛以 nanobot 的作業系統權限執行;宣告的權限不會隔離外掛。", "pluginTrustNotice": "外掛以 nanobot 的作業系統權限執行;宣告的權限不會隔離外掛。",
@@ -1321,7 +1319,7 @@
"configuredInstances": "已設定 {{count}} 個執行個體", "configuredInstances": "已設定 {{count}} 個執行個體",
"connectPreview": "請先在終端機執行下方指令,完成連線。", "connectPreview": "請先在終端機執行下方指令,完成連線。",
"copyCommand": "複製指令", "copyCommand": "複製指令",
"filterAll": "全部", "enabledOnly": "僅顯示已啟用",
"filterOff": "未執行", "filterOff": "未執行",
"filterOn": "執行中", "filterOn": "執行中",
"helperCopied": "已複製 {{name}}。", "helperCopied": "已複製 {{name}}。",
@@ -1625,7 +1623,7 @@
"description": "選擇對話中可用的技能", "description": "選擇對話中可用的技能",
"views": "技能檢視", "views": "技能檢視",
"installedTab": "已安裝", "installedTab": "已安裝",
"discoverTab": "探索", "discoverTab": "技能市集",
"customGroup": "自訂", "customGroup": "自訂",
"builtinGroup": "內建", "builtinGroup": "內建",
"otherGroup": "其他", "otherGroup": "其他",
@@ -1662,7 +1660,6 @@
"marketplaceSearchFailed": "暫時無法搜尋技能市集。", "marketplaceSearchFailed": "暫時無法搜尋技能市集。",
"marketplaceInstallFailed": "無法安裝此技能。", "marketplaceInstallFailed": "無法安裝此技能。",
"marketplaceSearchPlaceholder": "搜尋技能", "marketplaceSearchPlaceholder": "搜尋技能",
"marketplaceSearchLabel": "搜尋技能",
"marketplaceSearching": "正在搜尋", "marketplaceSearching": "正在搜尋",
"marketplaceProviderFilter": "技能來源", "marketplaceProviderFilter": "技能來源",
"marketplaceProviderAll": "全部", "marketplaceProviderAll": "全部",
+1 -3
View File
@@ -2,9 +2,7 @@ const SIDEBAR_SHORTCUTS = {
newChat: { key: "O", shift: true }, newChat: { key: "O", shift: true },
search: { key: "K", shift: false }, search: { key: "K", shift: false },
apps: { key: "1", shift: true }, apps: { key: "1", shift: true },
skills: { key: "2", shift: true }, automations: { key: "2", shift: true },
automations: { key: "3", shift: true },
channels: { key: "4", shift: true },
settings: { key: ",", shift: false }, settings: { key: ",", shift: false },
} as const; } as const;
+163 -88
View File
@@ -652,7 +652,11 @@ describe("App layout", () => {
expect(main).not.toHaveAttribute("style"); expect(main).not.toHaveAttribute("style");
expect(screen.getByTestId("sidebar-brand-row")).toHaveClass("pt-3"); expect(screen.getByTestId("sidebar-brand-row")).toHaveClass("pt-3");
expect(screen.getByTestId("sidebar-brand-mark")).not.toHaveClass("mt-5"); expect(screen.getByTestId("sidebar-brand-mark")).not.toHaveClass("mt-5");
expect(screen.getByRole("separator", { name: "Resize sidebar" })).toHaveAttribute("aria-valuenow", "272"); const resizeHandle = screen.getByRole("separator", { name: "Resize sidebar" });
expect(resizeHandle).toHaveAttribute("aria-valuenow", "56");
fireEvent.keyDown(resizeHandle, { key: "Enter" });
expect(resizeHandle).toHaveAttribute("aria-valuenow", "272");
expect(main).not.toHaveAttribute("style");
const asideClassNames = Array.from(container.querySelectorAll("aside")).map( const asideClassNames = Array.from(container.querySelectorAll("aside")).map(
(el) => el.className, (el) => el.className,
@@ -729,44 +733,67 @@ describe("App layout", () => {
expect(screen.queryByRole("dialog", { name: "Choose model" })).not.toBeInTheDocument(); expect(screen.queryByRole("dialog", { name: "Choose model" })).not.toBeInTheDocument();
}); });
it("places Automations after Skills in the main sidebar", async () => { it("opens the Apps catalog from the sidebar's bottom navigation", async () => {
mockSessions = [{ key: "websocket:chat-a", channel: "websocket", chatId: "chat-a", createdAt: null, updatedAt: null, preview: "First chat" }];
mockFetchRoutes({
"/api/settings": baseSettingsPayload(),
"/api/settings/cli-apps": { apps: [], installed_count: 0 },
"/api/settings/mcp-presets": { presets: [], installed_count: 0 },
"/api/remote-instances": { available: true, profiles: [] },
});
render(<App />); render(<App />);
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" }); const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
const appsButton = within(sidebar).getByRole("button", { name: "Apps" }); const footer = within(sidebar).getByTestId("sidebar-footer");
const skillsButton = within(sidebar).getByRole("button", { name: "Skills" }); await within(footer).findByRole("button", { name: "Switch host" });
const automationsButton = within(sidebar).getByRole("button", { name: "Automations" }); const buttons = within(footer).getAllByRole("button");
expect(buttons.map((button) => button.getAttribute("aria-label")))
expect(appsButton.compareDocumentPosition(skillsButton) & Node.DOCUMENT_POSITION_FOLLOWING) .toEqual(["Apps", "Automations", "Settings", "Switch host"]);
.toBeTruthy(); expect(buttons.slice(0, 3).map((button) => button.textContent)).toEqual(["Apps", "Automations", "Settings"]);
expect( fireEvent.click(within(footer).getByRole("button", { name: "Apps" }));
skillsButton.compareDocumentPosition(automationsButton) & await act(async () => { await import("@/components/settings/SettingsView"); });
Node.DOCUMENT_POSITION_FOLLOWING, const sections = await screen.findByRole("group", { name: "Apps" });
).toBeTruthy(); expect(within(sections).getAllByRole("button").map((button) => button.textContent)).toEqual(["Tools", "Skills", "Channels"]);
expect(within(sections).getByRole("button", { name: "Tools" })).toHaveAttribute("aria-pressed", "true");
}); });
it("opens Channels below Automations and supports its keyboard shortcut", async () => { it("keeps focus and independent searches when navigating among Apps sections", async () => {
mockFetchRoutes({ mockFetchRoutes({
"/api/settings": baseSettingsPayload(), "/api/settings": baseSettingsPayload(),
"/api/settings/cli-apps": { apps: [], installed_count: 0 },
"/api/settings/mcp-presets": { presets: [], installed_count: 0 },
"/api/settings/nanobot-features": { features: [], enabled_count: 0 }, "/api/settings/nanobot-features": { features: [], enabled_count: 0 },
}); });
render(<App />); render(<App />);
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" }); const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
const channels = within(sidebar).getByRole("button", { name: "Channels" }); const apps = within(sidebar).getByRole("button", { name: "Apps" });
expect(within(sidebar).getByRole("button", { name: "Automations" }) fireEvent.click(apps);
.compareDocumentPosition(channels) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); await act(async () => { await import("@/components/settings/SettingsView"); });
fireEvent.click(channels); await screen.findByRole("button", { name: "Tools", pressed: true });
expect(await screen.findByRole("heading", { name: "Channels" })).toBeVisible(); const search = screen.getByLabelText("Search tools");
expect(window.location.hash).toBe("#/channels"); fireEvent.change(search, { target: { value: "mcp" } });
expect(channels).toHaveAttribute("aria-current", "page"); fireEvent.click(screen.getByRole("button", { name: "Channels" }));
expect(document.title).toBe("Channels"); expect(await screen.findByRole("searchbox", { name: "Search channels" })).toBe(search);
fireEvent.click(within(sidebar).getByRole("button", { name: "New topic" })); expect(search).toHaveValue("");
await waitFor(() => expect(window.location.hash).toBe("#/new")); expect(window.location.hash).toBe("#/apps?section=channels");
fireEvent.keyDown(window, { key: "$", code: "Digit4", ctrlKey: true, shiftKey: true }); expect(apps).toHaveAttribute("aria-current", "page");
expect(await screen.findByRole("heading", { name: "Channels" })).toBeVisible(); expect(document.title).toBe("Apps");
expect(window.location.hash).toBe("#/channels"); fireEvent.change(search, { target: { value: "telegram" } });
search.focus();
act(() => {
window.history.replaceState(window.history.state, "", "#/apps?section=skills");
window.dispatchEvent(new PopStateEvent("popstate"));
});
expect(await screen.findByLabelText("Search installed skills")).toBe(search);
expect(search).toHaveFocus();
expect(search).toHaveValue("");
fireEvent.click(screen.getByRole("button", { name: "Channels" }));
expect(await screen.findByRole("searchbox", { name: "Search channels" })).toHaveValue("telegram");
fireEvent.click(screen.getByRole("button", { name: "Tools" }));
expect(await screen.findByLabelText("Search tools")).toHaveValue("mcp");
}); });
it("opens management in the main content area while keeping the standalone deep link", async () => { it("opens management in the main content area while keeping the standalone deep link", async () => {
@@ -838,7 +865,7 @@ describe("App layout", () => {
}); });
render(<App />); render(<App />);
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
await user.click(await screen.findByRole("button", { name: "Toggle sidebar" })); await user.click(await within(screen.getByRole("main")).findByRole("button", { name: "Toggle sidebar" }));
const sheet = await screen.findByRole("dialog"); const sheet = await screen.findByRole("dialog");
fireEvent.pointerDown(await within(sheet).findByRole("button", { name: "Switch host" }), { button: 0, ctrlKey: false }); fireEvent.pointerDown(await within(sheet).findByRole("button", { name: "Switch host" }), { button: 0, ctrlKey: false });
fireEvent.click(await screen.findByRole("menuitem", { name: "Manage connections" })); fireEvent.click(await screen.findByRole("menuitem", { name: "Manage connections" }));
@@ -869,7 +896,8 @@ describe("App layout", () => {
"/api/remote-instances": { available: true, profiles: [profile] }, "/api/remote-instances": { available: true, profiles: [profile] },
}); });
render(<App />); render(<App />);
await user.click(await screen.findByRole("button", { name: "Toggle sidebar" })); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
await user.click(await within(screen.getByRole("main")).findByRole("button", { name: "Toggle sidebar" }));
const sheet = await screen.findByRole("dialog"); const sheet = await screen.findByRole("dialog");
await user.click(await within(sheet).findByRole("button", { name: "Switch host" })); await user.click(await within(sheet).findByRole("button", { name: "Switch host" }));
await user.click(await screen.findByRole("menuitem", { name: "Team server team" })); await user.click(await screen.findByRole("menuitem", { name: "Team server team" }));
@@ -895,16 +923,26 @@ describe("App layout", () => {
expect(window.location.hash).toBe("#/remote"); expect(window.location.hash).toBe("#/remote");
}); });
it("highlights the blank new-topic destination immediately", async () => { it("keeps the compose action in place and hands off keyboard focus between sidebar toggles", async () => {
const user = userEvent.setup();
render(<App />); render(<App />);
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); const sidebar = within(await screen.findByRole("navigation", { name: "Sidebar navigation" }));
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" }); const compose = sidebar.getByRole("button", { name: "New topic" });
const newTopicButton = within(sidebar).getByRole("button", { name: "New topic" }); expect(compose).not.toHaveAttribute("aria-current");
expect(compose.querySelector("svg")).toHaveAttribute("data-product-icon", "compose");
expect(newTopicButton).toHaveAttribute("aria-current", "page"); const expand = sidebar.getByRole("button", { name: "Toggle sidebar", expanded: false });
expect(newTopicButton).toHaveClass("transition-[width,padding,color,background-color]"); expand.focus();
expect(newTopicButton).toBeEnabled(); await user.keyboard("{Enter}");
const collapse = sidebar.getByRole("button", { name: "Collapse sidebar", expanded: true });
expect(collapse).toHaveFocus();
expect(sidebar.getByRole("button", { name: "New topic" })).toBe(compose);
expect(compose).toHaveTextContent("New topic");
await user.keyboard(" ");
expect(expand).toHaveFocus();
expect(expand).toHaveAttribute("aria-expanded", "false");
}); });
it("keeps a just-created topic route while the session list catches up", async () => { it("keeps a just-created topic route while the session list catches up", async () => {
@@ -1325,9 +1363,10 @@ describe("App layout", () => {
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
expect( expect(
await screen.findByRole("heading", { name: "Channels" }), await screen.findByRole("heading", { name: "Apps" }),
).toBeInTheDocument(); ).toBeInTheDocument();
expect(within(screen.getByRole("navigation", { name: "Sidebar navigation" })).getByRole("button", { name: "Channels" })).toHaveAttribute("aria-current", "page"); expect(screen.getByRole("button", { name: "Channels" })).toHaveAttribute("aria-pressed", "true");
expect(within(screen.getByRole("navigation", { name: "Sidebar navigation" })).getByRole("button", { name: "Apps" })).toHaveAttribute("aria-current", "page");
expect(window.location.hash).toBe("#/settings?section=channels"); expect(window.location.hash).toBe("#/settings?section=channels");
}); });
@@ -1497,11 +1536,10 @@ describe("App layout", () => {
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" }); const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
const skillsButton = within(sidebar).getByRole("button", { name: "Skills" }); fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" }));
fireEvent.click(await screen.findByRole("button", { name: "Skills" }));
fireEvent.click(skillsButton); expect(await screen.findByRole("button", { name: "Skills" })).toHaveAttribute("aria-pressed", "true");
expect(await screen.findByRole("heading", { name: "Skills" })).toBeInTheDocument();
expect(screen.getByRole("textbox", { name: "Search installed skills" })).toBeInTheDocument(); expect(screen.getByRole("textbox", { name: "Search installed skills" })).toBeInTheDocument();
expect(screen.getByRole("heading", { name: "Custom" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Custom" })).toBeInTheDocument();
expect(screen.getByRole("heading", { name: "Built-in" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Built-in" })).toBeInTheDocument();
@@ -1510,17 +1548,18 @@ describe("App layout", () => {
expect(screen.getByText("Needs setup")).toBeInTheDocument(); expect(screen.getByText("Needs setup")).toBeInTheDocument();
expect(screen.getByRole("navigation", { name: "Sidebar navigation" })).toBeInTheDocument(); expect(screen.getByRole("navigation", { name: "Sidebar navigation" })).toBeInTheDocument();
expect(screen.queryByRole("navigation", { name: "Settings sections" })).not.toBeInTheDocument(); expect(screen.queryByRole("navigation", { name: "Settings sections" })).not.toBeInTheDocument();
expect(within(sidebar).getByRole("button", { name: "Skills" })).toHaveAttribute( expect(within(sidebar).getByRole("button", { name: "Apps" })).toHaveAttribute(
"aria-current", "aria-current",
"page", "page",
); );
expect(document.title).toBe("Skills"); expect(document.title).toBe("Apps");
fireEvent.click(screen.getByRole("button", { name: "Back to chat" })); fireEvent.click(screen.getByRole("button", { name: "Back to chat" }));
expect(await screen.findByTestId("thread-welcome-mark")).toBeInTheDocument(); expect(await screen.findByTestId("thread-welcome-mark")).toBeInTheDocument();
fireEvent.click(within(sidebar).getByRole("button", { name: "Skills" })); fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" }));
expect(await screen.findByRole("heading", { name: "Skills" })).toBeInTheDocument(); fireEvent.click(await screen.findByRole("button", { name: "Skills" }));
expect(await screen.findByRole("button", { name: "Skills" })).toHaveAttribute("aria-pressed", "true");
fireEvent.click(screen.getByRole("button", { name: "Open details for github" })); fireEvent.click(screen.getByRole("button", { name: "Open details for github" }));
@@ -1592,7 +1631,8 @@ describe("App layout", () => {
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" }); const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
fireEvent.click(within(sidebar).getByRole("button", { name: "Skills" })); fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" }));
fireEvent.click(await screen.findByRole("button", { name: "Skills" }));
fireEvent.click( fireEvent.click(
await screen.findByRole("button", { name: "Open details for custom-skill" }), await screen.findByRole("button", { name: "Open details for custom-skill" }),
); );
@@ -1724,10 +1764,13 @@ describe("App layout", () => {
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" }); const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
fireEvent.click(within(sidebar).getByRole("button", { name: "Skills" })); fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" }));
const discoverTab = await screen.findByRole("tab", { name: "Discover" }); fireEvent.click(await screen.findByRole("button", { name: "Skills" }));
expect(discoverTab.querySelector("svg")).toBeNull(); const selectView = async (view: string) => {
fireEvent.click(discoverTab); const views = await screen.findByRole("radiogroup", { name: "Skills views" });
await userEvent.click(within(views).getByRole("radio", { name: view }));
};
await selectView("Marketplace");
expect( expect(
await screen.findByRole("heading", { name: "Popular skills" }), await screen.findByRole("heading", { name: "Popular skills" }),
).toBeInTheDocument(); ).toBeInTheDocument();
@@ -1736,11 +1779,12 @@ describe("App layout", () => {
expect(screen.getByRole("link", { name: "Open ima-skills on SkillHub" })).toHaveAttribute( expect(screen.getByRole("link", { name: "Open ima-skills on SkillHub" })).toHaveAttribute(
"href", "https://skillhub.cn/skills/tencent-adm/ima-skills", "href", "https://skillhub.cn/skills/tencent-adm/ima-skills",
); );
expect(screen.getAllByText("SkillHub")).toHaveLength(2); expect(screen.getByRole("link", { name: "Open SkillHub" })).toBeInTheDocument();
expect(screen.getAllByText("skills.sh")).toHaveLength(2); expect(screen.getByRole("link", { name: "Open skills.sh" })).toBeInTheDocument();
expect(screen.getByText(/14,481 installs \/ 24h/)).toBeInTheDocument(); expect(screen.getByText(/14,481 installs \/ 24h/)).toBeInTheDocument();
expect(screen.queryByText(/11,831 installs/)).not.toBeInTheDocument(); expect(screen.queryByText(/11,831 installs/)).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("tab", { name: "SkillHub" })); const sources = within(screen.getByRole("radiogroup", { name: "Skill source" }));
fireEvent.click(sources.getByRole("radio", { name: "SkillHub" }));
expect(screen.getByText("ima-skills")).toBeInTheDocument(); expect(screen.getByText("ima-skills")).toBeInTheDocument();
expect(screen.queryByText("find-skills")).not.toBeInTheDocument(); expect(screen.queryByText("find-skills")).not.toBeInTheDocument();
expect( expect(
@@ -1749,7 +1793,7 @@ describe("App layout", () => {
String(input) === "/api/webui/skills/trending?provider=skillhub", String(input) === "/api/webui/skills/trending?provider=skillhub",
), ),
).toBe(false); ).toBe(false);
fireEvent.click(screen.getByRole("tab", { name: "All" })); fireEvent.click(sources.getByRole("radio", { name: "All" }));
expect(screen.getByText("find-skills")).toBeInTheDocument(); expect(screen.getByText("find-skills")).toBeInTheDocument();
expect(screen.getByText("ima-skills")).toBeInTheDocument(); expect(screen.getByText("ima-skills")).toBeInTheDocument();
expect( expect(
@@ -1780,8 +1824,10 @@ describe("App layout", () => {
150_000, 150_000,
); );
}); });
fireEvent.click(screen.getByRole("tab", { name: "Installed" })); await selectView("Installed");
fireEvent.click(screen.getByRole("tab", { name: "Discover" })); await selectView("Marketplace");
expect(screen.getByRole("textbox", { name: "Search skills" })).toHaveValue("React");
fireEvent.change(screen.getByRole("textbox", { name: "Search skills" }), { target: { value: "" } });
expect( expect(
await screen.findByRole("button", { name: "Install find-skills" }), await screen.findByRole("button", { name: "Install find-skills" }),
).toBeDisabled(); ).toBeDisabled();
@@ -1794,7 +1840,7 @@ describe("App layout", () => {
await waitFor(() => { await waitFor(() => {
expect(screen.getByRole("button", { name: "Install find-skills" })).toBeEnabled(); expect(screen.getByRole("button", { name: "Install find-skills" })).toBeEnabled();
}); });
fireEvent.click(screen.getByRole("tab", { name: "Installed" })); await selectView("Installed");
expect(screen.getByText("react-testing")).toBeInTheDocument(); expect(screen.getByText("react-testing")).toBeInTheDocument();
}); });
@@ -2184,9 +2230,9 @@ describe("App layout", () => {
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
const sidebar = screen.getByRole("navigation", { name: "侧边栏导航" }); const sidebar = screen.getByRole("navigation", { name: "侧边栏导航" });
fireEvent.click(within(sidebar).getByRole("button", { name: "自动任务" })); fireEvent.click(within(sidebar).getByRole("button", { name: "任务" }));
const heading = await screen.findByRole("heading", { name: "自动任务" }); const heading = await screen.findByRole("heading", { name: "任务" });
expect(heading).toBeInTheDocument(); expect(heading).toBeInTheDocument();
const automationsMain = heading.closest("main"); const automationsMain = heading.closest("main");
expect(automationsMain).not.toBeNull(); expect(automationsMain).not.toBeNull();
@@ -2204,10 +2250,29 @@ describe("App layout", () => {
expect(screen.queryByText("近期无问题")).not.toBeInTheDocument(); expect(screen.queryByText("近期无问题")).not.toBeInTheDocument();
expect(screen.queryByText("Workspace automations")).not.toBeInTheDocument(); expect(screen.queryByText("Workspace automations")).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: "刷新" })).not.toBeInTheDocument(); expect(screen.queryByRole("button", { name: "刷新" })).not.toBeInTheDocument();
expect(document.title).toBe("自动任务"); expect(document.title).toBe("任务");
});
it("collapses an empty sidebar, then restores the saved width when the first chat is created", async () => {
localStorage.setItem("nanobot-webui.sidebar", "1");
localStorage.setItem("nanobot-webui.sidebar.width", "320");
render(<App />);
const sidebar = await screen.findByTestId("host-sidebar-flow");
expect(sidebar).toHaveStyle({ width: "56px" });
fireEvent.click(within(sidebar).getByRole("button", { name: "Toggle sidebar" }));
expect(sidebar).toHaveStyle({ width: "320px" });
fireEvent.keyDown(within(sidebar).getByRole("separator"), { key: "Enter" });
expect(sidebar).toHaveStyle({ width: "56px" });
const composer = await screen.findByLabelText("Message input");
fireEvent.change(composer, { target: { value: "First message" } });
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
await waitFor(() => expect(sidebar).toHaveStyle({ width: "320px" }));
}); });
it("resizes the sidebar, collapses at the drag threshold and restores its saved width", async () => { it("resizes the sidebar, collapses at the drag threshold and restores its saved width", async () => {
mockSessions = [{ key: "websocket:chat-a", channel: "websocket", chatId: "chat-a", createdAt: null, updatedAt: null, preview: "First chat" }];
const view = render(<App />); const view = render(<App />);
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
const handle = screen.getByRole("separator", { name: "Resize sidebar" }); const handle = screen.getByRole("separator", { name: "Resize sidebar" });
@@ -2251,7 +2316,7 @@ describe("App layout", () => {
const sidebar = screen.getByTestId("host-sidebar-flow"); const sidebar = screen.getByTestId("host-sidebar-flow");
await within(sidebar).findByTestId("chats-selection-highlight"); await within(sidebar).findByTestId("chats-selection-highlight");
const handle = within(sidebar).getByRole("separator", { name: "Resize sidebar" }); const handle = within(sidebar).getByRole("separator", { name: "Resize sidebar" });
for (const label of ["Apps", "Skills", "Automations", "Channels"]) { for (const label of ["Apps", "Automations"]) {
expect(within(sidebar).getByRole("button", { name: label })).toHaveClass( expect(within(sidebar).getByRole("button", { name: label })).toHaveClass(
"group-data-[resizing=true]/sidebar:transition-none", "group-data-[resizing=true]/sidebar:transition-none",
); );
@@ -2269,7 +2334,7 @@ describe("App layout", () => {
expect(sidebar).toHaveStyle({ width: "400px" }); expect(sidebar).toHaveStyle({ width: "400px" });
fireEvent[finish](handle, { pointerId: 1, clientX: 400 }); fireEvent[finish](handle, { pointerId: 1, clientX: 400 });
expect(sidebar).not.toHaveAttribute("data-resizing"); expect(sidebar).not.toHaveAttribute("data-resizing");
expect(sidebar).toHaveClass("transition-[width]"); expect(sidebar).not.toHaveAttribute("data-collapsed");
}); });
it("uses the shared sidebar controls and rail on the native host", async () => { it("uses the shared sidebar controls and rail on the native host", async () => {
@@ -2415,6 +2480,11 @@ describe("App layout", () => {
); );
expect(screen.queryByText("Delete this topic?")).not.toBeInTheDocument(); expect(screen.queryByText("Delete this topic?")).not.toBeInTheDocument();
expect(document.body.style.pointerEvents).not.toBe("none"); expect(document.body.style.pointerEvents).not.toBe("none");
fireEvent.pointerDown(screen.getByLabelText("Topic actions for Second chat"), { button: 0 });
fireEvent.click(await screen.findByRole("menuitem", { name: "Delete" }));
fireEvent.click(within(await screen.findByRole("alertdialog")).getByRole("button", { name: "Delete" }));
await waitFor(() => expect(screen.getByTestId("host-sidebar-flow")).toHaveStyle({ width: "56px" }));
}, 15_000); }, 15_000);
it.each([false, true])("archives only persisted selected topics in one sidebar update (draft=%s)", async (includeDraft) => { it.each([false, true])("archives only persisted selected topics in one sidebar update (draft=%s)", async (includeDraft) => {
@@ -3416,7 +3486,7 @@ describe("App layout", () => {
await waitFor(() => expect(requestMutationSpy).toHaveBeenCalledWith( await waitFor(() => expect(requestMutationSpy).toHaveBeenCalledWith(
"settings.channel.configure", expect.objectContaining({ name: "email", values: { "channels.email.imapHost": "imap.changed.test" } }), 150_000, "settings.channel.configure", expect.objectContaining({ name: "email", values: { "channels.email.imapHost": "imap.changed.test" } }), 150_000,
)); ));
expect(window.location.hash).toBe("#/channels"); expect(window.location.hash).toBe("#/apps?section=channels");
expect(host).toHaveValue("imap.changed.test"); expect(host).toHaveValue("imap.changed.test");
await act(async () => { await act(async () => {
if (saved) resolveSave({ name: "email", saved: true, saved_keys: ["channels.email.imapHost"] }); if (saved) resolveSave({ name: "email", saved: true, saved_keys: ["channels.email.imapHost"] });
@@ -3426,7 +3496,7 @@ describe("App layout", () => {
await waitFor(() => expect(window.location.hash).toBe("#/new")); await waitFor(() => expect(window.location.hash).toBe("#/new"));
expect(screen.queryByRole("dialog")).not.toBeInTheDocument(); expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
} else { } else {
expect(window.location.hash).toBe("#/channels"); expect(window.location.hash).toBe("#/apps?section=channels");
expect(host).toHaveValue("imap.changed.test"); expect(host).toHaveValue("imap.changed.test");
expect(await screen.findByText("Save failed")).toBeVisible(); expect(await screen.findByText("Save failed")).toBeVisible();
} }
@@ -3533,7 +3603,7 @@ describe("App layout", () => {
expect(settingsHighlight).toHaveAttribute("data-active-id", "capabilities"); expect(settingsHighlight).toHaveAttribute("data-active-id", "capabilities");
}); });
it("defaults to Ready again when returning to Apps from another sidebar page", async () => { it("defaults to Ready again when returning to Tools from another Apps tab", async () => {
const app = { const app = {
name: "example", display_name: "Example App", category: "productivity", description: "Example", name: "example", display_name: "Example App", category: "productivity", description: "Example",
requires: "", source: "catalog", entry_point: "example", install_supported: true, requires: "", source: "catalog", entry_point: "example", install_supported: true,
@@ -3551,16 +3621,18 @@ describe("App layout", () => {
fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" })); fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" }));
await act(async () => { await import("@/components/settings/SettingsView"); }); await act(async () => { await import("@/components/settings/SettingsView"); });
expect(await screen.findByRole("heading", { name: "Example App" })).toBeInTheDocument(); expect(await screen.findByRole("heading", { name: "Example App" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Ready" })).toHaveAttribute("aria-pressed", "true"); expect(screen.getByRole("switch", { name: "Ready only" })).toBeChecked();
fireEvent.click(screen.getByRole("button", { name: "MCP" })); const types = within(screen.getByRole("radiogroup", { name: "Tool type" }));
fireEvent.click(within(sidebar).getByRole("button", { name: "Skills" })); await userEvent.click(types.getByRole("radio", { name: "MCP" }));
expect(await screen.findByRole("heading", { name: "Skills" })).toBeInTheDocument(); expect(types.getByRole("radio", { name: "MCP" })).toBeChecked();
fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" })); fireEvent.click(screen.getByRole("button", { name: "Skills" }));
expect(screen.getByRole("button", { name: "Skills" })).toHaveAttribute("aria-pressed", "true");
fireEvent.click(screen.getByRole("button", { name: "Tools" }));
expect(await screen.findByRole("heading", { name: "Example App" })).toBeInTheDocument(); expect(await screen.findByRole("heading", { name: "Example App" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Ready" })).toHaveAttribute("aria-pressed", "true"); expect(screen.getByRole("switch", { name: "Ready only" })).toBeChecked();
}); });
it("transitions between Apps and Skills without replacing the sidebar", async () => { it("switches Apps tabs without replacing their navigation or the sidebar", async () => {
mockFetchRoutes({ mockFetchRoutes({
"/api/settings": baseSettingsPayload(), "/api/settings": baseSettingsPayload(),
"/api/settings/cli-apps": { apps: [], installed_count: 0, catalog_updated_at: "2026-04-18" }, "/api/settings/cli-apps": { apps: [], installed_count: 0, catalog_updated_at: "2026-04-18" },
@@ -3601,10 +3673,13 @@ describe("App layout", () => {
"motion-reduce:animate-none", "motion-reduce:animate-none",
); );
expect(document.title).toBe("Apps"); expect(document.title).toBe("Apps");
const sections = screen.getByRole("group", { name: "Apps" });
fireEvent.click(within(sections).getByRole("button", { name: "Skills" }));
fireEvent.click(within(sidebar).getByRole("button", { name: "Skills" })); expect(screen.getByRole("group", { name: "Apps" })).toBe(sections);
expect(within(sections).getByRole("button", { name: "Skills" })).toHaveAttribute("aria-pressed", "true");
expect(await screen.findByRole("heading", { name: "Skills" })).toBeInTheDocument(); expect(window.location.hash).toBe("#/apps?section=skills");
expect(screen.getByRole("textbox", { name: "Search installed skills" })).toBeVisible();
await waitFor(() => { await waitFor(() => {
expect(screen.getByTestId("settings-section-transition")).toHaveAttribute( expect(screen.getByTestId("settings-section-transition")).toHaveAttribute(
"data-settings-section", "data-settings-section",
@@ -3612,15 +3687,15 @@ describe("App layout", () => {
); );
}); });
expect(screen.getByRole("navigation", { name: "Sidebar navigation" })).toBeInTheDocument(); expect(screen.getByRole("navigation", { name: "Sidebar navigation" })).toBeInTheDocument();
expect(within(sidebar).getByRole("button", { name: "Skills" })).toHaveAttribute( expect(within(sidebar).getByRole("button", { name: "Apps" })).toHaveAttribute(
"aria-current", "aria-current",
"page", "page",
); );
expect(within(sidebar).getByTestId("actions-selection-highlight")).toHaveAttribute( expect(within(sidebar).getByTestId("actions-selection-highlight")).toHaveAttribute(
"data-active-id", "data-active-id",
"utility:skills", "utility:apps",
); );
expect(document.title).toBe("Skills"); expect(document.title).toBe("Apps");
}); });
it("returns from settings to the blank start page when no session was active", async () => { it("returns from settings to the blank start page when no session was active", async () => {
@@ -3796,7 +3871,7 @@ describe("App layout", () => {
const newChatButton = within(sidebar).getByRole("button", { name: "New topic" }); const newChatButton = within(sidebar).getByRole("button", { name: "New topic" });
const searchButton = within(sidebar).getByRole("button", { name: "Search" }); const searchButton = within(sidebar).getByRole("button", { name: "Search" });
expect( expect(
searchButton.compareDocumentPosition(newChatButton) & newChatButton.compareDocumentPosition(searchButton) &
Node.DOCUMENT_POSITION_FOLLOWING, Node.DOCUMENT_POSITION_FOLLOWING,
).toBeTruthy(); ).toBeTruthy();
@@ -4404,16 +4479,17 @@ describe("App layout", () => {
}); });
it.each([ it.each([
["apps", "1", "Digit1", true], ["Apps", "#/apps", "!", "Digit1", "Meta+Shift+1 Control+Shift+1"],
["skills", "2", "Digit2", true], ["Automations", "#/automations", "@", "Digit2", "Meta+Shift+2 Control+Shift+2"],
["automations", "3", "Digit3", true], ["Settings", "#/settings", ",", "Comma", "Meta+, Control+,"],
["settings", ",", "Comma", false], ])("opens %s using its sidebar shortcut", async (name, hash, key, code, ariaShortcut) => {
])("opens %s using its sidebar shortcut", async (route, key, code, shiftKey) => {
mockFetchRoutes({ "/api/settings": baseSettingsPayload() }); mockFetchRoutes({ "/api/settings": baseSettingsPayload() });
render(<App />); render(<App />);
await waitFor(() => expect(connectSpy).toHaveBeenCalled()); await waitFor(() => expect(connectSpy).toHaveBeenCalled());
fireEvent.keyDown(window, { key, code, shiftKey, ctrlKey: true }); const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
await waitFor(() => expect(window.location.hash).toContain("#/" + route)); expect(within(sidebar).getByRole("button", { name })).toHaveAttribute("aria-keyshortcuts", ariaShortcut);
fireEvent.keyDown(window, { key, code, shiftKey: code !== "Comma", ctrlKey: true });
await waitFor(() => expect(window.location.hash).toBe(hash));
}); });
it.each([ it.each([
@@ -4472,7 +4548,6 @@ describe("App layout", () => {
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" }); const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
const newChatButton = within(sidebar).getByRole("button", { name: "New topic" }); const newChatButton = within(sidebar).getByRole("button", { name: "New topic" });
expect(newChatButton).toHaveTextContent("");
await userEvent.setup().hover(newChatButton); await userEvent.setup().hover(newChatButton);
const tooltip = await screen.findByRole("tooltip"); const tooltip = await screen.findByRole("tooltip");
expect(tooltip).toHaveTextContent("New topic"); expect(tooltip).toHaveTextContent("New topic");
@@ -4568,7 +4643,7 @@ describe("App layout", () => {
expect(within(rail).getByRole("button", { name: "New topic" })).toBeInTheDocument(); expect(within(rail).getByRole("button", { name: "New topic" })).toBeInTheDocument();
expect(within(rail).getByRole("button", { name: "Search" })).toBeInTheDocument(); expect(within(rail).getByRole("button", { name: "Search" })).toBeInTheDocument();
expect(within(rail).queryByRole("button", { name: "View" })).not.toBeInTheDocument(); expect(within(rail).queryByRole("button", { name: "View" })).not.toBeInTheDocument();
expect(within(rail).queryByText("Existing chat")).not.toBeInTheDocument(); expect(within(rail).queryByRole("button", { name: "Existing chat" })).not.toBeInTheDocument();
fireEvent.click(within(rail).getByRole("button", { name: "Toggle sidebar" })); fireEvent.click(within(rail).getByRole("button", { name: "Toggle sidebar" }));
await waitFor(() => expect(sidebarAside.style.width).toBe("272px")); await waitFor(() => expect(sidebarAside.style.width).toBe("272px"));
+20 -14
View File
@@ -9,6 +9,8 @@ import {
installSettingsViewTestHooks, installSettingsViewTestHooks,
jsonResponse, jsonResponse,
renderSettingsView, renderSettingsView,
selectToolType,
showOnlyReadyTools,
settingsPayload, settingsPayload,
} from "@/tests/settings-test-utils"; } from "@/tests/settings-test-utils";
@@ -57,9 +59,10 @@ describe("catalog loading", () => {
cleanup(); cleanup();
fetch.mockClear(); fetch.mockClear();
renderSettingsView({ client, initialSettings: settingsPayload() }); renderSettingsView({ client, initialSettings: settingsPayload() });
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" })); await selectToolType("CLI Apps");
expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Agent Plugins" })); await selectToolType("Agent Plugins");
await showOnlyReadyTools(false);
expect(screen.getByRole("heading", { name: "Computer Use" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Computer Use" })).toBeInTheDocument();
expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument(); expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
expect(fetch.mock.calls.filter(([url]) => String(url).match(/cli-apps|mcp-presets/))).toHaveLength(0); expect(fetch.mock.calls.filter(([url]) => String(url).match(/cli-apps|mcp-presets/))).toHaveLength(0);
@@ -68,9 +71,10 @@ describe("catalog loading", () => {
const now = vi.spyOn(Date, "now").mockReturnValue(Date.now() + TOOLS_CATALOG_TTL_MS + 1); const now = vi.spyOn(Date, "now").mockReturnValue(Date.now() + TOOLS_CATALOG_TTL_MS + 1);
try { try {
renderSettingsView({ client, initialSettings: settingsPayload() }); renderSettingsView({ client, initialSettings: settingsPayload() });
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" })); await selectToolType("CLI Apps");
expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Agent Plugins" })); await selectToolType("Agent Plugins");
await showOnlyReadyTools(false);
expect(screen.getByRole("heading", { name: "Computer Use" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Computer Use" })).toBeInTheDocument();
expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument(); expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
expect(fetch.mock.calls.filter(([url]) => String(url).match(/cli-apps|mcp-presets/))).toHaveLength(2); expect(fetch.mock.calls.filter(([url]) => String(url).match(/cli-apps|mcp-presets/))).toHaveLength(2);
@@ -79,7 +83,7 @@ describe("catalog loading", () => {
mcp.resolve(jsonResponse({ presets: [{ ...plugin, display_name: "Updated plugin" }], installed_count: 1 })); mcp.resolve(jsonResponse({ presets: [{ ...plugin, display_name: "Updated plugin" }], installed_count: 1 }));
}); });
expect(screen.getByRole("heading", { name: "Updated plugin" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Updated plugin" })).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" })); await selectToolType("CLI Apps");
expect(screen.getByRole("heading", { name: "Updated app" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Updated app" })).toBeInTheDocument();
} finally { } finally {
now.mockRestore(); now.mockRestore();
@@ -139,7 +143,7 @@ describe("catalog loading", () => {
return Promise.resolve(jsonResponse(settingsPayload())); return Promise.resolve(jsonResponse(settingsPayload()));
})); }));
renderSettingsView({ initialSettings: settingsPayload() }); renderSettingsView({ initialSettings: settingsPayload() });
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" })); await selectToolType("CLI Apps");
expect(screen.getByRole("status", { name: "Loading apps…" })).toHaveAttribute("aria-busy", "true"); expect(screen.getByRole("status", { name: "Loading apps…" })).toHaveAttribute("aria-busy", "true");
await act(async () => { cli.resolve(jsonResponse({ apps: [app], installed_count: 1 })); }); await act(async () => { cli.resolve(jsonResponse({ apps: [app], installed_count: 1 })); });
@@ -147,7 +151,8 @@ describe("catalog loading", () => {
expect(screen.getByRole("status", { name: "Loading apps…" })).toBeInTheDocument(); expect(screen.getByRole("status", { name: "Loading apps…" })).toBeInTheDocument();
await act(async () => { mcp.resolve(jsonResponse({ presets: [plugin], installed_count: 1 })); }); await act(async () => { mcp.resolve(jsonResponse({ presets: [plugin], installed_count: 1 })); });
expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Agent Plugins" })); await selectToolType("Agent Plugins");
await showOnlyReadyTools(false);
expect(screen.getByRole("heading", { name: "Computer Use" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Computer Use" })).toBeInTheDocument();
expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument(); expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
}); });
@@ -165,17 +170,18 @@ describe("catalog loading", () => {
renderSettingsView({ initialSettings: settingsPayload() }); renderSettingsView({ initialSettings: settingsPayload() });
await act(async () => {}); await act(async () => {});
expect(screen.getByRole("status", { name: "Loading apps…" })).toBeInTheDocument(); expect(screen.getByRole("status", { name: "Loading apps…" })).toBeInTheDocument();
expect(screen.queryByText("No CLI Apps available.")).not.toBeInTheDocument(); expect(screen.queryByText("No tools available")).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "MCP" })); await selectToolType("MCP");
expect(screen.getByText("No MCP tools available.")).toBeInTheDocument(); await showOnlyReadyTools(false);
expect(screen.getByText("No MCP tools available")).toBeInTheDocument();
expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument(); expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "AnyGen" } }); fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "AnyGen" } });
expect(screen.getByText("No tools match your search.")).toBeInTheDocument(); expect(screen.getByText("No tools match your search")).toBeInTheDocument();
expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument(); expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" })); await selectToolType("CLI Apps");
expect(screen.getByRole("status", { name: "Loading apps…" })).toBeInTheDocument(); expect(screen.getByRole("status", { name: "Loading apps…" })).toBeInTheDocument();
expect(screen.queryByText("No tools match your search.")).not.toBeInTheDocument(); expect(screen.queryByText("No tools match your search")).not.toBeInTheDocument();
await act(async () => { cli.resolve(jsonResponse({ apps: [app], installed_count: 1 })); }); await act(async () => { cli.resolve(jsonResponse({ apps: [app], installed_count: 1 })); });
expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument();
expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument(); expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
@@ -191,7 +197,7 @@ describe("catalog loading", () => {
renderSettingsView({ initialSection: section, initialSettings: settingsPayload() }); renderSettingsView({ initialSection: section, initialSettings: settingsPayload() });
expect(await screen.findByText("Catalog offline")).toBeInTheDocument(); expect(await screen.findByText("Catalog offline")).toBeInTheDocument();
expect(screen.queryByRole("status", { name: /Loading (apps|channels)/ })).not.toBeInTheDocument(); expect(screen.queryByRole("status", { name: /Loading (apps|channels)/ })).not.toBeInTheDocument();
expect(screen.queryByText("No CLI Apps available.")).not.toBeInTheDocument(); expect(screen.queryByText("No tools available")).not.toBeInTheDocument();
expect(screen.queryByText("No channels match this filter.")).not.toBeInTheDocument(); expect(screen.queryByText("No channels match this filter.")).not.toBeInTheDocument();
}); });
+26 -43
View File
@@ -4,7 +4,6 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { channelUiPresentation, registeredChannelUiContributions } from "@/channel-plugins/registry"; import { channelUiPresentation, registeredChannelUiContributions } from "@/channel-plugins/registry";
import { ChannelLogo } from "@/components/settings/channels/ChannelIdentity"; import { ChannelLogo } from "@/components/settings/channels/ChannelIdentity";
import { __clearLogoFallbackCacheForTests } from "@/hooks/useLogoFallback"; import { __clearLogoFallbackCacheForTests } from "@/hooks/useLogoFallback";
import { logoFallbackUrls } from "@/lib/provider-brand";
import type { NanobotFeatureInfo } from "@/lib/types"; import type { NanobotFeatureInfo } from "@/lib/types";
function feature(name: string): NanobotFeatureInfo { function feature(name: string): NanobotFeatureInfo {
@@ -31,11 +30,11 @@ describe("channel logos", () => {
beforeEach(__clearLogoFallbackCacheForTests); beforeEach(__clearLogoFallbackCacheForTests);
afterEach(cleanup); afterEach(cleanup);
const remoteChannels = registeredChannelUiContributions() const channelsWithBrandMarks = registeredChannelUiContributions()
.filter(({ contribution }) => contribution.presentation.logoUrl) .filter(({ contribution }) => contribution.presentation.logoUrl)
.map(({ channel }) => channel); .map(({ channel }) => channel);
it.each(remoteChannels)("keeps %s in one stable tile while loading", (channel) => { it.each(channelsWithBrandMarks)("loads the bundled %s mark in one stable tile", (channel) => {
const { container } = render(<ChannelLogo feature={feature(channel)} showBrandLogos />); const { container } = render(<ChannelLogo feature={feature(channel)} showBrandLogos />);
const icon = container.firstElementChild!; const icon = container.firstElementChild!;
const image = icon.querySelector("img")!; const image = icon.querySelector("img")!;
@@ -45,6 +44,7 @@ describe("channel logos", () => {
expectFootprint(icon); expectFootprint(icon);
expect(icon).toHaveClass("bg-muted"); expect(icon).toHaveClass("bg-muted");
expect(fallback).toHaveClass("opacity-100"); expect(fallback).toHaveClass("opacity-100");
expect(presentation.logoUrl).toMatch(/^\/brand\//);
expect(image).toHaveAttribute("src", presentation.logoUrl); expect(image).toHaveAttribute("src", presentation.logoUrl);
expect(image).toHaveAttribute("alt", ""); expect(image).toHaveAttribute("alt", "");
expect(image).toHaveAttribute("referrerpolicy", "no-referrer"); expect(image).toHaveAttribute("referrerpolicy", "no-referrer");
@@ -58,54 +58,47 @@ describe("channel logos", () => {
for (const className of ["invert", "grayscale", "object-cover"]) { for (const className of ["invert", "grayscale", "object-cover"]) {
expect(image).not.toHaveClass(className); expect(image).not.toHaveClass(className);
} }
expect(icon).toHaveClass(presentation.logoLayout === "tile" ? "bg-transparent" : "bg-white"); expect(icon).toHaveClass("bg-white");
expect(image).toHaveClass(...(presentation.logoLayout === "tile" ? ["h-8", "w-8"] : ["h-6", "w-6"])); expect(image).toHaveClass("h-6", "w-6");
}); });
it.each(["linear", "feishu", "lark"])("insets unknown %s fallback assets instead of stretching them", (channel) => { it.each(["dingtalk", "feishu", "lark", "mochat", "msteams", "napcat", "slack", "wecom"])(
const { container } = render(<ChannelLogo feature={feature(channel)} showBrandLogos />); "shows %s initials without an external image when there is no bundled mark",
(channel) => {
const { container } = render(<ChannelLogo feature={feature(channel)} showBrandLogos />);
const icon = container.firstElementChild!;
expectFootprint(icon);
expect(icon).toHaveTextContent(channelUiPresentation(channel)!.initials!);
expect(icon.querySelector("img")).toBeNull();
},
);
it("keeps QQ readable when its bundled SVG fails, without requesting another image", () => {
const { container } = render(<ChannelLogo feature={feature("qq")} showBrandLogos />);
const icon = container.firstElementChild!; const icon = container.firstElementChild!;
const image = icon.querySelector("img")!; const image = icon.querySelector("img")!;
fireEvent.load(image); expect(image).toHaveAttribute("src", "/brand/channels/qq.svg");
expect(icon).toHaveClass("bg-transparent");
expect(image).toHaveClass("h-8", "w-8");
fireEvent.error(image); fireEvent.error(image);
expect(icon).toHaveClass("bg-muted"); expect(container.firstElementChild).toBe(icon);
expect(image).toHaveClass("h-6", "w-6", "opacity-0");
fireEvent.load(image);
expect(icon).toHaveClass("bg-white");
expectFootprint(icon); expectFootprint(icon);
}); expect(icon).toHaveClass("bg-muted");
expect(icon.querySelector("span")).toHaveClass("opacity-100");
it("falls back to initials after all remote sources fail without changing size", () => { expect(icon).toHaveTextContent("QQ");
const { container } = render(<ChannelLogo feature={feature("slack")} showBrandLogos />);
const icon = container.firstElementChild!;
for (const url of logoFallbackUrls(channelUiPresentation("slack")!.logoUrl)) {
const image = icon.querySelector("img")!;
expect(image).toHaveAttribute("src", url);
fireEvent.error(image);
expect(container.firstElementChild).toBe(icon);
expectFootprint(icon);
expect(icon).toHaveClass("bg-muted");
expect(icon.querySelector("span")).toHaveClass("opacity-100");
}
expect(icon.querySelector("img")).toBeNull(); expect(icon.querySelector("img")).toBeNull();
expect(icon).toHaveTextContent(channelUiPresentation("slack")!.initials!);
}); });
it("respects the brand logo preference even for cached images", () => { it("respects the brand logo preference even for cached images", () => {
const { container, rerender } = render(<ChannelLogo feature={feature("slack")} showBrandLogos />); const { container, rerender } = render(<ChannelLogo feature={feature("linear")} showBrandLogos />);
const icon = container.firstElementChild!; const icon = container.firstElementChild!;
fireEvent.load(icon.querySelector("img")!); fireEvent.load(icon.querySelector("img")!);
rerender(<ChannelLogo feature={feature("slack")} showBrandLogos={false} />); rerender(<ChannelLogo feature={feature("linear")} showBrandLogos={false} />);
expectFootprint(icon); expectFootprint(icon);
expect(icon.querySelector("img")).toBeNull(); expect(icon.querySelector("img")).toBeNull();
expect(icon).toHaveClass("bg-muted"); expect(icon).toHaveClass("bg-muted");
expect(icon.querySelector("span")).toHaveClass("opacity-100"); expect(icon.querySelector("span")).toHaveClass("opacity-100");
rerender(<ChannelLogo feature={feature("slack")} showBrandLogos />); rerender(<ChannelLogo feature={feature("linear")} showBrandLogos />);
expect(icon.querySelector("img")).toHaveClass("opacity-100"); expect(icon.querySelector("img")).toHaveClass("opacity-100");
expect(icon).toHaveClass("bg-white"); expect(icon).toHaveClass("bg-white");
}); });
@@ -118,16 +111,6 @@ describe("channel logos", () => {
expect(channelUiPresentation("email")?.logoUrl).toBeUndefined(); expect(channelUiPresentation("email")?.logoUrl).toBeUndefined();
}); });
it("falls back to QQ's official favicon rather than its CDN's identity", () => {
const { container } = render(<ChannelLogo feature={feature("qq")} showBrandLogos />);
const image = container.querySelector("img")!;
expect(image).toHaveAttribute("src", channelUiPresentation("qq")!.logoUrl);
fireEvent.error(image);
expect(image).toHaveAttribute("src", "https://im.qq.com/favicon.ico");
fireEvent.load(image);
expect(container.firstElementChild).toHaveClass("bg-white");
});
it("keeps the local nanobot mark and unknown channel initials readable", () => { it("keeps the local nanobot mark and unknown channel initials readable", () => {
const { container, rerender } = render(<ChannelLogo feature={feature("websocket")} showBrandLogos />); const { container, rerender } = render(<ChannelLogo feature={feature("websocket")} showBrandLogos />);
expectFootprint(container.firstElementChild!); expectFootprint(container.firstElementChild!);
+2 -1
View File
@@ -146,7 +146,8 @@ it("switches the chat list preview between ready, loading, empty and archived st
await setMode("loading"); await setMode("loading");
expect(preview.getByText("Loading…")).toBeVisible(); expect(preview.getByText("Loading…")).toBeVisible();
await setMode("empty"); await setMode("empty");
expect(preview.getByText("No sessions yet.")).toBeVisible(); expect(preview.getByRole("combobox", { name: "Chat list state" })).toHaveTextContent("empty");
expect(preview.queryByText("Loading…")).not.toBeInTheDocument();
await setMode("archived"); await setMode("archived");
const archived = within(preview.getByRole("region", { name: "Archived" })); const archived = within(preview.getByRole("region", { name: "Archived" }));
expect(archived.getByRole("button", { name: "@history 历史方案" })).toBeVisible(); expect(archived.getByRole("button", { name: "@history 历史方案" })).toBeVisible();
+2 -3
View File
@@ -126,7 +126,6 @@ const LOCALIZED_SETTINGS_COPY_KEYS = [
"settings.skills.marketplaceSearchFailed", "settings.skills.marketplaceSearchFailed",
"settings.skills.marketplaceInstallFailed", "settings.skills.marketplaceInstallFailed",
"settings.skills.marketplaceSearchPlaceholder", "settings.skills.marketplaceSearchPlaceholder",
"settings.skills.marketplaceSearchLabel",
"settings.skills.marketplaceSearching", "settings.skills.marketplaceSearching",
"settings.skills.marketplaceProviderFilter", "settings.skills.marketplaceProviderFilter",
"settings.skills.marketplaceProviderAll", "settings.skills.marketplaceProviderAll",
@@ -248,7 +247,7 @@ const LOCALIZED_CHANNEL_SHELL_KEYS = [
"settings.channels.configuredInstances", "settings.channels.configuredInstances",
"settings.channels.connectPreview", "settings.channels.connectPreview",
"settings.channels.copyCommand", "settings.channels.copyCommand",
"settings.channels.filterAll", "settings.channels.enabledOnly",
"settings.channels.filterOff", "settings.channels.filterOff",
"settings.channels.filterOn", "settings.channels.filterOn",
"settings.channels.helperCopied", "settings.channels.helperCopied",
@@ -696,7 +695,7 @@ describe("webui i18n", () => {
expect(settings.overview.webSearch).toBe("网络搜索"); expect(settings.overview.webSearch).toBe("网络搜索");
expect(settings.overview.workspace).toBe("工作目录"); expect(settings.overview.workspace).toBe("工作目录");
expect(settings.skills.installedTab).toBe("已安装"); expect(settings.skills.installedTab).toBe("已安装");
expect(settings.skills.discoverTab).toBe("发现"); expect(settings.skills.discoverTab).toBe("技能市场");
expect(settings.skills.marketplaceProviderFilter).toBe("技能来源"); expect(settings.skills.marketplaceProviderFilter).toBe("技能来源");
expect(settings.skills.marketplaceProviderAll).toBe("全部"); expect(settings.skills.marketplaceProviderAll).toBe("全部");
expect(settings.skills.marketplaceSearchPlaceholder).toBe("搜索技能"); expect(settings.skills.marketplaceSearchPlaceholder).toBe("搜索技能");
@@ -16,6 +16,8 @@ import {
installSettingsViewTestHooks, installSettingsViewTestHooks,
jsonResponse, jsonResponse,
renderSettingsView, renderSettingsView,
selectToolType,
showOnlyReadyTools,
requestMutationMock, requestMutationMock,
settingsPayload, settingsPayload,
} from "@/tests/settings-test-utils"; } from "@/tests/settings-test-utils";
@@ -272,7 +274,8 @@ describe("MCP connection draft lifecycle", () => {
return { ok: false, status: 404, text: async () => "Not found" } as Response; return { ok: false, status: 404, text: async () => "Not found" } as Response;
})); }));
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
fireEvent.click(await screen.findByRole("button", { name: "Metabase" })); fireEvent.click(await screen.findByRole("button", { name: "Metabase" }));
const dialog = await screen.findByRole("dialog", { name: "Metabase" }); const dialog = await screen.findByRole("dialog", { name: "Metabase" });
expect(within(dialog).getByRole("tab", { name: "Overview" })).toHaveAttribute("aria-selected", "true"); expect(within(dialog).getByRole("tab", { name: "Overview" })).toHaveAttribute("aria-selected", "true");
@@ -349,7 +352,8 @@ describe("MCP connection draft lifecycle", () => {
}); });
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
fireEvent.click(await screen.findByRole("button", { name: "Connect Xmind" })); fireEvent.click(await screen.findByRole("button", { name: "Connect Xmind" }));
fireEvent.click(screen.getByRole("switch", { name: "Use proxy" })); fireEvent.click(screen.getByRole("switch", { name: "Use proxy" }));
fireEvent.click(screen.getByRole("button", { name: "Connect" })); fireEvent.click(screen.getByRole("button", { name: "Connect" }));
+2 -2
View File
@@ -44,11 +44,11 @@ function LocalShell({ collapsed = false, initialRemote = false }) {
return () => window.removeEventListener("hashchange", route); return () => window.removeEventListener("hashchange", route);
}, []); }, []);
return <> return <>
<Sidebar collapsed={collapsed} sessions={[]} activeKey={null} loading={false} newChatActive={false} <Sidebar collapsed={collapsed} sessions={[]} activeKey={null} loading={false}
onNewChat={() => { if (connections?.managing) connections.selectLocal(); window.location.hash = "/new"; setRemotePage(false); }} onSelect={noop} onRequestDelete={noop} onTogglePin={noop} onNewChat={() => { if (connections?.managing) connections.selectLocal(); window.location.hash = "/new"; setRemotePage(false); }} onSelect={noop} onRequestDelete={noop} onTogglePin={noop}
onRequestRename={async () => {}} onToggleArchive={noop} onToggleGroup={noop} onRequestRename={async () => {}} onToggleArchive={noop} onToggleGroup={noop}
onRequestRenameProject={noop} onNewChatInProject={noop} onOpenSettings={noop} onRequestRenameProject={noop} onNewChatInProject={noop} onOpenSettings={noop}
onOpenApps={noop} onOpenSkills={noop} onOpenAutomations={noop} onOpenChannels={noop} onOpenApps={noop} onOpenAutomations={noop}
onOpenSearch={noop} onToggleArchived={noop} /> onOpenSearch={noop} onToggleArchived={noop} />
<main><div hidden={connections?.managing} aria-hidden={connections?.managing || undefined}> <main><div hidden={connections?.managing} aria-hidden={connections?.managing || undefined}>
{remotePage ? <RemoteConnectionsPage onBackToChat={() => setRemotePage(false)} /> : <><p>Local conversations</p><textarea aria-label="Local draft" /></>} {remotePage ? <RemoteConnectionsPage onBackToChat={() => setRemotePage(false)} /> : <><p>Local conversations</p><textarea aria-label="Local draft" /></>}
+12 -5
View File
@@ -1,4 +1,4 @@
import { act, cleanup, fireEvent, screen } from "@testing-library/react"; import { act, cleanup, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import type { NanobotClient } from "@/lib/nanobot-client"; import type { NanobotClient } from "@/lib/nanobot-client";
@@ -6,6 +6,8 @@ import {
installSettingsViewTestHooks, installSettingsViewTestHooks,
jsonResponse, jsonResponse,
renderSettingsView, renderSettingsView,
selectToolType,
showOnlyReadyTools,
settingsPayload, settingsPayload,
} from "@/tests/settings-test-utils"; } from "@/tests/settings-test-utils";
@@ -42,7 +44,10 @@ describe("Apps default filter", () => {
renderSettingsView({ initialSettings: settingsPayload() }); renderSettingsView({ initialSettings: settingsPayload() });
expect(await screen.findByRole("heading", { name: "Example App" })).toBeInTheDocument(); expect(await screen.findByRole("heading", { name: "Example App" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "CLI Apps" })).toHaveAttribute("aria-pressed", "true"); expect(screen.getByRole("radio", { name: "All" })).toBeChecked();
expect(screen.getByRole("switch", { name: "Ready only" })).not.toBeChecked();
expect(screen.getByRole("heading", { name: "Docs MCP" })).toBeInTheDocument();
expect(screen.getByRole("heading", { name: "Example Plugin" })).toBeInTheDocument();
}); });
it("preserves a manual choice while MCP loads, then defaults to the cached Ready items on re-entry", async () => { it("preserves a manual choice while MCP loads, then defaults to the cached Ready items on re-entry", async () => {
@@ -56,14 +61,16 @@ describe("Apps default filter", () => {
renderSettingsView({ client, initialSettings: settingsPayload() }); renderSettingsView({ client, initialSettings: settingsPayload() });
await act(async () => {}); await act(async () => {});
expect(screen.queryByRole("heading", { name: "Example App" })).not.toBeInTheDocument(); expect(screen.queryByRole("heading", { name: "Example App" })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" })); await selectToolType("CLI Apps");
await showOnlyReadyTools(false);
await act(async () => { pending.resolve(jsonResponse({ presets: [mcp], installed_count: 1 })); }); await act(async () => { pending.resolve(jsonResponse({ presets: [mcp], installed_count: 1 })); });
expect(screen.getByRole("button", { name: "CLI Apps" })).toHaveAttribute("aria-pressed", "true"); expect(screen.getByRole("radio", { name: "CLI Apps" })).toBeChecked();
expect(screen.getByRole("switch", { name: "Ready only" })).not.toBeChecked();
expect(screen.getByRole("heading", { name: "Example App" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Example App" })).toBeInTheDocument();
cleanup(); cleanup();
renderSettingsView({ client, initialSettings: settingsPayload() }); renderSettingsView({ client, initialSettings: settingsPayload() });
expect(screen.getByRole("button", { name: "Ready" })).toHaveAttribute("aria-pressed", "true"); expect(screen.getByRole("switch", { name: "Ready only" })).toBeChecked();
expect(screen.getByRole("heading", { name: "Docs MCP" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Docs MCP" })).toBeInTheDocument();
}); });
}); });
+42 -22
View File
@@ -6,6 +6,8 @@ import {
installSettingsViewTestHooks, installSettingsViewTestHooks,
jsonResponse, jsonResponse,
renderSettingsView, renderSettingsView,
selectToolType,
showOnlyReadyTools,
requestMutationMock, requestMutationMock,
settingsPayload, settingsPayload,
} from "@/tests/settings-test-utils"; } from "@/tests/settings-test-utils";
@@ -43,7 +45,7 @@ async function connectXmind() {
describe("SettingsView Apps catalog", () => { describe("SettingsView Apps catalog", () => {
installSettingsViewTestHooks(); installSettingsViewTestHooks();
it("searches within the selected readiness or kind filter", async () => { it("combines independent type and readiness filters with search", async () => {
const figmaLocal = { ...xmindMcpPreset, name: "figma-local", display_name: "Figma local" }; const figmaLocal = { ...xmindMcpPreset, name: "figma-local", display_name: "Figma local" };
const figmaConnected = { const figmaConnected = {
...xmindMcpPreset, name: "figma-connected", display_name: "Figma connected", ...xmindMcpPreset, name: "figma-connected", display_name: "Figma connected",
@@ -72,18 +74,22 @@ describe("SettingsView Apps catalog", () => {
})); }));
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "Ready" })); await showOnlyReadyTools(true);
fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "figma" } }); fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "figma" } });
expect(await screen.findByRole("heading", { name: "Figma connected" })).toBeInTheDocument(); expect(await screen.findByRole("heading", { name: "Figma connected" })).toBeInTheDocument();
expect(screen.getByRole("heading", { name: "Figma CLI" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Figma CLI" })).toBeInTheDocument();
expect(screen.queryByRole("heading", { name: "Figma local" })).not.toBeInTheDocument(); expect(screen.queryByRole("heading", { name: "Figma local" })).not.toBeInTheDocument();
expect(screen.queryByRole("heading", { name: "Figma pending" })).not.toBeInTheDocument(); expect(screen.queryByRole("heading", { name: "Figma pending" })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "MCP" })); await selectToolType("MCP");
expect(screen.getByRole("switch", { name: "Ready only" })).toBeChecked();
expect(screen.queryByRole("heading", { name: "Figma local" })).not.toBeInTheDocument();
expect(screen.queryByRole("heading", { name: "Figma CLI" })).not.toBeInTheDocument();
await showOnlyReadyTools(false);
expect(screen.getByRole("heading", { name: "Figma local" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Figma local" })).toBeInTheDocument();
expect(screen.getByRole("heading", { name: "Figma connected" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Figma connected" })).toBeInTheDocument();
expect(screen.queryByRole("heading", { name: "Figma CLI" })).not.toBeInTheDocument(); expect(screen.queryByRole("heading", { name: "Figma CLI" })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" })); await selectToolType("CLI Apps");
expect(screen.getByRole("heading", { name: "Figma pending" })).toBeInTheDocument(); expect(screen.getByRole("heading", { name: "Figma pending" })).toBeInTheDocument();
expect(screen.queryByRole("heading", { name: "Figma local" })).not.toBeInTheDocument(); expect(screen.queryByRole("heading", { name: "Figma local" })).not.toBeInTheDocument();
expect(screen.queryByRole("heading", { name: "Photoshop CLI" })).not.toBeInTheDocument(); expect(screen.queryByRole("heading", { name: "Photoshop CLI" })).not.toBeInTheDocument();
@@ -102,7 +108,8 @@ describe("SettingsView Apps catalog", () => {
return { ok: false, status: 404, text: async () => "Not found" } as Response; return { ok: false, status: 404, text: async () => "Not found" } as Response;
})); }));
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
fireEvent.click(await screen.findByRole("button", { name: "Connect Xmind" })); fireEvent.click(await screen.findByRole("button", { name: "Connect Xmind" }));
const dialog = await screen.findByRole("dialog", { name: "Xmind" }); const dialog = await screen.findByRole("dialog", { name: "Xmind" });
const configure = within(dialog).queryByRole("button", { name: "Configure proxy" }); const configure = within(dialog).queryByRole("button", { name: "Configure proxy" });
@@ -158,7 +165,8 @@ describe("SettingsView Apps catalog", () => {
}); });
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
fireEvent.click(await screen.findByRole("button", { name: "Connect Metabase" })); fireEvent.click(await screen.findByRole("button", { name: "Connect Metabase" }));
const dialog = await screen.findByRole("dialog", { name: "Metabase" }); const dialog = await screen.findByRole("dialog", { name: "Metabase" });
@@ -247,7 +255,8 @@ describe("SettingsView Apps catalog", () => {
vi.stubGlobal("open", open); vi.stubGlobal("open", open);
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
expect(screen.getByText("MCP tools")).toBeInTheDocument(); expect(screen.getByText("MCP tools")).toBeInTheDocument();
const connectButton = await screen.findByRole("button", { name: "Connect Xmind" }); const connectButton = await screen.findByRole("button", { name: "Connect Xmind" });
expect(connectButton).toHaveTextContent("Connect"); expect(connectButton).toHaveTextContent("Connect");
@@ -320,10 +329,11 @@ describe("SettingsView Apps catalog", () => {
requestMutationMock.mockRejectedValueOnce(new Error("Stopped after request assertion")); requestMutationMock.mockRejectedValueOnce(new Error("Stopped after request assertion"));
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "Ready" })); await showOnlyReadyTools(true);
expect(await screen.findByText("No tools are ready yet.")).toBeInTheDocument(); expect(await screen.findByText("No tools are ready yet")).toBeInTheDocument();
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
const heading = await screen.findByRole("heading", { name: "Xmind" }); const heading = await screen.findByRole("heading", { name: "Xmind" });
const row = heading.closest("article"); const row = heading.closest("article");
@@ -382,7 +392,8 @@ describe("SettingsView Apps catalog", () => {
vi.stubGlobal("fetch", fetchMock); vi.stubGlobal("fetch", fetchMock);
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
const heading = await screen.findByRole("heading", { name: "Xmind" }); const heading = await screen.findByRole("heading", { name: "Xmind" });
const row = heading.closest("article"); const row = heading.closest("article");
@@ -425,13 +436,14 @@ describe("SettingsView Apps catalog", () => {
const client = { requestMutation: requestMutationMock, status: "open", onStatus: () => () => {} } as never; const client = { requestMutation: requestMutationMock, status: "open", onStatus: () => () => {} } as never;
renderSettingsView({ client, initialSection: "apps" }); renderSettingsView({ client, initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
expect(await screen.findByRole("button", { name: "Xmind" })) expect(await screen.findByRole("button", { name: "Xmind" }))
.toHaveAccessibleDescription("Connecting…"); .toHaveAccessibleDescription("Connecting…");
cleanup(); cleanup();
renderSettingsView({ client, initialSection: "apps", initialSettings: settingsPayload() }); renderSettingsView({ client, initialSection: "apps", initialSettings: settingsPayload() });
fireEvent.click(screen.getByRole("button", { name: "MCP" })); await selectToolType("MCP");
expect(screen.getByRole("button", { name: "Xmind" })).toHaveAccessibleDescription("Connecting…"); expect(screen.getByRole("button", { name: "Xmind" })).toHaveAccessibleDescription("Connecting…");
expect(mcpPresetRequests).toBe(1); expect(mcpPresetRequests).toBe(1);
expect(await screen.findByRole( expect(await screen.findByRole(
@@ -441,7 +453,7 @@ describe("SettingsView Apps catalog", () => {
)).toHaveTextContent("Manage"); )).toHaveTextContent("Manage");
expect(mcpPresetRequests).toBe(2); expect(mcpPresetRequests).toBe(2);
fireEvent.click(screen.getByRole("button", { name: "Ready" })); await showOnlyReadyTools(true);
expect(await screen.findByRole("heading", { name: "Xmind" })).toBeInTheDocument(); expect(await screen.findByRole("heading", { name: "Xmind" })).toBeInTheDocument();
}); });
@@ -486,7 +498,8 @@ describe("SettingsView Apps catalog", () => {
}); });
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
expect(await screen.findByText("Connection failed.")).toBeInTheDocument(); expect(await screen.findByText("Connection failed.")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Manage team-docs" })); fireEvent.click(screen.getByRole("button", { name: "Manage team-docs" }));
@@ -500,7 +513,8 @@ describe("SettingsView Apps catalog", () => {
)); ));
const connected = await screen.findByRole("button", { name: "Manage team-docs" }); const connected = await screen.findByRole("button", { name: "Manage team-docs" });
expect(connected).toHaveTextContent("Manage"); expect(connected).toHaveTextContent("Manage");
fireEvent.click(screen.getByRole("button", { name: "Ready" })); await selectToolType("All");
await showOnlyReadyTools(true);
const readyHeading = await screen.findByRole("heading", { name: "team-docs" }); const readyHeading = await screen.findByRole("heading", { name: "team-docs" });
expect(within(readyHeading.closest("article") as HTMLElement).getByText("MCP")) expect(within(readyHeading.closest("article") as HTMLElement).getByText("MCP"))
.toBeInTheDocument(); .toBeInTheDocument();
@@ -546,7 +560,8 @@ describe("SettingsView Apps catalog", () => {
}); });
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
fireEvent.click(await screen.findByRole("button", { name: "Custom" })); fireEvent.click(await screen.findByRole("button", { name: "Custom" }));
fireEvent.change(screen.getByLabelText("Server name"), { fireEvent.change(screen.getByLabelText("Server name"), {
@@ -673,7 +688,8 @@ describe("SettingsView Apps catalog", () => {
vi.stubGlobal("open", vi.fn(() => popup)); vi.stubGlobal("open", vi.fn(() => popup));
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
await connectXmind(); await connectXmind();
const callbackInput = await screen.findByRole("textbox", { name: "Callback URL" }); const callbackInput = await screen.findByRole("textbox", { name: "Callback URL" });
@@ -740,7 +756,8 @@ describe("SettingsView Apps catalog", () => {
vi.stubGlobal("open", vi.fn(() => popup)); vi.stubGlobal("open", vi.fn(() => popup));
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
await connectXmind(); await connectXmind();
const cancelButton = await screen.findByRole("button", { name: "Cancel" }); const cancelButton = await screen.findByRole("button", { name: "Cancel" });
@@ -796,7 +813,8 @@ describe("SettingsView Apps catalog", () => {
}); });
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
fireEvent.click(await screen.findByRole("button", { name: "Manage Xmind" })); fireEvent.click(await screen.findByRole("button", { name: "Manage Xmind" }));
const dialog = screen.getByRole("dialog", { name: "Xmind" }); const dialog = screen.getByRole("dialog", { name: "Xmind" });
fireEvent.click(within(dialog).getByRole("tab", { name: "Connection" })); fireEvent.click(within(dialog).getByRole("tab", { name: "Connection" }));
@@ -846,7 +864,8 @@ describe("SettingsView Apps catalog", () => {
vi.stubGlobal("open", open); vi.stubGlobal("open", open);
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
await connectXmind(); await connectXmind();
const continueButton = await screen.findByRole("button", { name: "Continue sign-in" }); const continueButton = await screen.findByRole("button", { name: "Continue sign-in" });
@@ -916,7 +935,8 @@ describe("SettingsView Apps catalog", () => {
vi.stubGlobal("open", vi.fn(() => popup)); vi.stubGlobal("open", vi.fn(() => popup));
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
await showOnlyReadyTools(false);
await connectXmind(); await connectXmind();
await waitFor(() => expect(statusCalls).toBe(1), { timeout: 2000 }); await waitFor(() => expect(statusCalls).toBe(1), { timeout: 2000 });
+5 -4
View File
@@ -406,11 +406,12 @@ describe("Settings channels", () => {
expect(await screen.findByRole("button", { name: "View Enabled channel settings" })).toBeInTheDocument(); expect(await screen.findByRole("button", { name: "View Enabled channel settings" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "View Enabled dependency channel settings" })).toBeInTheDocument(); expect(screen.getByRole("button", { name: "View Enabled dependency channel settings" })).toBeInTheDocument();
expect(screen.queryByRole("button", { name: "View Disabled channel settings" })).not.toBeInTheDocument(); expect(screen.queryByRole("button", { name: "View Disabled channel settings" })).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: "Enabled" })).toHaveAttribute("aria-pressed", "true"); expect(screen.getByRole("switch", { name: "Enabled only" })).toBeChecked();
expect(screen.queryByText("No installation needed")).not.toBeInTheDocument(); expect(screen.queryByText("No installation needed")).not.toBeInTheDocument();
expect(screen.queryByText("Requires dependencies")).not.toBeInTheDocument(); expect(screen.queryByText("Requires dependencies")).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "All" })); await userEvent.click(screen.getByRole("switch", { name: "Enabled only" }));
expect(screen.getByRole("switch", { name: "Enabled only" })).not.toBeChecked();
expect(screen.getByRole("button", { name: "View Disabled channel settings" })).toBeInTheDocument(); expect(screen.getByRole("button", { name: "View Disabled channel settings" })).toBeInTheDocument();
}); });
@@ -430,7 +431,7 @@ describe("Settings channels", () => {
expect(await screen.findByRole("button", { name: "View First channel settings" })).toBeInTheDocument(); expect(await screen.findByRole("button", { name: "View First channel settings" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "View Second channel settings" })).toBeInTheDocument(); expect(screen.getByRole("button", { name: "View Second channel settings" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "All" })).toHaveAttribute("aria-pressed", "true"); expect(screen.getByRole("switch", { name: "Enabled only" })).not.toBeChecked();
}); });
it("shows all channels by default when only the always-enabled WebUI is enabled", async () => { it("shows all channels by default when only the always-enabled WebUI is enabled", async () => {
@@ -453,7 +454,7 @@ describe("Settings channels", () => {
expect(await screen.findByText("nanobot WebUI")).toBeInTheDocument(); expect(await screen.findByText("nanobot WebUI")).toBeInTheDocument();
expect(screen.getByRole("button", { name: "View Disabled channel settings" })).toBeInTheDocument(); expect(screen.getByRole("button", { name: "View Disabled channel settings" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "All" })).toHaveAttribute("aria-pressed", "true"); expect(screen.getByRole("switch", { name: "Enabled only" })).not.toBeChecked();
}); });
it("replaces the installed channel switch with an in-row restart action", async () => { it("replaces the installed channel switch with an in-row restart action", async () => {
+3 -3
View File
@@ -7,7 +7,7 @@ import { NanobotClient } from "@/lib/nanobot-client";
import { ClientProvider } from "@/providers/ClientProvider"; import { ClientProvider } from "@/providers/ClientProvider";
import type { SettingsPayload } from "@/lib/types"; import type { SettingsPayload } from "@/lib/types";
import { DEFAULT_LOCAL_PREFS, LOCAL_PREFS_STORAGE_KEY, readLocalPreferences, writeLocalPreferences } from "@/lib/local-preferences"; import { DEFAULT_LOCAL_PREFS, LOCAL_PREFS_STORAGE_KEY, readLocalPreferences, writeLocalPreferences } from "@/lib/local-preferences";
import { jsonResponse, settingsPayload, renderSettingsView, installSettingsViewTestHooks } from "@/tests/settings-test-utils"; import { jsonResponse, settingsPayload, renderSettingsView, installSettingsViewTestHooks, selectToolType } from "@/tests/settings-test-utils";
const thirdPartyBrandNotice = const thirdPartyBrandNotice =
"Product names, logos, and brands are property of their respective owners. Use is for identification only and does not imply endorsement."; "Product names, logos, and brands are property of their respective owners. Use is for identification only and does not imply endorsement.";
@@ -348,8 +348,8 @@ describe("Settings overview and appearance", () => {
renderSettingsView(); renderSettingsView();
expect(await screen.findByText("No CLI Apps available.")).toBeInTheDocument(); expect(await screen.findByText("No tools available")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Browse MCP tools" })); await selectToolType("MCP");
expect(await screen.findByText("Add MCP")).toBeInTheDocument(); expect(await screen.findByText("Add MCP")).toBeInTheDocument();
}); });
+24 -14
View File
@@ -5,7 +5,7 @@ import { SkillsCatalogSettings } from "@/components/settings/SkillsCatalogSettin
import { ClientProvider } from "@/providers/ClientProvider"; import { ClientProvider } from "@/providers/ClientProvider";
import type { McpPresetInfo } from "@/lib/types"; import type { McpPresetInfo } from "@/lib/types";
import { __clearLogoFallbackCacheForTests } from "@/hooks/useLogoFallback"; import { __clearLogoFallbackCacheForTests } from "@/hooks/useLogoFallback";
import { requestMutationMock, jsonResponse, settingsPayload, renderSettingsView, installSettingsViewTestHooks } from "@/tests/settings-test-utils"; import { requestMutationMock, jsonResponse, settingsPayload, renderSettingsView, selectToolType, showOnlyReadyTools, installSettingsViewTestHooks } from "@/tests/settings-test-utils";
const installedAnyGen = { const installedAnyGen = {
@@ -138,7 +138,8 @@ describe("Settings system domains", () => {
renderSettingsView(); renderSettingsView();
fireEvent.click(await screen.findByRole("button", { name: "Agent Plugins" })); await selectToolType("Agent Plugins");
await showOnlyReadyTools(false);
expect(await screen.findByText("Computer Use")).toBeInTheDocument(); expect(await screen.findByText("Computer Use")).toBeInTheDocument();
expect(screen.getByText(/Control the desktop/)).toBeInTheDocument(); expect(screen.getByText(/Control the desktop/)).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Computer Use" })); fireEvent.click(screen.getByRole("button", { name: "Computer Use" }));
@@ -180,12 +181,13 @@ describe("Settings system domains", () => {
expect(await screen.findByRole("heading", { name: "AnyGen" })).toBeVisible(); expect(await screen.findByRole("heading", { name: "AnyGen" })).toBeVisible();
expect(screen.queryByRole("heading", { name: "Managed plugin" })).not.toBeInTheDocument(); expect(screen.queryByRole("heading", { name: "Managed plugin" })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Agent Plugins" })); await selectToolType("Agent Plugins");
await showOnlyReadyTools(false);
expect(screen.getByRole("heading", { name: "Separate plugin" })).toBeVisible(); expect(screen.getByRole("heading", { name: "Separate plugin" })).toBeVisible();
expect(screen.queryByRole("heading", { name: "Managed plugin" })).not.toBeInTheDocument(); expect(screen.queryByRole("heading", { name: "Managed plugin" })).not.toBeInTheDocument();
fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "separate" } }); fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "separate" } });
expect(screen.getByRole("heading", { name: "Separate plugin" })).toBeVisible(); expect(screen.getByRole("heading", { name: "Separate plugin" })).toBeVisible();
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" })); await selectToolType("CLI Apps");
expect(screen.queryByRole("heading", { name: "AnyGen" })).not.toBeInTheDocument(); expect(screen.queryByRole("heading", { name: "AnyGen" })).not.toBeInTheDocument();
fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "" } }); fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "" } });
fireEvent.click(screen.getByRole("button", { name: "Agent Plugin disabled" })); fireEvent.click(screen.getByRole("button", { name: "Agent Plugin disabled" }));
@@ -206,7 +208,8 @@ describe("Settings system domains", () => {
return jsonResponse(settingsPayload()); return jsonResponse(settingsPayload());
})); }));
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "Agent Plugins" })); await selectToolType("Agent Plugins");
await showOnlyReadyTools(false);
expect(await screen.findByRole("heading", { name: "Computer Use" })).toBeVisible(); expect(await screen.findByRole("heading", { name: "Computer Use" })).toBeVisible();
}); });
@@ -267,7 +270,8 @@ describe("Settings system domains", () => {
it("does not hide a standalone heading when the navigation is collapsed or absent", () => { it("does not hide a standalone heading when the navigation is collapsed or absent", () => {
renderSettingsView({ initialSection: "skills", initialSettings: settingsPayload(), showSidebar: false, mainNavigationExpanded: false }); renderSettingsView({ initialSection: "skills", initialSettings: settingsPayload(), showSidebar: false, mainNavigationExpanded: false });
expect(screen.getByTestId("settings-section-transition")).toHaveAttribute("data-main-navigation-expanded", "false"); expect(screen.getByTestId("settings-section-transition")).toHaveAttribute("data-main-navigation-expanded", "false");
expect(screen.getByRole("heading", { name: "Skills", level: 1 })).toBeVisible(); expect(screen.getByRole("heading", { name: "Apps", level: 1 })).toBeVisible();
expect(screen.getByRole("button", { name: "Skills" })).toHaveAttribute("aria-pressed", "true");
}); });
it("uses the inline section heading layout to align Apps titles and counts", async () => { it("uses the inline section heading layout to align Apps titles and counts", async () => {
@@ -288,10 +292,13 @@ describe("Settings system domains", () => {
expect(title.nextElementSibling).not.toHaveClass(className); expect(title.nextElementSibling).not.toHaveClass(className);
} }
fireEvent.click(screen.getByRole("button", { name: "MCP" })); await selectToolType("MCP");
const mcpTitle = screen.getByRole("heading", { name: "MCP tools" }); const mcpTitle = screen.getByRole("heading", { name: "MCP tools" });
expect(mcpTitle.parentElement).toHaveClass("settings-section-heading"); expect(mcpTitle.parentElement).toHaveClass("settings-section-heading");
expect(mcpTitle.nextElementSibling).toHaveTextContent("0"); expect(mcpTitle.nextElementSibling).toHaveTextContent("0");
expect(screen.getByRole("switch", { name: "Ready only" })).toBeChecked();
expect(screen.getByText("No MCP tools available")).toBeVisible();
expect(screen.getByText("Add a custom MCP server below")).toBeVisible();
}); });
it.each(["cli", "mcp"] as const)( it.each(["cli", "mcp"] as const)(
@@ -320,7 +327,7 @@ describe("Settings system domains", () => {
})); }));
renderSettingsView({ initialSection: "apps", initialSettings: settingsPayload() }); renderSettingsView({ initialSection: "apps", initialSettings: settingsPayload() });
await screen.findByText("AnyGen"); await screen.findByText("AnyGen");
if (kind === "mcp") fireEvent.click(screen.getByRole("button", { name: "MCP" })); if (kind === "mcp") await selectToolType("MCP");
const row = (await screen.findByText(name)).closest("article")!; const row = (await screen.findByText(name)).closest("article")!;
const image = row.querySelector("img")!; const image = row.querySelector("img")!;
expect(image).toHaveAttribute("src", logoUrl); expect(image).toHaveAttribute("src", logoUrl);
@@ -660,10 +667,12 @@ describe("Settings system domains", () => {
renderSettingsView({ initialSection: "apps" }); renderSettingsView({ initialSection: "apps" });
expect(await screen.findByText("AnyGen")).toBeInTheDocument(); expect(await screen.findByText("AnyGen")).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Ready" })).toHaveAttribute("aria-pressed", "false"); expect(screen.getByRole("switch", { name: "Ready only" })).not.toBeChecked();
expect(screen.getByRole("button", { name: "CLI Apps" })).toHaveAttribute("aria-pressed", "true"); const filters = within(screen.getByRole("radiogroup", { name: "Tool type" }));
expect(screen.getByRole("button", { name: "Agent Plugins" })).toBeInTheDocument(); expect(filters.getByRole("radio", { name: "All" })).toBeChecked();
expect(screen.getByRole("button", { name: "MCP" })).toBeInTheDocument(); for (const name of ["CLI Apps", "Agent Plugins", "MCP"]) {
expect(filters.getByRole("radio", { name })).toBeInTheDocument();
}
}); });
it("installs optional channel support before enabling and disabling it", async () => { it("installs optional channel support before enabling and disabling it", async () => {
@@ -745,7 +754,6 @@ describe("Settings system domains", () => {
renderSettingsView({ initialSection: "channels" }); renderSettingsView({ initialSection: "channels" });
const matrixRow = await screen.findByRole("button", { name: "View Matrix settings" }); const matrixRow = await screen.findByRole("button", { name: "View Matrix settings" });
expect(matrixRow).toHaveAttribute("aria-haspopup", "dialog");
fireEvent.click(matrixRow); fireEvent.click(matrixRow);
expect(screen.queryByRole("dialog")).not.toBeInTheDocument(); expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
expect(screen.queryByRole("switch", { name: "Matrix channel" })).not.toBeInTheDocument(); expect(screen.queryByRole("switch", { name: "Matrix channel" })).not.toBeInTheDocument();
@@ -777,7 +785,9 @@ describe("Settings system domains", () => {
); );
expect(screen.getAllByText("On").length).toBeGreaterThan(0); expect(screen.getAllByText("On").length).toBeGreaterThan(0);
fireEvent.click(screen.getByRole("button", { name: "View Matrix settings" })); const installedRow = screen.getByRole("button", { name: "View Matrix settings" });
expect(installedRow).toHaveAttribute("aria-haspopup", "dialog");
fireEvent.click(installedRow);
expect(screen.getByLabelText("Homeserver")).toBeInTheDocument(); expect(screen.getByLabelText("Homeserver")).toBeInTheDocument();
expect(screen.getByLabelText("User ID")).toBeInTheDocument(); expect(screen.getByLabelText("User ID")).toBeInTheDocument();
expect(screen.getByLabelText("Device ID")).toBeInTheDocument(); expect(screen.getByLabelText("Device ID")).toBeInTheDocument();
+11 -1
View File
@@ -1,4 +1,4 @@
import { cleanup, render } from "@testing-library/react"; import { cleanup, render, screen, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { afterEach, beforeEach, vi } from "vitest"; import { afterEach, beforeEach, vi } from "vitest";
import { SettingsView } from "@/components/settings/SettingsView"; import { SettingsView } from "@/components/settings/SettingsView";
@@ -171,6 +171,16 @@ export async function openPopover(trigger: HTMLElement) {
await userEvent.setup().click(trigger); await userEvent.setup().click(trigger);
} }
export async function selectToolType(name: string) {
const types = await screen.findByRole("radiogroup", { name: "Tool type" });
await userEvent.click(within(types).getByRole("radio", { name }));
}
export async function showOnlyReadyTools(ready: boolean) {
const toggle = await screen.findByRole("switch", { name: "Ready only" });
if ((toggle.getAttribute("aria-checked") === "true") !== ready) await userEvent.click(toggle);
}
export function installSettingsViewTestHooks() { export function installSettingsViewTestHooks() {
beforeEach(() => { beforeEach(() => {
requestMutationMock.mockReset().mockResolvedValue(settingsPayload()); requestMutationMock.mockReset().mockResolvedValue(settingsPayload());
+3 -3
View File
@@ -3,7 +3,7 @@ import userEvent from "@testing-library/user-event";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import type { McpPresetInfo } from "@/lib/types"; import type { McpPresetInfo } from "@/lib/types";
import { installSettingsViewTestHooks, jsonResponse, renderSettingsView, requestMutationMock, settingsPayload } from "@/tests/settings-test-utils"; import { installSettingsViewTestHooks, jsonResponse, renderSettingsView, selectToolType, requestMutationMock, settingsPayload } from "@/tests/settings-test-utils";
const preset: McpPresetInfo = { const preset: McpPresetInfo = {
name: "docs", display_name: "Docs MCP", category: "productivity", description: "Docs", name: "docs", display_name: "Docs MCP", category: "productivity", description: "Docs",
@@ -26,7 +26,7 @@ function installProxySettings() {
} }
async function openMcpSetup() { async function openMcpSetup() {
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
fireEvent.click(await screen.findByRole("button", { name: "Manage Docs MCP" })); fireEvent.click(await screen.findByRole("button", { name: "Manage Docs MCP" }));
const parent = await screen.findByRole("dialog", { name: "Docs MCP" }); const parent = await screen.findByRole("dialog", { name: "Docs MCP" });
fireEvent.click(within(parent).getByRole("tab", { name: "Connection" })); fireEvent.click(within(parent).getByRole("tab", { name: "Connection" }));
@@ -103,7 +103,7 @@ describe("Inline shared proxy setup", () => {
it("retains MCP tool selections when setup is cancelled", async () => { it("retains MCP tool selections when setup is cancelled", async () => {
const { settings } = installProxySettings(); const { settings } = installProxySettings();
renderSettingsView({ initialSection: "apps", initialSettings: settings }); renderSettingsView({ initialSection: "apps", initialSettings: settings });
fireEvent.click(await screen.findByRole("button", { name: "MCP" })); await selectToolType("MCP");
fireEvent.click(await screen.findByRole("button", { name: "Manage Docs MCP" })); fireEvent.click(await screen.findByRole("button", { name: "Manage Docs MCP" }));
const parent = await screen.findByRole("dialog", { name: "Docs MCP" }); const parent = await screen.findByRole("dialog", { name: "Docs MCP" });
fireEvent.click(within(parent).getByRole("tab", { name: "Tools" })); fireEvent.click(within(parent).getByRole("tab", { name: "Tools" }));
+16 -3
View File
@@ -1,3 +1,4 @@
import { useState, type ComponentProps } from "react";
import { act, fireEvent, render, renderHook, screen } from "@testing-library/react"; import { act, fireEvent, render, renderHook, screen } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
@@ -32,10 +33,18 @@ vi.mock("@/lib/api", async (importOriginal) => {
const client = {} as NanobotClient; const client = {} as NanobotClient;
function MarketplaceTestView(props: Omit<ComponentProps<typeof SkillsMarketplace>, "query" | "provider">) {
const [query, setQuery] = useState("");
return <>
<input aria-label="Search skills" value={query} onChange={(event) => setQuery(event.target.value)} />
<SkillsMarketplace {...props} query={query} provider="all" />
</>;
}
function marketplace(token: string) { function marketplace(token: string) {
return ( return (
<ClientProvider client={client} token={token}> <ClientProvider client={client} token={token}>
<SkillsMarketplace <MarketplaceTestView
installedSkills={[]} installedSkills={[]}
installing="" installing=""
onInstallingChange={() => {}} onInstallingChange={() => {}}
@@ -73,7 +82,7 @@ describe("useSkills", () => {
expect(screen.queryByRole("alert")).not.toBeInTheDocument(); expect(screen.queryByRole("alert")).not.toBeInTheDocument();
await act(async () => { resolveRetry({ skills: [] }); }); await act(async () => { resolveRetry({ skills: [] }); });
expect(screen.getByText("No skills are available.")).toBeInTheDocument(); expect(screen.getByText("No skills are available.")).toBeInTheDocument();
expect(screen.getByRole("button", { name: "All 0" })).toBeInTheDocument(); expect(screen.getByRole("radio", { name: "All 0" })).toBeChecked();
act(() => { requestSkillsRefresh(); }); act(() => { requestSkillsRefresh(); });
expect(screen.getByText("No skills are available.")).toBeInTheDocument(); expect(screen.getByText("No skills are available.")).toBeInTheDocument();
@@ -88,6 +97,10 @@ describe("useSkills", () => {
target: { value: "" }, target: { value: "" },
}); });
expect(screen.getByRole("button", { name: "Open details for weather" })).toBeInTheDocument(); expect(screen.getByRole("button", { name: "Open details for weather" })).toBeInTheDocument();
fireEvent.click(screen.getByRole("radio", { name: "Disabled 0" }));
expect(screen.getByText("No matching skills.")).toBeInTheDocument();
fireEvent.click(screen.getByRole("radio", { name: "Enabled 1" }));
expect(screen.getByRole("button", { name: "Open details for weather" })).toBeInTheDocument();
expect(fetchSkills).toHaveBeenCalledTimes(3); expect(fetchSkills).toHaveBeenCalledTimes(3);
}); });
@@ -289,7 +302,7 @@ describe("SkillsMarketplace", () => {
originSkill("new/source", "available"), originSkill("new/source", "available"),
], ],
}); });
render(<ClientProvider client={client} token="tok"><SkillsMarketplace render(<ClientProvider client={client} token="tok"><MarketplaceTestView
installedSkills={[{ name: "agent-browser", source: "workspace", description: "Local", available: true }]} installedSkills={[{ name: "agent-browser", source: "workspace", description: "Local", available: true }]}
installing="" onInstallingChange={vi.fn()} installing="" onInstallingChange={vi.fn()}
/></ClientProvider>); /></ClientProvider>);
@@ -154,14 +154,20 @@ describe("temporary chat navigation", () => {
vi.unstubAllGlobals(); vi.unstubAllGlobals();
}); });
it.each(["settings", "apps", "automations", "skills", "channels"])( it.each([
["settings", "#/settings"],
["apps", "#/apps"],
["automations", "#/automations"],
["skills", "#/apps?section=skills"],
["channels", "#/apps?section=channels"],
])(
"opens %s directly without mounting chat or retaining a chat query", "opens %s directly without mounting chat or retaining a chat query",
async (view) => { async (view, canonicalHash) => {
window.history.replaceState(null, "", `/#/${view}?chat=websocket%3Aregular`); window.history.replaceState(null, "", `/#/${view}?chat=websocket%3Aregular`);
render(<App />); render(<App />);
await screen.findByRole("button", { name: "Back to chat" }); await screen.findByRole("button", { name: "Back to chat" });
act(() => TestSocket.current.open()); act(() => TestSocket.current.open());
await waitFor(() => expect(window.location.hash).toBe(`#/${view}`)); await waitFor(() => expect(window.location.hash).toBe(canonicalHash));
expect(window.history.state.nanobotReturnChat.key).toBe("websocket:regular"); expect(window.history.state.nanobotReturnChat.key).toBe("websocket:regular");
expect(screen.queryByTestId("thread-message-region")).not.toBeInTheDocument(); expect(screen.queryByTestId("thread-message-region")).not.toBeInTheDocument();
const requests = vi.mocked(fetch).mock.calls.map(([url]) => String(url)); const requests = vi.mocked(fetch).mock.calls.map(([url]) => String(url));
+2 -2
View File
@@ -185,10 +185,10 @@ describe("Sidebar update entry", () => {
it("renders the same entry in expanded and collapsed navigation", () => { it("renders the same entry in expanded and collapsed navigation", () => {
const noop = vi.fn(); const noop = vi.fn();
const props = { sessions: [], activeKey: null, loading: false, newChatActive: false, const props = { sessions: [], activeKey: null, loading: false,
onNewChat: noop, onSelect: noop, onRequestDelete: noop, onTogglePin: noop, onRequestRename: noop, onNewChat: noop, onSelect: noop, onRequestDelete: noop, onTogglePin: noop, onRequestRename: noop,
onToggleArchive: noop, onToggleGroup: noop, onRequestRenameProject: noop, onNewChatInProject: noop, onToggleArchive: noop, onToggleGroup: noop, onRequestRenameProject: noop, onNewChatInProject: noop,
onOpenSettings: noop, onOpenApps: noop, onOpenSkills: noop, onOpenAutomations: noop, onOpenChannels: noop, onOpenSettings: noop, onOpenApps: noop, onOpenAutomations: noop,
onOpenSearch: noop, onToggleArchived: noop, onOpenUpdates: noop, onOpenSearch: noop, onToggleArchived: noop, onOpenUpdates: noop,
availableUpdate: { version: "0.3.6", onDismiss: noop } }; availableUpdate: { version: "0.3.6", onDismiss: noop } };
const { rerender } = render(<ClientProvider client={client} token="test"><Sidebar {...props} /></ClientProvider>); const { rerender } = render(<ClientProvider client={client} token="test"><Sidebar {...props} /></ClientProvider>);
+2 -1
View File
@@ -15,7 +15,8 @@ function startupSkeleton(): Plugin {
order: "post", order: "post",
handler(html) { handler(html) {
if (!html.includes("<!--startup-shell-->")) return html; if (!html.includes("<!--startup-shell-->")) return html;
const css = readFileSync(path.resolve(__dirname, "src/components/startup-skeleton.css"), "utf8"); const css = ["src/components/content-column.css", "src/components/settings/shared/catalog-layout.css", "src/components/startup-skeleton.css"]
.map((file) => readFileSync(path.resolve(__dirname, file), "utf8")).join("\n");
const initialize = `var shell = document.querySelector('.startup-shell'); var layout = (${readStartupLayout.toString()})(); const initialize = `var shell = document.querySelector('.startup-shell'); var layout = (${readStartupLayout.toString()})();
shell.dataset.startupSurface = layout.surface; shell.dataset.startupSection = layout.section; shell.dataset.startupSurface = layout.surface; shell.dataset.startupSection = layout.section;
shell.dataset.sidebarExpanded = String(layout.sidebarExpanded); shell.dataset.existingChat = String(layout.existingChat); shell.dataset.sidebarExpanded = String(layout.sidebarExpanded); shell.dataset.existingChat = String(layout.existingChat);