billion-context 0.1.9 → 0.1.10

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 CHANGED
@@ -3277,15 +3277,18 @@ async function checkForUpdate(opts, force = false) {
3277
3277
  if (!opts.autoUpdate && !force) return;
3278
3278
  if (inFlight) return;
3279
3279
  inFlight = true;
3280
+ const firstInProcess = !notified.has("__first_check_done__");
3280
3281
  try {
3281
3282
  const now = Date.now();
3282
3283
  const lastCheck = await readLastCheck();
3283
- if (!force && now - lastCheck < CHECK_INTERVAL_MS) {
3284
- log("info", `[update] check skipped (throttled, ${(CHECK_INTERVAL_MS - (now - lastCheck)) / 1e3 | 0}s until next)`);
3284
+ const sinceLastSec = lastCheck ? (now - lastCheck) / 1e3 | 0 : -1;
3285
+ if (!force && !firstInProcess && now - lastCheck < CHECK_INTERVAL_MS) {
3286
+ const retryIn = (CHECK_INTERVAL_MS - (now - lastCheck)) / 1e3 | 0;
3287
+ log("info", `[update] throttled \u2014 last checked ${sinceLastSec}s ago, retry in ${retryIn}s`);
3285
3288
  return;
3286
3289
  }
3287
3290
  await writeLastCheck(now);
3288
- log("info", `[update] checking npm registry for ${opts.packageName}\u2026`);
3291
+ log("info", `[update] checking npm registry for ${opts.packageName}${firstInProcess ? " (startup check)" : sinceLastSec < 0 ? "" : ` (last check ${sinceLastSec}s ago)`}\u2026`);
3289
3292
  const url = `${REGISTRY_BASE}/${opts.packageName}/latest`;
3290
3293
  const res = await fetch(url, {
3291
3294
  signal: AbortSignal.timeout(5e3),
@@ -3321,6 +3324,7 @@ async function checkForUpdate(opts, force = false) {
3321
3324
  log("warn", `[update] check failed: ${String(e)}`);
3322
3325
  } finally {
3323
3326
  inFlight = false;
3327
+ notified.add("__first_check_done__");
3324
3328
  }
3325
3329
  }
3326
3330
  async function installLatest(packageName, latest) {