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
No files matched your search
@@ -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.
|
||||
|
||||
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
|
||||
|
||||
| Location | Ownership | Examples |
|
||||
|
||||
@@ -45,7 +45,7 @@ export function AppsFixture() {
|
||||
return <main className="mx-auto max-w-4xl p-6" style={connectionLayout ? { maxWidth: 800 } : undefined}><AppsCatalogSettings
|
||||
cliApps={{ apps: [], installed_count: 0 }}
|
||||
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}
|
||||
mcpOAuthFlow={connecting ? { flow_id: "fixture", name: "linear", status: "authorization_required", expires_in: 300 } : null}
|
||||
mcpOAuthPopupBlocked={false}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { FilePreviewPanelView } from "@/components/FilePreviewPanelView";
|
||||
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 { AppsCatalogSettings, DEFAULT_CUSTOM_MCP_FORM } from "@/components/settings/system/AppsSettings";
|
||||
import { ChannelsSettings } from "@/components/settings/system/ChannelsSettings";
|
||||
@@ -11,7 +13,7 @@ import { WorkspaceProjectPicker } from "@/components/thread/WorkspaceControls";
|
||||
import { settings } from "@/dev/gallery/settings";
|
||||
import { useReadingTypography } from "@/hooks/useReadingTypography";
|
||||
import { fetchWorkspaceDirectories } from "@/lib/api";
|
||||
import type { McpPresetInfo, NanobotFeatureInfo } from "@/lib/types";
|
||||
import type { MarketplaceProvider, McpPresetInfo, NanobotFeatureInfo } from "@/lib/types";
|
||||
|
||||
const noop = () => {};
|
||||
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 }) {
|
||||
useReadingTypography();
|
||||
const { t } = useTranslation();
|
||||
const [query, setQuery] = useState("");
|
||||
const [provider, setProvider] = useState<MarketplaceProvider>("all");
|
||||
const [model, setModel] = useState("");
|
||||
const [previewLoading, setPreviewLoading] = useState(loading);
|
||||
const feature: NanobotFeatureInfo = {
|
||||
@@ -42,7 +47,7 @@ export function SkeletonFixture({ surface, loading }: { surface: string; loading
|
||||
available: false, status: "not_installed", skill_installed: false,
|
||||
})) : [], installed_count: 0 }}
|
||||
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}
|
||||
mcpOAuthCallbackUrl="" mcpOAuthCompleting={false} mcpOAuthCallbackError={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}
|
||||
onBackToChat={noop} onMcpFieldChange={noop} onCustomMcpFormChange={noop}
|
||||
onMcpConfigImportChange={noop} onSaveCustomMcp={noop} onImportMcpConfig={noop} onMcpToolsChange={noop}
|
||||
/> : surface === "channels" ? <ChannelsSettings
|
||||
token="fixture" nanobotFeatures={loading ? null : { features: names.map((name, index) => ({ ...feature, name: `channel-${index}`, display_name: name })), enabled_count: 6, requires_restart: false }}
|
||||
loading={loading} actionKey={null} showBrandLogos={false} error={null} requiresRestartPending={false}
|
||||
onAction={noop} onFeaturesUpdate={noop} onDismissStatus={noop}
|
||||
/> : surface === "skills" ? <SkillsCatalogSettings loading={loading} skills={loading ? [] : names.map((name) => ({
|
||||
/> : surface === "channels" ? <div className="apps-catalog-layout">
|
||||
<CatalogSearch type="search" value={query} onChange={(event) => setQuery(event.target.value)} placeholder={t("settings.channels.search")} />
|
||||
<ChannelsSettings query={query}
|
||||
token="fixture" nanobotFeatures={loading ? null : { features: names.map((name, index) => ({ ...feature, name: `channel-${index}`, display_name: name })), enabled_count: 6, requires_restart: false }}
|
||||
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,
|
||||
}))} /> : 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"
|
||||
settings={{ ...settings, providers: settings.providers.map((provider) => provider.name === "openai" ? { ...provider, model_catalog: "official" } : provider) }}
|
||||
provider={surface === "models-compact" ? "openai" : "anthropic"}
|
||||
|
||||
@@ -51,6 +51,9 @@ for (const width of [390, 1440]) {
|
||||
for (const [surface, [loadedSelector, loadingSelector]] of Object.entries(catalogRows)) {
|
||||
await page.goto(fixture(surface));
|
||||
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 icon = await box(surface === "channels" ? loaded.locator('[data-testid^="channel-logo"]')
|
||||
: 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;
|
||||
await page.goto(fixture(surface, true));
|
||||
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.locator(surface === "apps" ? ":scope > :first-child > :first-child" : ":scope > :first-child")), icon);
|
||||
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?**");
|
||||
try {
|
||||
await page.goto(fixture("marketplace"));
|
||||
if (view === "single") await page.getByRole("tab", { name: "skills.sh", exact: true }).click();
|
||||
if (view === "search") await page.locator("input").fill("project");
|
||||
if (view === "single") {
|
||||
await page.getByRole("radio", { name: "skills.sh", exact: true }).locator("..").click();
|
||||
}
|
||||
if (view === "search") await page.getByRole("textbox").fill("project");
|
||||
await requested;
|
||||
const skeletons = status(page).locator(".py-3\\.5");
|
||||
const count = view === "single" ? 5 : 10;
|
||||
|
||||
@@ -3,16 +3,27 @@ import { expect, test } from "@playwright/test";
|
||||
for (const width of [412, 1440]) {
|
||||
test.describe(`${width}px document startup skeleton`, () => {
|
||||
test.use({ viewport: { width, height: 922 }, reducedMotion: "reduce" });
|
||||
for (const surface of ["skills", "apps", "channels", "automations", "settings", "chat"]) {
|
||||
test(`${surface} paints before the application and stylesheet download`, async ({ page }) => {
|
||||
for (const route of ["skills", "apps", "channels", "apps?section=skills", "apps?section=channels", "automations", "settings", "chat"]) {
|
||||
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"));
|
||||
// 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.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");
|
||||
await expect(shell).toHaveAttribute("data-startup-surface", surface);
|
||||
await expect(shell).toHaveAttribute("aria-busy", "true");
|
||||
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");
|
||||
expect(await blocks.count()).toBeGreaterThan(5);
|
||||
const box = await blocks.first().boundingBox();
|
||||
|
||||
@@ -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" });
|
||||
return <main data-theme-surface className="flex bg-background" style={{ height: "100vh" }}>
|
||||
<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 () => {}}
|
||||
onToggleArchive={noop} onToggleGroup={noop} onRequestRenameProject={noop} onNewChatInProject={noop}
|
||||
onOpenSettings={noop} onOpenApps={noop} onOpenSkills={noop} onOpenAutomations={noop}
|
||||
onOpenChannels={noop} onOpenSearch={noop} onToggleArchived={noop} />
|
||||
onOpenSettings={noop} onOpenApps={noop} onOpenAutomations={noop}
|
||||
onOpenSearch={noop} onToggleArchived={noop} />
|
||||
</aside>
|
||||
<div className="min-w-0 flex-1">
|
||||
<PaneWorkbench panes={panes} activePaneKey="theme" layout="columns"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import { SettingsView } from "@/components/settings/SettingsView";
|
||||
import { StartupSkeleton } from "@/components/StartupSkeleton";
|
||||
import "@/components/startup-skeleton.css";
|
||||
import { settings } from "@/dev/gallery/settings";
|
||||
|
||||
export function installToolsCatalogPreviewApi() {
|
||||
@@ -12,14 +14,20 @@ export function installToolsCatalogPreviewApi() {
|
||||
|
||||
export function ToolsCatalogFixture() {
|
||||
const [open, setOpen] = useState(true);
|
||||
return <main>
|
||||
<button onClick={() => setOpen(value => !value)}>{open ? "Leave settings" : "Open settings"}</button>
|
||||
const params = new URLSearchParams(location.search);
|
||||
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
|
||||
initialSection="apps"
|
||||
initialSection={section}
|
||||
initialSettings={settings}
|
||||
showSidebar={false}
|
||||
themePreference="light"
|
||||
onChangeTheme={() => {}}
|
||||
onModelNameChange={() => {}}
|
||||
onStartAutomationChat={section === "automations" ? () => {} : undefined}
|
||||
onBackToChat={() => setOpen(false)}
|
||||
/>}
|
||||
</main>;
|
||||
|
||||
@@ -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 }) => {
|
||||
const clockStart = Date.now();
|
||||
await page.clock.setFixedTime(clockStart);
|
||||
const counts = { cli: 0, mcp: 0 };
|
||||
let refresh = false;
|
||||
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 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 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 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 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: "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();
|
||||
expect(counts).toEqual({ cli: 1, mcp: 1 });
|
||||
await page.getByRole("button", { name: "Leave settings", exact: true }).click();
|
||||
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: "Agent Plugins", exact: true }).click();
|
||||
await selectToolType(page, "Agent Plugins");
|
||||
await showAllTools(page);
|
||||
await expect.poll(() => counts).toEqual({ cli: 2, mcp: 2 });
|
||||
await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("status", { name: "Loading apps…", exact: true })).toHaveCount(0);
|
||||
release();
|
||||
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();
|
||||
});
|
||||
|
||||
|
||||
test("shows all category labels on narrow screens in each locale", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 320, height: 800 });
|
||||
test("reveals MCP tools hidden by Ready only without switching tool type", async ({ page }) => {
|
||||
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/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.goto(`/browser/fixture.html?case=tools-catalog&lang=${locale}`);
|
||||
const control = page.locator(".segmented-control").filter({ has: page.getByRole("button", { name: "CLI Apps", exact: true }) });
|
||||
await expect(control).toBeVisible();
|
||||
const geometry = await control.evaluate(element => {
|
||||
await page.route("**/api/settings/nanobot-features", route => route.fulfill({ json: { features: [], enabled_count: 0 } }));
|
||||
await page.route("**/api/webui/skills/trending?**", route => route.fulfill({ json: { skills: [] } }));
|
||||
const controls = page.locator(".catalog-controls");
|
||||
async function expectControlsFit(locale: string, count: number) {
|
||||
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();
|
||||
return {
|
||||
label: element.textContent,
|
||||
left: bounds.left,
|
||||
right: bounds.right,
|
||||
buttons: Array.from(element.querySelectorAll("button"), button => ({
|
||||
text: button.textContent,
|
||||
fits: button.scrollWidth <= button.clientWidth,
|
||||
})),
|
||||
fits: element.scrollWidth <= element.clientWidth
|
||||
&& (!element.matches("button") || element.scrollHeight <= element.clientHeight),
|
||||
};
|
||||
});
|
||||
expect(geometry.left, locale).toBeGreaterThanOrEqual(0);
|
||||
expect(geometry.right, locale).toBeLessThanOrEqual(320);
|
||||
expect(geometry.buttons, locale).toHaveLength(4);
|
||||
expect(geometry.buttons.every(button => button.fits), locale).toBe(true);
|
||||
}));
|
||||
expect(geometry.filter(item => item.left < 0 || item.right > width || !item.fits), locale).toEqual([]);
|
||||
}
|
||||
for (const locale of ["en", "es", "fr", "id", "ja", "ko", "pt-BR", "vi", "zh-CN", "zh-TW"]) {
|
||||
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").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§ion=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§ion=${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}§ion=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}§ion=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);
|
||||
}
|
||||
});
|
||||
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -6,6 +6,7 @@ import {
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
type CSSProperties,
|
||||
type ReactNode,
|
||||
} from "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 { webuiThreadCache } from "@/lib/webui-thread-cache";
|
||||
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 { transitionSession } from "@/components/thread/session-transition";
|
||||
import {
|
||||
@@ -137,7 +138,7 @@ const SIDEBAR_RAIL_WIDTH = 56;
|
||||
const MOBILE_SIDEBAR_WIDTH = `min(${SIDEBAR_WIDTH}px, calc(100vw - 0.75rem))`;
|
||||
const TOKEN_REFRESH_MARGIN_MS = 30_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 = {
|
||||
view: ShellView;
|
||||
activeKey: string | null;
|
||||
@@ -195,7 +196,8 @@ function defaultShellRoute(): ShellRoute {
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -272,19 +274,19 @@ function readShellRoute(): ShellRoute {
|
||||
};
|
||||
}
|
||||
if (path === "/apps") {
|
||||
return { view: "apps", activeKey, temporary, settingsSection: "apps" };
|
||||
return { view: "apps", activeKey, temporary, settingsSection: isAppsSection(settingsSection) ? settingsSection : "apps" };
|
||||
}
|
||||
if (path === "/automations") {
|
||||
return { view: "automations", activeKey, temporary, settingsSection: "automations" };
|
||||
}
|
||||
if (path === "/channels") {
|
||||
return { view: "channels", activeKey, temporary, settingsSection: "channels" };
|
||||
return { view: "apps", activeKey, temporary, settingsSection: "channels" };
|
||||
}
|
||||
if (path === "/remote") {
|
||||
return { view: "remote", activeKey, temporary, settingsSection: "overview" };
|
||||
}
|
||||
if (path === "/skills") {
|
||||
return { view: "skills", activeKey, temporary, settingsSection: "skills" };
|
||||
return { view: "apps", activeKey, temporary, settingsSection: "skills" };
|
||||
}
|
||||
if (path.startsWith("/temporary/")) {
|
||||
const encoded = path.slice("/temporary/".length);
|
||||
@@ -331,6 +333,9 @@ function shellRouteHash(route: ShellRoute): string {
|
||||
params.set("section", route.settingsSection);
|
||||
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();
|
||||
return `#/${route.view}${query ? `?${query}` : ""}`;
|
||||
}
|
||||
@@ -897,8 +902,7 @@ function Shell({
|
||||
const [settingsInitialSection, setSettingsInitialSection] =
|
||||
useState<SettingsSectionKey>(initialRouteRef.current.settingsSection);
|
||||
const [settingsFocus, setSettingsFocus] = useState<SettingsFocusTarget | undefined>(initialRouteRef.current.settingsFocus);
|
||||
const [hostSidebarOpen, setHostSidebarOpen] =
|
||||
useState<boolean>(readSidebarOpen);
|
||||
const [preferredSidebarOpen, setPreferredSidebarOpen] = useState(readSidebarOpen);
|
||||
const [sidebarWidth, setSidebarWidth] = useState(readSidebarWidth);
|
||||
const [sidebarDragging, setSidebarDragging] = useState(false);
|
||||
const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false);
|
||||
@@ -988,6 +992,14 @@ function Shell({
|
||||
)),
|
||||
[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(
|
||||
() => temporarySessionList.map((session) => session.chatId),
|
||||
[temporarySessionList],
|
||||
@@ -1128,7 +1140,7 @@ function Shell({
|
||||
try {
|
||||
window.localStorage.setItem(
|
||||
SIDEBAR_STORAGE_KEY,
|
||||
hostSidebarOpen ? "1" : "0",
|
||||
preferredSidebarOpen ? "1" : "0",
|
||||
);
|
||||
} catch {
|
||||
// ignore storage errors (private mode, etc.)
|
||||
@@ -1138,7 +1150,7 @@ function Shell({
|
||||
} catch {
|
||||
// Storage can be unavailable in private browsing.
|
||||
}
|
||||
}, [hostSidebarOpen, sidebarWidth]);
|
||||
}, [preferredSidebarOpen, sidebarWidth]);
|
||||
|
||||
useEffect(() => {
|
||||
writeSessionUpdateChatIds(updatedChatIds);
|
||||
@@ -1329,7 +1341,7 @@ function Shell({
|
||||
|
||||
const openHostSidebar = useCallback(() => {
|
||||
setHostSidebarOpen(true);
|
||||
}, []);
|
||||
}, [setHostSidebarOpen]);
|
||||
|
||||
const closeMobileSidebar = useCallback(() => {
|
||||
setMobileSidebarOpen(false);
|
||||
@@ -1340,11 +1352,11 @@ function Shell({
|
||||
typeof window !== "undefined" &&
|
||||
window.matchMedia("(min-width: 1024px)").matches;
|
||||
if (isNativeHost) {
|
||||
setHostSidebarOpen((v) => !v);
|
||||
setHostSidebarOpen(!hostSidebarOpen);
|
||||
} else {
|
||||
setMobileSidebarOpen((v) => !v);
|
||||
}
|
||||
}, []);
|
||||
}, [hostSidebarOpen, setHostSidebarOpen]);
|
||||
|
||||
const applyWorkspaceScope = useCallback(
|
||||
(scope: WorkspaceScopePayload) => {
|
||||
@@ -1814,21 +1826,9 @@ function Shell({
|
||||
setMobileSidebarOpen(false);
|
||||
}, [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(() => {
|
||||
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) => {
|
||||
if (!localActive) return;
|
||||
const action = matchSidebarShortcut(event);
|
||||
@@ -1838,7 +1838,7 @@ function Shell({
|
||||
};
|
||||
window.addEventListener("keydown", handleKeyDown);
|
||||
return () => window.removeEventListener("keydown", handleKeyDown);
|
||||
}, [localActive, onNewChat, onOpenSessionSearch, onOpenApps, onOpenSkills, onOpenAutomations, onOpenChannels, onOpenSettings]);
|
||||
}, [localActive, onNewChat, onOpenSessionSearch, onOpenApps, onOpenAutomations, onOpenSettings]);
|
||||
|
||||
const onSettingsSectionChange = useCallback(
|
||||
(section: SettingsSectionKey) => {
|
||||
@@ -2317,20 +2317,10 @@ function Shell({
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (view === "channels") {
|
||||
document.title = t("app.documentTitle.chat", { title: t("settings.nav.channels") });
|
||||
return;
|
||||
}
|
||||
if (view === "remote") {
|
||||
document.title = t("app.documentTitle.chat", { title: t("remote.title") });
|
||||
return;
|
||||
}
|
||||
if (view === "skills") {
|
||||
document.title = t("app.documentTitle.chat", {
|
||||
title: t("settings.nav.skills", { defaultValue: "Skills" }),
|
||||
});
|
||||
return;
|
||||
}
|
||||
document.title = activeSession
|
||||
? t("app.documentTitle.chat", { title: headerTitle })
|
||||
: t("app.documentTitle.base");
|
||||
@@ -2364,7 +2354,6 @@ function Shell({
|
||||
: null,
|
||||
loading: loading || sidebarStateLoading,
|
||||
initialLoading: sessionsInitialLoading || sidebarStateLoading,
|
||||
newChatActive: !managingConnections && view === "chat" && activeKey === null,
|
||||
onNewChat,
|
||||
onSelect: onSelectSidebarItem,
|
||||
onCloseTemporaryChat,
|
||||
@@ -2393,11 +2382,9 @@ function Shell({
|
||||
: undefined,
|
||||
onOpenApps,
|
||||
onOpenAutomations,
|
||||
onOpenChannels,
|
||||
onOpenSkills,
|
||||
onSettingsIntent,
|
||||
onOpenSearch: onOpenSessionSearch,
|
||||
activeUtility: !managingConnections && (view === "apps" || view === "automations" || view === "skills" || view === "channels") ? view : null,
|
||||
activeUtility: !managingConnections && (view === "apps" || view === "automations") ? view : null,
|
||||
onToggleArchived,
|
||||
pinnedKeys: sidebarPinnedTabKeys,
|
||||
archivedKeys: sidebarArchivedTabKeys,
|
||||
@@ -2460,29 +2447,34 @@ function Shell({
|
||||
<aside
|
||||
data-testid="host-sidebar-flow"
|
||||
data-resizing={sidebarDragging || undefined}
|
||||
data-collapsed={!hostSidebarOpen || undefined}
|
||||
id="main-sidebar"
|
||||
className={cn(
|
||||
"group/sidebar relative z-20 hidden shrink-0 overflow-hidden lg:block",
|
||||
sidebarDragging ? "select-none" : "transition-[width] duration-300 ease-out motion-reduce:transition-none",
|
||||
"sidebar-dock-frame group/sidebar relative z-20 hidden shrink-0 overflow-hidden bg-background lg:block",
|
||||
sidebarDragging && "select-none",
|
||||
)}
|
||||
data-theme-surface
|
||||
style={{
|
||||
width: hostSidebarFlowWidth,
|
||||
}}
|
||||
"--sidebar-open-width": `${sidebarWidth}px`,
|
||||
} as CSSProperties}
|
||||
>
|
||||
<div
|
||||
aria-hidden
|
||||
data-theme-surface
|
||||
className={cn(
|
||||
"absolute inset-y-0 left-0 h-full w-full overflow-hidden",
|
||||
showHostChrome
|
||||
? "host-sidebar-glass"
|
||||
: "bg-sidebar",
|
||||
"sidebar-dock-surface pointer-events-none absolute inset-0",
|
||||
showHostChrome ? "host-sidebar-glass" : "bg-sidebar",
|
||||
)}
|
||||
>
|
||||
/>
|
||||
<div className="absolute inset-0">
|
||||
<Sidebar
|
||||
{...sidebarProps}
|
||||
collapsed={!hostSidebarOpen}
|
||||
hostChromeInset={showHostChrome}
|
||||
onExpand={openHostSidebar}
|
||||
onCollapse={() => setHostSidebarOpen(false)}
|
||||
desktopDock
|
||||
/>
|
||||
</div>
|
||||
<SidebarResizeHandle
|
||||
@@ -2716,7 +2708,7 @@ function Shell({
|
||||
mainNavigationExpanded={showMainSidebar && hostSidebarOpen}
|
||||
hostChromeInset={showHostChrome}
|
||||
onBackToChat={onBackToChat}
|
||||
/> : <Suspense fallback={<StartupShell embedded surface={view} sidebarExpanded={hostSidebarOpen} />}>
|
||||
/> : <Suspense fallback={<StartupShell embedded surface={view === "apps" && isAppsSection(settingsInitialSection) ? settingsInitialSection : view} sidebarExpanded={hostSidebarOpen} />}>
|
||||
<SettingsView
|
||||
registerExitGuard={registerSettingsExitGuard}
|
||||
themePreference={themePreference}
|
||||
|
||||
@@ -5,11 +5,7 @@ export type ChannelPresentation = {
|
||||
initials: string;
|
||||
color: string;
|
||||
icon?: ComponentType<{ className?: string; strokeWidth?: string | number }>;
|
||||
logoUrl?: 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";
|
||||
logoUrl?: `/brand/${string}`;
|
||||
setup?: ChannelCatalogSetupPresentation;
|
||||
};
|
||||
|
||||
|
||||
@@ -266,7 +266,6 @@ interface ChatListProps {
|
||||
actionMenuPortalContainer?: HTMLElement | null;
|
||||
loading?: boolean;
|
||||
initialLoading?: boolean;
|
||||
emptyLabel?: string;
|
||||
}
|
||||
|
||||
export const ChatList = memo(function ChatList({
|
||||
@@ -309,7 +308,6 @@ export const ChatList = memo(function ChatList({
|
||||
actionMenuPortalContainer,
|
||||
loading,
|
||||
initialLoading = loading,
|
||||
emptyLabel,
|
||||
}: ChatListProps) {
|
||||
const { t } = useTranslation();
|
||||
const [visibleLimit, setVisibleLimit] = useState(INITIAL_VISIBLE_SESSIONS);
|
||||
@@ -638,13 +636,7 @@ export const ChatList = memo(function ChatList({
|
||||
);
|
||||
}
|
||||
|
||||
if (sessions.length === 0 && temporarySessions.length === 0) {
|
||||
return (
|
||||
<div className="px-3 py-6 text-[12px] leading-5 text-sidebar-muted-foreground">
|
||||
{emptyLabel ?? t("chat.noSessions")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (sessions.length === 0 && temporarySessions.length === 0) return null;
|
||||
|
||||
const running = new Set(runningChatIds);
|
||||
const updated = new Set(updatedChatIds);
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
import {
|
||||
ArchiveIcon,
|
||||
SkillsIcon,
|
||||
AutomationsIcon,
|
||||
ChannelsIcon,
|
||||
SearchIcon,
|
||||
SettingsIcon,
|
||||
NewChatIcon,
|
||||
ComposeIcon,
|
||||
AppsIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import {
|
||||
type ReactNode,
|
||||
type RefObject,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { PanelLeftClose } from "lucide-react";
|
||||
import { type ReactNode, useLayoutEffect, useRef, useState } from "react";
|
||||
import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import {
|
||||
@@ -39,6 +31,7 @@ import type {
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { UpdateMethod } from "@/lib/api";
|
||||
import { sidebarShortcutAria, sidebarShortcutLabel } from "@/lib/sidebar-shortcuts";
|
||||
import "./sidebar-dock.css";
|
||||
|
||||
interface SidebarProps {
|
||||
sessions: ChatSummary[];
|
||||
@@ -46,7 +39,6 @@ interface SidebarProps {
|
||||
activeKey: string | null;
|
||||
loading: boolean;
|
||||
initialLoading?: boolean;
|
||||
newChatActive: boolean;
|
||||
onNewChat: () => void;
|
||||
onSelect: (key: string) => void;
|
||||
onCloseTemporaryChat?: (key: string) => void;
|
||||
@@ -73,12 +65,10 @@ interface SidebarProps {
|
||||
onOpenUpdates?: () => void;
|
||||
availableUpdate?: { version: string; onDismiss: () => void; onRequestUpdate?: () => void; installationMethod?: UpdateMethod | null };
|
||||
onOpenApps: () => void;
|
||||
onOpenSkills: () => void;
|
||||
onOpenAutomations: () => void;
|
||||
onOpenChannels: () => void;
|
||||
onSettingsIntent?: () => void;
|
||||
onOpenSearch: () => void;
|
||||
activeUtility?: "apps" | "skills" | "automations" | "channels" | null;
|
||||
activeUtility?: "apps" | "automations" | null;
|
||||
onToggleArchived: () => void;
|
||||
onCollapse?: () => void;
|
||||
onExpand?: () => void;
|
||||
@@ -100,6 +90,7 @@ interface SidebarProps {
|
||||
archivedCount?: number;
|
||||
defaultWorkspacePath?: string | null;
|
||||
hostChromeInset?: boolean;
|
||||
desktopDock?: boolean;
|
||||
}
|
||||
|
||||
type NavigatorWithUserAgentData = Navigator & {
|
||||
@@ -119,36 +110,31 @@ export function Sidebar(props: SidebarProps) {
|
||||
const [menuPortalContainer, setMenuPortalContainer] =
|
||||
useState<HTMLElement | null>(null);
|
||||
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 collapseLabel = t("sidebar.collapse");
|
||||
const apple = isApplePlatform();
|
||||
const activeActionRef = useRef<HTMLButtonElement>(null);
|
||||
const activeActionId = collapsed && props.newChatActive
|
||||
? "new-chat"
|
||||
: props.activeUtility
|
||||
? `utility:${props.activeUtility}`
|
||||
: null;
|
||||
const activeUtilityId = props.activeUtility ? `utility:${props.activeUtility}` : null;
|
||||
const { desktopDock } = props;
|
||||
const footerActionProps = { collapsed, dockLabel: desktopDock, onIntent: props.onSettingsIntent, tooltipSide: "top" } as const;
|
||||
|
||||
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 = (
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
label={t("sidebar.searchAria")}
|
||||
shortcut={sidebarShortcutLabel("search", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("search")}
|
||||
iconOnly
|
||||
iconOnly={!desktopDock}
|
||||
dockLabel={desktopDock}
|
||||
onClick={props.onOpenSearch}
|
||||
icon={<SearchIcon className="h-4 w-4" />}
|
||||
/>
|
||||
@@ -161,134 +147,119 @@ export function Sidebar(props: SidebarProps) {
|
||||
data-theme-ink
|
||||
ref={props.containActionMenus ? setMenuPortalContainer : undefined}
|
||||
aria-label={t("sidebar.navigation")}
|
||||
data-sidebar-collapsed={desktopDock ? collapsed : undefined}
|
||||
className={cn(
|
||||
"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
|
||||
data-testid="sidebar-brand-row"
|
||||
className={cn(
|
||||
"flex items-start gap-1 pb-4 pt-3",
|
||||
collapsed ? "w-14 justify-start px-3" : "justify-between ps-4 pe-2",
|
||||
"flex items-start justify-between gap-1 pb-4 ps-3 pt-3",
|
||||
collapsed ? "w-14 pe-3" : "pe-2",
|
||||
)}
|
||||
>
|
||||
<button
|
||||
data-testid="sidebar-brand-mark"
|
||||
type="button"
|
||||
aria-label={collapsed ? toggleLabel : undefined}
|
||||
aria-hidden={collapsed ? undefined : true}
|
||||
title={collapsed ? toggleLabel : undefined}
|
||||
onClick={collapsed ? props.onExpand : undefined}
|
||||
tabIndex={collapsed ? 0 : -1}
|
||||
className={cn(
|
||||
"host-no-drag relative flex h-8 w-8 shrink-0 items-center justify-center rounded-control transition-colors",
|
||||
props.hostChromeInset && "mt-5",
|
||||
!collapsed && "pointer-events-none",
|
||||
)}
|
||||
>
|
||||
<img
|
||||
src="/brand/nanobot_mark.svg"
|
||||
alt=""
|
||||
className="theme-art h-8 w-8 select-none object-contain dark:opacity-0"
|
||||
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}
|
||||
/>
|
||||
</button>
|
||||
<HoverHint enabled={canExpand} content={toggleLabel} side="right">
|
||||
<Button
|
||||
ref={expandButton}
|
||||
data-testid="sidebar-brand-mark"
|
||||
type="button"
|
||||
size="icon"
|
||||
variant={canExpand ? "icon" : null}
|
||||
aria-label={canExpand ? toggleLabel : undefined}
|
||||
aria-expanded={canExpand ? false : undefined}
|
||||
aria-hidden={canExpand ? undefined : true}
|
||||
onClick={canExpand ? (event) => {
|
||||
restoreToggleFocus.current = event.detail === 0 && Boolean(props.onCollapse);
|
||||
props.onExpand?.();
|
||||
} : undefined}
|
||||
tabIndex={canExpand ? 0 : -1}
|
||||
className={cn(
|
||||
"host-no-drag group/brand relative h-8 w-8 shrink-0",
|
||||
props.hostChromeInset && "mt-5",
|
||||
!canExpand && "pointer-events-none",
|
||||
)}
|
||||
>
|
||||
<span className={cn("relative h-8 w-8", canExpand && "media-hover:group-hover/brand:opacity-0 group-focus-visible/brand:opacity-0")}>
|
||||
<img
|
||||
src="/brand/nanobot_mark.svg"
|
||||
alt=""
|
||||
className="theme-art h-8 w-8 select-none object-contain dark:opacity-0"
|
||||
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 && (
|
||||
<div className={cn("flex min-w-0 flex-1 items-center justify-end gap-1", props.hostChromeInset && "mt-5")}>
|
||||
{searchButton}
|
||||
{newChatButton}
|
||||
{!desktopDock && searchButton}
|
||||
{props.onCollapse && (
|
||||
<SidebarActionButton collapsed={false} label={t("sidebar.collapse")} iconOnly
|
||||
onClick={props.onCollapse} icon={<PanelLeftClose className="h-4 w-4" />} />
|
||||
<HoverHint content={collapseLabel} side="right">
|
||||
<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>
|
||||
|
||||
<SidebarSelectionHighlight
|
||||
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}</>}
|
||||
<div className={cn("flex flex-col gap-0.5 pb-1", desktopDock || collapsed ? "px-3" : "px-2")}>
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
label={t("sidebar.apps")}
|
||||
shortcut={sidebarShortcutLabel("apps", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("apps")}
|
||||
onClick={props.onOpenApps}
|
||||
onIntent={props.onSettingsIntent}
|
||||
active={props.activeUtility === "apps"}
|
||||
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" />}
|
||||
label={t("sidebar.newChat")}
|
||||
dockLabel={desktopDock}
|
||||
onClick={props.onNewChat}
|
||||
icon={<ComposeIcon className="h-4 w-4" />}
|
||||
shortcut={sidebarShortcutLabel("newChat", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("newChat")}
|
||||
/>
|
||||
{(desktopDock || collapsed) && searchButton}
|
||||
{props.archivedCount ? (
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
dockLabel={desktopDock}
|
||||
label={props.showArchived ? t("chat.hideArchived") : t("chat.showArchived")}
|
||||
onClick={props.onToggleArchived}
|
||||
icon={<ArchiveIcon className="h-4 w-4" />}
|
||||
/>
|
||||
) : null}
|
||||
</SidebarSelectionHighlight>
|
||||
</div>
|
||||
<div
|
||||
aria-hidden={collapsed || undefined}
|
||||
{...(collapsed ? { inert: "" } : {})}
|
||||
className={cn(
|
||||
"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden transition-opacity duration-200",
|
||||
collapsed && "pointer-events-none opacity-0",
|
||||
"flex min-h-0 flex-1 flex-col overflow-hidden",
|
||||
desktopDock ? "sidebar-dock-history" : "min-w-0",
|
||||
)}
|
||||
>
|
||||
{!collapsed && (
|
||||
{(desktopDock || !collapsed) && (
|
||||
<ChatList
|
||||
sessions={props.sessions}
|
||||
temporarySessions={props.temporarySessions}
|
||||
activeKey={props.activeKey}
|
||||
loading={props.loading}
|
||||
initialLoading={props.initialLoading}
|
||||
emptyLabel={t("chat.noSessions")}
|
||||
onSelect={props.onSelect}
|
||||
onCloseTemporaryChat={props.onCloseTemporaryChat}
|
||||
onRequestDelete={props.onRequestDelete}
|
||||
@@ -334,24 +305,56 @@ export function Sidebar(props: SidebarProps) {
|
||||
onRequestUpdate={props.availableUpdate.onRequestUpdate} installationMethod={props.availableUpdate.installationMethod} />
|
||||
)}
|
||||
<div
|
||||
data-testid="sidebar-footer"
|
||||
data-theme-surface
|
||||
className={cn(
|
||||
"flex items-center justify-between gap-1 px-2.5 py-3 text-xs",
|
||||
props.hostChromeInset && "bg-sidebar/55",
|
||||
collapsed && "w-14 flex-col px-0",
|
||||
"flex shrink-0 flex-col gap-0.5 px-2 py-3 text-xs",
|
||||
desktopDock && "px-3",
|
||||
props.hostChromeInset && !desktopDock && !collapsed && "bg-sidebar/55",
|
||||
collapsed && !desktopDock && "w-14 px-0",
|
||||
)}
|
||||
>
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
label={t("sidebar.settings")}
|
||||
iconOnly
|
||||
shortcut={sidebarShortcutLabel("settings", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("settings")}
|
||||
onClick={props.onOpenSettings}
|
||||
onIntent={props.onSettingsIntent}
|
||||
icon={<SettingsIcon className="h-4 w-4" />}
|
||||
/>
|
||||
<HostSwitcher collapsed={collapsed} portalContainer={props.containActionMenus ? menuPortalContainer : undefined} />
|
||||
<SidebarSelectionHighlight
|
||||
targetSelector=':scope > button[aria-current="page"]'
|
||||
activeId={activeUtilityId}
|
||||
scope="actions"
|
||||
className={cn("relative flex flex-col gap-0.5", collapsed && !desktopDock && "items-center")}
|
||||
>
|
||||
<SidebarActionButton
|
||||
{...footerActionProps}
|
||||
label={t("sidebar.apps")}
|
||||
shortcut={sidebarShortcutLabel("apps", apple)}
|
||||
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>
|
||||
</nav>
|
||||
);
|
||||
@@ -360,6 +363,7 @@ export function Sidebar(props: SidebarProps) {
|
||||
function SidebarActionButton({
|
||||
collapsed,
|
||||
iconOnly = false,
|
||||
dockLabel = false,
|
||||
label,
|
||||
icon,
|
||||
onClick,
|
||||
@@ -368,10 +372,11 @@ function SidebarActionButton({
|
||||
shortcut,
|
||||
ariaKeyShortcuts,
|
||||
onIntent,
|
||||
selectionRef,
|
||||
tooltipSide,
|
||||
}: {
|
||||
collapsed: boolean;
|
||||
iconOnly?: boolean;
|
||||
dockLabel?: boolean;
|
||||
label: string;
|
||||
icon: ReactNode;
|
||||
onClick: () => void;
|
||||
@@ -380,13 +385,12 @@ function SidebarActionButton({
|
||||
shortcut?: string;
|
||||
ariaKeyShortcuts?: string;
|
||||
onIntent?: () => void;
|
||||
selectionRef?: RefObject<HTMLButtonElement>;
|
||||
tooltipSide?: "top" | "bottom";
|
||||
}) {
|
||||
const compact = collapsed || iconOnly;
|
||||
|
||||
const button = (
|
||||
<Button
|
||||
ref={active ? selectionRef : undefined}
|
||||
type="button"
|
||||
variant={compact ? "icon" : null}
|
||||
aria-label={label}
|
||||
@@ -398,10 +402,9 @@ function SidebarActionButton({
|
||||
className={cn(
|
||||
"touch-target group h-8 min-w-0 gap-2 overflow-hidden rounded-control font-normal",
|
||||
SIDEBAR_SELECTION_ACTION_ITEM_CLASS,
|
||||
collapsed
|
||||
? "w-8 justify-center gap-0 px-0"
|
||||
: iconOnly ? "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]",
|
||||
dockLabel || !compact
|
||||
? "w-full justify-start gap-2 px-2 text-[13px] leading-5 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:stroke-[1.75]"
|
||||
: "w-8 shrink-0 justify-center gap-0 rounded-control px-0",
|
||||
active
|
||||
? "text-sidebar-accent-foreground"
|
||||
: compact
|
||||
@@ -413,13 +416,15 @@ function SidebarActionButton({
|
||||
<span className="flex shrink-0 items-center justify-center" aria-hidden>
|
||||
{icon}
|
||||
</span>
|
||||
{!compact && <span className="min-w-0 max-w-[12rem] truncate whitespace-nowrap">
|
||||
{label}
|
||||
</span>}
|
||||
{(dockLabel || !compact) && (
|
||||
<span aria-hidden={dockLabel || undefined} className={cn("min-w-0 max-w-48 truncate", dockLabel && "sidebar-dock-label")}>
|
||||
{label}
|
||||
</span>
|
||||
)}
|
||||
</Button>
|
||||
);
|
||||
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>
|
||||
{shortcut ? <kbd className="whitespace-nowrap font-sans text-muted-foreground">{shortcut}</kbd> : null}
|
||||
</>}>
|
||||
|
||||
@@ -37,7 +37,7 @@ export function SidebarResizeHandle({ width, open, onResize, onDraggingChange }:
|
||||
aria-valuemin={56}
|
||||
aria-valuemax={SIDEBAR_MAX_WIDTH}
|
||||
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) => {
|
||||
if (event.button !== 0) return;
|
||||
event.preventDefault();
|
||||
|
||||
@@ -21,7 +21,8 @@ export function readStartupLayout() {
|
||||
}
|
||||
const [path, query = ""] = hash.split("?", 2);
|
||||
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";
|
||||
if (page === "skills" || page === "apps" || page === "channels" || page === "automations" || page === "remote") surface = page;
|
||||
else if (path === "/settings") surface = "settings";
|
||||
@@ -90,10 +91,14 @@ export function StartupSkeleton({
|
||||
<div className="startup-scroll">
|
||||
<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-tabs"><Block /></div>
|
||||
<div className="startup-panel">
|
||||
<div className="startup-toolbar"><Block className="startup-search" /><Block className="startup-filters" /></div>
|
||||
<div className="startup-catalog-frame">
|
||||
<div className="startup-panel apps-catalog-layout">
|
||||
<div className="catalog-tabs startup-tabs"><Block /><Block /><Block /></div>
|
||||
<div className="catalog-controls startup-controls">
|
||||
<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">
|
||||
<div className="startup-catalog-group"><Block /></div>
|
||||
|
||||
@@ -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 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 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 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" /></>);
|
||||
|
||||
@@ -6,7 +6,6 @@ import { channelUiPresentation } from "@/channel-plugins/registry";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { floatingSurfaceElevationClassName } from "@/components/ui/floating-surface";
|
||||
import { useLogoFallback } from "@/hooks/useLogoFallback";
|
||||
import { logoFallbackUrls } from "@/lib/provider-brand";
|
||||
import type { PairingRequestInfo } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@@ -190,11 +189,8 @@ function PairingChannelBadge({ channel }: { channel: string }) {
|
||||
const presentation = pairingChannelPresentation(channel);
|
||||
const initials = presentation.initials;
|
||||
const color = presentation.color;
|
||||
const logoUrls = useMemo(
|
||||
() => logoFallbackUrls(presentation?.logoUrl),
|
||||
[presentation?.logoUrl],
|
||||
);
|
||||
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(logoUrls);
|
||||
const brandLogoUrl = presentation.logoUrl;
|
||||
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(brandLogoUrl ? [brandLogoUrl] : undefined);
|
||||
|
||||
return (
|
||||
<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" />}
|
||||
{!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>
|
||||
{!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>
|
||||
</Button>;
|
||||
const trigger = <TooltipTrigger asChild>{button}</TooltipTrigger>;
|
||||
|
||||
@@ -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 { Button } from "@/components/ui/button";
|
||||
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 type { EditCompletion } from "@/components/settings/shared/useEditCompletion";
|
||||
import { SharedProxySetupDialog } from "@/components/settings/shared/SharedProxySetupDialog";
|
||||
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 { AdvancedSettings } from "@/components/settings/capabilities/SecuritySettings";
|
||||
import { TranscriptionSettings } from "@/components/settings/capabilities/TranscriptionSettings";
|
||||
@@ -99,6 +101,8 @@ export function SettingsPage({
|
||||
const { client, webuiCapabilities } = useClient();
|
||||
const [dialogLayoutAnchor, setDialogLayoutAnchor] = useState<HTMLDivElement | null>(null);
|
||||
const [mcpSetupName, setMcpSetupName] = useState<string | null>(null);
|
||||
const [channelsQuery, setChannelsQuery] = useState("");
|
||||
const skillsSearch = useSkillsCatalogSearch();
|
||||
const presetDeletedCallback = useRef<(() => void) | null>(null);
|
||||
const [providerPanel, setProviderPanel] = useState<ProviderSettingsEntry | null>(null);
|
||||
const [proxySetupOpen, setProxySetupOpen] = useState(false);
|
||||
@@ -494,6 +498,7 @@ export function SettingsPage({
|
||||
case "channels":
|
||||
return (
|
||||
<ChannelsSettings
|
||||
query={channelsQuery}
|
||||
onBeforeCloseChange={registerChannelCompletion}
|
||||
onConfigureMcp={(name) => {
|
||||
setMcpSetupName(name);
|
||||
@@ -519,7 +524,6 @@ export function SettingsPage({
|
||||
);
|
||||
case "apps":
|
||||
return (
|
||||
<div className="settings-stack">
|
||||
<AppsCatalogPage
|
||||
onConfigureProxy={configureProxy}
|
||||
setupName={mcpSetupName}
|
||||
@@ -581,7 +585,6 @@ export function SettingsPage({
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={restartInProgress}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
case "automations":
|
||||
return (
|
||||
@@ -612,12 +615,24 @@ export function SettingsPage({
|
||||
</div>
|
||||
);
|
||||
case "skills":
|
||||
return <SkillsCatalogSettings skills={skills} loading={skillsLoading} error={skillsError} />;
|
||||
return <SkillsCatalogPage skills={skills} loading={skillsLoading} error={skillsError} searchState={skillsSearch} />;
|
||||
default:
|
||||
return renderSettingsSection(section, embedded);
|
||||
}
|
||||
};
|
||||
// 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 sectionReady = localSection || settings !== null || activeSection === "skills" || activeSection === "apps"
|
||||
|| activeSection === "channels" || activeSection === "automations";
|
||||
@@ -731,12 +746,12 @@ export function SettingsPage({
|
||||
|
||||
<div
|
||||
className={cn(
|
||||
"min-w-0 flex-1 bg-settings-canvas [scrollbar-gutter:stable]",
|
||||
"overflow-y-auto",
|
||||
"min-w-0 flex-1 overflow-y-auto bg-settings-canvas [scrollbar-gutter:stable]",
|
||||
!showSidebar && (appsSection || activeSection === "automations") && "sm:[scrollbar-gutter:stable_both-edges]",
|
||||
)}
|
||||
>
|
||||
<div
|
||||
key={activeSection}
|
||||
key={appsSection ? "apps" : activeSection}
|
||||
data-testid="settings-section-transition"
|
||||
ref={setDialogLayoutAnchor}
|
||||
data-settings-section={activeSection}
|
||||
@@ -747,7 +762,6 @@ export function SettingsPage({
|
||||
"settings-grid",
|
||||
activeSection === "about" && "flex min-h-full flex-col",
|
||||
!showSidebar && "settings-feature-page",
|
||||
!showSidebar && activeSection === "automations" && "settings-automations-grid",
|
||||
hostChromeInset && "pt-[4.25rem] sm:pt-[4.25rem] lg:pt-[4.75rem]",
|
||||
)}
|
||||
>
|
||||
@@ -762,7 +776,7 @@ export function SettingsPage({
|
||||
{t("settings.backToChat")}
|
||||
</button>
|
||||
{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),
|
||||
})}
|
||||
</h1> : null}
|
||||
@@ -781,17 +795,31 @@ export function SettingsPage({
|
||||
) : sectionReady ? (
|
||||
<div
|
||||
className={cn(
|
||||
"settings-stack",
|
||||
appsSection ? "apps-catalog-layout" : "settings-stack",
|
||||
activeSection === "about" && "flex flex-1 flex-col",
|
||||
activeSection === "channels" &&
|
||||
"flex min-h-0 flex-1 flex-col xl:overflow-hidden",
|
||||
)}
|
||||
>
|
||||
{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}
|
||||
</div>
|
||||
) : 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)}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
KeyRound,
|
||||
PowerOff,
|
||||
RefreshCw,
|
||||
Search,
|
||||
Terminal,
|
||||
Trash2,
|
||||
} from "lucide-react";
|
||||
@@ -26,33 +25,55 @@ import {
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Disclosure } from "@/components/ui/disclosure";
|
||||
import { ExpandableText } from "@/components/ui/expandable-text";
|
||||
import { SearchInput } from "@/components/ui/input";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { CatalogControls, CatalogFilter, CatalogToolbar } from "@/components/settings/shared/CatalogToolbar";
|
||||
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 { SkeletonStatus } from "@/components/settings/shared/SkeletonStatus";
|
||||
import { ToggleButton } from "@/components/ui/toggle-button";
|
||||
import { deleteSkill, fetchSkillDetail, updateSkillEnabled } from "@/lib/api";
|
||||
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 { 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[];
|
||||
loading?: 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 { view, setView, search } = searchState;
|
||||
const [selectedSkill, setSelectedSkill] = useState<SkillSummary | null>(null);
|
||||
const [view, setView] = useState<"installed" | "discover">("installed");
|
||||
const [installingSkill, setInstallingSkill] = useState("");
|
||||
const [installedQuery, setInstalledQuery] = useState("");
|
||||
const [marketplaceProvider, setMarketplaceProvider] = useState<MarketplaceProvider>("all");
|
||||
const [installedFilter, setInstalledFilter] = useState<"all" | "enabled" | "disabled">(
|
||||
"all",
|
||||
);
|
||||
const normalizedQuery = installedQuery.trim().toLowerCase();
|
||||
const normalizedQuery = view === "installed" ? search.value.trim().toLowerCase() : "";
|
||||
const filteredSkills = skills.filter((skill) => {
|
||||
const enabled = skill.enabled !== 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;
|
||||
|
||||
return (
|
||||
<div className="settings-stack">
|
||||
<SegmentedControl
|
||||
value={view}
|
||||
mode="tabs"
|
||||
ariaLabel={t("settings.skills.views", { defaultValue: "Skills views" })}
|
||||
className="w-fit text-[13px]"
|
||||
itemClassName="px-3.5"
|
||||
options={[
|
||||
{
|
||||
value: "installed",
|
||||
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]"
|
||||
<div className="catalog-section">
|
||||
<CatalogToolbar search={showSearch ? search : undefined}>
|
||||
<CatalogControls>
|
||||
<CatalogFilter label={t("settings.skills.views")} value={view} onChange={setView}
|
||||
options={[
|
||||
{ value: "installed", label: t("settings.skills.installedTab") },
|
||||
{ value: "discover", label: t("settings.skills.discoverTab") },
|
||||
]} />
|
||||
{view === "installed" ? (
|
||||
<CatalogFilter label={t("settings.apps.statusFilter")} value={installedFilter} onChange={setInstalledFilter}
|
||||
options={([
|
||||
["all", t("settings.skills.filterAll", { defaultValue: "All" }), skills.length],
|
||||
[
|
||||
"enabled",
|
||||
t("settings.skills.filterEnabled", { defaultValue: "Enabled" }),
|
||||
skills.length - disabledCount,
|
||||
],
|
||||
[
|
||||
"disabled",
|
||||
t("settings.skills.filterDisabled", { defaultValue: "Disabled" }),
|
||||
disabledCount,
|
||||
],
|
||||
["all", t("settings.skills.filterAll"), skills.length],
|
||||
["enabled", t("settings.skills.filterEnabled"), skills.length - disabledCount],
|
||||
["disabled", t("settings.skills.filterDisabled"), disabledCount],
|
||||
] as const).map(([value, label, count]) => ({
|
||||
value,
|
||||
label: (
|
||||
<>
|
||||
{label} <span className="ml-0.5 tabular-nums opacity-65">{loading || error ? "—" : count}</span>
|
||||
</>
|
||||
),
|
||||
}))}
|
||||
onChange={setInstalledFilter}
|
||||
/>
|
||||
</div>
|
||||
label: <><span>{label}</span><span className="tabular-nums opacity-65">{loading || error ? "—" : count}</span></>,
|
||||
}))} />
|
||||
) : <MarketplaceProviderFilter value={marketplaceProvider} onChange={setMarketplaceProvider} />}
|
||||
</CatalogControls>
|
||||
</CatalogToolbar>
|
||||
{view === "installed" ? (
|
||||
<section className="overflow-hidden rounded-panel bg-settings-surface pt-3">
|
||||
{loading ? (
|
||||
<CatalogSkeleton label={t("settings.skills.loading")} layout="skills" />
|
||||
) : error ? (
|
||||
@@ -193,6 +170,8 @@ export function SkillsCatalogSettings({ skills, loading = false, error = false }
|
||||
</section>
|
||||
) : (
|
||||
<SkillsMarketplace
|
||||
query={search.value}
|
||||
provider={marketplaceProvider}
|
||||
installedSkills={skills}
|
||||
installing={installingSkill}
|
||||
onInstallingChange={setInstallingSkill}
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
ExternalLink,
|
||||
Loader2,
|
||||
PackagePlus,
|
||||
Search,
|
||||
ShieldAlert,
|
||||
} from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -22,8 +21,7 @@ import {
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { SearchInput } from "@/components/ui/input";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { CatalogFilter } from "@/components/settings/shared/CatalogToolbar";
|
||||
import {
|
||||
ApiError,
|
||||
fetchMarketplaceSkillTrends,
|
||||
@@ -41,17 +39,20 @@ import { cn } from "@/lib/utils";
|
||||
import { useClient } from "@/providers/ClientProvider";
|
||||
|
||||
export function SkillsMarketplace({
|
||||
query,
|
||||
provider,
|
||||
installedSkills,
|
||||
installing,
|
||||
onInstallingChange,
|
||||
}: {
|
||||
query: string;
|
||||
provider: MarketplaceProvider;
|
||||
installedSkills: SkillSummary[];
|
||||
installing: string;
|
||||
onInstallingChange: (skillId: string) => void;
|
||||
}) {
|
||||
const { client, getToken } = useClient();
|
||||
const { t } = useTranslation();
|
||||
const [query, setQuery] = useState("");
|
||||
const [results, setResults] = useState<MarketplaceSkillSummary[]>([]);
|
||||
const [trending, setTrending] = useState<MarketplaceSkillSummary[]>([]);
|
||||
const [trends, setTrends] = useState<Record<string, number[]>>({});
|
||||
@@ -59,7 +60,6 @@ export function SkillsMarketplace({
|
||||
const [trendingLoading, setTrendingLoading] = useState(true);
|
||||
const [error, setError] = useState("");
|
||||
const [installError, setInstallError] = useState("");
|
||||
const [provider, setProvider] = useState<MarketplaceProvider>("all");
|
||||
const [selected, setSelected] = useState<MarketplaceSkillSummary | null>(null);
|
||||
const installTrigger = useRef<HTMLElement | null>(null);
|
||||
const selectSkill = (skill: MarketplaceSkillSummary) => {
|
||||
@@ -196,38 +196,8 @@ export function SkillsMarketplace({
|
||||
};
|
||||
|
||||
return (
|
||||
<section className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<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>
|
||||
<section className="grid gap-4">
|
||||
{loading ? <span className="sr-only" role="status">{t("settings.skills.marketplaceSearching")}</span> : null}
|
||||
|
||||
{error || installError ? (
|
||||
<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,
|
||||
onChange,
|
||||
}: {
|
||||
@@ -371,24 +341,12 @@ function ProviderFilter({
|
||||
const { t } = useTranslation();
|
||||
const providers: MarketplaceProvider[] = ["all", "skills_sh", "skillhub"];
|
||||
return (
|
||||
<SegmentedControl
|
||||
<CatalogFilter
|
||||
value={value}
|
||||
mode="tabs"
|
||||
ariaLabel={t("settings.skills.marketplaceProviderFilter", {
|
||||
defaultValue: "Skill source",
|
||||
})}
|
||||
className="w-fit bg-settings-surface"
|
||||
itemClassName="inline-flex h-7 items-center gap-1.5"
|
||||
label={t("settings.skills.marketplaceProviderFilter")}
|
||||
options={providers.map((provider) => ({
|
||||
value: provider,
|
||||
label: (
|
||||
<>
|
||||
{provider !== "all" ? <ProviderDot provider={provider} /> : null}
|
||||
{provider === "all"
|
||||
? t("settings.skills.marketplaceProviderAll", { defaultValue: "All" })
|
||||
: providerLabel(provider)}
|
||||
</>
|
||||
),
|
||||
label: provider === "all" ? t("settings.skills.marketplaceProviderAll") : providerLabel(provider),
|
||||
}))}
|
||||
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 { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -16,6 +16,8 @@ import { Button } from "@/components/ui/button";
|
||||
import type { NanobotFeatureInfo } from "@/lib/types";
|
||||
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({
|
||||
feature,
|
||||
showBrandLogos,
|
||||
@@ -28,7 +30,7 @@ export function ChannelCatalogRow({
|
||||
}: {
|
||||
feature: NanobotFeatureInfo;
|
||||
showBrandLogos: boolean;
|
||||
onSelect: (connect?: boolean) => void;
|
||||
onSelect: (trigger: HTMLButtonElement | null, connect?: boolean) => void;
|
||||
actionKey: string | null;
|
||||
restartRequired?: boolean;
|
||||
onAction: ChannelFeatureAction;
|
||||
@@ -47,6 +49,9 @@ export function ChannelCatalogRow({
|
||||
const actionsDisabled = restartRequired || isRestarting;
|
||||
const showInstallRestartHint = feature.install_supported && actionsDisabled;
|
||||
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);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -55,17 +60,18 @@ export function ChannelCatalogRow({
|
||||
return () => window.clearTimeout(timeout);
|
||||
}, [installHint]);
|
||||
|
||||
const pointToInstall = () => {
|
||||
setInstallHint(true);
|
||||
installButtonRef.current?.focus();
|
||||
};
|
||||
const channelIdentity = (
|
||||
<>
|
||||
<ChannelLogo feature={feature} showBrandLogos={showBrandLogos} />
|
||||
<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}
|
||||
</h3>
|
||||
{failed ? (
|
||||
<div id={statusId} className="mt-0.5">
|
||||
<ChannelStatusBadge status="failed">{channelStatusLabel(feature, tx)}</ChannelStatusBadge>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
@@ -86,22 +92,23 @@ export function ChannelCatalogRow({
|
||||
name: displayName,
|
||||
defaultValue: "View {{name}} settings",
|
||||
})}
|
||||
aria-haspopup="dialog"
|
||||
aria-haspopup={feature.installed ? "dialog" : undefined}
|
||||
aria-describedby={failed ? statusId : undefined}
|
||||
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"
|
||||
>
|
||||
{channelIdentity}
|
||||
</button>
|
||||
)}
|
||||
{feature.runtime_status === "failed" ? (
|
||||
<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">
|
||||
<div className="flex w-11 shrink-0 items-center justify-center">
|
||||
{!feature.installed ? (
|
||||
<HoverHint enabled={showInstallRestartHint}
|
||||
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">
|
||||
<Button ref={installButtonRef} type="button" variant="outline" size="icon"
|
||||
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",
|
||||
)}
|
||||
disabled={actionsDisabled || anyActionBusy || !feature.install_supported}
|
||||
@@ -130,7 +137,7 @@ export function ChannelCatalogRow({
|
||||
) : feature.restart_pending ? (
|
||||
<HoverHint content={t("settings.channels.restartRequired")}>
|
||||
<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-busy={isRestarting}
|
||||
disabled={isRestarting || anyActionBusy || !onRestart}
|
||||
@@ -141,12 +148,12 @@ export function ChannelCatalogRow({
|
||||
</Button>
|
||||
</HoverHint>
|
||||
) : (
|
||||
<ToggleButton checked={checked}
|
||||
<ToggleButton ref={toggleRef} checked={checked}
|
||||
label={checked ? tx("settings.values.on", "On") : tx("settings.values.off", "Off")}
|
||||
disabled={alwaysEnabled || actionsDisabled || anyActionBusy}
|
||||
ariaLabel={t("settings.channels.toggleChannel", { name: displayName, defaultValue: "{{name}} channel" })}
|
||||
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);
|
||||
}} />
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import i18n from "i18next";
|
||||
import { useMemo, type ReactNode } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import {
|
||||
@@ -19,7 +19,6 @@ import type {
|
||||
import { channelValidationMessage } from "@/components/settings/channels/validationMessages";
|
||||
import { useLogoFallback } from "@/hooks/useLogoFallback";
|
||||
import { normalizeLocale } from "@/i18n/config";
|
||||
import { logoFallbackUrls } from "@/lib/provider-brand";
|
||||
import type { ChannelRuntimeStatus, NanobotFeatureInfo } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@@ -154,23 +153,17 @@ export function ChannelLogo({
|
||||
?? channelUiPresentation(feature.name);
|
||||
const initials = presentation?.initials ?? feature.display_name.slice(0, 2).toUpperCase();
|
||||
const Icon = presentation?.icon;
|
||||
const logoUrls = useMemo(() => {
|
||||
const fallbackUrls = logoFallbackUrls(presentation?.logoFallbackUrl ?? presentation?.logoUrl);
|
||||
return presentation?.logoUrl && presentation.logoFallbackUrl
|
||||
? [...new Set([presentation.logoUrl, ...fallbackUrls])]
|
||||
: 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;
|
||||
const brandLogoUrl = presentation?.logoUrl;
|
||||
const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(brandLogoUrl ? [brandLogoUrl] : undefined);
|
||||
const showLogo = showBrandLogos && Boolean(logoUrl);
|
||||
const showLoadedLogo = showLogo && logoLoaded;
|
||||
|
||||
return (
|
||||
<span
|
||||
data-testid={`channel-logo-${feature.name}`}
|
||||
className={cn(
|
||||
"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
|
||||
>
|
||||
@@ -180,7 +173,7 @@ export function ChannelLogo({
|
||||
)}>
|
||||
{Icon ? <Icon className="h-6 w-6" strokeWidth={2} /> : initials}
|
||||
</span>
|
||||
{showRemoteLogo ? <img
|
||||
{showLogo ? <img
|
||||
src={logoUrl}
|
||||
alt=""
|
||||
decoding="async"
|
||||
@@ -188,8 +181,7 @@ export function ChannelLogo({
|
||||
referrerPolicy="no-referrer"
|
||||
draggable={false}
|
||||
className={cn(
|
||||
"absolute object-contain transition-opacity duration-150 motion-reduce:transition-none",
|
||||
isLogoTile ? "h-8 w-8" : "h-6 w-6",
|
||||
"absolute h-6 w-6 object-contain transition-opacity duration-150 motion-reduce:transition-none",
|
||||
logoLoaded ? "opacity-100" : "opacity-0",
|
||||
)}
|
||||
onLoad={onLogoLoad}
|
||||
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
} from "@/components/settings/channels/ChannelIdentity";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useLogoFallback } from "@/hooks/useLogoFallback";
|
||||
import { logoFallbackUrls } from "@/lib/provider-brand";
|
||||
import type {
|
||||
NanobotChannelInstanceInfo,
|
||||
NanobotFeatureInfo,
|
||||
@@ -344,8 +343,8 @@ function ChannelInstanceAvatar({
|
||||
}) {
|
||||
const presentation = channelUiPresentation(feature.name, feature.webui);
|
||||
const [avatarFailed, setAvatarFailed] = useState(false);
|
||||
const fallbackLogoUrls = useMemo(() => logoFallbackUrls(presentation?.logoUrl), [presentation?.logoUrl]);
|
||||
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(fallbackLogoUrls);
|
||||
const brandLogoUrl = presentation?.logoUrl;
|
||||
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(brandLogoUrl ? [brandLogoUrl] : undefined);
|
||||
const remoteAvatarUrl = !avatarFailed ? instance.avatar_url?.trim() : "";
|
||||
const imageUrl = remoteAvatarUrl || (showBrandLogos ? logoUrl : "");
|
||||
const Icon = presentation?.icon;
|
||||
|
||||
@@ -20,6 +20,12 @@ export type SettingsSectionKey =
|
||||
| "runtime"
|
||||
| "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 {
|
||||
return ["capabilities", "image", "voice", "browser", "memory"].includes(section);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export function CatalogSkeleton({ label, layout, appActionLabel }: {
|
||||
</div>
|
||||
) : <>{icon}{text}</>}
|
||||
<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 ? <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" />
|
||||
|
||||
@@ -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,
|
||||
PlayCircle,
|
||||
Plus,
|
||||
Search,
|
||||
TriangleAlert,
|
||||
Trash2,
|
||||
} from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
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 {
|
||||
DismissibleStatusMessage,
|
||||
RestartRequiredNotice,
|
||||
SETTINGS_SEARCH_INPUT_CLASS,
|
||||
SettingsSectionTitle,
|
||||
} from "@/components/settings/shared/SettingsControls";
|
||||
import { AgentPluginDialog } from "@/components/settings/system/AgentPluginDialog";
|
||||
@@ -53,7 +52,7 @@ import {
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} 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 { Textarea } from "@/components/ui/textarea";
|
||||
import { SettingsTextEditor } from "@/components/settings/shared/SettingsTextEditor";
|
||||
@@ -68,7 +67,10 @@ import type {
|
||||
} from "@/lib/types";
|
||||
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 =
|
||||
| { id: string; kind: "cli"; app: CliAppInfo }
|
||||
| { 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">) {
|
||||
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(
|
||||
props.cliApps?.apps.some((app) => app.installed) || props.mcpPresets?.presets.some(mcpPresetReady),
|
||||
);
|
||||
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(() => {
|
||||
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]);
|
||||
|
||||
return <AppsCatalogSettings {...props} filter={filter} onFilterChange={setSelection} />;
|
||||
return <AppsCatalogSettings {...props} filter={filter} onFilterChange={setSelection} showSearch={false} />;
|
||||
}
|
||||
|
||||
export function AppsCatalogSettings({
|
||||
@@ -129,6 +131,7 @@ export function AppsCatalogSettings({
|
||||
cliAppsLoading,
|
||||
mcpPresetsLoading,
|
||||
query,
|
||||
showSearch = true,
|
||||
filter,
|
||||
cliActionKey,
|
||||
mcpActionKey,
|
||||
@@ -175,7 +178,8 @@ export function AppsCatalogSettings({
|
||||
cliAppsLoading: boolean;
|
||||
mcpPresetsLoading: boolean;
|
||||
query: string;
|
||||
filter: AppsKindFilter;
|
||||
showSearch?: boolean;
|
||||
filter: AppsCatalogFilter;
|
||||
cliActionKey: string | null;
|
||||
mcpActionKey: string | null;
|
||||
mcpOAuthFlow: McpOAuthFlowPayload | null;
|
||||
@@ -194,7 +198,7 @@ export function AppsCatalogSettings({
|
||||
showBrandLogos: boolean;
|
||||
requiresRestartPending: boolean;
|
||||
onQueryChange: (value: string) => void;
|
||||
onFilterChange: (value: AppsKindFilter) => void;
|
||||
onFilterChange: (value: AppsCatalogFilter) => 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;
|
||||
onMcpOAuthConnect: (name: string, reset?: boolean, values?: Record<string, string>) => void;
|
||||
@@ -215,12 +219,12 @@ export function AppsCatalogSettings({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const tx = (key: string, fallback: string) => t(key, { defaultValue: fallback });
|
||||
const filterOptions = [
|
||||
{ value: "ready", label: tx("settings.apps.filterAll", "Ready") },
|
||||
const kindOptions = [
|
||||
{ value: "all", label: t("settings.apps.allTypes") },
|
||||
{ value: "cli", label: tx("settings.apps.filterCli", "CLI Apps") },
|
||||
{ value: "plugins", label: tx("settings.apps.filterPlugins", "Plugins") },
|
||||
{ value: "mcp", label: tx("settings.apps.filterMcp", "MCP") },
|
||||
];
|
||||
] as const;
|
||||
const normalizedQuery = query.trim().toLowerCase();
|
||||
const installedCliNames = new Set((cliApps?.apps ?? []).filter((app) => app.installed).map((app) => app.name));
|
||||
const managedPlugins = new Map(
|
||||
@@ -228,50 +232,39 @@ export function AppsCatalogSettings({
|
||||
.filter((preset) => preset.source === "agent-plugin" && preset.managed_by_cli)
|
||||
.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 })),
|
||||
...(mcpPresets?.presets ?? [])
|
||||
.filter((preset) => !preset.managed_by_cli || !installedCliNames.has(preset.managed_by_cli))
|
||||
.map((preset) => ({ id: `mcp:${preset.name}`, kind: "mcp" as const, preset })),
|
||||
]
|
||||
.filter((item) => {
|
||||
const matchesFilter = filter === "ready"
|
||||
? appsReady(item)
|
||||
: filter === "cli"
|
||||
? item.kind === "cli"
|
||||
: filter === "plugins"
|
||||
? item.kind === "mcp" && item.preset.source === "agent-plugin"
|
||||
: item.kind === "mcp" && item.preset.source !== "agent-plugin";
|
||||
return matchesFilter && (!normalizedQuery || appsSearchText(item).includes(normalizedQuery));
|
||||
})
|
||||
.sort((left, right) => {
|
||||
const rank = Number(!appsReady(left)) - Number(!appsReady(right));
|
||||
return rank || appsTitle(left).localeCompare(appsTitle(right));
|
||||
});
|
||||
];
|
||||
const matches = catalogItems.filter((item) => {
|
||||
const matchesKind = filter.kind === "all" || (filter.kind === "cli"
|
||||
? item.kind === "cli"
|
||||
: filter.kind === "plugins"
|
||||
? item.kind === "mcp" && item.preset.source === "agent-plugin"
|
||||
: item.kind === "mcp" && item.preset.source !== "agent-plugin");
|
||||
return matchesKind && (!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));
|
||||
return rank || appsTitle(left).localeCompare(appsTitle(right));
|
||||
});
|
||||
const hiddenByReadyFilter = matches.length > items.length;
|
||||
const focusedApp = cliFocusName
|
||||
? (cliApps?.apps ?? []).find((app) => app.name === cliFocusName && app.installed)
|
||||
: null;
|
||||
const loading = (mcpPresetsLoading && !mcpPresets)
|
||||
|| (filter !== "mcp" && cliAppsLoading && !cliApps);
|
||||
const cliAppCount = cliApps?.apps.length ?? 0;
|
||||
const emptyTitle = normalizedQuery
|
||||
? tx("settings.apps.empty", "No tools match your search.")
|
||||
: filter === "cli"
|
||||
? tx("settings.apps.emptyApps", "No apps available.")
|
||||
: filter === "plugins"
|
||||
? tx("settings.apps.emptyPlugins", "No Agent Plugins installed.")
|
||||
: filter === "mcp"
|
||||
? tx("settings.apps.emptyIntegrations", "No MCP 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";
|
||||
|| (filter.kind !== "mcp" && cliAppsLoading && !cliApps);
|
||||
const emptyTitle = hiddenByReadyFilter
|
||||
? tx("settings.apps.emptyReady", "No tools are ready yet")
|
||||
: normalizedQuery
|
||||
? tx("settings.apps.empty", "No tools match your search")
|
||||
: filter.kind === "plugins"
|
||||
? tx("settings.apps.emptyPlugins", "No Agent Plugins installed")
|
||||
: filter.kind === "mcp"
|
||||
? tx("settings.apps.emptyIntegrations", "No MCP tools available")
|
||||
: tx("settings.apps.emptyApps", "No tools available");
|
||||
const statusMessage =
|
||||
cliError ||
|
||||
mcpError ||
|
||||
@@ -286,30 +279,20 @@ export function AppsCatalogSettings({
|
||||
)
|
||||
: "";
|
||||
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>
|
||||
<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 ? (
|
||||
<DismissibleStatusMessage
|
||||
@@ -334,9 +317,9 @@ export function AppsCatalogSettings({
|
||||
<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">
|
||||
<SettingsSectionTitle>
|
||||
{filter === "mcp"
|
||||
{filter.kind === "mcp"
|
||||
? tx("settings.apps.mcpTools", "MCP tools")
|
||||
: filter === "plugins"
|
||||
: filter.kind === "plugins"
|
||||
? tx("settings.apps.filterPlugins", "Plugins")
|
||||
: tx("settings.apps.featured", "Tools")}
|
||||
</SettingsSectionTitle>
|
||||
@@ -373,7 +356,7 @@ export function AppsCatalogSettings({
|
||||
oauthCompleting={mcpOAuthCompleting}
|
||||
oauthCallbackError={mcpOAuthCallbackError}
|
||||
showBrandLogos={showBrandLogos}
|
||||
showTypeBadge={filter !== "mcp"}
|
||||
showTypeBadge={filter.kind !== "mcp"}
|
||||
onFieldChange={onMcpFieldChange}
|
||||
onAction={onMcpAction}
|
||||
onOAuthConnect={onMcpOAuthConnect}
|
||||
@@ -389,11 +372,11 @@ export function AppsCatalogSettings({
|
||||
) : null}
|
||||
{loading ? (
|
||||
<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 ? (
|
||||
<div className="px-3 py-12 text-center text-sm text-muted-foreground">
|
||||
<p>{emptyTitle}</p>
|
||||
{normalizedQuery ? (
|
||||
{hiddenByReadyFilter ? null : normalizedQuery ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
@@ -402,29 +385,18 @@ export function AppsCatalogSettings({
|
||||
>
|
||||
{tx("settings.apps.clearSearch", "Clear search")}
|
||||
</Button>
|
||||
) : emptyBrowseTarget ? (
|
||||
<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>
|
||||
) : (
|
||||
) : filter.kind === "mcp" || filter.kind === "plugins" ? (
|
||||
<p className="mx-auto mt-2 max-w-[28rem] text-[12px] leading-5">
|
||||
{filter === "plugins"
|
||||
? 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.")}
|
||||
{filter.kind === "mcp"
|
||||
? 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>
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
|
||||
{filter === "mcp" ? (
|
||||
{filter.kind === "mcp" ? (
|
||||
<McpCustomServerPanel
|
||||
onConfigureProxy={onConfigureProxy}
|
||||
form={customMcpForm}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
||||
import { Search, X } from "lucide-react";
|
||||
import { X } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { SearchInput } from "@/components/ui/input";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { SETTINGS_SEARCH_INPUT_CLASS } from "@/components/settings/shared/SettingsControls";
|
||||
import { CatalogControls, CatalogToggle, CatalogToolbar } from "@/components/settings/shared/CatalogToolbar";
|
||||
import { CatalogSkeleton } from "@/components/settings/shared/CatalogSkeleton";
|
||||
import type { ChannelFeatureAction } from "@/channel-plugins/types";
|
||||
import { ChannelCatalogRow } from "@/components/settings/channels/ChannelCatalogRow";
|
||||
@@ -18,7 +16,7 @@ import { Dialog, DialogClose, DialogContent, DialogTitle } from "@/components/ui
|
||||
type ChannelFilter = "all" | "enabled";
|
||||
|
||||
export function ChannelsSettings({
|
||||
token, nanobotFeatures, loading, actionKey, chatAppsDocsUrl, showBrandLogos,
|
||||
token, nanobotFeatures, loading, actionKey, chatAppsDocsUrl, showBrandLogos, query,
|
||||
error, requiresRestartPending, onAction, onFeaturesUpdate, onDismissStatus,
|
||||
onRestart, isRestarting, onConfigureMcp, onBeforeCloseChange,
|
||||
}: {
|
||||
@@ -28,6 +26,7 @@ export function ChannelsSettings({
|
||||
actionKey: string | null;
|
||||
chatAppsDocsUrl?: string;
|
||||
showBrandLogos: boolean;
|
||||
query: string;
|
||||
error: string | null;
|
||||
requiresRestartPending: boolean;
|
||||
onAction: ChannelFeatureAction;
|
||||
@@ -40,11 +39,10 @@ export function ChannelsSettings({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [selectedChannelName, setSelectedChannelName] = useState<string | null>(null);
|
||||
const [query, setQuery] = useState("");
|
||||
const [filter, setFilter] = useState<ChannelFilter>("enabled");
|
||||
const [connectRequestId, setConnectRequestId] = useState(0);
|
||||
const filterInitializedRef = useRef(false);
|
||||
const triggerRef = useRef<HTMLElement | null>(null);
|
||||
const triggerRef = useRef<HTMLButtonElement | null>(null);
|
||||
const dialogRef = useRef<HTMLDivElement | null>(null);
|
||||
const beforeCloseRef = useRef<(() => Promise<boolean>) | null>(null);
|
||||
const closePendingRef = useRef(false);
|
||||
@@ -103,23 +101,16 @@ export function ChannelsSettings({
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="settings-stack">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center">
|
||||
<div className="relative min-w-0 flex-1">
|
||||
<Search className="pointer-events-none absolute start-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden />
|
||||
<SearchInput type="search" value={query} onChange={(event) => setQuery(event.target.value)}
|
||||
aria-label={t("settings.channels.search")}
|
||||
placeholder={t("settings.channels.search")}
|
||||
className={`h-12 ps-11 text-[15px] ${SETTINGS_SEARCH_INPUT_CLASS}`} />
|
||||
</div>
|
||||
<SegmentedControl value={filter} onChange={(value) => {
|
||||
filterInitializedRef.current = true;
|
||||
setFilter(value);
|
||||
}} options={[
|
||||
{ value: "all", label: t("settings.channels.filterAll") },
|
||||
{ value: "enabled", label: t("settings.channels.filterEnabled") },
|
||||
]} />
|
||||
</div>
|
||||
<div className="catalog-section">
|
||||
<CatalogToolbar>
|
||||
<CatalogControls>
|
||||
<CatalogToggle label={t("settings.channels.enabledOnly")} checked={filter === "enabled"}
|
||||
onChange={(enabled) => {
|
||||
filterInitializedRef.current = true;
|
||||
setFilter(enabled ? "enabled" : "all");
|
||||
}} />
|
||||
</CatalogControls>
|
||||
</CatalogToolbar>
|
||||
{error && !selectedChannel ? <DismissibleStatusMessage message={error} isError onDismiss={onDismissStatus} /> : null}
|
||||
{restartRequired && !hasPendingChannelRestart ? (
|
||||
<RestartRequiredNotice message={t("settings.channels.restartRequired")}
|
||||
@@ -146,8 +137,8 @@ export function ChannelsSettings({
|
||||
<ChannelCatalogRow key={feature.name} feature={feature} showBrandLogos={showBrandLogos}
|
||||
actionKey={actionKey} restartRequired={restartRequired} onAction={onAction}
|
||||
onRestart={onRestart} isRestarting={isRestarting}
|
||||
onSelect={(connect = false) => {
|
||||
triggerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
||||
onSelect={(trigger, connect = false) => {
|
||||
triggerRef.current = trigger;
|
||||
beforeCloseRef.current = null;
|
||||
setConnectRequestId(connect ? 1 : 0);
|
||||
setSelectedChannelName(feature.name);
|
||||
@@ -168,7 +159,10 @@ export function ChannelsSettings({
|
||||
event.preventDefault();
|
||||
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>
|
||||
<div className="max-h-[85dvh] min-h-0 overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
|
||||
<div className="relative">
|
||||
|
||||
@@ -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; }
|
||||
@@ -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-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-shell[data-sidebar-expanded="false"] .startup-navigation { background: transparent; }
|
||||
.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-icon { flex: 0 0 16px; height: 16px; }
|
||||
.startup-nav-label { width: 96px; height: 12px; }
|
||||
.startup-content { flex: 1; min-width: 0; height: 100%; }
|
||||
.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-back { display: flex; align-items: center; height: 30px; margin-bottom: 16px; padding-left: 10px; }
|
||||
@media (pointer: coarse) { .startup-back { height: 44px; } }
|
||||
.startup-back .startup-block { width: 96px; height: 12px; }
|
||||
.startup-title { display: flex; align-items: center; height: 30px; }
|
||||
.startup-title .startup-block { width: 112px; height: 24px; }
|
||||
.startup-tabs { display: none; height: 35.5px; margin-bottom: 20px; }
|
||||
.startup-tabs .startup-block { width: 174px; height: 100%; border-radius: 9999px; }
|
||||
.startup-toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
|
||||
.startup-search { flex: 1; height: 48px; min-height: 48px; border-radius: 9999px; }
|
||||
.startup-filters { width: 100%; height: 34px; border-radius: 9999px; }
|
||||
.startup-tabs { display: flex; gap: 4px; width: 208px; height: 36px; padding: 4px; border-radius: 12px; background: var(--startup-surface); }
|
||||
.startup-tabs .startup-block { flex: 1; height: 28px; border-radius: 8px; }
|
||||
.startup-search { height: 36px; border-radius: 12px; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-primary-choices > :nth-child(n+3),
|
||||
.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 .startup-block { width: 40px; }
|
||||
.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-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-shell[data-startup-surface="skills"] .startup-tabs { display: block; }
|
||||
.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-frame { overflow: hidden; padding-top: 12px; border-radius: 22px; background: var(--startup-surface); }
|
||||
.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-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-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-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-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[data-startup-surface="automations"] .startup-page { max-width: 984px; }
|
||||
.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 .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-chat-layout { display: flex; flex-direction: column; }
|
||||
.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; }
|
||||
@media (min-width: 640px) {
|
||||
.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-footer { padding-inline: 16px; }
|
||||
.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-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="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-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="settings"] .startup-page { padding-inline: 32px; }
|
||||
.startup-shell[data-startup-surface="automations"] .startup-page { max-width: 992px; }
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
.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-back { 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; }
|
||||
}
|
||||
@media (min-width: 1280px) {
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
import type { ComponentProps } from "react";
|
||||
import { forwardRef, type ComponentProps } from "react";
|
||||
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,
|
||||
disabled,
|
||||
onChange,
|
||||
ariaLabel,
|
||||
label,
|
||||
...accessibility
|
||||
}: {
|
||||
checked: boolean;
|
||||
disabled?: boolean;
|
||||
onChange: (checked: boolean) => void;
|
||||
ariaLabel?: string;
|
||||
label: string;
|
||||
} & Pick<ComponentProps<"button">, "id" | "aria-describedby" | "aria-invalid">) {
|
||||
}, ref) {
|
||||
return (
|
||||
<button
|
||||
ref={ref}
|
||||
{...accessibility}
|
||||
type="button"
|
||||
role="switch"
|
||||
@@ -48,4 +51,4 @@ export function ToggleButton({
|
||||
<span className="sr-only">{label}</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -1,3 +1,6 @@
|
||||
@import "./components/content-column.css";
|
||||
@import "./components/settings/shared/catalog-layout.css";
|
||||
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
@@ -19,7 +22,7 @@
|
||||
}
|
||||
|
||||
.thread-composer-stack {
|
||||
--composer-content-width: 49.5rem;
|
||||
--composer-content-width: var(--content-column-width);
|
||||
}
|
||||
.thread-composer-stack.is-hero {
|
||||
--composer-content-width: 58rem;
|
||||
@@ -133,7 +136,6 @@
|
||||
--radius-prominent: 1.75rem;
|
||||
--radius-pill: 9999px;
|
||||
--corner-shape: superellipse(1.5);
|
||||
--content-column-width: 49.5rem;
|
||||
--sidebar: 40 8% 96.8%;
|
||||
--sidebar-foreground: 0 0% 3.9%;
|
||||
--sidebar-content: 240 3% 30%;
|
||||
@@ -1468,8 +1470,10 @@
|
||||
--settings-margin: 0.75rem;
|
||||
max-inline-size: calc(var(--content-column-width) + 2 * var(--settings-margin));
|
||||
}
|
||||
.settings-grid.settings-feature-page.settings-automations-grid {
|
||||
max-inline-size: calc(60rem + 2 * var(--settings-margin));
|
||||
.catalog-section {
|
||||
display: grid;
|
||||
min-inline-size: 0;
|
||||
gap: var(--settings-module-gap, 20px);
|
||||
}
|
||||
.automations-page {
|
||||
--settings-inset: 1rem;
|
||||
@@ -1495,6 +1499,7 @@
|
||||
}
|
||||
.automation-create-composer .thread-composer-collapsible-layout {
|
||||
padding-block-start: 0;
|
||||
padding-inline: 0;
|
||||
}
|
||||
/* Match the main sidebar's lg visibility; its collapsed rail has no labels. */
|
||||
@media (min-width: 1024px) {
|
||||
|
||||
@@ -454,10 +454,7 @@
|
||||
"ariaLabel": "Change language"
|
||||
},
|
||||
"apps": "Apps",
|
||||
"automations": "Automations",
|
||||
"skills": {
|
||||
"title": "Skills"
|
||||
}
|
||||
"automations": "Automations"
|
||||
},
|
||||
"settings": {
|
||||
"timezoneNoMatches": "No matching timezones.",
|
||||
@@ -1438,12 +1435,15 @@
|
||||
"enable": "Enable tracing"
|
||||
},
|
||||
"apps": {
|
||||
"allTypes": "All",
|
||||
"typeFilter": "Tool type",
|
||||
"statusFilter": "Status",
|
||||
"description": "Manage CLI Apps, Agent Plugins, and MCP tools.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "Channel",
|
||||
"featureLabel": "Feature",
|
||||
"filterAll": "Ready",
|
||||
"readyOnly": "Ready only",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
@@ -1452,17 +1452,15 @@
|
||||
"featured": "Tools",
|
||||
"mcpTools": "MCP tools",
|
||||
"loading": "Loading apps…",
|
||||
"empty": "No tools match your search.",
|
||||
"emptyApps": "No CLI Apps available.",
|
||||
"emptyIntegrations": "No MCP tools available.",
|
||||
"emptyReady": "No tools are ready yet.",
|
||||
"empty": "No tools match your search",
|
||||
"emptyApps": "No tools available",
|
||||
"emptyIntegrations": "No MCP tools available",
|
||||
"emptyReady": "No tools are ready yet",
|
||||
"clearSearch": "Clear search",
|
||||
"browseApps": "Browse CLI Apps",
|
||||
"browseIntegrations": "Browse MCP tools",
|
||||
"emptyIntegrationsHint": "Add a custom MCP server below.",
|
||||
"emptyIntegrationsHint": "Add a custom MCP server below",
|
||||
"restartRequired": "Restart nanobot to apply updated apps and MCP tools.",
|
||||
"emptyPlugins": "No Agent Plugins installed.",
|
||||
"emptyPluginsHint": "Add a plugin to the workspace plugins directory to enable it here.",
|
||||
"emptyPlugins": "No Agent Plugins installed",
|
||||
"emptyPluginsHint": "Add a plugin to the workspace plugins directory to enable it here",
|
||||
"pluginPermissions": "Declared permissions",
|
||||
"pluginServers": "MCP servers",
|
||||
"pluginTrustNotice": "Plugins run with nanobot’s operating-system permissions. Declared permissions do not sandbox them.",
|
||||
@@ -1501,7 +1499,7 @@
|
||||
"configuredInstances": "{{count}} instances configured",
|
||||
"connectPreview": "Run the command below in your terminal to connect.",
|
||||
"copyCommand": "Copy command",
|
||||
"filterAll": "All",
|
||||
"enabledOnly": "Enabled only",
|
||||
"filterOff": "Not running",
|
||||
"filterOn": "Running",
|
||||
"helperCopied": "{{name}} copied.",
|
||||
@@ -1807,7 +1805,7 @@
|
||||
"description": "Choose skills available in chat.",
|
||||
"views": "Skills views",
|
||||
"installedTab": "Installed",
|
||||
"discoverTab": "Discover",
|
||||
"discoverTab": "Marketplace",
|
||||
"customGroup": "Custom",
|
||||
"builtinGroup": "Built-in",
|
||||
"otherGroup": "Other",
|
||||
@@ -1844,7 +1842,6 @@
|
||||
"marketplaceSearchFailed": "Could not search skill marketplaces.",
|
||||
"marketplaceInstallFailed": "Could not install this skill.",
|
||||
"marketplaceSearchPlaceholder": "Search skills",
|
||||
"marketplaceSearchLabel": "Search skills",
|
||||
"marketplaceSearching": "Searching",
|
||||
"marketplaceProviderFilter": "Skill source",
|
||||
"marketplaceProviderAll": "All",
|
||||
|
||||
@@ -454,10 +454,7 @@
|
||||
"ariaLabel": "Cambiar idioma"
|
||||
},
|
||||
"apps": "Aplicaciones",
|
||||
"automations": "Automatizaciones",
|
||||
"skills": {
|
||||
"title": "Habilidades"
|
||||
}
|
||||
"automations": "Automatizaciones"
|
||||
},
|
||||
"settings": {
|
||||
"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."
|
||||
},
|
||||
"apps": {
|
||||
"allTypes": "Todos",
|
||||
"typeFilter": "Tipo de herramienta",
|
||||
"statusFilter": "Estado",
|
||||
"description": "Gestiona aplicaciones CLI, Agent Plugins y herramientas MCP.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "Canal",
|
||||
"featureLabel": "Función",
|
||||
"filterAll": "Disponibles",
|
||||
"readyOnly": "Solo disponibles",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
@@ -1270,17 +1270,15 @@
|
||||
"featured": "Herramientas",
|
||||
"mcpTools": "Herramientas MCP",
|
||||
"loading": "Cargando aplicaciones...",
|
||||
"empty": "Ninguna herramienta coincide con tu búsqueda.",
|
||||
"emptyApps": "No hay aplicaciones CLI disponibles.",
|
||||
"emptyIntegrations": "No hay herramientas MCP disponibles.",
|
||||
"emptyReady": "Todavía no hay herramientas listas.",
|
||||
"empty": "Ninguna herramienta coincide con tu búsqueda",
|
||||
"emptyApps": "No hay herramientas disponibles",
|
||||
"emptyIntegrations": "No hay herramientas MCP disponibles",
|
||||
"emptyReady": "Todavía no hay herramientas listas",
|
||||
"clearSearch": "Borrar búsqueda",
|
||||
"browseApps": "Explorar aplicaciones CLI",
|
||||
"browseIntegrations": "Explorar herramientas MCP",
|
||||
"emptyIntegrationsHint": "Añade un servidor MCP personalizado abajo.",
|
||||
"emptyIntegrationsHint": "Añade un servidor MCP personalizado abajo",
|
||||
"restartRequired": "Reinicia nanobot para aplicar las aplicaciones y herramientas MCP actualizadas.",
|
||||
"emptyPlugins": "No hay Agent Plugins instalados.",
|
||||
"emptyPluginsHint": "Añade un plugin al directorio plugins del espacio de trabajo para activarlo aquí.",
|
||||
"emptyPlugins": "No hay Agent Plugins instalados",
|
||||
"emptyPluginsHint": "Añade un plugin al directorio plugins del espacio de trabajo para activarlo aquí",
|
||||
"pluginPermissions": "Permisos declarados",
|
||||
"pluginServers": "Servidores MCP",
|
||||
"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",
|
||||
"connectPreview": "El siguiente paso es la conexión en el navegador. Por ahora, ejecuta el comando siguiente.",
|
||||
"copyCommand": "Copiar comando",
|
||||
"filterAll": "Todos",
|
||||
"enabledOnly": "Solo activados",
|
||||
"filterOff": "Detenidos",
|
||||
"filterOn": "En ejecución",
|
||||
"helperCopied": "{{name}} copiado.",
|
||||
@@ -1625,7 +1623,7 @@
|
||||
"description": "Elige las habilidades disponibles en el chat.",
|
||||
"views": "Vistas de habilidades",
|
||||
"installedTab": "Instaladas",
|
||||
"discoverTab": "Descubrir",
|
||||
"discoverTab": "Mercado de habilidades",
|
||||
"customGroup": "Personalizadas",
|
||||
"builtinGroup": "Integradas",
|
||||
"otherGroup": "Otras",
|
||||
@@ -1662,7 +1660,6 @@
|
||||
"marketplaceSearchFailed": "No se pudo buscar en los catálogos de habilidades.",
|
||||
"marketplaceInstallFailed": "No se pudo instalar esta habilidad.",
|
||||
"marketplaceSearchPlaceholder": "Buscar habilidades",
|
||||
"marketplaceSearchLabel": "Buscar habilidades",
|
||||
"marketplaceSearching": "Buscando",
|
||||
"marketplaceProviderFilter": "Origen de la habilidad",
|
||||
"marketplaceProviderAll": "Todos",
|
||||
|
||||
@@ -454,10 +454,7 @@
|
||||
"ariaLabel": "Changer de langue"
|
||||
},
|
||||
"apps": "Applications",
|
||||
"automations": "Automatisations",
|
||||
"skills": {
|
||||
"title": "Compétences"
|
||||
}
|
||||
"automations": "Automatisations"
|
||||
},
|
||||
"settings": {
|
||||
"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."
|
||||
},
|
||||
"apps": {
|
||||
"allTypes": "Tous",
|
||||
"typeFilter": "Type d’outil",
|
||||
"statusFilter": "État",
|
||||
"description": "Gérez les applications CLI, les Agent Plugins et les outils MCP.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "Canal",
|
||||
"featureLabel": "Fonction",
|
||||
"filterAll": "Prêts",
|
||||
"readyOnly": "Prêts uniquement",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
@@ -1270,17 +1270,15 @@
|
||||
"featured": "Outils",
|
||||
"mcpTools": "Outils MCP",
|
||||
"loading": "Chargement des applications...",
|
||||
"empty": "Aucun outil ne correspond à votre recherche.",
|
||||
"emptyApps": "Aucune application CLI disponible.",
|
||||
"emptyIntegrations": "Aucun outil MCP disponible.",
|
||||
"emptyReady": "Aucun outil n’est encore prêt.",
|
||||
"empty": "Aucun outil ne correspond à votre recherche",
|
||||
"emptyApps": "Aucun outil disponible",
|
||||
"emptyIntegrations": "Aucun outil MCP disponible",
|
||||
"emptyReady": "Aucun outil n’est encore prêt",
|
||||
"clearSearch": "Effacer la recherche",
|
||||
"browseApps": "Parcourir les applications CLI",
|
||||
"browseIntegrations": "Parcourir les outils MCP",
|
||||
"emptyIntegrationsHint": "Ajoutez un serveur MCP personnalisé ci-dessous.",
|
||||
"emptyIntegrationsHint": "Ajoutez un serveur MCP personnalisé ci-dessous",
|
||||
"restartRequired": "Redémarrez nanobot pour appliquer les applications et outils MCP mis à jour.",
|
||||
"emptyPlugins": "Aucun Agent Plugin installé.",
|
||||
"emptyPluginsHint": "Ajoutez un plugin au dossier plugins de l’espace de travail pour l’activer ici.",
|
||||
"emptyPlugins": "Aucun Agent Plugin installé",
|
||||
"emptyPluginsHint": "Ajoutez un plugin au dossier plugins de l’espace de travail pour l’activer ici",
|
||||
"pluginPermissions": "Autorisations déclarées",
|
||||
"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.",
|
||||
@@ -1321,7 +1319,7 @@
|
||||
"configuredInstances": "{{count}} instances configurées",
|
||||
"connectPreview": "La connexion dans le navigateur est la prochaine étape. Pour l'instant, exécutez la commande ci-dessous.",
|
||||
"copyCommand": "Copier la commande",
|
||||
"filterAll": "Tous",
|
||||
"enabledOnly": "Activés uniquement",
|
||||
"filterOff": "À l’arrêt",
|
||||
"filterOn": "En cours d’exécution",
|
||||
"helperCopied": "{{name}} copié.",
|
||||
@@ -1625,7 +1623,7 @@
|
||||
"description": "Choisissez les compétences disponibles dans les discussions.",
|
||||
"views": "Vues des compétences",
|
||||
"installedTab": "Installées",
|
||||
"discoverTab": "Découvrir",
|
||||
"discoverTab": "Catalogue de compétences",
|
||||
"customGroup": "Personnalisées",
|
||||
"builtinGroup": "Intégrées",
|
||||
"otherGroup": "Autres",
|
||||
@@ -1662,7 +1660,6 @@
|
||||
"marketplaceSearchFailed": "Impossible de rechercher dans les catalogues de compétences.",
|
||||
"marketplaceInstallFailed": "Impossible d’installer cette compétence.",
|
||||
"marketplaceSearchPlaceholder": "Rechercher des compétences",
|
||||
"marketplaceSearchLabel": "Rechercher des compétences",
|
||||
"marketplaceSearching": "Recherche en cours",
|
||||
"marketplaceProviderFilter": "Source des compétences",
|
||||
"marketplaceProviderAll": "Toutes",
|
||||
|
||||
@@ -454,10 +454,7 @@
|
||||
"ariaLabel": "Ganti bahasa"
|
||||
},
|
||||
"apps": "Aplikasi",
|
||||
"automations": "Otomasi",
|
||||
"skills": {
|
||||
"title": "Keterampilan"
|
||||
}
|
||||
"automations": "Otomasi"
|
||||
},
|
||||
"settings": {
|
||||
"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."
|
||||
},
|
||||
"apps": {
|
||||
"allTypes": "Semua",
|
||||
"typeFilter": "Jenis alat",
|
||||
"statusFilter": "Status",
|
||||
"description": "Kelola CLI Apps, Agent Plugins, dan alat MCP.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "Kanal",
|
||||
"featureLabel": "Fitur",
|
||||
"filterAll": "Siap",
|
||||
"readyOnly": "Hanya yang siap",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
@@ -1270,17 +1270,15 @@
|
||||
"featured": "Alat",
|
||||
"mcpTools": "Alat MCP",
|
||||
"loading": "Memuat aplikasi...",
|
||||
"empty": "Tidak ada alat yang cocok dengan pencarian Anda.",
|
||||
"emptyApps": "Tidak ada CLI App yang tersedia.",
|
||||
"emptyIntegrations": "Tidak ada alat MCP yang tersedia.",
|
||||
"emptyReady": "Belum ada alat yang siap.",
|
||||
"empty": "Tidak ada alat yang cocok dengan pencarian Anda",
|
||||
"emptyApps": "Tidak ada alat yang tersedia",
|
||||
"emptyIntegrations": "Tidak ada alat MCP yang tersedia",
|
||||
"emptyReady": "Belum ada alat yang siap",
|
||||
"clearSearch": "Hapus pencarian",
|
||||
"browseApps": "Jelajahi CLI Apps",
|
||||
"browseIntegrations": "Jelajahi alat MCP",
|
||||
"emptyIntegrationsHint": "Tambahkan server MCP khusus di bawah.",
|
||||
"emptyIntegrationsHint": "Tambahkan server MCP khusus di bawah",
|
||||
"restartRequired": "Mulai ulang nanobot untuk menerapkan aplikasi dan alat MCP yang diperbarui.",
|
||||
"emptyPlugins": "Belum ada Agent Plugin yang terpasang.",
|
||||
"emptyPluginsHint": "Tambahkan plugin ke direktori plugins ruang kerja untuk mengaktifkannya di sini.",
|
||||
"emptyPlugins": "Belum ada Agent Plugin yang terpasang",
|
||||
"emptyPluginsHint": "Tambahkan plugin ke direktori plugins ruang kerja untuk mengaktifkannya di sini",
|
||||
"pluginPermissions": "Izin yang dinyatakan",
|
||||
"pluginServers": "Server MCP",
|
||||
"pluginTrustNotice": "Plugin berjalan dengan izin sistem operasi nanobot. Izin yang dinyatakan tidak mengisolasinya.",
|
||||
@@ -1321,7 +1319,7 @@
|
||||
"configuredInstances": "{{count}} instans dikonfigurasi",
|
||||
"connectPreview": "Langkah berikutnya adalah koneksi di browser. Untuk saat ini, jalankan perintah di bawah.",
|
||||
"copyCommand": "Salin perintah",
|
||||
"filterAll": "Semua",
|
||||
"enabledOnly": "Hanya yang aktif",
|
||||
"filterOff": "Berhenti",
|
||||
"filterOn": "Berjalan",
|
||||
"helperCopied": "{{name}} disalin.",
|
||||
@@ -1625,7 +1623,7 @@
|
||||
"description": "Pilih skill yang tersedia di chat.",
|
||||
"views": "Tampilan keterampilan",
|
||||
"installedTab": "Terpasang",
|
||||
"discoverTab": "Temukan",
|
||||
"discoverTab": "Pasar keterampilan",
|
||||
"customGroup": "Kustom",
|
||||
"builtinGroup": "Bawaan",
|
||||
"otherGroup": "Lainnya",
|
||||
@@ -1662,7 +1660,6 @@
|
||||
"marketplaceSearchFailed": "Tidak dapat mencari marketplace keterampilan.",
|
||||
"marketplaceInstallFailed": "Tidak dapat memasang keterampilan ini.",
|
||||
"marketplaceSearchPlaceholder": "Cari keterampilan",
|
||||
"marketplaceSearchLabel": "Cari keterampilan",
|
||||
"marketplaceSearching": "Mencari",
|
||||
"marketplaceProviderFilter": "Sumber keterampilan",
|
||||
"marketplaceProviderAll": "Semua",
|
||||
|
||||
@@ -454,10 +454,7 @@
|
||||
"ariaLabel": "言語を変更"
|
||||
},
|
||||
"apps": "アプリ",
|
||||
"automations": "自動タスク",
|
||||
"skills": {
|
||||
"title": "スキル"
|
||||
}
|
||||
"automations": "自動タスク"
|
||||
},
|
||||
"settings": {
|
||||
"timezoneNoMatches": "一致するタイムゾーンがありません。",
|
||||
@@ -1256,12 +1253,15 @@
|
||||
"thirdPartyBrands": "製品名、ロゴ、ブランドはそれぞれの所有者に帰属します。使用は識別のみを目的とし、承認を意味するものではありません。"
|
||||
},
|
||||
"apps": {
|
||||
"allTypes": "すべて",
|
||||
"typeFilter": "ツールの種類",
|
||||
"statusFilter": "状態",
|
||||
"description": "CLI Apps、Agent Plugins、MCP ツールを管理します。",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "チャンネル",
|
||||
"featureLabel": "機能",
|
||||
"filterAll": "使用可能",
|
||||
"readyOnly": "使用可能のみ",
|
||||
"filterPlugins": "Agent プラグイン",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
@@ -1270,17 +1270,15 @@
|
||||
"featured": "ツール",
|
||||
"mcpTools": "MCP ツール",
|
||||
"loading": "アプリを読み込み中...",
|
||||
"empty": "検索条件に一致するツールはありません。",
|
||||
"emptyApps": "利用できる CLI App はありません。",
|
||||
"emptyIntegrations": "利用できる MCP ツールはありません。",
|
||||
"emptyReady": "使用可能なツールはまだありません。",
|
||||
"empty": "検索条件に一致するツールはありません",
|
||||
"emptyApps": "利用できるツールはありません",
|
||||
"emptyIntegrations": "利用できる MCP ツールはありません",
|
||||
"emptyReady": "使用可能なツールはまだありません",
|
||||
"clearSearch": "検索をクリア",
|
||||
"browseApps": "CLI Apps を見る",
|
||||
"browseIntegrations": "MCP ツールを見る",
|
||||
"emptyIntegrationsHint": "下からカスタム MCP サーバーを追加できます。",
|
||||
"emptyIntegrationsHint": "下からカスタム MCP サーバーを追加できます",
|
||||
"restartRequired": "更新したアプリと MCP ツールを反映するには nanobot を再起動してください。",
|
||||
"emptyPlugins": "Agent プラグインはインストールされていません。",
|
||||
"emptyPluginsHint": "ワークスペースの plugins ディレクトリにプラグインを追加すると、ここで有効にできます。",
|
||||
"emptyPlugins": "Agent プラグインはインストールされていません",
|
||||
"emptyPluginsHint": "ワークスペースの plugins ディレクトリにプラグインを追加すると、ここで有効にできます",
|
||||
"pluginPermissions": "宣言された権限",
|
||||
"pluginServers": "MCP サーバー",
|
||||
"pluginTrustNotice": "プラグインは nanobot の OS 権限で実行されます。宣言された権限によってサンドボックス化されるわけではありません。",
|
||||
@@ -1321,7 +1319,7 @@
|
||||
"configuredInstances": "{{count}} 個のインスタンスを設定済み",
|
||||
"connectPreview": "次の手順でブラウザー内接続を行います。今は下のコマンドを実行してください。",
|
||||
"copyCommand": "コマンドをコピー",
|
||||
"filterAll": "すべて",
|
||||
"enabledOnly": "有効のみ",
|
||||
"filterOff": "停止中",
|
||||
"filterOn": "実行中",
|
||||
"helperCopied": "{{name}} をコピーしました。",
|
||||
@@ -1625,7 +1623,7 @@
|
||||
"description": "チャットで使えるスキルを選びます。",
|
||||
"views": "スキル表示",
|
||||
"installedTab": "インストール済み",
|
||||
"discoverTab": "見つける",
|
||||
"discoverTab": "スキルマーケット",
|
||||
"customGroup": "カスタム",
|
||||
"builtinGroup": "組み込み",
|
||||
"otherGroup": "その他",
|
||||
@@ -1662,7 +1660,6 @@
|
||||
"marketplaceSearchFailed": "スキルマーケットを検索できませんでした。",
|
||||
"marketplaceInstallFailed": "このスキルをインストールできませんでした。",
|
||||
"marketplaceSearchPlaceholder": "スキルを検索",
|
||||
"marketplaceSearchLabel": "スキルを検索",
|
||||
"marketplaceSearching": "検索中",
|
||||
"marketplaceProviderFilter": "スキルの提供元",
|
||||
"marketplaceProviderAll": "すべて",
|
||||
|
||||
@@ -454,10 +454,7 @@
|
||||
"ariaLabel": "언어 변경"
|
||||
},
|
||||
"apps": "앱",
|
||||
"automations": "자동화",
|
||||
"skills": {
|
||||
"title": "스킬"
|
||||
}
|
||||
"automations": "자동화"
|
||||
},
|
||||
"settings": {
|
||||
"timezoneNoMatches": "일치하는 시간대가 없습니다.",
|
||||
@@ -1256,12 +1253,15 @@
|
||||
"thirdPartyBrands": "제품 이름, 로고 및 브랜드는 각 소유자의 자산입니다. 사용은 식별 목적일 뿐 보증이나 제휴를 의미하지 않습니다."
|
||||
},
|
||||
"apps": {
|
||||
"allTypes": "전체",
|
||||
"typeFilter": "도구 유형",
|
||||
"statusFilter": "상태",
|
||||
"description": "CLI Apps, Agent Plugins 및 MCP 도구를 관리합니다.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "채널",
|
||||
"featureLabel": "기능",
|
||||
"filterAll": "사용 가능",
|
||||
"readyOnly": "사용 가능만",
|
||||
"filterPlugins": "Agent 플러그인",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
@@ -1270,17 +1270,15 @@
|
||||
"featured": "도구",
|
||||
"mcpTools": "MCP 도구",
|
||||
"loading": "앱을 불러오는 중...",
|
||||
"empty": "검색과 일치하는 도구가 없습니다.",
|
||||
"emptyApps": "사용 가능한 CLI App이 없습니다.",
|
||||
"emptyIntegrations": "사용 가능한 MCP 도구가 없습니다.",
|
||||
"emptyReady": "아직 준비된 도구가 없습니다.",
|
||||
"empty": "검색과 일치하는 도구가 없습니다",
|
||||
"emptyApps": "사용 가능한 도구가 없습니다",
|
||||
"emptyIntegrations": "사용 가능한 MCP 도구가 없습니다",
|
||||
"emptyReady": "아직 준비된 도구가 없습니다",
|
||||
"clearSearch": "검색 지우기",
|
||||
"browseApps": "CLI Apps 둘러보기",
|
||||
"browseIntegrations": "MCP 도구 둘러보기",
|
||||
"emptyIntegrationsHint": "아래에서 사용자 지정 MCP 서버를 추가하세요.",
|
||||
"emptyIntegrationsHint": "아래에서 사용자 지정 MCP 서버를 추가하세요",
|
||||
"restartRequired": "업데이트된 앱과 MCP 도구를 적용하려면 nanobot을 다시 시작하세요.",
|
||||
"emptyPlugins": "설치된 Agent 플러그인이 없습니다.",
|
||||
"emptyPluginsHint": "워크스페이스의 plugins 디렉터리에 플러그인을 추가하면 여기에서 활성화할 수 있습니다.",
|
||||
"emptyPlugins": "설치된 Agent 플러그인이 없습니다",
|
||||
"emptyPluginsHint": "워크스페이스의 plugins 디렉터리에 플러그인을 추가하면 여기에서 활성화할 수 있습니다",
|
||||
"pluginPermissions": "선언된 권한",
|
||||
"pluginServers": "MCP 서버",
|
||||
"pluginTrustNotice": "플러그인은 nanobot의 운영체제 권한으로 실행됩니다. 선언된 권한은 플러그인을 격리하지 않습니다.",
|
||||
@@ -1321,7 +1319,7 @@
|
||||
"configuredInstances": "인스턴스 {{count}}개 설정됨",
|
||||
"connectPreview": "다음 단계에서 브라우저 내 연결을 진행합니다. 지금은 아래 명령을 실행하세요.",
|
||||
"copyCommand": "명령 복사",
|
||||
"filterAll": "전체",
|
||||
"enabledOnly": "활성화된 항목만",
|
||||
"filterOff": "중지됨",
|
||||
"filterOn": "실행 중",
|
||||
"helperCopied": "{{name}}을(를) 복사했습니다.",
|
||||
@@ -1625,7 +1623,7 @@
|
||||
"description": "채팅에서 사용할 스킬을 선택하세요.",
|
||||
"views": "스킬 보기",
|
||||
"installedTab": "설치됨",
|
||||
"discoverTab": "탐색",
|
||||
"discoverTab": "스킬 마켓",
|
||||
"customGroup": "사용자 지정",
|
||||
"builtinGroup": "기본 제공",
|
||||
"otherGroup": "기타",
|
||||
@@ -1662,7 +1660,6 @@
|
||||
"marketplaceSearchFailed": "스킬 마켓을 검색할 수 없습니다.",
|
||||
"marketplaceInstallFailed": "이 스킬을 설치할 수 없습니다.",
|
||||
"marketplaceSearchPlaceholder": "스킬 검색",
|
||||
"marketplaceSearchLabel": "스킬 검색",
|
||||
"marketplaceSearching": "검색 중",
|
||||
"marketplaceProviderFilter": "스킬 출처",
|
||||
"marketplaceProviderAll": "전체",
|
||||
|
||||
@@ -454,10 +454,7 @@
|
||||
"ariaLabel": "Trocar idioma"
|
||||
},
|
||||
"apps": "Aplicativos",
|
||||
"automations": "Automações",
|
||||
"skills": {
|
||||
"title": "Habilidades"
|
||||
}
|
||||
"automations": "Automações"
|
||||
},
|
||||
"settings": {
|
||||
"timezoneNoMatches": "Nenhum fuso horário encontrado.",
|
||||
@@ -1258,12 +1255,15 @@
|
||||
"enable": "Ativar rastreamento"
|
||||
},
|
||||
"apps": {
|
||||
"allTypes": "Todos",
|
||||
"typeFilter": "Tipo de ferramenta",
|
||||
"statusFilter": "Status",
|
||||
"description": "Gerencie aplicativos CLI, Agent Plugins e ferramentas MCP.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "Canal",
|
||||
"featureLabel": "Recurso",
|
||||
"filterAll": "Disponíveis",
|
||||
"readyOnly": "Só disponíveis",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
@@ -1272,17 +1272,15 @@
|
||||
"featured": "Ferramentas",
|
||||
"mcpTools": "Ferramentas MCP",
|
||||
"loading": "Carregando aplicativos...",
|
||||
"empty": "Nenhuma ferramenta corresponde à sua busca.",
|
||||
"emptyApps": "Nenhum aplicativo CLI disponível.",
|
||||
"emptyIntegrations": "Nenhuma ferramenta MCP disponível.",
|
||||
"emptyReady": "Ainda não há ferramentas prontas.",
|
||||
"empty": "Nenhuma ferramenta corresponde à sua busca",
|
||||
"emptyApps": "Nenhuma ferramenta disponível",
|
||||
"emptyIntegrations": "Nenhuma ferramenta MCP disponível",
|
||||
"emptyReady": "Ainda não há ferramentas prontas",
|
||||
"clearSearch": "Limpar busca",
|
||||
"browseApps": "Explorar aplicativos CLI",
|
||||
"browseIntegrations": "Explorar ferramentas MCP",
|
||||
"emptyIntegrationsHint": "Adicione um servidor MCP personalizado abaixo.",
|
||||
"emptyIntegrationsHint": "Adicione um servidor MCP personalizado abaixo",
|
||||
"restartRequired": "Reinicie o nanobot para aplicar os aplicativos e ferramentas MCP atualizados.",
|
||||
"emptyPlugins": "Nenhum Agent Plugin instalado.",
|
||||
"emptyPluginsHint": "Adicione um plugin ao diretório plugins do espaço de trabalho para ativá-lo aqui.",
|
||||
"emptyPlugins": "Nenhum Agent Plugin instalado",
|
||||
"emptyPluginsHint": "Adicione um plugin ao diretório plugins do espaço de trabalho para ativá-lo aqui",
|
||||
"pluginPermissions": "Permissões declaradas",
|
||||
"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.",
|
||||
@@ -1323,7 +1321,7 @@
|
||||
"configuredInstances": "{{count}} instâncias configuradas",
|
||||
"connectPreview": "A próxima etapa é a conexão no navegador. Por enquanto, execute o comando abaixo.",
|
||||
"copyCommand": "Copiar comando",
|
||||
"filterAll": "Todos",
|
||||
"enabledOnly": "Só ativados",
|
||||
"filterOff": "Parados",
|
||||
"filterOn": "Em execução",
|
||||
"helperCopied": "{{name}} copiado.",
|
||||
@@ -1627,7 +1625,7 @@
|
||||
"description": "Escolha as habilidades disponíveis nas conversas.",
|
||||
"views": "Visualizações de habilidades",
|
||||
"installedTab": "Instaladas",
|
||||
"discoverTab": "Descobrir",
|
||||
"discoverTab": "Mercado de habilidades",
|
||||
"customGroup": "Personalizadas",
|
||||
"builtinGroup": "Integradas",
|
||||
"otherGroup": "Outras",
|
||||
@@ -1664,7 +1662,6 @@
|
||||
"marketplaceSearchFailed": "Não foi possível pesquisar nos mercados de habilidades.",
|
||||
"marketplaceInstallFailed": "Não foi possível instalar esta habilidade.",
|
||||
"marketplaceSearchPlaceholder": "Pesquisar habilidades",
|
||||
"marketplaceSearchLabel": "Pesquisar habilidades",
|
||||
"marketplaceSearching": "Pesquisando",
|
||||
"marketplaceProviderFilter": "Origem da habilidade",
|
||||
"marketplaceProviderAll": "Todas",
|
||||
|
||||
@@ -454,10 +454,7 @@
|
||||
"ariaLabel": "Đổi ngôn ngữ"
|
||||
},
|
||||
"apps": "Ứng dụng",
|
||||
"automations": "Tự động hóa",
|
||||
"skills": {
|
||||
"title": "Kỹ năng"
|
||||
}
|
||||
"automations": "Tự động hóa"
|
||||
},
|
||||
"settings": {
|
||||
"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."
|
||||
},
|
||||
"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.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "Kênh",
|
||||
"featureLabel": "Tính năng",
|
||||
"filterAll": "Sẵn sàng",
|
||||
"readyOnly": "Chỉ mục sẵn sàng",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
@@ -1270,17 +1270,15 @@
|
||||
"featured": "Công cụ",
|
||||
"mcpTools": "Công cụ MCP",
|
||||
"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.",
|
||||
"emptyApps": "Không có CLI App 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.",
|
||||
"empty": "Không có công cụ phù hợp với tìm kiếm của bạn",
|
||||
"emptyApps": "Không có công cụ 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",
|
||||
"clearSearch": "Xóa tìm kiếm",
|
||||
"browseApps": "Xem CLI Apps",
|
||||
"browseIntegrations": "Xem công cụ MCP",
|
||||
"emptyIntegrationsHint": "Thêm máy chủ MCP tùy chỉnh ở bên dưới.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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",
|
||||
"pluginPermissions": "Quyền đã khai báo",
|
||||
"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.",
|
||||
@@ -1321,7 +1319,7 @@
|
||||
"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.",
|
||||
"copyCommand": "Sao chép lệnh",
|
||||
"filterAll": "Tất cả",
|
||||
"enabledOnly": "Chỉ mục đã bật",
|
||||
"filterOff": "Đã dừng",
|
||||
"filterOn": "Đang chạy",
|
||||
"helperCopied": "Đã sao chép {{name}}.",
|
||||
@@ -1625,7 +1623,7 @@
|
||||
"description": "Chọn kỹ năng có thể dùng trong trò chuyện.",
|
||||
"views": "Chế độ xem kỹ năng",
|
||||
"installedTab": "Đã cài đặt",
|
||||
"discoverTab": "Khám phá",
|
||||
"discoverTab": "Chợ kỹ năng",
|
||||
"customGroup": "Tùy chỉnh",
|
||||
"builtinGroup": "Tích hợp sẵn",
|
||||
"otherGroup": "Khác",
|
||||
@@ -1662,7 +1660,6 @@
|
||||
"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.",
|
||||
"marketplaceSearchPlaceholder": "Tìm kiếm kỹ năng",
|
||||
"marketplaceSearchLabel": "Tìm kiếm kỹ năng",
|
||||
"marketplaceSearching": "Đang tìm kiếm",
|
||||
"marketplaceProviderFilter": "Nguồn kỹ năng",
|
||||
"marketplaceProviderAll": "Tất cả",
|
||||
|
||||
@@ -454,10 +454,7 @@
|
||||
"ariaLabel": "切换语言"
|
||||
},
|
||||
"apps": "应用",
|
||||
"automations": "自动任务",
|
||||
"skills": {
|
||||
"title": "技能"
|
||||
}
|
||||
"automations": "任务"
|
||||
},
|
||||
"settings": {
|
||||
"timezoneNoMatches": "没有匹配的时区。",
|
||||
@@ -822,7 +819,7 @@
|
||||
"runtime": "系统",
|
||||
"advanced": "高级",
|
||||
"apps": "应用",
|
||||
"automations": "自动任务",
|
||||
"automations": "任务",
|
||||
"skills": "技能",
|
||||
"memory": "记忆"
|
||||
},
|
||||
@@ -1438,12 +1435,15 @@
|
||||
"enable": "启用追踪"
|
||||
},
|
||||
"apps": {
|
||||
"allTypes": "全部",
|
||||
"typeFilter": "工具类型",
|
||||
"statusFilter": "状态",
|
||||
"description": "管理 CLI Apps、Agent Plugins 和 MCP 工具。",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "聊天平台",
|
||||
"featureLabel": "功能",
|
||||
"filterAll": "已就绪",
|
||||
"readyOnly": "仅显示就绪",
|
||||
"filterPlugins": "Agent 插件",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
@@ -1452,17 +1452,15 @@
|
||||
"featured": "工具",
|
||||
"mcpTools": "MCP 工具",
|
||||
"loading": "正在加载应用...",
|
||||
"empty": "没有与搜索条件匹配的工具。",
|
||||
"emptyApps": "暂无可用的 CLI App。",
|
||||
"emptyIntegrations": "暂无可用 MCP 工具。",
|
||||
"emptyReady": "还没有就绪的工具。",
|
||||
"empty": "没有与搜索条件匹配的工具",
|
||||
"emptyApps": "暂无可用的工具",
|
||||
"emptyIntegrations": "暂无可用 MCP 工具",
|
||||
"emptyReady": "还没有就绪的工具",
|
||||
"clearSearch": "清除搜索",
|
||||
"browseApps": "浏览 CLI Apps",
|
||||
"browseIntegrations": "浏览 MCP 工具",
|
||||
"emptyIntegrationsHint": "可在下方添加自定义 MCP 服务器。",
|
||||
"emptyIntegrationsHint": "可在下方添加自定义 MCP 服务器",
|
||||
"restartRequired": "重启 nanobot 以应用更新后的应用和 MCP 工具。",
|
||||
"emptyPlugins": "尚未安装 Agent 插件。",
|
||||
"emptyPluginsHint": "将插件添加到工作区的 plugins 目录,即可在此启用。",
|
||||
"emptyPlugins": "尚未安装 Agent 插件",
|
||||
"emptyPluginsHint": "将插件添加到工作区的 plugins 目录,即可在此启用",
|
||||
"pluginPermissions": "声明的权限",
|
||||
"pluginServers": "MCP 服务器",
|
||||
"pluginTrustNotice": "插件以 nanobot 的操作系统权限运行;声明的权限不会隔离插件。",
|
||||
@@ -1503,7 +1501,7 @@
|
||||
"configuredInstances": "已配置 {{count}} 个实例",
|
||||
"connectPreview": "请先在终端运行下方命令,完成连接。",
|
||||
"copyCommand": "复制命令",
|
||||
"filterAll": "全部",
|
||||
"enabledOnly": "仅显示已启用",
|
||||
"filterOff": "未运行",
|
||||
"filterOn": "运行中",
|
||||
"helperCopied": "已复制 {{name}}。",
|
||||
@@ -1807,7 +1805,7 @@
|
||||
"description": "选择对话中可用的技能",
|
||||
"views": "技能视图",
|
||||
"installedTab": "已安装",
|
||||
"discoverTab": "发现",
|
||||
"discoverTab": "技能市场",
|
||||
"customGroup": "自定义",
|
||||
"builtinGroup": "内置",
|
||||
"otherGroup": "其他",
|
||||
@@ -1844,7 +1842,6 @@
|
||||
"marketplaceSearchFailed": "暂时无法搜索技能市场。",
|
||||
"marketplaceInstallFailed": "无法安装此技能。",
|
||||
"marketplaceSearchPlaceholder": "搜索技能",
|
||||
"marketplaceSearchLabel": "搜索技能",
|
||||
"marketplaceSearching": "正在搜索",
|
||||
"marketplaceProviderFilter": "技能来源",
|
||||
"marketplaceProviderAll": "全部",
|
||||
|
||||
@@ -454,10 +454,7 @@
|
||||
"ariaLabel": "切換語言"
|
||||
},
|
||||
"apps": "應用程式",
|
||||
"automations": "自動任務",
|
||||
"skills": {
|
||||
"title": "技能"
|
||||
}
|
||||
"automations": "任務"
|
||||
},
|
||||
"settings": {
|
||||
"timezoneNoMatches": "沒有符合的時區。",
|
||||
@@ -643,7 +640,7 @@
|
||||
"cliApps": "CLI 應用",
|
||||
"mcp": "MCP",
|
||||
"apps": "應用程式",
|
||||
"automations": "自動任務",
|
||||
"automations": "任務",
|
||||
"skills": "技能"
|
||||
},
|
||||
"sections": {
|
||||
@@ -1256,12 +1253,15 @@
|
||||
"thirdPartyBrands": "產品名稱、Logo 與品牌均為各自擁有者的財產。僅供識別之用,不代表任何形式的背書。"
|
||||
},
|
||||
"apps": {
|
||||
"allTypes": "全部",
|
||||
"typeFilter": "工具類型",
|
||||
"statusFilter": "狀態",
|
||||
"description": "管理 CLI Apps、Agent Plugins 和 MCP 工具。",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "通訊管道",
|
||||
"featureLabel": "功能",
|
||||
"filterAll": "就緒",
|
||||
"readyOnly": "僅顯示就緒",
|
||||
"filterPlugins": "Agent 外掛",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
@@ -1270,17 +1270,15 @@
|
||||
"featured": "工具",
|
||||
"mcpTools": "MCP 工具",
|
||||
"loading": "正在載入應用程式…",
|
||||
"empty": "沒有符合搜尋條件的工具。",
|
||||
"emptyApps": "沒有可用的 CLI App。",
|
||||
"emptyIntegrations": "沒有可用的 MCP 工具。",
|
||||
"emptyReady": "尚無就緒的工具。",
|
||||
"empty": "沒有符合搜尋條件的工具",
|
||||
"emptyApps": "沒有可用的工具",
|
||||
"emptyIntegrations": "沒有可用的 MCP 工具",
|
||||
"emptyReady": "尚無就緒的工具",
|
||||
"clearSearch": "清除搜尋",
|
||||
"browseApps": "瀏覽 CLI Apps",
|
||||
"browseIntegrations": "瀏覽 MCP 工具",
|
||||
"emptyIntegrationsHint": "可在下方新增自訂 MCP 伺服器。",
|
||||
"emptyIntegrationsHint": "可在下方新增自訂 MCP 伺服器",
|
||||
"restartRequired": "重新啟動 nanobot 以套用更新後的應用程式與 MCP 工具。",
|
||||
"emptyPlugins": "尚未安裝 Agent 外掛。",
|
||||
"emptyPluginsHint": "將外掛新增至工作區的 plugins 目錄,即可在此啟用。",
|
||||
"emptyPlugins": "尚未安裝 Agent 外掛",
|
||||
"emptyPluginsHint": "將外掛新增至工作區的 plugins 目錄,即可在此啟用",
|
||||
"pluginPermissions": "宣告的權限",
|
||||
"pluginServers": "MCP 伺服器",
|
||||
"pluginTrustNotice": "外掛以 nanobot 的作業系統權限執行;宣告的權限不會隔離外掛。",
|
||||
@@ -1321,7 +1319,7 @@
|
||||
"configuredInstances": "已設定 {{count}} 個執行個體",
|
||||
"connectPreview": "請先在終端機執行下方指令,完成連線。",
|
||||
"copyCommand": "複製指令",
|
||||
"filterAll": "全部",
|
||||
"enabledOnly": "僅顯示已啟用",
|
||||
"filterOff": "未執行",
|
||||
"filterOn": "執行中",
|
||||
"helperCopied": "已複製 {{name}}。",
|
||||
@@ -1625,7 +1623,7 @@
|
||||
"description": "選擇對話中可用的技能",
|
||||
"views": "技能檢視",
|
||||
"installedTab": "已安裝",
|
||||
"discoverTab": "探索",
|
||||
"discoverTab": "技能市集",
|
||||
"customGroup": "自訂",
|
||||
"builtinGroup": "內建",
|
||||
"otherGroup": "其他",
|
||||
@@ -1662,7 +1660,6 @@
|
||||
"marketplaceSearchFailed": "暫時無法搜尋技能市集。",
|
||||
"marketplaceInstallFailed": "無法安裝此技能。",
|
||||
"marketplaceSearchPlaceholder": "搜尋技能",
|
||||
"marketplaceSearchLabel": "搜尋技能",
|
||||
"marketplaceSearching": "正在搜尋",
|
||||
"marketplaceProviderFilter": "技能來源",
|
||||
"marketplaceProviderAll": "全部",
|
||||
|
||||
@@ -2,9 +2,7 @@ const SIDEBAR_SHORTCUTS = {
|
||||
newChat: { key: "O", shift: true },
|
||||
search: { key: "K", shift: false },
|
||||
apps: { key: "1", shift: true },
|
||||
skills: { key: "2", shift: true },
|
||||
automations: { key: "3", shift: true },
|
||||
channels: { key: "4", shift: true },
|
||||
automations: { key: "2", shift: true },
|
||||
settings: { key: ",", shift: false },
|
||||
} as const;
|
||||
|
||||
|
||||
@@ -652,7 +652,11 @@ describe("App layout", () => {
|
||||
expect(main).not.toHaveAttribute("style");
|
||||
expect(screen.getByTestId("sidebar-brand-row")).toHaveClass("pt-3");
|
||||
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(
|
||||
(el) => el.className,
|
||||
@@ -729,44 +733,67 @@ describe("App layout", () => {
|
||||
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 />);
|
||||
|
||||
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
|
||||
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
|
||||
const appsButton = within(sidebar).getByRole("button", { name: "Apps" });
|
||||
const skillsButton = within(sidebar).getByRole("button", { name: "Skills" });
|
||||
const automationsButton = within(sidebar).getByRole("button", { name: "Automations" });
|
||||
|
||||
expect(appsButton.compareDocumentPosition(skillsButton) & Node.DOCUMENT_POSITION_FOLLOWING)
|
||||
.toBeTruthy();
|
||||
expect(
|
||||
skillsButton.compareDocumentPosition(automationsButton) &
|
||||
Node.DOCUMENT_POSITION_FOLLOWING,
|
||||
).toBeTruthy();
|
||||
const footer = within(sidebar).getByTestId("sidebar-footer");
|
||||
await within(footer).findByRole("button", { name: "Switch host" });
|
||||
const buttons = within(footer).getAllByRole("button");
|
||||
expect(buttons.map((button) => button.getAttribute("aria-label")))
|
||||
.toEqual(["Apps", "Automations", "Settings", "Switch host"]);
|
||||
expect(buttons.slice(0, 3).map((button) => button.textContent)).toEqual(["Apps", "Automations", "Settings"]);
|
||||
fireEvent.click(within(footer).getByRole("button", { name: "Apps" }));
|
||||
await act(async () => { await import("@/components/settings/SettingsView"); });
|
||||
const sections = await screen.findByRole("group", { name: "Apps" });
|
||||
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({
|
||||
"/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 },
|
||||
});
|
||||
render(<App />);
|
||||
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
|
||||
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
|
||||
const channels = within(sidebar).getByRole("button", { name: "Channels" });
|
||||
expect(within(sidebar).getByRole("button", { name: "Automations" })
|
||||
.compareDocumentPosition(channels) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
||||
fireEvent.click(channels);
|
||||
expect(await screen.findByRole("heading", { name: "Channels" })).toBeVisible();
|
||||
expect(window.location.hash).toBe("#/channels");
|
||||
expect(channels).toHaveAttribute("aria-current", "page");
|
||||
expect(document.title).toBe("Channels");
|
||||
fireEvent.click(within(sidebar).getByRole("button", { name: "New topic" }));
|
||||
await waitFor(() => expect(window.location.hash).toBe("#/new"));
|
||||
fireEvent.keyDown(window, { key: "$", code: "Digit4", ctrlKey: true, shiftKey: true });
|
||||
expect(await screen.findByRole("heading", { name: "Channels" })).toBeVisible();
|
||||
expect(window.location.hash).toBe("#/channels");
|
||||
const apps = within(sidebar).getByRole("button", { name: "Apps" });
|
||||
fireEvent.click(apps);
|
||||
await act(async () => { await import("@/components/settings/SettingsView"); });
|
||||
await screen.findByRole("button", { name: "Tools", pressed: true });
|
||||
const search = screen.getByLabelText("Search tools");
|
||||
fireEvent.change(search, { target: { value: "mcp" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Channels" }));
|
||||
expect(await screen.findByRole("searchbox", { name: "Search channels" })).toBe(search);
|
||||
expect(search).toHaveValue("");
|
||||
expect(window.location.hash).toBe("#/apps?section=channels");
|
||||
expect(apps).toHaveAttribute("aria-current", "page");
|
||||
expect(document.title).toBe("Apps");
|
||||
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 () => {
|
||||
@@ -838,7 +865,7 @@ describe("App layout", () => {
|
||||
});
|
||||
render(<App />);
|
||||
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");
|
||||
fireEvent.pointerDown(await within(sheet).findByRole("button", { name: "Switch host" }), { button: 0, ctrlKey: false });
|
||||
fireEvent.click(await screen.findByRole("menuitem", { name: "Manage connections" }));
|
||||
@@ -869,7 +896,8 @@ describe("App layout", () => {
|
||||
"/api/remote-instances": { available: true, profiles: [profile] },
|
||||
});
|
||||
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");
|
||||
await user.click(await within(sheet).findByRole("button", { name: "Switch host" }));
|
||||
await user.click(await screen.findByRole("menuitem", { name: "Team server team" }));
|
||||
@@ -895,16 +923,26 @@ describe("App layout", () => {
|
||||
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 />);
|
||||
|
||||
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
|
||||
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
|
||||
const newTopicButton = within(sidebar).getByRole("button", { name: "New topic" });
|
||||
const sidebar = within(await screen.findByRole("navigation", { name: "Sidebar navigation" }));
|
||||
const compose = 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");
|
||||
expect(newTopicButton).toHaveClass("transition-[width,padding,color,background-color]");
|
||||
expect(newTopicButton).toBeEnabled();
|
||||
const expand = sidebar.getByRole("button", { name: "Toggle sidebar", expanded: false });
|
||||
expand.focus();
|
||||
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 () => {
|
||||
@@ -1325,9 +1363,10 @@ describe("App layout", () => {
|
||||
|
||||
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
|
||||
expect(
|
||||
await screen.findByRole("heading", { name: "Channels" }),
|
||||
await screen.findByRole("heading", { name: "Apps" }),
|
||||
).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");
|
||||
});
|
||||
|
||||
@@ -1497,11 +1536,10 @@ describe("App layout", () => {
|
||||
|
||||
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
|
||||
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("heading", { name: "Skills" })).toBeInTheDocument();
|
||||
expect(await screen.findByRole("button", { name: "Skills" })).toHaveAttribute("aria-pressed", "true");
|
||||
expect(screen.getByRole("textbox", { name: "Search installed skills" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("heading", { name: "Custom" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("heading", { name: "Built-in" })).toBeInTheDocument();
|
||||
@@ -1510,17 +1548,18 @@ describe("App layout", () => {
|
||||
expect(screen.getByText("Needs setup")).toBeInTheDocument();
|
||||
expect(screen.getByRole("navigation", { name: "Sidebar navigation" })).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",
|
||||
"page",
|
||||
);
|
||||
expect(document.title).toBe("Skills");
|
||||
expect(document.title).toBe("Apps");
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Back to chat" }));
|
||||
expect(await screen.findByTestId("thread-welcome-mark")).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(within(sidebar).getByRole("button", { name: "Skills" }));
|
||||
expect(await screen.findByRole("heading", { name: "Skills" })).toBeInTheDocument();
|
||||
fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" }));
|
||||
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" }));
|
||||
|
||||
@@ -1592,7 +1631,8 @@ describe("App layout", () => {
|
||||
|
||||
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
|
||||
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(
|
||||
await screen.findByRole("button", { name: "Open details for custom-skill" }),
|
||||
);
|
||||
@@ -1724,10 +1764,13 @@ describe("App layout", () => {
|
||||
|
||||
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
|
||||
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
|
||||
fireEvent.click(within(sidebar).getByRole("button", { name: "Skills" }));
|
||||
const discoverTab = await screen.findByRole("tab", { name: "Discover" });
|
||||
expect(discoverTab.querySelector("svg")).toBeNull();
|
||||
fireEvent.click(discoverTab);
|
||||
fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" }));
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Skills" }));
|
||||
const selectView = async (view: string) => {
|
||||
const views = await screen.findByRole("radiogroup", { name: "Skills views" });
|
||||
await userEvent.click(within(views).getByRole("radio", { name: view }));
|
||||
};
|
||||
await selectView("Marketplace");
|
||||
expect(
|
||||
await screen.findByRole("heading", { name: "Popular skills" }),
|
||||
).toBeInTheDocument();
|
||||
@@ -1736,11 +1779,12 @@ describe("App layout", () => {
|
||||
expect(screen.getByRole("link", { name: "Open ima-skills on SkillHub" })).toHaveAttribute(
|
||||
"href", "https://skillhub.cn/skills/tencent-adm/ima-skills",
|
||||
);
|
||||
expect(screen.getAllByText("SkillHub")).toHaveLength(2);
|
||||
expect(screen.getAllByText("skills.sh")).toHaveLength(2);
|
||||
expect(screen.getByRole("link", { name: "Open SkillHub" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("link", { name: "Open skills.sh" })).toBeInTheDocument();
|
||||
expect(screen.getByText(/14,481 installs \/ 24h/)).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.queryByText("find-skills")).not.toBeInTheDocument();
|
||||
expect(
|
||||
@@ -1749,7 +1793,7 @@ describe("App layout", () => {
|
||||
String(input) === "/api/webui/skills/trending?provider=skillhub",
|
||||
),
|
||||
).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("ima-skills")).toBeInTheDocument();
|
||||
expect(
|
||||
@@ -1780,8 +1824,10 @@ describe("App layout", () => {
|
||||
150_000,
|
||||
);
|
||||
});
|
||||
fireEvent.click(screen.getByRole("tab", { name: "Installed" }));
|
||||
fireEvent.click(screen.getByRole("tab", { name: "Discover" }));
|
||||
await selectView("Installed");
|
||||
await selectView("Marketplace");
|
||||
expect(screen.getByRole("textbox", { name: "Search skills" })).toHaveValue("React");
|
||||
fireEvent.change(screen.getByRole("textbox", { name: "Search skills" }), { target: { value: "" } });
|
||||
expect(
|
||||
await screen.findByRole("button", { name: "Install find-skills" }),
|
||||
).toBeDisabled();
|
||||
@@ -1794,7 +1840,7 @@ describe("App layout", () => {
|
||||
await waitFor(() => {
|
||||
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();
|
||||
});
|
||||
|
||||
@@ -2184,9 +2230,9 @@ describe("App layout", () => {
|
||||
|
||||
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
|
||||
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();
|
||||
const automationsMain = heading.closest("main");
|
||||
expect(automationsMain).not.toBeNull();
|
||||
@@ -2204,10 +2250,29 @@ describe("App layout", () => {
|
||||
expect(screen.queryByText("近期无问题")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("Workspace automations")).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 () => {
|
||||
mockSessions = [{ key: "websocket:chat-a", channel: "websocket", chatId: "chat-a", createdAt: null, updatedAt: null, preview: "First chat" }];
|
||||
const view = render(<App />);
|
||||
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
|
||||
const handle = screen.getByRole("separator", { name: "Resize sidebar" });
|
||||
@@ -2251,7 +2316,7 @@ describe("App layout", () => {
|
||||
const sidebar = screen.getByTestId("host-sidebar-flow");
|
||||
await within(sidebar).findByTestId("chats-selection-highlight");
|
||||
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(
|
||||
"group-data-[resizing=true]/sidebar:transition-none",
|
||||
);
|
||||
@@ -2269,7 +2334,7 @@ describe("App layout", () => {
|
||||
expect(sidebar).toHaveStyle({ width: "400px" });
|
||||
fireEvent[finish](handle, { pointerId: 1, clientX: 400 });
|
||||
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 () => {
|
||||
@@ -2415,6 +2480,11 @@ describe("App layout", () => {
|
||||
);
|
||||
expect(screen.queryByText("Delete this topic?")).not.toBeInTheDocument();
|
||||
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);
|
||||
|
||||
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(
|
||||
"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");
|
||||
await act(async () => {
|
||||
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"));
|
||||
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
||||
} else {
|
||||
expect(window.location.hash).toBe("#/channels");
|
||||
expect(window.location.hash).toBe("#/apps?section=channels");
|
||||
expect(host).toHaveValue("imap.changed.test");
|
||||
expect(await screen.findByText("Save failed")).toBeVisible();
|
||||
}
|
||||
@@ -3533,7 +3603,7 @@ describe("App layout", () => {
|
||||
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 = {
|
||||
name: "example", display_name: "Example App", category: "productivity", description: "Example",
|
||||
requires: "", source: "catalog", entry_point: "example", install_supported: true,
|
||||
@@ -3551,16 +3621,18 @@ describe("App layout", () => {
|
||||
fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" }));
|
||||
await act(async () => { await import("@/components/settings/SettingsView"); });
|
||||
expect(await screen.findByRole("heading", { name: "Example App" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Ready" })).toHaveAttribute("aria-pressed", "true");
|
||||
fireEvent.click(screen.getByRole("button", { name: "MCP" }));
|
||||
fireEvent.click(within(sidebar).getByRole("button", { name: "Skills" }));
|
||||
expect(await screen.findByRole("heading", { name: "Skills" })).toBeInTheDocument();
|
||||
fireEvent.click(within(sidebar).getByRole("button", { name: "Apps" }));
|
||||
expect(screen.getByRole("switch", { name: "Ready only" })).toBeChecked();
|
||||
const types = within(screen.getByRole("radiogroup", { name: "Tool type" }));
|
||||
await userEvent.click(types.getByRole("radio", { name: "MCP" }));
|
||||
expect(types.getByRole("radio", { name: "MCP" })).toBeChecked();
|
||||
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(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({
|
||||
"/api/settings": baseSettingsPayload(),
|
||||
"/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",
|
||||
);
|
||||
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(await screen.findByRole("heading", { name: "Skills" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("group", { name: "Apps" })).toBe(sections);
|
||||
expect(within(sections).getByRole("button", { name: "Skills" })).toHaveAttribute("aria-pressed", "true");
|
||||
expect(window.location.hash).toBe("#/apps?section=skills");
|
||||
expect(screen.getByRole("textbox", { name: "Search installed skills" })).toBeVisible();
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId("settings-section-transition")).toHaveAttribute(
|
||||
"data-settings-section",
|
||||
@@ -3612,15 +3687,15 @@ describe("App layout", () => {
|
||||
);
|
||||
});
|
||||
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",
|
||||
"page",
|
||||
);
|
||||
expect(within(sidebar).getByTestId("actions-selection-highlight")).toHaveAttribute(
|
||||
"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 () => {
|
||||
@@ -3796,7 +3871,7 @@ describe("App layout", () => {
|
||||
const newChatButton = within(sidebar).getByRole("button", { name: "New topic" });
|
||||
const searchButton = within(sidebar).getByRole("button", { name: "Search" });
|
||||
expect(
|
||||
searchButton.compareDocumentPosition(newChatButton) &
|
||||
newChatButton.compareDocumentPosition(searchButton) &
|
||||
Node.DOCUMENT_POSITION_FOLLOWING,
|
||||
).toBeTruthy();
|
||||
|
||||
@@ -4404,16 +4479,17 @@ describe("App layout", () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
["apps", "1", "Digit1", true],
|
||||
["skills", "2", "Digit2", true],
|
||||
["automations", "3", "Digit3", true],
|
||||
["settings", ",", "Comma", false],
|
||||
])("opens %s using its sidebar shortcut", async (route, key, code, shiftKey) => {
|
||||
["Apps", "#/apps", "!", "Digit1", "Meta+Shift+1 Control+Shift+1"],
|
||||
["Automations", "#/automations", "@", "Digit2", "Meta+Shift+2 Control+Shift+2"],
|
||||
["Settings", "#/settings", ",", "Comma", "Meta+, Control+,"],
|
||||
])("opens %s using its sidebar shortcut", async (name, hash, key, code, ariaShortcut) => {
|
||||
mockFetchRoutes({ "/api/settings": baseSettingsPayload() });
|
||||
render(<App />);
|
||||
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
|
||||
fireEvent.keyDown(window, { key, code, shiftKey, ctrlKey: true });
|
||||
await waitFor(() => expect(window.location.hash).toContain("#/" + route));
|
||||
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
|
||||
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([
|
||||
@@ -4472,7 +4548,6 @@ describe("App layout", () => {
|
||||
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
|
||||
|
||||
const newChatButton = within(sidebar).getByRole("button", { name: "New topic" });
|
||||
expect(newChatButton).toHaveTextContent("");
|
||||
await userEvent.setup().hover(newChatButton);
|
||||
const tooltip = await screen.findByRole("tooltip");
|
||||
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: "Search" })).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" }));
|
||||
await waitFor(() => expect(sidebarAside.style.width).toBe("272px"));
|
||||
|
||||
@@ -9,6 +9,8 @@ import {
|
||||
installSettingsViewTestHooks,
|
||||
jsonResponse,
|
||||
renderSettingsView,
|
||||
selectToolType,
|
||||
showOnlyReadyTools,
|
||||
settingsPayload,
|
||||
} from "@/tests/settings-test-utils";
|
||||
|
||||
@@ -57,9 +59,10 @@ describe("catalog loading", () => {
|
||||
cleanup();
|
||||
fetch.mockClear();
|
||||
renderSettingsView({ client, initialSettings: settingsPayload() });
|
||||
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" }));
|
||||
await selectToolType("CLI Apps");
|
||||
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.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
|
||||
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);
|
||||
try {
|
||||
renderSettingsView({ client, initialSettings: settingsPayload() });
|
||||
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" }));
|
||||
await selectToolType("CLI Apps");
|
||||
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.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
|
||||
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 }));
|
||||
});
|
||||
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();
|
||||
} finally {
|
||||
now.mockRestore();
|
||||
@@ -139,7 +143,7 @@ describe("catalog loading", () => {
|
||||
return Promise.resolve(jsonResponse(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");
|
||||
|
||||
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();
|
||||
await act(async () => { mcp.resolve(jsonResponse({ presets: [plugin], installed_count: 1 })); });
|
||||
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.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
|
||||
});
|
||||
@@ -165,17 +170,18 @@ describe("catalog loading", () => {
|
||||
renderSettingsView({ initialSettings: settingsPayload() });
|
||||
await act(async () => {});
|
||||
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" }));
|
||||
expect(screen.getByText("No MCP tools available.")).toBeInTheDocument();
|
||||
await selectToolType("MCP");
|
||||
await showOnlyReadyTools(false);
|
||||
expect(screen.getByText("No MCP tools available")).toBeInTheDocument();
|
||||
expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
|
||||
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();
|
||||
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" }));
|
||||
await selectToolType("CLI Apps");
|
||||
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 })); });
|
||||
expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument();
|
||||
expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
|
||||
@@ -191,7 +197,7 @@ describe("catalog loading", () => {
|
||||
renderSettingsView({ initialSection: section, initialSettings: settingsPayload() });
|
||||
expect(await screen.findByText("Catalog offline")).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();
|
||||
});
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { channelUiPresentation, registeredChannelUiContributions } from "@/channel-plugins/registry";
|
||||
import { ChannelLogo } from "@/components/settings/channels/ChannelIdentity";
|
||||
import { __clearLogoFallbackCacheForTests } from "@/hooks/useLogoFallback";
|
||||
import { logoFallbackUrls } from "@/lib/provider-brand";
|
||||
import type { NanobotFeatureInfo } from "@/lib/types";
|
||||
|
||||
function feature(name: string): NanobotFeatureInfo {
|
||||
@@ -31,11 +30,11 @@ describe("channel logos", () => {
|
||||
beforeEach(__clearLogoFallbackCacheForTests);
|
||||
afterEach(cleanup);
|
||||
|
||||
const remoteChannels = registeredChannelUiContributions()
|
||||
const channelsWithBrandMarks = registeredChannelUiContributions()
|
||||
.filter(({ contribution }) => contribution.presentation.logoUrl)
|
||||
.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 icon = container.firstElementChild!;
|
||||
const image = icon.querySelector("img")!;
|
||||
@@ -45,6 +44,7 @@ describe("channel logos", () => {
|
||||
expectFootprint(icon);
|
||||
expect(icon).toHaveClass("bg-muted");
|
||||
expect(fallback).toHaveClass("opacity-100");
|
||||
expect(presentation.logoUrl).toMatch(/^\/brand\//);
|
||||
expect(image).toHaveAttribute("src", presentation.logoUrl);
|
||||
expect(image).toHaveAttribute("alt", "");
|
||||
expect(image).toHaveAttribute("referrerpolicy", "no-referrer");
|
||||
@@ -58,54 +58,47 @@ describe("channel logos", () => {
|
||||
for (const className of ["invert", "grayscale", "object-cover"]) {
|
||||
expect(image).not.toHaveClass(className);
|
||||
}
|
||||
expect(icon).toHaveClass(presentation.logoLayout === "tile" ? "bg-transparent" : "bg-white");
|
||||
expect(image).toHaveClass(...(presentation.logoLayout === "tile" ? ["h-8", "w-8"] : ["h-6", "w-6"]));
|
||||
expect(icon).toHaveClass("bg-white");
|
||||
expect(image).toHaveClass("h-6", "w-6");
|
||||
});
|
||||
|
||||
it.each(["linear", "feishu", "lark"])("insets unknown %s fallback assets instead of stretching them", (channel) => {
|
||||
const { container } = render(<ChannelLogo feature={feature(channel)} showBrandLogos />);
|
||||
it.each(["dingtalk", "feishu", "lark", "mochat", "msteams", "napcat", "slack", "wecom"])(
|
||||
"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 image = icon.querySelector("img")!;
|
||||
fireEvent.load(image);
|
||||
expect(icon).toHaveClass("bg-transparent");
|
||||
expect(image).toHaveClass("h-8", "w-8");
|
||||
|
||||
expect(image).toHaveAttribute("src", "/brand/channels/qq.svg");
|
||||
fireEvent.error(image);
|
||||
expect(icon).toHaveClass("bg-muted");
|
||||
expect(image).toHaveClass("h-6", "w-6", "opacity-0");
|
||||
fireEvent.load(image);
|
||||
expect(icon).toHaveClass("bg-white");
|
||||
expect(container.firstElementChild).toBe(icon);
|
||||
expectFootprint(icon);
|
||||
});
|
||||
|
||||
it("falls back to initials after all remote sources fail without changing size", () => {
|
||||
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).toHaveClass("bg-muted");
|
||||
expect(icon.querySelector("span")).toHaveClass("opacity-100");
|
||||
expect(icon).toHaveTextContent("QQ");
|
||||
expect(icon.querySelector("img")).toBeNull();
|
||||
expect(icon).toHaveTextContent(channelUiPresentation("slack")!.initials!);
|
||||
});
|
||||
|
||||
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!;
|
||||
fireEvent.load(icon.querySelector("img")!);
|
||||
|
||||
rerender(<ChannelLogo feature={feature("slack")} showBrandLogos={false} />);
|
||||
rerender(<ChannelLogo feature={feature("linear")} showBrandLogos={false} />);
|
||||
expectFootprint(icon);
|
||||
expect(icon.querySelector("img")).toBeNull();
|
||||
expect(icon).toHaveClass("bg-muted");
|
||||
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).toHaveClass("bg-white");
|
||||
});
|
||||
@@ -118,16 +111,6 @@ describe("channel logos", () => {
|
||||
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", () => {
|
||||
const { container, rerender } = render(<ChannelLogo feature={feature("websocket")} showBrandLogos />);
|
||||
expectFootprint(container.firstElementChild!);
|
||||
|
||||
@@ -146,7 +146,8 @@ it("switches the chat list preview between ready, loading, empty and archived st
|
||||
await setMode("loading");
|
||||
expect(preview.getByText("Loading…")).toBeVisible();
|
||||
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");
|
||||
const archived = within(preview.getByRole("region", { name: "Archived" }));
|
||||
expect(archived.getByRole("button", { name: "@history 历史方案" })).toBeVisible();
|
||||
|
||||
@@ -126,7 +126,6 @@ const LOCALIZED_SETTINGS_COPY_KEYS = [
|
||||
"settings.skills.marketplaceSearchFailed",
|
||||
"settings.skills.marketplaceInstallFailed",
|
||||
"settings.skills.marketplaceSearchPlaceholder",
|
||||
"settings.skills.marketplaceSearchLabel",
|
||||
"settings.skills.marketplaceSearching",
|
||||
"settings.skills.marketplaceProviderFilter",
|
||||
"settings.skills.marketplaceProviderAll",
|
||||
@@ -248,7 +247,7 @@ const LOCALIZED_CHANNEL_SHELL_KEYS = [
|
||||
"settings.channels.configuredInstances",
|
||||
"settings.channels.connectPreview",
|
||||
"settings.channels.copyCommand",
|
||||
"settings.channels.filterAll",
|
||||
"settings.channels.enabledOnly",
|
||||
"settings.channels.filterOff",
|
||||
"settings.channels.filterOn",
|
||||
"settings.channels.helperCopied",
|
||||
@@ -696,7 +695,7 @@ describe("webui i18n", () => {
|
||||
expect(settings.overview.webSearch).toBe("网络搜索");
|
||||
expect(settings.overview.workspace).toBe("工作目录");
|
||||
expect(settings.skills.installedTab).toBe("已安装");
|
||||
expect(settings.skills.discoverTab).toBe("发现");
|
||||
expect(settings.skills.discoverTab).toBe("技能市场");
|
||||
expect(settings.skills.marketplaceProviderFilter).toBe("技能来源");
|
||||
expect(settings.skills.marketplaceProviderAll).toBe("全部");
|
||||
expect(settings.skills.marketplaceSearchPlaceholder).toBe("搜索技能");
|
||||
|
||||
@@ -16,6 +16,8 @@ import {
|
||||
installSettingsViewTestHooks,
|
||||
jsonResponse,
|
||||
renderSettingsView,
|
||||
selectToolType,
|
||||
showOnlyReadyTools,
|
||||
requestMutationMock,
|
||||
settingsPayload,
|
||||
} 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;
|
||||
}));
|
||||
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" }));
|
||||
const dialog = await screen.findByRole("dialog", { name: "Metabase" });
|
||||
expect(within(dialog).getByRole("tab", { name: "Overview" })).toHaveAttribute("aria-selected", "true");
|
||||
@@ -349,7 +352,8 @@ describe("MCP connection draft lifecycle", () => {
|
||||
});
|
||||
|
||||
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(screen.getByRole("switch", { name: "Use proxy" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "Connect" }));
|
||||
|
||||
@@ -44,11 +44,11 @@ function LocalShell({ collapsed = false, initialRemote = false }) {
|
||||
return () => window.removeEventListener("hashchange", route);
|
||||
}, []);
|
||||
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}
|
||||
onRequestRename={async () => {}} onToggleArchive={noop} onToggleGroup={noop}
|
||||
onRequestRenameProject={noop} onNewChatInProject={noop} onOpenSettings={noop}
|
||||
onOpenApps={noop} onOpenSkills={noop} onOpenAutomations={noop} onOpenChannels={noop}
|
||||
onOpenApps={noop} onOpenAutomations={noop}
|
||||
onOpenSearch={noop} onToggleArchived={noop} />
|
||||
<main><div hidden={connections?.managing} aria-hidden={connections?.managing || undefined}>
|
||||
{remotePage ? <RemoteConnectionsPage onBackToChat={() => setRemotePage(false)} /> : <><p>Local conversations</p><textarea aria-label="Local draft" /></>}
|
||||
|
||||
@@ -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 type { NanobotClient } from "@/lib/nanobot-client";
|
||||
@@ -6,6 +6,8 @@ import {
|
||||
installSettingsViewTestHooks,
|
||||
jsonResponse,
|
||||
renderSettingsView,
|
||||
selectToolType,
|
||||
showOnlyReadyTools,
|
||||
settingsPayload,
|
||||
} from "@/tests/settings-test-utils";
|
||||
|
||||
@@ -42,7 +44,10 @@ describe("Apps default filter", () => {
|
||||
renderSettingsView({ initialSettings: settingsPayload() });
|
||||
|
||||
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 () => {
|
||||
@@ -56,14 +61,16 @@ describe("Apps default filter", () => {
|
||||
renderSettingsView({ client, initialSettings: settingsPayload() });
|
||||
await act(async () => {});
|
||||
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 })); });
|
||||
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();
|
||||
|
||||
cleanup();
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -6,6 +6,8 @@ import {
|
||||
installSettingsViewTestHooks,
|
||||
jsonResponse,
|
||||
renderSettingsView,
|
||||
selectToolType,
|
||||
showOnlyReadyTools,
|
||||
requestMutationMock,
|
||||
settingsPayload,
|
||||
} from "@/tests/settings-test-utils";
|
||||
@@ -43,7 +45,7 @@ async function connectXmind() {
|
||||
describe("SettingsView Apps catalog", () => {
|
||||
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 figmaConnected = {
|
||||
...xmindMcpPreset, name: "figma-connected", display_name: "Figma connected",
|
||||
@@ -72,18 +74,22 @@ describe("SettingsView Apps catalog", () => {
|
||||
}));
|
||||
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Ready" }));
|
||||
await showOnlyReadyTools(true);
|
||||
fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "figma" } });
|
||||
expect(await screen.findByRole("heading", { name: "Figma connected" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("heading", { name: "Figma CLI" })).toBeInTheDocument();
|
||||
expect(screen.queryByRole("heading", { name: "Figma local" })).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 connected" })).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.queryByRole("heading", { name: "Figma local" })).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;
|
||||
}));
|
||||
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" }));
|
||||
const dialog = await screen.findByRole("dialog", { name: "Xmind" });
|
||||
const configure = within(dialog).queryByRole("button", { name: "Configure proxy" });
|
||||
@@ -158,7 +165,8 @@ describe("SettingsView Apps catalog", () => {
|
||||
});
|
||||
|
||||
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" }));
|
||||
|
||||
const dialog = await screen.findByRole("dialog", { name: "Metabase" });
|
||||
@@ -247,7 +255,8 @@ describe("SettingsView Apps catalog", () => {
|
||||
vi.stubGlobal("open", open);
|
||||
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
fireEvent.click(await screen.findByRole("button", { name: "MCP" }));
|
||||
await selectToolType("MCP");
|
||||
await showOnlyReadyTools(false);
|
||||
expect(screen.getByText("MCP tools")).toBeInTheDocument();
|
||||
const connectButton = await screen.findByRole("button", { name: "Connect Xmind" });
|
||||
expect(connectButton).toHaveTextContent("Connect");
|
||||
@@ -320,10 +329,11 @@ describe("SettingsView Apps catalog", () => {
|
||||
requestMutationMock.mockRejectedValueOnce(new Error("Stopped after request assertion"));
|
||||
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Ready" }));
|
||||
expect(await screen.findByText("No tools are ready yet.")).toBeInTheDocument();
|
||||
await showOnlyReadyTools(true);
|
||||
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 row = heading.closest("article");
|
||||
@@ -382,7 +392,8 @@ describe("SettingsView Apps catalog", () => {
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
||||
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 row = heading.closest("article");
|
||||
@@ -425,13 +436,14 @@ describe("SettingsView Apps catalog", () => {
|
||||
|
||||
const client = { requestMutation: requestMutationMock, status: "open", onStatus: () => () => {} } as never;
|
||||
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" }))
|
||||
.toHaveAccessibleDescription("Connecting…");
|
||||
cleanup();
|
||||
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(mcpPresetRequests).toBe(1);
|
||||
expect(await screen.findByRole(
|
||||
@@ -441,7 +453,7 @@ describe("SettingsView Apps catalog", () => {
|
||||
)).toHaveTextContent("Manage");
|
||||
expect(mcpPresetRequests).toBe(2);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Ready" }));
|
||||
await showOnlyReadyTools(true);
|
||||
expect(await screen.findByRole("heading", { name: "Xmind" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -486,7 +498,8 @@ describe("SettingsView Apps catalog", () => {
|
||||
});
|
||||
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
fireEvent.click(await screen.findByRole("button", { name: "MCP" }));
|
||||
await selectToolType("MCP");
|
||||
await showOnlyReadyTools(false);
|
||||
expect(await screen.findByText("Connection failed.")).toBeInTheDocument();
|
||||
|
||||
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" });
|
||||
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" });
|
||||
expect(within(readyHeading.closest("article") as HTMLElement).getByText("MCP"))
|
||||
.toBeInTheDocument();
|
||||
@@ -546,7 +560,8 @@ describe("SettingsView Apps catalog", () => {
|
||||
});
|
||||
|
||||
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.change(screen.getByLabelText("Server name"), {
|
||||
@@ -673,7 +688,8 @@ describe("SettingsView Apps catalog", () => {
|
||||
vi.stubGlobal("open", vi.fn(() => popup));
|
||||
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
fireEvent.click(await screen.findByRole("button", { name: "MCP" }));
|
||||
await selectToolType("MCP");
|
||||
await showOnlyReadyTools(false);
|
||||
await connectXmind();
|
||||
|
||||
const callbackInput = await screen.findByRole("textbox", { name: "Callback URL" });
|
||||
@@ -740,7 +756,8 @@ describe("SettingsView Apps catalog", () => {
|
||||
vi.stubGlobal("open", vi.fn(() => popup));
|
||||
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
fireEvent.click(await screen.findByRole("button", { name: "MCP" }));
|
||||
await selectToolType("MCP");
|
||||
await showOnlyReadyTools(false);
|
||||
await connectXmind();
|
||||
|
||||
const cancelButton = await screen.findByRole("button", { name: "Cancel" });
|
||||
@@ -796,7 +813,8 @@ describe("SettingsView Apps catalog", () => {
|
||||
});
|
||||
|
||||
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" }));
|
||||
const dialog = screen.getByRole("dialog", { name: "Xmind" });
|
||||
fireEvent.click(within(dialog).getByRole("tab", { name: "Connection" }));
|
||||
@@ -846,7 +864,8 @@ describe("SettingsView Apps catalog", () => {
|
||||
vi.stubGlobal("open", open);
|
||||
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
fireEvent.click(await screen.findByRole("button", { name: "MCP" }));
|
||||
await selectToolType("MCP");
|
||||
await showOnlyReadyTools(false);
|
||||
await connectXmind();
|
||||
|
||||
const continueButton = await screen.findByRole("button", { name: "Continue sign-in" });
|
||||
@@ -916,7 +935,8 @@ describe("SettingsView Apps catalog", () => {
|
||||
vi.stubGlobal("open", vi.fn(() => popup));
|
||||
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
fireEvent.click(await screen.findByRole("button", { name: "MCP" }));
|
||||
await selectToolType("MCP");
|
||||
await showOnlyReadyTools(false);
|
||||
await connectXmind();
|
||||
|
||||
await waitFor(() => expect(statusCalls).toBe(1), { timeout: 2000 });
|
||||
|
||||
@@ -406,11 +406,12 @@ describe("Settings channels", () => {
|
||||
expect(await screen.findByRole("button", { name: "View Enabled 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.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("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();
|
||||
});
|
||||
|
||||
@@ -430,7 +431,7 @@ describe("Settings channels", () => {
|
||||
|
||||
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: "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 () => {
|
||||
@@ -453,7 +454,7 @@ describe("Settings channels", () => {
|
||||
|
||||
expect(await screen.findByText("nanobot WebUI")).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 () => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { NanobotClient } from "@/lib/nanobot-client";
|
||||
import { ClientProvider } from "@/providers/ClientProvider";
|
||||
import type { SettingsPayload } from "@/lib/types";
|
||||
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 =
|
||||
"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();
|
||||
|
||||
expect(await screen.findByText("No CLI Apps available.")).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Browse MCP tools" }));
|
||||
expect(await screen.findByText("No tools available")).toBeInTheDocument();
|
||||
await selectToolType("MCP");
|
||||
expect(await screen.findByText("Add MCP")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { SkillsCatalogSettings } from "@/components/settings/SkillsCatalogSettin
|
||||
import { ClientProvider } from "@/providers/ClientProvider";
|
||||
import type { McpPresetInfo } from "@/lib/types";
|
||||
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 = {
|
||||
@@ -138,7 +138,8 @@ describe("Settings system domains", () => {
|
||||
|
||||
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(screen.getByText(/Control the desktop/)).toBeInTheDocument();
|
||||
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(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.queryByRole("heading", { name: "Managed plugin" })).not.toBeInTheDocument();
|
||||
fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "separate" } });
|
||||
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();
|
||||
fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Agent Plugin disabled" }));
|
||||
@@ -206,7 +208,8 @@ describe("Settings system domains", () => {
|
||||
return jsonResponse(settingsPayload());
|
||||
}));
|
||||
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();
|
||||
});
|
||||
|
||||
@@ -267,7 +270,8 @@ describe("Settings system domains", () => {
|
||||
it("does not hide a standalone heading when the navigation is collapsed or absent", () => {
|
||||
renderSettingsView({ initialSection: "skills", initialSettings: settingsPayload(), showSidebar: false, mainNavigationExpanded: 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 () => {
|
||||
@@ -288,10 +292,13 @@ describe("Settings system domains", () => {
|
||||
expect(title.nextElementSibling).not.toHaveClass(className);
|
||||
}
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "MCP" }));
|
||||
await selectToolType("MCP");
|
||||
const mcpTitle = screen.getByRole("heading", { name: "MCP tools" });
|
||||
expect(mcpTitle.parentElement).toHaveClass("settings-section-heading");
|
||||
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)(
|
||||
@@ -320,7 +327,7 @@ describe("Settings system domains", () => {
|
||||
}));
|
||||
renderSettingsView({ initialSection: "apps", initialSettings: settingsPayload() });
|
||||
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 image = row.querySelector("img")!;
|
||||
expect(image).toHaveAttribute("src", logoUrl);
|
||||
@@ -660,10 +667,12 @@ describe("Settings system domains", () => {
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
|
||||
expect(await screen.findByText("AnyGen")).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Ready" })).toHaveAttribute("aria-pressed", "false");
|
||||
expect(screen.getByRole("button", { name: "CLI Apps" })).toHaveAttribute("aria-pressed", "true");
|
||||
expect(screen.getByRole("button", { name: "Agent Plugins" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "MCP" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("switch", { name: "Ready only" })).not.toBeChecked();
|
||||
const filters = within(screen.getByRole("radiogroup", { name: "Tool type" }));
|
||||
expect(filters.getByRole("radio", { name: "All" })).toBeChecked();
|
||||
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 () => {
|
||||
@@ -745,7 +754,6 @@ describe("Settings system domains", () => {
|
||||
renderSettingsView({ initialSection: "channels" });
|
||||
|
||||
const matrixRow = await screen.findByRole("button", { name: "View Matrix settings" });
|
||||
expect(matrixRow).toHaveAttribute("aria-haspopup", "dialog");
|
||||
fireEvent.click(matrixRow);
|
||||
expect(screen.queryByRole("dialog")).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);
|
||||
|
||||
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("User ID")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("Device ID")).toBeInTheDocument();
|
||||
|
||||
@@ -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 { afterEach, beforeEach, vi } from "vitest";
|
||||
import { SettingsView } from "@/components/settings/SettingsView";
|
||||
@@ -171,6 +171,16 @@ export async function openPopover(trigger: HTMLElement) {
|
||||
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() {
|
||||
beforeEach(() => {
|
||||
requestMutationMock.mockReset().mockResolvedValue(settingsPayload());
|
||||
|
||||
@@ -3,7 +3,7 @@ import userEvent from "@testing-library/user-event";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
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 = {
|
||||
name: "docs", display_name: "Docs MCP", category: "productivity", description: "Docs",
|
||||
@@ -26,7 +26,7 @@ function installProxySettings() {
|
||||
}
|
||||
|
||||
async function openMcpSetup() {
|
||||
fireEvent.click(await screen.findByRole("button", { name: "MCP" }));
|
||||
await selectToolType("MCP");
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Manage Docs MCP" }));
|
||||
const parent = await screen.findByRole("dialog", { name: "Docs MCP" });
|
||||
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 () => {
|
||||
const { settings } = installProxySettings();
|
||||
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" }));
|
||||
const parent = await screen.findByRole("dialog", { name: "Docs MCP" });
|
||||
fireEvent.click(within(parent).getByRole("tab", { name: "Tools" }));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useState, type ComponentProps } from "react";
|
||||
import { act, fireEvent, render, renderHook, screen } from "@testing-library/react";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
@@ -32,10 +33,18 @@ vi.mock("@/lib/api", async (importOriginal) => {
|
||||
|
||||
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) {
|
||||
return (
|
||||
<ClientProvider client={client} token={token}>
|
||||
<SkillsMarketplace
|
||||
<MarketplaceTestView
|
||||
installedSkills={[]}
|
||||
installing=""
|
||||
onInstallingChange={() => {}}
|
||||
@@ -73,7 +82,7 @@ describe("useSkills", () => {
|
||||
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
|
||||
await act(async () => { resolveRetry({ skills: [] }); });
|
||||
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(); });
|
||||
expect(screen.getByText("No skills are available.")).toBeInTheDocument();
|
||||
@@ -88,6 +97,10 @@ describe("useSkills", () => {
|
||||
target: { value: "" },
|
||||
});
|
||||
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);
|
||||
});
|
||||
|
||||
@@ -289,7 +302,7 @@ describe("SkillsMarketplace", () => {
|
||||
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 }]}
|
||||
installing="" onInstallingChange={vi.fn()}
|
||||
/></ClientProvider>);
|
||||
|
||||
@@ -154,14 +154,20 @@ describe("temporary chat navigation", () => {
|
||||
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",
|
||||
async (view) => {
|
||||
async (view, canonicalHash) => {
|
||||
window.history.replaceState(null, "", `/#/${view}?chat=websocket%3Aregular`);
|
||||
render(<App />);
|
||||
await screen.findByRole("button", { name: "Back to chat" });
|
||||
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(screen.queryByTestId("thread-message-region")).not.toBeInTheDocument();
|
||||
const requests = vi.mocked(fetch).mock.calls.map(([url]) => String(url));
|
||||
|
||||
@@ -185,10 +185,10 @@ describe("Sidebar update entry", () => {
|
||||
|
||||
it("renders the same entry in expanded and collapsed navigation", () => {
|
||||
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,
|
||||
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,
|
||||
availableUpdate: { version: "0.3.6", onDismiss: noop } };
|
||||
const { rerender } = render(<ClientProvider client={client} token="test"><Sidebar {...props} /></ClientProvider>);
|
||||
|
||||
@@ -15,7 +15,8 @@ function startupSkeleton(): Plugin {
|
||||
order: "post",
|
||||
handler(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()})();
|
||||
shell.dataset.startupSurface = layout.surface; shell.dataset.startupSection = layout.section;
|
||||
shell.dataset.sidebarExpanded = String(layout.sidebarExpanded); shell.dataset.existingChat = String(layout.existingChat);
|
||||
|
||||