react-native-wakeword-sid 1.1.55

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.
Files changed (77) hide show
  1. package/KeyWordRNBridge.podspec +58 -0
  2. package/LICENSE +21 -0
  3. package/README.md +281 -0
  4. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  5. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  6. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  7. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  8. package/android/.gradle/8.9/gc.properties +0 -0
  9. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  10. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  11. package/android/.gradle/vcs-1/gc.properties +0 -0
  12. package/android/build.gradle +48 -0
  13. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar +0 -0
  14. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar.md5 +1 -0
  15. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar.sha1 +1 -0
  16. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.pom +10 -0
  17. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.pom.md5 +1 -0
  18. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.pom.sha1 +1 -0
  19. package/android/settings.gradle +2 -0
  20. package/android/src/main/AndroidManifest.xml +13 -0
  21. package/android/src/main/assets/hey_lookdeep.dm +0 -0
  22. package/android/src/main/assets/layer1.dm +0 -0
  23. package/android/src/main/assets/need_help_now.dm +0 -0
  24. package/android/src/main/java/com/davoice/DaVoiceUnifiedPackage.java +29 -0
  25. package/android/src/main/java/com/davoice/keywordspotting/KeyWordRNBridge.java +335 -0
  26. package/android/src/main/java/com/davoice/speakeridrn/SpeakerIdRNBridge.java_not_used_yet +588 -0
  27. package/android/src/main/libs/MyLibrary-release.aar +0 -0
  28. package/app.plugin.js +60 -0
  29. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/Info.plist +44 -0
  30. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +386 -0
  31. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection.h +18 -0
  32. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Info.plist +0 -0
  33. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/KeyWordDetection +0 -0
  34. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.abi.json +5758 -0
  35. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.private.swiftinterface +159 -0
  36. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  37. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftinterface +159 -0
  38. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/module.modulemap +11 -0
  39. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +768 -0
  40. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection.h +18 -0
  41. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Info.plist +0 -0
  42. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/KeyWordDetection +0 -0
  43. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json +5758 -0
  44. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +159 -0
  45. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  46. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface +159 -0
  47. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json +5758 -0
  48. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +159 -0
  49. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  50. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +159 -0
  51. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/module.modulemap +11 -0
  52. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeDirectory +0 -0
  53. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeRequirements +0 -0
  54. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeRequirements-1 +0 -0
  55. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeResources +297 -0
  56. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeSignature +0 -0
  57. package/ios/KeyWordRNBridge/KeyWordRNBridge.h +19 -0
  58. package/ios/KeyWordRNBridge/KeyWordRNBridge.m +642 -0
  59. package/ios/KeyWordRNBridge/KeyWordRNBridge.mm +416 -0
  60. package/ios/KeyWordRNBridge/models/coca_cola_model_28_05052025.onnx +0 -0
  61. package/ios/KeyWordRNBridge/models/embedding_model.onnx +0 -0
  62. package/ios/KeyWordRNBridge/models/hey_lookdeep.onnx +0 -0
  63. package/ios/KeyWordRNBridge/models/melspectrogram.onnx +0 -0
  64. package/ios/KeyWordRNBridge/models/need_help_now.onnx +0 -0
  65. package/ios/KeyWordRNBridge/models/silero_vad.onnx +0 -0
  66. package/package.json +74 -0
  67. package/react-native.config.js +10 -0
  68. package/wakewords/KeyWordRNBridge.d.ts +38 -0
  69. package/wakewords/KeyWordRNBridge.js +228 -0
  70. package/wakewords/SpeakerVerificationRNBridge.d.ts +32 -0
  71. package/wakewords/SpeakerVerificationRNBridge.js +124 -0
  72. package/wakewords/audioRoutingConfig.d.ts +17 -0
  73. package/wakewords/audioRoutingConfig.ts +28 -0
  74. package/wakewords/index.d.ts +16 -0
  75. package/wakewords/index.js +34 -0
  76. package/wakewords/useModel.d.ts +19 -0
  77. package/wakewords/useModel.tsx +235 -0
@@ -0,0 +1,335 @@
1
+ package com.davoice.keywordspotting;
2
+
3
+ import com.davoice.keywordsdetection.keywordslibrary.KeyWordsDetection;
4
+ import com.facebook.react.bridge.*;
5
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
6
+ import androidx.annotation.Nullable;
7
+ import android.util.Log;
8
+ import java.util.HashMap;
9
+ import java.util.Map;
10
+
11
+ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
12
+
13
+ private final String TAG = "KeyWordsDetection";
14
+ private static final String REACT_CLASS = "KeyWordRNBridge";
15
+ private static ReactApplicationContext reactContext;
16
+
17
+ // VAD API:
18
+ private final Map<String, Float> vadThresholdByInstance = new HashMap<>();
19
+ private final Map<String, Integer> vadMsWindowByInstance = new HashMap<>();
20
+ private static final float DEFAULT_VAD_THRESHOLD = 0.45f;
21
+ private static final int DEFAULT_VAD_MSWINDOW = 1000;
22
+
23
+ // Map to hold multiple instances
24
+ private Map<String, KeyWordsDetection> instances = new HashMap<>();
25
+
26
+ public KeyWordRNBridge(ReactApplicationContext context) {
27
+ super(context);
28
+ reactContext = context;
29
+ }
30
+
31
+ @Override
32
+ public String getName() {
33
+ return REACT_CLASS;
34
+ }
35
+
36
+ @ReactMethod
37
+ public void setKeywordDetectionLicense(String instanceId, String licenseKey, Promise promise) {
38
+ KeyWordsDetection instance = instances.get(instanceId);
39
+ Log.d(TAG, "setKeywordDetectionLicense()");
40
+
41
+ Boolean isLicesed = false;
42
+ if (instance != null) {
43
+ isLicesed = instance.setLicenseKey(licenseKey);
44
+ }
45
+ Log.d(TAG, "setKeywordDetectionLicense(): " + (isLicesed ? "Licensed" : "Not Licensed"));
46
+
47
+ promise.resolve(isLicesed);
48
+ }
49
+
50
+ // Create a new instance efficiently
51
+ @ReactMethod
52
+ public void createInstanceMulti(String instanceId, ReadableArray modelPathsArray, ReadableArray thresholdsArray, ReadableArray bufferCntsArray, ReadableArray msBetweenCallbackArray, Promise promise) {
53
+ if (instances.containsKey(instanceId)) {
54
+ promise.reject("InstanceExists", "Instance already exists with ID: " + instanceId);
55
+ return;
56
+ }
57
+
58
+ try {
59
+ int size = modelPathsArray.size();
60
+ if (thresholdsArray.size() != size || bufferCntsArray.size() != size || msBetweenCallbackArray.size() != size) {
61
+ promise.reject("InvalidArguments", "All input arrays must be the same length.");
62
+ return;
63
+ }
64
+
65
+ // Convert ReadableArrays to Java arrays
66
+ String[] modelPaths = new String[size];
67
+ float[] thresholds = new float[size];
68
+ int[] bufferCnts = new int[size];
69
+ long[] msBetweenCallback = new long[size];
70
+
71
+ for (int i = 0; i < size; i++) {
72
+ modelPaths[i] = modelPathsArray.getString(i);
73
+ thresholds[i] = (float) thresholdsArray.getDouble(i);
74
+ bufferCnts[i] = bufferCntsArray.getInt(i);
75
+ msBetweenCallback[i] = (long) msBetweenCallbackArray.getDouble(i); // RN uses Double for all numbers
76
+ }
77
+
78
+ // Create instance
79
+ KeyWordsDetection keyWordsDetection = new KeyWordsDetection(reactContext, modelPaths, thresholds, bufferCnts, msBetweenCallback);
80
+ keyWordsDetection.initialize((detected, modelName) -> onKeywordDetected(instanceId, detected, modelName));
81
+
82
+ instances.put(instanceId, keyWordsDetection);
83
+ vadThresholdByInstance.put(instanceId, DEFAULT_VAD_THRESHOLD);
84
+ vadMsWindowByInstance.put(instanceId, DEFAULT_VAD_MSWINDOW);
85
+
86
+ promise.resolve("Multi-model instance created with ID: " + instanceId);
87
+
88
+ } catch (Exception e) {
89
+ promise.reject("CreateError", "Failed to create multi-model instance: " + e.getMessage());
90
+ }
91
+ }
92
+
93
+ // Create a new instance
94
+ @ReactMethod
95
+ public void createInstance(String instanceId, String modelName, float threshold, int bufferCnt, Promise promise) {
96
+ if (instances.containsKey(instanceId)) {
97
+ promise.reject("InstanceExists", "Instance already exists with ID: " + instanceId);
98
+ return;
99
+ }
100
+
101
+ try {
102
+ KeyWordsDetection keyWordsDetection = new KeyWordsDetection(reactContext, modelName, threshold, bufferCnt);
103
+ keyWordsDetection.initialize((detected, ignored) -> onKeywordDetected(instanceId, detected, modelName));
104
+ vadThresholdByInstance.put(instanceId, DEFAULT_VAD_THRESHOLD);
105
+ vadMsWindowByInstance.put(instanceId, DEFAULT_VAD_MSWINDOW);
106
+
107
+ instances.put(instanceId, keyWordsDetection);
108
+ promise.resolve("Instance created with ID: " + instanceId);
109
+ } catch (Exception e) {
110
+ promise.reject("CreateError", "Failed to create instance: " + e.getMessage());
111
+ }
112
+ }
113
+
114
+ @ReactMethod
115
+ public void getRecordingWav(String instanceId, Promise promise) {
116
+ KeyWordsDetection instance = instances.get(instanceId);
117
+ String recordingWav = "";
118
+ if (instance == null) {
119
+ promise.reject("Instance not Exists", "Instance does not exists with ID: " + instanceId);
120
+ }
121
+ try {
122
+ recordingWav = instance.getRecordingWav();
123
+ promise.resolve(recordingWav);
124
+ } catch (Exception e) {
125
+ promise.reject("GetRecordingWavError", "Failed to get recording WAV: " + e.getMessage());
126
+ }
127
+ }
128
+
129
+ // Create a new instance
130
+ @ReactMethod
131
+ public void replaceKeywordDetectionModel(String instanceId, String modelName, float threshold, int bufferCnt, Promise promise) {
132
+ KeyWordsDetection instance = instances.get(instanceId);
133
+ if (instance == null) {
134
+ promise.reject("Instance not Exists", "Instance does not exists with ID: " + instanceId);
135
+ return;
136
+ }
137
+
138
+ try {
139
+ instance.replaceKeywordDetectionModel(reactContext, modelName, threshold, bufferCnt);
140
+ promise.resolve("Instance ID: " + instanceId + " change model " + modelName);
141
+ } catch (Exception e) {
142
+ promise.reject("CreateError", "Failed to create instance: " + e.getMessage());
143
+ }
144
+ }
145
+
146
+ // Start detection for a specific instance
147
+ @ReactMethod
148
+ public void startKeywordDetection(String instanceId, float threshold, Promise promise) {
149
+ KeyWordsDetection instance = instances.get(instanceId);
150
+ if (instance != null) {
151
+ instance.startListening(threshold);
152
+ promise.resolve("Started detection for instance: " + instanceId);
153
+ } else {
154
+ promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
155
+ }
156
+ }
157
+
158
+ // Stop detection for a specific instance
159
+ @ReactMethod
160
+ public void stopForegroundService(String instanceId, Promise promise) {
161
+ KeyWordsDetection instance = instances.get(instanceId);
162
+ if (instance != null) {
163
+ instance.stopForegroundService();
164
+ promise.resolve("stopForegroundService" + instanceId);
165
+ } else {
166
+ promise.reject("stopForegroundService", "No instance found with ID: " + instanceId);
167
+ }
168
+ }
169
+
170
+ // Stop detection for a specific instance
171
+ @ReactMethod
172
+ public void startForegroundService(String instanceId, Promise promise) {
173
+ KeyWordsDetection instance = instances.get(instanceId);
174
+ if (instance != null) {
175
+ instance.startForegroundService();
176
+ promise.resolve("startForegroundService" + instanceId);
177
+ } else {
178
+ promise.reject("startForegroundService", "No instance found with ID: " + instanceId);
179
+ }
180
+ }
181
+
182
+ // Stop detection for a specific instance
183
+ @ReactMethod
184
+ public void stopKeywordDetection(String instanceId, Promise promise) {
185
+ KeyWordsDetection instance = instances.get(instanceId);
186
+ if (instance != null) {
187
+ instance.stopListening();
188
+ promise.resolve("Stopped detection for instance: " + instanceId);
189
+ } else {
190
+ promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
191
+ }
192
+ }
193
+
194
+ // Destroy an instance
195
+ @ReactMethod
196
+ public void destroyInstance(String instanceId, Promise promise) {
197
+ KeyWordsDetection instance = instances.remove(instanceId);
198
+ vadThresholdByInstance.remove(instanceId); // NEW
199
+ vadMsWindowByInstance.remove(instanceId); // NEW
200
+ if (instance != null) {
201
+ instance.stopListening();
202
+ // Additional cleanup if necessary
203
+ promise.resolve("Destroyed instance: " + instanceId);
204
+ } else {
205
+ promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
206
+ }
207
+ }
208
+
209
+ // Handle keyword detection event
210
+ private void onKeywordDetected(String instanceId, boolean detected, String modelName) {
211
+ if (detected) {
212
+ WritableMap params = Arguments.createMap();
213
+ params.putString("instanceId", instanceId);
214
+ params.putString("phrase", modelName);
215
+ params.putString("modelName", modelName);
216
+ sendEvent("onKeywordDetectionEvent", params);
217
+ }
218
+ }
219
+
220
+ // Send event to JavaScript
221
+ private void sendEvent(String eventName, @Nullable WritableMap params) {
222
+ reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
223
+ .emit(eventName, params);
224
+ }
225
+
226
+ // VAD API:
227
+
228
+ // ===== Add: VAD parity methods (anywhere among other @ReactMethod methods) =====
229
+ @ReactMethod
230
+ public void getVoiceProps(String instanceId, Promise promise) {
231
+ KeyWordsDetection instance = instances.get(instanceId);
232
+ if (instance == null) {
233
+ promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
234
+ return;
235
+ }
236
+ try {
237
+ @SuppressWarnings("unchecked")
238
+ Map<String, Object> props = instance.getVoiceProps();
239
+ WritableMap out = Arguments.createMap();
240
+
241
+ Object err = props.get("error");
242
+ Object prob = props.get("voiceProbability");
243
+ Object last = props.get("lastTimeHumanVoiceHeard");
244
+
245
+ out.putString("error", err == null ? "" : String.valueOf(err));
246
+ out.putDouble("voiceProbability", prob instanceof Number ? ((Number) prob).doubleValue() : 0.0);
247
+ out.putDouble("lastTimeHumanVoiceHeard", last instanceof Number ? ((Number) last).doubleValue() : 0.0);
248
+
249
+ promise.resolve(out);
250
+ } catch (Exception e) {
251
+ promise.reject("GetVoicePropsError", e.getMessage());
252
+ }
253
+ }
254
+
255
+ @ReactMethod
256
+ public void startVADDetection(String instanceId, Promise promise) {
257
+ KeyWordsDetection instance = instances.get(instanceId);
258
+ if (instance == null) {
259
+ promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
260
+ return;
261
+ }
262
+ try {
263
+ // after: API-21 safe
264
+ Float _thr = vadThresholdByInstance.get(instanceId);
265
+ float thr = (_thr != null) ? _thr : DEFAULT_VAD_THRESHOLD;
266
+ Integer _win = vadMsWindowByInstance.get(instanceId);
267
+ int win = (_win != null) ? _win : DEFAULT_VAD_MSWINDOW;
268
+ instance.setVADParams(thr, win);
269
+ boolean ok = instance.startVADListening();
270
+ promise.resolve(ok);
271
+ } catch (Exception e) {
272
+ promise.reject("StartVADError", e.getMessage());
273
+ }
274
+ }
275
+
276
+ @ReactMethod
277
+ public void stopVADDetection(String instanceId, Promise promise) {
278
+ KeyWordsDetection instance = instances.get(instanceId);
279
+ if (instance == null) {
280
+ promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
281
+ return;
282
+ }
283
+ try {
284
+ instance.stopVADListening();
285
+ promise.resolve("Stopped VAD for instance: " + instanceId);
286
+ } catch (Exception e) {
287
+ promise.reject("StopVADError", e.getMessage());
288
+ }
289
+ }
290
+
291
+ @ReactMethod
292
+ public void setVADParams(String instanceId, double threshold, int msWindow, Promise promise) {
293
+ KeyWordsDetection instance = instances.get(instanceId);
294
+ if (instance == null) {
295
+ promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
296
+ return;
297
+ }
298
+ try {
299
+ float thr = (float) threshold;
300
+ vadThresholdByInstance.put(instanceId, thr);
301
+ vadMsWindowByInstance.put(instanceId, msWindow);
302
+ instance.setVADParams(thr, msWindow);
303
+ promise.resolve(null);
304
+ } catch (Exception e) {
305
+ promise.reject("SetVADParamsError", e.getMessage());
306
+ }
307
+ }
308
+
309
+ @ReactMethod
310
+ public void getVADParams(String instanceId, Promise promise) {
311
+ if (!instances.containsKey(instanceId)) {
312
+ promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
313
+ return;
314
+ }
315
+ WritableMap out = Arguments.createMap();
316
+ Float _thr = vadThresholdByInstance.get(instanceId);
317
+ float thr = (_thr != null) ? _thr : DEFAULT_VAD_THRESHOLD;
318
+ Integer _win = vadMsWindowByInstance.get(instanceId);
319
+ int win = (_win != null) ? _win : DEFAULT_VAD_MSWINDOW;
320
+ out.putDouble("threshold", (double) thr);
321
+ out.putInt("msWindow", win);
322
+ promise.resolve(out);
323
+ }
324
+
325
+ @ReactMethod
326
+ public void addListener(String eventName) {
327
+ // Set up any upstream listeners or background tasks as necessary
328
+ }
329
+
330
+ @ReactMethod
331
+ public void removeListeners(Integer count) {
332
+ // Remove upstream listeners, stop unnecessary background tasks
333
+ }
334
+ // Implement other methods as needed, ensuring to use instanceId
335
+ }