@lincyaw/kernel 1.0.0-rc.42 → 1.0.0-rc.44
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/package.json +1 -1
- package/src/contracts/authoring-actions.ts +3 -3
- package/src/contracts/authoring-clients.ts +20 -1
- package/src/contracts/document-voice.ts +35 -2
- package/src/contracts/speech-settings.ts +13 -0
- package/src/document-authoring-actions.ts +10 -0
- package/src/index.ts +1 -1
- package/src/node/authoring-actions.ts +1 -0
- package/src/node/document-voice.ts +6 -2
- package/src/node/index.ts +2 -2
- package/src/node/operator-speech.ts +4 -0
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import type { DocumentChangePlan } from './authoring.ts'
|
|
|
8
8
|
|
|
9
9
|
export const DOCUMENT_ACTION_MAX_REQUEST_CHARS = 4096
|
|
10
10
|
export const DOCUMENT_ACTION_MAX_RESPONSE_CHARS = 7168
|
|
11
|
-
export const DOCUMENT_AUTHORING_ACTION_TYPES = ['comment.create', 'comment.reply', 'comment.update', 'comment.react', 'comment.resolve', 'comment.reopen', 'comment.delete', 'voice.set', 'component.parameters.patch', 'component.step-parameters.patch', 'component.step-parameters.reset', 'component.definition.use', 'caption.timing.set', 'caption.timing.reset', 'caption.scale.set'] as const
|
|
11
|
+
export const DOCUMENT_AUTHORING_ACTION_TYPES = ['comment.create', 'comment.reply', 'comment.update', 'comment.react', 'comment.resolve', 'comment.reopen', 'comment.delete', 'voice.set', 'component.parameters.patch', 'component.step-parameters.patch', 'component.step-parameters.reset', 'component.definition.use', 'caption.timing.set', 'caption.timing.reset', 'caption.scale.set', 'production.enable'] as const
|
|
12
12
|
export const DOCUMENT_PARAMETER_MAX_CHANGES = 32
|
|
13
13
|
export const DOCUMENT_PARAMETER_MAX_PATH_DEPTH = 16
|
|
14
14
|
/** Paths belong only to this component's parameters; set replaces an array item or appends at its length. */
|
|
@@ -39,9 +39,9 @@ export interface DocumentComponentImpactAnswer {
|
|
|
39
39
|
collection: DocumentComponentImpactCollection, offset: number, total: number, entries: string[], nextOffset?: number, complete: boolean
|
|
40
40
|
}
|
|
41
41
|
/** New recording adoption belongs to the real-media service, never a raw settings action. */
|
|
42
|
-
export type DocumentAuthoringAction = DocumentCommentAction | DocumentComponentAction | DocumentCaptionTimingAction | { type: 'caption.scale.set', scale: number } | { type: 'voice.set', scope: DocumentVoiceScope, source: Exclude<VoiceSource, { type: 'recording' }> | null, replaceOverrides?: boolean }
|
|
42
|
+
export type DocumentAuthoringAction = DocumentCommentAction | DocumentComponentAction | DocumentCaptionTimingAction | { type: 'production.enable' } | { type: 'caption.scale.set', scale: number } | { type: 'voice.set', scope: DocumentVoiceScope, source: Exclude<VoiceSource, { type: 'recording' }> | null, replaceOverrides?: boolean }
|
|
43
43
|
export interface DocumentAuthoringActionRequest { id: string, source: CanonicalSource, action: DocumentAuthoringAction }
|
|
44
|
-
export type DocumentAuthoringActionEffect = { kind: 'caption-scale', value: { scale: number, changed: boolean } } | { kind: 'caption', value: { stepId: string, segments: number, changed: boolean, mode: 'manual' | 'automatic' } } | { kind: 'comment', value: DocumentCommentEffect } | { kind: 'voice', scope: DocumentVoiceScope['kind'], value: DocumentVoiceImpact, recordings: { preserved: number, removed: number } } | { kind: 'component', value: DocumentComponentEffect }
|
|
44
|
+
export type DocumentAuthoringActionEffect = { kind: 'production', value: { enabled: true, changed: boolean } } | { kind: 'caption-scale', value: { scale: number, changed: boolean } } | { kind: 'caption', value: { stepId: string, segments: number, changed: boolean, mode: 'manual' | 'automatic' } } | { kind: 'comment', value: DocumentCommentEffect } | { kind: 'voice', scope: DocumentVoiceScope['kind'], value: DocumentVoiceImpact, recordings: { preserved: number, removed: number } } | { kind: 'component', value: DocumentComponentEffect }
|
|
45
45
|
export interface DocumentAuthoringActionPlan extends DocumentChangePlan {
|
|
46
46
|
action: DocumentAuthoringAction
|
|
47
47
|
effect: DocumentAuthoringActionEffect
|
|
@@ -12,12 +12,19 @@ export const AUTHORING_CLIENT_MAX_REQUESTS = 64
|
|
|
12
12
|
export const AUTHORING_CLIENT_REQUEST_TIMEOUT_MS = 30000
|
|
13
13
|
export const AUTHORING_CLIENT_ACK_MAX_BYTES = 32768
|
|
14
14
|
export const AUTHORING_CLIENT_EVENT_MAX_BYTES = 8 << 10
|
|
15
|
-
export const AUTHORING_CLIENT_ACTIONS = ['state.read', 'source.flush', 'preview.prepare', 'comment-drafts.inspect', 'comment-drafts.read', 'comment-drafts.restore', 'comment-drafts.discard', 'component-drafts.inspect', 'component-drafts.read', 'component-drafts.restore', 'component-drafts.discard', 'playback.pause', 'position.step', 'playback.play', 'playback.seek', 'playback.rate'] as const
|
|
15
|
+
export const AUTHORING_CLIENT_ACTIONS = ['state.read', 'source.flush', 'preview.prepare', 'view.set', 'native-history.undo', 'native-history.redo', 'recording.start', 'recording.stop', 'recording.cancel', 'recording.discard', 'recording.save', 'recording.listen', 'recording.pause', 'comment-drafts.inspect', 'comment-drafts.read', 'comment-drafts.restore', 'comment-drafts.discard', 'component-drafts.inspect', 'component-drafts.read', 'component-drafts.restore', 'component-drafts.discard', 'playback.pause', 'position.step', 'playback.play', 'playback.seek', 'playback.rate'] as const
|
|
16
16
|
export type AuthoringClientActionType = typeof AUTHORING_CLIENT_ACTIONS[number]
|
|
17
|
+
export type AuthoringClientView = 'document' | 'reading' | 'presentation' | 'production'
|
|
18
|
+
/** Only these browser-owned actions may finish at a new saved source of the same document. */
|
|
19
|
+
export const authoringClientActionChangesSource = (type: AuthoringClientActionType): boolean => ['source.flush', 'native-history.undo', 'native-history.redo', 'recording.save'].includes(type)
|
|
17
20
|
export type AuthoringClientAction =
|
|
18
21
|
| { type: 'state.read' }
|
|
19
22
|
| { type: 'source.flush' }
|
|
20
23
|
| { type: 'preview.prepare' }
|
|
24
|
+
| { type: 'view.set', view: AuthoringClientView }
|
|
25
|
+
| { type: 'native-history.undo' | 'native-history.redo' }
|
|
26
|
+
| { type: 'recording.start' | 'recording.stop' | 'recording.cancel' | 'recording.save' | 'recording.listen' | 'recording.pause' }
|
|
27
|
+
| { type: 'recording.discard', confirm: true }
|
|
21
28
|
| { type: 'comment-drafts.inspect', cursor?: { after: string, token: string }, limit?: number }
|
|
22
29
|
| { type: 'comment-drafts.read', draft: ClientCommentDraftReference, offset: number, maxChars?: number }
|
|
23
30
|
| { type: 'comment-drafts.restore', draft: ClientCommentDraftReference, composerId: string, expectedCurrent: ClientCommentDraftReference | null }
|
|
@@ -78,6 +85,8 @@ export interface AuthoringClientSnapshot {
|
|
|
78
85
|
revision: number
|
|
79
86
|
source: CanonicalSource
|
|
80
87
|
view: 'document' | 'present'
|
|
88
|
+
mode?: AuthoringClientView
|
|
89
|
+
recording?: { phase: 'idle' | 'requesting' | 'recording' | 'stopping' | 'ready' | 'failed', elapsedMs: number, candidate?: { byteLength: number, mime: string, assetId?: string }, error?: string, audition?: 'idle' | 'loading' | 'playing' | 'failed' }
|
|
81
90
|
editing: { dirty: boolean, saving: boolean, composing: boolean, conflicted: boolean, locked: boolean, loading: boolean }
|
|
82
91
|
interaction: string
|
|
83
92
|
position?: { sectionId: string, stepId?: string }
|
|
@@ -97,6 +106,7 @@ export interface AuthoringClientDescriptor extends AuthoringClientConnection {
|
|
|
97
106
|
observedAt: string
|
|
98
107
|
verification: 'reported-state'
|
|
99
108
|
snapshot: AuthoringClientSnapshot
|
|
109
|
+
pendingRequest?: { requestId: string, action: AuthoringClientActionType, cancellationRequested?: true }
|
|
100
110
|
}
|
|
101
111
|
export interface AuthoringClientList { document: string, clients: AuthoringClientDescriptor[], nextAfter?: string, unavailable: readonly string[] }
|
|
102
112
|
export interface AuthoringClientRequest {
|
|
@@ -114,6 +124,7 @@ export interface AuthoringClientRequestResult extends AuthoringClientConnection
|
|
|
114
124
|
action: AuthoringClientActionType
|
|
115
125
|
source: CanonicalSource
|
|
116
126
|
state: AuthoringClientRequestState
|
|
127
|
+
cancellationRequested?: true
|
|
117
128
|
admittedAt: string
|
|
118
129
|
expiresAt: string
|
|
119
130
|
observedAt?: string
|
|
@@ -138,6 +149,7 @@ export interface AuthoringClients {
|
|
|
138
149
|
list(document: string, query: { clientId?: string, after?: string }, member: Member): Promise<AuthoringClientList>
|
|
139
150
|
request(document: string, request: AuthoringClientRequest, member: Member): Promise<AuthoringClientRequestResult>
|
|
140
151
|
get(document: string, query: { clientId: string, epoch: string, requestId: string }, member: Member): Promise<AuthoringClientRequestResult>
|
|
152
|
+
cancel?(document: string, query: { clientId: string, epoch: string, requestId: string }, member: Member): Promise<AuthoringClientRequestResult>
|
|
141
153
|
}
|
|
142
154
|
|
|
143
155
|
/** Reserve the complete receipt and the host-only lease, rather than budgeting only the text fragment. */
|
|
@@ -187,6 +199,10 @@ const position = object({ timeMs: number, stepTimeMs: number, sectionId: entity,
|
|
|
187
199
|
const playback = object({ binding, status: { enum: ['loading', 'ready', 'estimated', 'unavailable', 'failed'] }, position, error: { type: 'string', maxLength: 300 } }, ['binding', 'status'])
|
|
188
200
|
export const AUTHORING_CLIENT_SNAPSHOT_SCHEMA: Schema = object({
|
|
189
201
|
revision: integer, source, view: { enum: ['document', 'present'] }, editing: object({ dirty: bool, saving: bool, composing: bool, conflicted: bool, locked: bool, loading: bool }),
|
|
202
|
+
mode: { enum: ['document', 'reading', 'presentation', 'production'] },
|
|
203
|
+
recording: object({ phase: { enum: ['idle', 'requesting', 'recording', 'stopping', 'ready', 'failed'] }, elapsedMs: number,
|
|
204
|
+
candidate: object({ byteLength: integer, mime: { type: 'string', maxLength: 200 }, assetId: entity }, ['byteLength', 'mime']),
|
|
205
|
+
error: entity, audition: { enum: ['idle', 'loading', 'playing', 'failed'] } }, ['phase', 'elapsedMs']),
|
|
190
206
|
interaction: { type: 'string', maxLength: 200 }, position: object({ sectionId: entity, stepId: entity }, ['sectionId']), binding, playback,
|
|
191
207
|
preview: { oneOf: [object({ status: { enum: ['unprepared', 'preparing', 'unavailable'] } }), object({ status: { const: 'prepared' }, source, irRevision: entity, projectRevision: integer })] },
|
|
192
208
|
actions: { type: 'array', items: { enum: [...AUTHORING_CLIENT_ACTIONS] }, maxItems: AUTHORING_CLIENT_ACTIONS.length, uniqueItems: true }, unsubmittedContent: { const: 'not-inspected' },
|
|
@@ -194,6 +210,9 @@ export const AUTHORING_CLIENT_SNAPSHOT_SCHEMA: Schema = object({
|
|
|
194
210
|
const action = (type: string, properties: Record<string, Schema> = {}): Schema => object({ type: { const: type }, ...properties })
|
|
195
211
|
export const AUTHORING_CLIENT_ACTION_SCHEMA: Schema = { oneOf: [
|
|
196
212
|
action('state.read'), action('source.flush'), action('preview.prepare'), action('playback.pause'), action('position.step', { sectionId: entity, stepId: entity }),
|
|
213
|
+
action('view.set', { view: { enum: ['document', 'reading', 'presentation', 'production'] } }),
|
|
214
|
+
...['native-history.undo', 'native-history.redo', 'recording.start', 'recording.stop', 'recording.cancel', 'recording.save', 'recording.listen', 'recording.pause'].map(type => action(type)),
|
|
215
|
+
action('recording.discard', { confirm: { const: true } }),
|
|
197
216
|
object({ type: { const: 'comment-drafts.inspect' }, cursor, limit: { type: 'integer', minimum: 1, maximum: 10 } }, ['type']),
|
|
198
217
|
object({ type: { const: 'comment-drafts.read' }, draft: draftReference, offset: integer, maxChars: { type: 'integer', minimum: 2, maximum: 2048 } }, ['type', 'draft', 'offset']),
|
|
199
218
|
action('comment-drafts.restore', { draft: draftReference, composerId: id, expectedCurrent: nullableCommentReference }),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { CanonicalSource } from '../ir.ts'
|
|
2
|
+
import type { Schema } from '@cfworker/json-schema'
|
|
2
3
|
import type { Finding } from './checks.ts'
|
|
3
4
|
import type { Member } from './server.ts'
|
|
4
|
-
import type { SpeechEngineInfo } from './speech.ts'
|
|
5
|
+
import type { SpeechEngineInfo, VoiceCloneRequest, VoiceCloneStatus } from './speech.ts'
|
|
5
6
|
import type { VoiceCatalogAnswer, VoiceoverCancellation } from './voice.ts'
|
|
6
7
|
import type { DocumentVoiceTasks, VoiceoverJobQuery, VoiceoverStart, VoicePreviewStart } from './voiceover-execution.ts'
|
|
7
8
|
|
|
@@ -16,13 +17,29 @@ export interface DocumentVoiceCapabilities {
|
|
|
16
17
|
preview: boolean
|
|
17
18
|
engines: SpeechEngineInfo[]
|
|
18
19
|
defaultEngine?: string
|
|
19
|
-
actions: { status: boolean, list: true, get: true, start: boolean, cancel: true, quotePreview: boolean, preview: boolean, readPreview: true }
|
|
20
|
+
actions: { status: boolean, list: true, get: true, start: boolean, cancel: true, quotePreview: boolean, preview: boolean, readPreview: true, clone?: boolean, cloneStatus?: boolean }
|
|
20
21
|
tasks: { idempotency: 'process', limits: { intents: number, recentJobs: number, concurrent: number, quotes: number, quoteLifetimeMs: number, previewBytes: number, previewResources: number, retainedPreviewBytes: number } }
|
|
21
22
|
findings?: Finding[]
|
|
22
23
|
}
|
|
23
24
|
export interface DocumentVoiceCatalogQuery { source?: CanonicalSource, engine?: string, lang?: string }
|
|
24
25
|
export interface DocumentVoiceCatalogAnswer extends VoiceCatalogAnswer { document: string, source: CanonicalSource, findings?: Finding[] }
|
|
25
26
|
|
|
27
|
+
export const VOICE_CLONE_MAX_AUDIO_BYTES = 10 << 20
|
|
28
|
+
/** Files are scoped workspace paths; the service reads and fixes their bytes before spending approval. */
|
|
29
|
+
export type DocumentVoiceCloneRequest = Omit<VoiceCloneRequest, 'sample' | 'consent'> & {
|
|
30
|
+
source?: CanonicalSource
|
|
31
|
+
sample: string
|
|
32
|
+
consent: { speaker: string, scope: string, statement: string }
|
|
33
|
+
}
|
|
34
|
+
export interface DocumentVoiceCloneQuery { engine?: string, voice: string }
|
|
35
|
+
/** A process-local capability for this call, never a model argument or a retained plan. */
|
|
36
|
+
export interface PreparedVoiceClone {
|
|
37
|
+
engine: string
|
|
38
|
+
voice: string
|
|
39
|
+
start(signal?: AbortSignal): Promise<VoiceCloneStatus>
|
|
40
|
+
close(): void
|
|
41
|
+
}
|
|
42
|
+
|
|
26
43
|
/** Shared voice discovery and explicitly authorized tasks; discovery never compiles or synthesizes. */
|
|
27
44
|
export interface DocumentVoiceAuthoring extends DocumentVoiceTasks {
|
|
28
45
|
capabilities(document: string, member: Member, signal?: AbortSignal): Promise<DocumentVoiceCapabilities>
|
|
@@ -32,6 +49,8 @@ export interface DocumentVoiceAuthoring extends DocumentVoiceTasks {
|
|
|
32
49
|
checkPreview(document: string, request: VoicePreviewStart, member: Member, signal?: AbortSignal): Promise<void>
|
|
33
50
|
/** Undefined when there is something to cancel; otherwise the unchanged state that cancel would report. */
|
|
34
51
|
checkCancel(document: string, query: VoiceoverJobQuery, member: Member): Promise<VoiceoverCancellation | undefined>
|
|
52
|
+
prepareClone?(document: string, request: DocumentVoiceCloneRequest, member: Member, signal?: AbortSignal): Promise<PreparedVoiceClone>
|
|
53
|
+
cloneStatus?(document: string, query: DocumentVoiceCloneQuery, member: Member, signal?: AbortSignal): Promise<VoiceCloneStatus>
|
|
35
54
|
}
|
|
36
55
|
|
|
37
56
|
export const DOCUMENT_VOICE_CATALOG_SCHEMA = {
|
|
@@ -42,3 +61,17 @@ export const DOCUMENT_VOICE_CATALOG_SCHEMA = {
|
|
|
42
61
|
lang: { type: 'string', minLength: 1, maxLength: 100 },
|
|
43
62
|
},
|
|
44
63
|
} as const
|
|
64
|
+
|
|
65
|
+
const cloneText = { type: 'string', minLength: 1, maxLength: 200 } as const
|
|
66
|
+
export const DOCUMENT_VOICE_CLONE_QUERY_SCHEMA: Schema = {
|
|
67
|
+
type: 'object', additionalProperties: false, properties: { engine: cloneText, voice: cloneText }, required: ['voice'],
|
|
68
|
+
}
|
|
69
|
+
export const DOCUMENT_VOICE_CLONE_SCHEMA: Schema = {
|
|
70
|
+
type: 'object', additionalProperties: false,
|
|
71
|
+
properties: {
|
|
72
|
+
source: structuredClone(DOCUMENT_VOICE_CATALOG_SCHEMA.properties.source) as unknown as Schema, engine: cloneText, voice: cloneText,
|
|
73
|
+
sample: { type: 'string', minLength: 1, maxLength: 1024 },
|
|
74
|
+
consent: { type: 'object', additionalProperties: false, properties: { speaker: cloneText, scope: { type: 'string', minLength: 1, maxLength: 2000 }, statement: { type: 'string', minLength: 1, maxLength: 1024 } }, required: ['speaker', 'scope', 'statement'] },
|
|
75
|
+
lang: { type: 'string', minLength: 1, maxLength: 100 }, text: { type: 'string', maxLength: 4000 },
|
|
76
|
+
}, required: ['voice', 'sample', 'consent'],
|
|
77
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Schema } from '@cfworker/json-schema'
|
|
2
|
+
|
|
1
3
|
/** Operator configuration is separate from document voice choices. Secret values are write-only. */
|
|
2
4
|
export interface SpeechSettingsAnswer {
|
|
3
5
|
provider: 'volcengine'
|
|
@@ -14,3 +16,14 @@ export interface SpeechSettingsAnswer {
|
|
|
14
16
|
export type SpeechSettingsChange =
|
|
15
17
|
| { action: 'save', revision: string, apiKey?: string, appId?: string }
|
|
16
18
|
| { action: 'clear', revision: string }
|
|
19
|
+
|
|
20
|
+
export interface SpeechSettings {
|
|
21
|
+
read(): SpeechSettingsAnswer
|
|
22
|
+
change(change: SpeechSettingsChange): Promise<SpeechSettingsAnswer>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const SPEECH_SETTINGS_CHANGE_SCHEMA: Schema = {
|
|
26
|
+
type: 'object', additionalProperties: false,
|
|
27
|
+
properties: { action: { enum: ['save', 'clear'] }, revision: { type: 'string', maxLength: 200 }, apiKey: { type: 'string', maxLength: 8192 }, appId: { type: 'string', maxLength: 32 } },
|
|
28
|
+
required: ['action', 'revision'],
|
|
29
|
+
}
|
|
@@ -9,9 +9,19 @@ import type { DocumentAuthoringAction, DocumentAuthoringActionEffect } from './c
|
|
|
9
9
|
import type { DocumentCommentContext } from './contracts/document-comments.ts'
|
|
10
10
|
import type { TeachingDocument } from './contracts/document.ts'
|
|
11
11
|
|
|
12
|
+
export function enableDocumentProduction(document: TeachingDocument): TeachingDocument {
|
|
13
|
+
const plugins = [...new Set([...(document.metadata.plugins ?? []), '@lincyaw/addon-lecture', '@lincyaw/addon-speech'])]
|
|
14
|
+
if (JSON.stringify(plugins) === JSON.stringify(document.metadata.plugins) && document.metadata.renderers?.lecture) return document
|
|
15
|
+
return { ...document, metadata: { ...document.metadata, plugins, renderers: { ...document.metadata.renderers, lecture: document.metadata.renderers?.lecture ?? {} } } }
|
|
16
|
+
}
|
|
17
|
+
|
|
12
18
|
/** Fixed context is supplied by the owning adapter exactly once per semantic plan. */
|
|
13
19
|
export function applyDocumentAuthoringAction(document: TeachingDocument, action: DocumentAuthoringAction, context: DocumentCommentContext): { content: TeachingDocument, effect: DocumentAuthoringActionEffect } {
|
|
14
20
|
if (!context.member || !hasRole(context.member, 'editor')) throw new DocumentCommentError(403, 'authoring-permission-denied')
|
|
21
|
+
if (action.type === 'production.enable') {
|
|
22
|
+
const content = enableDocumentProduction(document)
|
|
23
|
+
return { content, effect: { kind: 'production', value: { enabled: true, changed: content !== document } } }
|
|
24
|
+
}
|
|
15
25
|
if (action.type === 'caption.scale.set') {
|
|
16
26
|
const content = changeDocumentCaptionScale(document, action.scale)
|
|
17
27
|
return { content, effect: { kind: 'caption-scale', value: { scale: captionScale(content.production), changed: content !== document } } }
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { DOCUMENT_COLOR_NAMES, documentColorToken, documentColorValue } from './
|
|
|
10
10
|
export type { DocumentColorKind, DocumentColorName } from './document-colors.ts'
|
|
11
11
|
export { applyDocumentCommentAction, degradeDocumentCommentAnchor, isDocumentTextLink, documentCommentTargets, validateDocumentCommentAnchor, DocumentCommentError } from './document-comments.ts'
|
|
12
12
|
export { documentAnchorKey, documentAnchorOrder, documentBlockSection, walkDocumentPlaces } from './document-places.ts'
|
|
13
|
-
export { applyDocumentAuthoringAction } from './document-authoring-actions.ts'
|
|
13
|
+
export { applyDocumentAuthoringAction, enableDocumentProduction } from './document-authoring-actions.ts'
|
|
14
14
|
export { applyDocumentComponentAction, effectiveComponentParameters, createDocumentParameterChanges, documentComponentSection, DocumentComponentError } from './document-components.ts'
|
|
15
15
|
export type { DocumentStepVoice, DocumentVoiceImpact, DocumentVoiceOptions, DocumentVoiceScope } from './document-voices.ts'
|
|
16
16
|
export { prepareTranscriptionAdoption } from './transcription-adoption.ts'
|
|
@@ -34,6 +34,7 @@ export const DOCUMENT_AUTHORING_ACTION_SCHEMA: Schema = {
|
|
|
34
34
|
action('caption.timing.set', { stepId: id, value: { $ref: '#/$defs/CaptionTiming' } }),
|
|
35
35
|
action('caption.timing.reset', { stepId: id }),
|
|
36
36
|
action('caption.scale.set', { scale: { type: 'number' } }),
|
|
37
|
+
action('production.enable', {}),
|
|
37
38
|
action('component.parameters.patch', { blockId: id, changes }),
|
|
38
39
|
action('component.step-parameters.patch', { blockId: id, stepId: id, changes }),
|
|
39
40
|
action('component.step-parameters.reset', { blockId: id, stepId: id }),
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Validator } from '@cfworker/json-schema'
|
|
2
2
|
import type { Schema } from '@cfworker/json-schema'
|
|
3
|
-
import { DOCUMENT_VOICE_CATALOG_SCHEMA } from '../contracts/document-voice.ts'
|
|
4
|
-
import type { DocumentVoiceCatalogQuery } from '../contracts/document-voice.ts'
|
|
3
|
+
import { DOCUMENT_VOICE_CATALOG_SCHEMA, DOCUMENT_VOICE_CLONE_SCHEMA, DOCUMENT_VOICE_CLONE_QUERY_SCHEMA } from '../contracts/document-voice.ts'
|
|
4
|
+
import type { DocumentVoiceCatalogQuery, DocumentVoiceCloneRequest, DocumentVoiceCloneQuery } from '../contracts/document-voice.ts'
|
|
5
5
|
|
|
6
6
|
const validator = new Validator(structuredClone(DOCUMENT_VOICE_CATALOG_SCHEMA) as unknown as Schema, '2020-12', false)
|
|
7
7
|
export const validateDocumentVoiceCatalogQuery = (value: unknown): value is DocumentVoiceCatalogQuery => validator.validate(value).valid
|
|
8
|
+
const clone = new Validator(structuredClone(DOCUMENT_VOICE_CLONE_SCHEMA), '2020-12', false)
|
|
9
|
+
const cloneQuery = new Validator(structuredClone(DOCUMENT_VOICE_CLONE_QUERY_SCHEMA), '2020-12', false)
|
|
10
|
+
export const validateDocumentVoiceClone = (value: unknown): value is DocumentVoiceCloneRequest => clone.validate(value).valid
|
|
11
|
+
export const validateDocumentVoiceCloneQuery = (value: unknown): value is DocumentVoiceCloneQuery => cloneQuery.validate(value).valid
|
package/src/node/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { validateDocumentOutlineQuery, validateDocumentPartQuery } from './docum
|
|
|
5
5
|
export { DOCUMENT_AUTHORING_ACTION_SCHEMA, DOCUMENT_AUTHORING_ACTION_APPLY_SCHEMA, DOCUMENT_AUTHORING_ACTION_IMPACT_SCHEMA, validateDocumentAuthoringAction, validateDocumentAuthoringActionReference, validateDocumentAuthoringActionImpact } from './authoring-actions.ts'
|
|
6
6
|
export { validateDocumentTranscriptionRequest } from './transcription.ts'
|
|
7
7
|
export { validateDocumentRecordingAdoption, validateDocumentAudioInspect, validateDocumentWorkspaceAudioImport, validateDocumentWorkspaceAudioInspect, validateDocumentMediaClipValidation, validateDocumentMediaClipEdit, validateDocumentProductionPlanQuery } from './document-audio.ts'
|
|
8
|
-
export { validateDocumentVoiceCatalogQuery } from './document-voice.ts'
|
|
8
|
+
export { validateDocumentVoiceCatalogQuery, validateDocumentVoiceClone, validateDocumentVoiceCloneQuery } from './document-voice.ts'
|
|
9
9
|
export { createVoiceoverOwner, VoiceoverOperationError, validateVoiceoverStart, validateVoiceoverStatus, validateVoiceoverJobQuery, validateVoicePreviewCheck, validateVoicePreviewStart } from './voiceover.ts'
|
|
10
10
|
export { createVoiceoverRoutes } from './voiceover-routes.ts'
|
|
11
11
|
export { validateTranscriptionAdoptionDraft, validateTranscriptionAdoptionApply } from './transcription-adoption.ts'
|
|
@@ -26,6 +26,6 @@ export { validateAuthoringClientRequest, validateAuthoringClientQuery, validateA
|
|
|
26
26
|
export { validateProjectPlan, validateProjectApply } from './projects.ts'
|
|
27
27
|
export { validateDocumentWorkspaceImageInspect, validateDocumentWorkspaceImageImport } from './document-image.ts'
|
|
28
28
|
export { systemLocale } from './locale.ts'
|
|
29
|
-
export { OperatorSpeechSettings, operatorSpeechSecrets, SpeechSettingsError } from './operator-speech.ts'
|
|
29
|
+
export { OperatorSpeechSettings, operatorSpeechSecrets, SpeechSettingsError, validateSpeechSettingsChange } from './operator-speech.ts'
|
|
30
30
|
export { devStateFile, readServiceState, removeServiceState, serveStateDir } from './service-state.ts'
|
|
31
31
|
export type { ServiceState } from './service-state.ts'
|
|
@@ -2,10 +2,14 @@ import { createRequire } from 'node:module'
|
|
|
2
2
|
import { randomUUID } from 'node:crypto'
|
|
3
3
|
import { constants, closeSync, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs'
|
|
4
4
|
import { dirname, join } from 'node:path'
|
|
5
|
+
import { Validator } from '@cfworker/json-schema'
|
|
6
|
+
import { SPEECH_SETTINGS_CHANGE_SCHEMA } from '../contracts/speech-settings.ts'
|
|
5
7
|
import type { SpeechSettingsAnswer, SpeechSettingsChange } from '../contracts/speech-settings.ts'
|
|
6
8
|
|
|
7
9
|
const KEY = 'PRESMIUM_SPEECH_VOLCENGINE_KEY', APPID = 'PRESMIUM_SPEECH_VOLCENGINE_APPID'
|
|
8
10
|
const MAX_BYTES = 16384
|
|
11
|
+
const settingsChangeValidator = new Validator(structuredClone(SPEECH_SETTINGS_CHANGE_SCHEMA), '2020-12', false)
|
|
12
|
+
export const validateSpeechSettingsChange = (value: unknown): value is SpeechSettingsChange => settingsChangeValidator.validate(value).valid
|
|
9
13
|
const lockfile = createRequire(import.meta.url)('proper-lockfile') as { lock(file: string, options: { realpath: boolean, retries: number }): Promise<() => Promise<void>> }
|
|
10
14
|
interface Stored { version: 1, revision: string, key?: string, appId?: string }
|
|
11
15
|
const empty = (): Stored => ({ version: 1, revision: 'none' })
|