@antiphony/shared 0.5.0 → 0.6.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/README.md +1 -1
- package/dist/cjs/api-codecs.cjs +52 -9
- package/dist/cjs/api-codecs.d.cts +92 -92
- package/dist/cjs/index.cjs +63 -9
- package/dist/cjs/index.d.cts +4 -307
- package/dist/cjs/nsid.cjs +10 -0
- package/dist/cjs/nsid.d.cts +25 -1
- package/dist/cjs/types/audio.cjs +50 -7
- package/dist/cjs/types/audio.d.cts +220 -197
- package/dist/cjs/types/processing.cjs +174 -0
- package/dist/cjs/types/processing.d.cts +336 -0
- package/dist/cjs/types/url.cjs +10 -0
- package/dist/cjs/types/url.d.cts +70 -0
- package/dist/esm/api-codecs.d.ts +92 -92
- package/dist/esm/api-codecs.js +5 -3
- package/dist/esm/{chunk-F5ZKFJL2.js → chunk-6EJLU4LG.js} +4 -3
- package/dist/esm/chunk-AKIWUNNK.js +129 -0
- package/dist/esm/{chunk-SBYNIQRZ.js → chunk-F5RKN3GY.js} +10 -1
- package/dist/esm/chunk-KMQWUFMV.js +8 -0
- package/dist/esm/{chunk-TVOXIQKF.js → chunk-QQ5GOLYW.js} +27 -111
- package/dist/esm/index.d.ts +4 -307
- package/dist/esm/index.js +7 -5
- package/dist/esm/nsid.d.ts +25 -1
- package/dist/esm/nsid.js +1 -1
- package/dist/esm/types/audio.d.ts +220 -197
- package/dist/esm/types/audio.js +4 -2
- package/dist/esm/types/processing.d.ts +336 -0
- package/dist/esm/types/processing.js +3 -0
- package/dist/esm/types/url.d.ts +70 -0
- package/dist/esm/types/url.js +2 -0
- package/package.json +6 -4
package/dist/esm/api-codecs.d.ts
CHANGED
|
@@ -53,9 +53,9 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
53
53
|
mimeType: string;
|
|
54
54
|
size: number;
|
|
55
55
|
};
|
|
56
|
-
waveform?: number[] | undefined;
|
|
57
56
|
durationMs?: number | undefined;
|
|
58
57
|
alt?: string | undefined;
|
|
58
|
+
waveform?: number[] | undefined;
|
|
59
59
|
}, {
|
|
60
60
|
$type: "dev.antiphony.embed.audio";
|
|
61
61
|
audio: {
|
|
@@ -66,9 +66,9 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
66
66
|
mimeType: string;
|
|
67
67
|
size: number;
|
|
68
68
|
};
|
|
69
|
-
waveform?: number[] | undefined;
|
|
70
69
|
durationMs?: number | undefined;
|
|
71
70
|
alt?: string | undefined;
|
|
71
|
+
waveform?: number[] | undefined;
|
|
72
72
|
}>>;
|
|
73
73
|
/** Present ⇒ this is a reply (StrongRef root + parent). */
|
|
74
74
|
reply: z.ZodOptional<z.ZodObject<{
|
|
@@ -130,37 +130,20 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
130
130
|
waveform: z.ZodOptional<z.ZodBoolean>;
|
|
131
131
|
reprocess: z.ZodOptional<z.ZodBoolean>;
|
|
132
132
|
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
waveform?: boolean | undefined;
|
|
134
|
+
transcribe?: boolean | undefined;
|
|
133
135
|
denoise?: boolean | undefined;
|
|
134
136
|
trim?: boolean | undefined;
|
|
135
|
-
transcribe?: boolean | undefined;
|
|
136
|
-
waveform?: boolean | undefined;
|
|
137
137
|
reprocess?: boolean | undefined;
|
|
138
138
|
}, {
|
|
139
|
+
waveform?: boolean | undefined;
|
|
140
|
+
transcribe?: boolean | undefined;
|
|
139
141
|
denoise?: boolean | undefined;
|
|
140
142
|
trim?: boolean | undefined;
|
|
141
|
-
transcribe?: boolean | undefined;
|
|
142
|
-
waveform?: boolean | undefined;
|
|
143
143
|
reprocess?: boolean | undefined;
|
|
144
144
|
}>>;
|
|
145
145
|
}, "strip", z.ZodTypeAny, {
|
|
146
146
|
text: string;
|
|
147
|
-
processing?: {
|
|
148
|
-
denoise?: boolean | undefined;
|
|
149
|
-
trim?: boolean | undefined;
|
|
150
|
-
transcribe?: boolean | undefined;
|
|
151
|
-
waveform?: boolean | undefined;
|
|
152
|
-
reprocess?: boolean | undefined;
|
|
153
|
-
} | undefined;
|
|
154
|
-
reply?: {
|
|
155
|
-
root: {
|
|
156
|
-
uri: string;
|
|
157
|
-
cid: string;
|
|
158
|
-
};
|
|
159
|
-
parent: {
|
|
160
|
-
uri: string;
|
|
161
|
-
cid: string;
|
|
162
|
-
};
|
|
163
|
-
} | undefined;
|
|
164
147
|
title?: string | undefined;
|
|
165
148
|
embed?: {
|
|
166
149
|
$type: "dev.antiphony.embed.audio";
|
|
@@ -172,20 +155,9 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
172
155
|
mimeType: string;
|
|
173
156
|
size: number;
|
|
174
157
|
};
|
|
175
|
-
waveform?: number[] | undefined;
|
|
176
158
|
durationMs?: number | undefined;
|
|
177
159
|
alt?: string | undefined;
|
|
178
|
-
|
|
179
|
-
langs?: string[] | undefined;
|
|
180
|
-
selfLabels?: string[] | undefined;
|
|
181
|
-
}, {
|
|
182
|
-
text?: string | undefined;
|
|
183
|
-
processing?: {
|
|
184
|
-
denoise?: boolean | undefined;
|
|
185
|
-
trim?: boolean | undefined;
|
|
186
|
-
transcribe?: boolean | undefined;
|
|
187
|
-
waveform?: boolean | undefined;
|
|
188
|
-
reprocess?: boolean | undefined;
|
|
160
|
+
waveform?: number[] | undefined;
|
|
189
161
|
} | undefined;
|
|
190
162
|
reply?: {
|
|
191
163
|
root: {
|
|
@@ -197,6 +169,17 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
197
169
|
cid: string;
|
|
198
170
|
};
|
|
199
171
|
} | undefined;
|
|
172
|
+
langs?: string[] | undefined;
|
|
173
|
+
selfLabels?: string[] | undefined;
|
|
174
|
+
processing?: {
|
|
175
|
+
waveform?: boolean | undefined;
|
|
176
|
+
transcribe?: boolean | undefined;
|
|
177
|
+
denoise?: boolean | undefined;
|
|
178
|
+
trim?: boolean | undefined;
|
|
179
|
+
reprocess?: boolean | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
}, {
|
|
182
|
+
text?: string | undefined;
|
|
200
183
|
title?: string | undefined;
|
|
201
184
|
embed?: {
|
|
202
185
|
$type: "dev.antiphony.embed.audio";
|
|
@@ -208,20 +191,9 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
208
191
|
mimeType: string;
|
|
209
192
|
size: number;
|
|
210
193
|
};
|
|
211
|
-
waveform?: number[] | undefined;
|
|
212
194
|
durationMs?: number | undefined;
|
|
213
195
|
alt?: string | undefined;
|
|
214
|
-
|
|
215
|
-
langs?: string[] | undefined;
|
|
216
|
-
selfLabels?: string[] | undefined;
|
|
217
|
-
}>, {
|
|
218
|
-
text: string;
|
|
219
|
-
processing?: {
|
|
220
|
-
denoise?: boolean | undefined;
|
|
221
|
-
trim?: boolean | undefined;
|
|
222
|
-
transcribe?: boolean | undefined;
|
|
223
|
-
waveform?: boolean | undefined;
|
|
224
|
-
reprocess?: boolean | undefined;
|
|
196
|
+
waveform?: number[] | undefined;
|
|
225
197
|
} | undefined;
|
|
226
198
|
reply?: {
|
|
227
199
|
root: {
|
|
@@ -233,6 +205,17 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
233
205
|
cid: string;
|
|
234
206
|
};
|
|
235
207
|
} | undefined;
|
|
208
|
+
langs?: string[] | undefined;
|
|
209
|
+
selfLabels?: string[] | undefined;
|
|
210
|
+
processing?: {
|
|
211
|
+
waveform?: boolean | undefined;
|
|
212
|
+
transcribe?: boolean | undefined;
|
|
213
|
+
denoise?: boolean | undefined;
|
|
214
|
+
trim?: boolean | undefined;
|
|
215
|
+
reprocess?: boolean | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
}>, {
|
|
218
|
+
text: string;
|
|
236
219
|
title?: string | undefined;
|
|
237
220
|
embed?: {
|
|
238
221
|
$type: "dev.antiphony.embed.audio";
|
|
@@ -244,20 +227,9 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
244
227
|
mimeType: string;
|
|
245
228
|
size: number;
|
|
246
229
|
};
|
|
247
|
-
waveform?: number[] | undefined;
|
|
248
230
|
durationMs?: number | undefined;
|
|
249
231
|
alt?: string | undefined;
|
|
250
|
-
|
|
251
|
-
langs?: string[] | undefined;
|
|
252
|
-
selfLabels?: string[] | undefined;
|
|
253
|
-
}, {
|
|
254
|
-
text?: string | undefined;
|
|
255
|
-
processing?: {
|
|
256
|
-
denoise?: boolean | undefined;
|
|
257
|
-
trim?: boolean | undefined;
|
|
258
|
-
transcribe?: boolean | undefined;
|
|
259
|
-
waveform?: boolean | undefined;
|
|
260
|
-
reprocess?: boolean | undefined;
|
|
232
|
+
waveform?: number[] | undefined;
|
|
261
233
|
} | undefined;
|
|
262
234
|
reply?: {
|
|
263
235
|
root: {
|
|
@@ -269,6 +241,17 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
269
241
|
cid: string;
|
|
270
242
|
};
|
|
271
243
|
} | undefined;
|
|
244
|
+
langs?: string[] | undefined;
|
|
245
|
+
selfLabels?: string[] | undefined;
|
|
246
|
+
processing?: {
|
|
247
|
+
waveform?: boolean | undefined;
|
|
248
|
+
transcribe?: boolean | undefined;
|
|
249
|
+
denoise?: boolean | undefined;
|
|
250
|
+
trim?: boolean | undefined;
|
|
251
|
+
reprocess?: boolean | undefined;
|
|
252
|
+
} | undefined;
|
|
253
|
+
}, {
|
|
254
|
+
text?: string | undefined;
|
|
272
255
|
title?: string | undefined;
|
|
273
256
|
embed?: {
|
|
274
257
|
$type: "dev.antiphony.embed.audio";
|
|
@@ -280,20 +263,9 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
280
263
|
mimeType: string;
|
|
281
264
|
size: number;
|
|
282
265
|
};
|
|
283
|
-
waveform?: number[] | undefined;
|
|
284
266
|
durationMs?: number | undefined;
|
|
285
267
|
alt?: string | undefined;
|
|
286
|
-
|
|
287
|
-
langs?: string[] | undefined;
|
|
288
|
-
selfLabels?: string[] | undefined;
|
|
289
|
-
}>, {
|
|
290
|
-
text: string;
|
|
291
|
-
processing?: {
|
|
292
|
-
denoise?: boolean | undefined;
|
|
293
|
-
trim?: boolean | undefined;
|
|
294
|
-
transcribe?: boolean | undefined;
|
|
295
|
-
waveform?: boolean | undefined;
|
|
296
|
-
reprocess?: boolean | undefined;
|
|
268
|
+
waveform?: number[] | undefined;
|
|
297
269
|
} | undefined;
|
|
298
270
|
reply?: {
|
|
299
271
|
root: {
|
|
@@ -305,6 +277,17 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
305
277
|
cid: string;
|
|
306
278
|
};
|
|
307
279
|
} | undefined;
|
|
280
|
+
langs?: string[] | undefined;
|
|
281
|
+
selfLabels?: string[] | undefined;
|
|
282
|
+
processing?: {
|
|
283
|
+
waveform?: boolean | undefined;
|
|
284
|
+
transcribe?: boolean | undefined;
|
|
285
|
+
denoise?: boolean | undefined;
|
|
286
|
+
trim?: boolean | undefined;
|
|
287
|
+
reprocess?: boolean | undefined;
|
|
288
|
+
} | undefined;
|
|
289
|
+
}>, {
|
|
290
|
+
text: string;
|
|
308
291
|
title?: string | undefined;
|
|
309
292
|
embed?: {
|
|
310
293
|
$type: "dev.antiphony.embed.audio";
|
|
@@ -316,20 +299,9 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
316
299
|
mimeType: string;
|
|
317
300
|
size: number;
|
|
318
301
|
};
|
|
319
|
-
waveform?: number[] | undefined;
|
|
320
302
|
durationMs?: number | undefined;
|
|
321
303
|
alt?: string | undefined;
|
|
322
|
-
|
|
323
|
-
langs?: string[] | undefined;
|
|
324
|
-
selfLabels?: string[] | undefined;
|
|
325
|
-
}, {
|
|
326
|
-
text?: string | undefined;
|
|
327
|
-
processing?: {
|
|
328
|
-
denoise?: boolean | undefined;
|
|
329
|
-
trim?: boolean | undefined;
|
|
330
|
-
transcribe?: boolean | undefined;
|
|
331
|
-
waveform?: boolean | undefined;
|
|
332
|
-
reprocess?: boolean | undefined;
|
|
304
|
+
waveform?: number[] | undefined;
|
|
333
305
|
} | undefined;
|
|
334
306
|
reply?: {
|
|
335
307
|
root: {
|
|
@@ -341,6 +313,17 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
341
313
|
cid: string;
|
|
342
314
|
};
|
|
343
315
|
} | undefined;
|
|
316
|
+
langs?: string[] | undefined;
|
|
317
|
+
selfLabels?: string[] | undefined;
|
|
318
|
+
processing?: {
|
|
319
|
+
waveform?: boolean | undefined;
|
|
320
|
+
transcribe?: boolean | undefined;
|
|
321
|
+
denoise?: boolean | undefined;
|
|
322
|
+
trim?: boolean | undefined;
|
|
323
|
+
reprocess?: boolean | undefined;
|
|
324
|
+
} | undefined;
|
|
325
|
+
}, {
|
|
326
|
+
text?: string | undefined;
|
|
344
327
|
title?: string | undefined;
|
|
345
328
|
embed?: {
|
|
346
329
|
$type: "dev.antiphony.embed.audio";
|
|
@@ -352,12 +335,29 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
352
335
|
mimeType: string;
|
|
353
336
|
size: number;
|
|
354
337
|
};
|
|
355
|
-
waveform?: number[] | undefined;
|
|
356
338
|
durationMs?: number | undefined;
|
|
357
339
|
alt?: string | undefined;
|
|
340
|
+
waveform?: number[] | undefined;
|
|
341
|
+
} | undefined;
|
|
342
|
+
reply?: {
|
|
343
|
+
root: {
|
|
344
|
+
uri: string;
|
|
345
|
+
cid: string;
|
|
346
|
+
};
|
|
347
|
+
parent: {
|
|
348
|
+
uri: string;
|
|
349
|
+
cid: string;
|
|
350
|
+
};
|
|
358
351
|
} | undefined;
|
|
359
352
|
langs?: string[] | undefined;
|
|
360
353
|
selfLabels?: string[] | undefined;
|
|
354
|
+
processing?: {
|
|
355
|
+
waveform?: boolean | undefined;
|
|
356
|
+
transcribe?: boolean | undefined;
|
|
357
|
+
denoise?: boolean | undefined;
|
|
358
|
+
trim?: boolean | undefined;
|
|
359
|
+
reprocess?: boolean | undefined;
|
|
360
|
+
} | undefined;
|
|
361
361
|
}>;
|
|
362
362
|
type CreateAudioPostRequest = z.infer<typeof CreateAudioPostRequestSchema>;
|
|
363
363
|
/**
|
|
@@ -379,32 +379,32 @@ declare const PatchAudioPostRequestSchema: z.ZodObject<{
|
|
|
379
379
|
waveform: z.ZodOptional<z.ZodBoolean>;
|
|
380
380
|
reprocess: z.ZodOptional<z.ZodBoolean>;
|
|
381
381
|
}, "strip", z.ZodTypeAny, {
|
|
382
|
+
waveform?: boolean | undefined;
|
|
383
|
+
transcribe?: boolean | undefined;
|
|
382
384
|
denoise?: boolean | undefined;
|
|
383
385
|
trim?: boolean | undefined;
|
|
384
|
-
transcribe?: boolean | undefined;
|
|
385
|
-
waveform?: boolean | undefined;
|
|
386
386
|
reprocess?: boolean | undefined;
|
|
387
387
|
}, {
|
|
388
|
+
waveform?: boolean | undefined;
|
|
389
|
+
transcribe?: boolean | undefined;
|
|
388
390
|
denoise?: boolean | undefined;
|
|
389
391
|
trim?: boolean | undefined;
|
|
390
|
-
transcribe?: boolean | undefined;
|
|
391
|
-
waveform?: boolean | undefined;
|
|
392
392
|
reprocess?: boolean | undefined;
|
|
393
393
|
}>;
|
|
394
394
|
}, "strip", z.ZodTypeAny, {
|
|
395
395
|
processing: {
|
|
396
|
+
waveform?: boolean | undefined;
|
|
397
|
+
transcribe?: boolean | undefined;
|
|
396
398
|
denoise?: boolean | undefined;
|
|
397
399
|
trim?: boolean | undefined;
|
|
398
|
-
transcribe?: boolean | undefined;
|
|
399
|
-
waveform?: boolean | undefined;
|
|
400
400
|
reprocess?: boolean | undefined;
|
|
401
401
|
};
|
|
402
402
|
}, {
|
|
403
403
|
processing: {
|
|
404
|
+
waveform?: boolean | undefined;
|
|
405
|
+
transcribe?: boolean | undefined;
|
|
404
406
|
denoise?: boolean | undefined;
|
|
405
407
|
trim?: boolean | undefined;
|
|
406
|
-
transcribe?: boolean | undefined;
|
|
407
|
-
waveform?: boolean | undefined;
|
|
408
408
|
reprocess?: boolean | undefined;
|
|
409
409
|
};
|
|
410
410
|
}>;
|
package/dist/esm/api-codecs.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export { CreateAudioPostRequestSchema, PatchAudioPostRequestSchema } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-D655OH2I.js';
|
|
1
|
+
export { CreateAudioPostRequestSchema, PatchAudioPostRequestSchema } from './chunk-6EJLU4LG.js';
|
|
2
|
+
import './chunk-QQ5GOLYW.js';
|
|
4
3
|
import './chunk-SMK4OZNU.js';
|
|
4
|
+
import './chunk-AKIWUNNK.js';
|
|
5
|
+
import './chunk-D655OH2I.js';
|
|
6
|
+
import './chunk-KMQWUFMV.js';
|
|
5
7
|
import './chunk-5JBD5THX.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReplyRefSchema, AudioEmbedSchema } from './chunk-QQ5GOLYW.js';
|
|
2
|
+
import { ProcessingRequestSchema } from './chunk-AKIWUNNK.js';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
4
5
|
var CreateAudioPostRequestSchema = z.object({
|
|
@@ -11,9 +12,9 @@ var CreateAudioPostRequestSchema = z.object({
|
|
|
11
12
|
/** Present ⇒ this is a reply (StrongRef root + parent). */
|
|
12
13
|
reply: ReplyRefSchema.optional(),
|
|
13
14
|
/** BCP-47 language tags. */
|
|
14
|
-
langs: z.array(z.string()).max(3).optional(),
|
|
15
|
+
langs: z.array(z.string().max(35)).max(3).optional(),
|
|
15
16
|
/** Author self-label values (content warnings). */
|
|
16
|
-
selfLabels: z.array(z.string()).optional(),
|
|
17
|
+
selfLabels: z.array(z.string().max(128)).max(10).optional(),
|
|
17
18
|
/**
|
|
18
19
|
* Opt-in audio processing for this post's audio (denoise / trim /
|
|
19
20
|
* transcribe / waveform). All default off. Stages the deployment can't
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { FirestoreTimestampSchema } from './chunk-D655OH2I.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
var ProcessingStageStatusSchema = z.enum(["pending", "ready", "failed", "skipped"]);
|
|
5
|
+
var PROCESSING_STAGES = ["denoise", "trim", "transcribe", "waveform"];
|
|
6
|
+
var ProcessingStageSchema = z.enum(PROCESSING_STAGES);
|
|
7
|
+
var BYTE_MUTATING_STAGES = ["denoise", "trim"];
|
|
8
|
+
var DERIVED_STAGES = ["transcribe", "waveform"];
|
|
9
|
+
var ProcessingRequestSchema = z.object({
|
|
10
|
+
transcribe: z.boolean().optional(),
|
|
11
|
+
denoise: z.boolean().optional(),
|
|
12
|
+
trim: z.boolean().optional(),
|
|
13
|
+
waveform: z.boolean().optional(),
|
|
14
|
+
/**
|
|
15
|
+
* Whether a completed byte-mutating stage should invalidate and recompute
|
|
16
|
+
* the derived artifacts that describe the old audio. Defaults to **true**
|
|
17
|
+
* — a transcript of superseded audio is wrong, not merely stale.
|
|
18
|
+
*
|
|
19
|
+
* `false` opts out, for an app that would rather keep the existing
|
|
20
|
+
* transcript than pay to regenerate it. It does NOT name a stage, so a
|
|
21
|
+
* request carrying only `reprocess` requests no work.
|
|
22
|
+
*/
|
|
23
|
+
reprocess: z.boolean().optional()
|
|
24
|
+
});
|
|
25
|
+
var ProcessingStageMapSchema = z.object({
|
|
26
|
+
transcribe: ProcessingStageStatusSchema.optional(),
|
|
27
|
+
denoise: ProcessingStageStatusSchema.optional(),
|
|
28
|
+
trim: ProcessingStageStatusSchema.optional(),
|
|
29
|
+
waveform: ProcessingStageStatusSchema.optional()
|
|
30
|
+
});
|
|
31
|
+
var ResolvedProcessingSchema = ProcessingStageMapSchema.extend({
|
|
32
|
+
reprocess: z.boolean().optional()
|
|
33
|
+
});
|
|
34
|
+
var ProcessingStateSchema = ResolvedProcessingSchema.extend({
|
|
35
|
+
/**
|
|
36
|
+
* Content CID of the processed audio variant — the composed output of every
|
|
37
|
+
* byte-mutating stage that has completed. The record's own
|
|
38
|
+
* `embed.audio.ref.$link` stays the ORIGINAL CID (immutable content
|
|
39
|
+
* address); only the read-time view swaps playback to this variant.
|
|
40
|
+
*/
|
|
41
|
+
processedBlobCid: z.string().optional(),
|
|
42
|
+
/**
|
|
43
|
+
* MIME type of the processed variant. Present because providers may
|
|
44
|
+
* TRANSCODE — the ElevenLabs Voice Isolator returns MP3 regardless of what
|
|
45
|
+
* it is given — so the variant's type cannot be assumed to match
|
|
46
|
+
* `embed.audio.mimeType`. Anything reading the variant's bytes must use
|
|
47
|
+
* this, not the embed's.
|
|
48
|
+
*/
|
|
49
|
+
processedMimeType: z.string().optional(),
|
|
50
|
+
/**
|
|
51
|
+
* Duration of the processed variant, when a byte-mutating stage changed it
|
|
52
|
+
* (i.e. trim). Absent when the variant's duration matches the original.
|
|
53
|
+
*/
|
|
54
|
+
processedDurationMs: z.number().int().min(0).optional(),
|
|
55
|
+
/**
|
|
56
|
+
* Which denoiser produced the variant's denoise contribution — provenance,
|
|
57
|
+
* the counterpart to a transcript record's `model`.
|
|
58
|
+
*
|
|
59
|
+
* Lives here because a cleaned variant, unlike a transcript, has no record
|
|
60
|
+
* of its own to carry it: it is a blob CID on this state. Without it,
|
|
61
|
+
* changing denoisers leaves no way to tell which variants predate the
|
|
62
|
+
* switch, so nothing can identify what to re-run.
|
|
63
|
+
*
|
|
64
|
+
* Named for the STAGE, not the variant (`processedModel`), because it
|
|
65
|
+
* describes one link of the byte-mutating chain rather than the composed
|
|
66
|
+
* artifact. Trim contributes to the same variant and has no model, and a
|
|
67
|
+
* later external link would want its own field rather than to overwrite
|
|
68
|
+
* this one.
|
|
69
|
+
*
|
|
70
|
+
* Written on every successful denoise, never cleared — it moves with
|
|
71
|
+
* `processedBlobCid`, which is only ever set, never reset. A denoise that
|
|
72
|
+
* FAILS leaves both alone, which is correct: the variant still holds the
|
|
73
|
+
* previous denoiser's output, so the previous model still describes it.
|
|
74
|
+
*
|
|
75
|
+
* Internal, like the other variant fields — `toProcessingView` projects
|
|
76
|
+
* stages only, so this never reaches a client.
|
|
77
|
+
*/
|
|
78
|
+
denoiseModel: z.string().optional(),
|
|
79
|
+
/**
|
|
80
|
+
* Peaks for the processed variant, once the `waveform` stage completes.
|
|
81
|
+
* Same normalization and bounds as `embed.waveform` (0–100, max 1000), so
|
|
82
|
+
* a view can never carry a larger payload than the record allows.
|
|
83
|
+
*/
|
|
84
|
+
waveformPeaks: z.array(z.number().int().min(0).max(100)).max(1e3).optional(),
|
|
85
|
+
/**
|
|
86
|
+
* When the current runner's exclusive claim on this post expires.
|
|
87
|
+
*
|
|
88
|
+
* Queue delivery is at-least-once, so the same job can arrive twice and
|
|
89
|
+
* run CONCURRENTLY. `process()` is idempotent under sequential retry — it
|
|
90
|
+
* acts on `pending` and re-does nothing already settled — but two passes
|
|
91
|
+
* interleaved is a different failure: both read the same `pending` state,
|
|
92
|
+
* both bill the provider for the same stage, and both write
|
|
93
|
+
* `processedBlobCid`, so the surviving variant is whichever finished last
|
|
94
|
+
* and the other's blob is orphaned.
|
|
95
|
+
*
|
|
96
|
+
* A runner claims this field transactionally before doing any work and
|
|
97
|
+
* clears it when finished; a second runner finding it unexpired declines
|
|
98
|
+
* and returns. It is an EXPIRY, not a boolean lock, because the holder can
|
|
99
|
+
* die mid-run (instance recycled, process killed) with no chance to
|
|
100
|
+
* release — a plain flag would strand the post permanently, where a lapsed
|
|
101
|
+
* lease lets the next delivery pick it up.
|
|
102
|
+
*
|
|
103
|
+
* Internal, like the variant fields above: `toProcessingView` projects
|
|
104
|
+
* stages only, so this never reaches a client.
|
|
105
|
+
*/
|
|
106
|
+
leaseUntil: FirestoreTimestampSchema.optional(),
|
|
107
|
+
updatedAt: FirestoreTimestampSchema
|
|
108
|
+
});
|
|
109
|
+
var ProcessingViewSchema = ProcessingStageMapSchema;
|
|
110
|
+
function toProcessingView(state) {
|
|
111
|
+
const view = {};
|
|
112
|
+
for (const stage of PROCESSING_STAGES) {
|
|
113
|
+
if (state[stage] !== void 0) view[stage] = state[stage];
|
|
114
|
+
}
|
|
115
|
+
return view;
|
|
116
|
+
}
|
|
117
|
+
function resolveAudioVariant(canonical, state) {
|
|
118
|
+
var _a;
|
|
119
|
+
if (!state) return canonical;
|
|
120
|
+
const hasVariant = state.processedBlobCid !== void 0;
|
|
121
|
+
const peaksAreCurrent = state.waveform === "ready" && state.waveformPeaks !== void 0;
|
|
122
|
+
return {
|
|
123
|
+
blobCid: hasVariant ? state.processedBlobCid : canonical.blobCid,
|
|
124
|
+
durationMs: hasVariant ? (_a = state.processedDurationMs) != null ? _a : canonical.durationMs : canonical.durationMs,
|
|
125
|
+
waveform: peaksAreCurrent ? state.waveformPeaks : canonical.waveform
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export { BYTE_MUTATING_STAGES, DERIVED_STAGES, PROCESSING_STAGES, ProcessingRequestSchema, ProcessingStageMapSchema, ProcessingStageSchema, ProcessingStageStatusSchema, ProcessingStateSchema, ProcessingViewSchema, ResolvedProcessingSchema, resolveAudioVariant, toProcessingView };
|
|
@@ -14,10 +14,19 @@ var EMBED_NSID = {
|
|
|
14
14
|
Audio: "dev.antiphony.embed.audio",
|
|
15
15
|
RecordWithAudio: "dev.antiphony.embed.recordWithAudio"
|
|
16
16
|
};
|
|
17
|
+
var XRPC_NSID = {
|
|
18
|
+
// Queries (GET).
|
|
19
|
+
GetPost: "dev.antiphony.audio.getPost",
|
|
20
|
+
GetThread: "dev.antiphony.audio.getThread",
|
|
21
|
+
GetPlaybackUrl: "dev.antiphony.audio.getPlaybackUrl",
|
|
22
|
+
// Procedures (POST).
|
|
23
|
+
CreatePost: "dev.antiphony.audio.createPost",
|
|
24
|
+
ReprocessPost: "dev.antiphony.audio.reprocessPost"
|
|
25
|
+
};
|
|
17
26
|
var COLLECTIONS = {
|
|
18
27
|
// One post collection + the transcript enrichment namespace.
|
|
19
28
|
[NSID.AudioPost]: "posts",
|
|
20
29
|
[NSID.AudioTranscript]: "audio_transcripts"
|
|
21
30
|
};
|
|
22
31
|
|
|
23
|
-
export { COLLECTIONS, EMBED_NSID, NSID };
|
|
32
|
+
export { COLLECTIONS, EMBED_NSID, NSID, XRPC_NSID };
|