@lincyaw/workbench 0.2.0-rc.4 → 0.2.0-rc.41
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 +5 -4
- package/src/MediaClipEditor.tsx +1 -1
- package/src/authoring-client.ts +3 -3
- package/src/authoring-draft-fragment.ts +3 -1
- package/src/component-property-drafts.ts +5 -5
- package/src/components.tsx +10 -28
- package/src/context.tsx +2 -1
- package/src/diagnostics.ts +1 -1
- package/src/document-drafts.ts +6 -7
- package/src/document-editing.ts +484 -0
- package/src/document-editor/BlockNoteSurface.tsx +25 -9
- package/src/document-editor/ComponentMaterials.tsx +3 -9
- package/src/document-editor/ComponentPropertiesDialog.tsx +4 -4
- package/src/document-editor/DocumentBlockPreview.tsx +4 -2
- package/src/document-editor/DocumentComments.tsx +58 -9
- package/src/document-editor/DocumentEditor.tsx +44 -7
- package/src/document-editor/DocumentStepNarration.tsx +30 -25
- package/src/document-editor/NarrationEditor.tsx +54 -20
- package/src/document-editor/NewCommentDrafts.tsx +4 -3
- package/src/document-editor/PlaceComment.tsx +150 -0
- package/src/document-editor/comment-drafts.ts +16 -14
- package/src/document-editor/comments.ts +30 -10
- 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/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/projection.ts +2 -2
- package/src/document-editor/rich-text.ts +3 -2
- package/src/document-editor/selection.ts +13 -0
- package/src/document-editor/style.css +12 -1
- package/src/document-editor/table-identities.ts +2 -1
- package/src/document-production.ts +331 -0
- package/src/document-session.ts +50 -16
- package/src/history.ts +3 -3
- package/src/index.ts +5 -5
- package/src/jobs.ts +1 -1
- package/src/messages.ts +19 -4
- package/src/panels/DocumentView.tsx +21 -21
- package/src/panels/DocumentVoiceDialog.tsx +2 -2
- package/src/panels/DocumentVoiceField.tsx +1 -1
- package/src/panels/ExportPanel.tsx +1 -6
- package/src/panels/HistoryPanel.tsx +1 -1
- package/src/panels/PageDeleteDialog.tsx +4 -4
- package/src/panels/PageRenameDialog.tsx +1 -1
- package/src/panels/PreviewPanel.tsx +1 -4
- package/src/panels/ProductionCaptionSize.tsx +20 -0
- package/src/panels/ProductionCaptionTiming.tsx +7 -7
- package/src/panels/ProductionMediaClips.tsx +6 -5
- package/src/panels/ProductionPanel.tsx +7 -3
- package/src/panels/ProductionRecording.tsx +1 -1
- package/src/panels/ProductionRecordingRange.tsx +4 -4
- package/src/panels/ProductionTimeline.tsx +6 -1
- package/src/panels/ProductionTranscription.tsx +5 -4
- package/src/panels/SourceDocumentPanel.tsx +12 -15
- package/src/panels/TranscriptionAdoption.tsx +9 -8
- package/src/panels/VoiceoverDialog.tsx +1 -1
- package/src/places.ts +1 -36
- package/src/preview-playback.ts +1 -1
- package/src/production-messages.ts +6 -0
- package/src/production-playback.ts +1 -1
- package/src/production-voice-playback.ts +3 -2
- package/src/sha256.ts +9 -0
- package/src/styles.css +16 -41
- package/src/use-recording-adoption.ts +2 -2
- package/src/voiceover-jobs.ts +1 -1
- package/src/workbench-state.ts +157 -0
- package/src/workbench.ts +101 -932
- package/src/workspace-client.ts +2 -1
- package/src/assistant-mascot.ts +0 -62
- package/src/mascot-preference.ts +0 -37
- package/src/panels/ChangeTrail.tsx +0 -79
|
@@ -58,13 +58,13 @@ export function useRecordingAdoption({ identity, sectionId, stepId, active, disa
|
|
|
58
58
|
if (!owns()) return
|
|
59
59
|
const source = workbench.getState().authoring
|
|
60
60
|
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.
|
|
61
|
+
const expected = { identity, version: source.version }, inspection = await workbench.production.inspectAudio(target.assetId, expected, controller.signal)
|
|
62
62
|
if (!owns()) return
|
|
63
63
|
const canonical = { documentId: source.content.id, version: source.version, fingerprint: source.fingerprint }, previous = retry.current
|
|
64
64
|
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
65
|
? previous : { id: requestId(), source: canonical, stepId: target.stepId, assetId: target.assetId, sha256: inspection.inspection.sha256 }
|
|
66
66
|
retry.current = sent; submitted.current = sent
|
|
67
|
-
await workbench.
|
|
67
|
+
await workbench.production.adoptRecording(sent, expected, controller.signal)
|
|
68
68
|
if (!owns()) return
|
|
69
69
|
if (retry.current === sent) retry.current = undefined
|
|
70
70
|
setFailure(undefined)
|
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)
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { CanonicalSource, DiagnosticSnapshot, DocumentsAnswer, FocusReport, IrAnswer, JobsAnswer, PreviewAnchor, PreviewAnswer, PreviewCommand, PreviewPoint, PreviewPosition, PreviewRect, PreviewRenderer, ProductionPlan, ProductionPlaybackState, ReviewSnapshot, RevisionsAnswer, UncommittedFile, VoiceoverJob } from '@lincyaw/kernel'
|
|
2
|
+
import type { DocumentSessionState } from './document-session.ts'
|
|
3
|
+
import type { Locale } from './messages.ts'
|
|
4
|
+
|
|
5
|
+
/** `editing`: the canonical document is edited in the parent; `viewing`: a derived snapshot is presented. */
|
|
6
|
+
export type WorkbenchMode = 'editing' | 'viewing'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* How the web form is shown: as a page or as its presentation, whose controls can play a configured lecture.
|
|
10
|
+
* Both share one preview page and switch in place with `go.view`.
|
|
11
|
+
*/
|
|
12
|
+
export type WebView = 'document' | 'present'
|
|
13
|
+
|
|
14
|
+
/** A playback key pressed in a preview that the workbench plays: Space, and the left and right arrows. */
|
|
15
|
+
export type PlaybackKey = 'play-pause' | 'previous' | 'next'
|
|
16
|
+
|
|
17
|
+
/** What the author points at in the document: a block (or a section), or a passage selected in it. */
|
|
18
|
+
export interface Pointer {
|
|
19
|
+
target: PreviewAnchor
|
|
20
|
+
step?: number
|
|
21
|
+
/** The selected passage. */
|
|
22
|
+
quote?: string
|
|
23
|
+
/** Its box in the preview's viewport; none while it is out of sight. */
|
|
24
|
+
rect?: PreviewRect
|
|
25
|
+
obstacles?: PreviewRect[]
|
|
26
|
+
point?: PreviewPoint
|
|
27
|
+
/** Its text can be edited in place. */
|
|
28
|
+
isEditable: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type SaveState =
|
|
32
|
+
| { kind: 'idle' }
|
|
33
|
+
| { kind: 'saving' }
|
|
34
|
+
| { kind: 'saved', at: string }
|
|
35
|
+
| { kind: 'locked' }
|
|
36
|
+
| { kind: 'failed', message: string }
|
|
37
|
+
|
|
38
|
+
/** A request for the agent of the conversation: its text and what it is about. */
|
|
39
|
+
export interface AgentRequest {
|
|
40
|
+
text: string
|
|
41
|
+
focus: FocusReport[]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A request for the author to finish and send in the conversation, and what it is about: the host only shows it. */
|
|
45
|
+
export interface AgentDraft {
|
|
46
|
+
text: string
|
|
47
|
+
focus: FocusReport[]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Where the host put a request: the conversation's session and the request's id, which its user message carries. */
|
|
51
|
+
export interface AgentAnswer {
|
|
52
|
+
session: string
|
|
53
|
+
request: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface WorkbenchState {
|
|
57
|
+
locale: Locale
|
|
58
|
+
authoring?: DocumentSessionState
|
|
59
|
+
/** Unaccepted numeric form input is retained separately from saved canonical timing. */
|
|
60
|
+
hasDocumentTimingDrafts?: boolean
|
|
61
|
+
documentTimingDraftStorageFailure?: boolean
|
|
62
|
+
captionTimingDraftSteps?: string[]
|
|
63
|
+
captionTimingDraftStorageFailure?: boolean
|
|
64
|
+
isDark: boolean
|
|
65
|
+
documents?: DocumentsAnswer
|
|
66
|
+
documentsFailure?: string
|
|
67
|
+
/** The workspace's routes answer 404: `@lincyaw/dsh` is turned off on the plugins page. */
|
|
68
|
+
isBundleDisabled?: boolean
|
|
69
|
+
document?: string
|
|
70
|
+
ir?: IrAnswer
|
|
71
|
+
mode: WorkbenchMode
|
|
72
|
+
previewRenderer: PreviewRenderer
|
|
73
|
+
/** In the web form: the page or the presentation, both in the same page, switched without loading it again. */
|
|
74
|
+
webView: WebView
|
|
75
|
+
previewReload: number
|
|
76
|
+
preview?: PreviewAnswer
|
|
77
|
+
previewFailure?: string
|
|
78
|
+
/** The IR revision the preview shows. */
|
|
79
|
+
previewIrRevision?: string
|
|
80
|
+
isPreparingPresentation?: boolean
|
|
81
|
+
presentationFailure?: string
|
|
82
|
+
presentationSnapshot?: { version: string, fingerprint: string, revision: string, project: number }
|
|
83
|
+
productionPlan?: ProductionPlan
|
|
84
|
+
productionPlayback?: ProductionPlaybackState
|
|
85
|
+
productionFailure?: string
|
|
86
|
+
voiceoverJobs?: VoiceoverJob[]
|
|
87
|
+
voiceoverJobsFailure?: string
|
|
88
|
+
/** A cache refresh that actually changed the current production binding; it never starts playback. */
|
|
89
|
+
voiceoverCacheRefresh?: { source: CanonicalSource, revision: string, sequence: number }
|
|
90
|
+
/** Changes when an acknowledged preview connection is attached or detached, including same-revision reloads. */
|
|
91
|
+
previewConnection: number
|
|
92
|
+
/** Where the preview is: the section the author reads, or the slide and its step. */
|
|
93
|
+
position?: PreviewPosition
|
|
94
|
+
/** Changes on every position intent, including A → B → A, without changing the source. */
|
|
95
|
+
documentPositionToken: string
|
|
96
|
+
/** Explicit author navigation, distinct from the player's passive cursor and frame reload reports. */
|
|
97
|
+
productionNavigationVersion: number
|
|
98
|
+
documentPositionIntent: 'seek' | 'pause'
|
|
99
|
+
/** An explicit source navigation request; scrolling updates position without issuing another request. */
|
|
100
|
+
documentNavigation?: { section: string, block?: string, request: string }
|
|
101
|
+
documentPositionFailure?: 'removed'
|
|
102
|
+
isCreatingPage?: boolean
|
|
103
|
+
isEditingPage?: boolean
|
|
104
|
+
editorHistory?: EditorHistoryState
|
|
105
|
+
isHistoryPreparing?: boolean
|
|
106
|
+
pageEditFailure?: string
|
|
107
|
+
diagnostics?: DiagnosticSnapshot
|
|
108
|
+
isDiagnosticsUnavailable: boolean
|
|
109
|
+
canRepairDiagnostics: boolean
|
|
110
|
+
isRepairingDiagnostics: boolean
|
|
111
|
+
diagnosticsRepairFailure?: string
|
|
112
|
+
pointer?: Pointer
|
|
113
|
+
save: SaveState
|
|
114
|
+
/** What the conversation's agent is told the author points at. */
|
|
115
|
+
focus: FocusReport[]
|
|
116
|
+
isFocusPending: boolean
|
|
117
|
+
focusFailure?: string
|
|
118
|
+
review?: ReviewSnapshot
|
|
119
|
+
history?: RevisionsAnswer
|
|
120
|
+
/** Files changed elsewhere and not yet in the history. */
|
|
121
|
+
outside?: UncommittedFile[]
|
|
122
|
+
historyFailure?: string
|
|
123
|
+
isHistoryBusy: boolean
|
|
124
|
+
isAsking: boolean
|
|
125
|
+
askFailure?: string
|
|
126
|
+
/** What the document can be made into, and its builds and exports (the author's and the AI's). */
|
|
127
|
+
jobs?: JobsAnswer
|
|
128
|
+
jobsFailure?: string
|
|
129
|
+
voiceServiceVersion?: number
|
|
130
|
+
jobPreparing?: { target: string, canCancel: boolean }
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface PreviewSink {
|
|
134
|
+
readonly generation?: number
|
|
135
|
+
readonly capabilities?: readonly PreviewCommand['type'][]
|
|
136
|
+
send(command: PreviewCommand): void
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface EditorHistoryState { section: string, undo: boolean, redo: boolean, field?: boolean }
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
/** The workbench's state as its parts read and change it. */
|
|
143
|
+
export interface WorkbenchStore {
|
|
144
|
+
readonly state: WorkbenchState
|
|
145
|
+
set(patch: Partial<WorkbenchState>): void
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** The document the conversation works on: none when no document is open. */
|
|
149
|
+
export function selectedDocument(state: WorkbenchState): string | null {
|
|
150
|
+
return state.document ?? null
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Whether the AI is changing the workspace now, or its change waits for the author. */
|
|
154
|
+
export function isAgentChanging(state: WorkbenchState): boolean {
|
|
155
|
+
return Boolean(state.review?.engine === 'git' && (state.review.running || state.review.changes.length > 0))
|
|
156
|
+
}
|
|
157
|
+
|