Fix duplicate command args for generic ACP providers (#444)

* Fix duplicate command args for generic ACP providers

* Fix desktop IME enter handling
This commit is contained in:
Edvard Chen
2026-04-16 10:23:05 +08:00
committed by GitHub
parent b8ade39f73
commit 45a5ba8637
6 changed files with 90 additions and 5 deletions
@@ -0,0 +1,45 @@
import { describe, expect, test, vi } from "vitest";
import { createTestLogger } from "../../../test-utils/test-logger.js";
const mockState = vi.hoisted(() => ({
superConstructorOptions: [] as unknown[],
}));
vi.mock("./acp-agent.js", () => ({
ACPAgentClient: class ACPAgentClient {
readonly provider: string;
constructor(options: unknown) {
this.provider = "acp";
mockState.superConstructorOptions.push(options);
}
},
}));
import { GenericACPAgentClient } from "./generic-acp-agent.js";
describe("GenericACPAgentClient", () => {
test("passes the custom command only as defaultCommand", () => {
new GenericACPAgentClient({
logger: createTestLogger(),
command: ["hermes", "acp"],
env: {
HERMES_LOG: "info",
},
});
expect(mockState.superConstructorOptions).toEqual([
{
provider: "acp",
logger: expect.any(Object),
runtimeSettings: {
env: {
HERMES_LOG: "info",
},
},
defaultCommand: ["hermes", "acp"],
},
]);
});
});
@@ -21,10 +21,6 @@ export class GenericACPAgentClient extends ACPAgentClient {
provider: "acp",
logger: options.logger,
runtimeSettings: {
command: {
mode: "replace",
argv: options.command,
},
env: options.env,
},
defaultCommand: options.command as [string, ...string[]],