Skip to content

Commit 0e217af

Browse files
committed
fix(providers): hide first-party agents from ACP registry search
1 parent c0de6bd commit 0e217af

2 files changed

Lines changed: 101 additions & 11 deletions

File tree

‎packages/provider-acp-registry/src/server/AcpRegistrySupport.test.ts‎

Lines changed: 89 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -910,19 +910,19 @@ describe("AcpRegistrySupport", () => {
910910
it.effect("searches compatible agents with deterministic ranking and bounded metadata", () => {
911911
const exact = {
912912
...makeAgent({ npx: { package: "@example/[email protected]" } }),
913-
id: "codex-acp",
914-
name: "Codex",
915-
authors: ["OpenAI", "Zed Industries"],
913+
id: "kimi",
914+
name: "Kimi",
915+
authors: ["Moonshot AI", "Zed Industries"],
916916
license: "Apache-2.0",
917-
website: "https://example.test/codex",
918-
repository: "https://example.test/codex/source",
919-
icon: "https://example.test/codex.svg",
917+
website: "https://example.test/kimi",
918+
repository: "https://example.test/kimi/source",
919+
icon: "https://example.test/kimi.svg",
920920
} satisfies AcpRegistrySupport.AcpRegistryAgent;
921921
const descriptionMatch = {
922922
...makeAgent({ npx: { package: "[email protected]" } }),
923923
id: "other-agent",
924924
name: "Other Agent",
925-
description: "An adapter for Codex workflows",
925+
description: "An adapter for Kimi workflows",
926926
} satisfies AcpRegistrySupport.AcpRegistryAgent;
927927
const incompatible = {
928928
...makeAgent({
@@ -931,7 +931,7 @@ describe("AcpRegistrySupport", () => {
931931
},
932932
}),
933933
id: "darwin-only",
934-
name: "Codex Darwin",
934+
name: "Kimi Darwin",
935935
} satisfies AcpRegistrySupport.AcpRegistryAgent;
936936

937937
return Effect.gen(function* () {
@@ -944,11 +944,11 @@ describe("AcpRegistrySupport", () => {
944944
toolsDir: `${cacheDir}/tools`,
945945
registryUrl,
946946
});
947-
const result = yield* resolver.search({ query: "codex" });
947+
const result = yield* resolver.search({ query: "kimi" });
948948

949-
expect(result.agents.map((agent) => agent.id)).toEqual(["codex-acp", "other-agent"]);
949+
expect(result.agents.map((agent) => agent.id)).toEqual(["kimi", "other-agent"]);
950950
expect(result.agents[0]).toMatchObject({
951-
authors: ["OpenAI", "Zed Industries"],
951+
authors: ["Moonshot AI", "Zed Industries"],
952952
distribution: "npx",
953953
integrity: "registry",
954954
license: "Apache-2.0",
@@ -973,6 +973,84 @@ describe("AcpRegistrySupport", () => {
973973
);
974974
});
975975

976+
it.effect(
977+
"hides first-party providers from registry searches without breaking existing configs",
978+
() => {
979+
const firstPartyAgents = (
980+
[
981+
["antigravity-acp", "Google Antigravity"],
982+
["claude-acp", "Claude Agent"],
983+
["codex-acp", "Codex"],
984+
["cursor", "Cursor"],
985+
["grok-build", "Grok Build"],
986+
["opencode", "OpenCode"],
987+
["pi-acp", "pi ACP"],
988+
] as const
989+
).map(([id, name]) => ({
990+
...makeAgent({
991+
binary: { "linux-x86_64": { archive: archiveUrl, cmd: "agent" } },
992+
}),
993+
id,
994+
name,
995+
}));
996+
const otherAgent = {
997+
...makeAgent({
998+
binary: { "linux-x86_64": { archive: archiveUrl, cmd: "agent" } },
999+
}),
1000+
description: "Supports Codex workflows",
1001+
};
1002+
return Effect.gen(function* () {
1003+
const fileSystem = yield* FileSystem.FileSystem;
1004+
const cacheDir = yield* fileSystem.makeTempDirectoryScoped({
1005+
prefix: "t3-acp-registry-first-party-",
1006+
});
1007+
const resolver = yield* AcpRegistrySupport.makeAcpRegistryCatalog({
1008+
cacheDir,
1009+
toolsDir: `${cacheDir}/tools`,
1010+
registryUrl,
1011+
});
1012+
1013+
expect((yield* resolver.search({ query: "" })).agents.map((agent) => agent.id)).toEqual([
1014+
otherAgent.id,
1015+
]);
1016+
for (const agent of firstPartyAgents) {
1017+
for (const query of [agent.id, agent.name]) {
1018+
expect(
1019+
(yield* resolver.search({ query })).agents.map((result) => result.id),
1020+
).not.toContain(agent.id);
1021+
}
1022+
}
1023+
expect(
1024+
(yield* resolver.search({ query: "Codex" })).agents.map((agent) => agent.id),
1025+
).toEqual([otherAgent.id]);
1026+
1027+
const commandPath = `${cacheDir}/existing-agent`;
1028+
yield* fileSystem.writeFileString(commandPath, "#!/bin/sh\n");
1029+
yield* fileSystem.chmod(commandPath, 0o755);
1030+
const resolved = yield* resolver.resolve(
1031+
settings({ agentId: "codex-acp", commandPath }),
1032+
"/workspace",
1033+
);
1034+
expect(resolved.agent?.id).toBe("codex-acp");
1035+
expect(resolved.spawn.command).toBe(commandPath);
1036+
}).pipe(
1037+
Effect.scoped,
1038+
Effect.provide(
1039+
layerResolver((request) =>
1040+
Effect.succeed(
1041+
HttpClientResponse.fromWeb(
1042+
request,
1043+
new Response(
1044+
JSON.stringify({ version: "1.0.0", agents: [...firstPartyAgents, otherAgent] }),
1045+
),
1046+
),
1047+
),
1048+
),
1049+
),
1050+
);
1051+
},
1052+
);
1053+
9761054
it.effect("refreshes explicit searches and coalesces concurrent refreshes", () => {
9771055
const agent = makeAgent({ npx: { package: "@example/[email protected]" } });
9781056
let requests = 0;

‎packages/provider-acp-registry/src/server/AcpRegistrySupport.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSession
4848

4949
const ACP_REGISTRY_URL = "https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json";
5050

51+
// Prefer first-party integrations in discovery, while keeping existing ACP configurations usable.
52+
const FIRST_PARTY_AGENT_IDS = new Set([
53+
"antigravity-acp",
54+
"claude-acp",
55+
"codex-acp",
56+
"cursor",
57+
"grok-build",
58+
"opencode",
59+
"pi-acp",
60+
]);
61+
5162
const MAX_REGISTRY_BYTES = 1024 * 1024;
5263
const MAX_ARCHIVE_BYTES = 1024 * 1024 * 1024;
5364
const MAX_PACKAGE_MANIFEST_BYTES = 1024 * 1024;
@@ -1593,6 +1604,7 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct
15931604
Effect.gen(function* () {
15941605
const registry = yield* refreshRegistry();
15951606
const ranked = registry.agents.flatMap((agent) => {
1607+
if (FIRST_PARTY_AGENT_IDS.has(agent.id)) return [];
15961608
const distribution = resolveAcpRegistryDistribution({
15971609
agent,
15981610
preference: "auto",

0 commit comments

Comments
 (0)