@zerox1/sdk 0.1.24 → 0.1.26

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.d.ts CHANGED
@@ -85,6 +85,9 @@ export declare class Zerox1Agent {
85
85
  * Safe to await — resolves once the agent is live on the mesh.
86
86
  */
87
87
  start(): Promise<void>;
88
+ /** Fetch /version from the aggregator and warn if this SDK is outdated. */
89
+ private _checkVersion;
90
+ private _isNewer;
88
91
  /**
89
92
  * Disconnect from the mesh and stop the node process.
90
93
  */
package/dist/index.js CHANGED
@@ -199,9 +199,37 @@ class Zerox1Agent {
199
199
  });
200
200
  // Wait until the HTTP server is accepting connections.
201
201
  await waitForReady(this.port);
202
+ // Fire-and-forget version check: warn if a newer SDK is available.
203
+ this._checkVersion().catch(() => { });
202
204
  // Open the inbox WebSocket.
203
205
  this._connectInbox();
204
206
  }
207
+ /** Fetch /version from the aggregator and warn if this SDK is outdated. */
208
+ async _checkVersion() {
209
+ const AGGREGATOR = 'https://aggregator.0x01.world';
210
+ const CURRENT = '0.1.23'; // updated by the release workflow
211
+ try {
212
+ const res = await fetch(`${AGGREGATOR}/version`, { signal: AbortSignal.timeout(4000) });
213
+ if (!res.ok)
214
+ return;
215
+ const { sdk } = await res.json();
216
+ if (sdk && sdk !== CURRENT && this._isNewer(sdk, CURRENT)) {
217
+ process.stderr.write(`\n⚠️ [zerox1] SDK update available: ${CURRENT} → ${sdk}\n` +
218
+ ` Run: npm install @zerox1/sdk@latest\n\n`);
219
+ }
220
+ }
221
+ catch { /* network unavailable — silently skip */ }
222
+ }
223
+ _isNewer(latest, current) {
224
+ const parse = (v) => v.split('.').map(Number);
225
+ const [lM, lm, lp] = parse(latest);
226
+ const [cM, cm, cp] = parse(current);
227
+ if (lM !== cM)
228
+ return lM > cM;
229
+ if (lm !== cm)
230
+ return lm > cm;
231
+ return lp > cp;
232
+ }
205
233
  /**
206
234
  * Disconnect from the mesh and stop the node process.
207
235
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerox1/sdk",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "0x01 mesh agent SDK — zero-config, binary bundled, works on every platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,10 +12,10 @@
12
12
  "ws": "^8.18.0"
13
13
  },
14
14
  "optionalDependencies": {
15
- "@zerox1/sdk-darwin-arm64": "0.1.24",
16
- "@zerox1/sdk-darwin-x64": "0.1.24",
17
- "@zerox1/sdk-linux-x64": "0.1.24",
18
- "@zerox1/sdk-win32-x64": "0.1.24"
15
+ "@zerox1/sdk-darwin-arm64": "0.1.26",
16
+ "@zerox1/sdk-darwin-x64": "0.1.26",
17
+ "@zerox1/sdk-linux-x64": "0.1.26",
18
+ "@zerox1/sdk-win32-x64": "0.1.26"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "^22.0.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerox1/sdk-darwin-arm64",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "zerox1-node binary for macOS ARM64 (Apple Silicon)",
5
5
  "os": [
6
6
  "darwin"
Binary file
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerox1/sdk-darwin-x64",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "zerox1-node binary for macOS x64 (Intel)",
5
5
  "os": [
6
6
  "darwin"
Binary file
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerox1/sdk-linux-x64",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "zerox1-node binary for Linux x64",
5
5
  "os": [
6
6
  "linux"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerox1/sdk-win32-x64",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "zerox1-node binary for Windows x64",
5
5
  "os": [
6
6
  "win32"
package/src/index.ts CHANGED
@@ -275,10 +275,38 @@ export class Zerox1Agent {
275
275
  // Wait until the HTTP server is accepting connections.
276
276
  await waitForReady(this.port)
277
277
 
278
+ // Fire-and-forget version check: warn if a newer SDK is available.
279
+ this._checkVersion().catch(() => { /* never block the agent */ })
280
+
278
281
  // Open the inbox WebSocket.
279
282
  this._connectInbox()
280
283
  }
281
284
 
285
+ /** Fetch /version from the aggregator and warn if this SDK is outdated. */
286
+ private async _checkVersion(): Promise<void> {
287
+ const AGGREGATOR = 'https://aggregator.0x01.world'
288
+ const CURRENT = '0.1.23' // updated by the release workflow
289
+ try {
290
+ const res = await fetch(`${AGGREGATOR}/version`, { signal: AbortSignal.timeout(4_000) })
291
+ if (!res.ok) return
292
+ const { sdk } = await res.json() as { sdk: string }
293
+ if (sdk && sdk !== CURRENT && this._isNewer(sdk, CURRENT)) {
294
+ process.stderr.write(
295
+ `\n⚠️ [zerox1] SDK update available: ${CURRENT} → ${sdk}\n` +
296
+ ` Run: npm install @zerox1/sdk@latest\n\n`
297
+ )
298
+ }
299
+ } catch { /* network unavailable — silently skip */ }
300
+ }
301
+
302
+ private _isNewer(latest: string, current: string): boolean {
303
+ const parse = (v: string) => v.split('.').map(Number)
304
+ const [lM, lm, lp] = parse(latest); const [cM, cm, cp] = parse(current)
305
+ if (lM !== cM) return lM > cM
306
+ if (lm !== cm) return lm > cm
307
+ return lp > cp
308
+ }
309
+
282
310
  /**
283
311
  * Disconnect from the mesh and stop the node process.
284
312
  */