acp: add regression coverage and smoke-test docs

This commit is contained in:
Mariano Belinky
2026-03-09 21:32:55 +01:00
committed by mbelinky
parent 4aebff78bc
commit d06138ac3d
3 changed files with 86 additions and 0 deletions

View File

@@ -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();