mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-24 18:19:05 +02:00
Keep large response artifacts inspectable through the existing authenticated API route. Preserve company and run authority, UTF-8 boundaries, and transfer limits. Reproduce the artifact loop through real HTTP and add an explicit full-stack fixture. Co-Authored-By: Paperclip <noreply@paperclip.ing>
20 lines
1.3 KiB
TypeScript
20 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { apiResponseReadingTask, responseEvidenceCode, responseEvidenceDescription, successfulApiReadCount } from "./api-response-reading.js";
|
|
|
|
describe("large API response evidence fixture", () => {
|
|
it("keeps evidence beyond both preview and inline limits and out of the assignment", () => {
|
|
const source = responseEvidenceDescription("fixture");
|
|
const code = responseEvidenceCode("fixture");
|
|
expect(Buffer.byteLength(source)).toBeGreaterThan(24 * 1024);
|
|
expect(source.indexOf(code)).toBeGreaterThan(24 * 1024);
|
|
expect(apiResponseReadingTask.buildPrompt("fixture")).not.toContain(code);
|
|
expect(apiResponseReadingTask.buildPrompt("fixture")).toContain("responseText.nextOffsetBytes");
|
|
});
|
|
it("counts only real completed API tool events, never narrative claims or missing evidence", () => {
|
|
const event = { eventType: "tool.execution.completed", payload: { prpEvent: { payload: { name: "call_api", status: "completed" } } } };
|
|
expect(successfulApiReadCount([event])).toBe(1);
|
|
expect(successfulApiReadCount([])).toBe(0);
|
|
expect(successfulApiReadCount([{ ...event, eventType: "item.delta" }, { ...event, payload: null }, { ...event, payload: { prpEvent: { payload: { name: "call_api", status: "failed" } } } }])).toBe(0);
|
|
});
|
|
});
|