@picovoice/eagle-web 2.0.0 → 3.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.
package/src/types.ts CHANGED
@@ -1,218 +1,224 @@
1
- /*
2
- Copyright 2023-2025 Picovoice Inc.
3
-
4
- You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
5
- file accompanying this source.
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
8
- an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
9
- specific language governing permissions and limitations under the License.
10
- */
11
-
12
- import { PvModel } from '@picovoice/web-utils';
13
-
14
- export enum PvStatus {
15
- SUCCESS = 10000,
16
- OUT_OF_MEMORY,
17
- IO_ERROR,
18
- INVALID_ARGUMENT,
19
- STOP_ITERATION,
20
- KEY_ERROR,
21
- INVALID_STATE,
22
- RUNTIME_ERROR,
23
- ACTIVATION_ERROR,
24
- ACTIVATION_LIMIT_REACHED,
25
- ACTIVATION_THROTTLED,
26
- ACTIVATION_REFUSED,
27
- }
28
-
29
- /**
30
- * EagleModel types
31
- */
32
- export type EagleModel = PvModel;
33
-
34
- export enum EagleProfilerEnrollFeedback {
35
- AUDIO_OK = 0,
36
- AUDIO_TOO_SHORT,
37
- UNKNOWN_SPEAKER,
38
- NO_VOICE_FOUND,
39
- QUALITY_ISSUE,
40
- }
41
-
42
- export type EagleProfile = {
43
- /** Buffer containing the speaker profile. */
44
- bytes: Uint8Array;
45
- };
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
-
57
- export type EagleProfilerEnrollResult = {
58
- feedback: EagleProfilerEnrollFeedback;
59
- percentage: number;
60
- };
61
-
62
- export type EagleProfilerWorkerInitRequest = {
63
- command: 'init';
64
- accessKey: string;
65
- modelPath: string;
66
- options: EagleProfilerOptions;
67
- wasmSimd: string;
68
- wasmSimdLib: string;
69
- wasmPThread: string;
70
- wasmPThreadLib: string;
71
- sdk: string;
72
- };
73
-
74
- export type EagleProfilerWorkerEnrollRequest = {
75
- command: 'enroll';
76
- inputFrame: Int16Array;
77
- };
78
-
79
- export type EagleProfilerWorkerExportRequest = {
80
- command: 'export';
81
- };
82
-
83
- export type EagleProfilerWorkerResetRequest = {
84
- command: 'reset';
85
- };
86
-
87
- export type EagleProfilerWorkerReleaseRequest = {
88
- command: 'release';
89
- };
90
-
91
- export type EagleProfilerWorkerRequest =
92
- | EagleProfilerWorkerInitRequest
93
- | EagleProfilerWorkerEnrollRequest
94
- | EagleProfilerWorkerExportRequest
95
- | EagleProfilerWorkerResetRequest
96
- | EagleProfilerWorkerReleaseRequest;
97
-
98
- export type EagleProfilerWorkerFailureResponse = {
99
- command: 'failed' | 'error';
100
- status: PvStatus;
101
- shortMessage: string;
102
- messageStack: string[];
103
- };
104
-
105
- export type EagleProfilerWorkerInitResponse =
106
- | EagleProfilerWorkerFailureResponse
107
- | {
108
- command: 'ok';
109
- minEnrollSamples: number;
110
- sampleRate: number;
111
- version: string;
112
- };
113
-
114
- export type EagleProfilerWorkerEnrollResponse =
115
- | EagleProfilerWorkerFailureResponse
116
- | {
117
- command: 'ok';
118
- result: EagleProfilerEnrollResult;
119
- };
120
-
121
- export type EagleProfilerWorkerExportResponse =
122
- | EagleProfilerWorkerFailureResponse
123
- | {
124
- command: 'ok';
125
- profile: EagleProfile;
126
- };
127
-
128
- export type EagleProfilerWorkerResetResponse =
129
- | EagleProfilerWorkerFailureResponse
130
- | {
131
- command: 'ok';
132
- };
133
-
134
- export type EagleProfilerWorkerReleaseResponse =
135
- | EagleProfilerWorkerFailureResponse
136
- | {
137
- command: 'ok';
138
- };
139
-
140
- export type EagleProfilerWorkerResponse =
141
- | EagleProfilerWorkerInitResponse
142
- | EagleProfilerWorkerEnrollResponse
143
- | EagleProfilerWorkerExportResponse
144
- | EagleProfilerWorkerResetResponse
145
- | EagleProfilerWorkerReleaseResponse;
146
-
147
- export type EagleWorkerInitRequest = {
148
- command: 'init';
149
- accessKey: string;
150
- modelPath: string;
151
- speakerProfiles: EagleProfile[];
152
- options: EagleOptions;
153
- wasmSimd: string;
154
- wasmSimdLib: string;
155
- wasmPThread: string;
156
- wasmPThreadLib: string;
157
- sdk: string;
158
- };
159
-
160
- export type EagleWorkerProcessRequest = {
161
- command: 'process';
162
- inputFrame: Int16Array;
163
- };
164
-
165
- export type EagleWorkerResetRequest = {
166
- command: 'reset';
167
- };
168
-
169
- export type EagleWorkerReleaseRequest = {
170
- command: 'release';
171
- };
172
-
173
- export type EagleWorkerRequest =
174
- | EagleWorkerInitRequest
175
- | EagleWorkerProcessRequest
176
- | EagleWorkerResetRequest
177
- | EagleWorkerReleaseRequest;
178
-
179
- export type EagleWorkerFailureResponse = {
180
- command: 'failed' | 'error';
181
- status: PvStatus;
182
- shortMessage: string;
183
- messageStack: string[];
184
- };
185
-
186
- export type EagleWorkerInitResponse =
187
- | EagleWorkerFailureResponse
188
- | {
189
- command: 'ok';
190
- frameLength: number;
191
- sampleRate: number;
192
- version: string;
193
- };
194
-
195
- export type EagleWorkerProcessResponse =
196
- | EagleWorkerFailureResponse
197
- | {
198
- command: 'ok';
199
- scores: number[];
200
- };
201
-
202
- export type EagleWorkerResetResponse =
203
- | EagleWorkerFailureResponse
204
- | {
205
- command: 'ok';
206
- };
207
-
208
- export type EagleWorkerReleaseResponse =
209
- | EagleWorkerFailureResponse
210
- | {
211
- command: 'ok';
212
- };
213
-
214
- export type EagleWorkerResponse =
215
- | EagleWorkerInitResponse
216
- | EagleWorkerProcessResponse
217
- | EagleWorkerResetResponse
218
- | EagleWorkerReleaseResponse;
1
+ /*
2
+ Copyright 2023-2026 Picovoice Inc.
3
+
4
+ You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
5
+ file accompanying this source.
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
8
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
9
+ specific language governing permissions and limitations under the License.
10
+ */
11
+
12
+ import { PvModel } from '@picovoice/web-utils';
13
+
14
+ export enum PvStatus {
15
+ SUCCESS = 10000,
16
+ OUT_OF_MEMORY,
17
+ IO_ERROR,
18
+ INVALID_ARGUMENT,
19
+ STOP_ITERATION,
20
+ KEY_ERROR,
21
+ INVALID_STATE,
22
+ RUNTIME_ERROR,
23
+ ACTIVATION_ERROR,
24
+ ACTIVATION_LIMIT_REACHED,
25
+ ACTIVATION_THROTTLED,
26
+ ACTIVATION_REFUSED,
27
+ }
28
+
29
+ /**
30
+ * EagleModel types
31
+ */
32
+ export type EagleModel = PvModel;
33
+
34
+ export type EagleProfile = {
35
+ /** Buffer containing the speaker profile. */
36
+ bytes: Uint8Array;
37
+ };
38
+
39
+ export type EagleOptions = {
40
+ /** @defaultValue `best` */
41
+ device?: string;
42
+ /** @defaultValue `0.3` */
43
+ voiceThreshold?: number;
44
+ };
45
+
46
+ export type EagleProfilerOptions = {
47
+ /** @defaultValue `best` */
48
+ device?: string;
49
+ /** @defaultValue `1` */
50
+ minEnrollmentChunks?: number;
51
+ /** @defaultValue `0.3` */
52
+ voiceThreshold?: number;
53
+ };
54
+
55
+ export type EagleProfilerWorkerInitRequest = {
56
+ command: 'init';
57
+ accessKey: string;
58
+ modelPath: string;
59
+ options: EagleProfilerOptions;
60
+ wasmSimd: string;
61
+ wasmSimdLib: string;
62
+ wasmPThread: string;
63
+ wasmPThreadLib: string;
64
+ sdk: string;
65
+ };
66
+
67
+ export type EagleProfilerWorkerEnrollRequest = {
68
+ command: 'enroll';
69
+ inputFrame: Int16Array;
70
+ };
71
+
72
+ export type EagleProfilerWorkerFlushRequest = {
73
+ command: 'flush';
74
+ };
75
+
76
+ export type EagleProfilerWorkerExportRequest = {
77
+ command: 'export';
78
+ };
79
+
80
+ export type EagleProfilerWorkerResetRequest = {
81
+ command: 'reset';
82
+ };
83
+
84
+ export type EagleProfilerWorkerReleaseRequest = {
85
+ command: 'release';
86
+ };
87
+
88
+ export type EagleProfilerWorkerRequest =
89
+ | EagleProfilerWorkerInitRequest
90
+ | EagleProfilerWorkerEnrollRequest
91
+ | EagleProfilerWorkerFlushRequest
92
+ | EagleProfilerWorkerExportRequest
93
+ | EagleProfilerWorkerResetRequest
94
+ | EagleProfilerWorkerReleaseRequest;
95
+
96
+ export type EagleProfilerWorkerFailureResponse = {
97
+ command: 'failed' | 'error';
98
+ status: PvStatus;
99
+ shortMessage: string;
100
+ messageStack: string[];
101
+ };
102
+
103
+ export type EagleProfilerWorkerInitResponse =
104
+ | EagleProfilerWorkerFailureResponse
105
+ | {
106
+ command: 'ok';
107
+ frameLength: number;
108
+ sampleRate: number;
109
+ version: string;
110
+ };
111
+
112
+ export type EagleProfilerWorkerEnrollResponse =
113
+ | EagleProfilerWorkerFailureResponse
114
+ | {
115
+ command: 'ok';
116
+ result: number;
117
+ };
118
+
119
+ export type EagleProfilerWorkerFlushResponse =
120
+ | EagleProfilerWorkerFailureResponse
121
+ | {
122
+ command: 'ok';
123
+ result: number;
124
+ };
125
+
126
+ export type EagleProfilerWorkerExportResponse =
127
+ | EagleProfilerWorkerFailureResponse
128
+ | {
129
+ command: 'ok';
130
+ profile: EagleProfile;
131
+ };
132
+
133
+ export type EagleProfilerWorkerResetResponse =
134
+ | EagleProfilerWorkerFailureResponse
135
+ | {
136
+ command: 'ok';
137
+ };
138
+
139
+ export type EagleProfilerWorkerReleaseResponse =
140
+ | EagleProfilerWorkerFailureResponse
141
+ | {
142
+ command: 'ok';
143
+ };
144
+
145
+ export type EagleProfilerWorkerResponse =
146
+ | EagleProfilerWorkerInitResponse
147
+ | EagleProfilerWorkerEnrollResponse
148
+ | EagleProfilerWorkerFlushResponse
149
+ | EagleProfilerWorkerExportResponse
150
+ | EagleProfilerWorkerResetResponse
151
+ | EagleProfilerWorkerReleaseResponse;
152
+
153
+ export type EagleWorkerInitRequest = {
154
+ command: 'init';
155
+ accessKey: string;
156
+ modelPath: string;
157
+ options: EagleOptions;
158
+ wasmSimd: string;
159
+ wasmSimdLib: string;
160
+ wasmPThread: string;
161
+ wasmPThreadLib: string;
162
+ sdk: string;
163
+ };
164
+
165
+ export type EagleWorkerProcessRequest = {
166
+ command: 'process';
167
+ inputFrame: Int16Array;
168
+ speakerProfiles: EagleProfile[];
169
+ };
170
+
171
+ export type EagleWorkerResetRequest = {
172
+ command: 'reset';
173
+ };
174
+
175
+ export type EagleWorkerReleaseRequest = {
176
+ command: 'release';
177
+ };
178
+
179
+ export type EagleWorkerRequest =
180
+ | EagleWorkerInitRequest
181
+ | EagleWorkerProcessRequest
182
+ | EagleWorkerResetRequest
183
+ | EagleWorkerReleaseRequest;
184
+
185
+ export type EagleWorkerFailureResponse = {
186
+ command: 'failed' | 'error';
187
+ status: PvStatus;
188
+ shortMessage: string;
189
+ messageStack: string[];
190
+ };
191
+
192
+ export type EagleWorkerInitResponse =
193
+ | EagleWorkerFailureResponse
194
+ | {
195
+ command: 'ok';
196
+ minProcessSamples: number;
197
+ sampleRate: number;
198
+ version: string;
199
+ };
200
+
201
+ export type EagleWorkerProcessResponse =
202
+ | EagleWorkerFailureResponse
203
+ | {
204
+ command: 'ok';
205
+ scores: number[];
206
+ };
207
+
208
+ export type EagleWorkerResetResponse =
209
+ | EagleWorkerFailureResponse
210
+ | {
211
+ command: 'ok';
212
+ };
213
+
214
+ export type EagleWorkerReleaseResponse =
215
+ | EagleWorkerFailureResponse
216
+ | {
217
+ command: 'ok';
218
+ };
219
+
220
+ export type EagleWorkerResponse =
221
+ | EagleWorkerInitResponse
222
+ | EagleWorkerProcessResponse
223
+ | EagleWorkerResetResponse
224
+ | EagleWorkerReleaseResponse;
package/tsconfig.json CHANGED
@@ -1,22 +1,22 @@
1
- {
2
- "compilerOptions": {
3
- "allowJs": true,
4
- "allowSyntheticDefaultImports": true,
5
- "downlevelIteration": true,
6
- "isolatedModules": false,
7
- "noImplicitAny": false,
8
- "lib": ["es2015", "esnext", "dom"],
9
- "module": "esnext",
10
- "moduleResolution": "node",
11
- "noEmit": false,
12
- "outDir": "./dist",
13
- "removeComments": false,
14
- "resolveJsonModule": true,
15
- "sourceMap": true,
16
- "strict": true,
17
- "target": "esnext",
18
- "types": ["node", "emscripten"]
19
- },
20
- "include": ["src", "module.d.ts"],
21
- "exclude": ["node_modules", "src/lib"]
22
- }
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "allowSyntheticDefaultImports": true,
5
+ "downlevelIteration": true,
6
+ "isolatedModules": false,
7
+ "noImplicitAny": false,
8
+ "lib": ["es2015", "esnext", "dom"],
9
+ "module": "esnext",
10
+ "moduleResolution": "node",
11
+ "noEmit": false,
12
+ "outDir": "./dist",
13
+ "removeComments": false,
14
+ "resolveJsonModule": true,
15
+ "sourceMap": true,
16
+ "strict": true,
17
+ "target": "esnext",
18
+ "types": ["node", "emscripten"]
19
+ },
20
+ "include": ["src", "module.d.ts"],
21
+ "exclude": ["node_modules", "src/lib"]
22
+ }