@devries-cameron20 / t3code Mirror · read-only / commits / 46b508d119
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 16:00 UTC

fix(web): keep long ACP registry searches within the query limit (#23584)

Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Victor committed Nov 14, 2026 at 02:15 UTC 46b508d119b81b772053fa38df72498a0515aab9
3 files changed +31 -4
apps/web/src/components/settings/AcpRegistrySearchStep.browser.test.tsx
+18 -1
@@ -1,6 +1,6 @@
1 import { EnvironmentId, ProviderDriverKind, type AcpRegistrySearchAgent } from "@t3tools/contracts";
2 import { expect, it, vi } from "vite-plus/test";
3 -import { page } from "vite-plus/test/browser";
3 +import { page, userEvent } from "vite-plus/test/browser";
4
5 import { render } from "../../../test/render";
6
@@ -117,6 +117,23 @@ it("rechecks the grant before preparing an agent", async () => {
117 expect(onPrepared).not.toHaveBeenCalled();
118 });
119
120 +it("bounds pasted registry searches before debounce and submission", async () => {
121 + setup();
122 + await using screen = await render(<Step />);
123 + const searchbox = screen.getByRole("searchbox", { name: "Search ACP Registry" });
124 +
125 + await searchbox.fill("agent".repeat(26));
126 + await vi.waitFor(() => {
127 + expect(state.search).toHaveBeenLastCalledWith({
128 + environmentId,
129 + input: { query: "agent".repeat(24) },
130 + });
131 + });
132 + await userEvent.keyboard("{Enter}");
133 + expect(state.refresh).toHaveBeenCalledTimes(1);
134 + await expect.element(searchbox).toHaveValue("agent".repeat(24));
135 +});
136 +
137 it("leaves out Registry agents that T3 Code supports as their own providers", async () => {
138 setup();
139 state.result = { agents: [gemini, { ...gemini, id: "codex-acp", name: "Codex" }] };
apps/web/src/components/settings/AcpRegistrySearchStep.tsx
+11 -2
@@ -1,5 +1,9 @@
1 import { pipe } from "effect/Function";
2 -import { ACP_REGISTRY_MAX_AGENTS, AuthProvidersManageScope } from "@t3tools/contracts";
2 +import {
3 + ACP_REGISTRY_MAX_AGENTS,
4 + ACP_REGISTRY_SEARCH_QUERY_MAX_LENGTH,
5 + AuthProvidersManageScope,
6 +} from "@t3tools/contracts";
7 import { readEnvironmentScope, useEnvironmentScope } from "../../state/session";
8 import {
9 isAtomCommandInterrupted,
@@ -90,7 +94,11 @@ export function useAcpRegistrySearch(environmentId: EnvironmentId, enabled: bool
94 prepareError,
95 type: (text: string) => {
96 setPrepareError(null);
93 - setInput({ text, submitted: submittedQuery, typedAt: Date.now() });
97 + setInput({
98 + text: text.slice(0, ACP_REGISTRY_SEARCH_QUERY_MAX_LENGTH),
99 + submitted: submittedQuery,
100 + typedAt: Date.now(),
101 + });
102 },
103 submit: () => {
104 const trimmed = input.text.trim();
@@ -168,6 +176,7 @@ export function AcpRegistrySearchStep({
176 </InputGroupAddon>
177 <InputGroupInput
178 aria-label="Search ACP Registry"
179 + maxLength={ACP_REGISTRY_SEARCH_QUERY_MAX_LENGTH}
180 disabled={preparingId !== null}
181 onChange={(event) => registry.type(event.currentTarget.value)}
182 placeholder="Search agents…"
packages/contracts/src/acpRegistry.ts
+2 -1
@@ -48,9 +48,10 @@ export const AcpRegistryIntegrity = Schema.Literals(["sha256", "registry"]);
48 export type AcpRegistryIntegrity = typeof AcpRegistryIntegrity.Type;
49
50 export const ACP_REGISTRY_MAX_AGENTS = 512;
51 +export const ACP_REGISTRY_SEARCH_QUERY_MAX_LENGTH = 120;
52
53 export const AcpRegistrySearchInput = Schema.Struct({
53 - query: TrimmedString.check(Schema.isMaxLength(120)),
54 + query: TrimmedString.check(Schema.isMaxLength(ACP_REGISTRY_SEARCH_QUERY_MAX_LENGTH)),
55 limit: Schema.optional(
56 Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: ACP_REGISTRY_MAX_AGENTS })),
57 ),