react-native-wakeword-sid 1.1.61 → 1.1.63

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.
@@ -18,7 +18,7 @@
18
18
  </data>
19
19
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
20
20
  <data>
21
- gJXfpUYLrwcB+76wLRAg9qViWWI=
21
+ +6HZB9EfXLINqyxTu/vRzEuoZm8=
22
22
  </data>
23
23
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
24
24
  <data>
@@ -34,11 +34,11 @@
34
34
  </data>
35
35
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
36
36
  <data>
37
- wKE/3G+nppvrddzjewDeOeRSo98=
37
+ 7apWamZSIA9amBY+NyVXhEsMo78=
38
38
  </data>
39
39
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
40
40
  <data>
41
- gJXfpUYLrwcB+76wLRAg9qViWWI=
41
+ +6HZB9EfXLINqyxTu/vRzEuoZm8=
42
42
  </data>
43
43
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
44
44
  <data>
@@ -54,7 +54,7 @@
54
54
  </data>
55
55
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
56
56
  <data>
57
- Ea8Mhh9Mt4a2jrpO3veVJb+PheE=
57
+ /qQYbO/qiBnTLnAMWARDC3x672k=
58
58
  </data>
59
59
  <key>Modules/module.modulemap</key>
60
60
  <data>
@@ -89,11 +89,11 @@
89
89
  <dict>
90
90
  <key>hash</key>
91
91
  <data>
92
- gJXfpUYLrwcB+76wLRAg9qViWWI=
92
+ +6HZB9EfXLINqyxTu/vRzEuoZm8=
93
93
  </data>
94
94
  <key>hash2</key>
95
95
  <data>
96
- HKQPpOXEW/femtFBeFYDDjK+WiSw9KT46gM3IuIwM9k=
96
+ IvmR/gmPm2Zt33gjTXJ4qzChrbe54jhaY7DjX06ixYA=
97
97
  </data>
98
98
  </dict>
99
99
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
@@ -133,22 +133,22 @@
133
133
  <dict>
134
134
  <key>hash</key>
135
135
  <data>
136
- wKE/3G+nppvrddzjewDeOeRSo98=
136
+ 7apWamZSIA9amBY+NyVXhEsMo78=
137
137
  </data>
138
138
  <key>hash2</key>
139
139
  <data>
140
- 0mHM4W3SUdmqsfErJx1bWCx0RRD+SyEGn1XPzU7KJ9U=
140
+ AFhTo5TwiWyRwRUHoqGld/dEUEjDvsKDwklB+g9x31s=
141
141
  </data>
142
142
  </dict>
143
143
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
144
144
  <dict>
145
145
  <key>hash</key>
146
146
  <data>
147
- gJXfpUYLrwcB+76wLRAg9qViWWI=
147
+ +6HZB9EfXLINqyxTu/vRzEuoZm8=
148
148
  </data>
149
149
  <key>hash2</key>
150
150
  <data>
151
- HKQPpOXEW/femtFBeFYDDjK+WiSw9KT46gM3IuIwM9k=
151
+ IvmR/gmPm2Zt33gjTXJ4qzChrbe54jhaY7DjX06ixYA=
152
152
  </data>
153
153
  </dict>
154
154
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
@@ -188,11 +188,11 @@
188
188
  <dict>
189
189
  <key>hash</key>
190
190
  <data>
191
- Ea8Mhh9Mt4a2jrpO3veVJb+PheE=
191
+ /qQYbO/qiBnTLnAMWARDC3x672k=
192
192
  </data>
193
193
  <key>hash2</key>
194
194
  <data>
195
- YPjaTjLsn/37Hrt6z6kijE4hfsQUktyWGL1+zbVyvx0=
195
+ ETS+GAaO5qg275IYzJItyEBo7dO56btjxlxVE4bzF5U=
196
196
  </data>
197
197
  </dict>
198
198
  <key>Modules/module.modulemap</key>
@@ -215,12 +215,101 @@ static Class SVFacadeClass(void) {
215
215
  return NSClassFromString(@"SpeakerVerificationRNFacade");
216
216
  }
217
217
 
218
+ // ============================================================
219
+ // MARK: - Speaker Verification Mic Config JSON resolver (modelPath)
220
+ // ============================================================
221
+
222
+ // Resolve "modelPath" inside mic controller config JSON (bundle name -> absolute file path)
223
+ // so Swift/ORT always receives a real filesystem path.
224
+ static NSString * _Nullable SVResolveMicConfigJson(NSString *configJson, NSError **error) {
225
+ if (!configJson || configJson.length == 0) {
226
+ NSLog(@"[SV][ObjC] SVResolveMicConfigJson: empty configJson");
227
+ return configJson;
228
+ }
229
+
230
+ NSData *data = [configJson dataUsingEncoding:NSUTF8StringEncoding];
231
+ if (!data) {
232
+ NSLog(@"[SV][ObjC] SVResolveMicConfigJson: failed to make NSData from JSON string (passing through)");
233
+ return configJson;
234
+ }
235
+
236
+ NSError *jsonErr = nil;
237
+ id obj = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonErr];
238
+ if (jsonErr || ![obj isKindOfClass:[NSDictionary class]]) {
239
+ NSLog(@"[SV][ObjC] SVResolveMicConfigJson: JSON parse failed (passing through). err=%@ json=%@", jsonErr, configJson);
240
+ return configJson;
241
+ }
242
+
243
+ NSMutableDictionary *cfg = [(NSDictionary *)obj mutableCopy];
244
+ id mp = cfg[@"modelPath"];
245
+ if (![mp isKindOfClass:[NSString class]] || ((NSString *)mp).length == 0) {
246
+ NSLog(@"[SV][ObjC] SVResolveMicConfigJson: missing/invalid modelPath (passing through). keys=%@", cfg.allKeys);
247
+ return configJson;
248
+ }
249
+
250
+ NSString *modelPathIn = (NSString *)mp;
251
+ NSLog(@"[SV][ObjC] SVResolveMicConfigJson: modelPath(in)='%@'", modelPathIn);
252
+
253
+ // If already absolute and exists: keep
254
+ if ([modelPathIn hasPrefix:@"/"] && [[NSFileManager defaultManager] fileExistsAtPath:modelPathIn]) {
255
+ NSLog(@"[SV][ObjC] SVResolveMicConfigJson: modelPath absolute & exists ✅");
256
+ return configJson;
257
+ }
258
+
259
+ // Resolve using the SAME logic as createSpeakerVerifier
260
+ NSString *resolved = SVResolveFilePath(modelPathIn);
261
+ if (!resolved) {
262
+ NSArray<NSString *> *onnx = [[NSBundle mainBundle] pathsForResourcesOfType:@"onnx" inDirectory:nil];
263
+ NSLog(@"[SV][ObjC] SVResolveMicConfigJson: ❌ cannot resolve modelPath='%@' in bundle. onnxCount=%lu sample=%@",
264
+ modelPathIn, (unsigned long)onnx.count, onnx.count ? onnx.firstObject : @"(none)");
265
+ if (error) {
266
+ *error = [NSError errorWithDomain:@"SV" code:420 userInfo:@{
267
+ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Mic config model not found in app bundle: %@", modelPathIn]
268
+ }];
269
+ }
270
+ return nil;
271
+ }
272
+
273
+ NSString *stable = SVCopyToTempIfNeeded(resolved, [modelPathIn lastPathComponent]) ?: resolved;
274
+ cfg[@"modelPath"] = stable;
275
+
276
+ NSData *outData = [NSJSONSerialization dataWithJSONObject:cfg options:0 error:&jsonErr];
277
+ if (jsonErr || !outData) {
278
+ NSLog(@"[SV][ObjC] SVResolveMicConfigJson: re-encode failed (passing original). err=%@", jsonErr);
279
+ return configJson;
280
+ }
281
+
282
+ NSString *outJson = [[NSString alloc] initWithData:outData encoding:NSUTF8StringEncoding];
283
+ NSLog(@"[SV][ObjC] SVResolveMicConfigJson: modelPath(resolved)='%@'", stable);
284
+ NSLog(@"[SV][ObjC] SVResolveMicConfigJson: json(out)=%@", outJson);
285
+ return outJson;
286
+ }
287
+
218
288
 
219
289
  // =========================
220
290
  // MARK: - Mic controller dynamic bridge
221
291
  // =========================
222
292
 
223
293
  static id _Nullable SVCreateMicController(NSString *configJson, NSError **error) {
294
+ NSLog(@"[SV][ObjC] SVCreateMicController: in.jsonLen=%lu json=%@",
295
+ (unsigned long)(configJson ? configJson.length : 0),
296
+ configJson ?: @"(null)");
297
+
298
+ // Resolve modelPath inside JSON BEFORE calling Swift
299
+ NSError *resolveErr = nil;
300
+ NSString *fixedJson = SVResolveMicConfigJson(configJson, &resolveErr);
301
+ if (resolveErr || !fixedJson) {
302
+ if (error) *error = resolveErr;
303
+ NSLog(@"[SV][ObjC] SVCreateMicController: ❌ SVResolveMicConfigJson failed: %@", resolveErr.localizedDescription);
304
+ return nil;
305
+ }
306
+ if (![fixedJson isEqualToString:configJson]) {
307
+ NSLog(@"[SV][ObjC] SVCreateMicController: using RESOLVED jsonLen=%lu", (unsigned long)fixedJson.length);
308
+ } else {
309
+ NSLog(@"[SV][ObjC] SVCreateMicController: json unchanged (no modelPath fix needed)");
310
+ }
311
+
312
+
224
313
  Class c = SVFacadeClass();
225
314
  if (!c) {
226
315
  if (error) *error = [NSError errorWithDomain:@"SV" code:10 userInfo:@{NSLocalizedDescriptionKey: @"Swift class SpeakerVerificationRNFacade not found"}];
@@ -232,7 +321,13 @@ static id _Nullable SVCreateMicController(NSString *configJson, NSError **error)
232
321
  return nil;
233
322
  }
234
323
  id (*msgSend)(id, SEL, NSString*, NSError**) = (void*)objc_msgSend;
235
- return msgSend(c, sel, configJson, error);
324
+ id out = msgSend(c, sel, fixedJson, error);
325
+ if (*error) {
326
+ NSLog(@"[SV][ObjC] SVCreateMicController: ❌ Swift createMicController failed: %@", (*error).localizedDescription);
327
+ } else {
328
+ NSLog(@"[SV][ObjC] SVCreateMicController: ✅ created controller=%@", out);
329
+ }
330
+ return out;
236
331
  }
237
332
 
238
333
  static BOOL SVCallBool2(id obj, SEL sel, NSString *s1, NSInteger i1, BOOL b1, NSError **error) {
@@ -438,6 +533,11 @@ RCT_EXPORT_METHOD(createSpeakerVerificationMicController:(NSString *)controllerI
438
533
  resolver:(RCTPromiseResolveBlock)resolve
439
534
  rejecter:(RCTPromiseRejectBlock)reject)
440
535
  {
536
+ NSLog(@"[SV][ObjC] createSpeakerVerificationMicController: controllerId=%@ jsonLen=%lu json=%@",
537
+ controllerId,
538
+ (unsigned long)(configJson ? configJson.length : 0),
539
+ configJson ?: @"(null)");
540
+
441
541
  if (self.speakerMicControllers[controllerId]) {
442
542
  reject(@"SVMicExists", [NSString stringWithFormat:@"Speaker mic controller already exists with ID: %@", controllerId], nil);
443
543
  return;
@@ -448,11 +548,15 @@ RCT_EXPORT_METHOD(createSpeakerVerificationMicController:(NSString *)controllerI
448
548
  NSError *err = nil;
449
549
  id ctrl = SVCreateMicController(configJson, &err);
450
550
  if (err || !ctrl) {
551
+ NSLog(@"[SV][ObjC] createSpeakerVerificationMicController: ❌ FAILED err=%@", err.localizedDescription ?: @"(null)");
552
+
451
553
  reject(@"SVMicCreateError",
452
554
  [NSString stringWithFormat:@"Failed to create mic controller: %@", err.localizedDescription ?: @"unknown"],
453
555
  err);
454
556
  return;
455
557
  }
558
+ NSLog(@"[SV][ObjC] createSpeakerVerificationMicController: ✅ ctrl=%@", ctrl);
559
+
456
560
 
457
561
  // Create delegate proxy that will forward Swift callbacks -> RN events
458
562
  SVMicDelegateProxy *proxy = [SVMicDelegateProxy new];
@@ -461,12 +565,15 @@ RCT_EXPORT_METHOD(createSpeakerVerificationMicController:(NSString *)controllerI
461
565
 
462
566
  // Set delegate dynamically (no header needed)
463
567
  SVSetDelegate(ctrl, proxy);
568
+ NSLog(@"[SV][ObjC] createSpeakerVerificationMicController: delegate set proxy=%@", proxy);
464
569
 
465
570
  SVMicHolder *h = [SVMicHolder new];
466
571
  h.controllerId = controllerId;
467
572
  h.controller = ctrl;
468
573
  h.delegateProxy = proxy; // keep strong ref
469
574
  self.speakerMicControllers[controllerId] = h;
575
+ NSLog(@"[SV][ObjC] createSpeakerVerificationMicController: stored holder. count=%lu",
576
+ (unsigned long)self.speakerMicControllers.count);
470
577
 
471
578
  resolve(@{ @"ok": @YES, @"controllerId": controllerId });
472
579
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wakeword-sid",
3
- "version": "1.1.61",
3
+ "version": "1.1.63",
4
4
  "description": "Voice/Wake-word detection library for React Native",
5
5
  "main": "wakewords/index.js",
6
6
  "types": "wakewords/index.d.ts",