feat(gateway): make chat turns durable and idempotent

This commit is contained in:
sam committed 2026-08-09 01:15:41 +10:00
1 parent 80f9d92e51
commit b876fc80cc
16 files changed
+2183 -188

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { newChatTurn, retryChatTurn } from "../src/chat/chat-retry.js";
test("retry preserves the logical turn identity and text", () => {
const turn = newChatTurn("keep this message");
const retry = retryChatTurn(turn);
assert.notEqual(turn.sourceID, undefined);
assert.deepEqual(retry, turn);
});
test("new turns receive distinct identities", () => {
const first = newChatTurn("same text");
const second = newChatTurn("same text");
assert.notEqual(first.sourceID, second.sourceID);
});