promethios-bridge 1.7.1 → 1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/bridge.js +46 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promethios-bridge",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Run Promethios agent frameworks locally on your computer with full file, terminal, browser access, ambient context capture, and the always-on-top floating chat overlay. Native Framework Mode supports OpenClaw and other frameworks via the bridge.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/bridge.js CHANGED
@@ -30,6 +30,48 @@ const HEARTBEAT_INTERVAL = 30_000; // 30s
30
30
  const POLL_INTERVAL = 1_000; // 1s — poll for pending tool calls
31
31
  const CONTEXT_PUSH_INTERVAL = 5_000; // 5s — push ambient context snapshot
32
32
 
33
+ // ─────────────────────────────────────────────────────────────────────────────
34
+ // Check npm registry for a newer version (non-blocking, best-effort)
35
+ // ─────────────────────────────────────────────────────────────────────────────
36
+ async function checkForUpdates(currentVersion, log) {
37
+ try {
38
+ const res = await fetch('https://registry.npmjs.org/promethios-bridge/latest', {
39
+ headers: { Accept: 'application/json' },
40
+ timeout: 5000,
41
+ });
42
+ if (!res.ok) return;
43
+ const data = await res.json();
44
+ const latestVersion = data.version;
45
+ if (!latestVersion) return;
46
+ // Simple semver comparison: split into [major, minor, patch] and compare
47
+ const toNum = v => v.split('.').map(Number);
48
+ const [cMaj, cMin, cPat] = toNum(currentVersion);
49
+ const [lMaj, lMin, lPat] = toNum(latestVersion);
50
+ const isOutdated =
51
+ lMaj > cMaj ||
52
+ (lMaj === cMaj && lMin > cMin) ||
53
+ (lMaj === cMaj && lMin === cMin && lPat > cPat);
54
+ if (isOutdated) {
55
+ console.log('');
56
+ console.log(chalk.yellow(' ┌─────────────────────────────────────────────────────────┐'));
57
+ console.log(chalk.yellow(' │ 🔄 Update available: v' + currentVersion + ' → v' + latestVersion + ' '.repeat(Math.max(0, 28 - currentVersion.length - latestVersion.length)) + '│'));
58
+ console.log(chalk.yellow(' │ │'));
59
+ console.log(chalk.yellow(' │ To update, close this window and re-run the │'));
60
+ console.log(chalk.yellow(' │ installer script from Promethios, or run: │'));
61
+ console.log(chalk.yellow(' │ │'));
62
+ console.log(chalk.yellow(' │ ' + chalk.white('npx promethios-bridge@latest --token <your-token>') + ' │'));
63
+ console.log(chalk.yellow(' │ │'));
64
+ console.log(chalk.yellow(' │ Your current version will continue to work. │'));
65
+ console.log(chalk.yellow(' └─────────────────────────────────────────────────────────┘'));
66
+ console.log('');
67
+ } else {
68
+ log('Version check: up to date (v' + currentVersion + ')');
69
+ }
70
+ } catch (err) {
71
+ log('Version check failed (non-critical):', err.message);
72
+ }
73
+ }
74
+
33
75
  async function startBridge({ setupToken, apiBase, port, dev }) {
34
76
  const log = dev
35
77
  ? (...args) => console.log(chalk.gray(' [debug]'), ...args)
@@ -165,6 +207,10 @@ async function startBridge({ setupToken, apiBase, port, dev }) {
165
207
  process.exit(1);
166
208
  }
167
209
 
210
+ // ── Step 3b: Check for updates (non-blocking) ───────────────────────────
211
+ const currentVersion = require('../package.json').version;
212
+ checkForUpdates(currentVersion, log).catch(() => {}); // fire-and-forget
213
+
168
214
  // ── Step 4: Show status and keep alive ───────────────────────────────────
169
215
  console.log('');
170
216
  console.log(chalk.bold.green(' ✓ Promethios Local Bridge is running'));