@lincyaw/workbench 0.2.0-rc.12 → 0.2.0-rc.121

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.
Files changed (124) hide show
  1. package/README.md +1 -1
  2. package/package.json +5 -4
  3. package/src/AgentActivityBar.tsx +25 -0
  4. package/src/MediaClipEditor.tsx +7 -6
  5. package/src/StepProductionEditor.tsx +16 -7
  6. package/src/agent-activity-messages.ts +14 -0
  7. package/src/agent-activity.ts +38 -0
  8. package/src/approvals.tsx +6 -1
  9. package/src/audio-recording-messages.ts +5 -5
  10. package/src/audio-recording.ts +27 -5
  11. package/src/authoring-client.ts +10 -10
  12. package/src/authoring-draft-fragment.ts +3 -1
  13. package/src/authoring-window.ts +100 -0
  14. package/src/base-controls.tsx +28 -7
  15. package/src/body-draft-actions.ts +60 -0
  16. package/src/caption-timing-drafts.ts +20 -3
  17. package/src/caption-timing-messages.ts +2 -2
  18. package/src/caption-timing.ts +2 -2
  19. package/src/component-draft-actions.ts +1 -1
  20. package/src/component-properties.ts +3 -3
  21. package/src/component-property-drafts.ts +6 -6
  22. package/src/components.tsx +43 -38
  23. package/src/container-layout.ts +21 -0
  24. package/src/context.tsx +5 -3
  25. package/src/diagnostics.ts +1 -1
  26. package/src/document-draft-store.ts +45 -18
  27. package/src/document-drafts.ts +30 -21
  28. package/src/document-editing.ts +485 -0
  29. package/src/document-editor/BlockNoteSurface.tsx +40 -14
  30. package/src/document-editor/CommentComposer.tsx +24 -0
  31. package/src/document-editor/ComponentMaterials.tsx +4 -10
  32. package/src/document-editor/ComponentPropertiesDialog.tsx +12 -12
  33. package/src/document-editor/DocumentBlockFallback.tsx +4 -3
  34. package/src/document-editor/DocumentBlockPreview.tsx +11 -4
  35. package/src/document-editor/DocumentComments.tsx +87 -17
  36. package/src/document-editor/DocumentEditor.tsx +66 -14
  37. package/src/document-editor/DocumentStepNarration.tsx +39 -27
  38. package/src/document-editor/NarrationEditor.tsx +55 -21
  39. package/src/document-editor/NewCommentDrafts.tsx +120 -37
  40. package/src/document-editor/PlaceComment.tsx +252 -0
  41. package/src/document-editor/agent-targets.ts +34 -0
  42. package/src/document-editor/blocknote-messages.ts +2 -0
  43. package/src/document-editor/comment-draft-actions.ts +40 -20
  44. package/src/document-editor/comment-draft-inspection.ts +2 -2
  45. package/src/document-editor/comment-drafts.ts +75 -27
  46. package/src/document-editor/comments.ts +34 -14
  47. package/src/document-editor/component-label.ts +11 -0
  48. package/src/document-editor/file-input.ts +2 -2
  49. package/src/document-editor/focus.ts +0 -2
  50. package/src/document-editor/inline.ts +1 -0
  51. package/src/document-editor/insertion-place.ts +60 -0
  52. package/src/document-editor/messages.ts +3 -3
  53. package/src/document-editor/narration-schema.tsx +12 -6
  54. package/src/document-editor/narration.ts +19 -3
  55. package/src/document-editor/page-body.ts +60 -0
  56. package/src/document-editor/popover.tsx +4 -2
  57. package/src/document-editor/projection.ts +21 -19
  58. package/src/document-editor/rich-text.ts +3 -2
  59. package/src/document-editor/selection.ts +13 -0
  60. package/src/document-editor/style.css +8 -3
  61. package/src/document-editor/table-identities.ts +2 -1
  62. package/src/document-preview.ts +3 -2
  63. package/src/document-production.ts +492 -0
  64. package/src/document-return-point.ts +2 -2
  65. package/src/document-session.ts +216 -67
  66. package/src/document-timing-drafts.ts +26 -6
  67. package/src/effective-settings.ts +12 -0
  68. package/src/history.ts +5 -5
  69. package/src/import-messages.ts +40 -0
  70. package/src/index.ts +11 -5
  71. package/src/jobs.ts +1 -1
  72. package/src/mcp-settings-messages.ts +39 -0
  73. package/src/media-drafts.ts +43 -1
  74. package/src/messages.ts +39 -18
  75. package/src/outline.ts +5 -5
  76. package/src/panels/DocumentImportDialog.tsx +59 -0
  77. package/src/panels/DocumentNarrationPanel.tsx +2 -2
  78. package/src/panels/DocumentView.tsx +106 -77
  79. package/src/panels/DocumentVoiceDialog.tsx +29 -12
  80. package/src/panels/DocumentVoiceField.tsx +3 -2
  81. package/src/panels/ExportPanel.tsx +2 -10
  82. package/src/panels/HistoryPanel.tsx +36 -10
  83. package/src/panels/HomePanel.tsx +12 -1
  84. package/src/panels/McpSettingsPanel.tsx +86 -0
  85. package/src/panels/PageDeleteDialog.tsx +4 -4
  86. package/src/panels/PageRenameDialog.tsx +1 -1
  87. package/src/panels/PreviewPanel.tsx +4 -7
  88. package/src/panels/ProductionCaptionSize.tsx +20 -0
  89. package/src/panels/ProductionCaptionTiming.tsx +12 -9
  90. package/src/panels/ProductionMediaClips.tsx +25 -9
  91. package/src/panels/ProductionPanel.tsx +21 -17
  92. package/src/panels/ProductionRecording.tsx +86 -9
  93. package/src/panels/ProductionRecordingRange.tsx +26 -23
  94. package/src/panels/ProductionTimeline.tsx +6 -1
  95. package/src/panels/ProductionTranscription.tsx +8 -6
  96. package/src/panels/SourceDocumentPanel.tsx +24 -40
  97. package/src/panels/SpeechSettingsPanel.tsx +2 -2
  98. package/src/panels/TranscriptionAdoption.tsx +42 -36
  99. package/src/panels/VoiceCloneDialog.tsx +2 -1
  100. package/src/panels/VoicePreviewDialog.tsx +1 -1
  101. package/src/panels/VoiceScopeField.tsx +2 -2
  102. package/src/panels/VoiceoverDialog.tsx +11 -10
  103. package/src/places.ts +1 -36
  104. package/src/preview-playback.ts +1 -1
  105. package/src/production-draft-actions.ts +37 -0
  106. package/src/production-messages.ts +6 -0
  107. package/src/production-playback.ts +1 -1
  108. package/src/production-voice-playback.ts +3 -2
  109. package/src/recording-adoption.ts +4 -4
  110. package/src/sha256.ts +9 -0
  111. package/src/speech-settings-messages.ts +6 -6
  112. package/src/step-production.ts +4 -4
  113. package/src/styles.css +43 -92
  114. package/src/transcription-drafts.ts +124 -0
  115. package/src/use-recording-adoption.ts +5 -4
  116. package/src/voice-drafts.ts +32 -8
  117. package/src/voice-messages.ts +9 -9
  118. package/src/voiceover-jobs.ts +1 -1
  119. package/src/workbench-state.ts +159 -0
  120. package/src/workbench.ts +323 -956
  121. package/src/workspace-client.ts +41 -12
  122. package/src/assistant-mascot.ts +0 -62
  123. package/src/mascot-preference.ts +0 -37
  124. package/src/panels/ChangeTrail.tsx +0 -79
@@ -0,0 +1,159 @@
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' | 'scrolly' | '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
+ agentActivities?: import('@lincyaw/kernel').AgentActivity[]
58
+ agentFollowing?: boolean
59
+ locale: Locale
60
+ authoring?: DocumentSessionState
61
+ /** Unaccepted numeric form input is retained separately from saved canonical timing. */
62
+ hasDocumentTimingDrafts?: boolean
63
+ documentTimingDraftStorageFailure?: boolean
64
+ captionTimingDraftSteps?: string[]
65
+ captionTimingDraftStorageFailure?: boolean
66
+ isDark: boolean
67
+ documents?: DocumentsAnswer
68
+ documentsFailure?: string
69
+ /** The workspace's routes answer 404: `@lincyaw/dsh` is turned off on the plugins page. */
70
+ isBundleDisabled?: boolean
71
+ document?: string
72
+ ir?: IrAnswer
73
+ mode: WorkbenchMode
74
+ previewRenderer: PreviewRenderer
75
+ /** In the web form: the page or the presentation, both in the same page, switched without loading it again. */
76
+ webView: WebView
77
+ previewReload: number
78
+ preview?: PreviewAnswer
79
+ previewFailure?: string
80
+ /** The IR revision the preview shows. */
81
+ previewIrRevision?: string
82
+ isPreparingPresentation?: boolean
83
+ presentationFailure?: string
84
+ presentationSnapshot?: { version: string, fingerprint: string, revision: string, project: number }
85
+ productionPlan?: ProductionPlan
86
+ productionPlayback?: ProductionPlaybackState
87
+ productionFailure?: string
88
+ voiceoverJobs?: VoiceoverJob[]
89
+ voiceoverJobsFailure?: string
90
+ /** A cache refresh that actually changed the current production binding; it never starts playback. */
91
+ voiceoverCacheRefresh?: { source: CanonicalSource, revision: string, sequence: number }
92
+ /** Changes when an acknowledged preview connection is attached or detached, including same-revision reloads. */
93
+ previewConnection: number
94
+ /** Where the preview is: the section the author reads, or the slide and its step. */
95
+ position?: PreviewPosition
96
+ /** Changes on every position intent, including A → B → A, without changing the source. */
97
+ documentPositionToken: string
98
+ /** Explicit author navigation, distinct from the player's passive cursor and frame reload reports. */
99
+ productionNavigationVersion: number
100
+ documentPositionIntent: 'seek' | 'pause'
101
+ /** An explicit source navigation request; scrolling updates position without issuing another request. */
102
+ documentNavigation?: { section: string, block?: string, request: string }
103
+ documentPositionFailure?: 'removed'
104
+ isCreatingPage?: boolean
105
+ isEditingPage?: boolean
106
+ editorHistory?: EditorHistoryState
107
+ isHistoryPreparing?: boolean
108
+ pageEditFailure?: string
109
+ diagnostics?: DiagnosticSnapshot
110
+ isDiagnosticsUnavailable: boolean
111
+ canRepairDiagnostics: boolean
112
+ isRepairingDiagnostics: boolean
113
+ diagnosticsRepairFailure?: string
114
+ pointer?: Pointer
115
+ save: SaveState
116
+ /** What the conversation's agent is told the author points at. */
117
+ focus: FocusReport[]
118
+ isFocusPending: boolean
119
+ focusFailure?: string
120
+ review?: ReviewSnapshot
121
+ history?: RevisionsAnswer
122
+ /** Files changed elsewhere and not yet in the history. */
123
+ outside?: UncommittedFile[]
124
+ historyFailure?: string
125
+ isHistoryBusy: boolean
126
+ isAsking: boolean
127
+ askFailure?: string
128
+ /** What the document can be made into, and its builds and exports (the author's and the AI's). */
129
+ jobs?: JobsAnswer
130
+ jobsFailure?: string
131
+ voiceServiceVersion?: number
132
+ jobPreparing?: { target: string, canCancel: boolean }
133
+ }
134
+
135
+ export interface PreviewSink {
136
+ readonly generation?: number
137
+ readonly capabilities?: readonly PreviewCommand['type'][]
138
+ send(command: PreviewCommand): void
139
+ }
140
+
141
+ export interface EditorHistoryState { section: string, undo: boolean, redo: boolean, field?: boolean }
142
+
143
+
144
+ /** The workbench's state as its parts read and change it. */
145
+ export interface WorkbenchStore {
146
+ readonly state: WorkbenchState
147
+ set(patch: Partial<WorkbenchState>): void
148
+ }
149
+
150
+ /** The document the conversation works on: none when no document is open. */
151
+ export function selectedDocument(state: WorkbenchState): string | null {
152
+ return state.document ?? null
153
+ }
154
+
155
+ /** Whether the AI is changing the workspace now, or its change waits for the author. */
156
+ export function isAgentChanging(state: WorkbenchState): boolean {
157
+ return Boolean(state.review?.engine === 'git' && (state.review.running || state.review.changes.length > 0))
158
+ }
159
+