Fix browser file operations and persist visible save times

Preserve JSON Content-Type when custom idempotency headers are supplied. Expose the latest accepted folder operation timestamp so browser saves remain visible before an agent runs and after all files are deleted.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-09-07 13:31:59 -05:00
1 parent 23407236b4
commit b4c3bf6961
8 files changed
+46 -6

No files matched your search

+12
View File
@@ -57,6 +57,18 @@ describe("durable work folders", () => {
expect(await textContent(f, "memory.md")).toBe("second");
await expect(svc.write(f, { ...first, body: Buffer.from("different") })).rejects.toMatchObject({ status: 409 });
});
it("retains the last accepted save time after all files are removed", async () => {
const f = await folder();
expect((await svc.list(f)).lastSavedAt).toBeNull();
await svc.write(f, { path: "note", body: Buffer.from("saved"), operationId: "write" });
const saved = (await svc.list(f)).lastSavedAt;
expect(saved).toEqual(expect.any(String));
await svc.remove(f, "note", "delete");
const listing = await svc.list(f);
expect(listing.files).toEqual([]);
expect(Date.parse(listing.lastSavedAt!)).toBeGreaterThanOrEqual(Date.parse(saved!));
expect((await svc.list(f, { trash: true })).lastSavedAt).toBe(listing.lastSavedAt);
});
it("retains a deleted copy after the same path is recreated", async () => {
const f = await folder();
await svc.write(f, { path: "note", body: Buffer.from("deleted"), operationId: "one" });