@jskit-ai/assistant-core 0.1.235 → 0.1.236
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
|
@@ -442,13 +442,19 @@ export function createConversationRuntime({ engine: defaultEngine = "api", defau
|
|
|
442
442
|
: Math.max(0, initialWindow - (request?.input.origin === "user" ? 1 : 0)),
|
|
443
443
|
maximumInitialMessageCharacters: limits.maxInitialNativeHistoryMessageCharacters,
|
|
444
444
|
...(budget ? { maximumHistoryBytes: async options => {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
445
|
+
try {
|
|
446
|
+
await access(context, entry.id, request.operation, entry);
|
|
447
|
+
signal.throwIfAborted();
|
|
448
|
+
// A host may free native context first; show that as compacting.
|
|
449
|
+
const bytes = await budget({ ...options, context, signal,
|
|
450
|
+
setPhase: phase => setPhase(entry, phase === "compacting" ? "compacting" : "preparing") });
|
|
451
|
+
signal.throwIfAborted();
|
|
452
|
+
return bytes;
|
|
453
|
+
} catch (error) {
|
|
454
|
+
// Sizing missed history precedes native dispatch, so this message
|
|
455
|
+
// was definitely not sent. Hosts and clients report it as such.
|
|
456
|
+
throw Object.assign(error, { delivery: "not-sent" });
|
|
457
|
+
}
|
|
452
458
|
} } : {}),
|
|
453
459
|
presentation: entry.conversation?.presentation || { unconfirmedCode: "conversation_delivery_uncertain",
|
|
454
460
|
unconfirmedMessage: "The previous submission has uncertain delivery. Retry this message to check its native receipt; it will not be resent automatically." },
|
package/test/claudeTurn.test.js
CHANGED
|
@@ -2361,7 +2361,8 @@ test("bound Main cannot dispatch or retain a pending prompt when its history bud
|
|
|
2361
2361
|
f.binding.transcript.history = async () => [{ id: "earlier", version: "v1", role: "user", text: "Earlier work." }];
|
|
2362
2362
|
await f.binding.state.write({ lastEngine: "codex", engines: { codex: { seen: {} } } });
|
|
2363
2363
|
f.binding.maximumHistoryBytes = async () => { throw new Error("Current native context usage unavailable"); };
|
|
2364
|
-
await assert.rejects(f.conversation.send({ messageId: "no-budget", text: "Continue" }),
|
|
2364
|
+
await assert.rejects(f.conversation.send({ messageId: "no-budget", text: "Continue" }), error =>
|
|
2365
|
+
/Current native context usage unavailable/u.test(error.message) && error.delivery === "not-sent");
|
|
2365
2366
|
assert.equal(f.processes.length, 0);
|
|
2366
2367
|
assert.equal(f.messages.length, 0);
|
|
2367
2368
|
assert.equal((await f.binding.state.read())?.engines?.claude?.pending, undefined);
|