billion-context-omp 0.3.0 → 0.3.1
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/dist/index.js +7 -45
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts +0 -8
- package/dist/wire-fold.d.ts +0 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -574,7 +574,7 @@ function truncateLargeToolOutputs(messages, tokenCount, config, countTokens, opt
|
|
|
574
574
|
);
|
|
575
575
|
return { messages: updated, truncatedCount, savedTokens };
|
|
576
576
|
}
|
|
577
|
-
var KEEP_LAST_ORPHANED =
|
|
577
|
+
var KEEP_LAST_ORPHANED = 2;
|
|
578
578
|
function rangeKey(startRef, endRef) {
|
|
579
579
|
return `${startRef}::${endRef}`;
|
|
580
580
|
}
|
|
@@ -3420,22 +3420,6 @@ function toolResultTexts(stream) {
|
|
|
3420
3420
|
}
|
|
3421
3421
|
return results;
|
|
3422
3422
|
}
|
|
3423
|
-
function lastRejectedCompressPair(stream) {
|
|
3424
|
-
for (let i = stream.length - 1; i >= 0; i--) {
|
|
3425
|
-
const m = stream[i];
|
|
3426
|
-
if (m.role !== "toolResult" || m.toolName !== "compress" || !m.toolCallId) continue;
|
|
3427
|
-
if (!extractText(m.content).includes("No changes applied")) continue;
|
|
3428
|
-
for (let j = stream.length - 1; j >= 0; j--) {
|
|
3429
|
-
if (j === i) continue;
|
|
3430
|
-
const c = stream[j];
|
|
3431
|
-
if (c.role !== "assistant") continue;
|
|
3432
|
-
if (!allToolCalls(c.content).some((call) => call.id === m.toolCallId && compressToolArgs(call))) continue;
|
|
3433
|
-
return [stream[j], stream[i]];
|
|
3434
|
-
}
|
|
3435
|
-
return null;
|
|
3436
|
-
}
|
|
3437
|
-
return null;
|
|
3438
|
-
}
|
|
3439
3423
|
function findCompressCalls(message) {
|
|
3440
3424
|
const out = [];
|
|
3441
3425
|
for (const call of allToolCalls(message.content)) {
|
|
@@ -3950,18 +3934,6 @@ function toolResultTextsCore(msgs) {
|
|
|
3950
3934
|
}
|
|
3951
3935
|
return results;
|
|
3952
3936
|
}
|
|
3953
|
-
function lastRejectedPairCore(msgs) {
|
|
3954
|
-
const names = toolCallNames(msgs);
|
|
3955
|
-
for (let i = msgs.length - 1; i >= 0; i--) {
|
|
3956
|
-
const m = msgs[i];
|
|
3957
|
-
if (m.contentType !== "tool-result" || !m.toolCallId) continue;
|
|
3958
|
-
if (!(m.text ?? "").includes("No changes applied")) continue;
|
|
3959
|
-
if (names.get(m.toolCallId) !== "compress") continue;
|
|
3960
|
-
const call = msgs.find((c) => c.contentType === "tool-call" && c.toolCallId === m.toolCallId);
|
|
3961
|
-
return call ? [call, m] : null;
|
|
3962
|
-
}
|
|
3963
|
-
return null;
|
|
3964
|
-
}
|
|
3965
3937
|
function findCompressCallsCore(msg) {
|
|
3966
3938
|
if (msg.contentType !== "tool-call" || !msg.toolName) return [];
|
|
3967
3939
|
const args = compressToolArgs({ name: msg.toolName, arguments: msg.text });
|
|
@@ -5663,7 +5635,7 @@ async function statusReport(runtime, ctx) {
|
|
|
5663
5635
|
const coveredIds = collectCoveredMessageIds(state);
|
|
5664
5636
|
const sentTokens = estimateTokens(coreMessages, coveredIds) + systemPromptTokens;
|
|
5665
5637
|
const turn = runtime.core.processTurn({ messages: coreMessages, state, config, tokenCount: sentTokens });
|
|
5666
|
-
const versionStr = "0.3.
|
|
5638
|
+
const versionStr = "0.3.1" ? `billion-context-omp@${"0.3.1"}` : void 0;
|
|
5667
5639
|
return buildStatusPanel({
|
|
5668
5640
|
version: versionStr,
|
|
5669
5641
|
tokenCount: sessionTokens,
|
|
@@ -5974,7 +5946,7 @@ async function autoInstallLatest(latest, npmDirOverride) {
|
|
|
5974
5946
|
logWarn("update", { event: "install-abort", reason: "npmroot-not-found", extDir });
|
|
5975
5947
|
return "failed";
|
|
5976
5948
|
}
|
|
5977
|
-
const prevVersion = (await readPackageJson(join4(npmDir, "node_modules", PACKAGE_NAME, "package.json")))?.version ?? "0.3.
|
|
5949
|
+
const prevVersion = (await readPackageJson(join4(npmDir, "node_modules", PACKAGE_NAME, "package.json")))?.version ?? "0.3.1";
|
|
5978
5950
|
try {
|
|
5979
5951
|
const keepAlive = setInterval(() => {
|
|
5980
5952
|
}, 500);
|
|
@@ -5986,7 +5958,7 @@ async function autoInstallLatest(latest, npmDirOverride) {
|
|
|
5986
5958
|
}
|
|
5987
5959
|
const verify = await verifyInstall(npmDir, latest);
|
|
5988
5960
|
if (!verify.ok) {
|
|
5989
|
-
const rollbackTo = SEMVER_RE.test(prevVersion) ? prevVersion : "0.3.
|
|
5961
|
+
const rollbackTo = SEMVER_RE.test(prevVersion) ? prevVersion : "0.3.1";
|
|
5990
5962
|
logWarn("update", { event: "auto-install-verify-failed", latest, reason: verify.reason, rollbackTo });
|
|
5991
5963
|
const rb = await runNpm(installArgs(rollbackTo), npmDir);
|
|
5992
5964
|
logInfo("update", { event: "rollback", from: latest, to: rollbackTo, ok: rb.code === 0 });
|
|
@@ -6026,7 +5998,7 @@ async function checkForUpdate(autoUpdate, notify) {
|
|
|
6026
5998
|
const data = await res.json();
|
|
6027
5999
|
const latest = data.version;
|
|
6028
6000
|
if (!latest) return;
|
|
6029
|
-
const current = runtimeVersion ?? "0.3.
|
|
6001
|
+
const current = runtimeVersion ?? "0.3.1";
|
|
6030
6002
|
const hasUpdate = isNewer(latest, current);
|
|
6031
6003
|
debug.event("update-check", {
|
|
6032
6004
|
current,
|
|
@@ -6320,9 +6292,9 @@ function wireSessionLifecycle(pi, runtime) {
|
|
|
6320
6292
|
pi.on("session_start", async (_event, ctx) => {
|
|
6321
6293
|
const sid = ctx.sessionManager.getSessionId();
|
|
6322
6294
|
const modelInfo = ctx.model;
|
|
6323
|
-
logInfo("session", { event: "start", sid, cwd: ctx.cwd, debug: runtime.adapter.debug ?? null, version: true ? "0.3.
|
|
6295
|
+
logInfo("session", { event: "start", sid, cwd: ctx.cwd, debug: runtime.adapter.debug ?? null, version: true ? "0.3.1" : null, model: modelInfo?.id ?? null, modelApi: modelInfo?.api ?? null, contextWindow: modelInfo?.contextWindow ?? null });
|
|
6324
6296
|
const selfPath = import.meta.url;
|
|
6325
|
-
const conflict = stampAndDetect(selfPath, true ? "0.3.
|
|
6297
|
+
const conflict = stampAndDetect(selfPath, true ? "0.3.1" : null);
|
|
6326
6298
|
if (conflict) {
|
|
6327
6299
|
logWarn("instance", { event: "dual-instance", self: selfPath, other: conflict.path, otherPid: conflict.pid, otherVersion: conflict.version });
|
|
6328
6300
|
try {
|
|
@@ -6416,11 +6388,6 @@ async function transformStream(ctx, runtime, input, mode) {
|
|
|
6416
6388
|
activeAfter: turn.state.blocks.filter((b) => b.active).length
|
|
6417
6389
|
});
|
|
6418
6390
|
const rebuilt = coreOutToAgentMessages(turn.messages, originalById);
|
|
6419
|
-
const rejectedPair = lastRejectedCompressPair(input);
|
|
6420
|
-
if (rejectedPair) {
|
|
6421
|
-
rebuilt.push(...rejectedPair);
|
|
6422
|
-
debug.event("rejected-pair-visible", { sid, callId: rejectedPair[1].toolCallId ?? null });
|
|
6423
|
-
}
|
|
6424
6391
|
debug.event("core-out", {
|
|
6425
6392
|
sid,
|
|
6426
6393
|
coreOutMsgs: turn.messages.length,
|
|
@@ -6636,11 +6603,6 @@ async function transformStreamCore(ctx, runtime, wireMsgs, fmt2) {
|
|
|
6636
6603
|
turn.state,
|
|
6637
6604
|
{ config, tokenCount }
|
|
6638
6605
|
);
|
|
6639
|
-
const rejectedPair = lastRejectedPairCore(wireMsgs);
|
|
6640
|
-
if (rejectedPair) {
|
|
6641
|
-
coreOut.push(...rejectedPair);
|
|
6642
|
-
debug.event("rejected-pair-visible", { sid, space: "core", callId: rejectedPair[1]?.toolCallId ?? null });
|
|
6643
|
-
}
|
|
6644
6606
|
let nudgeInjected = false;
|
|
6645
6607
|
if (turn.nudge?.shouldInject) {
|
|
6646
6608
|
const lastUser = [...wireMsgs].reverse().find((m) => m.role === "user");
|