mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 07:22:44 +00:00
feat(acp): add kimi harness support surfaces
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user