Commit 838d057
Shubham rag fix (#441)
* Added Lora + Fixed Build-All-Work-Flow (#389)
* feat(lora): add LoRA adapter support across SDK + demo app
Implement LoRA (Low-Rank Adaptation) adapter hot-swapping for llama.cpp
backend across all 6 SDK layers (C++ -> C API -> Component -> JNI ->
Kotlin Bridge -> Kotlin Public API).
- Add load/remove/clear/query LoRA adapter operations
- Use vtable dispatch in component layer to decouple librac_commons
from librac_backend_llamacpp (fixes linker errors)
- Add LoRA vtable entries to rac_llm_service_ops_t
- Fix AttachCurrentThread cast for Android NDK C++ JNI build
- Add RunAnyWhereLora Android demo app with Material 3 Q&A UI
- Add comprehensive implementation docs with C/C++ API reference
* feat(ci): add selectable build targets to Build All workflow + fix Swift concurrency errors
Rewrite build-all-test.yml with 9 boolean checkbox inputs so each build
target can be toggled independently from the GitHub Actions UI:
- C++ Android Backends (arm64-v8a, armeabi-v7a, x86_64 matrix)
- C++ iOS Backends (XCFramework)
- Kotlin SDK (JVM + Android)
- Swift SDK (iOS/macOS)
- Web SDK (TypeScript)
- Flutter SDK (Dart analyze via Melos)
- React Native SDK (TypeScript via Lerna)
- Android Example Apps (RunAnywhereAI + RunAnyWhereLora)
- IntelliJ Plugin
Fix two Swift strict-concurrency errors that fail the Swift SDK build:
- LiveTranscriptionSession: add @unchecked Sendable (safe because class
is @mainactor, all access serialized)
- RunAnywhere+VisionLanguage: add Sendable conformance to rac_vlm_image_t
so the C struct can cross the Task boundary in the streaming builder;
simplify StreamingCollector to start timing at init
* fix(swift): resolve strict concurrency errors in LiveTranscriptionSession and VLM streaming
LiveTranscriptionSession.swift:
- Replace [weak self] captures with strong `let session = self` before
closures to avoid captured var in @Sendable/@task contexts (class is
@mainactor @unchecked Sendable so strong ref is safe, bounded by
stream lifecycle)
- Wrap deprecated startStreamingTranscription call in @available helper
to silence deprecation warning until migration to transcribeStream API
RunAnywhere+VisionLanguage.swift:
- Add `let capturedCImage = cImage` before AsyncThrowingStream closure
so the Task captures an immutable let instead of a mutable var
- Add `extension rac_vlm_image_t: @unchecked Sendable {}` for the C
struct to cross Task concurrency boundaries safely
- Simplify StreamingCollector to initialize startTime at init instead
of requiring a separate async start() call
* fix(jni): address CodeRabbit review findings in LoRA JNI functions
- Replace raw -1 returns with RAC_ERROR_INVALID_HANDLE/RAC_ERROR_INVALID_ARGUMENT
to match codebase error handling conventions
- Use getCString() helper instead of raw GetStringUTFChars/ReleaseStringUTFChars
- Add missing result logging to racLlmComponentRemoveLora and racLlmComponentClearLora
- Use rac_free() instead of free() in racLlmComponentGetLoraInfo for consistency
- Clarify LoRA adapter memory ownership comments (adapters freed automatically
with model per llama.cpp b8011 API — llama_adapter_lora_free is deprecated)
* Add lora ios (#407)
* ios initial changes
* minimal sample needed to test lora
* updating docs
* addressed the comments
* Prototype for Optimised RAG
First version for Optimised RAG. Not polished yet, Once tested, I'll microoptimise, bench, and finish.
* Aligning / upstream update for dev (#442)
* chore: add AGENTS.md with Cursor Cloud specific instructions
* chore: update AGENTS.md with Linux backend build and voice assistant instructions
* minor fixes
* fix: Android app UI improvements, SDK concurrency bug fixes, and LoRA download support
Android App:
- Redesign intro screen with minimal layout and linear progress bar
- Improve VLM screen: use shared ModelRequiredOverlay, theme-consistent colors,
fix button clipping (replace IconButton with clickable Column)
- Fix keyboard handling: hide bottom bar when keyboard open, apply imePadding correctly
- Add scrollable auto-scroll prompt suggestions in ChatScreen
- Add shimmer typing indicator with "Thinking..." label
- Fix 9 app-level bugs: think tag leak, CancellationException handling,
VoiceAssistant lifecycle, ConversationStore ANR, TTS sample rate parsing,
LoRA download mutex deadlock
KMP SDK (10 bug fixes):
- Fix cancel() deadlock: move JNI calls outside synchronized(lock) in CppBridgeLLM
- Fix orphaned CoroutineScope leak in generateStream using callbackFlow
- Fix initializeServices() holding lock across network I/O
- Fix loraDownloadDir lazy val caching wrong path before pathProvider set
- Fix setBaseDirCallback TOCTOU race condition
- Add @volatile to DownloadTask mutable fields for thread visibility
- Fix unescapeJson() replacement order (process \\\\ before \\n)
- Add downloadLock for atomic cancel/pause/resume operations
- Fix checkNativeLibrary() to actually call native method
- Add ensureServicesReady() to generateStream
- Add LoRA adapter download/delete/path SDK functions
Known issue: Tool-calling may show unexpected behavior when a LoRA adapter is
applied — the model detects the tool call but responds with "I can assist with
this" instead of executing it. Tested with Qwen 2.5 0.5B. This only occurs
when the model has a LoRA adapter loaded.
* fix(tts): scan WAV data chunk instead of hardcoding 44-byte header offset
WAV files with extra chunks (LIST, fact, bext) had metadata bytes fed
into AudioTrack as PCM, causing distorted playback. Now walks the chunk
structure to find the actual "data" chunk start.
* fix: Android app UI bug fixes, responsive dimensions, LoRA example prompts, and darker dark mode
- Fix nested verticalScroll inside LazyColumn (ThinkingToggle) causing broken scroll
- Fix weight(1f) + verticalScroll overflow in VLMScreen DescriptionPanel
- Add verticalScroll to MoreHubScreen to prevent clipping on small screens
- Add imePadding to ConversationListSheet so keyboard doesn't cover search
- Fix auto-scroll wrap logic in EmptyStateView using canScrollForward
- Replace collectAsState with collectAsStateWithLifecycle in 3 screens
- Replace deprecated STTMode.values() with .entries
- Replace hardcoded Color.Gray with AppColors.statusGray for dark mode contrast
- Remove redundant Color.White inside buttons with contentColor set
- Replace hardcoded 300.dp bubble width with responsive Dimensions.messageBubbleMaxWidth
- Add accessibility semantics role to VLMScreen clickable Column
- Disable Image Generation card (placeholder feature)
- Add responsive rDp/rSp utilities and convert Dimensions/AppSpacing to use them
- Add LoRA example prompts with copy button to adapter picker and manager screens
- Darken dark mode background colors
* fix: Android app bug fixes - race conditions, ANR, pixel corruption, scroll, and memory safety
- VoiceAssistantViewModel: replace runBlocking with GlobalScope.launch in onCleared to prevent ANR
- VoiceAssistantViewModel: add synchronized audioBufferLock for thread-safe ByteArrayOutputStream access
- VoiceAssistantViewModel: scan WAV data chunk instead of hardcoding 44-byte header offset
- ConversationStore: use MutableStateFlow.update {} for atomic compare-and-set on all mutations
- ToolSettingsViewModel: clear static singleton in onCleared to prevent stale references
- VLMViewModel: advance rgbIdx by 3 in else branch to prevent pixel corruption on out-of-bounds skip
- ChatViewModel: use CopyOnWriteArrayList for tokensPerSecondHistory thread safety
- VoiceAssistantParticleView: remove wasted transparent drawPoints call
- RunAnywhereApplication: capture volatile initializationError to local val before null check
- VLMScreen: add verticalScroll to description panel for long text overflow
- ResponsiveUtils: add designWidth <= 0 guard to prevent division by zero in rDp/rSp
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Sanchit Monga <sanchitmonga22@gmail.com>
Co-authored-by: Sanchit Monga <sm3468@g.rit.edu>
Co-authored-by: Siddhesh2377 <siddheshsonar2377@gmail.com>
Co-authored-by: RunAnywhere <>
* RAG rewrite
* Refactor RAG terminology to "pipeline" across scripts and source files for consistency. Update comments and logging messages to reflect the change from "backend" to "pipeline". Remove unused React Native package files related to RAG.
* Complete RAG Flutter implementation (full state) (#419)
RAG Flutter SDK.
->there are a bunch of UI/UX issues with this like button not loading, the round spinny download thing not being proper etc, but the rag pipeline works.
-> also onnx and rag when built together were giving duplicate symbol errors as rag requires onnx, so a future task that should be done soon is to include onnx in core as well, and perhaps add a conditional?
* Optimised RAG + implement a hybrid search
* fixed tnc block error.
* Changed batching parametres, similarity threshold, and optimised embedding memory+speed output
* fix(rag): close anonymous namespace in rag_chunker.cpp to fix compilation
The anonymous namespace wrapping perform_recursive_chunking was never
closed, causing DocumentChunker member definitions to be inside the
anonymous namespace — resulting in "cannot define or redeclare" errors.
Made-with: Cursor
* fix: remove stale runanywhere-core-rag module references from Android app
RAG was moved into the core SDK but the Android example app still
referenced the deleted module, breaking the build.
* fixing ios/swift - remvoing ragbackend - refactor
* finxing the tts for platform in voice agent
* lora fixes - to match up with kotlin
* refactor: fold RAG backend into rac_commons, remove separate RAG binary
- Changed rac_backend_rag from SHARED/STATIC to OBJECT library (CMake)
- RAG objects folded into rac_commons at compile time
- Moved ONNX embedding provider to rac_backend_onnx to break shared-lib cycle
- ONNX backend now registers embeddings provider during rac_backend_onnx_register()
- Removed RAG as separate backend from all build scripts and SDK configs
- Updated Android, Kotlin, Flutter, React Native build/distribution pipelines
- RAG JNI bridge (librac_backend_rag_jni.so) remains as thin wrapper linking rac_commons
* fixing rn for rag +some permissions for vlm + npm dependencies + archive logic improved
* refactor for react - tts is causing trouble - refactoring that now - will follow with flutter once done
---------
Co-authored-by: Siddhesh <DARKWILDHACKER@gmail.com>
Co-authored-by: Sanchit Monga <sanchitmonga22@gmail.com>
Co-authored-by: VyasGuru <71374747+VyasGuru@users.noreply.github.com>
Co-authored-by: Sanchit Monga <sm3468@g.rit.edu>
Co-authored-by: Siddhesh2377 <siddheshsonar2377@gmail.com>1 parent 99216a5 commit 838d057
228 files changed
Lines changed: 10609 additions & 17501 deletions
File tree
- examples
- android/RunAnywhereAI
- app
- flutter/RunAnywhereAI
- lib
- app
- features
- chat
- models
- rag
- ios/RunAnywhereAI
- RunAnywhereAI.xcodeproj
- RunAnywhereAI/Features/Chat
- Models
- ViewModels
- Views
- react-native/RunAnywhereAI
- ios
- RunAnywhereAI.xcodeproj
- RunAnywhereAI
- src
- components/model
- screens
- types
- sdk
- runanywhere-commons
- include/rac
- backends
- features
- embeddings
- llm
- rag
- scripts
- src
- backends
- llamacpp
- onnx
- rag
- features
- embeddings
- llm
- rag
- jni
- voice_agent
- tests
- runanywhere-flutter
- packages/runanywhere
- android
- ios
- Classes
- lib
- core/types
- infrastructure
- download
- events
- native
- type_conversions
- public
- events
- extensions
- types
- scripts
- runanywhere-kotlin
- modules/runanywhere-core-rag
- src
- commonMain/kotlin/com/runanywhere/sdk/rag
- jvmAndroidMain/kotlin/com/runanywhere/sdk/rag
- scripts
- src/jvmAndroidMain/kotlin/com/runanywhere/sdk
- public/extensions
- rag
- runanywhere-react-native
- packages
- core
- android
- cpp
- bridges
- ios
- src
- Public
- Extensions
- services
- specs
- types
- llamacpp
- cpp/bridges
- src
- onnx
- src
- rag
- android
- src/main
- cpp
- java/com/margelo/nitro/runanywhere/rag
- cpp
- example
- ios
- Headers
- Libraries
- rac_backend_onnx.xcframework
- rac_backend_rag.xcframework
- nitrogen/generated
- android
- c++
- kotlin/com/margelo/nitro/runanywhere/rag
- ios
- c++
- swift
- scripts
- src
- specs
- scripts
- runanywhere-swift
- Sources
- RAGRuntime
- include
- RunAnywhere
- CRACommons
- include
- Features/TTS/System
- Foundation/Bridge/Extensions
- Infrastructure/Download/Utilities
- Public/Extensions/RAG
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 46 | | |
53 | 47 | | |
54 | 48 | | |
| |||
87 | 81 | | |
88 | 82 | | |
89 | 83 | | |
90 | | - | |
| 84 | + | |
91 | 85 | | |
92 | 86 | | |
93 | 87 | | |
| |||
152 | 146 | | |
153 | 147 | | |
154 | 148 | | |
155 | | - | |
| 149 | + | |
156 | 150 | | |
157 | 151 | | |
158 | 152 | | |
| |||
231 | 225 | | |
232 | 226 | | |
233 | 227 | | |
234 | | - | |
| 228 | + | |
235 | 229 | | |
236 | 230 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | 231 | | |
291 | 232 | | |
292 | 233 | | |
| |||
314 | 255 | | |
315 | 256 | | |
316 | 257 | | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | 258 | | |
322 | 259 | | |
323 | 260 | | |
| |||
369 | 306 | | |
370 | 307 | | |
371 | 308 | | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | 309 | | |
384 | 310 | | |
385 | 311 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 56 | + | |
| 57 | + | |
Lines changed: 54 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | | - | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
| 143 | + | |
145 | 144 | | |
146 | | - | |
147 | | - | |
148 | 145 | | |
149 | 146 | | |
150 | 147 | | |
| |||
190 | 187 | | |
191 | 188 | | |
192 | 189 | | |
193 | | - | |
194 | | - | |
195 | 190 | | |
196 | 191 | | |
197 | 192 | | |
| |||
206 | 201 | | |
207 | 202 | | |
208 | 203 | | |
209 | | - | |
210 | | - | |
211 | | - | |
| 204 | + | |
212 | 205 | | |
213 | 206 | | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 207 | + | |
219 | 208 | | |
220 | 209 | | |
221 | 210 | | |
| |||
229 | 218 | | |
230 | 219 | | |
231 | 220 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | 221 | | |
246 | 222 | | |
| 223 | + | |
247 | 224 | | |
248 | | - | |
| 225 | + | |
249 | 226 | | |
250 | 227 | | |
251 | | - | |
252 | | - | |
| 228 | + | |
| 229 | + | |
253 | 230 | | |
254 | 231 | | |
255 | 232 | | |
256 | | - | |
| 233 | + | |
| 234 | + | |
257 | 235 | | |
258 | 236 | | |
259 | | - | |
260 | | - | |
| 237 | + | |
| 238 | + | |
261 | 239 | | |
262 | 240 | | |
263 | 241 | | |
264 | 242 | | |
265 | 243 | | |
266 | | - | |
| 244 | + | |
267 | 245 | | |
268 | 246 | | |
269 | | - | |
270 | | - | |
| 247 | + | |
| 248 | + | |
271 | 249 | | |
272 | 250 | | |
273 | 251 | | |
274 | | - | |
| 252 | + | |
| 253 | + | |
275 | 254 | | |
276 | 255 | | |
277 | | - | |
278 | | - | |
| 256 | + | |
| 257 | + | |
279 | 258 | | |
280 | 259 | | |
281 | 260 | | |
282 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
283 | 296 | | |
284 | 297 | | |
285 | 298 | | |
| |||
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
454 | 455 | | |
455 | 456 | | |
456 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
457 | 469 | | |
458 | 470 | | |
459 | 471 | | |
| |||
947 | 959 | | |
948 | 960 | | |
949 | 961 | | |
950 | | - | |
| 962 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
| |||
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
510 | | - | |
511 | | - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
512 | 519 | | |
513 | 520 | | |
514 | 521 | | |
| |||
0 commit comments