@dr33m/react-native-litert-lm 0.6.0 → 0.6.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.
@@ -55,11 +55,14 @@ extension HybridLiteRTLM {
55
55
  )
56
56
  let ptr = Unmanaged.passRetained(ctx).toOpaque()
57
57
 
58
- let cb: LiteRtLmStreamCallback = { ptr, chunk, isFinal, errorMsg in
59
- guard let ptr = ptr else { return }
58
+ // v0.15: the callback receives an opaque LiteRtLmStreamChunk; text,
59
+ // finality, and errors are read through accessors. The chunk (and any
60
+ // string it returns) is only valid for the duration of the call.
61
+ let cb: LiteRtLmStreamCallback = { ptr, chunk in
62
+ guard let ptr = ptr, let chunk = chunk else { return }
60
63
  let ctx = Unmanaged<ExecuteStreamContext>.fromOpaque(ptr).takeUnretainedValue()
61
64
 
62
- if let errorMsg = errorMsg {
65
+ if let errorMsg = litert_lm_stream_chunk_get_error(chunk) {
63
66
  let msg = String(cString: errorMsg)
64
67
  ctx.onToken("Error: \(msg)", true)
65
68
  ctx.cleanup()
@@ -69,13 +72,13 @@ extension HybridLiteRTLM {
69
72
  return
70
73
  }
71
74
 
72
- if isFinal {
75
+ if litert_lm_stream_chunk_is_final(chunk) {
73
76
  ctx.parent.finalizeExecuteStream(ctx: ctx, streamPtr: ptr)
74
77
  return
75
78
  }
76
79
 
77
- if let chunk = chunk {
78
- ctx.parent.emitExecuteStreamChunk(ctx: ctx, chunk: chunk)
80
+ if let text = litert_lm_stream_chunk_get_text(chunk) {
81
+ ctx.parent.emitExecuteStreamChunk(ctx: ctx, chunk: text)
79
82
  }
80
83
  }
81
84
 
@@ -239,7 +239,9 @@ public class HybridLiteRTLM: HybridLiteRTLMSpec_base, HybridLiteRTLMSpec_protoco
239
239
  var rawEngine: OpaquePointer? = nil
240
240
 
241
241
  // Set LiteRT C Log Level to WARNING (2) for clean production output
242
- litert_lm_set_min_log_level(2)
242
+ // v0.15: takes a typed LiteRtLmLogSeverity (previously a raw int,
243
+ // where 2 was INFO — WARNING is the intended level).
244
+ litert_lm_set_min_log_level(kLiteRtLmLogSeverityWarning)
243
245
 
244
246
  // Creation helper with scoped FFI pointer lifetime
245
247
  let createEngine = { (main: String, vision: String?, audio: String?) -> OpaquePointer? in
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dr33m/react-native-litert-lm",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "litertLm": {
5
- "version": "0.12.0",
6
- "androidMavenVersion": "0.12.0",
7
- "iosGitTag": "v0.12.0"
5
+ "version": "0.15.0",
6
+ "androidMavenVersion": "0.15.0",
7
+ "iosGitTag": "v0.15.0"
8
8
  },
9
9
  "description": "High-performance LLM inference for React Native using LiteRT-LM. Optimized for Gemma 4 and other on-device language models.",
10
10
  "license": "MIT",
@@ -37,6 +37,10 @@ Pod::Spec.new do |s|
37
37
  '"$(PODS_TARGET_SRCROOT)/nitrogen/generated/ios"',
38
38
  ].join(' '),
39
39
  'OTHER_LDFLAGS' => '$(inherited) -ObjC',
40
+ # CLiteRTLM.xcframework has no x86_64 simulator slice (ARM-only policy);
41
+ # without this, generic simulator builds compile both archs and the
42
+ # CLiteRTLM module resolves for neither.
43
+ 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'x86_64',
40
44
  }
41
45
 
42
46
  # Load nitrogen autolinking