offgrid-ai 0.7.1 → 0.7.2

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "offgrid-ai",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Privacy-first CLI for running local LLMs — discover, configure, run, benchmark",
5
5
  "author": "Eeshan Srivastava (https://eeshans.com)",
6
6
  "type": "module",
package/src/cli.mjs CHANGED
@@ -10,7 +10,7 @@ import { uninstallCommand } from "./commands/uninstall.mjs";
10
10
 
11
11
  async function offerUpdate(argv) {
12
12
  const invocation = detectInvocation();
13
- const update = await checkForUpdate({ force: true });
13
+ const update = await checkForUpdate({ force: false });
14
14
  if (!update) return false;
15
15
 
16
16
  const plan = updateCommand(invocation, argv);
@@ -56,7 +56,7 @@ async function printVersion() {
56
56
  const version = currentPackageVersion();
57
57
  console.log(`offgrid-ai v${version}`);
58
58
  const invocation = detectInvocation();
59
- const update = await checkForUpdate({ force: true });
59
+ const update = await checkForUpdate({ force: false });
60
60
  if (update) {
61
61
  const plan = updateCommand(invocation, ["version"]);
62
62
  console.log(pc.yellow(`Update available: v${update.latest}. Run: ${plan.display}`));
package/src/updates.mjs CHANGED
@@ -15,8 +15,15 @@ export async function checkForUpdate({ now = Date.now(), fetchImpl = globalThis.
15
15
  const cacheFile = join(DATA_DIR, "update-cache.json");
16
16
  const cached = await readUpdateCache(cacheFile);
17
17
 
18
- if (!force && cached?.currentVersion === currentVersion && cached?.lastChecked && now - cached.lastChecked < UPDATE_CHECK_INTERVAL) {
19
- return updateResult(currentVersion, cached.latestVersion);
18
+ // Use cache if fresh (within 24h) and still applies to current version
19
+ if (!force && cached?.lastChecked && now - cached.lastChecked < UPDATE_CHECK_INTERVAL) {
20
+ if (cached.currentVersion === currentVersion) {
21
+ return updateResult(currentVersion, cached.latestVersion);
22
+ }
23
+ // Cache is from a different version — if latest isn't newer than current, no update
24
+ if (cached.latestVersion && !isNewerVersion(cached.latestVersion, currentVersion)) {
25
+ return null;
26
+ }
20
27
  }
21
28
 
22
29
  try {