@ariacompute/engine-rn 1.19.1 → 1.20.0

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": "@ariacompute/engine-rn",
3
- "version": "1.19.1",
3
+ "version": "1.20.0",
4
4
  "description": "React Native binding for Aria Engine",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Native surface — native module bridges to libaria_ffi (Turbo Module / JSI).
2
+ * React Native surface — native module bridges to libaria-engine_ffi (Turbo Module / JSI).
3
3
  * JS API mirrors @ariacompute/engine-ts for docs samples.
4
4
  *
5
5
  * Auto-download: `AriaEngine.open(modelRef, { token, site })` resolves a model
@@ -272,9 +272,9 @@ const SDK_UA = 'aria-engine-sdk/0.1.0';
272
272
  const zlib = require('zlib');
273
273
 
274
274
  function ffiLibName(platform = process.platform) {
275
- if (platform === 'win32' || String(platform).toLowerCase().startsWith('win')) return 'aria_ffi.dll';
276
- if (platform === 'darwin') return 'libaria_ffi.dylib';
277
- return 'libaria_ffi.so';
275
+ if (platform === 'win32' || String(platform).toLowerCase().startsWith('win')) return 'aria-engine_ffi.dll';
276
+ if (platform === 'darwin') return 'libaria-engine_ffi.dylib';
277
+ return 'libaria-engine_ffi.so';
278
278
  }
279
279
 
280
280
  function libDir() {
@@ -298,7 +298,7 @@ function ffiAssetOs(platform = process.platform, arch = process.arch) {
298
298
  if ((p === 'win32' || p.startsWith('win')) && (a === 'x64' || a === 'x86_64' || a === 'amd64')) {
299
299
  return 'windows_x86_64';
300
300
  }
301
- throw new Error(`unsupported platform ${platform}/${arch} for libaria_ffi`);
301
+ throw new Error(`unsupported platform ${platform}/${arch} for libaria-engine_ffi`);
302
302
  }
303
303
 
304
304
  function stripV(tag) {
@@ -329,7 +329,7 @@ function selectLatestStable(releases) {
329
329
  bestTag = tag;
330
330
  }
331
331
  }
332
- if (!bestTag) throw new Error('no stable release found for libaria_ffi');
332
+ if (!bestTag) throw new Error('no stable release found for libaria-engine_ffi');
333
333
  return stripV(bestTag);
334
334
  }
335
335
 
@@ -399,7 +399,7 @@ async function ensureFfiLib(site) {
399
399
  const releases = JSON.parse(raw.toString('utf8'));
400
400
  if (!Array.isArray(releases)) throw new Error('unexpected releases payload');
401
401
  const ver = selectLatestStable(releases);
402
- const assetName = `libaria_ffi_${ver}_${ffiAssetOs()}.tar.gz`;
402
+ const assetName = `libaria-engine_ffi_${ver}_${ffiAssetOs()}.tar.gz`;
403
403
  let url;
404
404
  for (const rel of releases) {
405
405
  const tag = String(rel.tag_name || rel.tag || '');
@@ -479,7 +479,7 @@ export class AriaEngine {
479
479
  success: true,
480
480
  response: '',
481
481
  function_calls: [],
482
- note: 'Link native module to libaria_ffi',
482
+ note: 'Link native module to libaria-engine_ffi',
483
483
  };
484
484
  }
485
485
 
package/src/setup.js CHANGED
@@ -7,8 +7,13 @@ const CN_UPGRADE = 'https://gitee.com/ariacompute';
7
7
 
8
8
  function defaultSetupConfig() {
9
9
  return {
10
+ // Local (router registration)
10
11
  router: '',
11
12
  router_api_key: '',
13
+ // OAuth (Aria Compute)
14
+ serve_site: '',
15
+ serve_api_key: '',
16
+ // Hub / compute
12
17
  site_url: '',
13
18
  upgrade_url: '',
14
19
  compute: 'auto',
@@ -38,6 +43,27 @@ function fillSetupUrls(cfg) {
38
43
  return out;
39
44
  }
40
45
 
46
+ function validateRouterApiKey(key) {
47
+ const t = (key || '').trim();
48
+ if (!t) return;
49
+ if (t.startsWith('bfvk-')) {
50
+ throw new Error(
51
+ 'OAuth key detected (bfvk-); use serve_api_key / [2/2] OAuth (Aria Compute)',
52
+ );
53
+ }
54
+ }
55
+
56
+ function validateServeApiKey(key) {
57
+ const t = (key || '').trim();
58
+ if (!t) return;
59
+ if (t.startsWith('sk-aria_')) {
60
+ throw new Error('Local router key detected (sk-aria_); use router_api_key / [1/2] Local');
61
+ }
62
+ if (!t.startsWith('bfvk-')) {
63
+ throw new Error('serve_api_key must start with bfvk-');
64
+ }
65
+ }
66
+
41
67
  function applySetup(existing, updates) {
42
68
  const out = { ...existing };
43
69
  for (const [k, v] of Object.entries(updates || {})) {
@@ -47,6 +73,8 @@ function applySetup(existing, updates) {
47
73
  if (!['auto', 'cpu', 'cuda'].includes(out.compute)) {
48
74
  throw new Error(`invalid compute: ${out.compute}`);
49
75
  }
76
+ validateRouterApiKey(out.router_api_key);
77
+ validateServeApiKey(out.serve_api_key);
50
78
  return fillSetupUrls(out);
51
79
  }
52
80