@devries-cameron20 / t3code-1 / commits / 5188454cd9
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(acp-registry): list every compatible agent in Add provider (#19145)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Craig Davison committed Oct 20, 2026 at 05:10 UTC 5188454cd9ef689a4be28abcf34f164bc496c100
6 files changed +94 -12
apps/web/src/components/settings/AcpRegistrySearchStep.browser.test.tsx
+26 -6
@@ -1,4 +1,9 @@
1 -import { EnvironmentId, ProviderDriverKind, type AcpRegistrySearchAgent } from "@t3tools/contracts";
1 +import {
2 + EnvironmentId,
3 + ProviderDriverKind,
4 + type AcpRegistrySearchAgent,
5 + type AcpRegistrySearchInput,
6 +} from "@t3tools/contracts";
7 import * as Cause from "effect/Cause";
8 import { act } from "react";
9 import { createRoot, type Root } from "react-dom/client";
@@ -127,22 +132,37 @@ afterEach(async () => {
132 document.body.replaceChildren();
133 });
134
130 -it("loads the catalog immediately and searches only after typing settles", async () => {
135 +it("shows the full catalog initially and after clearing a debounced search", async () => {
136 + const agents = Array.from({ length: 25 }, (_, index) => ({
137 + ...gemini,
138 + id: `gemini-${index}`,
139 + name: `Gemini CLI ${index + 1}`,
140 + }));
141 + state.search.mockImplementation(({ input }: { input: AcpRegistrySearchInput }) => {
142 + state.result = {
143 + agents: agents
144 + .filter((agent) => agent.name.toLowerCase().includes(input.query.toLowerCase()))
145 + .slice(0, input.limit ?? 20),
146 + };
147 + });
148 + const addButtons = () => page.getByRole("button", { name: /^Add Gemini CLI / }).elements();
149 await render();
132 - expect(state.search).toHaveBeenLastCalledWith({ environmentId, input: { query: "" } });
150 + expect(addButtons()).toHaveLength(25);
151 + await expect.element(page.getByRole("button", { name: "Add Gemini CLI 25" })).toBeEnabled();
152
153 vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout"] });
154 await userEvent.fill(searchBox(), " Gemini ");
155 await act(async () => vi.advanceTimersByTime(200));
156 await userEvent.fill(searchBox(), " Gemini CLI ");
157 await act(async () => vi.advanceTimersByTime(299));
139 - expect(lastQuery()).toBe("");
158 + expect(addButtons()).toHaveLength(25);
159 await act(async () => vi.advanceTimersByTime(1));
141 - expect(lastQuery()).toBe("Gemini CLI");
160 + expect(addButtons()).toHaveLength(20);
161
162 await userEvent.clear(searchBox());
163 await act(async () => vi.advanceTimersByTime(300));
145 - expect(lastQuery()).toBe("");
164 + expect(addButtons()).toHaveLength(25);
165 + await expect.element(page.getByRole("button", { name: "Add Gemini CLI 25" })).toBeEnabled();
166 });
167
168 it("shows the loading, error, and empty states", async () => {
apps/web/src/components/settings/AcpRegistrySearchStep.tsx
+4 -2
@@ -1,4 +1,4 @@
1 -import { AuthProvidersManageScope } from "@t3tools/contracts";
1 +import { ACP_REGISTRY_MAX_AGENTS, AuthProvidersManageScope } from "@t3tools/contracts";
2 import { readEnvironmentScope, useEnvironmentScope } from "../../state/session";
3 import {
4 isAtomCommandInterrupted,
@@ -72,7 +72,9 @@ export function AcpRegistrySearchStep({
72 const search = useEnvironmentQuery(
73 serverEnvironment.searchAcpRegistry({
74 environmentId,
75 - input: { query: submittedQuery },
75 + input: submittedQuery
76 + ? { query: submittedQuery }
77 + : { query: "", limit: ACP_REGISTRY_MAX_AGENTS },
78 }),
79 );
80 const prepareAgent = useAtomCommand(serverEnvironment.prepareAcpRegistryAgent, {
packages/contracts/src/acpRegistry.test.ts
+3
@@ -50,6 +50,7 @@ describe("ACP Registry contracts", () => {
50 expect(decodeSearchInput({ query: " codex " })).toEqual({
51 query: "codex",
52 });
53 + expect(decodeSearchInput({ query: "", limit: 512 })).toEqual({ query: "", limit: 512 });
54 expect(
55 decodePrepareResult({
56 agentId: "codex-acp",
@@ -62,6 +63,8 @@ describe("ACP Registry contracts", () => {
63
64 it("rejects oversized queries and result metadata", () => {
65 expect(() => decodeSearchInput({ query: "x".repeat(121) })).toThrow();
66 + expect(() => decodeSearchInput({ query: "", limit: 0 })).toThrow();
67 + expect(() => decodeSearchInput({ query: "", limit: 513 })).toThrow();
68 expect(() =>
69 decodeSearchAgent({
70 id: "agent",
packages/contracts/src/acpRegistry.ts
+6 -1
@@ -47,8 +47,13 @@ export type AcpRegistryDistribution = typeof AcpRegistryDistribution.Type;
47 export const AcpRegistryIntegrity = Schema.Literals(["sha256", "registry"]);
48 export type AcpRegistryIntegrity = typeof AcpRegistryIntegrity.Type;
49
50 +export const ACP_REGISTRY_MAX_AGENTS = 512;
51 +
52 export const AcpRegistrySearchInput = Schema.Struct({
53 query: TrimmedString.check(Schema.isMaxLength(120)),
54 + limit: Schema.optional(
55 + Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: ACP_REGISTRY_MAX_AGENTS })),
56 + ),
57 });
58 export type AcpRegistrySearchInput = typeof AcpRegistrySearchInput.Type;
59
@@ -70,7 +75,7 @@ export const AcpRegistrySearchAgent = Schema.Struct({
75 export type AcpRegistrySearchAgent = typeof AcpRegistrySearchAgent.Type;
76
77 export const AcpRegistrySearchResult = Schema.Struct({
73 - agents: Schema.Array(AcpRegistrySearchAgent).check(Schema.isMaxLength(20)),
78 + agents: Schema.Array(AcpRegistrySearchAgent).check(Schema.isMaxLength(ACP_REGISTRY_MAX_AGENTS)),
79 });
80 export type AcpRegistrySearchResult = typeof AcpRegistrySearchResult.Type;
81
packages/provider-acp-registry/src/server/AcpRegistrySupport.test.ts
+49
@@ -1,6 +1,8 @@
1 import * as NodeServices from "@effect/platform-node/NodeServices";
2 import { describe, expect, it } from "@effect/vitest";
3 import {
4 + AcpRegistrySearchInput,
5 + AcpRegistrySearchResult,
6 DEFAULT_SERVER_SETTINGS,
7 ProviderDriverKind,
8 ProviderInstanceId,
@@ -29,6 +31,8 @@ import * as TestProviderHost from "@t3tools/provider-testing/TestProviderHost";
31 const registryUrl = "https://registry.test/registry.json";
32 const archiveUrl = "https://registry.test/example-agent.bin";
33 const decodeAcpRegistrySettings = Schema.decodeSync(AcpRegistrySettings);
34 +const decodeSearchInput = Schema.decodeEffect(AcpRegistrySearchInput);
35 +const decodeSearchResult = Schema.decodeEffect(AcpRegistrySearchResult);
36 const encodeUnknownJson = Schema.encodeUnknownSync(Schema.fromJsonString(Schema.Unknown));
37
38 function makeAgent(
@@ -1050,6 +1054,51 @@ describe("AcpRegistrySupport", () => {
1054 );
1055 });
1056
1057 + it.effect("keeps default searches at 20 and honors larger catalog limits", () => {
1058 + const base = makeAgent({
1059 + binary: {
1060 + "linux-x86_64": { archive: archiveUrl, cmd: "example-agent" },
1061 + },
1062 + });
1063 + const agents = Array.from({ length: 26 }, (_, index) => {
1064 + const suffix = String(index).padStart(2, "0");
1065 + return { ...base, id: `example-agent-${suffix}`, name: `Example Agent ${suffix}` };
1066 + });
1067 + return Effect.gen(function* () {
1068 + const fileSystem = yield* FileSystem.FileSystem;
1069 + const cacheDir = yield* fileSystem.makeTempDirectoryScoped({
1070 + prefix: "t3-acp-registry-limit-",
1071 + });
1072 + const resolver = yield* AcpRegistrySupport.makeAcpRegistryCatalog({
1073 + cacheDir,
1074 + toolsDir: `${cacheDir}/tools`,
1075 + registryUrl,
1076 + });
1077 + const input = yield* decodeSearchInput({ query: "", limit: 512 });
1078 + const catalog = yield* resolver.search(input).pipe(Effect.flatMap(decodeSearchResult));
1079 + const limited = yield* resolver.search({ query: "", limit: 25 });
1080 + const defaultCatalog = yield* resolver.search({ query: "" });
1081 + const matches = yield* resolver.search({ query: "example" });
1082 +
1083 + expect(catalog.agents).toHaveLength(26);
1084 + expect(limited.agents).toHaveLength(25);
1085 + expect(defaultCatalog.agents).toHaveLength(20);
1086 + expect(matches.agents).toHaveLength(20);
1087 + }).pipe(
1088 + Effect.scoped,
1089 + Effect.provide(
1090 + layerResolver((request) =>
1091 + Effect.succeed(
1092 + HttpClientResponse.fromWeb(
1093 + request,
1094 + new Response(JSON.stringify({ version: "1.0.0", agents })),
1095 + ),
1096 + ),
1097 + ),
1098 + ),
1099 + );
1100 + });
1101 +
1102 it.effect("discards registry agents with blank names or unsafe versions", () => {
1103 const distribution = {
1104 binary: {
packages/provider-acp-registry/src/server/AcpRegistrySupport.ts
+6 -3
@@ -1,4 +1,5 @@
1 import {
2 + ACP_REGISTRY_MAX_AGENTS,
3 AcpRegistryOperationError,
4 AcpRegistryOperationErrorReason,
5 TrimmedNonEmptyString,
@@ -51,7 +52,8 @@ const ACP_REGISTRY_URL = "https://cdn.agentclientprotocol.com/registry/v1/latest
52 const MAX_REGISTRY_BYTES = 1024 * 1024;
53 const MAX_ARCHIVE_BYTES = 1024 * 1024 * 1024;
54 const MAX_PACKAGE_MANIFEST_BYTES = 1024 * 1024;
54 -const MAX_SEARCH_RESULTS = 20;
55 +// Older clients omit the limit and validate responses against a 20-agent cap.
56 +const DEFAULT_SEARCH_LIMIT = 20;
57 const REGISTRY_REQUEST_TIMEOUT = "30 seconds";
58 const ARCHIVE_REQUEST_TIMEOUT = "20 minutes";
59 const PACKAGE_INSTALL_TIMEOUT = "20 minutes";
@@ -170,7 +172,7 @@ type AcpRegistryPackageInstallReceipt = typeof AcpRegistryPackageInstallReceipt.
172
173 const AcpRegistryIndexEnvelope = Schema.Struct({
174 version: BoundedVersion,
173 - agents: Schema.Array(Schema.Unknown).check(Schema.isMaxLength(512)),
175 + agents: Schema.Array(Schema.Unknown).check(Schema.isMaxLength(ACP_REGISTRY_MAX_AGENTS)),
176 });
177 export interface AcpRegistryIndex {
178 readonly version: string;
@@ -1614,8 +1616,9 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct
1616 compareText(left.agent.name.toLowerCase(), right.agent.name.toLowerCase()) ||
1617 compareText(left.agent.id, right.agent.id),
1618 );
1619 + const limit = input.limit ?? DEFAULT_SEARCH_LIMIT;
1620 return {
1618 - agents: ranked.slice(0, MAX_SEARCH_RESULTS).map(({ agent, distribution }) => ({
1621 + agents: ranked.slice(0, limit).map(({ agent, distribution }) => ({
1622 id: agent.id,
1623 name: agent.name,
1624 version: agent.version,