@lincyaw/workbench 0.2.0-rc.12 → 0.2.0-rc.120
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/package.json +5 -4
- package/src/AgentActivityBar.tsx +25 -0
- package/src/MediaClipEditor.tsx +7 -6
- package/src/StepProductionEditor.tsx +16 -7
- package/src/agent-activity-messages.ts +14 -0
- package/src/agent-activity.ts +38 -0
- package/src/approvals.tsx +6 -1
- package/src/audio-recording-messages.ts +5 -5
- package/src/audio-recording.ts +27 -5
- package/src/authoring-client.ts +10 -10
- package/src/authoring-draft-fragment.ts +3 -1
- package/src/authoring-window.ts +100 -0
- package/src/base-controls.tsx +28 -7
- package/src/body-draft-actions.ts +60 -0
- package/src/caption-timing-drafts.ts +20 -3
- package/src/caption-timing-messages.ts +2 -2
- package/src/caption-timing.ts +2 -2
- package/src/component-draft-actions.ts +1 -1
- package/src/component-properties.ts +3 -3
- package/src/component-property-drafts.ts +6 -6
- package/src/components.tsx +43 -38
- package/src/container-layout.ts +21 -0
- package/src/context.tsx +5 -3
- package/src/diagnostics.ts +1 -1
- package/src/document-draft-store.ts +45 -18
- package/src/document-drafts.ts +30 -21
- package/src/document-editing.ts +485 -0
- package/src/document-editor/BlockNoteSurface.tsx +40 -14
- package/src/document-editor/CommentComposer.tsx +24 -0
- package/src/document-editor/ComponentMaterials.tsx +4 -10
- package/src/document-editor/ComponentPropertiesDialog.tsx +12 -12
- package/src/document-editor/DocumentBlockFallback.tsx +4 -3
- package/src/document-editor/DocumentBlockPreview.tsx +11 -4
- package/src/document-editor/DocumentComments.tsx +87 -17
- package/src/document-editor/DocumentEditor.tsx +66 -14
- package/src/document-editor/DocumentStepNarration.tsx +39 -27
- package/src/document-editor/NarrationEditor.tsx +55 -21
- package/src/document-editor/NewCommentDrafts.tsx +120 -37
- package/src/document-editor/PlaceComment.tsx +252 -0
- package/src/document-editor/agent-targets.ts +34 -0
- package/src/document-editor/blocknote-messages.ts +2 -0
- package/src/document-editor/comment-draft-actions.ts +40 -20
- package/src/document-editor/comment-draft-inspection.ts +2 -2
- package/src/document-editor/comment-drafts.ts +75 -27
- package/src/document-editor/comments.ts +34 -14
- package/src/document-editor/component-label.ts +11 -0
- package/src/document-editor/file-input.ts +2 -2
- package/src/document-editor/focus.ts +0 -2
- package/src/document-editor/inline.ts +1 -0
- package/src/document-editor/insertion-place.ts +60 -0
- package/src/document-editor/messages.ts +3 -3
- package/src/document-editor/narration-schema.tsx +12 -6
- package/src/document-editor/narration.ts +19 -3
- package/src/document-editor/page-body.ts +60 -0
- package/src/document-editor/popover.tsx +4 -2
- package/src/document-editor/projection.ts +21 -19
- package/src/document-editor/rich-text.ts +3 -2
- package/src/document-editor/selection.ts +13 -0
- package/src/document-editor/style.css +8 -3
- package/src/document-editor/table-identities.ts +2 -1
- package/src/document-preview.ts +3 -2
- package/src/document-production.ts +492 -0
- package/src/document-return-point.ts +2 -2
- package/src/document-session.ts +216 -67
- package/src/document-timing-drafts.ts +26 -6
- package/src/effective-settings.ts +12 -0
- package/src/history.ts +5 -5
- package/src/import-messages.ts +40 -0
- package/src/index.ts +11 -5
- package/src/jobs.ts +1 -1
- package/src/mcp-settings-messages.ts +39 -0
- package/src/media-drafts.ts +43 -1
- package/src/messages.ts +39 -18
- package/src/outline.ts +5 -5
- package/src/panels/DocumentImportDialog.tsx +59 -0
- package/src/panels/DocumentNarrationPanel.tsx +2 -2
- package/src/panels/DocumentView.tsx +106 -77
- package/src/panels/DocumentVoiceDialog.tsx +29 -12
- package/src/panels/DocumentVoiceField.tsx +3 -2
- package/src/panels/ExportPanel.tsx +2 -10
- package/src/panels/HistoryPanel.tsx +36 -10
- package/src/panels/HomePanel.tsx +12 -1
- package/src/panels/McpSettingsPanel.tsx +86 -0
- package/src/panels/PageDeleteDialog.tsx +4 -4
- package/src/panels/PageRenameDialog.tsx +1 -1
- package/src/panels/PreviewPanel.tsx +4 -7
- package/src/panels/ProductionCaptionSize.tsx +20 -0
- package/src/panels/ProductionCaptionTiming.tsx +12 -9
- package/src/panels/ProductionMediaClips.tsx +25 -9
- package/src/panels/ProductionPanel.tsx +21 -17
- package/src/panels/ProductionRecording.tsx +86 -9
- package/src/panels/ProductionRecordingRange.tsx +26 -23
- package/src/panels/ProductionTimeline.tsx +6 -1
- package/src/panels/ProductionTranscription.tsx +8 -6
- package/src/panels/SourceDocumentPanel.tsx +24 -40
- package/src/panels/SpeechSettingsPanel.tsx +2 -2
- package/src/panels/TranscriptionAdoption.tsx +42 -36
- package/src/panels/VoiceCloneDialog.tsx +2 -1
- package/src/panels/VoicePreviewDialog.tsx +1 -1
- package/src/panels/VoiceScopeField.tsx +2 -2
- package/src/panels/VoiceoverDialog.tsx +11 -10
- package/src/places.ts +1 -36
- package/src/preview-playback.ts +1 -1
- package/src/production-draft-actions.ts +37 -0
- package/src/production-messages.ts +6 -0
- package/src/production-playback.ts +1 -1
- package/src/production-voice-playback.ts +3 -2
- package/src/recording-adoption.ts +4 -4
- package/src/sha256.ts +9 -0
- package/src/speech-settings-messages.ts +6 -6
- package/src/step-production.ts +4 -4
- package/src/styles.css +43 -92
- package/src/transcription-drafts.ts +124 -0
- package/src/use-recording-adoption.ts +5 -4
- package/src/voice-drafts.ts +32 -8
- package/src/voice-messages.ts +9 -9
- package/src/voiceover-jobs.ts +1 -1
- package/src/workbench-state.ts +159 -0
- package/src/workbench.ts +323 -956
- package/src/workspace-client.ts +41 -12
- package/src/assistant-mascot.ts +0 -62
- package/src/mascot-preference.ts +0 -37
- package/src/panels/ChangeTrail.tsx +0 -79
|
@@ -6,14 +6,14 @@ const zh = {
|
|
|
6
6
|
key: '语音密钥', keyPlaceholder: '输入 API Key 或 Access Token', keySaved: '已配置,留空保留',
|
|
7
7
|
keyHint: '使用语音 API Key,或与 App ID 配套的 Access Token。',
|
|
8
8
|
appId: 'App ID(可选)', appIdPlaceholder: '使用 API Key 时留空', appIdHint: '使用 Access Token 时填写对应 App ID;不需要 Secret Key。输入新的密钥且留空此项时,使用 API Key。',
|
|
9
|
-
console: '
|
|
9
|
+
console: '服务控制台',
|
|
10
10
|
source: { saved: '使用本机保存的密钥', environment: '使用启动环境中的密钥', none: '尚未配置密钥' },
|
|
11
11
|
configured: '已配置,尚未验证服务权限', unconfigured: '未配置',
|
|
12
12
|
verification: '检查配置仅检查已保存的本机设置,服务权限在播放或试听时验证。请先开通语音合成服务;播放会按需生成并缓存配音,可能产生服务费用。',
|
|
13
|
-
privacy: '
|
|
14
|
-
check: '
|
|
15
|
-
remove: '
|
|
16
|
-
cleared: '已清除本机保存的密钥。', retry: '
|
|
13
|
+
privacy: '密钥仅保存在本机此工作区的服务配置中,不写入文稿。',
|
|
14
|
+
check: '检查', save: '保存', saved: '语音服务已保存,无需重启。', checked: '本机配置可用。请通过试听验证服务权限。',
|
|
15
|
+
remove: '清除密钥', removeTitle: '清除语音服务密钥', removeHint: '清除本机保存的密钥后恢复启动环境中的配置;讲稿、音色选择和已有配音保留。', cancel: '取消',
|
|
16
|
+
cleared: '已清除本机保存的密钥。', retry: '重试', loading: '正在加载语音服务设置…',
|
|
17
17
|
unavailable: '无法读取语音服务设置,请重试。', invalid: '请输入有效的语音密钥和对应 App ID。',
|
|
18
18
|
conflict: '设置已在别处更新。当前输入已保留,请重新加载后再保存。', busy: '设置正在被更新,请稍后重试。',
|
|
19
19
|
failed: '无法保存语音服务设置。当前输入已保留,请重试。',
|
|
@@ -31,7 +31,7 @@ export const SPEECH_SETTINGS_MESSAGES: Record<Locale, typeof zh> = {
|
|
|
31
31
|
configured: 'Configured; service permissions not verified', unconfigured: 'Not configured',
|
|
32
32
|
verification: 'Checking configuration checks saved local settings. Playback or a sample verifies service permissions. Enable speech synthesis first; playback generates and caches missing voiceover and may incur service charges.',
|
|
33
33
|
privacy: 'The key stays in this workspace’s service settings on this machine, outside the document.',
|
|
34
|
-
check: 'Check
|
|
34
|
+
check: 'Check', save: 'Save', saved: 'Voice service saved. No restart is needed.', checked: 'Local settings are available. Play a sample to verify service permissions.',
|
|
35
35
|
remove: 'Clear Saved Key', removeTitle: 'Clear Voice Service Key', removeHint: 'Clearing the saved key restores the launch environment configuration. Scripts, voice choices, and generated audio are kept.', cancel: 'Cancel',
|
|
36
36
|
cleared: 'The saved key was cleared.', retry: 'Reload', loading: 'Reading voice service settings…',
|
|
37
37
|
unavailable: 'Couldn’t read voice service settings. Try again.', invalid: 'Enter a valid speech key and matching App ID.',
|
package/src/step-production.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StepProduction,
|
|
1
|
+
import type { StepProduction, PresmiumDocument } from '@lincyaw/kernel'
|
|
2
2
|
|
|
3
3
|
export const STEP_TIMING_KEYS = ['narrationStart', 'minimumHoldMs', 'trailingPauseMs'] as const
|
|
4
4
|
export type StepTimingKey = typeof STEP_TIMING_KEYS[number]
|
|
@@ -9,7 +9,7 @@ export type StepDurationKey = 'minimumHoldMs' | 'trailingPauseMs'
|
|
|
9
9
|
export interface StepDurationDraft { text: string, error: boolean, review?: boolean }
|
|
10
10
|
|
|
11
11
|
/** The source is author intent; an absent value is not a fabricated playback default. */
|
|
12
|
-
export function stepTimingValue<K extends StepTimingKey>(document:
|
|
12
|
+
export function stepTimingValue<K extends StepTimingKey>(document: PresmiumDocument, stepId: string, key: K): { value: StepProduction[K], source: ProductionSource } {
|
|
13
13
|
const production = document.production, step = document.steps[stepId]
|
|
14
14
|
const layers = [[production.stepOverrides[stepId], 'step'], [step && production.sectionOverrides?.[step.sectionId], 'section'], [production.defaults, 'document']] as const
|
|
15
15
|
for (const [settings, source] of layers) if (settings?.[key] !== undefined) return { value: settings[key], source }
|
|
@@ -17,7 +17,7 @@ export function stepTimingValue<K extends StepTimingKey>(document: TeachingDocum
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/** Migrated narration defaults are inherited until this step explicitly overrides its start. */
|
|
20
|
-
export function stepNarrationStarts(document:
|
|
20
|
+
export function stepNarrationStarts(document: PresmiumDocument, stepId: string) {
|
|
21
21
|
const inherited = stepTimingValue(document, stepId, 'narrationStart')
|
|
22
22
|
return (document.steps[stepId]?.narrationIds ?? []).map(id => ({ id,
|
|
23
23
|
value: inherited.source === 'step' ? inherited.value : document.production.narrationOverrides?.[id]?.narrationStart ?? inherited.value,
|
|
@@ -26,7 +26,7 @@ export function stepNarrationStarts(document: TeachingDocument, stepId: string)
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/** Patches only author-owned timing; voice, cues, media and other steps retain their source values. */
|
|
29
|
-
export function changeStepTiming(document:
|
|
29
|
+
export function changeStepTiming(document: PresmiumDocument, stepId: string, patch: StepTimingPatch): PresmiumDocument {
|
|
30
30
|
const step = document.steps[stepId]
|
|
31
31
|
if (!step || !document.sections[step.sectionId]?.stepOrder.includes(stepId)) return document
|
|
32
32
|
for (const key of Object.keys(patch)) if (!STEP_TIMING_KEYS.includes(key as StepTimingKey)) throw new Error('document-production-key')
|
package/src/styles.css
CHANGED
|
@@ -171,15 +171,7 @@
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
.pmw-toolbar {
|
|
174
|
-
display: flex;
|
|
175
|
-
flex: none;
|
|
176
|
-
align-items: center;
|
|
177
|
-
gap: var(--pm-space-px);
|
|
178
|
-
min-height: var(--pm-toolbar-height);
|
|
179
|
-
padding: var(--pm-space-1) var(--pm-space-2);
|
|
180
174
|
overflow-x: auto;
|
|
181
|
-
border-bottom: var(--pm-size-hairline) solid var(--pm-color-line);
|
|
182
|
-
background: var(--pm-color-chrome);
|
|
183
175
|
scrollbar-width: none;
|
|
184
176
|
}
|
|
185
177
|
|
|
@@ -188,8 +180,8 @@
|
|
|
188
180
|
max-width: calc(var(--pm-navigation-width) * 1.5);
|
|
189
181
|
margin: 0 var(--pm-space-2) 0 var(--pm-space-1);
|
|
190
182
|
overflow: hidden;
|
|
191
|
-
font-size: var(--pm-text-
|
|
192
|
-
font-weight:
|
|
183
|
+
font-size: var(--pm-text-sm);
|
|
184
|
+
font-weight: var(--pm-weight-semibold);
|
|
193
185
|
text-overflow: ellipsis;
|
|
194
186
|
white-space: nowrap;
|
|
195
187
|
}
|
|
@@ -232,19 +224,6 @@
|
|
|
232
224
|
padding: var(--pm-space-2) var(--pm-space-3) 0;
|
|
233
225
|
}
|
|
234
226
|
|
|
235
|
-
.pmw-notices > .pm-ui-notice {
|
|
236
|
-
display: flex;
|
|
237
|
-
flex-wrap: wrap;
|
|
238
|
-
align-items: center;
|
|
239
|
-
gap: var(--pm-space-2);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.pmw-notice__actions {
|
|
243
|
-
display: inline-flex;
|
|
244
|
-
gap: var(--pm-space-2);
|
|
245
|
-
margin-left: auto;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
227
|
.pmw-problems {
|
|
249
228
|
display: flex;
|
|
250
229
|
flex: 1;
|
|
@@ -265,20 +244,24 @@
|
|
|
265
244
|
color: var(--pm-color-danger);
|
|
266
245
|
}
|
|
267
246
|
|
|
268
|
-
.pmw-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
.pmw-problems__details ul {
|
|
275
|
-
margin: var(--pm-space-1) 0 0;
|
|
247
|
+
.pmw-problems__list {
|
|
248
|
+
display: flex;
|
|
249
|
+
flex-direction: column;
|
|
250
|
+
gap: var(--pm-space-3);
|
|
251
|
+
margin: 0;
|
|
276
252
|
padding-left: var(--pm-space-4);
|
|
277
|
-
font-family: var(--pm-font-mono);
|
|
278
|
-
font-size: var(--pm-text-xs);
|
|
279
253
|
overflow-wrap: anywhere;
|
|
280
254
|
}
|
|
281
255
|
|
|
256
|
+
.pmw-problems__list p {
|
|
257
|
+
margin: 0;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.pmw-problems__hint {
|
|
261
|
+
color: var(--pm-color-muted);
|
|
262
|
+
font-size: var(--pm-text-sm);
|
|
263
|
+
}
|
|
264
|
+
|
|
282
265
|
.pmw-document__body {
|
|
283
266
|
display: flex;
|
|
284
267
|
flex: 1;
|
|
@@ -551,13 +534,6 @@
|
|
|
551
534
|
position: sticky;
|
|
552
535
|
top: 0;
|
|
553
536
|
z-index: 1;
|
|
554
|
-
display: flex;
|
|
555
|
-
flex: none;
|
|
556
|
-
align-items: center;
|
|
557
|
-
gap: var(--pm-space-2);
|
|
558
|
-
min-height: var(--pm-pane-header-height);
|
|
559
|
-
padding: 0 var(--pm-space-2) 0 var(--pm-space-3);
|
|
560
|
-
background: var(--pm-color-chrome);
|
|
561
537
|
}
|
|
562
538
|
|
|
563
539
|
.pmw-pane__title {
|
|
@@ -717,6 +693,11 @@
|
|
|
717
693
|
justify-self: start;
|
|
718
694
|
}
|
|
719
695
|
|
|
696
|
+
.pmw-version__actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: var(--pm-space-2); }
|
|
697
|
+
.pmw-history-group { display: grid; gap: var(--pm-space-2); }
|
|
698
|
+
.pmw-history-group__header { display: flex; align-items: center; gap: var(--pm-space-2); padding-inline: var(--pm-space-3); }
|
|
699
|
+
.pmw-toolbar__history { display: inline-flex; align-items: center; gap: var(--pm-space-1); }
|
|
700
|
+
|
|
720
701
|
/* Above the video: its file. */
|
|
721
702
|
|
|
722
703
|
|
|
@@ -820,17 +801,6 @@
|
|
|
820
801
|
accent-color: var(--pm-color-accent);
|
|
821
802
|
}
|
|
822
803
|
|
|
823
|
-
/* The kitten above the bar, as far along it as the job has come (`--pmw-job-done`, 0 to 1), never past its ends. */
|
|
824
|
-
.pmw-job__runner {
|
|
825
|
-
display: block;
|
|
826
|
-
margin-left: calc((100% - var(--pm-size-mascot-sm)) * var(--pmw-job-done));
|
|
827
|
-
line-height: 0;
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
.pmw-job__runner:empty {
|
|
831
|
-
display: none;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
804
|
.pmw-job__error {
|
|
835
805
|
margin: 0;
|
|
836
806
|
color: var(--pm-color-danger);
|
|
@@ -888,25 +858,21 @@
|
|
|
888
858
|
|
|
889
859
|
/* Narrow: labels go, icons stay; the side pane covers the document. */
|
|
890
860
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
.pmw-document__body { position: relative; }
|
|
894
|
-
.pmw-navigation {
|
|
861
|
+
.pmw-document:not([data-roomy]) .pmw-document__body { position: relative; }
|
|
862
|
+
.pmw-document:not([data-roomy]) .pmw-navigation {
|
|
895
863
|
position: absolute;
|
|
896
864
|
inset: 0 auto 0 0;
|
|
897
865
|
z-index: 6;
|
|
898
866
|
width: min(100%, var(--pm-navigation-width));
|
|
899
867
|
box-shadow: var(--pm-shadow-float);
|
|
900
868
|
}
|
|
901
|
-
|
|
869
|
+
.pmw-document:not([data-roomy]) .pmw-document__aside {
|
|
902
870
|
position: absolute;
|
|
903
871
|
inset: 0 0 0 auto;
|
|
904
872
|
z-index: 6;
|
|
905
873
|
width: min(100%, 24rem);
|
|
906
874
|
box-shadow: var(--pm-shadow-float);
|
|
907
875
|
}
|
|
908
|
-
}
|
|
909
|
-
|
|
910
876
|
/* Per-step speech: compact step strip and two tracks, alongside either document or presentation. */
|
|
911
877
|
.pmw-narration { min-height: 0; overflow: auto; }
|
|
912
878
|
.pmw-narration__body { display: grid; gap: var(--pm-space-3); padding: var(--pm-space-3); }
|
|
@@ -928,10 +894,9 @@
|
|
|
928
894
|
.pmw-document__source[hidden] { display: none; }
|
|
929
895
|
.pmw-source-document { flex: 1; min-width: 0; min-height: 0; overflow: auto; padding: var(--pm-space-5); background: var(--pm-color-canvas); }
|
|
930
896
|
.pmw-source-document__notices { position: sticky; inset-block-start: 0; z-index: var(--pm-z-site-header); display: grid; gap: var(--pm-space-3); margin-block-end: var(--pm-space-3); }
|
|
931
|
-
.pmw-source-document__recovery { display: grid; gap: var(--pm-space-2); min-width: 0; }
|
|
932
|
-
.pmw-source-document__recovery-actions { display: flex; flex-wrap: wrap; gap: var(--pm-space-2); }
|
|
933
897
|
.pmw-source-document__diagnostics { margin-block-end: var(--pm-space-3); }
|
|
934
|
-
|
|
898
|
+
/* Its end margin is the editor's own end area, which fills the rest of the sheet and takes the presses below the last block. */
|
|
899
|
+
.pmw-source-document__sheet { display: flex; flex-direction: column; max-width: var(--pm-sheet-width); min-height: 100%; margin-inline: auto; padding-block-start: var(--pm-space-4); background: var(--pm-color-surface); box-shadow: var(--pm-shadow-page); }
|
|
935
900
|
/* Opening: the page's own margins, so that the placeholder lines sit where the text will. */
|
|
936
901
|
.pmw-source-document__sheet--loading { box-sizing: border-box; padding: var(--pm-space-10) var(--pm-space-12); }
|
|
937
902
|
.pmw-voice__filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pm-space-3); }
|
|
@@ -945,19 +910,17 @@
|
|
|
945
910
|
.pmw-step-timeline__steps { display: flex; gap: var(--pm-space-1); overflow-x: auto; padding: var(--pm-space-1); }
|
|
946
911
|
.pmw-step-timeline__steps > * { flex: none; }
|
|
947
912
|
.pmw-toolbar--present { justify-content: flex-end; }
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
.pmw-step-timeline { padding: var(--pm-space-2); }
|
|
960
|
-
}
|
|
913
|
+
.pmw-document[data-narrow] .pmw-source-document { padding: var(--pm-space-2); }
|
|
914
|
+
.pmw-document[data-narrow] .pmw-toolbar--document { flex-wrap: wrap; }
|
|
915
|
+
.pmw-document[data-narrow] .pmw-toolbar--document .pmw-toolbar__document { display: flex; flex: 1 0 100%; align-items: center; gap: var(--pm-space-px); min-width: 0; }
|
|
916
|
+
.pmw-document[data-narrow] .pmw-toolbar--document .pmw-toolbar__title { flex: 1; max-width: none; }
|
|
917
|
+
.pmw-document[data-narrow] .pmw-toolbar--document .pmw-toolbar__status { flex: 1 1 0; }
|
|
918
|
+
.pmw-document[data-narrow] .pmw-toolbar--document > .pmw-spacer { display: none; }
|
|
919
|
+
.pmw-document[data-narrow] .pmw-toolbar__status { flex: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
920
|
+
.pmw-document[data-narrow] .pmw-toolbar__status-full:has(+ .pmw-toolbar__status-short) { display: none; }
|
|
921
|
+
.pmw-document[data-narrow] .pmw-toolbar__status-short { display: inline; }
|
|
922
|
+
.pmw-document[data-narrow] .pmw-document__aside { width: 100%; }
|
|
923
|
+
.pmw-document[data-narrow] .pmw-step-timeline { padding: var(--pm-space-2); }
|
|
961
924
|
|
|
962
925
|
/* Production owns pane layout; controls and dock chrome live in the shared design layer. */
|
|
963
926
|
.pmw-speech-settings { min-width: 0; }
|
|
@@ -1004,22 +967,10 @@
|
|
|
1004
967
|
.pmw-approvals .pmw-muted { margin: 0; }
|
|
1005
968
|
.pmw-approvals__detail { max-height: 30vh; margin: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1006
969
|
.pmw-approvals__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--pm-space-2); }
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
left: 0;
|
|
1013
|
-
z-index: 1;
|
|
1014
|
-
pointer-events: none;
|
|
1015
|
-
transform: translate(calc(var(--pmw-trail-x) - 45%), calc(var(--pmw-trail-y) - 89%));
|
|
1016
|
-
transition: transform var(--pm-duration-walk) linear, opacity var(--pm-duration-slow);
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
.pmw-change-trail[data-phase='done'] {
|
|
1020
|
-
opacity: 0.9;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
.pmw-change-trail__facing[data-facing='left'] {
|
|
1024
|
-
transform: scaleX(-1);
|
|
970
|
+
.pmw-agent-activity {
|
|
971
|
+
display: inline-flex;
|
|
972
|
+
align-items: center;
|
|
973
|
+
flex: none;
|
|
974
|
+
gap: var(--pm-space-1);
|
|
1025
975
|
}
|
|
976
|
+
.pmw-agent-activity__label { min-width: 0; }
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { isRecord, randomUUID } from '@lincyaw/kernel'
|
|
2
|
+
import type { NarrationNode, TranscriptionAdoptionDraft } from '@lincyaw/kernel'
|
|
3
|
+
|
|
4
|
+
export interface TranscriptionCorrection { id: string, revision: number, nodes?: NarrationNode[], discarded: string[], shared: 'fork' | 'edit-shared', baseVersion?: string, applied?: boolean }
|
|
5
|
+
export interface TranscriptionCorrectionTarget { identity: string, candidate: TranscriptionAdoptionDraft['candidate'], stepId: string, narrationId?: string, segmentIds: string[] }
|
|
6
|
+
interface Entry { target: TranscriptionCorrectionTarget, draft?: TranscriptionCorrection, raw?: string | null, failed: boolean, corrupt: boolean }
|
|
7
|
+
const prefix = 'presmium.transcription-draft.v1:'
|
|
8
|
+
export const transcriptionCorrectionKey = (target: TranscriptionCorrectionTarget): string => JSON.stringify([target.identity, target.candidate.id, target.candidate.revision, target.stepId, target.narrationId ?? null, target.segmentIds])
|
|
9
|
+
const fresh = (): TranscriptionCorrection => ({ id: randomUUID(), revision: 0, discarded: [], shared: 'fork' })
|
|
10
|
+
function valid(value: unknown): value is TranscriptionCorrection {
|
|
11
|
+
return isRecord(value) && typeof value.id === 'string' && Number.isSafeInteger(value.revision) && Number(value.revision) >= 0 && Array.isArray(value.discarded) && value.discarded.every(key => typeof key === 'string') && ['fork', 'edit-shared'].includes(String(value.shared))
|
|
12
|
+
&& (value.baseVersion === undefined || typeof value.baseVersion === 'string') && (value.applied === undefined || typeof value.applied === 'boolean')
|
|
13
|
+
&& (value.nodes === undefined || Array.isArray(value.nodes) && value.nodes.every(node => isRecord(node) && (node.type === 'text' && typeof node.text === 'string' || node.type === 'pronunciation' && typeof node.display === 'string' && typeof node.spoken === 'string' || node.type === 'cue' && typeof node.id === 'string' && typeof node.action === 'string')))
|
|
14
|
+
}
|
|
15
|
+
function parseTarget(key: string): TranscriptionCorrectionTarget | undefined {
|
|
16
|
+
try {
|
|
17
|
+
const value: unknown = JSON.parse(key)
|
|
18
|
+
if (!Array.isArray(value) || value.length !== 6) return
|
|
19
|
+
const [identity, id, revision, stepId, narrationId, segmentIds] = value
|
|
20
|
+
if (typeof identity !== 'string' || typeof id !== 'string' || typeof revision !== 'string' || typeof stepId !== 'string' || narrationId !== null && typeof narrationId !== 'string' || !Array.isArray(segmentIds) || !segmentIds.every(id => typeof id === 'string')) return
|
|
21
|
+
return { identity, candidate: { id, revision }, stepId, ...narrationId !== null ? { narrationId } : {}, segmentIds }
|
|
22
|
+
} catch { return }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The native correction bank uses its existing localStorage keys; no MCP copy or provider result is changed. */
|
|
26
|
+
export class TranscriptionCorrections {
|
|
27
|
+
readonly #entries = new Map<string, Entry>()
|
|
28
|
+
#load(target: TranscriptionCorrectionTarget): Entry {
|
|
29
|
+
const key = transcriptionCorrectionKey(target), known = this.#entries.get(key)
|
|
30
|
+
if (known) return known
|
|
31
|
+
const entry: Entry = { target: structuredClone(target), failed: false, corrupt: false }
|
|
32
|
+
this.#entries.set(key, entry)
|
|
33
|
+
try {
|
|
34
|
+
entry.raw = localStorage.getItem(prefix + key)
|
|
35
|
+
if (entry.raw !== null) {
|
|
36
|
+
const value: unknown = JSON.parse(entry.raw)
|
|
37
|
+
if (!valid(value)) throw new Error('invalid-draft')
|
|
38
|
+
entry.draft = value
|
|
39
|
+
}
|
|
40
|
+
} catch { entry.failed = true; entry.corrupt = entry.raw != null }
|
|
41
|
+
return entry
|
|
42
|
+
}
|
|
43
|
+
read(target: TranscriptionCorrectionTarget): { draft: TranscriptionCorrection, failed: boolean } {
|
|
44
|
+
const entry = this.#load(target)
|
|
45
|
+
// A reopened native form adopts another window's saved value, retaining failed local input.
|
|
46
|
+
try {
|
|
47
|
+
const raw = localStorage.getItem(prefix + transcriptionCorrectionKey(target))
|
|
48
|
+
if (raw !== entry.raw && !(entry.failed && entry.draft)) {
|
|
49
|
+
const value: unknown = raw === null ? undefined : JSON.parse(raw)
|
|
50
|
+
if (value !== undefined && !valid(value)) throw new Error('invalid-draft')
|
|
51
|
+
entry.raw = raw; entry.draft = value as TranscriptionCorrection | undefined; entry.failed = false; entry.corrupt = false
|
|
52
|
+
} else if (raw !== entry.raw) entry.failed = true
|
|
53
|
+
} catch { entry.failed = true }
|
|
54
|
+
return { draft: entry.draft ? structuredClone(entry.draft) : fresh(), failed: entry.failed }
|
|
55
|
+
}
|
|
56
|
+
keep(target: TranscriptionCorrectionTarget, draft: TranscriptionCorrection): boolean {
|
|
57
|
+
if (!valid(draft)) throw new Error('invalid-draft')
|
|
58
|
+
const entry = this.#load(target), key = prefix + transcriptionCorrectionKey(target)
|
|
59
|
+
entry.draft = structuredClone(draft)
|
|
60
|
+
try {
|
|
61
|
+
if (entry.raw === undefined || localStorage.getItem(key) !== entry.raw) throw new Error('changed-draft')
|
|
62
|
+
if (entry.corrupt && entry.raw != null) localStorage.setItem(key + ':unreadable', entry.raw)
|
|
63
|
+
const raw = JSON.stringify(draft)
|
|
64
|
+
localStorage.setItem(key, raw)
|
|
65
|
+
entry.raw = raw; entry.failed = false; entry.corrupt = false
|
|
66
|
+
return true
|
|
67
|
+
} catch { entry.failed = true; return false }
|
|
68
|
+
}
|
|
69
|
+
/** A completed native adoption cannot retire input changed in another form/window while it ran. */
|
|
70
|
+
complete(target: TranscriptionCorrectionTarget, expected: TranscriptionCorrection, next: TranscriptionCorrection): boolean {
|
|
71
|
+
const key = transcriptionCorrectionKey(target), entry = this.#entries.get(key)
|
|
72
|
+
if (!entry || entry.corrupt || JSON.stringify(entry.draft) !== JSON.stringify(expected)) return false
|
|
73
|
+
try {
|
|
74
|
+
if (entry.raw === undefined || localStorage.getItem(prefix + key) !== entry.raw) return false
|
|
75
|
+
const raw = JSON.stringify(next)
|
|
76
|
+
localStorage.setItem(prefix + key, raw)
|
|
77
|
+
entry.raw = raw; entry.draft = structuredClone(next); entry.failed = false
|
|
78
|
+
return true
|
|
79
|
+
} catch { entry.failed = true; return false }
|
|
80
|
+
}
|
|
81
|
+
discard(key: string, expected: TranscriptionCorrection): boolean {
|
|
82
|
+
const entry = this.#entries.get(key)
|
|
83
|
+
if (!entry || entry.corrupt || JSON.stringify(entry.draft) !== JSON.stringify(expected)) return false
|
|
84
|
+
try {
|
|
85
|
+
if (entry.raw === undefined || localStorage.getItem(prefix + key) !== entry.raw) return false
|
|
86
|
+
localStorage.removeItem(prefix + key)
|
|
87
|
+
this.#entries.delete(key)
|
|
88
|
+
return true
|
|
89
|
+
} catch { entry.failed = true; return false }
|
|
90
|
+
}
|
|
91
|
+
snapshot(identity: string) {
|
|
92
|
+
const keys = new Set([...this.#entries].filter(([, entry]) => entry.target.identity === identity).map(([key]) => key))
|
|
93
|
+
let partial = false
|
|
94
|
+
const head = prefix + JSON.stringify([identity]).slice(0, -1) + ','
|
|
95
|
+
try {
|
|
96
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
97
|
+
const key = localStorage.key(i)
|
|
98
|
+
if (key?.startsWith(head) && !key.endsWith(':unreadable')) keys.add(key.slice(prefix.length))
|
|
99
|
+
}
|
|
100
|
+
} catch { partial = true }
|
|
101
|
+
const entries: { key: string, target: TranscriptionCorrectionTarget, draft: TranscriptionCorrection, persisted: boolean }[] = [], observed: [string, string | null][] = []
|
|
102
|
+
for (const key of keys) {
|
|
103
|
+
const target = parseTarget(key)
|
|
104
|
+
if (!target || target.identity !== identity) { partial = true; continue }
|
|
105
|
+
const entry = this.#load(target)
|
|
106
|
+
let persisted = false
|
|
107
|
+
try {
|
|
108
|
+
const raw = localStorage.getItem(prefix + key)
|
|
109
|
+
observed.push([key, raw])
|
|
110
|
+
persisted = !entry.failed && !entry.corrupt && raw === entry.raw
|
|
111
|
+
if (raw !== entry.raw) partial = true
|
|
112
|
+
} catch { partial = true }
|
|
113
|
+
if (entry.corrupt || entry.raw === undefined) partial = true
|
|
114
|
+
if (entry.draft && !entry.draft.applied) entries.push({ key, target: structuredClone(target), draft: structuredClone(entry.draft), persisted })
|
|
115
|
+
}
|
|
116
|
+
return { entries, partial, guard: () => {
|
|
117
|
+
for (const [key, raw] of observed) {
|
|
118
|
+
try { if (localStorage.getItem(prefix + key) === raw) continue } catch { /* Cannot verify the same persisted input. */ }
|
|
119
|
+
throw new Error('client-production-drafts-changed')
|
|
120
|
+
}
|
|
121
|
+
} }
|
|
122
|
+
}
|
|
123
|
+
close(): void { this.#entries.clear() }
|
|
124
|
+
}
|
|
@@ -2,10 +2,11 @@ import { useEffect, useRef, useState } from 'react'
|
|
|
2
2
|
import type { DocumentRecordingAdoption } from '@lincyaw/kernel'
|
|
3
3
|
import type { DocumentSessionState } from './document-session.ts'
|
|
4
4
|
import { useWorkbench, useWorkbenchState } from './context.tsx'
|
|
5
|
+
import { effectiveOf } from './effective-settings.ts'
|
|
5
6
|
|
|
6
7
|
const requestId = () => `recording_${[...crypto.getRandomValues(new Uint8Array(16))].map(value => value.toString(16).padStart(2, '0')).join('')}`
|
|
7
8
|
function applied(source: DocumentSessionState | undefined, request: DocumentRecordingAdoption): boolean {
|
|
8
|
-
const document = source?.content, step = document?.steps[request.stepId]
|
|
9
|
+
const document = effectiveOf(source?.content, source?.inherited), step = document?.steps[request.stepId]
|
|
9
10
|
const voice = step && (document.production.stepOverrides[step.id]?.voiceSource ?? document.production.sectionOverrides?.[step.sectionId]?.voiceSource ?? document.production.defaults.voiceSource)
|
|
10
11
|
return Boolean(document?.id === request.source.documentId && voice?.type === 'recording' && voice.assetId === request.assetId && document.assets[request.assetId]?.fingerprint === `sha256:${request.sha256}`)
|
|
11
12
|
}
|
|
@@ -18,7 +19,7 @@ export function useRecordingAdoption({ identity, sectionId, stepId, active, disa
|
|
|
18
19
|
const [selection, setSelection] = useState<string>(), [busy, setBusy] = useState(false), [failure, setFailure] = useState<string>()
|
|
19
20
|
const owner = useRef({ active: false, revision: 0 }), request = useRef<AbortController>(), retry = useRef<DocumentRecordingAdoption>(), submitted = useRef<DocumentRecordingAdoption>(), reported = useRef<string>()
|
|
20
21
|
const latest = useRef({ sectionId, stepId, active, onAdopted }); latest.current = { sectionId, stepId, active, onAdopted }
|
|
21
|
-
const document = source?.identity === identity ? source.content : undefined
|
|
22
|
+
const document = source?.identity === identity ? effectiveOf(source.content, source.inherited) : undefined
|
|
22
23
|
const effective = document && (document.production.stepOverrides[stepId]?.voiceSource ?? document.production.sectionOverrides?.[sectionId]?.voiceSource ?? document.production.defaults.voiceSource)
|
|
23
24
|
const selected = selection ?? candidateAssetId ?? (effective?.type === 'recording' ? effective.assetId : '')
|
|
24
25
|
const assets = Object.values(document?.assets ?? {}).filter(asset => asset.kind === 'audio')
|
|
@@ -58,13 +59,13 @@ export function useRecordingAdoption({ identity, sectionId, stepId, active, disa
|
|
|
58
59
|
if (!owns()) return
|
|
59
60
|
const source = workbench.getState().authoring
|
|
60
61
|
if (!source?.version || !source.fingerprint || !source.content || source.identity !== identity || source.dirty || source.saving || source.composing || source.restored || source.error) throw new Error('production-source-changed')
|
|
61
|
-
const expected = { identity, version: source.version }, inspection = await workbench.
|
|
62
|
+
const expected = { identity, version: source.version }, inspection = await workbench.production.inspectAudio(target.assetId, expected, controller.signal)
|
|
62
63
|
if (!owns()) return
|
|
63
64
|
const canonical = { documentId: source.content.id, version: source.version, fingerprint: source.fingerprint }, previous = retry.current
|
|
64
65
|
sent = previous && previous.source.documentId === canonical.documentId && previous.source.version === canonical.version && previous.source.fingerprint === canonical.fingerprint && previous.stepId === target.stepId && previous.assetId === target.assetId && previous.sha256 === inspection.inspection.sha256
|
|
65
66
|
? previous : { id: requestId(), source: canonical, stepId: target.stepId, assetId: target.assetId, sha256: inspection.inspection.sha256 }
|
|
66
67
|
retry.current = sent; submitted.current = sent
|
|
67
|
-
await workbench.
|
|
68
|
+
await workbench.production.adoptRecording(sent, expected, controller.signal)
|
|
68
69
|
if (!owns()) return
|
|
69
70
|
if (retry.current === sent) retry.current = undefined
|
|
70
71
|
setFailure(undefined)
|
package/src/voice-drafts.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { WorkspaceClient } from './workspace-client.ts'
|
|
|
5
5
|
|
|
6
6
|
export interface VoiceDraft { version: string, scope: DocumentVoiceScope, source: VoiceSource | null, replaceOverrides: boolean, rateInput?: string }
|
|
7
7
|
export type VoiceDraftStorageStatus = 'available' | 'unavailable' | 'corrupt'
|
|
8
|
-
interface StoredDraft { draft?: VoiceDraft, status: VoiceDraftStorageStatus, unreadable?: string }
|
|
8
|
+
interface StoredDraft { draft?: VoiceDraft, status: VoiceDraftStorageStatus, unreadable?: string, raw?: string | null }
|
|
9
9
|
const drafts = new WeakMap<WorkspaceClient, Map<string, StoredDraft>>()
|
|
10
10
|
const keyOf = (identity: string, stepId: string) => JSON.stringify([identity, stepId])
|
|
11
11
|
const storageKey = (key: string) => `presmium.voice-draft.v2:${key}`
|
|
@@ -36,6 +36,7 @@ function load(client: WorkspaceClient, key: string): StoredDraft {
|
|
|
36
36
|
known.set(key, entry)
|
|
37
37
|
try {
|
|
38
38
|
const raw = sessionStorage.getItem(storageKey(key))
|
|
39
|
+
entry.raw = raw
|
|
39
40
|
if (raw !== null) {
|
|
40
41
|
entry.unreadable = raw
|
|
41
42
|
const value: unknown = JSON.parse(raw)
|
|
@@ -64,7 +65,9 @@ export function keepVoiceDraft(client: WorkspaceClient, identity: string, stepId
|
|
|
64
65
|
entry.draft = structuredClone(value)
|
|
65
66
|
try {
|
|
66
67
|
if (entry.unreadable !== undefined) sessionStorage.setItem(`${storageKey(key)}:unreadable`, entry.unreadable)
|
|
67
|
-
|
|
68
|
+
const raw = JSON.stringify(entry.draft)
|
|
69
|
+
sessionStorage.setItem(storageKey(key), raw)
|
|
70
|
+
entry.raw = raw
|
|
68
71
|
entry.status = 'available'; delete entry.unreadable
|
|
69
72
|
return true
|
|
70
73
|
} catch { entry.status = 'unavailable'; return false }
|
|
@@ -76,14 +79,35 @@ export function clearVoiceDraft(client: WorkspaceClient, identity: string, stepI
|
|
|
76
79
|
if (expected && JSON.stringify(entry.draft) !== JSON.stringify(expected)) return false
|
|
77
80
|
try {
|
|
78
81
|
const raw = sessionStorage.getItem(storageKey(key))
|
|
79
|
-
if (expected && raw !==
|
|
80
|
-
let persisted: unknown
|
|
81
|
-
try { persisted = JSON.parse(raw) } catch { entry.status = 'corrupt'; entry.unreadable = raw; return false }
|
|
82
|
-
if (!valid(persisted)) { entry.status = 'corrupt'; entry.unreadable = raw; return false }
|
|
83
|
-
if (JSON.stringify(persisted) !== JSON.stringify(expected)) return false
|
|
84
|
-
}
|
|
82
|
+
if (expected && (entry.unreadable !== undefined || raw !== entry.raw)) return false
|
|
85
83
|
sessionStorage.removeItem(storageKey(key))
|
|
84
|
+
entry.raw = null
|
|
86
85
|
delete entry.draft; delete entry.unreadable; entry.status = 'available'
|
|
87
86
|
return true
|
|
88
87
|
} catch { entry.status = 'unavailable'; return false }
|
|
89
88
|
}
|
|
89
|
+
|
|
90
|
+
/** Enumerate this native bank, including offscreen forms; callers receive no second persisted copy. */
|
|
91
|
+
export function voiceDraftSnapshot(client: WorkspaceClient, identity: string): { entries: { stepId: string, value: VoiceDraft, persisted: boolean }[], partial: boolean } {
|
|
92
|
+
const keys = new Set([...store(client).keys()].filter(key => key.startsWith(`${JSON.stringify([identity]).slice(0, -1)},`)))
|
|
93
|
+
let partial = false
|
|
94
|
+
try {
|
|
95
|
+
const prefix = `presmium.voice-draft.v2:${JSON.stringify([identity]).slice(0, -1)},`
|
|
96
|
+
for (let index = 0; index < sessionStorage.length; index++) {
|
|
97
|
+
const key = sessionStorage.key(index)
|
|
98
|
+
if (key?.startsWith(prefix) && !key.endsWith(':unreadable')) keys.add(key.slice('presmium.voice-draft.v2:'.length))
|
|
99
|
+
}
|
|
100
|
+
} catch { partial = true }
|
|
101
|
+
const entries: { stepId: string, value: VoiceDraft, persisted: boolean }[] = []
|
|
102
|
+
for (const key of keys) {
|
|
103
|
+
let target: unknown
|
|
104
|
+
try { target = JSON.parse(key) } catch { partial = true; continue }
|
|
105
|
+
if (!Array.isArray(target) || target.length !== 2 || target[0] !== identity || typeof target[1] !== 'string') { partial = true; continue }
|
|
106
|
+
const entry = load(client, key)
|
|
107
|
+
let persisted = false
|
|
108
|
+
try { const raw = sessionStorage.getItem(storageKey(key)); persisted = entry.status === 'available' && raw === entry.raw; if (raw !== entry.raw) partial = true } catch { partial = true }
|
|
109
|
+
if (entry.status === 'corrupt' || entry.raw === undefined) partial = true
|
|
110
|
+
if (entry.draft) entries.push({ stepId: target[1], value: structuredClone(entry.draft), persisted })
|
|
111
|
+
}
|
|
112
|
+
return { entries, partial }
|
|
113
|
+
}
|
package/src/voice-messages.ts
CHANGED
|
@@ -31,21 +31,21 @@ const zh = {
|
|
|
31
31
|
auditionFailed: '无法试听,请重试。音色设置未更改。',
|
|
32
32
|
pauseUnavailable: '预览尚不支持暂停播放,暂时无法试听。请重新加载文稿。',
|
|
33
33
|
pauseTimeout: '无法确认播放已暂停,请重试。',
|
|
34
|
-
changed: '
|
|
34
|
+
changed: '文稿或音色设置已更新。草稿已保留,请重新检查范围。',
|
|
35
35
|
draftRecovered: '已恢复尚未应用的音色设置草稿,请检查范围后应用。', recoveryFailed: '无法在此浏览器保留音色草稿,请在关闭前应用或复制设置。',
|
|
36
|
-
recheck: '
|
|
36
|
+
recheck: '重新检查', scope: '应用范围', scopes: { step: '当前步骤', steps: '所选步骤', page: '当前页', document: '整份文稿' },
|
|
37
37
|
selectedSteps: '选择步骤', step: (page: number, step: number) => `第 ${page} 页,步骤 ${step}`,
|
|
38
38
|
selected: (count: number) => `已选择 ${count} 个步骤`, inherit: '使用继承的音色', inheritHint: '改用最近的页面或文稿默认音色。',
|
|
39
39
|
pageScript: (page: number) => `第 ${page} 页,关联讲稿(按页生成)`,
|
|
40
40
|
replace: '已有覆盖', preserve: '保留独立设置', replaceAll: '替换独立设置',
|
|
41
41
|
counts: (updated: number, preserved: number) => `将更新 ${updated} 个步骤,保留 ${preserved} 个独立设置。`,
|
|
42
|
-
check: '
|
|
42
|
+
check: '检查范围', checking: '正在检查范围…', apply: '应用', saved: '音色设置已保存。', cachedPreview: '本次使用已有配音缓存。', clearDefault: '清除默认音色',
|
|
43
43
|
rate: '语速', rateInvalid: (min: number, max: number) => `请输入 ${min}–${max} 之间的数值。`, style: '朗读风格', styleDefault: '服务默认',
|
|
44
44
|
cueStep: '此讲稿包含跨步骤提示,暂不支持单独覆盖音色。可设置页面或文稿默认音色。',
|
|
45
45
|
disclosure: (provider: string, local: boolean) => local ? `本次在本机通过 ${provider} 合成。` : `本次将所示讲稿发送至 ${provider} 合成配音。`,
|
|
46
|
-
confirmPreview: '
|
|
46
|
+
confirmPreview: '试听', sampleText: '标准示例文本', source: '声音来源', previewHint: '确认后播放已有缓存或请求合成;选择音色本身不会生成配音。',
|
|
47
47
|
refreshing: '正在加载配音状态…', refresh: '刷新状态', missingOnly: '只生成缺失与需要更新的片段',
|
|
48
|
-
confirmGenerate: '
|
|
48
|
+
confirmGenerate: '生成配音', cancelJob: '取消生成', oldVersion: '较早文稿版本', noScript: '当前范围没有可生成的讲稿。',
|
|
49
49
|
statuses: { ready: '可播放', missing: '需要生成', blocked: '暂不可生成', empty: '没有讲稿' },
|
|
50
50
|
jobs: { queued: '等待生成', running: '正在生成', cancelling: '正在取消', cancelled: '已取消', done: '已完成', failed: '生成失败', stale: '文稿已更新' },
|
|
51
51
|
progress: (done: number, total: number, failed: number) => `已完成 ${done} / ${total}${failed ? `,失败 ${failed}` : ''}`,
|
|
@@ -89,19 +89,19 @@ const en: VoiceMessages = {
|
|
|
89
89
|
pauseTimeout: 'Couldn’t confirm that playback paused. Try again.',
|
|
90
90
|
changed: 'The document or voice settings changed. Your draft is kept; check the scope again for the current step.',
|
|
91
91
|
draftRecovered: 'Your draft voice settings were recovered. Check the scope before applying them.', recoveryFailed: 'Voice drafts can’t be kept in this browser. Apply or copy your settings before closing.',
|
|
92
|
-
recheck: '
|
|
92
|
+
recheck: 'Recheck', scope: 'Apply to', scopes: { step: 'Current step', steps: 'Selected steps', page: 'Current page', document: 'Entire document' },
|
|
93
93
|
selectedSteps: 'Select Steps', step: (page, step) => `Page ${page}, step ${step}`, selected: count => `${count} steps selected`,
|
|
94
94
|
pageScript: page => `Page ${page}, linked script (generate by page)`,
|
|
95
95
|
inherit: 'Use Inherited Voice', inheritHint: 'Use the nearest page or document default voice.',
|
|
96
96
|
replace: 'Existing overrides', preserve: 'Keep independent settings', replaceAll: 'Replace independent settings',
|
|
97
97
|
counts: (updated, preserved) => `${updated} steps will update; ${preserved} independent settings will be kept.`,
|
|
98
|
-
check: 'Check Scope', checking: 'Checking scope…', apply: 'Apply
|
|
98
|
+
check: 'Check Scope', checking: 'Checking scope…', apply: 'Apply', saved: 'Voice settings saved.', cachedPreview: 'This preview uses an existing voiceover cache.', clearDefault: 'Clear Default Voice',
|
|
99
99
|
rate: 'Speaking rate', rateInvalid: (min, max) => `Enter a number between ${min} and ${max}.`, style: 'Reading style', styleDefault: 'Service default',
|
|
100
100
|
cueStep: 'This script has cues across steps. A step voice override is not supported yet; set a page or document default instead.',
|
|
101
101
|
disclosure: (provider, local) => local ? `The voiceover is generated on this device with ${provider}.` : `The script shown is sent to ${provider} to generate the voiceover.`,
|
|
102
|
-
confirmPreview: '
|
|
102
|
+
confirmPreview: 'Play Sample', sampleText: 'Standard sample text', source: 'Voice source', previewHint: 'After you confirm, a saved voiceover plays or a new one is generated. Choosing a voice doesn’t generate voiceover.',
|
|
103
103
|
refreshing: 'Loading voiceover status…', refresh: 'Refresh Status', missingOnly: 'Generate only missing clips and clips that need updating',
|
|
104
|
-
confirmGenerate: '
|
|
104
|
+
confirmGenerate: 'Generate', cancelJob: 'Cancel Generating', oldVersion: 'Earlier document version', noScript: 'There is no script to generate in this scope.',
|
|
105
105
|
statuses: { ready: 'Playable', missing: 'Needs generation', blocked: 'Unavailable', empty: 'No script' },
|
|
106
106
|
jobs: { queued: 'Queued', running: 'Generating', cancelling: 'Canceling', cancelled: 'Canceled', done: 'Completed', failed: 'Generation failed', stale: 'Document changed' },
|
|
107
107
|
progress: (done, total, failed) => `${done} / ${total} completed${failed ? `; ${failed} failed` : ''}`,
|
package/src/voiceover-jobs.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { errorMessage } from '@lincyaw/kernel'
|
|
2
2
|
import type { VoiceoverJob } from '@lincyaw/kernel'
|
|
3
|
-
import type { WorkbenchStore } from './workbench.ts'
|
|
3
|
+
import type { WorkbenchStore } from './workbench-state.ts'
|
|
4
4
|
import type { WorkspaceClient } from './workspace-client.ts'
|
|
5
5
|
|
|
6
6
|
const active = (job: VoiceoverJob) => ['queued', 'running', 'cancelling'].includes(job.state)
|