@devries-cameron20 / t3code-1 / commits / 84eb429049
Fork 0

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

fix(acp-registry): detect droid, glm, and vibe flavors for local commands (#39618)

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

Neil Daquioag committed Nov 20, 2026 at 02:39 UTC 84eb4290492eefe39bcf9aa99f1890d48721a0a8
3 files changed +160 -6
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+15
@@ -111,6 +111,10 @@ const OMP_SETTINGS = Schema.decodeSync(AcpRegistrySettings)({
111 commandPath: "/usr/local/bin/omp",
112 commandArgs: ["acp"],
113 });
114 +const DROID_LOCAL_SETTINGS = Schema.decodeSync(AcpRegistrySettings)({
115 + source: "local",
116 + commandPath: "/opt/droid/bin/droid",
117 +});
118 const OPENCODE_SETTINGS = Schema.decodeSync(AcpRegistrySettings)({
119 source: "local",
120 commandPath: "/usr/local/bin/opencode",
@@ -2082,6 +2086,17 @@ describe("AcpAdapterV2", () => {
2086 content: { question_1: "option_1", question_2: "other", question_2_other: "Markdown" },
2087 },
2088 },
2089 + {
2090 + scenario: "extracts the paired form for a local droid command",
2091 + settings: DROID_LOCAL_SETTINGS,
2092 + schema: droidSchema,
2093 + questions: droidQuestions,
2094 + answers: { question_1: "option_1", question_2: "Markdown" },
2095 + result: {
2096 + action: "accept",
2097 + content: { question_1: "option_1", question_2: "other", question_2_other: "Markdown" },
2098 + },
2099 + },
2100 {
2101 scenario: "preserves selected labels and attachment paths in custom answers",
2102 schema: droidSchema,
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts
+122
@@ -2928,6 +2928,128 @@ describe("AcpRegistryAdapterV2", () => {
2928 }).pipe(Effect.provide(layerTest), Effect.scoped),
2929 );
2930
2931 + it.effect("counts per-turn usage for a local glm command", () =>
2932 + Effect.gen(function* () {
2933 + const session = yield* openClaudeReplaySession(
2934 + [
2935 + // GLM reports per-turn usage on the v1 prompt response.
2936 + ...claudeFrames.open.map((entry) =>
2937 + entry.frame.method === "initialize" && entry.type === "emit_inbound"
2938 + ? {
2939 + ...entry,
2940 + frame: {
2941 + ...entry.frame,
2942 + result: { protocolVersion: 1, agentCapabilities: {}, authMethods: [] },
2943 + },
2944 + }
2945 + : entry,
2946 + ),
2947 + {
2948 + type: "expect_outbound",
2949 + frame: { kind: "request", method: "session/prompt", params: "<any>" },
2950 + },
2951 + {
2952 + type: "emit_inbound",
2953 + frame: {
2954 + kind: "response",
2955 + method: "session/prompt",
2956 + result: {
2957 + stopReason: "end_turn",
2958 + usage: { totalTokens: 3_000, inputTokens: 2_500, outputTokens: 500 },
2959 + },
2960 + },
2961 + },
2962 + claudeFrames.closeRequest,
2963 + claudeFrames.closed,
2964 + ],
2965 + undefined,
2966 + false,
2967 + { source: "local", commandPath: "/opt/glm/bin/glm" },
2968 + );
2969 + yield* session.runtime.startTurn(session.turnInput(1)).pipe(Effect.forkScoped);
2970 + const events = yield* session.until((event) => event.type === "turn.terminal");
2971 + const completed = events.findLast(
2972 + (event) =>
2973 + event.type === "provider_turn.updated" && event.providerTurn.status === "completed",
2974 + );
2975 + assert.deepEqual(
2976 + completed?.type === "provider_turn.updated" ? completed.providerTurn.turnTokenUsage : null,
2977 + {
2978 + usageScope: "main_agent",
2979 + usageStatus: "complete",
2980 + hasSubagents: false,
2981 + inputTokens: 2_500,
2982 + outputTokens: 500,
2983 + },
2984 + );
2985 + const terminal = events.at(-1)!;
2986 + if (terminal.type !== "turn.terminal") throw new Error("Missing terminal");
2987 + assert.equal(terminal.status, "completed");
2988 + }).pipe(Effect.provide(layerTest), Effect.scoped),
2989 + );
2990 +
2991 + it.effect("surfaces Mistral's retry notice for a local vibe command", () =>
2992 + Effect.gen(function* () {
2993 + const session = yield* openClaudeReplaySession(
2994 + [
2995 + ...claudeFrames.open,
2996 + {
2997 + type: "expect_outbound",
2998 + frame: { kind: "request", method: "session/prompt", params: "<any>" },
2999 + },
3000 + claudeFrames.update(CLAUDE_ROOT_SESSION, {
3001 + sessionUpdate: "user_message",
3002 + messageId: "user-1",
3003 + content: [{ type: "text", text: "test prompt" }],
3004 + }),
3005 + claudeFrames.update(CLAUDE_ROOT_SESSION, {
3006 + sessionUpdate: "state_update",
3007 + state: "running",
3008 + }),
3009 + {
3010 + type: "emit_inbound",
3011 + frame: {
3012 + kind: "notification",
3013 + method: "_session/retrying",
3014 + params: {
3015 + sessionId: CLAUDE_ROOT_SESSION,
3016 + category: "rate_limited",
3017 + detail: "Backing off for 30s",
3018 + },
3019 + },
3020 + },
3021 + claudeMarker("retry noticed"),
3022 + {
3023 + type: "emit_inbound",
3024 + frame: {
3025 + kind: "response",
3026 + method: "session/prompt",
3027 + result: { stopReason: "end_turn" },
3028 + },
3029 + },
3030 + claudeFrames.idle("end_turn"),
3031 + claudeFrames.closeRequest,
3032 + claudeFrames.closed,
3033 + ],
3034 + undefined,
3035 + false,
3036 + { source: "local", commandPath: "/opt/vibe/bin/vibe-acp" },
3037 + );
3038 + yield* session.runtime.startTurn(session.turnInput(1));
3039 + const events = yield* session.throughMarker("retry noticed");
3040 + const retry = events.find(
3041 + (event) => event.type === "turn_item.updated" && event.turnItem.type === "error",
3042 + );
3043 + if (retry?.type !== "turn_item.updated" || retry.turnItem.type !== "error")
3044 + throw new Error("Missing provider retry item");
3045 + assert.equal(retry.turnItem.title, "Provider retry");
3046 + assert.equal(retry.turnItem.failure.class, "usage_limit");
3047 + assert.equal(retry.turnItem.retry?.attempt, 1);
3048 + const terminal = yield* session.terminal;
3049 + assert.equal(terminal.status, "completed");
3050 + }).pipe(Effect.provide(layerTest), Effect.scoped),
3051 + );
3052 +
3053 it.effect("keeps stopped child tools interrupted when a late output chunk arrives", () =>
3054 Effect.gen(function* () {
3055 const { update } = claudeFrames;
packages/provider-acp-registry/src/server/adapter.ts
+23 -6
@@ -225,6 +225,24 @@ export const makeAcpRegistryAdapterV2 = Effect.fn("makeAcpRegistryAdapterV2")(fu
225 /^claude-agent-acp(\.exe|\.cmd)?$/i.test(
226 options.settings.commandPath.split(/[\\/]/).pop() ?? "",
227 ));
228 + const isDroid =
229 + registryAgentId === "factory-droid" ||
230 + (options.settings.source === "local" &&
231 + /^(?:factory-)?droid(\.exe|\.cmd)?$/i.test(
232 + options.settings.commandPath.split(/[\\/]/).pop() ?? "",
233 + ));
234 + const isGlm =
235 + registryAgentId === "glm-acp-agent" ||
236 + (options.settings.source === "local" &&
237 + /^glm(?:-acp-agent)?(\.exe|\.cmd)?$/i.test(
238 + options.settings.commandPath.split(/[\\/]/).pop() ?? "",
239 + ));
240 + const isVibe =
241 + registryAgentId === "mistral-vibe" ||
242 + (options.settings.source === "local" &&
243 + /^(?:mistral-)?vibe(?:-acp)?(\.exe|\.cmd)?$/i.test(
244 + options.settings.commandPath.split(/[\\/]/).pop() ?? "",
245 + ));
246 const runtimeOptions = isClaude
247 ? {
248 ...options,
@@ -256,8 +274,9 @@ export const makeAcpRegistryAdapterV2 = Effect.fn("makeAcpRegistryAdapterV2")(fu
274 customModels: readCustomModelEntries(options.settings.customModels).map((entry) => entry.slug),
275 compactViaAdvertisedCommand: true,
276 ...(isAntigravityCli ? { wakeOnDetachedRequest: true, replyEndsWithUsageUpdate: true } : {}),
259 - promptFailure: (cause) => acpRegistryPromptFailure(registryAgentId, cause),
260 - ...(registryAgentId === "factory-droid"
277 + promptFailure: (cause) =>
278 + acpRegistryPromptFailure(isVibe ? "mistral-vibe" : registryAgentId, cause),
279 + ...(isDroid
280 ? { extractElicitationForm: extractDroidElicitationForm }
281 : isOmp
282 ? { extractElicitationForm: extractOmpElicitationForm }
@@ -265,7 +284,7 @@ export const makeAcpRegistryAdapterV2 = Effect.fn("makeAcpRegistryAdapterV2")(fu
284 ? { extractElicitationForm: extractOpenCodeElicitationForm }
285 : {}),
286 // glm-acp-agent is the one agent whose per-turn usage a live probe has verified.
268 - ...(registryAgentId === "glm-acp-agent" ? { reportsPerTurnPromptUsage: true } : {}),
287 + ...(isGlm ? { reportsPerTurnPromptUsage: true } : {}),
288 ...(watchKimiPromptOutcome === undefined
289 ? {}
290 : {
@@ -280,9 +299,7 @@ export const makeAcpRegistryAdapterV2 = Effect.fn("makeAcpRegistryAdapterV2")(fu
299 ),
300 ),
301 }),
283 - ...(registryAgentId === "mistral-vibe"
284 - ? { registerExtensions: registerMistralVibeAcpExtensions }
285 - : {}),
302 + ...(isVibe ? { registerExtensions: registerMistralVibeAcpExtensions } : {}),
303 ...(isClaude
304 ? {
305 followAgentWorkState: true,