@vocasync/astro 0.1.10 → 1.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/README.md +77 -41
- package/dist/api/client.d.ts +63 -50
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +132 -145
- package/dist/api/client.js.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/cli.js +7 -7
- package/dist/cli.js.map +1 -1
- package/dist/components/AudioPlayer.astro +136 -137
- package/dist/config/schema.d.ts +21 -20
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +15 -4
- package/dist/config/schema.js.map +1 -1
- package/dist/core/audio-map.js +1 -1
- package/dist/core/speech-builder.d.ts +10 -7
- package/dist/core/speech-builder.d.ts.map +1 -1
- package/dist/core/speech-builder.js +72 -116
- package/dist/core/speech-builder.js.map +1 -1
- package/dist/core/spoken-form.d.ts +52 -0
- package/dist/core/spoken-form.d.ts.map +1 -0
- package/dist/core/spoken-form.js +279 -0
- package/dist/core/spoken-form.js.map +1 -0
- package/dist/lib/latex-to-speech/index.d.ts.map +1 -1
- package/dist/lib/latex-to-speech/index.js +9 -11
- package/dist/lib/latex-to-speech/index.js.map +1 -1
- package/dist/lib/latex-to-speech/speak.d.ts +7 -2
- package/dist/lib/latex-to-speech/speak.d.ts.map +1 -1
- package/dist/lib/latex-to-speech/speak.js +10 -27
- package/dist/lib/latex-to-speech/speak.js.map +1 -1
- package/dist/rehype/audio-words.d.ts +14 -24
- package/dist/rehype/audio-words.d.ts.map +1 -1
- package/dist/rehype/audio-words.js +131 -252
- package/dist/rehype/audio-words.js.map +1 -1
- package/dist/rehype/index.d.ts +1 -2
- package/dist/rehype/index.d.ts.map +1 -1
- package/dist/rehype/index.js +0 -1
- package/dist/rehype/index.js.map +1 -1
- package/dist/rehype/rehype-math-speech.d.ts +26 -10
- package/dist/rehype/rehype-math-speech.d.ts.map +1 -1
- package/dist/rehype/rehype-math-speech.js +59 -43
- package/dist/rehype/rehype-math-speech.js.map +1 -1
- package/dist/rehype/shared.d.ts +9 -0
- package/dist/rehype/shared.d.ts.map +1 -0
- package/dist/rehype/shared.js +31 -0
- package/dist/rehype/shared.js.map +1 -0
- package/dist/sync/orchestrator.d.ts +4 -22
- package/dist/sync/orchestrator.d.ts.map +1 -1
- package/dist/sync/orchestrator.js +123 -123
- package/dist/sync/orchestrator.js.map +1 -1
- package/dist/types/index.d.ts +82 -46
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +14 -11
- package/src/api/client.ts +175 -190
- package/src/api/index.ts +8 -1
- package/src/cli.ts +7 -14
- package/src/components/AudioPlayer.astro +136 -137
- package/src/config/schema.ts +15 -4
- package/src/core/audio-map.ts +1 -1
- package/src/core/speech-builder.ts +74 -130
- package/src/core/spoken-form.ts +298 -0
- package/src/lib/latex-to-speech/index.ts +8 -9
- package/src/lib/latex-to-speech/speak.ts +11 -34
- package/src/rehype/audio-words.ts +145 -307
- package/src/rehype/index.ts +1 -2
- package/src/rehype/rehype-math-speech.ts +64 -59
- package/src/rehype/shared.ts +36 -0
- package/src/sync/orchestrator.ts +150 -157
- package/src/types/index.ts +85 -47
- package/dist/rehype/remark-math-speech.d.ts +0 -14
- package/dist/rehype/remark-math-speech.d.ts.map +0 -1
- package/dist/rehype/remark-math-speech.js +0 -27
- package/dist/rehype/remark-math-speech.js.map +0 -1
- package/src/rehype/remark-math-speech.ts +0 -32
|
@@ -1,176 +1,177 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toAlignmentLocale, withPublishableKey } from "../api/client.js";
|
|
2
|
+
import { FormatSchema, LanguageSchema, VoiceSchema } from "../config/index.js";
|
|
2
3
|
import { getAudioEntry, loadAudioMap, saveAudioMap, setAudioEntry } from "../core/audio-map.js";
|
|
3
4
|
import { loadContent } from "../core/content-loader.js";
|
|
4
|
-
import {
|
|
5
|
+
import { computeHash } from "../core/hash-manager.js";
|
|
5
6
|
import { buildSpeechDocument } from "../core/speech-builder.js";
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
/** Resolve effective synthesis params from per-post frontmatter, falling back to config. */
|
|
8
|
+
function resolveParams(item, config) {
|
|
9
|
+
const fm = item.frontmatter;
|
|
10
|
+
let voice = config.synthesis.voice;
|
|
11
|
+
if (fm.voice !== undefined && fm.voice !== null) {
|
|
12
|
+
const parsed = VoiceSchema.safeParse(fm.voice);
|
|
13
|
+
if (!parsed.success)
|
|
14
|
+
return { error: `invalid frontmatter voice "${String(fm.voice)}"` };
|
|
15
|
+
voice = parsed.data;
|
|
16
|
+
}
|
|
17
|
+
let language = config.language;
|
|
18
|
+
if (fm.language !== undefined && fm.language !== null) {
|
|
19
|
+
const parsed = LanguageSchema.safeParse(fm.language);
|
|
20
|
+
if (!parsed.success)
|
|
21
|
+
return { error: `invalid frontmatter language "${String(fm.language)}"` };
|
|
22
|
+
language = parsed.data;
|
|
23
|
+
}
|
|
24
|
+
let format = config.synthesis.format;
|
|
25
|
+
if (fm.format !== undefined && fm.format !== null) {
|
|
26
|
+
const parsed = FormatSchema.safeParse(fm.format);
|
|
27
|
+
if (!parsed.success)
|
|
28
|
+
return { error: `invalid frontmatter format "${String(fm.format)}"` };
|
|
29
|
+
format = parsed.data;
|
|
30
|
+
}
|
|
31
|
+
return { voice, language, format };
|
|
32
|
+
}
|
|
33
|
+
/** True when an existing entry is a complete v3 artifact matching the hash. */
|
|
34
|
+
function isUpToDate(entry, contentHash) {
|
|
35
|
+
return Boolean(entry &&
|
|
36
|
+
entry.contentHash === contentHash &&
|
|
37
|
+
entry.synthesisProjectUuid &&
|
|
38
|
+
entry.alignmentProjectUuid &&
|
|
39
|
+
Array.isArray(entry.words));
|
|
40
|
+
}
|
|
41
|
+
/** Orchestrate the full sync: load -> build -> two-POST synthesis+alignment -> persist. */
|
|
16
42
|
export async function sync(config, client, options = {}) {
|
|
17
43
|
const { only, force = false, dryRun = false, onProgress = () => { } } = options;
|
|
18
44
|
const results = [];
|
|
19
45
|
let unchanged = 0;
|
|
20
46
|
let synced = 0;
|
|
21
47
|
let errors = 0;
|
|
22
|
-
// Load existing audio map
|
|
23
48
|
onProgress("Loading audio map...", "info");
|
|
24
49
|
const audioMap = await loadAudioMap(config.output.audioMapPath);
|
|
25
|
-
// Load content from collection
|
|
26
50
|
onProgress(`Loading content from ${config.collection.name}...`, "info");
|
|
27
51
|
let items = await loadContent(config.collection, config.frontmatterField);
|
|
28
|
-
// Filter by slug if specified
|
|
29
52
|
if (only) {
|
|
30
53
|
items = items.filter((item) => item.slug === only);
|
|
31
|
-
if (items.length === 0)
|
|
54
|
+
if (items.length === 0)
|
|
32
55
|
throw new Error(`No content found with slug: ${only}`);
|
|
33
|
-
}
|
|
34
56
|
}
|
|
35
57
|
onProgress(`Found ${items.length} content items`, "info");
|
|
36
|
-
// Process each item
|
|
37
58
|
for (const item of items) {
|
|
38
59
|
const result = await processItem(item, config, client, audioMap, { force, dryRun, onProgress });
|
|
39
60
|
results.push(result);
|
|
40
|
-
if (result.status === "unchanged")
|
|
61
|
+
if (result.status === "unchanged")
|
|
41
62
|
unchanged++;
|
|
42
|
-
|
|
43
|
-
else if (result.status === "error") {
|
|
63
|
+
else if (result.status === "error")
|
|
44
64
|
errors++;
|
|
45
|
-
|
|
46
|
-
else {
|
|
65
|
+
else
|
|
47
66
|
synced++;
|
|
48
|
-
}
|
|
49
67
|
}
|
|
50
|
-
// Save updated audio map
|
|
51
68
|
if (!dryRun && synced > 0) {
|
|
52
69
|
onProgress("Saving audio map...", "info");
|
|
70
|
+
audioMap.version = 3;
|
|
53
71
|
await saveAudioMap(config.output.audioMapPath, audioMap);
|
|
54
72
|
}
|
|
55
|
-
return {
|
|
56
|
-
total: items.length,
|
|
57
|
-
unchanged,
|
|
58
|
-
synced,
|
|
59
|
-
errors,
|
|
60
|
-
results,
|
|
61
|
-
};
|
|
73
|
+
return { total: items.length, unchanged, synced, errors, results };
|
|
62
74
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Process a single content item.
|
|
65
|
-
*/
|
|
66
75
|
async function processItem(item, config, client, audioMap, options) {
|
|
67
76
|
const { force, dryRun, onProgress } = options;
|
|
68
77
|
try {
|
|
69
|
-
|
|
78
|
+
const resolved = resolveParams(item, config);
|
|
79
|
+
if ("error" in resolved) {
|
|
80
|
+
onProgress(`⚠ ${item.slug} - skipped: ${resolved.error}`, "warn");
|
|
81
|
+
return { slug: item.slug, status: "error", error: resolved.error };
|
|
82
|
+
}
|
|
83
|
+
const { voice, language, format } = resolved;
|
|
70
84
|
const speechDoc = await buildSpeechDocument(item, { math: config.math });
|
|
71
|
-
|
|
85
|
+
const contentHash = computeHash(JSON.stringify([speechDoc.normalisedSpeechtext, voice, language, format]));
|
|
72
86
|
const existingEntry = getAudioEntry(audioMap, item.slug);
|
|
73
|
-
|
|
74
|
-
// Check if existing entry is missing publishable key (migration from v1)
|
|
75
|
-
const needsPublishableKey = existingEntry && !existingEntry.publishableKey;
|
|
76
|
-
if (!force && !contentChanged && existingEntry && !needsPublishableKey) {
|
|
87
|
+
if (!force && isUpToDate(existingEntry, contentHash)) {
|
|
77
88
|
onProgress(`⏭ ${item.slug} - unchanged`, "info");
|
|
78
89
|
return { slug: item.slug, status: "unchanged" };
|
|
79
90
|
}
|
|
80
|
-
// If only missing publishable key, create it without re-synthesizing
|
|
81
|
-
if (!force && !contentChanged && existingEntry && needsPublishableKey) {
|
|
82
|
-
onProgress(`🔑 ${item.slug} - creating missing publishable key...`, "info");
|
|
83
|
-
if (dryRun) {
|
|
84
|
-
onProgress(`🔍 ${item.slug} - would create publishable key (dry run)`, "info");
|
|
85
|
-
return { slug: item.slug, status: "unchanged" };
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
const { publishableKey } = await client.createPublishableKey(existingEntry.projectUuid);
|
|
89
|
-
// Update existing entry with publishable key
|
|
90
|
-
const updatedArtifact = {
|
|
91
|
-
...existingEntry,
|
|
92
|
-
publishableKey,
|
|
93
|
-
updatedAt: new Date().toISOString(),
|
|
94
|
-
};
|
|
95
|
-
setAudioEntry(audioMap, item.slug, updatedArtifact);
|
|
96
|
-
onProgress(`✅ ${item.slug} - publishable key added`, "success");
|
|
97
|
-
return { slug: item.slug, status: "updated", projectUuid: existingEntry.projectUuid };
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
101
|
-
onProgress(`❌ ${item.slug} - failed to create publishable key: ${message}`, "error");
|
|
102
|
-
return { slug: item.slug, status: "error", error: message };
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
91
|
const status = existingEntry ? "updated" : "new";
|
|
106
|
-
onProgress(`📤 ${item.slug} - ${status}, submitting...`, "info");
|
|
107
92
|
if (dryRun) {
|
|
108
|
-
onProgress(`🔍 ${item.slug} - would ${status} (dry run
|
|
93
|
+
onProgress(`🔍 ${item.slug} - would ${status} (voice=${voice}, lang=${language}) [dry run]`, "info");
|
|
109
94
|
return { slug: item.slug, status };
|
|
110
95
|
}
|
|
111
|
-
//
|
|
112
|
-
|
|
96
|
+
// 1. Synthesis ------------------------------------------------------------
|
|
97
|
+
onProgress(`📤 ${item.slug} - synthesizing (voice=${voice}, lang=${language})...`, "info");
|
|
98
|
+
const synthesis = await client.synthesize({
|
|
113
99
|
name: `astro-${item.slug}`,
|
|
114
|
-
text: speechDoc.
|
|
115
|
-
voice
|
|
100
|
+
text: speechDoc.speechtext,
|
|
101
|
+
voice,
|
|
116
102
|
quality: config.synthesis.quality,
|
|
117
|
-
language
|
|
103
|
+
language,
|
|
104
|
+
outputFormat: format,
|
|
118
105
|
});
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
onProgress: (status) => {
|
|
123
|
-
const synthStatus = status.synthesisJob?.status || "pending";
|
|
124
|
-
const alignStatus = status.alignmentJob?.status || "pending";
|
|
125
|
-
onProgress(` synth: ${synthStatus}, align: ${alignStatus}`, "info");
|
|
126
|
-
},
|
|
106
|
+
const synthUuid = synthesis.projectUuid;
|
|
107
|
+
await client.pollUntilComplete(synthUuid, {
|
|
108
|
+
onProgress: (s) => onProgress(` synthesis: ${s.status}`, "info"),
|
|
127
109
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
110
|
+
const synthesisPublishableKey = await client.createPublishableKey(synthUuid);
|
|
111
|
+
// 2. Alignment (explicit, client-supplied transcript) ---------------------
|
|
112
|
+
onProgress(`🔗 ${item.slug} - aligning...`, "info");
|
|
113
|
+
const audioStreamUrl = client.streamUrl(synthUuid, "synthesis");
|
|
114
|
+
const { bytes: audioBytes, contentType } = await client.downloadBytes(withPublishableKey(audioStreamUrl, synthesisPublishableKey));
|
|
115
|
+
const transcriptBytes = new TextEncoder().encode(speechDoc.normalisedSpeechtext);
|
|
116
|
+
const alignmentLocale = toAlignmentLocale(language);
|
|
117
|
+
const presign = await client.presignAlignment({
|
|
118
|
+
audioName: `synthesis.${format}`,
|
|
119
|
+
audioType: contentType,
|
|
120
|
+
audioSize: audioBytes.byteLength,
|
|
121
|
+
transcriptSize: transcriptBytes.byteLength,
|
|
122
|
+
language: alignmentLocale,
|
|
123
|
+
});
|
|
124
|
+
await client.uploadToPresigned(presign.audio.uploadUrl, audioBytes, contentType);
|
|
125
|
+
await client.uploadToPresigned(presign.transcript.uploadUrl, transcriptBytes, "text/plain");
|
|
126
|
+
await client.submitAlignment({
|
|
127
|
+
projectUuid: presign.projectUuid,
|
|
128
|
+
audioFileKey: presign.audio.key,
|
|
129
|
+
transcriptFileKey: presign.transcript.key,
|
|
130
|
+
audioFileSizeBytes: audioBytes.byteLength,
|
|
131
|
+
transcriptFileSizeBytes: transcriptBytes.byteLength,
|
|
132
|
+
language: alignmentLocale,
|
|
133
|
+
projectName: `astro-${item.slug}`,
|
|
134
|
+
});
|
|
135
|
+
const alignUuid = presign.projectUuid;
|
|
136
|
+
await client.pollUntilComplete(alignUuid, {
|
|
137
|
+
onProgress: (s) => onProgress(` alignment: ${s.status}`, "info"),
|
|
138
|
+
});
|
|
139
|
+
const alignmentPublishableKey = await client.createPublishableKey(alignUuid);
|
|
140
|
+
// 3. Fetch timings + persist ---------------------------------------------
|
|
141
|
+
const { words, duration } = await client.fetchAlignmentWords(withPublishableKey(client.streamUrl(alignUuid, "alignment"), alignmentPublishableKey));
|
|
142
|
+
// The alignment stream may omit total duration; fall back to the last word's end.
|
|
143
|
+
const effectiveDuration = duration || (words.length ? words[words.length - 1].end : 0);
|
|
144
|
+
const now = new Date().toISOString();
|
|
139
145
|
const artifact = {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
contentHash,
|
|
147
|
+
voice,
|
|
148
|
+
language,
|
|
149
|
+
format,
|
|
150
|
+
synthesisProjectUuid: synthUuid,
|
|
151
|
+
synthesisPublishableKey,
|
|
152
|
+
audioUrl: audioStreamUrl,
|
|
153
|
+
alignmentProjectUuid: alignUuid,
|
|
154
|
+
alignmentPublishableKey,
|
|
155
|
+
words,
|
|
156
|
+
duration: effectiveDuration,
|
|
157
|
+
mathSpeech: speechDoc.mathSpeech,
|
|
158
|
+
createdAt: existingEntry?.createdAt ?? now,
|
|
159
|
+
updatedAt: now,
|
|
148
160
|
};
|
|
149
|
-
// Update audio map
|
|
150
161
|
setAudioEntry(audioMap, item.slug, artifact);
|
|
151
|
-
onProgress(`✅ ${item.slug} - ${status} complete`, "success");
|
|
152
|
-
return {
|
|
153
|
-
slug: item.slug,
|
|
154
|
-
status,
|
|
155
|
-
projectUuid: response.projectUuid,
|
|
156
|
-
};
|
|
162
|
+
onProgress(`✅ ${item.slug} - ${status} complete (${words.length} words)`, "success");
|
|
163
|
+
return { slug: item.slug, status, projectUuid: synthUuid };
|
|
157
164
|
}
|
|
158
165
|
catch (error) {
|
|
159
166
|
const message = error instanceof Error ? error.message : String(error);
|
|
160
167
|
onProgress(`❌ ${item.slug} - error: ${message}`, "error");
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
status: "error",
|
|
164
|
-
error: message,
|
|
165
|
-
};
|
|
168
|
+
// Do not persist a partial entry; leave any prior entry intact.
|
|
169
|
+
return { slug: item.slug, status: "error", error: message };
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
|
-
/**
|
|
169
|
-
* Check if the configuration and API key are valid.
|
|
170
|
-
*/
|
|
172
|
+
/** Validate config + API key. Balance is returned by /me in cents. */
|
|
171
173
|
export async function checkConfig(config, client) {
|
|
172
174
|
try {
|
|
173
|
-
// Validate API key
|
|
174
175
|
const validation = await client.validateApiKey();
|
|
175
176
|
if (!validation.valid) {
|
|
176
177
|
return {
|
|
@@ -178,20 +179,19 @@ export async function checkConfig(config, client) {
|
|
|
178
179
|
message: "Invalid API key. Check your VOCASYNC_API_KEY environment variable.",
|
|
179
180
|
};
|
|
180
181
|
}
|
|
181
|
-
// Check content collection
|
|
182
182
|
const items = await loadContent(config.collection, config.frontmatterField);
|
|
183
|
+
const balance = validation.balanceCents !== undefined
|
|
184
|
+
? `$${(validation.balanceCents / 100).toFixed(2)}`
|
|
185
|
+
: "unknown";
|
|
183
186
|
return {
|
|
184
187
|
valid: true,
|
|
185
|
-
message: `Configuration valid. Found ${items.length} content items. Balance:
|
|
186
|
-
|
|
188
|
+
message: `Configuration valid. Found ${items.length} content items. Balance: ${balance}.`,
|
|
189
|
+
balanceCents: validation.balanceCents,
|
|
187
190
|
};
|
|
188
191
|
}
|
|
189
192
|
catch (error) {
|
|
190
193
|
const message = error instanceof Error ? error.message : String(error);
|
|
191
|
-
return {
|
|
192
|
-
valid: false,
|
|
193
|
-
message: `Configuration error: ${message}`,
|
|
194
|
-
};
|
|
194
|
+
return { valid: false, message: `Configuration error: ${message}` };
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/sync/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/sync/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,cAAc,EAAuB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAkBhE,4FAA4F;AAC5F,SAAS,aAAa,CACpB,IAAiB,EACjB,MAAsB;IAEtB,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC;IAE5B,IAAI,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,KAAe,CAAC;IAC7C,IAAI,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,OAAO,EAAE,KAAK,EAAE,8BAA8B,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACzF,KAAK,GAA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,YAAY,KAAK,SAAS;YACnC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAClD,CAAC,CAAC,SAAS,CAAC;QAEhB,OAAO;YACL,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,8BAA8B,KAAK,CAAC,MAAM,4BAA4B,OAAO,GAAG;YACzF,YAAY,EAAE,UAAU,CAAC,YAAY;SACtC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,wBAAwB,OAAO,EAAE,EAAE,CAAC;IACtE,CAAC;AACH,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,15 +12,26 @@ export interface ContentItem {
|
|
|
12
12
|
filePath: string;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Processed speech document ready for synthesis
|
|
15
|
+
* Processed speech document ready for synthesis + alignment.
|
|
16
|
+
*
|
|
17
|
+
* `speechtext` is POSTed to /synthesis (expanded spoken form, punctuation
|
|
18
|
+
* preserved). `normalisedSpeechtext` is POSTed as the alignment transcript
|
|
19
|
+
* (stripped form) and is the exact token stream the rehype plugin indexes.
|
|
16
20
|
*/
|
|
17
21
|
export interface SpeechDocument {
|
|
18
22
|
/** Unique slug identifier */
|
|
19
23
|
slug: string;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
+
/** Expanded spoken text for TTS synthesis */
|
|
25
|
+
speechtext: string;
|
|
26
|
+
/** Normalised transcript for alignment (token-for-token with data-i) */
|
|
27
|
+
normalisedSpeechtext: string;
|
|
28
|
+
/**
|
|
29
|
+
* Spoken form of each math expression, keyed by `${'d'|'i'}:${latex}`
|
|
30
|
+
* (d = display/block, i = inline). The rehype plugin reuses these so the
|
|
31
|
+
* math tokens it counts match what was synthesized — math-to-speech runs
|
|
32
|
+
* only here (Node/CLI), never in the Astro/Vite build.
|
|
33
|
+
*/
|
|
34
|
+
mathSpeech: Record<string, string>;
|
|
24
35
|
/** Source file path */
|
|
25
36
|
source: string;
|
|
26
37
|
}
|
|
@@ -36,21 +47,34 @@ export interface AlignedWord {
|
|
|
36
47
|
end: number;
|
|
37
48
|
}
|
|
38
49
|
/**
|
|
39
|
-
* Audio artifact entry in audio-map.json
|
|
50
|
+
* Audio artifact entry in audio-map.json (v3).
|
|
51
|
+
*
|
|
52
|
+
* The two-POST flow produces TWO projects: a synthesis project (whose
|
|
53
|
+
* stream serves the audio) and an alignment project (used at build time
|
|
54
|
+
* to fetch the word timings, which are embedded here as `words`). Each
|
|
55
|
+
* project has its own publishable key.
|
|
40
56
|
*/
|
|
41
57
|
export interface AudioArtifact {
|
|
42
|
-
/**
|
|
43
|
-
projectUuid: string;
|
|
44
|
-
/** Content hash used for change detection */
|
|
58
|
+
/** Hash of normalisedSpeechtext + resolved voice/language/format */
|
|
45
59
|
contentHash: string;
|
|
60
|
+
/** Resolved synthesis params (also part of change detection) */
|
|
61
|
+
voice: string;
|
|
62
|
+
language: string;
|
|
63
|
+
format: string;
|
|
64
|
+
/** Synthesis project (serves the audio stream) */
|
|
65
|
+
synthesisProjectUuid: string;
|
|
66
|
+
synthesisPublishableKey: string;
|
|
67
|
+
/** Stable audio stream URL (without the publishable key) */
|
|
68
|
+
audioUrl: string;
|
|
69
|
+
/** Alignment project (source of the embedded timings) */
|
|
70
|
+
alignmentProjectUuid: string;
|
|
71
|
+
alignmentPublishableKey: string;
|
|
72
|
+
/** Word timings, indexed positionally by the rehype plugin's data-i */
|
|
73
|
+
words: AlignedWord[];
|
|
46
74
|
/** Total audio duration in seconds */
|
|
47
75
|
duration: number;
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
/** URL to fetch alignment JSON (stable, non-expiring) */
|
|
51
|
-
alignmentUrl: string;
|
|
52
|
-
/** Publishable key for streaming endpoint authentication */
|
|
53
|
-
publishableKey?: string;
|
|
76
|
+
/** Spoken form of each math expression, keyed by `${'d'|'i'}:${latex}`. */
|
|
77
|
+
mathSpeech?: Record<string, string>;
|
|
54
78
|
/** When this artifact was created */
|
|
55
79
|
createdAt: string;
|
|
56
80
|
/** When this artifact was last updated */
|
|
@@ -61,30 +85,58 @@ export interface AudioArtifact {
|
|
|
61
85
|
*/
|
|
62
86
|
export interface AudioMap {
|
|
63
87
|
/** Version of the audio-map schema */
|
|
64
|
-
version: 1 | 2;
|
|
88
|
+
version: 1 | 2 | 3;
|
|
65
89
|
/** When the map was last updated */
|
|
66
90
|
updatedAt: string;
|
|
67
91
|
/** Map of slug -> audio artifact */
|
|
68
92
|
entries: Record<string, AudioArtifact>;
|
|
69
93
|
}
|
|
70
94
|
/**
|
|
71
|
-
* VocaSync API synthesis request
|
|
95
|
+
* VocaSync API synthesis request (FormData fields).
|
|
72
96
|
*/
|
|
73
97
|
export interface SynthesisRequest {
|
|
74
98
|
name: string;
|
|
75
99
|
text: string;
|
|
76
100
|
voice: string;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
101
|
+
quality: "sd" | "hd";
|
|
102
|
+
/** ISO 639-1 language code */
|
|
103
|
+
language: string;
|
|
104
|
+
/** Output container: mp3 | aac | opus | flac | wav */
|
|
105
|
+
outputFormat: string;
|
|
81
106
|
}
|
|
82
107
|
/**
|
|
83
|
-
* VocaSync API synthesis response
|
|
108
|
+
* VocaSync API synthesis response (POST /v1/synthesis).
|
|
84
109
|
*/
|
|
85
110
|
export interface SynthesisResponse {
|
|
86
111
|
projectUuid: string;
|
|
87
|
-
|
|
112
|
+
projectId?: string;
|
|
113
|
+
characterCount?: number;
|
|
114
|
+
status?: JobStatus;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Presigned upload target for one file.
|
|
118
|
+
*/
|
|
119
|
+
export interface PresignTarget {
|
|
120
|
+
key: string;
|
|
121
|
+
uploadUrl: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Response from POST /v1/alignment/presign.
|
|
125
|
+
*/
|
|
126
|
+
export interface AlignmentPresignResponse {
|
|
127
|
+
/** UUID minted for the alignment project; reused in the /alignment POST */
|
|
128
|
+
projectUuid: string;
|
|
129
|
+
audio: PresignTarget;
|
|
130
|
+
transcript: PresignTarget;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Response from POST /v1/alignment (JSON mode).
|
|
134
|
+
*/
|
|
135
|
+
export interface AlignmentSubmitResponse {
|
|
136
|
+
projectUuid: string;
|
|
137
|
+
projectId?: string;
|
|
138
|
+
jobId?: string;
|
|
139
|
+
status?: JobStatus;
|
|
88
140
|
}
|
|
89
141
|
/**
|
|
90
142
|
* VocaSync API publishable key response
|
|
@@ -127,22 +179,14 @@ export interface JobResponse {
|
|
|
127
179
|
error: string | null;
|
|
128
180
|
}
|
|
129
181
|
/**
|
|
130
|
-
*
|
|
131
|
-
*/
|
|
132
|
-
export interface LinkedAlignmentStatus {
|
|
133
|
-
projectUuid: string;
|
|
134
|
-
status: JobStatus;
|
|
135
|
-
error?: string | null;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Project response from /projects/{uuid} endpoint
|
|
182
|
+
* Project response from GET /v1/projects/{uuid}.
|
|
139
183
|
*/
|
|
140
184
|
export interface ProjectResponse {
|
|
141
185
|
id: string;
|
|
142
186
|
projectUuid: string;
|
|
143
187
|
name: string | null;
|
|
144
188
|
description: string | null;
|
|
145
|
-
projectType: "alignment" | "synthesis";
|
|
189
|
+
projectType: "alignment" | "synthesis" | "transcription" | "translation";
|
|
146
190
|
source: "web" | "api";
|
|
147
191
|
language: string | null;
|
|
148
192
|
status: JobStatus;
|
|
@@ -153,26 +197,18 @@ export interface ProjectResponse {
|
|
|
153
197
|
error: string | null;
|
|
154
198
|
artifacts: ArtifactResponse[];
|
|
155
199
|
latestJob?: JobResponse | null;
|
|
156
|
-
linkedAlignment?: LinkedAlignmentStatus | null;
|
|
157
200
|
}
|
|
158
201
|
/**
|
|
159
|
-
* Project status (internal representation
|
|
202
|
+
* Project status (internal, single-project representation used by the
|
|
203
|
+
* poller and the `status` CLI command).
|
|
160
204
|
*/
|
|
161
205
|
export interface ProjectStatus {
|
|
162
206
|
uuid: string;
|
|
163
207
|
name: string;
|
|
208
|
+
projectType: ProjectResponse["projectType"];
|
|
164
209
|
status: JobStatus;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
audioUrl?: string;
|
|
168
|
-
duration?: number;
|
|
169
|
-
error?: string;
|
|
170
|
-
};
|
|
171
|
-
alignmentJob?: {
|
|
172
|
-
status: JobStatus;
|
|
173
|
-
alignmentUrl?: string;
|
|
174
|
-
error?: string;
|
|
175
|
-
};
|
|
210
|
+
durationSeconds?: number;
|
|
211
|
+
error?: string;
|
|
176
212
|
}
|
|
177
213
|
/**
|
|
178
214
|
* Alignment data fetched from VocaSync
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,OAAO,EAAE,MA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