fix(webui): separate agent plugins from CLI apps (#6687)
* fix(webui): separate agent plugins from CLI apps * fix(webui): preserve plugin payload row typing
This commit is contained in:
1 parent
e767174450
commit
b77e9592af
26 files changed
+485
-116
No files matched your search
+3
-1
@@ -235,12 +235,14 @@ Test a new channel with a private DM. When a supported channel sends a pairing c
|
||||
|
||||
## Apps
|
||||
|
||||
**Apps → Ready** lists capabilities available for use:
|
||||
**Apps → Ready** lists capabilities available for use. Use the **CLI Apps**, **Agent Plugins**, and **MCP** filters to manage each kind separately:
|
||||
|
||||
- **Agent Plugins** are local packages that can bundle skills, MCP servers, or both. A package under `<workspace>/plugins/` is installed but remains inactive until you enable it in Apps.
|
||||
- **CLI Apps** are command-line tool adapters on the nanobot host. Install and enable an adapter before attaching it to a turn.
|
||||
- **MCP** lists Model Context Protocol servers. Presets provide known configurations, and the **Add MCP server** panel accepts stdio, HTTP, and SSE servers. Custom HTTP/SSE servers can use no authentication, OAuth, or request headers. After saving an OAuth server, choose **Connect** to open its sign-in page. Presets such as Xmind, Notion, and Linear already use OAuth. HTTPS and localhost WebUIs return automatically; a remote plain-HTTP WebUI shows one field for pasting the complete localhost callback URL.
|
||||
|
||||
A plugin generated by a CLI App is managed from that app's entry, including re-enabling it if needed. Other Agent Plugins appear in the **Agent Plugins** filter. Plugin details show declared permissions and MCP servers; declared permissions do not sandbox a plugin from nanobot's operating-system permissions.
|
||||
|
||||
CLI Apps run with a limited environment that excludes provider API keys. On Unix, they inherit `XDG_RUNTIME_DIR` when it is set in the gateway's environment, so desktop CLIs such as Obsidian can locate the running application. Start the gateway in the same desktop session as the app to inherit that runtime directory.
|
||||
|
||||
Manage optional runtime support from **System**, **Models**, or **Web**, or use [`nanobot plugins`](./cli-reference.md#optional-features). That command manages runtime extras, not Agent Plugin packages. PDF and common Office attachment readers require no setup.
|
||||
|
||||
@@ -457,6 +457,13 @@ class CliAppManager:
|
||||
"""Return registry names explicitly installed through CLI Apps."""
|
||||
return sorted(str(name) for name in self._load_installed())
|
||||
|
||||
def managed_plugin_owners(self) -> dict[Path, str]:
|
||||
"""Map the plugin directories managed by installed CLI Apps to their owners."""
|
||||
return {
|
||||
(self.workspace / _plugin_skill_relative_path(name)).parents[2].resolve(): name
|
||||
for name in self.installed_names()
|
||||
}
|
||||
|
||||
def installed_skill_aliases(self) -> dict[str, str]:
|
||||
"""Map pre-plugin CLI App skill names to their portable identities."""
|
||||
aliases: dict[str, str] = {}
|
||||
|
||||
@@ -23,6 +23,7 @@ from nanobot.agent.tools.mcp_oauth import (
|
||||
mcp_oauth_has_credentials,
|
||||
)
|
||||
from nanobot.agent.tools.registry import ToolRegistry
|
||||
from nanobot.apps.cli import CliAppManager
|
||||
from nanobot.apps.protocol import app_manifest, compact_dict
|
||||
from nanobot.config.loader import load_config, resolve_config_env_vars, save_config
|
||||
from nanobot.config.network import NetworkConfig
|
||||
@@ -600,8 +601,9 @@ def mcp_presets_payload(
|
||||
if name not in known
|
||||
]
|
||||
existing_names = {str(row["name"]) for row in (*preset_rows, *custom_rows)}
|
||||
plugin_rows = [
|
||||
_agent_plugin_payload(plugin)
|
||||
managed_plugins = CliAppManager(workspace=config.workspace_path).managed_plugin_owners()
|
||||
plugin_rows: list[dict[str, Any]] = [
|
||||
_agent_plugin_payload(plugin) | {"managed_by_cli": managed_plugins.get(plugin.root)}
|
||||
for plugin in discover_agent_plugins(config.workspace_path)
|
||||
if f"plugin-{plugin.name}" not in existing_names
|
||||
]
|
||||
|
||||
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import sys
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
|
||||
@@ -10,6 +11,7 @@ from mcp.shared.auth import OAuthToken
|
||||
|
||||
from nanobot.agent.plugins import AGENT_PLUGIN_MCP_SCHEMA, AGENT_PLUGIN_SCHEMA
|
||||
from nanobot.agent.tools.mcp_oauth import MCPOAuthStorage, mcp_oauth_has_credentials
|
||||
from nanobot.apps.cli import CliAppManager
|
||||
from nanobot.config.loader import load_config, save_config
|
||||
from nanobot.config.schema import Config
|
||||
from nanobot.webui.mcp_presets_api import (
|
||||
@@ -162,6 +164,33 @@ def test_agent_plugin_reuses_mcp_catalog_and_runtime_action(
|
||||
assert len(rows) == 1 and rows[0]["source"] == "custom"
|
||||
|
||||
|
||||
def test_cli_installer_exposes_managed_plugin_owner_without_claiming_other_plugins(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
_use_config(tmp_path, monkeypatch)
|
||||
workspace = load_config().workspace_path
|
||||
manager = CliAppManager(workspace=workspace)
|
||||
app = {"name": "example", "display_name": "Example", "package_manager": "bundled", "entry_point": sys.executable}
|
||||
monkeypatch.setattr(CliAppManager, "get_app", lambda self, name, **kwargs: app)
|
||||
monkeypatch.setattr(CliAppManager, "payload", lambda self, **kwargs: {})
|
||||
monkeypatch.setattr(CliAppManager, "_fetch_skill_content", lambda self, app: None)
|
||||
manager.install("example")
|
||||
|
||||
unrelated = workspace / "plugins" / "cli-app-unrelated"
|
||||
unrelated.mkdir(parents=True)
|
||||
(unrelated / "plugin.json").write_text(json.dumps({
|
||||
"$schema": AGENT_PLUGIN_SCHEMA, "name": "cli-app-unrelated", "description": "A separate plugin",
|
||||
}), encoding="utf-8")
|
||||
|
||||
rows = {item["name"]: item for item in mcp_presets_payload()["presets"] if item["source"] == "agent-plugin"}
|
||||
assert rows["plugin-cli-app-example"]["managed_by_cli"] == "example"
|
||||
assert rows["plugin-cli-app-unrelated"]["managed_by_cli"] is None
|
||||
|
||||
manager.uninstall("example")
|
||||
names = {item["name"] for item in mcp_presets_payload()["presets"] if item["source"] == "agent-plugin"}
|
||||
assert names == {"plugin-cli-app-unrelated"}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_oauth_preset_is_one_click_configured_after_token_storage(
|
||||
tmp_path,
|
||||
|
||||
@@ -209,7 +209,7 @@ async function loadFixture() {
|
||||
const fixture = await loadFixture();
|
||||
await initializeI18n();
|
||||
if (fixtureCase === "activity-wheel") await setAppLanguage("zh-CN");
|
||||
if ((["appearance", "session-transition"].includes(fixtureCase ?? "") || historyPreview) && parameters.has("lang")) {
|
||||
if ((["appearance", "session-transition", "tools-catalog"].includes(fixtureCase ?? "") || historyPreview) && parameters.has("lang")) {
|
||||
await setAppLanguage(normalizeLocale(parameters.get("lang")));
|
||||
}
|
||||
createRoot(document.getElementById("root")!).render(<TooltipProvider>{fixture}</TooltipProvider>);
|
||||
@@ -28,24 +28,75 @@ test("settings reentry reuses tools immediately and refreshes expired catalogs w
|
||||
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("heading", { name: "Fixture plugin", exact: true })).toHaveCount(0);
|
||||
await page.getByRole("button", { name: "Apps", exact: true }).click();
|
||||
await page.getByRole("button", { name: "CLI Apps", exact: true }).click();
|
||||
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 expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toHaveCount(0);
|
||||
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: "Apps", exact: true }).click();
|
||||
await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toBeVisible();
|
||||
await page.getByRole("button", { name: "Agent Plugins", exact: true }).click();
|
||||
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.getByRole("button", { name: "Open settings", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Apps", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Agent Plugins", exact: true }).click();
|
||||
await expect.poll(() => counts).toEqual({ cli: 2, mcp: 2 });
|
||||
await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("heading", { name: "Fixture plugin", exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("status", { name: "Loading apps…", exact: true })).toHaveCount(0);
|
||||
release();
|
||||
await expect(page.getByRole("heading", { name: "Updated CLI", exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("heading", { name: "Updated plugin", exact: true })).toBeVisible();
|
||||
await page.getByRole("button", { name: "CLI Apps", exact: true }).click();
|
||||
await 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 });
|
||||
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 => {
|
||||
const bounds = element.getBoundingClientRect();
|
||||
return {
|
||||
left: bounds.left,
|
||||
right: bounds.right,
|
||||
buttons: Array.from(element.querySelectorAll("button"), button => ({
|
||||
text: button.textContent,
|
||||
fits: button.scrollWidth <= button.clientWidth,
|
||||
})),
|
||||
};
|
||||
});
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test("opens the generated plugin from its CLI app", 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: true,
|
||||
}], installed_count: 1 } }));
|
||||
await page.route("**/api/settings/mcp-presets", route => route.fulfill({ json: { presets: [{
|
||||
name: "plugin-cli-app-fixture-cli", display_name: "Generated plugin", category: "Plugin",
|
||||
description: "Generated skill", requires: "", transport: "stdio", source: "agent-plugin",
|
||||
managed_by_cli: "fixture-cli", install_supported: false, installed: true, configured: true,
|
||||
enabled: true, available: true, status: "enabled", required_fields: [], docs_url: "", note: "", connection_summary: "",
|
||||
}], installed_count: 1 } }));
|
||||
await page.goto("/browser/fixture.html?case=tools-catalog");
|
||||
await expect(page.getByRole("heading", { name: "Fixture CLI", exact: true })).toBeVisible();
|
||||
await page.getByRole("button", { name: "App ready", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "Agent Plugin", exact: true }).click();
|
||||
await expect(page.getByRole("dialog", { name: "Generated plugin" })).toBeVisible();
|
||||
await expect(page.getByRole("dialog").getByRole("button", { name: "Disable" })).toBeVisible();
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
import { ExternalLink, Loader2 } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@/components/ui/dialog";
|
||||
import type { McpPresetInfo } from "@/lib/types";
|
||||
|
||||
export function AgentPluginDialog({
|
||||
plugin,
|
||||
open,
|
||||
actionKey,
|
||||
onOpenChange,
|
||||
onAction,
|
||||
}: {
|
||||
plugin: McpPresetInfo;
|
||||
open: boolean;
|
||||
actionKey: string | null;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onAction: (action: "enable" | "disable", name: string) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const enabled = Boolean(plugin.enabled);
|
||||
const action = enabled ? "disable" : "enable";
|
||||
const busy = actionKey === `${action}:${plugin.name}`;
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-lg">
|
||||
<div className="space-y-1 pr-8">
|
||||
<DialogTitle>{plugin.display_name}</DialogTitle>
|
||||
<DialogDescription>{plugin.description}</DialogDescription>
|
||||
</div>
|
||||
<div className="space-y-4 text-sm">
|
||||
<p className="font-medium">{t(enabled ? "settings.values.enabled" : "settings.values.disabled")}</p>
|
||||
{plugin.requires ? (
|
||||
<div>
|
||||
<p className="font-medium">{t("settings.apps.pluginPermissions")}</p>
|
||||
<p className="mt-1 text-muted-foreground">{plugin.requires}</p>
|
||||
</div>
|
||||
) : null}
|
||||
{plugin.connection_summary ? (
|
||||
<div>
|
||||
<p className="font-medium">{t("settings.apps.pluginServers")}</p>
|
||||
<p className="mt-1 break-words text-muted-foreground">{plugin.connection_summary}</p>
|
||||
</div>
|
||||
) : null}
|
||||
<p className="text-muted-foreground">{t("settings.apps.pluginTrustNotice")}</p>
|
||||
{plugin.docs_url ? (
|
||||
<a href={plugin.docs_url} target="_blank" rel="noreferrer" className="inline-flex items-center gap-1.5 font-medium text-foreground/75 hover:text-foreground">
|
||||
{t("settings.mcp.openDocs")} <ExternalLink className="h-3.5 w-3.5" aria-hidden />
|
||||
</a>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="flex justify-end">
|
||||
<Button type="button" disabled={busy} onClick={() => { onOpenChange(false); onAction(action, plugin.name); }}>
|
||||
{busy ? <Loader2 className="mr-1.5 h-4 w-4 animate-spin motion-reduce:animate-none" aria-hidden /> : null}
|
||||
{t(enabled ? "settings.nanobotFeatures.disable" : "settings.nanobotFeatures.enable")}
|
||||
</Button>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -41,6 +41,7 @@ import {
|
||||
SETTINGS_SEARCH_INPUT_CLASS,
|
||||
SettingsSectionTitle,
|
||||
} from "@/components/settings/shared/SettingsControls";
|
||||
import { AgentPluginDialog } from "@/components/settings/system/AgentPluginDialog";
|
||||
import {
|
||||
McpManagementDialog,
|
||||
type McpManagementTab,
|
||||
@@ -67,7 +68,7 @@ import type {
|
||||
} from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type AppsKindFilter = "ready" | "cli" | "mcp";
|
||||
export type AppsKindFilter = "ready" | "cli" | "plugins" | "mcp";
|
||||
type AppsCatalogItem =
|
||||
| { id: string; kind: "cli"; app: CliAppInfo }
|
||||
| { id: string; kind: "mcp"; preset: McpPresetInfo };
|
||||
@@ -216,24 +217,31 @@ export function AppsCatalogSettings({
|
||||
const tx = (key: string, fallback: string) => t(key, { defaultValue: fallback });
|
||||
const filterOptions = [
|
||||
{ value: "ready", label: tx("settings.apps.filterAll", "Ready") },
|
||||
{ value: "cli", label: tx("settings.apps.filterCli", "Apps") },
|
||||
{ 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") },
|
||||
];
|
||||
const normalizedQuery = query.trim().toLowerCase();
|
||||
const installedCliNames = new Set((cliApps?.apps ?? []).filter((app) => app.installed).map((app) => app.name));
|
||||
const managedPlugins = new Map(
|
||||
(mcpPresets?.presets ?? [])
|
||||
.filter((preset) => preset.source === "agent-plugin" && preset.managed_by_cli)
|
||||
.map((preset) => [preset.managed_by_cli!, preset]),
|
||||
);
|
||||
const items: AppsCatalogItem[] = [
|
||||
...(cliApps?.apps ?? []).map((app) => ({ id: `cli:${app.name}`, kind: "cli" as const, app })),
|
||||
...(mcpPresets?.presets ?? []).map((preset) => ({
|
||||
id: `mcp:${preset.name}`,
|
||||
kind: "mcp" as const,
|
||||
preset,
|
||||
})),
|
||||
...(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" || item.preset.source === "agent-plugin"
|
||||
: item.kind === "mcp" && item.preset.source !== "agent-plugin";
|
||||
? 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) => {
|
||||
@@ -250,10 +258,12 @@ export function AppsCatalogSettings({
|
||||
? tx("settings.apps.empty", "No tools match your search.")
|
||||
: filter === "cli"
|
||||
? tx("settings.apps.emptyApps", "No apps available.")
|
||||
: 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"
|
||||
? 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"
|
||||
@@ -296,6 +306,7 @@ export function AppsCatalogSettings({
|
||||
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>
|
||||
@@ -325,7 +336,9 @@ export function AppsCatalogSettings({
|
||||
<SettingsSectionTitle>
|
||||
{filter === "mcp"
|
||||
? tx("settings.apps.mcpTools", "MCP tools")
|
||||
: tx("settings.apps.featured", "Tools")}
|
||||
: filter === "plugins"
|
||||
? tx("settings.apps.filterPlugins", "Plugins")
|
||||
: tx("settings.apps.featured", "Tools")}
|
||||
</SettingsSectionTitle>
|
||||
<span className="text-[12px] tabular-nums text-muted-foreground">
|
||||
{loading ? "—" : items.length}
|
||||
@@ -338,9 +351,12 @@ export function AppsCatalogSettings({
|
||||
<CliAppsCatalogRow
|
||||
key={item.id}
|
||||
app={item.app}
|
||||
plugin={item.app.installed ? managedPlugins.get(item.app.name) : undefined}
|
||||
actionKey={cliActionKey}
|
||||
pluginActionKey={mcpActionKey}
|
||||
showBrandLogos={showBrandLogos}
|
||||
onAction={onCliAction}
|
||||
onPluginAction={onMcpAction}
|
||||
/>
|
||||
) : (
|
||||
<McpAppsCatalogRow
|
||||
@@ -399,10 +415,9 @@ export function AppsCatalogSettings({
|
||||
</Button>
|
||||
) : (
|
||||
<p className="mx-auto mt-2 max-w-[28rem] text-[12px] leading-5">
|
||||
{tx(
|
||||
"settings.apps.emptyIntegrationsHint",
|
||||
"Add a custom MCP server below.",
|
||||
)}
|
||||
{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.")}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
@@ -427,16 +442,23 @@ export function AppsCatalogSettings({
|
||||
|
||||
function CliAppsCatalogRow({
|
||||
app,
|
||||
plugin,
|
||||
actionKey,
|
||||
pluginActionKey,
|
||||
showBrandLogos,
|
||||
onAction,
|
||||
onPluginAction,
|
||||
}: {
|
||||
app: CliAppInfo;
|
||||
plugin?: McpPresetInfo;
|
||||
actionKey: string | null;
|
||||
pluginActionKey: string | null;
|
||||
showBrandLogos: boolean;
|
||||
onAction: (action: "install" | "update" | "uninstall" | "test", name: string) => void;
|
||||
onPluginAction: (action: "enable" | "disable", name: string) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [pluginOpen, setPluginOpen] = useState(false);
|
||||
const tx = (key: string, fallback: string) => t(key, { defaultValue: fallback });
|
||||
const installBusy = actionKey === `install:${app.name}`;
|
||||
const updateBusy = actionKey === `update:${app.name}`;
|
||||
@@ -454,6 +476,11 @@ function CliAppsCatalogRow({
|
||||
<AppsTypeBadge>{tx("settings.apps.cliLabel", "App")}</AppsTypeBadge>
|
||||
</div>
|
||||
<p className="mt-0.5 truncate text-[12.5px] leading-5 text-muted-foreground">{description}</p>
|
||||
{plugin?.enabled === false ? (
|
||||
<button type="button" onClick={() => setPluginOpen(true)} className="text-left text-[12px] font-medium text-destructive underline">
|
||||
{tx("settings.apps.pluginDisabled", "Agent Plugin disabled")}
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-1">
|
||||
{app.installed ? (
|
||||
@@ -470,6 +497,12 @@ function CliAppsCatalogRow({
|
||||
</AppsActionButton>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
{plugin ? (
|
||||
<DropdownMenuItem disabled={busy} onClick={() => setPluginOpen(true)}>
|
||||
<AppActionsIcon aria-hidden />
|
||||
{tx("settings.apps.pluginDetails", "Agent Plugin")}
|
||||
</DropdownMenuItem>
|
||||
) : null}
|
||||
<DropdownMenuItem disabled={busy} onClick={() => onAction("test", app.name)}>
|
||||
<PlayCircle aria-hidden />
|
||||
{tx("settings.cliApps.test", "Test CLI")}
|
||||
@@ -512,6 +545,15 @@ function CliAppsCatalogRow({
|
||||
</AppsActionButton>
|
||||
)}
|
||||
</div>
|
||||
{plugin && pluginOpen ? (
|
||||
<AgentPluginDialog
|
||||
plugin={plugin}
|
||||
open={pluginOpen}
|
||||
actionKey={pluginActionKey}
|
||||
onOpenChange={setPluginOpen}
|
||||
onAction={onPluginAction}
|
||||
/>
|
||||
) : null}
|
||||
</article>
|
||||
);
|
||||
}
|
||||
@@ -595,7 +637,7 @@ function McpAppsCatalogRow({
|
||||
const runtimeFailed = !toggleable && preset.installed && preset.runtime_status === "failed";
|
||||
const connecting = Boolean(oauthFlow) || (runtimeConnecting && configuredInstalled);
|
||||
const statusLabel = toggleable
|
||||
? tx("settings.nanobotFeatures.enabled", "Enabled")
|
||||
? preset.enabled ? tx("settings.values.enabled", "Enabled") : tx("settings.values.disabled", "Disabled")
|
||||
: runtimeConnected
|
||||
? tx("connection.open", "Connected")
|
||||
: mcpPresetStatusLabel(preset.status, tx);
|
||||
@@ -895,7 +937,15 @@ function McpAppsCatalogRow({
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{managementOpen ? (
|
||||
{managementOpen && agentPlugin ? (
|
||||
<AgentPluginDialog
|
||||
plugin={preset}
|
||||
open={managementOpen}
|
||||
actionKey={actionKey}
|
||||
onOpenChange={setManagementOpen}
|
||||
onAction={onAction}
|
||||
/>
|
||||
) : managementOpen ? (
|
||||
<McpManagementDialog
|
||||
onConfigureProxy={onConfigureProxy}
|
||||
preset={preset}
|
||||
|
||||
@@ -172,6 +172,7 @@ export function createSystemSettingsActions({
|
||||
setCliApps(payload);
|
||||
if (action !== "test") {
|
||||
notifyCliAppsChanged(payload);
|
||||
state.toolsCatalog.invalidateMcpPresets();
|
||||
}
|
||||
setCliAppsMessage(payload.last_action?.message ?? null);
|
||||
setCliAppsFocusName(action === "uninstall" ? null : name);
|
||||
|
||||
@@ -1438,14 +1438,14 @@
|
||||
"enable": "Enable tracing"
|
||||
},
|
||||
"apps": {
|
||||
"description": "Connect tools and call them with @ in chat.",
|
||||
"cliLabel": "App",
|
||||
"description": "Manage CLI Apps, Agent Plugins, and MCP tools.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "Channel",
|
||||
"featureLabel": "Feature",
|
||||
"filterAll": "Ready",
|
||||
"filterPlugins": "Plugins",
|
||||
"filterCli": "Apps",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
"enabledSummary": "{{count}} ready",
|
||||
"searchPlaceholder": "Search tools",
|
||||
@@ -1453,14 +1453,21 @@
|
||||
"mcpTools": "MCP tools",
|
||||
"loading": "Loading apps…",
|
||||
"empty": "No tools match your search.",
|
||||
"emptyApps": "No apps available.",
|
||||
"emptyApps": "No CLI Apps available.",
|
||||
"emptyIntegrations": "No MCP tools available.",
|
||||
"emptyReady": "No tools are ready yet.",
|
||||
"clearSearch": "Clear search",
|
||||
"browseApps": "Browse apps",
|
||||
"browseApps": "Browse CLI Apps",
|
||||
"browseIntegrations": "Browse MCP tools",
|
||||
"emptyIntegrationsHint": "Add a custom MCP server below.",
|
||||
"restartRequired": "Restart nanobot to apply updated apps and MCP tools."
|
||||
"restartRequired": "Restart nanobot to apply updated apps and MCP tools.",
|
||||
"emptyPlugins": "No Agent Plugins installed.",
|
||||
"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.",
|
||||
"pluginDetails": "Agent Plugin",
|
||||
"pluginDisabled": "Agent Plugin disabled"
|
||||
},
|
||||
"channels": {
|
||||
"description": "Connect chat apps, email, and WebUI.",
|
||||
|
||||
@@ -1256,14 +1256,14 @@
|
||||
"thirdPartyBrands": "Los nombres, logotipos y marcas de productos pertenecen a sus respectivos propietarios. Su uso es solo identificativo y no implica respaldo."
|
||||
},
|
||||
"apps": {
|
||||
"description": "Conecta herramientas y úsalas con @ en el chat.",
|
||||
"cliLabel": "Aplicación",
|
||||
"description": "Gestiona aplicaciones CLI, Agent Plugins y herramientas MCP.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "Canal",
|
||||
"featureLabel": "Función",
|
||||
"filterAll": "Disponibles",
|
||||
"filterPlugins": "Complementos",
|
||||
"filterCli": "Aplicaciones",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
"enabledSummary": "{{count}} disponibles",
|
||||
"searchPlaceholder": "Buscar aplicaciones",
|
||||
@@ -1271,14 +1271,21 @@
|
||||
"mcpTools": "Herramientas MCP",
|
||||
"loading": "Cargando aplicaciones...",
|
||||
"empty": "Ninguna herramienta coincide con tu búsqueda.",
|
||||
"emptyApps": "No hay aplicaciones disponibles.",
|
||||
"emptyApps": "No hay aplicaciones CLI disponibles.",
|
||||
"emptyIntegrations": "No hay herramientas MCP disponibles.",
|
||||
"emptyReady": "Todavía no hay herramientas listas.",
|
||||
"clearSearch": "Borrar búsqueda",
|
||||
"browseApps": "Explorar aplicaciones",
|
||||
"browseApps": "Explorar aplicaciones CLI",
|
||||
"browseIntegrations": "Explorar herramientas MCP",
|
||||
"emptyIntegrationsHint": "Añade un servidor MCP personalizado abajo.",
|
||||
"restartRequired": "Reinicia nanobot para aplicar las aplicaciones y herramientas MCP actualizadas."
|
||||
"restartRequired": "Reinicia nanobot para aplicar las aplicaciones y herramientas MCP actualizadas.",
|
||||
"emptyPlugins": "No hay Agent Plugins instalados.",
|
||||
"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.",
|
||||
"pluginDetails": "Agent Plugin",
|
||||
"pluginDisabled": "Agent Plugin desactivado"
|
||||
},
|
||||
"channels": {
|
||||
"description": "Conecta apps de chat, correo y WebUI.",
|
||||
|
||||
@@ -1256,14 +1256,14 @@
|
||||
"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": {
|
||||
"description": "Connectez des outils et appelez-les avec @ dans les discussions.",
|
||||
"cliLabel": "Application",
|
||||
"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",
|
||||
"filterPlugins": "Extensions",
|
||||
"filterCli": "Applications",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
"enabledSummary": "{{count}} prêts",
|
||||
"searchPlaceholder": "Rechercher des applications",
|
||||
@@ -1271,14 +1271,21 @@
|
||||
"mcpTools": "Outils MCP",
|
||||
"loading": "Chargement des applications...",
|
||||
"empty": "Aucun outil ne correspond à votre recherche.",
|
||||
"emptyApps": "Aucune application disponible.",
|
||||
"emptyApps": "Aucune application CLI disponible.",
|
||||
"emptyIntegrations": "Aucun outil MCP disponible.",
|
||||
"emptyReady": "Aucun outil n’est encore prêt.",
|
||||
"clearSearch": "Effacer la recherche",
|
||||
"browseApps": "Parcourir les applications",
|
||||
"browseApps": "Parcourir les applications CLI",
|
||||
"browseIntegrations": "Parcourir les outils MCP",
|
||||
"emptyIntegrationsHint": "Ajoutez un serveur MCP personnalisé ci-dessous.",
|
||||
"restartRequired": "Redémarrez nanobot pour appliquer les applications et outils MCP mis à jour."
|
||||
"restartRequired": "Redémarrez nanobot pour appliquer les applications et outils MCP mis à jour.",
|
||||
"emptyPlugins": "Aucun Agent Plugin installé.",
|
||||
"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.",
|
||||
"pluginDetails": "Agent Plugin",
|
||||
"pluginDisabled": "Agent Plugin désactivé"
|
||||
},
|
||||
"channels": {
|
||||
"description": "Connectez les applications de discussion, l’e-mail et WebUI.",
|
||||
|
||||
@@ -1256,14 +1256,14 @@
|
||||
"thirdPartyBrands": "Nama produk, logo, dan merek adalah milik pemiliknya masing-masing. Penggunaan hanya untuk identifikasi dan tidak menyiratkan dukungan."
|
||||
},
|
||||
"apps": {
|
||||
"description": "Hubungkan alat dan panggil dengan @ di chat.",
|
||||
"cliLabel": "Aplikasi",
|
||||
"description": "Kelola CLI Apps, Agent Plugins, dan alat MCP.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "Kanal",
|
||||
"featureLabel": "Fitur",
|
||||
"filterAll": "Siap",
|
||||
"filterPlugins": "Plugin",
|
||||
"filterCli": "Aplikasi",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
"enabledSummary": "{{count}} siap",
|
||||
"searchPlaceholder": "Cari aplikasi",
|
||||
@@ -1271,14 +1271,21 @@
|
||||
"mcpTools": "Alat MCP",
|
||||
"loading": "Memuat aplikasi...",
|
||||
"empty": "Tidak ada alat yang cocok dengan pencarian Anda.",
|
||||
"emptyApps": "Tidak ada aplikasi yang tersedia.",
|
||||
"emptyApps": "Tidak ada CLI App yang tersedia.",
|
||||
"emptyIntegrations": "Tidak ada alat MCP yang tersedia.",
|
||||
"emptyReady": "Belum ada alat yang siap.",
|
||||
"clearSearch": "Hapus pencarian",
|
||||
"browseApps": "Jelajahi aplikasi",
|
||||
"browseApps": "Jelajahi CLI Apps",
|
||||
"browseIntegrations": "Jelajahi alat MCP",
|
||||
"emptyIntegrationsHint": "Tambahkan server MCP khusus di bawah.",
|
||||
"restartRequired": "Mulai ulang nanobot untuk menerapkan aplikasi dan alat MCP yang diperbarui."
|
||||
"restartRequired": "Mulai ulang nanobot untuk menerapkan aplikasi dan alat MCP yang diperbarui.",
|
||||
"emptyPlugins": "Belum ada Agent Plugin yang terpasang.",
|
||||
"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.",
|
||||
"pluginDetails": "Agent Plugin",
|
||||
"pluginDisabled": "Agent Plugin dinonaktifkan"
|
||||
},
|
||||
"channels": {
|
||||
"description": "Hubungkan aplikasi chat, email, dan WebUI.",
|
||||
|
||||
@@ -1256,14 +1256,14 @@
|
||||
"thirdPartyBrands": "製品名、ロゴ、ブランドはそれぞれの所有者に帰属します。使用は識別のみを目的とし、承認を意味するものではありません。"
|
||||
},
|
||||
"apps": {
|
||||
"description": "ツールを接続し、チャットで @ を使って呼び出します。",
|
||||
"cliLabel": "アプリ",
|
||||
"description": "CLI Apps、Agent Plugins、MCP ツールを管理します。",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "チャンネル",
|
||||
"featureLabel": "機能",
|
||||
"filterAll": "使用可能",
|
||||
"filterPlugins": "プラグイン",
|
||||
"filterCli": "アプリ",
|
||||
"filterPlugins": "Agent プラグイン",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
"enabledSummary": "{{count}} 件使用可能",
|
||||
"searchPlaceholder": "アプリを検索",
|
||||
@@ -1271,14 +1271,21 @@
|
||||
"mcpTools": "MCP ツール",
|
||||
"loading": "アプリを読み込み中...",
|
||||
"empty": "検索条件に一致するツールはありません。",
|
||||
"emptyApps": "利用できるアプリはありません。",
|
||||
"emptyApps": "利用できる CLI App はありません。",
|
||||
"emptyIntegrations": "利用できる MCP ツールはありません。",
|
||||
"emptyReady": "使用可能なツールはまだありません。",
|
||||
"clearSearch": "検索をクリア",
|
||||
"browseApps": "アプリを見る",
|
||||
"browseApps": "CLI Apps を見る",
|
||||
"browseIntegrations": "MCP ツールを見る",
|
||||
"emptyIntegrationsHint": "下からカスタム MCP サーバーを追加できます。",
|
||||
"restartRequired": "更新したアプリと MCP ツールを反映するには nanobot を再起動してください。"
|
||||
"restartRequired": "更新したアプリと MCP ツールを反映するには nanobot を再起動してください。",
|
||||
"emptyPlugins": "Agent プラグインはインストールされていません。",
|
||||
"emptyPluginsHint": "ワークスペースの plugins ディレクトリにプラグインを追加すると、ここで有効にできます。",
|
||||
"pluginPermissions": "宣言された権限",
|
||||
"pluginServers": "MCP サーバー",
|
||||
"pluginTrustNotice": "プラグインは nanobot の OS 権限で実行されます。宣言された権限によってサンドボックス化されるわけではありません。",
|
||||
"pluginDetails": "Agent プラグイン",
|
||||
"pluginDisabled": "Agent プラグインは無効です"
|
||||
},
|
||||
"channels": {
|
||||
"description": "チャットアプリ、メール、WebUI を接続します。",
|
||||
|
||||
@@ -1256,14 +1256,14 @@
|
||||
"thirdPartyBrands": "제품 이름, 로고 및 브랜드는 각 소유자의 자산입니다. 사용은 식별 목적일 뿐 보증이나 제휴를 의미하지 않습니다."
|
||||
},
|
||||
"apps": {
|
||||
"description": "도구를 연결하고 채팅에서 @로 호출하세요.",
|
||||
"cliLabel": "앱",
|
||||
"description": "CLI Apps, Agent Plugins 및 MCP 도구를 관리합니다.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "채널",
|
||||
"featureLabel": "기능",
|
||||
"filterAll": "사용 가능",
|
||||
"filterPlugins": "플러그인",
|
||||
"filterCli": "앱",
|
||||
"filterPlugins": "Agent 플러그인",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
"enabledSummary": "{{count}}개 사용 가능",
|
||||
"searchPlaceholder": "앱 검색",
|
||||
@@ -1271,14 +1271,21 @@
|
||||
"mcpTools": "MCP 도구",
|
||||
"loading": "앱을 불러오는 중...",
|
||||
"empty": "검색과 일치하는 도구가 없습니다.",
|
||||
"emptyApps": "사용 가능한 앱이 없습니다.",
|
||||
"emptyApps": "사용 가능한 CLI App이 없습니다.",
|
||||
"emptyIntegrations": "사용 가능한 MCP 도구가 없습니다.",
|
||||
"emptyReady": "아직 준비된 도구가 없습니다.",
|
||||
"clearSearch": "검색 지우기",
|
||||
"browseApps": "앱 둘러보기",
|
||||
"browseApps": "CLI Apps 둘러보기",
|
||||
"browseIntegrations": "MCP 도구 둘러보기",
|
||||
"emptyIntegrationsHint": "아래에서 사용자 지정 MCP 서버를 추가하세요.",
|
||||
"restartRequired": "업데이트된 앱과 MCP 도구를 적용하려면 nanobot을 다시 시작하세요."
|
||||
"restartRequired": "업데이트된 앱과 MCP 도구를 적용하려면 nanobot을 다시 시작하세요.",
|
||||
"emptyPlugins": "설치된 Agent 플러그인이 없습니다.",
|
||||
"emptyPluginsHint": "워크스페이스의 plugins 디렉터리에 플러그인을 추가하면 여기에서 활성화할 수 있습니다.",
|
||||
"pluginPermissions": "선언된 권한",
|
||||
"pluginServers": "MCP 서버",
|
||||
"pluginTrustNotice": "플러그인은 nanobot의 운영체제 권한으로 실행됩니다. 선언된 권한은 플러그인을 격리하지 않습니다.",
|
||||
"pluginDetails": "Agent 플러그인",
|
||||
"pluginDisabled": "Agent 플러그인이 비활성화됨"
|
||||
},
|
||||
"channels": {
|
||||
"description": "채팅 앱, 이메일 및 WebUI를 연결하세요.",
|
||||
|
||||
@@ -1258,14 +1258,14 @@
|
||||
"enable": "Ativar rastreamento"
|
||||
},
|
||||
"apps": {
|
||||
"description": "Conecte ferramentas e chame com @ nas conversas.",
|
||||
"cliLabel": "Aplicativo",
|
||||
"description": "Gerencie aplicativos CLI, Agent Plugins e ferramentas MCP.",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "Canal",
|
||||
"featureLabel": "Recurso",
|
||||
"filterAll": "Disponíveis",
|
||||
"filterPlugins": "Complementos",
|
||||
"filterCli": "Aplicativos",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
"enabledSummary": "{{count}} disponíveis",
|
||||
"searchPlaceholder": "Buscar ferramentas",
|
||||
@@ -1273,14 +1273,21 @@
|
||||
"mcpTools": "Ferramentas MCP",
|
||||
"loading": "Carregando aplicativos...",
|
||||
"empty": "Nenhuma ferramenta corresponde à sua busca.",
|
||||
"emptyApps": "Nenhum aplicativo disponível.",
|
||||
"emptyApps": "Nenhum aplicativo CLI disponível.",
|
||||
"emptyIntegrations": "Nenhuma ferramenta MCP disponível.",
|
||||
"emptyReady": "Ainda não há ferramentas prontas.",
|
||||
"clearSearch": "Limpar busca",
|
||||
"browseApps": "Explorar aplicativos",
|
||||
"browseApps": "Explorar aplicativos CLI",
|
||||
"browseIntegrations": "Explorar ferramentas MCP",
|
||||
"emptyIntegrationsHint": "Adicione um servidor MCP personalizado abaixo.",
|
||||
"restartRequired": "Reinicie o nanobot para aplicar os aplicativos e ferramentas MCP atualizados."
|
||||
"restartRequired": "Reinicie o nanobot para aplicar os aplicativos e ferramentas MCP atualizados.",
|
||||
"emptyPlugins": "Nenhum Agent Plugin instalado.",
|
||||
"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.",
|
||||
"pluginDetails": "Agent Plugin",
|
||||
"pluginDisabled": "Agent Plugin desativado"
|
||||
},
|
||||
"channels": {
|
||||
"description": "Conecte apps de conversa, e-mail e WebUI.",
|
||||
|
||||
@@ -1256,14 +1256,14 @@
|
||||
"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": {
|
||||
"description": "Kết nối công cụ và gọi bằng @ trong trò chuyện.",
|
||||
"cliLabel": "Ứng dụng",
|
||||
"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",
|
||||
"filterPlugins": "Plugin",
|
||||
"filterCli": "Ứng dụng",
|
||||
"filterPlugins": "Agent Plugins",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
"enabledSummary": "{{count}} sẵn sàng",
|
||||
"searchPlaceholder": "Tìm ứng dụng",
|
||||
@@ -1271,14 +1271,21 @@
|
||||
"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ó ứng dụng nào.",
|
||||
"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.",
|
||||
"clearSearch": "Xóa tìm kiếm",
|
||||
"browseApps": "Xem ứng dụng",
|
||||
"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.",
|
||||
"restartRequired": "Khởi động lại nanobot để áp dụng ứng dụng và công cụ MCP đã cập nhật."
|
||||
"restartRequired": "Khởi động lại nanobot để áp dụng ứng dụng và công cụ MCP đã cập nhật.",
|
||||
"emptyPlugins": "Chưa cài đặt Agent Plugin nào.",
|
||||
"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.",
|
||||
"pluginDetails": "Agent Plugin",
|
||||
"pluginDisabled": "Agent Plugin đã tắt"
|
||||
},
|
||||
"channels": {
|
||||
"description": "Kết nối ứng dụng trò chuyện, email và WebUI.",
|
||||
|
||||
@@ -1438,14 +1438,14 @@
|
||||
"enable": "启用追踪"
|
||||
},
|
||||
"apps": {
|
||||
"description": "接入工具,在对话中用 @ 调用",
|
||||
"cliLabel": "应用",
|
||||
"description": "管理 CLI Apps、Agent Plugins 和 MCP 工具。",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "聊天平台",
|
||||
"featureLabel": "功能",
|
||||
"filterAll": "已就绪",
|
||||
"filterPlugins": "插件",
|
||||
"filterCli": "应用",
|
||||
"filterPlugins": "Agent 插件",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
"enabledSummary": "{{count}} 个可用",
|
||||
"searchPlaceholder": "搜索工具",
|
||||
@@ -1453,14 +1453,21 @@
|
||||
"mcpTools": "MCP 工具",
|
||||
"loading": "正在加载应用...",
|
||||
"empty": "没有与搜索条件匹配的工具。",
|
||||
"emptyApps": "暂无可用应用。",
|
||||
"emptyApps": "暂无可用的 CLI App。",
|
||||
"emptyIntegrations": "暂无可用 MCP 工具。",
|
||||
"emptyReady": "还没有就绪的工具。",
|
||||
"clearSearch": "清除搜索",
|
||||
"browseApps": "浏览应用",
|
||||
"browseApps": "浏览 CLI Apps",
|
||||
"browseIntegrations": "浏览 MCP 工具",
|
||||
"emptyIntegrationsHint": "可在下方添加自定义 MCP 服务器。",
|
||||
"restartRequired": "重启 nanobot 以应用更新后的应用和 MCP 工具。"
|
||||
"restartRequired": "重启 nanobot 以应用更新后的应用和 MCP 工具。",
|
||||
"emptyPlugins": "尚未安装 Agent 插件。",
|
||||
"emptyPluginsHint": "将插件添加到工作区的 plugins 目录,即可在此启用。",
|
||||
"pluginPermissions": "声明的权限",
|
||||
"pluginServers": "MCP 服务器",
|
||||
"pluginTrustNotice": "插件以 nanobot 的操作系统权限运行;声明的权限不会隔离插件。",
|
||||
"pluginDetails": "Agent 插件",
|
||||
"pluginDisabled": "Agent 插件已禁用"
|
||||
},
|
||||
"channels": {
|
||||
"description": "连接聊天应用、邮箱和 WebUI",
|
||||
|
||||
@@ -1256,14 +1256,14 @@
|
||||
"thirdPartyBrands": "產品名稱、Logo 與品牌均為各自擁有者的財產。僅供識別之用,不代表任何形式的背書。"
|
||||
},
|
||||
"apps": {
|
||||
"description": "接入工具,在對話中用 @ 呼叫",
|
||||
"cliLabel": "應用程式",
|
||||
"description": "管理 CLI Apps、Agent Plugins 和 MCP 工具。",
|
||||
"cliLabel": "CLI App",
|
||||
"mcpLabel": "MCP",
|
||||
"channelLabel": "通訊管道",
|
||||
"featureLabel": "功能",
|
||||
"filterAll": "就緒",
|
||||
"filterPlugins": "外掛程式",
|
||||
"filterCli": "應用程式",
|
||||
"filterPlugins": "Agent 外掛",
|
||||
"filterCli": "CLI Apps",
|
||||
"filterMcp": "MCP",
|
||||
"enabledSummary": "{{count}} 個就緒",
|
||||
"searchPlaceholder": "搜尋工具",
|
||||
@@ -1271,14 +1271,21 @@
|
||||
"mcpTools": "MCP 工具",
|
||||
"loading": "正在載入應用程式…",
|
||||
"empty": "沒有符合搜尋條件的工具。",
|
||||
"emptyApps": "沒有可用的應用程式。",
|
||||
"emptyApps": "沒有可用的 CLI App。",
|
||||
"emptyIntegrations": "沒有可用的 MCP 工具。",
|
||||
"emptyReady": "尚無就緒的工具。",
|
||||
"clearSearch": "清除搜尋",
|
||||
"browseApps": "瀏覽應用程式",
|
||||
"browseApps": "瀏覽 CLI Apps",
|
||||
"browseIntegrations": "瀏覽 MCP 工具",
|
||||
"emptyIntegrationsHint": "可在下方新增自訂 MCP 伺服器。",
|
||||
"restartRequired": "重新啟動 nanobot 以套用更新後的應用程式與 MCP 工具。"
|
||||
"restartRequired": "重新啟動 nanobot 以套用更新後的應用程式與 MCP 工具。",
|
||||
"emptyPlugins": "尚未安裝 Agent 外掛。",
|
||||
"emptyPluginsHint": "將外掛新增至工作區的 plugins 目錄,即可在此啟用。",
|
||||
"pluginPermissions": "宣告的權限",
|
||||
"pluginServers": "MCP 伺服器",
|
||||
"pluginTrustNotice": "外掛以 nanobot 的作業系統權限執行;宣告的權限不會隔離外掛。",
|
||||
"pluginDetails": "Agent 外掛",
|
||||
"pluginDisabled": "Agent 外掛已停用"
|
||||
},
|
||||
"channels": {
|
||||
"description": "連線聊天應用、郵箱和 WebUI",
|
||||
|
||||
@@ -43,6 +43,13 @@ function createToolsCatalog(token: string) {
|
||||
snapshot = { ...snapshot, invalidation: snapshot.invalidation + 1 };
|
||||
publish();
|
||||
},
|
||||
invalidateMcpPresets() {
|
||||
mcpUpdated = -Infinity;
|
||||
mcpRevision++;
|
||||
mcpRequest = null;
|
||||
snapshot = { ...snapshot, invalidation: snapshot.invalidation + 1 };
|
||||
publish();
|
||||
},
|
||||
cliFresh: () => snapshot.cliApps !== null && Date.now() - cliUpdated < TOOLS_CATALOG_TTL_MS,
|
||||
mcpFresh: () => snapshot.mcpPresets !== null && Date.now() - mcpUpdated < TOOLS_CATALOG_TTL_MS,
|
||||
loadCliApps(): Promise<void> {
|
||||
|
||||
@@ -1320,6 +1320,7 @@ export interface McpPresetInfo {
|
||||
error?: string | null;
|
||||
enabled_tools?: string[];
|
||||
source?: "preset" | "custom" | string;
|
||||
managed_by_cli?: string | null;
|
||||
manifest?: AppManifest;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,9 @@ describe("catalog loading", () => {
|
||||
cleanup();
|
||||
fetch.mockClear();
|
||||
renderSettingsView({ client, initialSettings: settingsPayload() });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Apps" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" }));
|
||||
expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Agent Plugins" }));
|
||||
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);
|
||||
@@ -67,8 +68,9 @@ 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: "Apps" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" }));
|
||||
expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Agent Plugins" }));
|
||||
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);
|
||||
@@ -76,8 +78,9 @@ describe("catalog loading", () => {
|
||||
cli.resolve(jsonResponse({ apps: [{ ...app, display_name: "Updated app" }], installed_count: 1 }));
|
||||
mcp.resolve(jsonResponse({ presets: [{ ...plugin, display_name: "Updated plugin" }], installed_count: 1 }));
|
||||
});
|
||||
expect(screen.getByRole("heading", { name: "Updated app" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("heading", { name: "Updated plugin" })).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" }));
|
||||
expect(screen.getByRole("heading", { name: "Updated app" })).toBeInTheDocument();
|
||||
} finally {
|
||||
now.mockRestore();
|
||||
}
|
||||
@@ -136,13 +139,15 @@ describe("catalog loading", () => {
|
||||
return Promise.resolve(jsonResponse(settingsPayload()));
|
||||
}));
|
||||
renderSettingsView({ initialSettings: settingsPayload() });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Apps" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" }));
|
||||
expect(screen.getByRole("status", { name: "Loading apps…" })).toHaveAttribute("aria-busy", "true");
|
||||
|
||||
await act(async () => { cli.resolve(jsonResponse({ apps: [app], installed_count: 1 })); });
|
||||
expect(screen.getByRole("heading", { name: "AnyGen" })).toBeInTheDocument();
|
||||
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" }));
|
||||
expect(screen.getByRole("heading", { name: "Computer Use" })).toBeInTheDocument();
|
||||
expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
|
||||
});
|
||||
@@ -160,7 +165,7 @@ describe("catalog loading", () => {
|
||||
renderSettingsView({ initialSettings: settingsPayload() });
|
||||
await act(async () => {});
|
||||
expect(screen.getByRole("status", { name: "Loading apps…" })).toBeInTheDocument();
|
||||
expect(screen.queryByText("No apps available.")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("No CLI Apps available.")).not.toBeInTheDocument();
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "MCP" }));
|
||||
expect(screen.getByText("No MCP tools available.")).toBeInTheDocument();
|
||||
@@ -168,7 +173,7 @@ describe("catalog loading", () => {
|
||||
fireEvent.change(screen.getByPlaceholderText("Search tools"), { target: { value: "AnyGen" } });
|
||||
expect(screen.getByText("No tools match your search.")).toBeInTheDocument();
|
||||
expect(screen.queryByRole("status", { name: "Loading apps…" })).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Apps" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" }));
|
||||
expect(screen.getByRole("status", { name: "Loading apps…" })).toBeInTheDocument();
|
||||
expect(screen.queryByText("No tools match your search.")).not.toBeInTheDocument();
|
||||
await act(async () => { cli.resolve(jsonResponse({ apps: [app], installed_count: 1 })); });
|
||||
@@ -186,7 +191,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 apps available.")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("No CLI Apps available.")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("No channels match this filter.")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ describe("Apps default filter", () => {
|
||||
renderSettingsView({ initialSettings: settingsPayload() });
|
||||
|
||||
expect(await screen.findByRole("heading", { name: "Example App" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Apps" })).toHaveAttribute("aria-pressed", "true");
|
||||
expect(screen.getByRole("button", { name: "CLI Apps" })).toHaveAttribute("aria-pressed", "true");
|
||||
});
|
||||
|
||||
it("preserves a manual choice while MCP loads, then defaults to the cached Ready items on re-entry", async () => {
|
||||
@@ -56,9 +56,9 @@ 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: "Apps" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "CLI Apps" }));
|
||||
await act(async () => { pending.resolve(jsonResponse({ presets: [mcp], installed_count: 1 })); });
|
||||
expect(screen.getByRole("button", { name: "Apps" })).toHaveAttribute("aria-pressed", "true");
|
||||
expect(screen.getByRole("button", { name: "CLI Apps" })).toHaveAttribute("aria-pressed", "true");
|
||||
expect(screen.getByRole("heading", { name: "Example App" })).toBeInTheDocument();
|
||||
|
||||
cleanup();
|
||||
|
||||
@@ -83,7 +83,7 @@ describe("SettingsView Apps catalog", () => {
|
||||
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: "Apps" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "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();
|
||||
|
||||
@@ -348,7 +348,7 @@ describe("Settings overview and appearance", () => {
|
||||
|
||||
renderSettingsView();
|
||||
|
||||
expect(await screen.findByText("No apps available.")).toBeInTheDocument();
|
||||
expect(await screen.findByText("No CLI Apps available.")).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Browse MCP tools" }));
|
||||
expect(await screen.findByText("Add MCP")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -138,11 +138,16 @@ describe("Settings system domains", () => {
|
||||
|
||||
renderSettingsView();
|
||||
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Agent Plugins" }));
|
||||
expect(await screen.findByText("Computer Use")).toBeInTheDocument();
|
||||
expect(screen.getByText("Plugins")).toBeInTheDocument();
|
||||
expect(screen.getByText(/Control the desktop/)).toBeInTheDocument();
|
||||
expect(screen.getByText("screen-recording, accessibility")).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Enable" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "Computer Use" }));
|
||||
const dialog = screen.getByRole("dialog", { name: "Computer Use" });
|
||||
expect(within(dialog).getByText("Declared permissions")).toBeVisible();
|
||||
expect(within(dialog).getByText("screen-recording, accessibility")).toBeVisible();
|
||||
expect(within(dialog).queryByRole("tab", { name: "Tools" })).not.toBeInTheDocument();
|
||||
expect(requestMutationMock).not.toHaveBeenCalled();
|
||||
fireEvent.click(within(dialog).getByRole("button", { name: "Enable" }));
|
||||
|
||||
await waitFor(() => expect(requestMutationMock).toHaveBeenCalledWith(
|
||||
"settings.mcp.enable", { name: "plugin-computer-use" }, 20_000,
|
||||
@@ -159,6 +164,52 @@ describe("Settings system domains", () => {
|
||||
});
|
||||
|
||||
|
||||
it("groups a CLI-managed plugin under its app while keeping other plugins independent", async () => {
|
||||
const managed = { ...agentPlugin, name: "plugin-cli-app-anygen", display_name: "Managed plugin", managed_by_cli: "anygen" };
|
||||
const separate = { ...agentPlugin, name: "plugin-cli-app-other", display_name: "Separate plugin", managed_by_cli: null };
|
||||
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
|
||||
const url = String(input);
|
||||
if (url === "/api/settings/cli-apps") return jsonResponse({ apps: [installedAnyGen], installed_count: 1 });
|
||||
if (url === "/api/settings/mcp-presets") return jsonResponse({ presets: [managed, separate], installed_count: 1 });
|
||||
return jsonResponse(settingsPayload());
|
||||
}));
|
||||
requestMutationMock.mockResolvedValue({
|
||||
presets: [{ ...managed, enabled: true, status: "enabled" }, separate], installed_count: 2,
|
||||
});
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
|
||||
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" }));
|
||||
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" }));
|
||||
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" }));
|
||||
fireEvent.click(within(screen.getByRole("dialog", { name: "Managed plugin" })).getByRole("button", { name: "Enable" }));
|
||||
await waitFor(() => expect(requestMutationMock).toHaveBeenCalledWith(
|
||||
"settings.mcp.enable", { name: "plugin-cli-app-anygen" }, 20_000,
|
||||
));
|
||||
await waitFor(() => expect(screen.queryByRole("button", { name: "Agent Plugin disabled" })).not.toBeInTheDocument());
|
||||
});
|
||||
|
||||
it("keeps a managed plugin accessible when its owning app is missing from the loaded catalog", async () => {
|
||||
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
|
||||
const url = String(input);
|
||||
if (url === "/api/settings/cli-apps") return jsonResponse({ apps: [], installed_count: 1 });
|
||||
if (url === "/api/settings/mcp-presets") return jsonResponse({
|
||||
presets: [{ ...agentPlugin, managed_by_cli: "missing-app" }], installed_count: 0,
|
||||
});
|
||||
return jsonResponse(settingsPayload());
|
||||
}));
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Agent Plugins" }));
|
||||
expect(await screen.findByRole("heading", { name: "Computer Use" })).toBeVisible();
|
||||
});
|
||||
|
||||
it.each(["apps", "skills", "automations", "channels"] as const)(
|
||||
"uses the conversation-width content frame for the standalone %s page",
|
||||
(initialSection) => {
|
||||
@@ -487,6 +538,35 @@ describe("Settings system domains", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("refreshes plugin ownership after installing a CLI app without replacing its mutation result", async () => {
|
||||
let installed = false;
|
||||
const managed = { ...agentPlugin, name: "plugin-cli-app-anygen", display_name: "Managed plugin", enabled: true, managed_by_cli: "anygen" };
|
||||
const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
|
||||
const url = String(input);
|
||||
if (url === "/api/settings/cli-apps") return jsonResponse({
|
||||
apps: [{ ...installedAnyGen, installed: false }], installed_count: 0,
|
||||
});
|
||||
if (url === "/api/settings/mcp-presets") return jsonResponse({
|
||||
presets: installed ? [managed] : [], installed_count: Number(installed),
|
||||
});
|
||||
return jsonResponse(settingsPayload());
|
||||
});
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
requestMutationMock.mockImplementation(async () => {
|
||||
installed = true;
|
||||
return { apps: [installedAnyGen], installed_count: 1 };
|
||||
});
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Install app" }));
|
||||
await waitFor(() => expect(fetchMock.mock.calls.filter(([url]) => String(url) === "/api/settings/mcp-presets")).toHaveLength(2));
|
||||
const appAction = await screen.findByRole("button", { name: "App ready" });
|
||||
fireEvent.pointerDown(appAction, { button: 0, ctrlKey: false });
|
||||
fireEvent.click(await screen.findByRole("menuitem", { name: "Agent Plugin" }));
|
||||
expect(screen.getByRole("dialog", { name: "Managed plugin" })).toBeVisible();
|
||||
expect(fetchMock.mock.calls.filter(([url]) => String(url) === "/api/settings/cli-apps")).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("shows a visible uninstall button for installed CLI apps and calls uninstall", async () => {
|
||||
const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
|
||||
const url = String(input);
|
||||
@@ -581,7 +661,8 @@ describe("Settings system domains", () => {
|
||||
|
||||
expect(await screen.findByText("AnyGen")).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Ready" })).toHaveAttribute("aria-pressed", "false");
|
||||
expect(screen.getByRole("button", { name: "Apps" })).toHaveAttribute("aria-pressed", "true");
|
||||
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();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user