mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-27 17:11:46 +00:00
acp: add regression coverage and smoke-test docs
This commit is contained in:
committed by
mbelinky
parent
4aebff78bc
commit
d06138ac3d
@@ -127,6 +127,40 @@ describe("AcpxRuntime", () => {
|
||||
expect(promptArgs).toContain("--approve-all");
|
||||
});
|
||||
|
||||
it("serializes text plus image attachments into ACP prompt blocks", async () => {
|
||||
const { runtime, logPath } = await createMockRuntimeFixture();
|
||||
|
||||
const handle = await runtime.ensureSession({
|
||||
sessionKey: "agent:codex:acp:with-image",
|
||||
agent: "codex",
|
||||
mode: "persistent",
|
||||
});
|
||||
|
||||
for await (const _event of runtime.runTurn({
|
||||
handle,
|
||||
text: "describe this image",
|
||||
attachments: [{ mediaType: "image/png", data: "aW1hZ2UtYnl0ZXM=" }],
|
||||
mode: "prompt",
|
||||
requestId: "req-image",
|
||||
})) {
|
||||
// Consume stream to completion so prompt logging is finalized.
|
||||
}
|
||||
|
||||
const logs = await readMockRuntimeLogEntries(logPath);
|
||||
const prompt = logs.find(
|
||||
(entry) =>
|
||||
entry.kind === "prompt" &&
|
||||
String(entry.sessionName ?? "") === "agent:codex:acp:with-image",
|
||||
);
|
||||
expect(prompt).toBeDefined();
|
||||
|
||||
const stdinBlocks = JSON.parse(String(prompt?.stdinText ?? ""));
|
||||
expect(stdinBlocks).toEqual([
|
||||
{ type: "text", text: "describe this image" },
|
||||
{ type: "image", mimeType: "image/png", data: "aW1hZ2UtYnl0ZXM=" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("preserves leading spaces across streamed text deltas", async () => {
|
||||
const runtime = sharedFixture?.runtime;
|
||||
expect(runtime).toBeDefined();
|
||||
|
||||
Reference in New Issue
Block a user