feat(acp): add kimi harness support surfaces

This commit is contained in:
Peter Steinberger
2026-03-03 01:02:03 +00:00
parent f26853f14c
commit 287606e445
6 changed files with 79 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ function createAcpEnabledConfig(home: string, storePath: string): OpenClawConfig
acp: {
enabled: true,
backend: "acpx",
allowedAgents: ["codex"],
allowedAgents: ["codex", "kimi"],
dispatch: { enabled: true },
},
agents: {
@@ -62,19 +62,20 @@ function mockConfigWithAcpOverrides(
loadConfigSpy.mockReturnValue(cfg);
}
function writeAcpSessionStore(storePath: string) {
function writeAcpSessionStore(storePath: string, agent = "codex") {
const sessionKey = `agent:${agent}:acp:test`;
fs.mkdirSync(path.dirname(storePath), { recursive: true });
fs.writeFileSync(
storePath,
JSON.stringify(
{
"agent:codex:acp:test": {
[sessionKey]: {
sessionId: "acp-session-1",
updatedAt: Date.now(),
acp: {
backend: "acpx",
agent: "codex",
runtimeSessionName: "agent:codex:acp:test",
agent,
runtimeSessionName: sessionKey,
mode: "oneshot",
state: "idle",
lastActivityAt: Date.now(),
@@ -278,4 +279,30 @@ describe("agentCommand ACP runtime routing", () => {
expect(runEmbeddedPiAgentSpy).not.toHaveBeenCalled();
});
});
it("allows ACP turns for kimi when policy allowlists kimi", async () => {
await withTempHome(async (home) => {
const storePath = path.join(home, "sessions.json");
writeAcpSessionStore(storePath, "kimi");
mockConfigWithAcpOverrides(home, storePath, {
allowedAgents: ["kimi"],
});
const runTurn = vi.fn(async (_params: unknown) => {});
mockAcpManager({
runTurn: (params: unknown) => runTurn(params),
resolveSession: ({ sessionKey }) => resolveReadySession(sessionKey, "kimi"),
});
await agentCommand({ message: "ping", sessionKey: "agent:kimi:acp:test" }, runtime);
expect(runTurn).toHaveBeenCalledWith(
expect.objectContaining({
sessionKey: "agent:kimi:acp:test",
text: "ping",
}),
);
expect(runEmbeddedPiAgentSpy).not.toHaveBeenCalled();
});
});
});