@deepseek-ai/dsh-experimental-api-speech-to-text 0.1.7-alpha.1

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.
@@ -0,0 +1,311 @@
1
+ /* Generated by @deepseek-ai/dsh-typert-generator from the Host FaceModel — do not edit. */
2
+ import { z } from 'zod'
3
+
4
+ let _deepseek_ai_dsh_experimental_api_speech_to_text_speech_cancelPreparation_parameter_0$schema$value
5
+ const _deepseek_ai_dsh_experimental_api_speech_to_text_speech_cancelPreparation_parameter_0$schema = () => (_deepseek_ai_dsh_experimental_api_speech_to_text_speech_cancelPreparation_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
6
+ let _deepseek_ai_dsh_experimental_api_speech_to_text_speech_cancelPreparation_result$schema$value
7
+ const _deepseek_ai_dsh_experimental_api_speech_to_text_speech_cancelPreparation_result$schema = () => (_deepseek_ai_dsh_experimental_api_speech_to_text_speech_cancelPreparation_result$schema$value ??= z.void())
8
+ let _deepseek_ai_dsh_experimental_api_speech_to_text_speech_catalog_result$schema$value
9
+ const _deepseek_ai_dsh_experimental_api_speech_to_text_speech_catalog_result$schema = () => (_deepseek_ai_dsh_experimental_api_speech_to_text_speech_catalog_result$schema$value ??= z.object({
10
+ 'maxAudioBytes': z.number().readonly(),
11
+ 'maxDurationSeconds': z.number().readonly(),
12
+ 'providers': z.array(z.object({
13
+ 'preparation': z.union([z.intersection(z.object({
14
+ 'phase': z.union([z.literal("cancelled"), z.literal("ready"), z.literal("unprepared"), z.literal("standby")]).readonly(),
15
+ }), z.object({
16
+ 'step': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly().optional(),
17
+ 'steps': z.array(z.object({
18
+ 'kind': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly(),
19
+ 'status': z.union([z.literal("cancelled"), z.literal("failed"), z.literal("running"), z.literal("pending"), z.literal("complete")]).readonly(),
20
+ 'startedAt': z.number().readonly().optional(),
21
+ })).readonly().optional(),
22
+ })), z.intersection(z.object({
23
+ 'phase': z.literal("downloading").readonly(),
24
+ 'resource': z.string().readonly(),
25
+ 'completedBytes': z.number().readonly(),
26
+ 'totalBytes': z.number().readonly().optional(),
27
+ }), z.object({
28
+ 'step': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly().optional(),
29
+ 'steps': z.array(z.object({
30
+ 'kind': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly(),
31
+ 'status': z.union([z.literal("cancelled"), z.literal("failed"), z.literal("running"), z.literal("pending"), z.literal("complete")]).readonly(),
32
+ 'startedAt': z.number().readonly().optional(),
33
+ })).readonly().optional(),
34
+ })), z.intersection(z.object({
35
+ 'phase': z.union([z.literal("checking"), z.literal("loading"), z.literal("waking"), z.literal("cancelling")]).readonly(),
36
+ 'startedAt': z.number().readonly(),
37
+ }), z.object({
38
+ 'step': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly().optional(),
39
+ 'steps': z.array(z.object({
40
+ 'kind': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly(),
41
+ 'status': z.union([z.literal("cancelled"), z.literal("failed"), z.literal("running"), z.literal("pending"), z.literal("complete")]).readonly(),
42
+ 'startedAt': z.number().readonly().optional(),
43
+ })).readonly().optional(),
44
+ })), z.intersection(z.object({
45
+ 'phase': z.literal("failed").readonly(),
46
+ 'message': z.string().readonly(),
47
+ 'download': z.object({
48
+ 'resource': z.string().readonly(),
49
+ 'source': z.string().readonly(),
50
+ 'reason': z.union([z.literal("network"), z.literal("storage"), z.literal("unknown"), z.literal("dns"), z.literal("timeout"), z.literal("certificate"), z.literal("http"), z.literal("integrity")]).readonly(),
51
+ 'code': z.string().readonly().optional(),
52
+ 'status': z.number().readonly().optional(),
53
+ }).readonly().optional(),
54
+ }), z.object({
55
+ 'step': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly().optional(),
56
+ 'steps': z.array(z.object({
57
+ 'kind': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly(),
58
+ 'status': z.union([z.literal("cancelled"), z.literal("failed"), z.literal("running"), z.literal("pending"), z.literal("complete")]).readonly(),
59
+ 'startedAt': z.number().readonly().optional(),
60
+ })).readonly().optional(),
61
+ }))]).readonly(),
62
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
63
+ 'name': z.string().readonly(),
64
+ 'location': z.union([z.literal("host-local"), z.literal("cloud")]).readonly(),
65
+ 'languages': z.array(z.string()).readonly(),
66
+ 'setupEstimate': z.object({
67
+ 'recommendedDiskBytes': z.number().readonly(),
68
+ 'expectedMemoryBytes': z.number().readonly(),
69
+ 'minimumMinutes': z.number().readonly(),
70
+ 'maximumMinutes': z.number().readonly(),
71
+ }).readonly().optional(),
72
+ })).readonly(),
73
+ 'selection': z.object({
74
+ 'providerId': z.intersection(z.string(), z.unknown()).readonly(),
75
+ 'language': z.string().readonly(),
76
+ }).readonly(),
77
+ }))
78
+ let _deepseek_ai_dsh_experimental_api_speech_to_text_speech_configure_parameter_0$schema$value
79
+ const _deepseek_ai_dsh_experimental_api_speech_to_text_speech_configure_parameter_0$schema = () => (_deepseek_ai_dsh_experimental_api_speech_to_text_speech_configure_parameter_0$schema$value ??= z.object({
80
+ 'providerId': z.intersection(z.string(), z.unknown()).readonly().optional(),
81
+ 'language': z.string().readonly().optional(),
82
+ }))
83
+ let _deepseek_ai_dsh_experimental_api_speech_to_text_speech_configure_result$schema$value
84
+ const _deepseek_ai_dsh_experimental_api_speech_to_text_speech_configure_result$schema = () => (_deepseek_ai_dsh_experimental_api_speech_to_text_speech_configure_result$schema$value ??= z.void())
85
+ let _deepseek_ai_dsh_experimental_api_speech_to_text_speech_follow_result$schema$value
86
+ const _deepseek_ai_dsh_experimental_api_speech_to_text_speech_follow_result$schema = () => (_deepseek_ai_dsh_experimental_api_speech_to_text_speech_follow_result$schema$value ??= z.object({
87
+ 'maxAudioBytes': z.number().readonly(),
88
+ 'maxDurationSeconds': z.number().readonly(),
89
+ 'providers': z.array(z.object({
90
+ 'preparation': z.union([z.intersection(z.object({
91
+ 'phase': z.union([z.literal("cancelled"), z.literal("ready"), z.literal("unprepared"), z.literal("standby")]).readonly(),
92
+ }), z.object({
93
+ 'step': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly().optional(),
94
+ 'steps': z.array(z.object({
95
+ 'kind': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly(),
96
+ 'status': z.union([z.literal("cancelled"), z.literal("failed"), z.literal("running"), z.literal("pending"), z.literal("complete")]).readonly(),
97
+ 'startedAt': z.number().readonly().optional(),
98
+ })).readonly().optional(),
99
+ })), z.intersection(z.object({
100
+ 'phase': z.literal("downloading").readonly(),
101
+ 'resource': z.string().readonly(),
102
+ 'completedBytes': z.number().readonly(),
103
+ 'totalBytes': z.number().readonly().optional(),
104
+ }), z.object({
105
+ 'step': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly().optional(),
106
+ 'steps': z.array(z.object({
107
+ 'kind': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly(),
108
+ 'status': z.union([z.literal("cancelled"), z.literal("failed"), z.literal("running"), z.literal("pending"), z.literal("complete")]).readonly(),
109
+ 'startedAt': z.number().readonly().optional(),
110
+ })).readonly().optional(),
111
+ })), z.intersection(z.object({
112
+ 'phase': z.union([z.literal("checking"), z.literal("loading"), z.literal("waking"), z.literal("cancelling")]).readonly(),
113
+ 'startedAt': z.number().readonly(),
114
+ }), z.object({
115
+ 'step': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly().optional(),
116
+ 'steps': z.array(z.object({
117
+ 'kind': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly(),
118
+ 'status': z.union([z.literal("cancelled"), z.literal("failed"), z.literal("running"), z.literal("pending"), z.literal("complete")]).readonly(),
119
+ 'startedAt': z.number().readonly().optional(),
120
+ })).readonly().optional(),
121
+ })), z.intersection(z.object({
122
+ 'phase': z.literal("failed").readonly(),
123
+ 'message': z.string().readonly(),
124
+ 'download': z.object({
125
+ 'resource': z.string().readonly(),
126
+ 'source': z.string().readonly(),
127
+ 'reason': z.union([z.literal("network"), z.literal("storage"), z.literal("unknown"), z.literal("dns"), z.literal("timeout"), z.literal("certificate"), z.literal("http"), z.literal("integrity")]).readonly(),
128
+ 'code': z.string().readonly().optional(),
129
+ 'status': z.number().readonly().optional(),
130
+ }).readonly().optional(),
131
+ }), z.object({
132
+ 'step': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly().optional(),
133
+ 'steps': z.array(z.object({
134
+ 'kind': z.union([z.literal("check"), z.literal("model"), z.literal("vad"), z.literal("verify"), z.literal("load")]).readonly(),
135
+ 'status': z.union([z.literal("cancelled"), z.literal("failed"), z.literal("running"), z.literal("pending"), z.literal("complete")]).readonly(),
136
+ 'startedAt': z.number().readonly().optional(),
137
+ })).readonly().optional(),
138
+ }))]).readonly(),
139
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
140
+ 'name': z.string().readonly(),
141
+ 'location': z.union([z.literal("host-local"), z.literal("cloud")]).readonly(),
142
+ 'languages': z.array(z.string()).readonly(),
143
+ 'setupEstimate': z.object({
144
+ 'recommendedDiskBytes': z.number().readonly(),
145
+ 'expectedMemoryBytes': z.number().readonly(),
146
+ 'minimumMinutes': z.number().readonly(),
147
+ 'maximumMinutes': z.number().readonly(),
148
+ }).readonly().optional(),
149
+ })).readonly(),
150
+ 'selection': z.object({
151
+ 'providerId': z.intersection(z.string(), z.unknown()).readonly(),
152
+ 'language': z.string().readonly(),
153
+ }).readonly(),
154
+ }))
155
+ let _deepseek_ai_dsh_experimental_api_speech_to_text_speech_prepare_parameter_0$schema$value
156
+ const _deepseek_ai_dsh_experimental_api_speech_to_text_speech_prepare_parameter_0$schema = () => (_deepseek_ai_dsh_experimental_api_speech_to_text_speech_prepare_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
157
+ let _deepseek_ai_dsh_experimental_api_speech_to_text_speech_prepare_result$schema$value
158
+ const _deepseek_ai_dsh_experimental_api_speech_to_text_speech_prepare_result$schema = () => (_deepseek_ai_dsh_experimental_api_speech_to_text_speech_prepare_result$schema$value ??= z.void())
159
+ let _deepseek_ai_dsh_experimental_api_speech_to_text_speech_transcribe_parameter_0$schema$value
160
+ const _deepseek_ai_dsh_experimental_api_speech_to_text_speech_transcribe_parameter_0$schema = () => (_deepseek_ai_dsh_experimental_api_speech_to_text_speech_transcribe_parameter_0$schema$value ??= z.object({
161
+ 'audioBase64': z.string().readonly(),
162
+ 'providerId': z.intersection(z.string(), z.unknown()).readonly().optional(),
163
+ 'language': z.string().readonly().optional(),
164
+ }))
165
+ let _deepseek_ai_dsh_experimental_api_speech_to_text_speech_transcribe_result$schema$value
166
+ const _deepseek_ai_dsh_experimental_api_speech_to_text_speech_transcribe_result$schema = () => (_deepseek_ai_dsh_experimental_api_speech_to_text_speech_transcribe_result$schema$value ??= z.object({
167
+ 'text': z.string().readonly(),
168
+ 'audioSeconds': z.number().readonly(),
169
+ 'inferenceSeconds': z.number().readonly(),
170
+ }))
171
+
172
+ export const TYPERT_REMOTE = {
173
+ package: '@deepseek-ai/dsh-experimental-api-speech-to-text',
174
+ descriptors: [
175
+ {
176
+ id: '@deepseek-ai/dsh-experimental-api-speech-to-text#speech/cancelPreparation',
177
+ service: 'speechController',
178
+ namespace: 'speech',
179
+ method: 'cancelPreparation',
180
+ invocation: { kind: 'direct' },
181
+ parameters: [
182
+ {
183
+ name: 'providerId',
184
+ wire: 'providerId',
185
+ source: 'json',
186
+ codec: {
187
+ mode: 'strict',
188
+ typeSymbol: '@deepseek-ai/dsh-experimental-speech-to-text/types#SpeechProviderId',
189
+ create: _deepseek_ai_dsh_experimental_api_speech_to_text_speech_cancelPreparation_parameter_0$schema,
190
+ },
191
+ },
192
+ ],
193
+ result: {
194
+ mode: 'strict',
195
+ typeSymbol: '@deepseek-ai/dsh-experimental-api-speech-to-text#speech/cancelPreparation:result',
196
+ create: _deepseek_ai_dsh_experimental_api_speech_to_text_speech_cancelPreparation_result$schema,
197
+ },
198
+ sourceLocation: {"file":"packages/experimental/api-speech-to-text/src/index.ts","line":79,"column":3},
199
+ },
200
+ {
201
+ id: '@deepseek-ai/dsh-experimental-api-speech-to-text#speech/catalog',
202
+ service: 'speechController',
203
+ namespace: 'speech',
204
+ method: 'catalog',
205
+ invocation: { kind: 'direct' },
206
+ parameters: [
207
+ ],
208
+ result: {
209
+ mode: 'strict',
210
+ typeSymbol: '@deepseek-ai/dsh-experimental-api-speech-to-text/types#SpeechCatalog',
211
+ create: _deepseek_ai_dsh_experimental_api_speech_to_text_speech_catalog_result$schema,
212
+ },
213
+ sourceLocation: {"file":"packages/experimental/api-speech-to-text/src/index.ts","line":44,"column":3},
214
+ },
215
+ {
216
+ id: '@deepseek-ai/dsh-experimental-api-speech-to-text#speech/configure',
217
+ service: 'speechController',
218
+ namespace: 'speech',
219
+ method: 'configure',
220
+ invocation: { kind: 'direct' },
221
+ parameters: [
222
+ {
223
+ name: 'patch',
224
+ wire: 'patch',
225
+ source: 'json',
226
+ codec: {
227
+ mode: 'strict',
228
+ typeSymbol: '@deepseek-ai/dsh-experimental-speech-to-text/types#SpeechSelectionPatch',
229
+ create: _deepseek_ai_dsh_experimental_api_speech_to_text_speech_configure_parameter_0$schema,
230
+ },
231
+ },
232
+ ],
233
+ result: {
234
+ mode: 'strict',
235
+ typeSymbol: '@deepseek-ai/dsh-experimental-api-speech-to-text#speech/configure:result',
236
+ create: _deepseek_ai_dsh_experimental_api_speech_to_text_speech_configure_result$schema,
237
+ },
238
+ sourceLocation: {"file":"packages/experimental/api-speech-to-text/src/index.ts","line":64,"column":3},
239
+ },
240
+ {
241
+ id: '@deepseek-ai/dsh-experimental-api-speech-to-text#speech/follow',
242
+ service: 'speechController',
243
+ namespace: 'speech',
244
+ method: 'follow',
245
+ mode: 'stream',
246
+ invocation: { kind: 'direct' },
247
+ parameters: [
248
+ ],
249
+ cancellation: { parameter: 'signal' },
250
+ result: {
251
+ mode: 'strict',
252
+ typeSymbol: '@deepseek-ai/dsh-experimental-api-speech-to-text/types#SpeechCatalog',
253
+ create: _deepseek_ai_dsh_experimental_api_speech_to_text_speech_follow_result$schema,
254
+ },
255
+ sourceLocation: {"file":"packages/experimental/api-speech-to-text/src/index.ts","line":54,"column":10},
256
+ },
257
+ {
258
+ id: '@deepseek-ai/dsh-experimental-api-speech-to-text#speech/prepare',
259
+ service: 'speechController',
260
+ namespace: 'speech',
261
+ method: 'prepare',
262
+ invocation: { kind: 'direct' },
263
+ parameters: [
264
+ {
265
+ name: 'providerId',
266
+ wire: 'providerId',
267
+ source: 'json',
268
+ codec: {
269
+ mode: 'strict',
270
+ typeSymbol: '@deepseek-ai/dsh-experimental-speech-to-text/types#SpeechProviderId',
271
+ create: _deepseek_ai_dsh_experimental_api_speech_to_text_speech_prepare_parameter_0$schema,
272
+ },
273
+ },
274
+ ],
275
+ result: {
276
+ mode: 'strict',
277
+ typeSymbol: '@deepseek-ai/dsh-experimental-api-speech-to-text#speech/prepare:result',
278
+ create: _deepseek_ai_dsh_experimental_api_speech_to_text_speech_prepare_result$schema,
279
+ },
280
+ sourceLocation: {"file":"packages/experimental/api-speech-to-text/src/index.ts","line":71,"column":3},
281
+ },
282
+ {
283
+ id: '@deepseek-ai/dsh-experimental-api-speech-to-text#speech/transcribe',
284
+ service: 'speechController',
285
+ namespace: 'speech',
286
+ method: 'transcribe',
287
+ invocation: { kind: 'direct' },
288
+ parameters: [
289
+ {
290
+ name: 'request',
291
+ wire: 'request',
292
+ source: 'json',
293
+ codec: {
294
+ mode: 'strict',
295
+ typeSymbol: '@deepseek-ai/dsh-experimental-api-speech-to-text/types#TranscriptionRequest',
296
+ create: _deepseek_ai_dsh_experimental_api_speech_to_text_speech_transcribe_parameter_0$schema,
297
+ },
298
+ },
299
+ ],
300
+ cancellation: { parameter: 'signal' },
301
+ result: {
302
+ mode: 'strict',
303
+ typeSymbol: '@deepseek-ai/dsh-experimental-speech-to-text/types#Transcript',
304
+ create: _deepseek_ai_dsh_experimental_api_speech_to_text_speech_transcribe_result$schema,
305
+ },
306
+ sourceLocation: {"file":"packages/experimental/api-speech-to-text/src/index.ts","line":88,"column":9},
307
+ },
308
+ ],
309
+ }
310
+
311
+ export default TYPERT_REMOTE
@@ -0,0 +1,63 @@
1
+ /** Authenticated, cancellation-aware Client access to the speech capability. */
2
+ import { Context } from '@deepseek-ai/cordis';
3
+ import z from '@deepseek-ai/schemastery';
4
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
5
+ import type { SpeechProviderId, SpeechSelectionPatch, Transcript } from '@deepseek-ai/dsh-experimental-speech-to-text/types';
6
+ import type { SpeechCatalog, TranscriptionRequest } from './types.ts';
7
+ export type * from './types.ts';
8
+ declare module '@deepseek-ai/cordis' {
9
+ interface Context {
10
+ /** Experimental speech Remote controller. */
11
+ speechController: SpeechController;
12
+ }
13
+ }
14
+ /** Limits applied before decoding or calling a provider. */
15
+ export interface Config {
16
+ /** Maximum decoded WAV bytes per request. */
17
+ maxAudioBytes: number;
18
+ /** Maximum PCM recording duration in seconds. */
19
+ maxDurationSeconds: number;
20
+ }
21
+ /** Speech calls never activate or submit to an Agent. */
22
+ export default class SpeechController extends TypertRemoteService {
23
+ private readonly config;
24
+ static inject: string[];
25
+ static Config: z<Config>;
26
+ constructor(ctx: Context, config: Config);
27
+ /**
28
+ * Read provider choices without preparing a recognizer.
29
+ * @returns available providers, resolved default, and recording limits.
30
+ */
31
+ catalog(): SpeechCatalog;
32
+ /**
33
+ * Follow provider readiness independently of Session and preparation lifetimes.
34
+ * @param signal - Client observation lifetime.
35
+ * @returns initial and subsequent complete readiness snapshots.
36
+ */
37
+ follow(signal: AbortSignal): AsyncIterable<SpeechCatalog>;
38
+ /**
39
+ * Persist the user's recognition preferences.
40
+ * @param patch - changed preference fields.
41
+ * @returns after preferences are saved.
42
+ */
43
+ configure(patch: SpeechSelectionPatch): Promise<void>;
44
+ /**
45
+ * Start or join one Host-owned preparation task.
46
+ * @param providerId - selected recognizer.
47
+ */
48
+ prepare(providerId: SpeechProviderId): void;
49
+ /**
50
+ * Explicitly cancel resource preparation.
51
+ * @param providerId - selected recognizer.
52
+ * @returns after the preparation task settles.
53
+ */
54
+ cancelPreparation(providerId: SpeechProviderId): Promise<void>;
55
+ /**
56
+ * Validate and transcribe one recording through the explicit provider selection.
57
+ * @param request - canonical WAV encoded as base64, provider id and language hint.
58
+ * @param signal - Client cancellation or Remote contribution disposal.
59
+ * @returns final transcript without adding a Session event.
60
+ */
61
+ transcribe(request: TranscriptionRequest, signal: AbortSignal): Promise<Transcript>;
62
+ }
63
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,142 @@
1
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
2
+ var useValue = arguments.length > 2;
3
+ for (var i = 0; i < initializers.length; i++) {
4
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
5
+ }
6
+ return useValue ? value : void 0;
7
+ };
8
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
9
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
10
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
11
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
12
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13
+ var _, done = false;
14
+ for (var i = decorators.length - 1; i >= 0; i--) {
15
+ var context = {};
16
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
17
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
18
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
19
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
20
+ if (kind === "accessor") {
21
+ if (result === void 0) continue;
22
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
23
+ if (_ = accept(result.get)) descriptor.get = _;
24
+ if (_ = accept(result.set)) descriptor.set = _;
25
+ if (_ = accept(result.init)) initializers.unshift(_);
26
+ }
27
+ else if (_ = accept(result)) {
28
+ if (kind === "field") initializers.unshift(_);
29
+ else descriptor[key] = _;
30
+ }
31
+ }
32
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
33
+ done = true;
34
+ };
35
+ import z from '@deepseek-ai/schemastery';
36
+ import { Remote, RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
37
+ import { validateWave } from '@deepseek-ai/dsh-experimental-speech-to-text/wave';
38
+ let SpeechController = (() => {
39
+ let _classSuper = TypertRemoteService;
40
+ let _instanceExtraInitializers = [];
41
+ let _catalog_decorators;
42
+ let _follow_decorators;
43
+ let _configure_decorators;
44
+ let _prepare_decorators;
45
+ let _cancelPreparation_decorators;
46
+ let _transcribe_decorators;
47
+ return class SpeechController extends _classSuper {
48
+ static {
49
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
50
+ _catalog_decorators = [Remote];
51
+ _follow_decorators = [Remote({ mode: 'stream' })];
52
+ _configure_decorators = [Remote];
53
+ _prepare_decorators = [Remote];
54
+ _cancelPreparation_decorators = [Remote];
55
+ _transcribe_decorators = [Remote];
56
+ __esDecorate(this, null, _catalog_decorators, { kind: "method", name: "catalog", static: false, private: false, access: { has: obj => "catalog" in obj, get: obj => obj.catalog }, metadata: _metadata }, null, _instanceExtraInitializers);
57
+ __esDecorate(this, null, _follow_decorators, { kind: "method", name: "follow", static: false, private: false, access: { has: obj => "follow" in obj, get: obj => obj.follow }, metadata: _metadata }, null, _instanceExtraInitializers);
58
+ __esDecorate(this, null, _configure_decorators, { kind: "method", name: "configure", static: false, private: false, access: { has: obj => "configure" in obj, get: obj => obj.configure }, metadata: _metadata }, null, _instanceExtraInitializers);
59
+ __esDecorate(this, null, _prepare_decorators, { kind: "method", name: "prepare", static: false, private: false, access: { has: obj => "prepare" in obj, get: obj => obj.prepare }, metadata: _metadata }, null, _instanceExtraInitializers);
60
+ __esDecorate(this, null, _cancelPreparation_decorators, { kind: "method", name: "cancelPreparation", static: false, private: false, access: { has: obj => "cancelPreparation" in obj, get: obj => obj.cancelPreparation }, metadata: _metadata }, null, _instanceExtraInitializers);
61
+ __esDecorate(this, null, _transcribe_decorators, { kind: "method", name: "transcribe", static: false, private: false, access: { has: obj => "transcribe" in obj, get: obj => obj.transcribe }, metadata: _metadata }, null, _instanceExtraInitializers);
62
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
63
+ }
64
+ config = __runInitializers(this, _instanceExtraInitializers);
65
+ static inject = ['speechToText', 'typert'];
66
+ static Config = z.object({
67
+ maxAudioBytes: z.natural().min(46).default(4 * 1024 * 1024),
68
+ maxDurationSeconds: z.number().min(1).default(120),
69
+ });
70
+ constructor(ctx, config) {
71
+ super(ctx, 'speechController', { namespace: 'speech' });
72
+ this.config = config;
73
+ }
74
+ /**
75
+ * Read provider choices without preparing a recognizer.
76
+ * @returns available providers, resolved default, and recording limits.
77
+ */
78
+ catalog() {
79
+ return { ...this.ctx.speechToText.snapshot(), ...this.config };
80
+ }
81
+ /**
82
+ * Follow provider readiness independently of Session and preparation lifetimes.
83
+ * @param signal - Client observation lifetime.
84
+ * @returns initial and subsequent complete readiness snapshots.
85
+ */
86
+ async *follow(signal) {
87
+ for await (const snapshot of this.ctx.speechToText.follow(signal))
88
+ yield { ...snapshot, ...this.config };
89
+ }
90
+ /**
91
+ * Persist the user's recognition preferences.
92
+ * @param patch - changed preference fields.
93
+ * @returns after preferences are saved.
94
+ */
95
+ configure(patch) { return this.ctx.speechToText.configure(patch); }
96
+ /**
97
+ * Start or join one Host-owned preparation task.
98
+ * @param providerId - selected recognizer.
99
+ */
100
+ prepare(providerId) { this.ctx.speechToText.prepare(providerId); }
101
+ /**
102
+ * Explicitly cancel resource preparation.
103
+ * @param providerId - selected recognizer.
104
+ * @returns after the preparation task settles.
105
+ */
106
+ cancelPreparation(providerId) { return this.ctx.speechToText.cancelPreparation(providerId); }
107
+ /**
108
+ * Validate and transcribe one recording through the explicit provider selection.
109
+ * @param request - canonical WAV encoded as base64, provider id and language hint.
110
+ * @param signal - Client cancellation or Remote contribution disposal.
111
+ * @returns final transcript without adding a Session event.
112
+ */
113
+ async transcribe(request, signal) {
114
+ signal.throwIfAborted();
115
+ const encoded = request.audioBase64;
116
+ if (encoded.length > Math.ceil(this.config.maxAudioBytes / 3) * 4) {
117
+ throw new RemoteError('speech/invalid-audio', 'Audio is invalid or exceeds the configured byte limit', { reason: 'encoding-or-size' });
118
+ }
119
+ const audio = Buffer.from(encoded, 'base64');
120
+ try {
121
+ if (audio.toString('base64') !== encoded)
122
+ throw new Error('Audio must use canonical base64 encoding');
123
+ if (audio.length > this.config.maxAudioBytes)
124
+ throw new Error('Audio exceeds the configured byte limit');
125
+ validateWave(audio, this.config.maxDurationSeconds);
126
+ const spec = this.ctx.speechToText.resolve({ audio,
127
+ ...request.providerId === undefined ? {} : { providerId: request.providerId },
128
+ ...request.language === undefined ? {} : { language: request.language },
129
+ });
130
+ return await this.ctx.speechToText.transcribe(spec, signal);
131
+ }
132
+ catch (error) {
133
+ signal.throwIfAborted();
134
+ const reason = error instanceof Error ? error.message : String(error);
135
+ throw new RemoteError('speech/transcription-failed', reason, { reason });
136
+ }
137
+ }
138
+ };
139
+ })();
140
+ /** Speech calls never activate or submit to an Agent. */
141
+ export default SpeechController;
142
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,26 @@
1
+ /** JSON-safe inputs and results of the experimental speech Remote namespace. */
2
+ import type { SpeechProviderId, SpeechSnapshot } from '@deepseek-ai/dsh-experimental-speech-to-text/types';
3
+ declare module '@deepseek-ai/dsh-typert-protocol' {
4
+ interface RemoteErrorDetailsMap {
5
+ /** Audio encoding or intake limits prevented transcription. */
6
+ 'speech/invalid-audio': {
7
+ readonly reason: string;
8
+ };
9
+ /** The selected provider rejected transcription. */
10
+ 'speech/transcription-failed': {
11
+ readonly reason: string;
12
+ };
13
+ }
14
+ }
15
+ /** Complete recording submitted for transcription, separate from Session admission. */
16
+ export interface TranscriptionRequest {
17
+ readonly audioBase64: string;
18
+ readonly providerId?: SpeechProviderId;
19
+ readonly language?: string;
20
+ }
21
+ /** Current provider choices and audio intake limits. */
22
+ export interface SpeechCatalog extends SpeechSnapshot {
23
+ readonly maxAudioBytes: number;
24
+ readonly maxDurationSeconds: number;
25
+ }
26
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@deepseek-ai/dsh-experimental-api-speech-to-text",
3
+ "description": "Authenticated experimental speech transcription for browser clients",
4
+ "version": "0.1.7-alpha.1",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "packages/experimental/api-speech-to-text"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./src/*": "./src/*",
22
+ "./package.json": "./package.json",
23
+ "./types": {
24
+ "types": "./lib/types/types.d.ts",
25
+ "default": "./lib/types/types.js"
26
+ },
27
+ "./typert": {
28
+ "types": "./lib/typert.host.d.ts",
29
+ "default": "./lib/typert.host.js"
30
+ },
31
+ "./remote": {
32
+ "types": "./lib/typert.remote-client.d.ts",
33
+ "default": "./lib/typert.remote-client.js"
34
+ }
35
+ },
36
+ "files": [
37
+ "lib/index.js",
38
+ "lib/types/**/*.js",
39
+ "lib/types/**/*.d.ts",
40
+ "lib/typert.host.js",
41
+ "lib/typert.host.d.ts",
42
+ "lib/typert.remote-client.js",
43
+ "lib/typert.remote-client.d.ts"
44
+ ],
45
+ "license": "MIT",
46
+ "dependencies": {
47
+ "zod": "^4.4.3",
48
+ "@deepseek-ai/schemastery": "^3.18.3"
49
+ },
50
+ "peerDependencies": {
51
+ "@deepseek-ai/dsh-experimental-speech-to-text": "^0.1.7-alpha.1",
52
+ "@deepseek-ai/cordis": "^4.0.3",
53
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.7-alpha.1"
54
+ },
55
+ "devDependencies": {
56
+ "@deepseek-ai/cordis": "^4.0.3",
57
+ "@deepseek-ai/dsh-experimental-speech-to-text": "^0.1.7-alpha.1",
58
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.7-alpha.1"
59
+ }
60
+ }