@picovoice/eagle-web 0.2.0 → 2.0.0

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,5 +1,5 @@
1
1
  /*
2
- Copyright 2023 Picovoice Inc.
2
+ Copyright 2023-2025 Picovoice Inc.
3
3
 
4
4
  You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
5
5
  file accompanying this source.
@@ -15,11 +15,13 @@ import {
15
15
  EagleModel,
16
16
  EagleProfile,
17
17
  EagleProfilerEnrollResult,
18
+ EagleProfilerOptions,
18
19
  EagleProfilerWorkerEnrollResponse,
19
20
  EagleProfilerWorkerExportResponse,
20
21
  EagleProfilerWorkerInitResponse,
21
22
  EagleProfilerWorkerReleaseResponse,
22
23
  EagleProfilerWorkerResetResponse,
24
+ PvStatus,
23
25
  } from './types';
24
26
  import { loadModel } from '@picovoice/web-utils';
25
27
  import { pvStatusToException } from "./eagle_errors";
@@ -30,9 +32,12 @@ export class EagleProfilerWorker {
30
32
  private readonly _sampleRate: number;
31
33
  private readonly _version: string;
32
34
 
33
- private static _wasm: string;
34
35
  private static _wasmSimd: string;
35
- private static _sdk: string = "web";
36
+ private static _wasmSimdLib: string;
37
+ private static _wasmPThread: string;
38
+ private static _wasmPThreadLib: string;
39
+
40
+ private static _sdk: string = 'web';
36
41
 
37
42
  private constructor(
38
43
  worker: Worker,
@@ -68,22 +73,42 @@ export class EagleProfilerWorker {
68
73
  }
69
74
 
70
75
  /**
71
- * Set base64 wasm file.
72
- * @param wasm Base64'd wasm file to use to initialize wasm.
76
+ * Set base64 wasm file with SIMD feature.
77
+ * @param wasmSimd Base64'd wasm SIMD file to use to initialize wasm.
73
78
  */
74
- public static setWasm(wasm: string): void {
75
- if (this._wasm === undefined) {
76
- this._wasm = wasm;
79
+ public static setWasmSimd(wasmSimd: string): void {
80
+ if (this._wasmSimd === undefined) {
81
+ this._wasmSimd = wasmSimd;
77
82
  }
78
83
  }
79
84
 
80
85
  /**
81
- * Set base64 wasm file with SIMD feature.
82
- * @param wasmSimd Base64'd wasm file to use to initialize wasm.
86
+ * Set base64 wasm file with SIMD feature in text format.
87
+ * @param wasmSimdLib Base64'd wasm SIMD file in text format.
83
88
  */
84
- public static setWasmSimd(wasmSimd: string): void {
85
- if (this._wasmSimd === undefined) {
86
- this._wasmSimd = wasmSimd;
89
+ public static setWasmSimdLib(wasmSimdLib: string): void {
90
+ if (this._wasmSimdLib === undefined) {
91
+ this._wasmSimdLib = wasmSimdLib;
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Set base64 wasm file with SIMD and pthread feature.
97
+ * @param wasmPThread Base64'd wasm file to use to initialize wasm.
98
+ */
99
+ public static setWasmPThread(wasmPThread: string): void {
100
+ if (this._wasmPThread === undefined) {
101
+ this._wasmPThread = wasmPThread;
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Set base64 SIMD and thread wasm file in text format.
107
+ * @param wasmPThreadLib Base64'd wasm file in text format.
108
+ */
109
+ public static setWasmPThreadLib(wasmPThreadLib: string): void {
110
+ if (this._wasmPThreadLib === undefined) {
111
+ this._wasmPThreadLib = wasmPThreadLib;
87
112
  }
88
113
  }
89
114
 
@@ -102,12 +127,19 @@ export class EagleProfilerWorker {
102
127
  * Set to a different name to use multiple models across `eagle` instances.
103
128
  * @param model.forceWrite Flag to overwrite the model in storage even if it exists.
104
129
  * @param model.version Version of the model file. Increment to update the model file in storage.
130
+ * @param options Optional configuration arguments.
131
+ * @param options.device String representation of the device (e.g., CPU or GPU) to use. If set to `best`, the most
132
+ * suitable device is selected automatically. If set to `gpu`, the engine uses the first available GPU device. To select a specific
133
+ * GPU device, set this argument to `gpu:${GPU_INDEX}`, where `${GPU_INDEX}` is the index of the target GPU. If set to
134
+ * `cpu`, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this
135
+ * argument to `cpu:${NUM_THREADS}`, where `${NUM_THREADS}` is the desired number of threads.
105
136
  *
106
137
  * @return An instance of the Eagle Profiler.
107
138
  */
108
139
  public static async create(
109
140
  accessKey: string,
110
- model: EagleModel
141
+ model: EagleModel,
142
+ options: EagleProfilerOptions = {}
111
143
  ): Promise<EagleProfilerWorker> {
112
144
  const customWritePath = model.customWritePath
113
145
  ? model.customWritePath
@@ -135,11 +167,22 @@ export class EagleProfilerWorker {
135
167
  break;
136
168
  case 'failed':
137
169
  case 'error':
138
- reject(pvStatusToException(event.data.status, event.data.shortMessage, event.data.messageStack));
170
+ reject(
171
+ pvStatusToException(
172
+ event.data.status,
173
+ event.data.shortMessage,
174
+ event.data.messageStack
175
+ )
176
+ );
139
177
  break;
140
178
  default:
141
- // @ts-ignore
142
- reject(pvStatusToException(PvStatus.RUNTIME_ERROR, `Unrecognized command: ${event.data.command}`));
179
+ reject(
180
+ pvStatusToException(
181
+ PvStatus.RUNTIME_ERROR,
182
+ // @ts-ignore
183
+ `Unrecognized command: ${event.data.command}`
184
+ )
185
+ );
143
186
  }
144
187
  };
145
188
  }
@@ -149,8 +192,11 @@ export class EagleProfilerWorker {
149
192
  command: 'init',
150
193
  accessKey: accessKey,
151
194
  modelPath: modelPath,
152
- wasm: this._wasm,
195
+ options: options,
153
196
  wasmSimd: this._wasmSimd,
197
+ wasmSimdLib: this._wasmSimdLib,
198
+ wasmPThread: this._wasmPThread,
199
+ wasmPThreadLib: this._wasmPThreadLib,
154
200
  sdk: this._sdk,
155
201
  });
156
202
 
@@ -194,11 +240,22 @@ export class EagleProfilerWorker {
194
240
  break;
195
241
  case 'failed':
196
242
  case 'error':
197
- reject(pvStatusToException(event.data.status, event.data.shortMessage, event.data.messageStack));
243
+ reject(
244
+ pvStatusToException(
245
+ event.data.status,
246
+ event.data.shortMessage,
247
+ event.data.messageStack
248
+ )
249
+ );
198
250
  break;
199
251
  default:
200
- // @ts-ignore
201
- reject(pvStatusToException(PvStatus.RUNTIME_ERROR, `Unrecognized command: ${event.data.command}`));
252
+ reject(
253
+ pvStatusToException(
254
+ PvStatus.RUNTIME_ERROR,
255
+ // @ts-ignore
256
+ `Unrecognized command: ${event.data.command}`
257
+ )
258
+ );
202
259
  }
203
260
  };
204
261
  }
@@ -230,11 +287,22 @@ export class EagleProfilerWorker {
230
287
  break;
231
288
  case 'failed':
232
289
  case 'error':
233
- reject(pvStatusToException(event.data.status, event.data.shortMessage, event.data.messageStack));
290
+ reject(
291
+ pvStatusToException(
292
+ event.data.status,
293
+ event.data.shortMessage,
294
+ event.data.messageStack
295
+ )
296
+ );
234
297
  break;
235
298
  default:
236
- // @ts-ignore
237
- reject(pvStatusToException(PvStatus.RUNTIME_ERROR, `Unrecognized command: ${event.data.command}`));
299
+ reject(
300
+ pvStatusToException(
301
+ PvStatus.RUNTIME_ERROR,
302
+ // @ts-ignore
303
+ `Unrecognized command: ${event.data.command}`
304
+ )
305
+ );
238
306
  }
239
307
  };
240
308
  }
@@ -261,11 +329,22 @@ export class EagleProfilerWorker {
261
329
  break;
262
330
  case 'failed':
263
331
  case 'error':
264
- reject(pvStatusToException(event.data.status, event.data.shortMessage, event.data.messageStack));
332
+ reject(
333
+ pvStatusToException(
334
+ event.data.status,
335
+ event.data.shortMessage,
336
+ event.data.messageStack
337
+ )
338
+ );
265
339
  break;
266
340
  default:
267
- // @ts-ignore
268
- reject(pvStatusToException(PvStatus.RUNTIME_ERROR, `Unrecognized command: ${event.data.command}`));
341
+ reject(
342
+ pvStatusToException(
343
+ PvStatus.RUNTIME_ERROR,
344
+ // @ts-ignore
345
+ `Unrecognized command: ${event.data.command}`
346
+ )
347
+ );
269
348
  }
270
349
  };
271
350
  });
@@ -290,11 +369,22 @@ export class EagleProfilerWorker {
290
369
  break;
291
370
  case 'failed':
292
371
  case 'error':
293
- reject(pvStatusToException(event.data.status, event.data.shortMessage, event.data.messageStack));
372
+ reject(
373
+ pvStatusToException(
374
+ event.data.status,
375
+ event.data.shortMessage,
376
+ event.data.messageStack
377
+ )
378
+ );
294
379
  break;
295
380
  default:
296
- // @ts-ignore
297
- reject(pvStatusToException(PvStatus.RUNTIME_ERROR, `Unrecognized command: ${event.data.command}`));
381
+ reject(
382
+ pvStatusToException(
383
+ PvStatus.RUNTIME_ERROR,
384
+ // @ts-ignore
385
+ `Unrecognized command: ${event.data.command}`
386
+ )
387
+ );
298
388
  }
299
389
  };
300
390
  });
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2023 Picovoice Inc.
2
+ Copyright 2023-2025 Picovoice Inc.
3
3
  You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
4
4
  file accompanying this source.
5
5
  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
@@ -32,10 +32,16 @@ const initRequest = async (
32
32
  };
33
33
  }
34
34
  try {
35
- EagleProfiler.setWasm(request.wasm);
36
35
  EagleProfiler.setWasmSimd(request.wasmSimd);
36
+ EagleProfiler.setWasmSimdLib(request.wasmSimdLib);
37
+ EagleProfiler.setWasmPThread(request.wasmPThread);
38
+ EagleProfiler.setWasmPThreadLib(request.wasmPThreadLib);
37
39
  EagleProfiler.setSdk(request.sdk);
38
- profiler = await EagleProfiler._init(request.accessKey, request.modelPath);
40
+ profiler = await EagleProfiler._init(
41
+ request.accessKey,
42
+ request.modelPath,
43
+ request.options
44
+ );
39
45
  return {
40
46
  command: 'ok',
41
47
  minEnrollSamples: profiler.minEnrollSamples,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2023 Picovoice Inc.
2
+ Copyright 2023-2025 Picovoice Inc.
3
3
 
4
4
  You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
5
5
  file accompanying this source.
@@ -13,11 +13,13 @@ import PvWorker from 'web-worker:./eagle_worker_handler.ts';
13
13
 
14
14
  import {
15
15
  EagleModel,
16
+ EagleOptions,
16
17
  EagleWorkerProcessResponse,
17
18
  EagleWorkerInitResponse,
18
19
  EagleWorkerReleaseResponse,
19
20
  EagleWorkerResetResponse,
20
21
  EagleProfile,
22
+ PvStatus,
21
23
  } from './types';
22
24
  import { loadModel } from '@picovoice/web-utils';
23
25
  import { pvStatusToException } from "./eagle_errors";
@@ -28,9 +30,12 @@ export class EagleWorker {
28
30
  private readonly _sampleRate: number;
29
31
  private readonly _version: string;
30
32
 
31
- private static _wasm: string;
32
33
  private static _wasmSimd: string;
33
- private static _sdk: string = "web";
34
+ private static _wasmSimdLib: string;
35
+ private static _wasmPThread: string;
36
+ private static _wasmPThreadLib: string;
37
+
38
+ private static _sdk: string = 'web';
34
39
 
35
40
  private constructor(
36
41
  worker: Worker,
@@ -66,22 +71,42 @@ export class EagleWorker {
66
71
  }
67
72
 
68
73
  /**
69
- * Set base64 wasm file.
70
- * @param wasm Base64'd wasm file to use to initialize wasm.
74
+ * Set base64 wasm file with SIMD feature.
75
+ * @param wasmSimd Base64'd wasm SIMD file to use to initialize wasm.
71
76
  */
72
- public static setWasm(wasm: string): void {
73
- if (this._wasm === undefined) {
74
- this._wasm = wasm;
77
+ public static setWasmSimd(wasmSimd: string): void {
78
+ if (this._wasmSimd === undefined) {
79
+ this._wasmSimd = wasmSimd;
75
80
  }
76
81
  }
77
82
 
78
83
  /**
79
- * Set base64 wasm file with SIMD feature.
80
- * @param wasmSimd Base64'd wasm file to use to initialize wasm.
84
+ * Set base64 wasm file with SIMD feature in text format.
85
+ * @param wasmSimdLib Base64'd wasm SIMD file in text format.
81
86
  */
82
- public static setWasmSimd(wasmSimd: string): void {
83
- if (this._wasmSimd === undefined) {
84
- this._wasmSimd = wasmSimd;
87
+ public static setWasmSimdLib(wasmSimdLib: string): void {
88
+ if (this._wasmSimdLib === undefined) {
89
+ this._wasmSimdLib = wasmSimdLib;
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Set base64 wasm file with SIMD and pthread feature.
95
+ * @param wasmPThread Base64'd wasm file to use to initialize wasm.
96
+ */
97
+ public static setWasmPThread(wasmPThread: string): void {
98
+ if (this._wasmPThread === undefined) {
99
+ this._wasmPThread = wasmPThread;
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Set base64 SIMD and thread wasm file in text format.
105
+ * @param wasmPThreadLib Base64'd wasm file in text format.
106
+ */
107
+ public static setWasmPThreadLib(wasmPThreadLib: string): void {
108
+ if (this._wasmPThreadLib === undefined) {
109
+ this._wasmPThreadLib = wasmPThreadLib;
85
110
  }
86
111
  }
87
112
 
@@ -101,13 +126,20 @@ export class EagleWorker {
101
126
  * @param model.forceWrite Flag to overwrite the model in storage even if it exists.
102
127
  * @param model.version Version of the model file. Increment to update the model file in storage.
103
128
  * @param speakerProfiles One or more Eagle speaker profiles. These can be constructed using `EagleProfiler`.
129
+ * @param options Optional configuration arguments.
130
+ * @param options.device String representation of the device (e.g., CPU or GPU) to use. If set to `best`, the most
131
+ * suitable device is selected automatically. If set to `gpu`, the engine uses the first available GPU device. To select a specific
132
+ * GPU device, set this argument to `gpu:${GPU_INDEX}`, where `${GPU_INDEX}` is the index of the target GPU. If set to
133
+ * `cpu`, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this
134
+ * argument to `cpu:${NUM_THREADS}`, where `${NUM_THREADS}` is the desired number of threads.
104
135
  *
105
136
  * @return An instance of the Eagle engine.
106
137
  */
107
138
  public static async create(
108
139
  accessKey: string,
109
140
  model: EagleModel,
110
- speakerProfiles: EagleProfile[] | EagleProfile
141
+ speakerProfiles: EagleProfile[] | EagleProfile,
142
+ options: EagleOptions = {}
111
143
  ): Promise<EagleWorker> {
112
144
  const customWritePath = model.customWritePath
113
145
  ? model.customWritePath
@@ -135,11 +167,22 @@ export class EagleWorker {
135
167
  break;
136
168
  case 'failed':
137
169
  case 'error':
138
- reject(pvStatusToException(event.data.status, event.data.shortMessage, event.data.messageStack));
170
+ reject(
171
+ pvStatusToException(
172
+ event.data.status,
173
+ event.data.shortMessage,
174
+ event.data.messageStack
175
+ )
176
+ );
139
177
  break;
140
178
  default:
141
- // @ts-ignore
142
- reject(pvStatusToException(PvStatus.RUNTIME_ERROR, `Unrecognized command: ${event.data.command}`));
179
+ reject(
180
+ pvStatusToException(
181
+ PvStatus.RUNTIME_ERROR,
182
+ // @ts-ignore
183
+ `Unrecognized command: ${event.data.command}`
184
+ )
185
+ );
143
186
  }
144
187
  };
145
188
  }
@@ -152,8 +195,11 @@ export class EagleWorker {
152
195
  speakerProfiles: !Array.isArray(speakerProfiles)
153
196
  ? [speakerProfiles]
154
197
  : speakerProfiles,
155
- wasm: this._wasm,
198
+ options: options,
156
199
  wasmSimd: this._wasmSimd,
200
+ wasmSimdLib: this._wasmSimdLib,
201
+ wasmPThread: this._wasmPThread,
202
+ wasmPThreadLib: this._wasmPThreadLib,
157
203
  sdk: this._sdk,
158
204
  });
159
205
 
@@ -181,11 +227,22 @@ export class EagleWorker {
181
227
  break;
182
228
  case 'failed':
183
229
  case 'error':
184
- reject(pvStatusToException(event.data.status, event.data.shortMessage, event.data.messageStack));
230
+ reject(
231
+ pvStatusToException(
232
+ event.data.status,
233
+ event.data.shortMessage,
234
+ event.data.messageStack
235
+ )
236
+ );
185
237
  break;
186
238
  default:
187
- // @ts-ignore
188
- reject(pvStatusToException(PvStatus.RUNTIME_ERROR, `Unrecognized command: ${event.data.command}`));
239
+ reject(
240
+ pvStatusToException(
241
+ PvStatus.RUNTIME_ERROR,
242
+ // @ts-ignore
243
+ `Unrecognized command: ${event.data.command}`
244
+ )
245
+ );
189
246
  }
190
247
  };
191
248
  });
@@ -213,11 +270,22 @@ export class EagleWorker {
213
270
  break;
214
271
  case 'failed':
215
272
  case 'error':
216
- reject(pvStatusToException(event.data.status, event.data.shortMessage, event.data.messageStack));
273
+ reject(
274
+ pvStatusToException(
275
+ event.data.status,
276
+ event.data.shortMessage,
277
+ event.data.messageStack
278
+ )
279
+ );
217
280
  break;
218
281
  default:
219
- // @ts-ignore
220
- reject(pvStatusToException(PvStatus.RUNTIME_ERROR, `Unrecognized command: ${event.data.command}`));
282
+ reject(
283
+ pvStatusToException(
284
+ PvStatus.RUNTIME_ERROR,
285
+ // @ts-ignore
286
+ `Unrecognized command: ${event.data.command}`
287
+ )
288
+ );
221
289
  }
222
290
  };
223
291
  });
@@ -242,11 +310,22 @@ export class EagleWorker {
242
310
  break;
243
311
  case 'failed':
244
312
  case 'error':
245
- reject(pvStatusToException(event.data.status, event.data.shortMessage, event.data.messageStack));
313
+ reject(
314
+ pvStatusToException(
315
+ event.data.status,
316
+ event.data.shortMessage,
317
+ event.data.messageStack
318
+ )
319
+ );
246
320
  break;
247
321
  default:
248
- // @ts-ignore
249
- reject(pvStatusToException(PvStatus.RUNTIME_ERROR, `Unrecognized command: ${event.data.command}`));
322
+ reject(
323
+ pvStatusToException(
324
+ PvStatus.RUNTIME_ERROR,
325
+ // @ts-ignore
326
+ `Unrecognized command: ${event.data.command}`
327
+ )
328
+ );
250
329
  }
251
330
  };
252
331
  });
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2023 Picovoice Inc.
2
+ Copyright 2023-2025 Picovoice Inc.
3
3
  You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
4
4
  file accompanying this source.
5
5
  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
@@ -30,13 +30,16 @@ const initRequest = async (request: EagleWorkerInitRequest): Promise<any> => {
30
30
  };
31
31
  }
32
32
  try {
33
- Eagle.setWasm(request.wasm);
34
33
  Eagle.setWasmSimd(request.wasmSimd);
34
+ Eagle.setWasmSimdLib(request.wasmSimdLib);
35
+ Eagle.setWasmPThread(request.wasmPThread);
36
+ Eagle.setWasmPThreadLib(request.wasmPThreadLib);
35
37
  Eagle.setSdk(request.sdk);
36
38
  eagle = await Eagle._init(
37
39
  request.accessKey,
38
40
  request.modelPath,
39
- request.speakerProfiles
41
+ request.speakerProfiles,
42
+ request.options
40
43
  );
41
44
  return {
42
45
  command: 'ok',
package/src/index.ts CHANGED
@@ -5,9 +5,11 @@ import * as EagleErrors from './eagle_errors';
5
5
 
6
6
  import {
7
7
  EagleModel,
8
+ EagleOptions,
8
9
  EagleProfile,
9
10
  EagleProfilerEnrollFeedback,
10
11
  EagleProfilerEnrollResult,
12
+ EagleProfilerOptions,
11
13
  EagleProfilerWorkerEnrollRequest,
12
14
  EagleProfilerWorkerEnrollResponse,
13
15
  EagleProfilerWorkerExportRequest,
@@ -34,26 +36,39 @@ import {
34
36
  EagleWorkerResponse,
35
37
  } from './types';
36
38
 
37
- import eagleWasm from '../lib/pv_eagle.wasm';
38
- import eagleWasmSimd from '../lib/pv_eagle_simd.wasm';
39
+ import eagleWasmSimd from './lib/pv_eagle_simd.wasm';
40
+ import eagleWasmSimdLib from './lib/pv_eagle_simd.txt';
41
+ import eagleWasmPThread from './lib/pv_eagle_pthread.wasm';
42
+ import eagleWasmPThreadLib from './lib/pv_eagle_pthread.txt';
39
43
 
40
- Eagle.setWasm(eagleWasm);
41
44
  Eagle.setWasmSimd(eagleWasmSimd);
42
- EagleWorker.setWasm(eagleWasm);
45
+ Eagle.setWasmSimdLib(eagleWasmSimdLib);
46
+ Eagle.setWasmPThread(eagleWasmPThread);
47
+ Eagle.setWasmPThreadLib(eagleWasmPThreadLib);
43
48
  EagleWorker.setWasmSimd(eagleWasmSimd);
44
- EagleProfiler.setWasm(eagleWasm);
49
+ EagleWorker.setWasmSimdLib(eagleWasmSimdLib);
50
+ EagleWorker.setWasmPThread(eagleWasmPThread);
51
+ EagleWorker.setWasmPThreadLib(eagleWasmPThreadLib);
52
+
45
53
  EagleProfiler.setWasmSimd(eagleWasmSimd);
46
- EagleProfilerWorker.setWasm(eagleWasm);
54
+ EagleProfiler.setWasmSimdLib(eagleWasmSimdLib);
55
+ EagleProfiler.setWasmPThread(eagleWasmPThread);
56
+ EagleProfiler.setWasmPThreadLib(eagleWasmPThreadLib);
47
57
  EagleProfilerWorker.setWasmSimd(eagleWasmSimd);
58
+ EagleProfilerWorker.setWasmSimdLib(eagleWasmSimdLib);
59
+ EagleProfilerWorker.setWasmPThread(eagleWasmPThread);
60
+ EagleProfilerWorker.setWasmPThreadLib(eagleWasmPThreadLib);
48
61
 
49
62
  export {
50
63
  Eagle,
51
64
  EagleErrors,
52
65
  EagleModel,
66
+ EagleOptions,
53
67
  EagleProfile,
54
68
  EagleProfiler,
55
69
  EagleProfilerEnrollFeedback,
56
70
  EagleProfilerEnrollResult,
71
+ EagleProfilerOptions,
57
72
  EagleProfilerWorker,
58
73
  EagleProfilerWorkerEnrollRequest,
59
74
  EagleProfilerWorkerEnrollResponse,
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2023 Picovoice Inc.
2
+ Copyright 2023-2025 Picovoice Inc.
3
3
 
4
4
  You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
5
5
  file accompanying this source.
@@ -44,6 +44,16 @@ export type EagleProfile = {
44
44
  bytes: Uint8Array;
45
45
  };
46
46
 
47
+ export type EagleOptions = {
48
+ /** @defaultValue `best` */
49
+ device?: string;
50
+ };
51
+
52
+ export type EagleProfilerOptions = {
53
+ /** @defaultValue `best` */
54
+ device?: string;
55
+ };
56
+
47
57
  export type EagleProfilerEnrollResult = {
48
58
  feedback: EagleProfilerEnrollFeedback;
49
59
  percentage: number;
@@ -53,8 +63,11 @@ export type EagleProfilerWorkerInitRequest = {
53
63
  command: 'init';
54
64
  accessKey: string;
55
65
  modelPath: string;
56
- wasm: string;
66
+ options: EagleProfilerOptions;
57
67
  wasmSimd: string;
68
+ wasmSimdLib: string;
69
+ wasmPThread: string;
70
+ wasmPThreadLib: string;
58
71
  sdk: string;
59
72
  };
60
73
 
@@ -136,8 +149,11 @@ export type EagleWorkerInitRequest = {
136
149
  accessKey: string;
137
150
  modelPath: string;
138
151
  speakerProfiles: EagleProfile[];
139
- wasm: string;
152
+ options: EagleOptions;
140
153
  wasmSimd: string;
154
+ wasmSimdLib: string;
155
+ wasmPThread: string;
156
+ wasmPThreadLib: string;
141
157
  sdk: string;
142
158
  };
143
159
 
package/tsconfig.json CHANGED
@@ -15,8 +15,8 @@
15
15
  "sourceMap": true,
16
16
  "strict": true,
17
17
  "target": "esnext",
18
- "types": ["node"]
18
+ "types": ["node", "emscripten"]
19
19
  },
20
20
  "include": ["src", "module.d.ts"],
21
- "exclude": ["node_modules"]
21
+ "exclude": ["node_modules", "src/lib"]
22
22
  }