feat(providers): make bundled Hoplite opt-in from the catalog

Keep the contributor ACP adapter and provisioning progress while activating it only when a provider config entry exists. Removing the entry removes membership across restarts; existing provider defaults remain unchanged.

Present the Add provider catalog as a searchable grid and gate Hoplite activation on host support.

Co-authored-by: Odin Glynn-Martin <odin.glynn@icloud.com>
This commit is contained in:
Mohamed Boudra
2026-10-15 13:24:50 +02:00
co-authored by Odin Glynn-Martin
parent 665e15ed31
commit 95ea57746a
42 changed files with 977 additions and 185 deletions
+1 -1
View File
@@ -484,7 +484,7 @@ The [Agent Client Protocol (ACP)](https://agentclientprotocol.com) is an open st
ACP agents communicate over JSON-RPC 2.0 on stdio. Paseo spawns the agent process and talks to it through stdin/stdout.
Paseo also ships an in-app ACP provider catalog for common agents, including CodeWhale, Cursor, DeepAgents, DimCode, Gemini CLI, Hermes, Qwen Code, and Kimi Code. Catalog entries create the same `extends: "acp"` provider config shown below.
Paseo also ships an in-app ACP provider catalog for common agents, including CodeWhale, Cursor, DeepAgents, DimCode, Gemini CLI, Hermes, Qwen Code, and Kimi Code. Most catalog entries create the same `extends: "acp"` provider config shown below. Hoplite activates its [bundled provider](plugins.md#built-in-plugins) instead.
### Adding a generic ACP provider
+6
View File
@@ -107,6 +107,12 @@ absent from the installed plugin list and source configuration; their client bun
appear in the plugin catalog. Editing one in development requires a daemon restart.
Directory, Git, and npm installs cannot use a built-in ID.
A provider registration with `requiresConfiguration: true` participates only while its ID exists
under `agents.providers`. Hoplite uses this for catalog opt-in. Add writes `{ "enabled": true }`
without `extends`, so it selects the bundled adapter. Remove deletes the config entry; setting
`enabled: false` keeps the entry. The bundled JavaScript still loads at startup, but an absent
provider does not enter executable resolution or catalog discovery.
Provider plugins use separate installation and provider IDs. `muse-provider` registers the
selectable `muse` provider (Muse Code) and a usage source. Its `status({ launch })` reports
availability and a diagnostic after the daemon resolves the executable. Configure command,
@@ -1,4 +1,13 @@
import { test } from "../support/fixtures";
import {
closeModelPicker,
openModelPicker,
seedAgentProfiles,
} from "../support/helpers/agent-profiles";
import { expectComposerVisible } from "../support/helpers/composer";
import { clickNewChat, gotoWorkspace } from "../support/helpers/launcher";
import { seedWorkspace } from "../support/helpers/seed-client";
import { writeFile } from "node:fs/promises";
import { expect, test } from "../support/fixtures";
import { gotoAppShell, openSettings } from "../support/helpers/app";
import { connectDaemonClient } from "../support/helpers/daemon-client-loader";
import { getServerId } from "../support/helpers/server-id";
@@ -9,6 +18,7 @@ import {
openAddProviderArea,
openSettingsHost,
openSettingsHostSection,
seedSavedSettingsHosts,
} from "../support/helpers/settings";
const ACP_PROVIDER = {
@@ -17,8 +27,13 @@ const ACP_PROVIDER = {
};
interface ProviderCatalogDaemonClient {
getLastServerInfoMessage(): {
features?: { hopliteProvider?: boolean; plugins?: boolean };
} | null;
connect(): Promise<void>;
close(): Promise<void>;
getDaemonConfig(): Promise<{ config: { providers?: Record<string, unknown> } }>;
getProvidersSnapshot(): Promise<{ entries: Array<{ provider: string }> }>;
patchDaemonConfig(config: { removeProviders?: string[] }): Promise<unknown>;
}
@@ -49,6 +64,11 @@ for (const theme of ["light", "dark"] as const) {
clientIdPrefix: "hoplite-catalog-e2e",
});
try {
expect(client.getLastServerInfoMessage()?.features?.hopliteProvider).toBe(true);
await client.patchDaemonConfig({ removeProviders: ["hoplite"] });
expect(
(await client.getProvidersSnapshot()).entries.some((entry) => entry.provider === "hoplite"),
).toBe(false);
await page.addInitScript((value) => {
localStorage.setItem("@paseo:app-settings", JSON.stringify({ theme: value }));
}, theme);
@@ -56,15 +76,103 @@ for (const theme of ["light", "dark"] as const) {
await openSettings(page);
await openSettingsHost(page, getServerId());
await openSettingsHostSection(page, getServerId(), "providers");
await expect(
page.getByRole("button", { name: "Hoplite provider details", exact: true }),
).toHaveCount(0);
await openAddProviderArea(page);
await findAcpCatalogProvider(page, "Hoplite");
await page.screenshot({ path: testInfo.outputPath(`hoplite-catalog-${theme}.png`) });
await installAcpCatalogProvider(page, "Hoplite");
await expectProviderInstalledInSettings(page, "Hoplite");
await page.screenshot({ path: testInfo.outputPath(`hoplite-installed-${theme}.png`) });
expect((await client.getDaemonConfig()).config.providers?.hoplite).toEqual({ enabled: true });
await writeFile(
testInfo.outputPath(`hoplite-added-${theme}.json`),
JSON.stringify(await client.getProvidersSnapshot(), null, 2),
);
await removeHoplite(page);
await expect(
page.getByRole("button", { name: "Hoplite provider details", exact: true }),
).toHaveCount(0);
expect((await client.getDaemonConfig()).config.providers?.hoplite).toBeUndefined();
expect(
(await client.getProvidersSnapshot()).entries.some((entry) => entry.provider === "hoplite"),
).toBe(false);
await writeFile(
testInfo.outputPath(`hoplite-removed-${theme}.json`),
JSON.stringify(await client.getProvidersSnapshot(), null, 2),
);
await openAddProviderArea(page);
await findAcpCatalogProvider(page, "Hoplite");
await page.screenshot({ path: testInfo.outputPath(`hoplite-removed-${theme}.png`) });
await installAcpCatalogProvider(page, "Hoplite");
await expectProviderInstalledInSettings(page, "Hoplite");
} finally {
await client.patchDaemonConfig({ removeProviders: ["hoplite"] }).catch(() => undefined);
await client.close().catch(() => undefined);
}
});
}
async function removeHoplite(page: import("@playwright/test").Page): Promise<void> {
await page.getByTestId("provider-actions-hoplite").click();
page.once("dialog", (dialog) => {
void dialog.accept();
});
await page.getByTestId("provider-remove-hoplite").click();
}
test("unsupported host asks for an update without writing Hoplite config", async ({
page,
outdatedDaemon,
}, testInfo) => {
const client = await connectDaemonClient<ProviderCatalogDaemonClient>({
clientIdPrefix: "hoplite-unsupported",
port: Number(new URL(`http://${outdatedDaemon.endpoint}`).port),
});
try {
expect(client.getLastServerInfoMessage()?.features?.plugins).toBe(true);
expect(client.getLastServerInfoMessage()?.features?.hopliteProvider).toBe(false);
const before = await client.getDaemonConfig();
await seedSavedSettingsHosts(page, [outdatedDaemon]);
await page.reload();
await openSettings(page);
await openSettingsHost(page, outdatedDaemon.serverId);
await openSettingsHostSection(page, outdatedDaemon.serverId, "providers");
await openAddProviderArea(page);
await installAcpCatalogProvider(page, "Hoplite");
await expect(page.getByRole("alert")).toHaveText("Update the host to add Hoplite.");
expect((await client.getDaemonConfig()).config).toEqual(before.config);
await expect(
page.getByRole("button", { name: "Hoplite provider details", exact: true }),
).toHaveCount(0);
await page.screenshot({ path: testInfo.outputPath("hoplite-update-host.png") });
} finally {
await client.close();
}
});
test("model selector excludes Hoplite before opt-in", async ({ page }, testInfo) => {
const client = await connectDaemonClient<ProviderCatalogDaemonClient>({
clientIdPrefix: "hoplite-picker",
});
const profiles = await seedAgentProfiles([
{ id: "hoplite-picker-anchor", name: "Picker anchor", provider: "mock" },
]);
const workspace = await seedWorkspace({ repoPrefix: "hoplite-picker-" });
try {
await client.patchDaemonConfig({ removeProviders: ["hoplite"] });
await gotoWorkspace(page, workspace.workspaceId);
await clickNewChat(page);
await expectComposerVisible(page);
await openModelPicker(page);
await expect(page.getByTestId("model-provider-mock")).toBeVisible();
await expect(page.getByTestId("model-provider-hoplite")).toHaveCount(0);
await page.screenshot({ path: testInfo.outputPath("hoplite-model-selector-absent.png") });
await closeModelPicker(page);
} finally {
await workspace.cleanup();
await profiles.restore();
await client.close();
}
});
+1 -1
View File
@@ -370,7 +370,7 @@ export async function findAcpCatalogProvider(page: Page, providerName: string):
export async function installAcpCatalogProvider(page: Page, providerName: string): Promise<void> {
await findAcpCatalogProvider(page, providerName);
await page.getByRole("button", { name: "Add", exact: true }).click();
await page.getByRole("button", { name: `Add ${providerName}`, exact: true }).click();
}
export async function expectProviderInstalledInSettings(
@@ -1,19 +1,21 @@
import { useCallback, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Pressable, Text, View } from "react-native";
import { Text, View, type LayoutChangeEvent } from "react-native";
import { SvgXml } from "react-native-svg";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { ExternalLink, PackagePlus, Search } from "lucide-react-native";
import { PackagePlus } from "lucide-react-native";
import { Button } from "@/components/ui/button";
import { isWeb } from "@/constants/platform";
import { ExternalLink } from "@/components/ui/external-link";
import { SearchField } from "@/components/ui/search-field";
import { StatusBadge } from "@/components/ui/status-badge";
import { rankProviderCatalog } from "@/components/provider-catalog-search";
import {
useAcpProviderCatalog,
type AcpProviderCatalogItem,
} from "@/hooks/use-acp-provider-catalog";
import { useProvidersSnapshot } from "@/hooks/use-providers-snapshot";
import type { Theme } from "@/styles/theme";
import { openExternalUrl } from "@/utils/open-external-url";
import { EditingTextInput as TextInput } from "@/components/ui/text-input";
import { SPACING, type Theme } from "@/styles/theme";
import { settingsStyles } from "@/styles/settings";
interface ProviderCatalogListProps {
serverId: string;
@@ -21,101 +23,106 @@ interface ProviderCatalogListProps {
onInstall: (entry: AcpProviderCatalogItem) => Promise<void> | void;
}
const SEARCH_ICON_SIZE = 16;
const PROVIDER_FALLBACK_ICON_SIZE = 20;
const PROVIDER_REMOTE_ICON_SIZE = 24;
const TILE_GAP = SPACING[3];
/** Narrowest tile that keeps the type badge and install link on one line. */
const MIN_TILE_WIDTH = 216;
const MAX_COLUMNS = 4;
const ThemedPackagePlus = withUnistyles(PackagePlus);
const ThemedSvgXml = withUnistyles(SvgXml);
const ThemedSearch = withUnistyles(Search);
const ThemedExternalLink = withUnistyles(ExternalLink);
const ThemedTextInput = withUnistyles(TextInput, (theme) => ({
placeholderTextColor: theme.colors.foregroundMuted,
}));
const foregroundColorMapping = (theme: Theme) => ({ color: theme.colors.foreground });
const foregroundMutedColorMapping = (theme: Theme) => ({
color: theme.colors.foregroundMuted,
});
function matchesSearch(entry: AcpProviderCatalogItem, query: string): boolean {
const normalized = query.trim().toLowerCase();
if (!normalized) return true;
return [entry.title, entry.id, entry.description].some((value) =>
value.toLowerCase().includes(normalized),
);
function columnCountForWidth(width: number): number {
const fits = Math.floor((width + TILE_GAP) / (MIN_TILE_WIDTH + TILE_GAP));
return Math.min(MAX_COLUMNS, Math.max(1, fits));
}
interface CatalogRowProps {
interface CatalogTileProps {
entry: AcpProviderCatalogItem;
/** `undefined` until the grid is measured; a single column fills the row. */
width: number | undefined;
installing: boolean;
onInstall: (entry: AcpProviderCatalogItem) => void;
}
function CatalogRow({ entry, installing, onInstall }: CatalogRowProps) {
function CatalogTile({ entry, width, installing, onInstall }: CatalogTileProps) {
const { t } = useTranslation();
const actionLabel = installing
? t("providerCatalog.actions.adding")
: t("providerCatalog.actions.add");
const handleInstall = useCallback(() => {
onInstall(entry);
}, [entry, onInstall]);
const isSingleColumn = width === undefined;
const tileStyle = useMemo(
() => [settingsStyles.card, styles.tile, isSingleColumn ? styles.tileFull : { width }],
[isSingleColumn, width],
);
const handleOpenInstallLink = useCallback(() => {
void openExternalUrl(entry.installLink);
}, [entry.installLink]);
return (
<View style={styles.row}>
<View style={styles.iconFrame}>
{entry.iconSvg ? (
<ThemedSvgXml
xml={entry.iconSvg}
width={PROVIDER_REMOTE_ICON_SIZE}
height={PROVIDER_REMOTE_ICON_SIZE}
uniProps={foregroundColorMapping}
/>
) : (
<ThemedPackagePlus size={PROVIDER_FALLBACK_ICON_SIZE} uniProps={foregroundColorMapping} />
)}
</View>
<View style={styles.textColumn}>
<View style={styles.titleRow}>
<Text style={styles.name} numberOfLines={1}>
{entry.title}
</Text>
<Text style={styles.version} numberOfLines={1}>
{entry.version}
</Text>
</View>
<Text style={styles.description} numberOfLines={1}>
{entry.description || entry.id}
</Text>
<Pressable
accessibilityRole="link"
const icon = (
<View style={styles.iconFrame}>
{entry.iconSvg ? (
<ThemedSvgXml
xml={entry.iconSvg}
width={PROVIDER_REMOTE_ICON_SIZE}
height={PROVIDER_REMOTE_ICON_SIZE}
uniProps={foregroundColorMapping}
/>
) : (
<ThemedPackagePlus size={PROVIDER_FALLBACK_ICON_SIZE} uniProps={foregroundColorMapping} />
)}
</View>
);
const addButton = (
<Button
size="sm"
variant="outline"
disabled={installing}
loading={installing}
onPress={handleInstall}
accessibilityLabel={t("providerCatalog.actions.addProvider", { provider: entry.title })}
style={styles.addButton}
testID={`install-provider-${entry.id}`}
>
{installing ? t("providerCatalog.actions.adding") : t("providerCatalog.actions.add")}
</Button>
);
const details = (
<View style={isSingleColumn ? [styles.details, styles.detailsInRow] : styles.details}>
<Text style={styles.name} numberOfLines={1}>
{entry.title}
</Text>
<View style={styles.metaRow}>
{/* The catalog is the ACP registry, so every entry it offers is an ACP provider. */}
<StatusBadge label={t("providerCatalog.types.acp")} size="xs" />
<ExternalLink
href={entry.installLink}
label={t("providerCatalog.actions.installInstructions")}
accessibilityLabel={t("providerCatalog.actions.installInstructionsFor", {
provider: entry.title,
})}
onPress={handleOpenInstallLink}
style={styles.installLink}
>
<Text style={styles.installLinkText} numberOfLines={1}>
{t("providerCatalog.actions.installInstructions")}
</Text>
<ThemedExternalLink size={12} uniProps={foregroundMutedColorMapping} />
</Pressable>
/>
</View>
<Button
size="sm"
variant="default"
disabled={installing}
loading={installing}
onPress={handleInstall}
style={styles.actionButton}
testID={`install-provider-${entry.id}`}
>
{actionLabel}
</Button>
</View>
);
return (
<View style={tileStyle} testID={`provider-catalog-tile-${entry.id}`}>
{isSingleColumn ? (
<View style={styles.singleColumnRow}>
{icon}
{details}
{addButton}
</View>
) : (
<>
<View style={styles.tileHeader}>
{icon}
{addButton}
</View>
{details}
</>
)}
</View>
);
}
@@ -129,6 +136,7 @@ export function ProviderCatalogList({
const { entries: catalogEntries } = useAcpProviderCatalog();
const { entries: providerEntries } = useProvidersSnapshot(serverId);
const [search, setSearch] = useState("");
const [gridWidth, setGridWidth] = useState<number | null>(null);
const installedIds = useMemo(
() => new Set(providerEntries?.map((entry) => entry.provider) ?? []),
@@ -137,41 +145,48 @@ export function ProviderCatalogList({
const availableEntries = useMemo(
() =>
catalogEntries
.filter((entry) => !installedIds.has(entry.id))
.filter((entry) => matchesSearch(entry, search)),
rankProviderCatalog(
catalogEntries.filter((entry) => !installedIds.has(entry.id)),
search,
),
[catalogEntries, installedIds, search],
);
const handleGridLayout = useCallback((event: LayoutChangeEvent) => {
setGridWidth(event.nativeEvent.layout.width);
}, []);
const tileWidth = useMemo(() => {
if (gridWidth === null) return undefined;
const columns = columnCountForWidth(gridWidth);
if (columns === 1) return undefined;
return Math.floor((gridWidth - TILE_GAP * (columns - 1)) / columns);
}, [gridWidth]);
return (
<View>
<View style={styles.searchField}>
<View style={styles.searchIcon}>
<ThemedSearch size={SEARCH_ICON_SIZE} uniProps={foregroundMutedColorMapping} />
</View>
<ThemedTextInput
testID="provider-catalog-search"
initialValue={search}
<View style={styles.searchRail}>
<SearchField
value={search}
onChangeText={setSearch}
accessibilityLabel={t("providerCatalog.search")}
placeholder={t("providerCatalog.search")}
// @ts-expect-error - outlineStyle is web-only
style={[styles.searchInput, isWeb && { outlineStyle: "none" }]}
autoCapitalize="none"
autoCorrect={false}
clearAccessibilityLabel={t("providerCatalog.clearSearch")}
testID="provider-catalog-search"
clearTestID="provider-catalog-search-clear"
/>
</View>
{availableEntries.length === 0 ? (
<View style={styles.stateBox}>
<View style={[settingsStyles.card, styles.stateBox]}>
<Text style={styles.stateText}>{t("providerCatalog.noProviders")}</Text>
</View>
) : (
<View style={styles.list}>
<View style={styles.grid} onLayout={handleGridLayout}>
{availableEntries.map((entry) => (
<CatalogRow
<CatalogTile
key={entry.id}
entry={entry}
width={tileWidth}
installing={installingProviderId === entry.id}
onInstall={onInstall}
/>
@@ -183,101 +198,68 @@ export function ProviderCatalogList({
}
const styles = StyleSheet.create((theme) => ({
searchField: {
searchRail: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
backgroundColor: theme.colors.surface2,
borderRadius: theme.borderRadius.lg,
borderWidth: 1,
borderColor: theme.colors.border,
paddingHorizontal: theme.spacing[3],
marginBottom: theme.spacing[3],
},
searchIcon: {
width: 18,
grid: {
flexDirection: "row",
flexWrap: "wrap",
gap: TILE_GAP,
},
tile: {
gap: theme.spacing[3],
padding: theme.spacing[3],
},
tileFull: {
width: "100%",
},
tileHeader: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
gap: theme.spacing[2],
},
searchInput: {
flex: 1,
minWidth: 0,
paddingVertical: theme.spacing[3],
color: theme.colors.foreground,
fontSize: theme.fontSize.base,
},
list: {
borderRadius: theme.borderRadius.lg,
borderWidth: 1,
borderColor: theme.colors.border,
overflow: "hidden",
},
row: {
singleColumnRow: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[3],
padding: theme.spacing[3],
borderBottomWidth: 1,
borderBottomColor: theme.colors.border,
},
details: {
gap: theme.spacing[1],
},
detailsInRow: {
flex: 1,
minWidth: 0,
},
iconFrame: {
flexShrink: 0,
width: 36,
height: 36,
borderRadius: theme.borderRadius.md,
backgroundColor: theme.colors.surface2,
alignItems: "center",
justifyContent: "center",
},
addButton: {
flexShrink: 0,
},
textColumn: {
flex: 1,
minWidth: 0,
gap: theme.spacing[1],
},
titleRow: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
minWidth: 0,
minWidth: 72,
},
name: {
color: theme.colors.foreground,
fontSize: theme.fontSize.base,
fontWeight: theme.fontWeight.medium,
flexShrink: 1,
fontWeight: theme.fontWeight.normal,
},
version: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.sm,
flexShrink: 0,
},
description: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.sm,
},
installLink: {
alignSelf: "flex-start",
metaRow: {
flexDirection: "row",
flexWrap: "wrap",
alignItems: "center",
gap: theme.spacing[1],
maxWidth: "100%",
},
installLinkText: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.sm,
},
actionButton: {
width: 92,
flexShrink: 0,
gap: theme.spacing[2],
},
stateBox: {
minHeight: 96,
borderRadius: theme.borderRadius.lg,
borderWidth: 1,
borderColor: theme.colors.border,
backgroundColor: theme.colors.surface1,
alignItems: "center",
justifyContent: "center",
gap: theme.spacing[3],
padding: theme.spacing[4],
},
stateText: {
@@ -0,0 +1,45 @@
import { describe, expect, it } from "vitest";
import { rankProviderCatalog } from "./provider-catalog-search";
const entries = [
{ id: "kiro-cli", title: "Kiro CLI" },
{ id: "goose", title: "goose" },
{ id: "kimi", title: "Kimi Code CLI" },
{ id: "gemini", title: "Gemini CLI" },
{ id: "qwen-code", title: "Qwen Code" },
{ id: "codex-acp", title: "Codex" },
];
function titles(list: { title: string }[]): string[] {
return list.map((entry) => entry.title);
}
describe("rankProviderCatalog", () => {
it("lists every provider alphabetically by name without a query", () => {
expect(titles(rankProviderCatalog(entries, " "))).toEqual([
"Codex",
"Gemini CLI",
"goose",
"Kimi Code CLI",
"Kiro CLI",
"Qwen Code",
]);
});
it("ranks the strongest match first and drops providers that do not match", () => {
expect(titles(rankProviderCatalog(entries, "cod"))).toEqual([
"Codex",
"Kimi Code CLI",
"Qwen Code",
]);
});
it("matches in-word subsequences and multiple tokens like the other pickers", () => {
expect(titles(rankProviderCatalog(entries, "gmni"))).toEqual(["Gemini CLI"]);
expect(titles(rankProviderCatalog(entries, "qw cod"))).toEqual(["Qwen Code"]);
});
it("matches the provider id", () => {
expect(titles(rankProviderCatalog(entries, "kiro-cli"))).toEqual(["Kiro CLI"]);
});
});
@@ -0,0 +1,34 @@
import {
compareMatchScores,
scoreTextFields,
type MatchScore,
} from "@getpaseo/protocol/search/text-match";
export interface SearchableCatalogEntry {
id: string;
title: string;
}
function compareTitles(a: SearchableCatalogEntry, b: SearchableCatalogEntry): number {
return a.title.localeCompare(b.title, undefined, { sensitivity: "base" });
}
/**
* Orders the Add provider catalog. Without a query the list is alphabetical by
* name. With a query it uses the pickers' ranked matcher over the fields the
* tile shows (name and id), best match first, ties alphabetical.
*/
export function rankProviderCatalog<T extends SearchableCatalogEntry>(
entries: readonly T[],
query: string,
): T[] {
if (!query.trim()) return [...entries].sort(compareTitles);
const scored: { entry: T; score: MatchScore }[] = [];
for (const entry of entries) {
const score = scoreTextFields(query, [entry.title, entry.id]);
if (score) scored.push({ entry, score });
}
scored.sort((a, b) => compareMatchScores(a.score, b.score) || compareTitles(a.entry, b.entry));
return scored.map(({ entry }) => entry);
}
@@ -8,6 +8,7 @@ export interface AcpProviderCatalogEntry {
iconSvg: string | null;
installLink: string;
command: readonly [string, ...string[]];
bundledProvider?: boolean;
env?: Readonly<Record<string, string>>;
params?: Readonly<Record<string, unknown>>;
}
@@ -240,6 +241,7 @@ const CATALOG_DATA = [
},
{
id: "hoplite",
bundledProvider: true,
title: "Hoplite",
description: "Cloud coding agent through the local hoplite acp bridge",
version: "manual",
@@ -398,6 +400,7 @@ export const ACP_PROVIDER_CATALOG: AcpProviderCatalogEntry[] = CATALOG_DATA.map(
version: entry.version,
installLink: entry.installLink,
command: entry.command,
bundledProvider: "bundledProvider" in entry ? entry.bundledProvider : undefined,
env: "env" in entry ? entry.env : undefined,
params: "params" in entry ? entry.params : undefined,
iconSvg: entry.iconId ? (ACP_PROVIDER_ICON_SVGS[entry.iconId] ?? null) : null,
@@ -66,15 +66,9 @@ describe("ACP provider catalog", () => {
command: ["hoplite", "acp"],
installLink: "https://hoplite.sh/docs/cli/acp",
});
expect(buildAcpProviderConfigPatch(findProvider("hoplite"))).toEqual({
expect(buildAcpProviderConfigPatch(findProvider("hoplite"), true)).toEqual({
providers: {
hoplite: {
extends: "acp",
label: "Hoplite",
description: "Cloud coding agent through the local hoplite acp bridge",
command: ["hoplite", "acp"],
env: {},
},
hoplite: { enabled: true },
},
});
const ids = getAcpProviderCatalog().map((entry) => entry.id);
@@ -83,6 +77,15 @@ describe("ACP provider catalog", () => {
expect(findProvider("hoplite").iconSvg).toContain('fill="currentColor"');
});
it.each([undefined, false])(
"rejects unsupported bundled Hoplite before producing a patch (%s)",
(supported) => {
expect(() => buildAcpProviderConfigPatch(findProvider("hoplite"), supported)).toThrow(
"Update the host to add Hoplite.",
);
},
);
it("maps a catalog entry to the daemon provider config patch", () => {
expect(buildAcpProviderConfigPatch(findProvider("amp-acp"))).toEqual({
providers: {
@@ -10,7 +10,13 @@ export function getAcpProviderCatalog(): AcpProviderCatalogItem[] {
export function buildAcpProviderConfigPatch(
entry: AcpProviderCatalogItem,
supportsHopliteProvider = false,
): MutableDaemonConfigPatch {
if (entry.bundledProvider) {
// COMPAT(hopliteProvider): added after v0.11.2, remove after 2027-04-15 once host floor includes the bundled adapter.
if (!supportsHopliteProvider) throw new Error("Update the host to add Hoplite.");
return { providers: { [entry.id]: { enabled: true } } };
}
return {
providers: {
[entry.id]: {
+5
View File
@@ -1657,14 +1657,19 @@ export const ar: TranslationResources = {
title: "إضافة مزود",
search: "مقدمي البحث",
noProviders: "لم يتم العثور على مقدمي الخدمات",
clearSearch: "مسح البحث",
actions: {
add: "يضيف",
addProvider: "إضافة {{provider}}",
adding: "إضافة",
installed: "تم التثبيت",
cancel: "يلغي",
installInstructions: "تعليمات التثبيت",
installInstructionsFor: "تعليمات تثبيت{{provider}}",
},
types: {
acp: "ACP",
},
errors: {
unableToInstall: "غير قادر على تثبيت الموفر",
},
+5
View File
@@ -1682,14 +1682,19 @@ export const en = {
title: "Add provider",
search: "Search providers",
noProviders: "No providers found",
clearSearch: "Clear search",
actions: {
add: "Add",
addProvider: "Add {{provider}}",
adding: "Adding",
installed: "Installed",
cancel: "Cancel",
installInstructions: "Install instructions",
installInstructionsFor: "{{provider}} install instructions",
},
types: {
acp: "ACP",
},
errors: {
unableToInstall: "Unable to install provider",
},
+5
View File
@@ -1703,14 +1703,19 @@ export const es: TranslationResources = {
title: "Agregar proveedor",
search: "Proveedores de búsqueda",
noProviders: "No se encontraron proveedores",
clearSearch: "Borrar búsqueda",
actions: {
add: "Agregar",
addProvider: "Añadir {{provider}}",
adding: "Añadiendo",
installed: "Instalado",
cancel: "Cancelar",
installInstructions: "Instrucciones de instalación",
installInstructionsFor: "Instrucciones de instalación de{{provider}}",
},
types: {
acp: "ACP",
},
errors: {
unableToInstall: "No se puede instalar el proveedor",
},
+5
View File
@@ -1699,14 +1699,19 @@ export const fr: TranslationResources = {
title: "Ajouter un fournisseur",
search: "Rechercher des fournisseurs",
noProviders: "Aucun fournisseur trouvé",
clearSearch: "Effacer la recherche",
actions: {
add: "Ajouter",
addProvider: "Ajouter {{provider}}",
adding: "Ajout…",
installed: "Installé",
cancel: "Annuler",
installInstructions: "Instructions d’installation",
installInstructionsFor: "Instructions d’installation de {{provider}}",
},
types: {
acp: "ACP",
},
errors: {
unableToInstall: "Impossible d’installer le fournisseur",
},
+5
View File
@@ -1674,14 +1674,19 @@ export const ja: TranslationResources = {
title: "プロバイダーを追加",
search: "プロバイダーを検索",
noProviders: "プロバイダーが見つかりません",
clearSearch: "検索をクリア",
actions: {
add: "追加",
addProvider: "{{provider}} を追加",
adding: "追加中",
installed: "インストール済み",
cancel: "キャンセル",
installInstructions: "インストール手順",
installInstructionsFor: "{{provider}}のインストール手順",
},
types: {
acp: "ACP",
},
errors: {
unableToInstall: "プロバイダーをインストールできません",
},
+5
View File
@@ -1667,14 +1667,19 @@ export const ko: TranslationResources = {
title: "프로바이더 추가",
search: "프로바이더 검색",
noProviders: "프로바이더를 찾을 수 없습니다",
clearSearch: "검색 지우기",
actions: {
add: "추가",
addProvider: "{{provider}} 추가",
adding: "추가 중",
installed: "설치됨",
cancel: "취소",
installInstructions: "설치 안내",
installInstructionsFor: "{{provider}} 설치 안내",
},
types: {
acp: "ACP",
},
errors: {
unableToInstall: "프로바이더를 설치할 수 없습니다",
},
+5
View File
@@ -1688,14 +1688,19 @@ export const ptBR: TranslationResources = {
title: "Adicionar provedor",
search: "Buscar provedores",
noProviders: "Nenhum provedor encontrado",
clearSearch: "Limpar pesquisa",
actions: {
add: "Adicionar",
addProvider: "Adicionar {{provider}}",
adding: "Adicionando",
installed: "Instalado",
cancel: "Cancelar",
installInstructions: "Instruções de instalação",
installInstructionsFor: "Instruções de instalação de {{provider}}",
},
types: {
acp: "ACP",
},
errors: {
unableToInstall: "Não foi possível instalar provedor",
},
+5
View File
@@ -1686,14 +1686,19 @@ export const ru: TranslationResources = {
title: "Добавить провайдера",
search: "Поиск провайдеров",
noProviders: "Провайдеры не найдены",
clearSearch: "Очистить поиск",
actions: {
add: "Добавить",
addProvider: "Добавить {{provider}}",
adding: "Добавление",
installed: "Установлено",
cancel: "Отмена",
installInstructions: "Инструкции по установке",
installInstructionsFor: "Инструкции по установке {{provider}}",
},
types: {
acp: "ACP",
},
errors: {
unableToInstall: "Не удалось установить провайдера",
},
+5
View File
@@ -1640,14 +1640,19 @@ export const zhCN: TranslationResources = {
title: "添加 provider",
search: "搜索 providers",
noProviders: "未找到 providers",
clearSearch: "清除搜索",
actions: {
add: "添加",
addProvider: "添加 {{provider}}",
adding: "正在添加",
installed: "已安装",
cancel: "取消",
installInstructions: "安装说明",
installInstructionsFor: "{{provider}} 安装说明",
},
types: {
acp: "ACP",
},
errors: {
unableToInstall: "无法安装 provider",
},
@@ -19,6 +19,7 @@ import { useDaemonConfig } from "@/hooks/use-daemon-config";
import { buildProviderDefinitions } from "@/utils/provider-definitions";
import {
buildAcpProviderConfigPatch,
getAcpProviderCatalog,
type AcpProviderCatalogItem,
} from "@/hooks/use-acp-provider-catalog";
import { ProviderCatalogList } from "@/components/provider-catalog-list";
@@ -326,6 +327,8 @@ export interface ProvidersSectionProps {
export function ProvidersSection({ serverId }: ProvidersSectionProps) {
const { t } = useTranslation();
const isConnected = useHostRuntimeIsConnected(serverId);
const supportsHopliteProvider = useHostFeature(serverId, "hopliteProvider");
const [installError, setInstallError] = useState<string | null>(null);
const supportsProviderRemoval = useHostFeature(serverId, "providerRemoval");
const { entries, isLoading, refresh } = useProvidersSnapshot(serverId);
const { config, patchConfig } = useDaemonConfig(serverId);
@@ -338,9 +341,16 @@ export function ProvidersSection({ serverId }: ProvidersSectionProps) {
const providerDefinitions = useMemo(() => buildProviderDefinitions(entries), [entries]);
const hasServer = serverId.length > 0;
/** Custom providers are deletable only when config.json holds their `extends` definition. */
/** Config owns derived providers and opt-in bundled catalog providers. */
const isConfigOwnedProvider = useCallback(
(providerId: string) => Boolean(config?.providers?.[providerId]?.extends),
(providerId: string) =>
Boolean(
config?.providers?.[providerId] &&
(config.providers[providerId].extends ||
getAcpProviderCatalog().some(
(entry) => entry.id === providerId && entry.bundledProvider,
)),
),
[config],
);
@@ -403,20 +413,18 @@ export function ProvidersSection({ serverId }: ProvidersSectionProps) {
const handleInstall = useCallback(
async (entry: AcpProviderCatalogItem) => {
if (installingProviderId) return;
setInstallError(null);
setInstallingProviderId(entry.id);
try {
await patchConfig(buildAcpProviderConfigPatch(entry));
await patchConfig(buildAcpProviderConfigPatch(entry, supportsHopliteProvider));
await refresh([entry.id]);
} catch (error) {
Alert.alert(
t("settings.providers.addErrorTitle"),
error instanceof Error ? error.message : String(error),
);
setInstallError(error instanceof Error ? error.message : String(error));
} finally {
setInstallingProviderId((current) => (current === entry.id ? null : current));
}
},
[installingProviderId, patchConfig, refresh, t],
[installingProviderId, patchConfig, refresh, supportsHopliteProvider],
);
return (
@@ -472,6 +480,11 @@ export function ProvidersSection({ serverId }: ProvidersSectionProps) {
testID="host-page-add-provider-card"
style={styles.addProviderSection}
>
{installError ? (
<Text accessibilityRole="alert" style={styles.errorText}>
{installError}
</Text>
) : null}
<ProviderCatalogList
serverId={serverId}
installingProviderId={installingProviderId}
@@ -359,6 +359,8 @@ class AcpRuntime {
private emit: (event: ProviderEvent) => void;
private readonly messages = new Map<string, string>();
private readonly toolCalls = new Map<string, AcpToolCallSnapshot>();
// Running tool rows published by transformers; the turn's terminal closes any left open.
private readonly vendorToolCalls = new Map<string, ToolCallTimelineItem>();
private readonly pendingCompactions = new Set<string>();
private readonly permissions = new Map<
string,
@@ -595,10 +597,13 @@ class AcpRuntime {
turnId,
state: "started",
});
// The SDK dispatches notifications without awaiting them, so the prompt response can resolve
// while earlier session updates are still queued. Apply them before the turn ends.
const settled = this.call(
this.connection.prompt({ sessionId: this.nativeSessionId, prompt }),
).then(
(response): void => {
async (response): Promise<void> => {
await this.drainNotifications();
const state = response.stopReason === "cancelled" ? "canceled" : "completed";
this.fallbackChunkIds.clear();
this.terminalizeTransientItems(state);
@@ -610,7 +615,8 @@ class AcpRuntime {
});
return undefined;
},
(error): void => {
async (error): Promise<void> => {
await this.drainNotifications();
this.fallbackChunkIds.clear();
this.terminalizeTransientItems("failed");
this.emit({
@@ -1027,9 +1033,17 @@ class AcpRuntime {
this.emit({
type: "timeline.item",
sessionId: this.options.boundarySessionId,
item: toolTimelineItem(completed),
item: terminalToolItem(toolTimelineItem(snapshot), state),
});
}
for (const item of this.vendorToolCalls.values()) {
this.emit({
type: "timeline.item",
sessionId: this.options.boundarySessionId,
item: terminalToolItem(item, state),
});
}
this.vendorToolCalls.clear();
for (const id of this.pendingCompactions) {
this.emit({
type: "timeline.item",
@@ -1076,6 +1090,10 @@ class AcpRuntime {
if (this.configTransaction) this.stagedTransformerConfig = update.config;
else this.emitConfigSnapshot(update.config);
} else if (update.type === "timeline") {
if (update.item.type === "tool_call") {
if (update.item.status === "running") this.vendorToolCalls.set(update.item.id, update.item);
else this.vendorToolCalls.delete(update.item.id);
}
this.emit({
type: "timeline.item",
sessionId: this.options.boundarySessionId,
@@ -1383,7 +1401,9 @@ function configValues(
return Object.fromEntries(options.map((option) => [option.id, option.currentValue]));
}
function toolTimelineItem(snapshot: AcpToolCallSnapshot): ProviderTimelineItem {
type ToolCallTimelineItem = Extract<ProviderTimelineItem, { type: "tool_call" }>;
function toolTimelineItem(snapshot: AcpToolCallSnapshot): ToolCallTimelineItem {
const input = jsonRecord(snapshot.input);
const isEdit = snapshot.kind === "edit" || snapshot.name?.toLowerCase().includes("edit") === true;
const detail = isEdit
@@ -1411,6 +1431,18 @@ function toolTimelineItem(snapshot: AcpToolCallSnapshot): ProviderTimelineItem {
return { ...base, status, error: null };
}
// A row the turn left open ends with the turn. The wire contract requires a non-null error on a
// failed tool call, so a canceled turn cancels its rows instead of failing them.
function terminalToolItem(
item: ToolCallTimelineItem,
state: "completed" | "failed" | "canceled",
): ToolCallTimelineItem {
if (state === "failed") {
return { ...item, status: "failed", error: item.error ?? { message: "Turn failed" } };
}
return { ...item, status: state, error: null };
}
function jsonValue(value: unknown) {
return z.json().parse(value);
}
+140
View File
@@ -619,6 +619,146 @@ lines.on("line", (line) => {
await connection.close();
});
it.each([
["end_turn", "completed", "completed"],
["cancelled", "canceled", "canceled"],
] as const)(
"closes a transformer's running tool row when the turn ends with %s",
async (stopReason, turnState, rowStatus) => {
const harness = connectorHarness({
handleMessage(instance, message) {
if (!("method" in message) || !("id" in message)) return false;
if (message.method !== "session/prompt") return false;
instance.notify("vendor/phase", { id: "phase-1", label: "Preparing" });
instance.respond(message as AcpRequestMessage, { stopReason });
return true;
},
});
const registration = runAcpProvider({
id: "vendor-row-acp",
label: "Vendor row ACP",
connector: harness.connector,
transformers: [
{
notification(notification) {
if (notification.method !== "vendor/phase") return null;
return {
type: "timeline",
item: {
type: "tool_call",
id: "phase-1",
callId: "phase-1",
name: "Vendor phase",
detail: { type: "plain_text", label: "Preparing" },
status: "running",
error: null,
},
};
},
},
],
});
const connection = await registration.connect({
versions: [1],
capabilities: ["prompt.message"],
});
const events: ProviderEvent[] = [];
connection.onEvent((event) => events.push(event));
await connection.send(openInput());
await waitForEvent(events, (event) => event.type === "session.ready");
await connection.send({
type: "session.prompt",
sessionId: "session-1",
prompt: {
clientMessageId: "first",
delivery: "auto",
input: { type: "message", content: [{ type: "text", text: "first" }] },
},
});
await waitForEvent(
events,
(event) => event.type === "session.turn" && event.state === turnState,
);
const rows = events.flatMap((event) =>
event.type === "timeline.item" && event.item.id === "phase-1" ? [event.item] : [],
);
expect(rows.map((row) => row.type === "tool_call" && row.status)).toEqual([
"running",
rowStatus,
]);
const closed = events.findIndex(
(event) =>
event.type === "timeline.item" &&
event.item.id === "phase-1" &&
event.item.type === "tool_call" &&
event.item.status === rowStatus,
);
const terminal = events.findIndex(
(event) => event.type === "session.turn" && event.state === turnState,
);
expect(closed).toBeLessThan(terminal);
// The wire contract only accepts a failed tool call with a non-null error.
expect(rows.at(-1)).toMatchObject({ error: null });
await connection.close();
},
);
it("cancels an in-progress ACP tool call with the canceled turn instead of failing it without an error", async () => {
const harness = connectorHarness({
handleMessage(instance, message) {
if (!("method" in message) || !("id" in message)) return false;
if (message.method !== "session/prompt") return false;
instance.notify("session/update", {
sessionId: "connector-session",
update: {
sessionUpdate: "tool_call",
toolCallId: "tool-1",
title: "Run tests",
kind: "execute",
status: "in_progress",
},
});
instance.respond(message as AcpRequestMessage, { stopReason: "cancelled" });
return true;
},
});
const registration = runAcpProvider({
id: "cancel-tool-acp",
label: "Cancel tool ACP",
connector: harness.connector,
});
const connection = await registration.connect({
versions: [1],
capabilities: ["prompt.message"],
});
const events: ProviderEvent[] = [];
connection.onEvent((event) => events.push(event));
await connection.send(openInput());
await waitForEvent(events, (event) => event.type === "session.ready");
await connection.send({
type: "session.prompt",
sessionId: "session-1",
prompt: {
clientMessageId: "first",
delivery: "auto",
input: { type: "message", content: [{ type: "text", text: "first" }] },
},
});
await waitForEvent(
events,
(event) => event.type === "session.turn" && event.state === "canceled",
);
const rows = events.flatMap((event) =>
event.type === "timeline.item" && event.item.id === "tool-1" ? [event.item] : [],
);
expect(rows.at(-1)).toMatchObject({ type: "tool_call", status: "canceled", error: null });
await connection.close();
});
it("serializes configuration mutations", async () => {
let releaseMutation: (() => void) | null = null;
const configOptions = [
+2
View File
@@ -26,6 +26,8 @@ export const PROVIDER_CAPABILITIES = [
export type ProviderCapability = (typeof PROVIDER_CAPABILITIES)[number];
export interface ProviderRegistration {
/** Activate only while agents.providers contains this provider ID, independently of enabled. */
requiresConfiguration?: boolean;
/** Equal keys share discovery within this provider. Include effective configuration and execution environment. */
getCatalogCacheKey?(options: ProviderCatalogOptions): Promise<string | undefined>;
/** Default executable and arguments; the daemon resolves overrides before status/connect. */
@@ -812,3 +812,14 @@ describe("checkout PR schemas", () => {
});
});
});
test.each([undefined, false, true])(
"accepts optional Hoplite capability (%s)",
(hopliteProvider) => {
const features = hopliteProvider === undefined ? {} : { hopliteProvider };
expect(
ServerInfoStatusPayloadSchema.parse({ status: "server_info", serverId: "test", features })
.features,
).toEqual(features);
},
);
+2
View File
@@ -3710,6 +3710,8 @@ export const ServerInfoStatusPayloadSchema = z
commitBaseClassification: z.boolean().optional(),
// COMPAT(providerRemoval): added in v0.1.105, drop the gate when floor >= v0.1.105.
providerRemoval: z.boolean().optional(),
// COMPAT(hopliteProvider): added after v0.11.2, remove after 2027-04-15 once host floor includes the bundled adapter.
hopliteProvider: z.boolean().optional(),
// COMPAT(importSessionWorkspaceTarget): added in v0.1.110, remove gate after 2027-01-16.
importSessionWorkspaceTarget: z.boolean().optional(),
// COMPAT(importSessionSearch): added in v0.8.0, remove gate after 2027-03-02.
@@ -1121,3 +1121,50 @@ describe("plugin provider launch and status", () => {
},
);
});
test("config-required plugin membership is independent of enablement and other providers", async () => {
const logger = createTestLogger();
const plugins = new PluginAgentClientRegistry(logger);
const harness = createProviderHarness();
let connections = 0;
let probes = 0;
plugins.replace([
{
...harness.registration,
requiresConfiguration: true,
async status() {
probes++;
return { available: true };
},
async connect(request) {
connections++;
return harness.registration.connect(request);
},
},
]);
const build = (providerOverrides = {}) =>
buildProviderRegistry(logger, {
pluginProviders: plugins.definitions(),
providerOverrides,
});
try {
const before = build();
expect(before["plugin-direct"]).toBeUndefined();
expect({ probes, connections }).toEqual({ probes: 0, connections: 0 });
const added = build({ "plugin-direct": {} });
expect(added["plugin-direct"].enabled).toBe(true);
const client = added["plugin-direct"].createClient(logger);
expect(await client.isAvailable()).toBe(true);
const catalog = await client.fetchCatalog({ scope: "global" });
expect(catalog.models.map((model) => model.id)).toEqual(["plugin-model"]);
expect({ probes, connections }).toEqual({ probes: 1, connections: 1 });
const disabled = build({ "plugin-direct": { enabled: false } });
expect(disabled["plugin-direct"].enabled).toBe(false);
expect(Object.keys(build())).toEqual(Object.keys(before));
for (const id of Object.keys(before)) {
expect(added[id].enabled).toBe(before[id].enabled);
}
} finally {
await plugins.shutdown();
}
});
@@ -885,6 +885,7 @@ function createPluginProviderDefinition(
label: registration.label,
description: registration.description ?? `Plugin provider ${registration.label}`,
iconSvg: registration.icon,
requiresConfiguration: registration.requiresConfiguration,
defaultModeId: null,
modes: [],
supportsExactMcpPreapproval: true,
@@ -97,6 +97,7 @@ export interface ProviderDefinition extends AgentProviderDefinition {
/** Provider metadata and an unconfigured factory; the registry owns override application. */
export interface RegisteredProviderDefinition extends AgentProviderDefinition {
requiresConfiguration?: boolean;
iconSvg?: string;
supportsExactMcpPreapproval: boolean;
createClient: (logger: Logger, runtimeSettings?: ProviderRuntimeSettings) => AgentClient;
@@ -925,6 +926,8 @@ export function buildProviderRegistry(
throw new Error(`Plugin provider '${provider}' conflicts with a built-in provider`);
}
const override = providerOverrides[provider];
if (definition.requiresConfiguration && !override) continue;
if (override?.extends) {
logger.warn({ provider }, "Plugin provider shadowed by configured provider");
continue;
@@ -348,6 +348,10 @@ export class ProviderSnapshotManager {
return Object.prototype.hasOwnProperty.call(this.generation.definitions, provider);
}
supportsConfigRequiredProvider(provider: AgentProvider): boolean {
return this.pluginProviders.definitions()[provider]?.requiresConfiguration === true;
}
getProviderLabel(provider: AgentProvider): string {
return this.generation.definitions[provider]?.label ?? provider;
}
@@ -0,0 +1,37 @@
// Local ACP peer for the bundled Hoplite adapter; no Hoplite service or credentials.
const fs = require("node:fs");
const readline = require("node:readline");
fs.appendFileSync(process.env.HOPLITE_TEST_RECORD, "launch\n");
const configOptions = [
{
id: "model",
category: "model",
type: "select",
name: "Model",
currentValue: "fixture-model",
options: [{ value: "fixture-model", name: "Fixture model" }],
},
];
const send = (message) =>
process.stdout.write(JSON.stringify({ jsonrpc: "2.0", ...message }) + "\n");
readline.createInterface({ input: process.stdin }).on("line", (line) => {
const request = JSON.parse(line);
if (request.id === undefined) return;
let result = {};
if (request.method === "initialize")
result = { protocolVersion: 1, agentCapabilities: {}, authMethods: [] };
if (request.method === "session/new")
result = {
sessionId: "hoplite-fixture",
configOptions,
};
if (request.method === "session/set_config_option") result = { configOptions };
if (request.method === "session/prompt") {
send({
method: "_hoplite/run_phase",
params: { runId: "fixture-run", phase: "provisioning", label: "Preparing fixture workspace" },
});
result = { stopReason: "end_turn" };
}
send({ id: request.id, result });
});
@@ -1,7 +1,8 @@
import { describe, test, expect } from "vitest";
import { mkdtemp, rm } from "node:fs/promises";
import { mkdtemp, rm, readFile, writeFile } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { loadConfig } from "../config.js";
import { findExecutable } from "../../executable-resolution/executable-resolution.js";
import { BuiltinPluginLoader } from "../plugins/builtin/index.js";
import { createTestPaseoDaemon } from "../test-utils/paseo-daemon.js";
@@ -165,3 +166,125 @@ test("Antigravity creates an agent and answers a prompt with real agy", async ({
await rm(cwd, { recursive: true, force: true });
}
}, 120000);
test("bundled Hoplite requires a config entry and removal survives restart", async () => {
const root = await mkdtemp(path.join(os.tmpdir(), "paseo-hoplite-optin-"));
const record = path.join(root, "launches.txt");
await writeFile(record, "");
const options = {
paseoHomeRoot: root,
cleanup: false,
mcpEnabled: false,
builtinPlugins: new BuiltinPluginLoader(undefined, [
"hoplite-provider",
"antigravity-provider",
]),
};
let daemon = await createTestPaseoDaemon(options);
const connect = async () => {
const client = new DaemonClient({
url: `ws://127.0.0.1:${daemon.port}/ws`,
appVersion: "0.11.2",
});
await client.connect();
await client.fetchAgents({ subscribe: {} });
return client;
};
let client = await connect();
try {
const before = await client.getProvidersSnapshot();
expect(before.entries.some((entry) => entry.provider === "hoplite")).toBe(false);
expect(before.entries.some((entry) => entry.provider === "antigravity")).toBe(true);
expect(await readFile(record, "utf8")).toBe("");
await client.patchDaemonConfig({
providers: {
hoplite: {
enabled: true,
command: [process.execPath, path.resolve(import.meta.dirname, "hoplite-fixture.cjs")],
env: { HOPLITE_TEST_RECORD: record },
},
},
});
await expect
.poll(
async () =>
(await client.getProvidersSnapshot()).entries.find(
(entry) => entry.provider === "hoplite",
)?.status,
)
.toBe("ready");
expect((await client.listProviderModels("hoplite")).models.map((model) => model.id)).toEqual([
"fixture-model",
]);
const agent = await client.createAgent({
provider: "hoplite",
cwd: root,
model: "fixture-model",
});
await client.sendMessage(agent.id, "Exercise the contributor transformer");
await client.waitForFinish(agent.id, 10000);
const timeline = await client.fetchAgentTimeline(agent.id, { limit: 100 });
expect(timeline.entries.map((entry) => entry.item)).toContainEqual(
expect.objectContaining({
type: "tool_call",
name: "Hoplite workspace",
status: "completed",
}),
);
await client.archiveAgent(agent.id);
expect(await readFile(record, "utf8")).toContain("launch");
await client.patchDaemonConfig({ providers: { hoplite: { enabled: false } } });
expect(
(await client.getProvidersSnapshot()).entries.find((entry) => entry.provider === "hoplite")
?.enabled,
).toBe(false);
await client.close();
await daemon.close();
daemon = await createTestPaseoDaemon({
...options,
staticDir: daemon.staticDir,
providerOverrides: loadConfig(daemon.paseoHome, { env: {} }).providerOverrides,
});
client = await connect();
expect(
(await client.getProvidersSnapshot()).entries.find((entry) => entry.provider === "hoplite")
?.enabled,
).toBe(false);
await client.patchDaemonConfig({ removeProviders: ["hoplite"] });
expect(
(await client.getProvidersSnapshot()).entries.some((entry) => entry.provider === "hoplite"),
).toBe(false);
expect((await client.getDaemonConfig()).config.providers?.hoplite).toBeUndefined();
const persisted = JSON.parse(
await readFile(path.join(daemon.paseoHome, "config.json"), "utf8"),
);
expect(persisted.agents?.providers?.hoplite).toBeUndefined();
const launchesAfterRemoval = await readFile(record, "utf8");
await client.close();
await daemon.close();
daemon = await createTestPaseoDaemon({
...options,
staticDir: daemon.staticDir,
providerOverrides: loadConfig(daemon.paseoHome, { env: {} }).providerOverrides,
});
client = await connect();
const restarted = await client.getProvidersSnapshot();
expect(restarted.entries.some((entry) => entry.provider === "hoplite")).toBe(false);
expect(restarted.entries.map((entry) => entry.provider)).toEqual(
before.entries.map((entry) => entry.provider),
);
expect(await readFile(record, "utf8")).toBe(launchesAfterRemoval);
await client.patchDaemonConfig({ providers: { hoplite: { enabled: false } } });
expect(
(await client.getProvidersSnapshot()).entries.find((entry) => entry.provider === "hoplite")
?.enabled,
).toBe(false);
} finally {
await client.close();
await daemon.close();
await rm(root, { recursive: true, force: true });
await rm(daemon.staticDir, { recursive: true, force: true });
}
}, 60000);
@@ -9,6 +9,7 @@ export const builtinPlugins = [
"copilot-usage-source",
"cursor-usage-source",
"grok-usage-source",
"hoplite-provider",
"kimi-usage-source",
"minimax-usage-source",
"muse-provider",
@@ -629,6 +629,7 @@ export class PluginService {
label: provider.label,
description: provider.description,
command: provider.command,
requiresConfiguration: provider.requiresConfiguration,
status: provider.hasStatus
? (request) => {
if (!this.runtime.getProviderStatus)
@@ -14,6 +14,7 @@ import {
import { z } from "zod";
export interface PluginProviderMetadata {
requiresConfiguration?: boolean;
hasCatalogCacheKey?: boolean;
hasStatus?: boolean;
command?: readonly [string, ...string[]];
@@ -112,6 +113,7 @@ const providerMetadataSchema = z
label: z.string().min(1),
description: z.string().optional(),
iconPath: z.string().optional(),
requiresConfiguration: z.boolean().optional(),
hasCatalogCacheKey: z.boolean().optional(),
hasStatus: z.boolean().optional(),
command: z.tuple([z.string().min(1)], z.string()).optional(),
@@ -158,6 +158,7 @@ export function createPluginWorker(options: {
label: provider.label,
description: provider.description,
iconPath: provider.icon,
requiresConfiguration: provider.requiresConfiguration,
hasCatalogCacheKey: provider.getCatalogCacheKey !== undefined,
hasStatus: provider.status !== undefined,
command: provider.command,
@@ -1915,6 +1915,7 @@ export class VoiceAssistantWebSocketServer {
commitBaseClassification: true,
// COMPAT(providerRemoval): added in v0.1.105, drop the gate when floor >= v0.1.105.
providerRemoval: true,
hopliteProvider: this.providerSnapshotManager.supportsConfigRequiredProvider("hoplite"),
// COMPAT(importSessionWorkspaceTarget): added in v0.1.110, remove gate after 2027-01-16.
importSessionWorkspaceTarget: true,
// COMPAT(importSessionSearch): added in v0.7.3, remove gate after 2027-03-02.
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="1.394 1.679 8.494 7.828" fill="currentColor"><path d="M8.237 7.813C8.276 7.789 8.327 7.796 8.358 7.83L9.741 9.346C9.797 9.407 9.754 9.506 9.671 9.507H8.977C8.924 9.507 8.881 9.463 8.881 9.41V9.125C8.881 9.089 8.861 9.057 8.83 9.04L7.589 8.379C7.524 8.344 7.521 8.251 7.584 8.212L8.237 7.813ZM3.944 1.679C4.502 1.679 5.052 1.82 5.54 2.09L5.962 2.323C6.024 2.358 6.029 2.446 5.97 2.486L5.091 3.09C5.065 3.108 5.05 3.137 5.05 3.169V3.495C5.05 3.529 5.032 3.561 5.003 3.578L4.68 3.769C4.594 3.82 4.498 3.722 4.549 3.637L4.592 3.566C4.63 3.502 4.584 3.421 4.51 3.421H4.028C3.925 3.421 3.894 3.562 3.989 3.604L4.377 3.775C4.448 3.806 4.455 3.904 4.389 3.944L3.77 4.323C3.755 4.332 3.737 4.337 3.72 4.337H3.361C3.309 4.337 3.268 4.379 3.268 4.431C3.268 4.484 3.309 4.526 3.361 4.526H3.779C3.797 4.526 3.814 4.521 3.829 4.513L7.599 2.272C8.135 1.954 8.815 2.008 9.294 2.407C9.307 2.418 9.314 2.434 9.314 2.451V2.729C9.315 2.812 9.413 2.856 9.475 2.8L9.728 2.57C9.789 2.514 9.888 2.558 9.888 2.641V5.812C9.888 5.865 9.845 5.908 9.792 5.908H9.359C9.331 5.908 9.303 5.895 9.285 5.873L8.374 4.773C8.337 4.728 8.268 4.728 8.229 4.771L7.468 5.625C7.429 5.669 7.438 5.737 7.487 5.769L9.038 6.776C9.098 6.815 9.096 6.903 9.035 6.939L6.618 8.363C6.556 8.4 6.478 8.358 6.474 8.286L6.439 7.633C6.437 7.578 6.48 7.532 6.535 7.532H6.925C6.948 7.532 6.971 7.523 6.988 7.508L7.211 7.31C7.276 7.252 7.236 7.144 7.148 7.142L5.991 7.118H1.49C1.437 7.118 1.394 7.075 1.394 7.022V3.308C1.394 3.255 1.437 3.212 1.49 3.212H2.544C2.597 3.212 2.64 3.169 2.64 3.116V2.969C2.64 2.916 2.597 2.873 2.544 2.873H1.461C1.366 2.873 1.329 2.75 1.408 2.697L2.134 2.221C2.672 1.867 3.301 1.679 3.944 1.679Z"/></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

+7
View File
@@ -0,0 +1,7 @@
import type { PluginServerContext } from "@getpaseo/plugin/server";
import { createHopliteProvider } from "./server/provider.js";
export default function contribute(server: PluginServerContext) {
server.registerProvider(createHopliteProvider());
return () => {};
}
@@ -0,0 +1 @@
{ "id": "hoplite-provider", "requirements": { "paseo": ">=0.11.0" } }
@@ -0,0 +1,17 @@
import { runAcpProvider } from "@getpaseo/plugin/server/acp";
import type { ProviderRegistration } from "@getpaseo/plugin/server/provider";
import { runPhaseTransformer } from "./run-phase.js";
export function createHopliteProvider(): ProviderRegistration {
return {
requiresConfiguration: true,
...runAcpProvider({
id: "hoplite",
label: "Hoplite",
description: "Hoplite's coding agent through the local `hoplite acp` bridge",
icon: "icon.svg",
command: ["hoplite", "acp"],
transformers: [runPhaseTransformer],
}),
};
}
@@ -0,0 +1,74 @@
import { describe, expect, it } from "vitest";
import { runPhaseTransformer } from "./run-phase.js";
const context = { sessionId: "session-1" };
// Frames captured from `hoplite acp` 3.0.0.
function runPhase(phase: string | null, label: string | null) {
return {
method: "_hoplite/run_phase",
params: {
sessionId: "thr_c75d39f7d7624256af918eeee2f4941b",
runId: "run_eb213b97bd3147afb2927fbc27f87180",
phase,
label,
startedAt: phase === null ? null : "2026-10-04T17:51:46.311Z",
},
};
}
describe("runPhaseTransformer", () => {
it("shows a provisioning phase as one running workspace item per run", () => {
const update = runPhaseTransformer.notification?.(
runPhase("fetching_repository", "Cloning repository"),
context,
);
expect(update).toEqual({
type: "timeline",
item: {
type: "tool_call",
id: "hoplite-run-phase:run_eb213b97bd3147afb2927fbc27f87180",
callId: "hoplite-run-phase:run_eb213b97bd3147afb2927fbc27f87180",
name: "Hoplite workspace",
detail: { type: "plain_text", label: "Cloning repository", icon: "wrench" },
status: "running",
error: null,
},
});
});
it("completes the same item when the run leaves provisioning", () => {
const update = runPhaseTransformer.notification?.(runPhase(null, null), context);
expect(update).toMatchObject({
type: "timeline",
item: {
id: "hoplite-run-phase:run_eb213b97bd3147afb2927fbc27f87180",
status: "completed",
detail: { label: "Workspace ready" },
},
});
});
it("falls back to the phase name when Hoplite sends no label", () => {
const update = runPhaseTransformer.notification?.(
runPhase("configuring_workspace", null),
context,
);
expect(update).toMatchObject({ item: { detail: { label: "configuring_workspace" } } });
});
it("ignores other vendor notifications and malformed phases", () => {
expect(
runPhaseTransformer.notification?.({ method: "_hoplite/other", params: {} }, context),
).toBeNull();
expect(
runPhaseTransformer.notification?.(
{ method: "_hoplite/run_phase", params: { phase: "x" } },
context,
),
).toBeNull();
});
});
@@ -0,0 +1,39 @@
import type { AcpTransformer } from "@getpaseo/plugin/server/acp";
import { z } from "zod";
// Hoplite provisions a cloud workspace before the first agent output of a run and reports each
// step as `_hoplite/run_phase`. A null phase ends provisioning for that run.
const runPhaseSchema = z.object({
runId: z.string().min(1),
phase: z.string().nullable(),
label: z.string().nullable(),
});
const RUN_PHASE_METHOD = "_hoplite/run_phase";
export const runPhaseTransformer: AcpTransformer = {
notification(notification) {
if (notification.method !== RUN_PHASE_METHOD) return null;
const params = runPhaseSchema.safeParse(notification.params);
if (!params.success) return null;
const { runId, phase, label } = params.data;
const id = `hoplite-run-phase:${runId}`;
const running = phase !== null;
return {
type: "timeline",
item: {
type: "tool_call",
id,
callId: id,
name: "Hoplite workspace",
detail: {
type: "plain_text",
label: running ? (label ?? phase) : "Workspace ready",
icon: "wrench",
},
status: running ? "running" : "completed",
error: null,
},
};
},
};