@jskit-ai/assistant-core 0.1.233 → 0.1.234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -130,8 +130,9 @@ export function createConversationStorage({ readRecord, writeRecord, deleteRecor
|
|
|
130
130
|
|
|
131
131
|
// Saved records are shared and never changed in place. A transaction copies
|
|
132
132
|
// the turn map and each turn it changes, then commits that new record.
|
|
133
|
+
// Adapter fields the transaction does not manage are carried unchanged.
|
|
133
134
|
function transaction(saved) {
|
|
134
|
-
const
|
|
135
|
+
const { index: _index, ...draft } = saved;
|
|
135
136
|
const added = new Map();
|
|
136
137
|
let ownTurns = false;
|
|
137
138
|
const owned = new Set();
|
|
@@ -81,6 +81,15 @@ test("message adaptation retains progress, attachments, system actions and SQL m
|
|
|
81
81
|
assert.equal(turns[2].assistant.sql, "select 1");
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
+
test("record storage carries adapter fields it does not manage through writes", async () => {
|
|
85
|
+
let record = { turns: new Map(), metadata: {}, rewound: [{ turnId: "000001" }] };
|
|
86
|
+
const storage = createConversationStorage({ readRecord: () => record, writeRecord: (_scope, next) => { record = next; } });
|
|
87
|
+
await storage.write("conversation", transaction => transaction.appendMessage("000002",
|
|
88
|
+
{ role: "user", at: "2026-10-01T01:00:00.000Z", text: "Hello", messageId: "m1" }));
|
|
89
|
+
assert.deepEqual(record.rewound, [{ turnId: "000001" }]);
|
|
90
|
+
assert.equal(record.turns.get("000002").messages[0].text, "Hello");
|
|
91
|
+
});
|
|
92
|
+
|
|
84
93
|
test("record storage preserves original role, timestamp and message-id overwrite identity", async () => {
|
|
85
94
|
let record = { turns: new Map(), metadata: {} };
|
|
86
95
|
const storage = createConversationStorage({ readRecord: () => record, writeRecord: (_scope, next) => { record = next; } });
|