@picovoice/eagle-web 1.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,202 +1,224 @@
1
- /*
2
- Copyright 2023 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 EagleProfilerEnrollResult = {
48
- feedback: EagleProfilerEnrollFeedback;
49
- percentage: number;
50
- };
51
-
52
- export type EagleProfilerWorkerInitRequest = {
53
- command: 'init';
54
- accessKey: string;
55
- modelPath: string;
56
- wasm: string;
57
- wasmSimd: string;
58
- sdk: string;
59
- };
60
-
61
- export type EagleProfilerWorkerEnrollRequest = {
62
- command: 'enroll';
63
- inputFrame: Int16Array;
64
- };
65
-
66
- export type EagleProfilerWorkerExportRequest = {
67
- command: 'export';
68
- };
69
-
70
- export type EagleProfilerWorkerResetRequest = {
71
- command: 'reset';
72
- };
73
-
74
- export type EagleProfilerWorkerReleaseRequest = {
75
- command: 'release';
76
- };
77
-
78
- export type EagleProfilerWorkerRequest =
79
- | EagleProfilerWorkerInitRequest
80
- | EagleProfilerWorkerEnrollRequest
81
- | EagleProfilerWorkerExportRequest
82
- | EagleProfilerWorkerResetRequest
83
- | EagleProfilerWorkerReleaseRequest;
84
-
85
- export type EagleProfilerWorkerFailureResponse = {
86
- command: 'failed' | 'error';
87
- status: PvStatus;
88
- shortMessage: string;
89
- messageStack: string[];
90
- };
91
-
92
- export type EagleProfilerWorkerInitResponse =
93
- | EagleProfilerWorkerFailureResponse
94
- | {
95
- command: 'ok';
96
- minEnrollSamples: number;
97
- sampleRate: number;
98
- version: string;
99
- };
100
-
101
- export type EagleProfilerWorkerEnrollResponse =
102
- | EagleProfilerWorkerFailureResponse
103
- | {
104
- command: 'ok';
105
- result: EagleProfilerEnrollResult;
106
- };
107
-
108
- export type EagleProfilerWorkerExportResponse =
109
- | EagleProfilerWorkerFailureResponse
110
- | {
111
- command: 'ok';
112
- profile: EagleProfile;
113
- };
114
-
115
- export type EagleProfilerWorkerResetResponse =
116
- | EagleProfilerWorkerFailureResponse
117
- | {
118
- command: 'ok';
119
- };
120
-
121
- export type EagleProfilerWorkerReleaseResponse =
122
- | EagleProfilerWorkerFailureResponse
123
- | {
124
- command: 'ok';
125
- };
126
-
127
- export type EagleProfilerWorkerResponse =
128
- | EagleProfilerWorkerInitResponse
129
- | EagleProfilerWorkerEnrollResponse
130
- | EagleProfilerWorkerExportResponse
131
- | EagleProfilerWorkerResetResponse
132
- | EagleProfilerWorkerReleaseResponse;
133
-
134
- export type EagleWorkerInitRequest = {
135
- command: 'init';
136
- accessKey: string;
137
- modelPath: string;
138
- speakerProfiles: EagleProfile[];
139
- wasm: string;
140
- wasmSimd: string;
141
- sdk: string;
142
- };
143
-
144
- export type EagleWorkerProcessRequest = {
145
- command: 'process';
146
- inputFrame: Int16Array;
147
- };
148
-
149
- export type EagleWorkerResetRequest = {
150
- command: 'reset';
151
- };
152
-
153
- export type EagleWorkerReleaseRequest = {
154
- command: 'release';
155
- };
156
-
157
- export type EagleWorkerRequest =
158
- | EagleWorkerInitRequest
159
- | EagleWorkerProcessRequest
160
- | EagleWorkerResetRequest
161
- | EagleWorkerReleaseRequest;
162
-
163
- export type EagleWorkerFailureResponse = {
164
- command: 'failed' | 'error';
165
- status: PvStatus;
166
- shortMessage: string;
167
- messageStack: string[];
168
- };
169
-
170
- export type EagleWorkerInitResponse =
171
- | EagleWorkerFailureResponse
172
- | {
173
- command: 'ok';
174
- frameLength: number;
175
- sampleRate: number;
176
- version: string;
177
- };
178
-
179
- export type EagleWorkerProcessResponse =
180
- | EagleWorkerFailureResponse
181
- | {
182
- command: 'ok';
183
- scores: number[];
184
- };
185
-
186
- export type EagleWorkerResetResponse =
187
- | EagleWorkerFailureResponse
188
- | {
189
- command: 'ok';
190
- };
191
-
192
- export type EagleWorkerReleaseResponse =
193
- | EagleWorkerFailureResponse
194
- | {
195
- command: 'ok';
196
- };
197
-
198
- export type EagleWorkerResponse =
199
- | EagleWorkerInitResponse
200
- | EagleWorkerProcessResponse
201
- | EagleWorkerResetResponse
202
- | 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"]
19
- },
20
- "include": ["src", "module.d.ts"],
21
- "exclude": ["node_modules"]
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
+ }