@runanywhere/llamacpp 0.16.1 → 0.16.4

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.
@@ -1,3 +1,39 @@
1
+ // =============================================================================
2
+ // Node Binary Detection for Android Studio Compatibility
3
+ // Android Studio doesn't inherit terminal PATH, so we need to find node explicitly
4
+ // =============================================================================
5
+ def findNodeBinary() {
6
+ // Check local.properties first (user can override)
7
+ def localProperties = new Properties()
8
+ def localPropertiesFile = rootProject.file("local.properties")
9
+ if (localPropertiesFile.exists()) {
10
+ localPropertiesFile.withInputStream { localProperties.load(it) }
11
+ def nodePath = localProperties.getProperty("node.path")
12
+ if (nodePath && new File(nodePath).exists()) {
13
+ return nodePath
14
+ }
15
+ }
16
+
17
+ // Check common node installation paths
18
+ def homeDir = System.getProperty("user.home")
19
+ def nodePaths = [
20
+ "/opt/homebrew/bin/node", // macOS ARM (Apple Silicon)
21
+ "/usr/local/bin/node", // macOS Intel / Linux
22
+ "/usr/bin/node", // Linux system
23
+ "${homeDir}/.nvm/current/bin/node", // nvm
24
+ "${homeDir}/.volta/bin/node", // volta
25
+ "${homeDir}/.asdf/shims/node" // asdf
26
+ ]
27
+ for (path in nodePaths) {
28
+ if (new File(path).exists()) {
29
+ return path
30
+ }
31
+ }
32
+
33
+ // Fallback to 'node' (works if PATH is set correctly in terminal builds)
34
+ return "node"
35
+ }
36
+
1
37
  def getExtOrDefault(name) {
2
38
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RunAnywhereLlama_' + name]
3
39
  }
@@ -12,6 +48,11 @@ apply plugin: 'kotlin-android'
12
48
  apply from: '../nitrogen/generated/android/runanywherellama+autolinking.gradle'
13
49
  apply plugin: 'com.facebook.react'
14
50
 
51
+ // Configure node path for Android Studio builds
52
+ react {
53
+ nodeExecutableAndArgs = [findNodeBinary()]
54
+ }
55
+
15
56
  def getExtOrIntegerDefault(name) {
16
57
  if (rootProject.ext.has(name)) {
17
58
  return rootProject.ext.get(name)
@@ -149,6 +190,14 @@ task downloadNativeLibs {
149
190
  return
150
191
  }
151
192
 
193
+ // Check if libs are already bundled (npm install case)
194
+ def bundledLibsDir = file("${jniLibsDir}/arm64-v8a")
195
+ def bundledLibs = bundledLibsDir.exists() ? bundledLibsDir.listFiles()?.findAll { it.name.endsWith(".so") } : []
196
+ if (bundledLibs?.size() > 0) {
197
+ logger.lifecycle("[RunAnywhereLlama] ✅ Using bundled native libraries from npm package (${bundledLibs.size()} .so files)")
198
+ return
199
+ }
200
+
152
201
  def currentVersion = versionFile.exists() ? versionFile.text.trim() : ""
153
202
  if (currentVersion == expectedVersion) {
154
203
  logger.lifecycle("[RunAnywhereLlama] RABackendLlamaCPP version $expectedVersion already downloaded")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runanywhere/llamacpp",
3
- "version": "0.16.1",
3
+ "version": "0.16.4",
4
4
  "description": "LlamaCpp backend for RunAnywhere React Native SDK - GGUF model support for on-device LLM",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",