billion-context-omp 0.1.1 → 0.1.3
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 +43 -19
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts +11 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3003,6 +3003,10 @@ function boundaryRaw(ref, byRef, blocks, pick) {
|
|
|
3003
3003
|
const pos = (id) => rawPos(byRef[id] ?? id);
|
|
3004
3004
|
return pick === "min" ? ids.reduce((a, b) => pos(a) <= pos(b) ? a : b) : ids.reduce((a, b) => pos(a) >= pos(b) ? a : b);
|
|
3005
3005
|
}
|
|
3006
|
+
var VIABLE_RANGE_MIN_TOKENS = 200;
|
|
3007
|
+
function viableRanges(ranges) {
|
|
3008
|
+
return ranges.filter((r) => r.tokens >= VIABLE_RANGE_MIN_TOKENS);
|
|
3009
|
+
}
|
|
3006
3010
|
function rangeFingerprints(ranges, coreMessages, byRef, blocks) {
|
|
3007
3011
|
return ranges.map((r) => {
|
|
3008
3012
|
const start = boundaryRaw(r.startRef, byRef, blocks, "min");
|
|
@@ -3665,7 +3669,7 @@ async function handleStatus(args, runtime, ctx) {
|
|
|
3665
3669
|
});
|
|
3666
3670
|
if (args.scope) return base;
|
|
3667
3671
|
const nudge = turn.nudge;
|
|
3668
|
-
const ranges = nudge?.compressibleRanges ?? [];
|
|
3672
|
+
const ranges = viableRanges(nudge?.compressibleRanges ?? []);
|
|
3669
3673
|
const protectedRanges = nudge?.protectedRanges ?? [];
|
|
3670
3674
|
const extra = [];
|
|
3671
3675
|
if (nudge) {
|
|
@@ -3811,7 +3815,7 @@ async function statusReport(runtime, ctx) {
|
|
|
3811
3815
|
const activeBlocksList = state.blocks.filter((b) => b.active);
|
|
3812
3816
|
const totalBlocksList = state.blocks;
|
|
3813
3817
|
const lines = [];
|
|
3814
|
-
const versionStr = "0.1.
|
|
3818
|
+
const versionStr = "0.1.3" ? `billion-context-omp@${"0.1.3"}` : "";
|
|
3815
3819
|
lines.push("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E");
|
|
3816
3820
|
lines.push("\u2502 ACP Context Analysis \u2502");
|
|
3817
3821
|
lines.push("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F");
|
|
@@ -4244,22 +4248,41 @@ async function findExtensionDir() {
|
|
|
4244
4248
|
}
|
|
4245
4249
|
}
|
|
4246
4250
|
async function autoInstallLatest(latest) {
|
|
4247
|
-
if (!SEMVER_RE.test(latest))
|
|
4251
|
+
if (!SEMVER_RE.test(latest)) {
|
|
4252
|
+
logWarn("update", { event: "install-abort", reason: "semver", latest });
|
|
4253
|
+
return false;
|
|
4254
|
+
}
|
|
4248
4255
|
const extDir = await findExtensionDir();
|
|
4249
|
-
if (!extDir)
|
|
4256
|
+
if (!extDir) {
|
|
4257
|
+
logWarn("update", { event: "install-abort", reason: "extdir-not-found", moduleUrl: import.meta.url });
|
|
4258
|
+
return false;
|
|
4259
|
+
}
|
|
4250
4260
|
const npmDir = findNpmRoot(extDir);
|
|
4251
|
-
if (!npmDir)
|
|
4261
|
+
if (!npmDir) {
|
|
4262
|
+
logWarn("update", { event: "install-abort", reason: "npmroot-not-found", extDir });
|
|
4263
|
+
return false;
|
|
4264
|
+
}
|
|
4252
4265
|
try {
|
|
4253
|
-
const
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4266
|
+
const keepAlive = setInterval(() => {
|
|
4267
|
+
}, 500);
|
|
4268
|
+
try {
|
|
4269
|
+
const code = await new Promise((resolve2) => {
|
|
4270
|
+
execFile(
|
|
4271
|
+
"npm",
|
|
4272
|
+
["install", `${PACKAGE_NAME}@${latest}`, "--silent", "--no-audit", "--no-fund"],
|
|
4273
|
+
{ cwd: npmDir, timeout: 6e4, shell: process.platform === "win32" },
|
|
4274
|
+
(err, _stdout, stderr) => {
|
|
4275
|
+
if (err) logWarn("update", { event: "install-exec-failed", error: err.message, stderr: String(stderr).slice(0, 300) });
|
|
4276
|
+
resolve2(err ? 1 : 0);
|
|
4277
|
+
}
|
|
4278
|
+
);
|
|
4279
|
+
});
|
|
4280
|
+
return code === 0;
|
|
4281
|
+
} finally {
|
|
4282
|
+
clearInterval(keepAlive);
|
|
4283
|
+
}
|
|
4284
|
+
} catch (e) {
|
|
4285
|
+
logWarn("update", { event: "install-throw", error: e instanceof Error ? e.message : String(e) });
|
|
4263
4286
|
return false;
|
|
4264
4287
|
}
|
|
4265
4288
|
}
|
|
@@ -4287,7 +4310,7 @@ async function checkForUpdate(autoUpdate, notify) {
|
|
|
4287
4310
|
const data = await res.json();
|
|
4288
4311
|
const latest = data.version;
|
|
4289
4312
|
if (!latest) return;
|
|
4290
|
-
const current = runtimeVersion ?? "0.1.
|
|
4313
|
+
const current = runtimeVersion ?? "0.1.3";
|
|
4291
4314
|
const hasUpdate = isNewer(latest, current);
|
|
4292
4315
|
debug.event("update-check", {
|
|
4293
4316
|
current,
|
|
@@ -4575,7 +4598,7 @@ function wireCompactionDisable(pi, runtime) {
|
|
|
4575
4598
|
function wireSessionLifecycle(pi, runtime) {
|
|
4576
4599
|
pi.on("session_start", async (_event, ctx) => {
|
|
4577
4600
|
const sid = ctx.sessionManager.getSessionId();
|
|
4578
|
-
logInfo("session", { event: "start", sid, cwd: ctx.cwd, debug: runtime.adapter.debug ?? null, version: true ? "0.1.
|
|
4601
|
+
logInfo("session", { event: "start", sid, cwd: ctx.cwd, debug: runtime.adapter.debug ?? null, version: true ? "0.1.3" : null });
|
|
4579
4602
|
try {
|
|
4580
4603
|
const user = await loadUserConfig(ctx.cwd);
|
|
4581
4604
|
runtime.setAdapter(applyUserConfig(runtime.adapter, user));
|
|
@@ -4590,7 +4613,7 @@ function wireSessionLifecycle(pi, runtime) {
|
|
|
4590
4613
|
runtime.setPrompts(defaultPrompts);
|
|
4591
4614
|
}
|
|
4592
4615
|
runtime.primeFold(ctx);
|
|
4593
|
-
|
|
4616
|
+
await checkForUpdate(runtime.adapter.autoUpdate ?? true, (msg) => {
|
|
4594
4617
|
if (ctx.hasUI) ctx.ui.notify(msg);
|
|
4595
4618
|
});
|
|
4596
4619
|
});
|
|
@@ -4672,6 +4695,7 @@ function wireContextTransform(pi, runtime) {
|
|
|
4672
4695
|
if (turn.nudge?.shouldInject) {
|
|
4673
4696
|
const emergency = turn.nudge.breakdown?.emergencyOverride === 1;
|
|
4674
4697
|
{
|
|
4698
|
+
turn.nudge.compressibleRanges = viableRanges(turn.nudge.compressibleRanges);
|
|
4675
4699
|
const rendered = renderNudgeText(turn.nudge, runtime.prompts);
|
|
4676
4700
|
const top = [...turn.nudge.compressibleRanges].sort((a, b) => b.tokens - a.tokens)[0];
|
|
4677
4701
|
const example = top ? `
|
|
@@ -4693,7 +4717,7 @@ ${rendered.text}${example}`);
|
|
|
4693
4717
|
injected: turn.nudge?.shouldInject ?? false,
|
|
4694
4718
|
emergency: turn.nudge?.breakdown?.emergencyOverride === 1
|
|
4695
4719
|
});
|
|
4696
|
-
|
|
4720
|
+
await checkForUpdate(runtime.adapter.autoUpdate ?? true, (msg) => {
|
|
4697
4721
|
if (ctx.hasUI) ctx.ui.notify(msg);
|
|
4698
4722
|
});
|
|
4699
4723
|
return { messages: rebuilt };
|