@jskit-ai/assistant-core 0.1.231 → 0.1.232
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
|
@@ -418,7 +418,9 @@ export function createConversationRuntime({ engine: defaultEngine = "api", defau
|
|
|
418
418
|
...(budget ? { maximumHistoryBytes: async options => {
|
|
419
419
|
await access(context, entry.id, request.operation, entry);
|
|
420
420
|
signal.throwIfAborted();
|
|
421
|
-
|
|
421
|
+
// A host may free native context first; show that as compacting.
|
|
422
|
+
const bytes = await budget({ ...options, context, signal,
|
|
423
|
+
setPhase: phase => setPhase(entry, phase === "compacting" ? "compacting" : "preparing") });
|
|
422
424
|
signal.throwIfAborted();
|
|
423
425
|
return bytes;
|
|
424
426
|
} } : {}),
|
package/test/claudeTurn.test.js
CHANGED
|
@@ -2298,8 +2298,14 @@ test("bound Main history budget transfers more than 30 complete messages through
|
|
|
2298
2298
|
f.binding.transcript.history = async () => history;
|
|
2299
2299
|
await f.binding.state.write({ lastEngine: "codex", engines: { codex: { seen: {} } } });
|
|
2300
2300
|
let reads = 0;
|
|
2301
|
-
|
|
2301
|
+
const phases = [];
|
|
2302
|
+
const canonical = await f.runtime.open({ id: "lesson", context: f.toolContext });
|
|
2303
|
+
f.binding.maximumHistoryBytes = async ({ engineId, returning, context, signal, input, setPhase }) => {
|
|
2302
2304
|
reads++;
|
|
2305
|
+
await setPhase("compacting");
|
|
2306
|
+
phases.push((await canonical.read()).phase);
|
|
2307
|
+
await setPhase("preparing");
|
|
2308
|
+
phases.push((await canonical.read()).phase);
|
|
2303
2309
|
assert.equal(engineId, "claude");
|
|
2304
2310
|
assert.equal(returning, false);
|
|
2305
2311
|
assert.equal(context.actor.id, "owner");
|
|
@@ -2314,6 +2320,7 @@ test("bound Main history budget transfers more than 30 complete messages through
|
|
|
2314
2320
|
};
|
|
2315
2321
|
await sendCommon(f, "full-history");
|
|
2316
2322
|
assert.equal(reads, 1);
|
|
2323
|
+
assert.deepEqual(phases, ["compacting", "preparing"], "a host freeing native context reports it as compacting");
|
|
2317
2324
|
assert.ok(sent[0].length > 128_000);
|
|
2318
2325
|
for (const message of history) assert.ok(sent[0].includes(JSON.stringify(message.text)), message.id);
|
|
2319
2326
|
await f.frame({ type: "result", subtype: "success", result: "Received." });
|