@lincyaw/workbench 0.2.0-rc.11 → 0.2.0-rc.111

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 (108) hide show
  1. package/package.json +5 -4
  2. package/src/AgentActivityBar.tsx +25 -0
  3. package/src/MediaClipEditor.tsx +4 -3
  4. package/src/StepProductionEditor.tsx +13 -4
  5. package/src/agent-activity-messages.ts +14 -0
  6. package/src/agent-activity.ts +38 -0
  7. package/src/approvals.tsx +6 -1
  8. package/src/audio-recording-messages.ts +5 -5
  9. package/src/audio-recording.ts +27 -5
  10. package/src/authoring-client.ts +10 -10
  11. package/src/authoring-draft-fragment.ts +3 -1
  12. package/src/authoring-window.ts +100 -0
  13. package/src/base-controls.tsx +2 -2
  14. package/src/body-draft-actions.ts +60 -0
  15. package/src/caption-timing-drafts.ts +18 -1
  16. package/src/caption-timing-messages.ts +2 -2
  17. package/src/component-property-drafts.ts +5 -5
  18. package/src/components.tsx +34 -36
  19. package/src/container-layout.ts +21 -0
  20. package/src/context.tsx +5 -3
  21. package/src/diagnostics.ts +1 -1
  22. package/src/document-draft-store.ts +45 -18
  23. package/src/document-drafts.ts +28 -19
  24. package/src/document-editing.ts +484 -0
  25. package/src/document-editor/BlockNoteSurface.tsx +39 -13
  26. package/src/document-editor/CommentComposer.tsx +24 -0
  27. package/src/document-editor/ComponentMaterials.tsx +3 -9
  28. package/src/document-editor/ComponentPropertiesDialog.tsx +4 -4
  29. package/src/document-editor/DocumentBlockPreview.tsx +11 -4
  30. package/src/document-editor/DocumentComments.tsx +85 -14
  31. package/src/document-editor/DocumentEditor.tsx +56 -7
  32. package/src/document-editor/DocumentStepNarration.tsx +37 -26
  33. package/src/document-editor/NarrationEditor.tsx +54 -20
  34. package/src/document-editor/NewCommentDrafts.tsx +120 -37
  35. package/src/document-editor/PlaceComment.tsx +252 -0
  36. package/src/document-editor/agent-targets.ts +34 -0
  37. package/src/document-editor/blocknote-messages.ts +2 -0
  38. package/src/document-editor/comment-draft-actions.ts +40 -20
  39. package/src/document-editor/comment-draft-inspection.ts +2 -2
  40. package/src/document-editor/comment-drafts.ts +73 -25
  41. package/src/document-editor/comments.ts +30 -10
  42. package/src/document-editor/component-label.ts +11 -0
  43. package/src/document-editor/file-input.ts +2 -2
  44. package/src/document-editor/focus.ts +0 -2
  45. package/src/document-editor/insertion-place.ts +60 -0
  46. package/src/document-editor/messages.ts +3 -3
  47. package/src/document-editor/narration-schema.tsx +12 -6
  48. package/src/document-editor/narration.ts +19 -3
  49. package/src/document-editor/page-body.ts +60 -0
  50. package/src/document-editor/popover.tsx +4 -2
  51. package/src/document-editor/projection.ts +2 -2
  52. package/src/document-editor/rich-text.ts +3 -2
  53. package/src/document-editor/selection.ts +13 -0
  54. package/src/document-editor/style.css +7 -1
  55. package/src/document-editor/table-identities.ts +2 -1
  56. package/src/document-production.ts +491 -0
  57. package/src/document-session.ts +202 -56
  58. package/src/document-timing-drafts.ts +22 -2
  59. package/src/history.ts +5 -5
  60. package/src/index.ts +11 -5
  61. package/src/jobs.ts +1 -1
  62. package/src/mcp-settings-messages.ts +39 -0
  63. package/src/media-drafts.ts +43 -1
  64. package/src/messages.ts +33 -16
  65. package/src/panels/DocumentNarrationPanel.tsx +2 -2
  66. package/src/panels/DocumentView.tsx +97 -65
  67. package/src/panels/DocumentVoiceDialog.tsx +25 -9
  68. package/src/panels/DocumentVoiceField.tsx +1 -1
  69. package/src/panels/ExportPanel.tsx +2 -10
  70. package/src/panels/HistoryPanel.tsx +34 -7
  71. package/src/panels/HomePanel.tsx +3 -1
  72. package/src/panels/McpSettingsPanel.tsx +86 -0
  73. package/src/panels/PageDeleteDialog.tsx +4 -4
  74. package/src/panels/PageRenameDialog.tsx +1 -1
  75. package/src/panels/PreviewPanel.tsx +1 -4
  76. package/src/panels/ProductionCaptionSize.tsx +20 -0
  77. package/src/panels/ProductionCaptionTiming.tsx +12 -9
  78. package/src/panels/ProductionMediaClips.tsx +23 -7
  79. package/src/panels/ProductionPanel.tsx +16 -13
  80. package/src/panels/ProductionRecording.tsx +86 -9
  81. package/src/panels/ProductionRecordingRange.tsx +21 -19
  82. package/src/panels/ProductionTimeline.tsx +6 -1
  83. package/src/panels/ProductionTranscription.tsx +5 -4
  84. package/src/panels/SourceDocumentPanel.tsx +18 -36
  85. package/src/panels/SpeechSettingsPanel.tsx +1 -1
  86. package/src/panels/TranscriptionAdoption.tsx +40 -34
  87. package/src/panels/VoiceCloneDialog.tsx +2 -1
  88. package/src/panels/VoiceoverDialog.tsx +1 -1
  89. package/src/places.ts +1 -36
  90. package/src/preview-playback.ts +1 -1
  91. package/src/production-draft-actions.ts +37 -0
  92. package/src/production-messages.ts +6 -0
  93. package/src/production-playback.ts +1 -1
  94. package/src/production-voice-playback.ts +3 -2
  95. package/src/sha256.ts +9 -0
  96. package/src/speech-settings-messages.ts +5 -5
  97. package/src/styles.css +43 -79
  98. package/src/transcription-drafts.ts +124 -0
  99. package/src/use-recording-adoption.ts +2 -2
  100. package/src/voice-drafts.ts +32 -8
  101. package/src/voice-messages.ts +9 -9
  102. package/src/voiceover-jobs.ts +1 -1
  103. package/src/workbench-state.ts +159 -0
  104. package/src/workbench.ts +303 -952
  105. package/src/workspace-client.ts +30 -11
  106. package/src/assistant-mascot.ts +0 -62
  107. package/src/mascot-preference.ts +0 -37
  108. package/src/panels/ChangeTrail.tsx +0 -79
@@ -0,0 +1,39 @@
1
+ const zh = {
2
+ title: 'MCP 连接', description: '让 AI 连接当前工作区,操作会实时显示在应用中。',
3
+ transport: '连接方式', stdio: 'stdio(推荐)', http: 'HTTP',
4
+ stdioHint: 'AI 客户端按需启动连接,无需预留端口。与桌面应用共享同一个工作区服务。',
5
+ httpHint: '为外部 AI 开启本机 HTTP 连接。更改端口不会改变编辑器地址。',
6
+ local: '这些配置用于运行 Presmium 的这台电脑。远程使用时,请在 AI 所在电脑安装 Presmium 后配置 stdio,或通过受保护的转发使用 HTTP。',
7
+ port: '端口', portHint: '填 0 自动分配可用端口;也可填写 1–65535 的固定端口。',
8
+ address: '当前连接地址', save: '应用', saved: '配置已应用。', loading: '正在加载连接配置…',
9
+ copyConfig: '复制配置', copyPrompt: '复制提示词', copied: '已复制。',
10
+ output: '复制内容', manualCopy: '无法自动复制,请从下面的文本框手动复制。',
11
+ unavailable: '暂时无法读取连接配置,请重试。', retry: '重试', failed: '配置未能应用,当前连接仍可使用。',
12
+ outdatedService: '当前工作区仍在使用旧版后台服务。请将 AI 中的 Presmium 连接更新为桌面应用提供的版本,重新连接后再打开工作区。',
13
+ portBusy: '该端口无法使用,请选择其他端口,或填 0 自动分配。',
14
+ conflict: '配置已在其他窗口更新,请重新读取后再修改。', invalid: '请输入 0–65535 的整数端口。',
15
+ noCommand: '当前服务没有可用的本机启动命令,请使用 HTTP 连接。',
16
+ applyFirst: '先应用修改,再复制与当前连接一致的配置。',
17
+ prompt: '请帮我为当前 AI 客户端配置 Presmium MCP。保留已有 MCP 服务,只新增或更新名为 presmium 的连接;先找到客户端的官方配置格式,将下面的通用 MCP 配置转换后写入,再验证连接和读取工作区。不要扩大操作权限,也不要提交凭据。工作区:{root}。',
18
+ httpPrompt: '使用 Streamable HTTP,地址:{url}。在运行 Presmium 的本机读取 {stateFile},仅使用其中 token 字段作为 Authorization: Bearer 的值,不要使用 launcherToken。不要把凭据输出到对话或提交到仓库。此地址需要 Presmium 工作区服务运行;服务重启后如端口或访问令牌变化,请重新读取配置。',
19
+ }
20
+ const en: typeof zh = {
21
+ title: 'MCP Connection', description: 'Connect AI to this workspace and see its actions live in the app.',
22
+ transport: 'Transport', stdio: 'stdio (recommended)', http: 'HTTP',
23
+ stdioHint: 'The AI client starts its connection on demand without reserving a port. It shares the workspace service with the desktop app.',
24
+ httpHint: 'Enable a local HTTP connection for external AI clients. Changing its port leaves the editor address unchanged.',
25
+ local: 'These settings are for the computer running Presmium. For remote use, install Presmium on the AI client computer for stdio, or use protected forwarding for HTTP.',
26
+ port: 'Port', portHint: 'Use 0 to choose an available port, or 1–65535 for a fixed port.',
27
+ address: 'Current endpoint', save: 'Apply', saved: 'Settings applied.', loading: 'Loading connection settings…',
28
+ copyConfig: 'Copy Config', copyPrompt: 'Copy Prompt', copied: 'Copied.',
29
+ output: 'Copy Content', manualCopy: 'Automatic copying failed. Copy the text below manually.',
30
+ unavailable: 'Connection settings are unavailable. Please retry.', retry: 'Retry', failed: 'Settings could not be applied. The current connection remains available.',
31
+ outdatedService: 'This workspace is still using an older background service. Update the Presmium connection in your AI client to the desktop app’s bundled version, reconnect, then reopen the workspace.',
32
+ portBusy: 'This port is unavailable. Choose another port or use 0 to assign one automatically.',
33
+ conflict: 'Another window updated these settings. Reload before editing.', invalid: 'Enter an integer port from 0 to 65535.',
34
+ noCommand: 'This service has no local launch command. Use HTTP instead.',
35
+ applyFirst: 'Apply your changes before copying the current connection configuration.',
36
+ prompt: 'Configure Presmium MCP for this AI client. Preserve existing MCP servers and only add or update the connection named presmium. Find the official client configuration format, adapt the generic MCP configuration below, save it, then verify the connection and read the workspace. Do not broaden permissions or save credentials in the repository. Workspace: {root}.',
37
+ httpPrompt: 'Use Streamable HTTP at {url}. On the computer running Presmium, read {stateFile} and use only its token field as Authorization: Bearer; never use launcherToken. Do not print credentials in the chat or save them in the repository. The Presmium workspace service must be running. If the port or token changes after a restart, read the settings again.',
38
+ }
39
+ export const MCP_SETTINGS_MESSAGES = { 'zh-CN': zh, en }
@@ -4,7 +4,7 @@ import type { MediaClipDraft } from './MediaClipEditor.tsx'
4
4
  import type { WorkspaceClient } from './workspace-client.ts'
5
5
 
6
6
  export interface MediaDrafts { selectedClipId?: string, entries: Record<string, MediaClipDraft> }
7
- interface Entry { value: MediaDrafts, failed: boolean, volatile: boolean, unreadable?: string }
7
+ interface Entry { value: MediaDrafts, failed: boolean, volatile: boolean, unreadable?: string, raw?: string | null }
8
8
  const memory = new WeakMap<WorkspaceClient, Map<string, Entry>>()
9
9
  const prefix = 'presmium.media-drafts.v1:', limit = 64
10
10
  const keyOf = (identity: string, stepId: string) => prefix + JSON.stringify([identity, stepId])
@@ -38,6 +38,7 @@ function load(client: WorkspaceClient, key: string): Entry {
38
38
  const entry: Entry = { value: { entries: {} }, failed: false, volatile: false }
39
39
  try {
40
40
  const raw = sessionStorage.getItem(key)
41
+ entry.raw = raw
41
42
  if (raw !== null) {
42
43
  entry.unreadable = raw
43
44
  if (raw.length > 131072) throw new Error('media-drafts-size')
@@ -68,6 +69,7 @@ export function keepMediaDrafts(client: WorkspaceClient, identity: string, stepI
68
69
  if (raw.length > 131072) throw new Error('media-drafts-size')
69
70
  if (entry.unreadable !== undefined) sessionStorage.setItem(`${key}:unreadable`, entry.unreadable)
70
71
  sessionStorage.setItem(key, raw)
72
+ entry.raw = raw
71
73
  const keys = Array.from({ length: sessionStorage.length }, (_, index) => sessionStorage.key(index)!).filter(name => name.startsWith(prefix) && !name.endsWith(':unreadable') && name !== key)
72
74
  let excess = keys.length - limit + 1
73
75
  for (const old of keys) {
@@ -81,3 +83,43 @@ export function keepMediaDrafts(client: WorkspaceClient, identity: string, stepI
81
83
  return true
82
84
  } catch { entry.failed = true; trim(known); return false }
83
85
  }
86
+
87
+ /** This is the same step/form bank used when the author reopens Media, including session-only input. */
88
+ export function mediaDraftSnapshot(client: WorkspaceClient, identity: string): { entries: { stepId: string, value: MediaDrafts, persisted: boolean }[], partial: boolean } {
89
+ const scoped = `${prefix}${JSON.stringify([identity]).slice(0, -1)},`
90
+ const keys = new Set([...store(client).keys()].filter(key => key.startsWith(scoped)))
91
+ let partial = false
92
+ try {
93
+ for (let index = 0; index < sessionStorage.length; index++) {
94
+ const key = sessionStorage.key(index)
95
+ if (key?.startsWith(scoped) && !key.endsWith(':unreadable')) keys.add(key)
96
+ }
97
+ } catch { partial = true }
98
+ const entries: { stepId: string, value: MediaDrafts, persisted: boolean }[] = []
99
+ for (const key of keys) {
100
+ let target: unknown
101
+ try { target = JSON.parse(key.slice(prefix.length)) } catch { partial = true; continue }
102
+ if (!Array.isArray(target) || target.length !== 2 || target[0] !== identity || typeof target[1] !== 'string') { partial = true; continue }
103
+ const entry = load(client, key)
104
+ let persisted = false
105
+ try { const raw = sessionStorage.getItem(key); persisted = !entry.failed && raw === entry.raw; if (raw !== entry.raw) partial = true } catch { partial = true }
106
+ if (entry.unreadable !== undefined || entry.raw === undefined) partial = true
107
+ if (Object.keys(entry.value.entries).length) entries.push({ stepId: target[1], value: structuredClone(entry.value), persisted })
108
+ }
109
+ return { entries, partial }
110
+ }
111
+
112
+ /** Retire one exact clip proposal, preserving sibling forms and any independently changed storage. */
113
+ export function discardMediaDraft(client: WorkspaceClient, identity: string, stepId: string, name: string, expected: MediaDrafts): boolean {
114
+ const key = keyOf(identity, stepId), entry = load(client, key)
115
+ if (!Object.hasOwn(expected.entries, name) || JSON.stringify(entry.value) !== JSON.stringify(expected)) return false
116
+ try {
117
+ if (entry.raw === undefined || entry.unreadable !== undefined || sessionStorage.getItem(key) !== entry.raw) return false
118
+ const next = structuredClone(entry.value)
119
+ delete next.entries[name]
120
+ const raw = JSON.stringify(next)
121
+ sessionStorage.setItem(key, raw)
122
+ entry.value = next; entry.raw = raw; entry.failed = false; entry.volatile = false
123
+ return true
124
+ } catch { entry.failed = true; return false }
125
+ }
package/src/messages.ts CHANGED
@@ -12,6 +12,11 @@ export interface AgentPlace {
12
12
 
13
13
  // A Latin word or a number set after Chinese text is spaced from it (docs/glossary.md 2).
14
14
  const spaced = (text: string) => (/^[A-Za-z0-9]/.test(text) ? ` ${text}` : text)
15
+ // The start of a passage, enough to recognize it.
16
+ const excerpt = (text: string, length: number) => [...text].length > length ? `${[...text].slice(0, length).join('').trimEnd()}…` : text
17
+
18
+ /** Where on a page the author asks for new content: after a passage (its text, '' for content without text), at the start (none) or at the end. */
19
+ interface AgentInsertion { after?: string, end: boolean }
15
20
 
16
21
  // Names of commands follow Microsoft Word's (撤消/Undo, 新建批注/New Comment, 版本历史/Version History…).
17
22
  const zh = {
@@ -106,14 +111,13 @@ const zh = {
106
111
  narrationAutosave: '自动保存;切换步骤会保留未完成的草稿。',
107
112
  narrationDiscard: '放弃草稿',
108
113
  narrationRecoveryUnavailable: '浏览器无法在本机保留草稿。草稿仍在本次会话中,请保存后再关闭窗口。',
109
- documentDraftFound: '发现本地草稿',
110
- documentDraftSelect: '恢复草稿',
111
- documentDraftChoose: '请选择草稿',
114
+ documentDrafts: '本地草稿',
115
+ documentDraftName: (index: number) => `草稿 ${index}`,
116
+ documentDraftDiscardAll: '全部放弃',
112
117
  documentDraftRestore: '恢复草稿',
113
- documentDraftChanged: '本地草稿已更新,请重新选择。',
118
+ documentDraftChanged: '本地草稿已更新,请查看最新列表。',
114
119
  documentDraftUnreadable: '部分本地草稿无法读取。',
115
120
  documentDraftBackingUp: '正在备份…',
116
- documentDraftOption: (index: number, date: string, source: 'durable' | 'rescue') => `${date} · ${source === 'rescue' ? '临时副本' : '草稿'} ${index}`,
117
121
  narrationCompositionInterrupted: '输入法组字未完成,草稿已保留。请检查文字后保存或继续编辑。',
118
122
  narrationRefresh: '讲稿已写入,但画面尚未完成更新。草稿已保留,请等待预览恢复后重试。',
119
123
  narrationDuring: '与动画同步',
@@ -136,7 +140,7 @@ const zh = {
136
140
  noMatch: '没有找到匹配的文稿。',
137
141
  newDocument: '新建文稿',
138
142
  noDocuments: '还没有文稿。点“新建文稿”开始。',
139
- notGit: '这个文件夹还没有开启版本历史,新建、重命名、创建副本、删除和撤消都需要它。请让管理员为这个文件夹开启版本历史。',
143
+ notGit: '工作区的版本历史未能准备好,暂时无法新建或修改文稿。请重新打开工作区;仍未恢复时请查看诊断。',
140
144
  bundleDisabled: '无法加载文稿:Presmium 的扩展在“插件”页中被关闭了。请从“更多”打开“插件”,重新开启 Presmium,然后重新加载页面。',
141
145
  more: (title: string) => `“${title}”的更多操作`,
142
146
  open: '打开',
@@ -241,6 +245,8 @@ const zh = {
241
245
  formattedEdit: '这一处带有格式或特殊内容,不能直接修改文字。要用 AI 改写吗?',
242
246
  rewriteEdit: '用 AI 改写',
243
247
  versionHistory: '版本历史',
248
+ historyWithDrafts: (count: number) => `版本历史(${count} 份本地草稿)`,
249
+ historySavedVersions: '已保存版本',
244
250
  historyNewer: '较新版本',
245
251
  historyOlder: '更早版本',
246
252
  exportPane: '导出',
@@ -325,11 +331,11 @@ const zh = {
325
331
  'history-result-no-longer-current': '之前的结果已不是当前版本,请查看最新的历史。',
326
332
  'authoring-review-required': '有修改等待你审阅,请先接受或放弃。',
327
333
  } as Record<string, string>,
328
- agentWorking: 'AI 正在修改文稿…',
329
334
  agentWaiting: (n: number) => `AI 修改了 ${n} 处内容,要接受这些修改吗?`,
330
335
  accept: '接受',
331
336
  reject: '拒绝',
332
- problems: (n: number) => `有 ${n} 处内容无法正确显示。`,
337
+ problems: (n: number) => `文稿有 ${n} 个问题需要处理。`,
338
+ problemsTitle: '文稿中的问题',
333
339
  fixWithAi: '用 AI 修复',
334
340
  fixing: '正在发送给 AI…',
335
341
  fixFailed: (reason: string) => `无法发送给 AI。${reason}`,
@@ -356,6 +362,11 @@ const zh = {
356
362
  place.quote ? `\n原文:“${place.quote}”` : '',
357
363
  ].join('')).filter(Boolean),
358
364
  ].join('\n\n'),
365
+ animationRequest: (page: number, title: string, place: AgentInsertion) => {
366
+ const at = `第 ${page} 页${title ? `“${title}”` : ''}`
367
+ return place.end ? `在${at}的末尾加一个动画:` : place.after === undefined ? `在${at}的开头加一个动画:`
368
+ : place.after ? `在${at}中“${excerpt(place.after, 16)}”这一段之后加一个动画:` : `在${at}的这个位置加一个动画:`
369
+ },
359
370
  commentsRequest: (comments: (AgentPlace & { text: string })[]) => [
360
371
  comments.length === 1 ? '我在文稿上写了一条批注:' : `我在文稿上写了 ${comments.length} 条批注:`,
361
372
  ...comments.map((comment, i) => [
@@ -470,14 +481,13 @@ const en: WorkbenchMessages = {
470
481
  narrationAutosave: 'Saved automatically. Switching steps keeps unfinished drafts.',
471
482
  narrationDiscard: 'Discard Draft',
472
483
  narrationRecoveryUnavailable: 'This browser can’t keep drafts on this device. Your draft stays in this session; save before closing the window.',
473
- documentDraftFound: 'Drafts found on this device',
474
- documentDraftSelect: 'Recover Draft',
475
- documentDraftChoose: 'Choose a draft',
484
+ documentDrafts: 'Local Drafts',
485
+ documentDraftName: (index: number) => `Draft ${index}`,
486
+ documentDraftDiscardAll: 'Discard All',
476
487
  documentDraftRestore: 'Recover Draft',
477
- documentDraftChanged: 'The draft on this device changed. Choose it again.',
488
+ documentDraftChanged: 'Drafts on this device changed. Check the updated list.',
478
489
  documentDraftUnreadable: 'Couldn’t read some drafts on this device.',
479
490
  documentDraftBackingUp: 'Backing up…',
480
- documentDraftOption: (index: number, date: string, source: 'durable' | 'rescue') => `${date} · ${source === 'rescue' ? 'Temporary copy' : 'Draft'} ${index}`,
481
491
  narrationCompositionInterrupted: 'Typing with the input method was interrupted. Your draft is kept; review it before saving, or keep editing.',
482
492
  narrationRefresh: 'The script was written, but the preview has not updated yet. Your draft is kept; retry after the preview recovers.',
483
493
  narrationDuring: 'During animation',
@@ -500,7 +510,7 @@ const en: WorkbenchMessages = {
500
510
  noMatch: 'No matching documents.',
501
511
  newDocument: 'New Document',
502
512
  noDocuments: 'No documents yet. Choose New Document to start.',
503
- notGit: 'Version History is not turned on for this folder. New, Rename, Make a Copy, Delete, and Undo need it. Ask your administrator to turn on Version History for this folder.',
513
+ notGit: 'Workspace history could not be prepared, so documents cannot be created or edited yet. Reopen the workspace; if this continues, check Diagnostics.',
504
514
  bundleDisabled: 'Couldn’t load the documents: the Presmium extension was turned off on the Plugins page. Open Plugins from More, turn Presmium on again, then reload the page.',
505
515
  more: (title: string) => `More Actions for “${title}”`,
506
516
  open: 'Open',
@@ -605,6 +615,8 @@ const en: WorkbenchMessages = {
605
615
  formattedEdit: 'This text has formatting or special content and can’t be edited directly. Rewrite it with AI?',
606
616
  rewriteEdit: 'Rewrite with AI',
607
617
  versionHistory: 'Version History',
618
+ historyWithDrafts: (count: number) => `Version History (${count} local ${count === 1 ? 'draft' : 'drafts'})`,
619
+ historySavedVersions: 'Saved Versions',
608
620
  historyNewer: 'Newer versions',
609
621
  historyOlder: 'Older versions',
610
622
  exportPane: 'Export',
@@ -689,11 +701,11 @@ const en: WorkbenchMessages = {
689
701
  'history-result-no-longer-current': 'The earlier result is no longer the current version. Review the latest history.',
690
702
  'authoring-review-required': 'Changes are waiting for your review. Accept or discard them first.',
691
703
  },
692
- agentWorking: 'The AI is editing the document…',
693
704
  agentWaiting: (n: number) => `The AI changed ${n} file${n === 1 ? '' : 's'}. Accept the changes?`,
694
705
  accept: 'Accept',
695
706
  reject: 'Reject',
696
- problems: (n: number) => `${n} item${n === 1 ? '' : 's'} can’t be displayed correctly.`,
707
+ problems: (n: number) => `The document has ${n} problem${n === 1 ? '' : 's'} to fix.`,
708
+ problemsTitle: 'Problems in the Document',
697
709
  fixWithAi: 'Fix with AI',
698
710
  fixing: 'Sending to the AI…',
699
711
  fixFailed: (reason: string) => `Couldn’t send to the AI. ${reason}`,
@@ -720,6 +732,11 @@ const en: WorkbenchMessages = {
720
732
  place.quote ? `\nText: “${place.quote}”` : '',
721
733
  ].join('')).filter(Boolean),
722
734
  ].join('\n\n'),
735
+ animationRequest: (page: number, title: string, place: AgentInsertion) => {
736
+ const at = `page ${page}${title ? `, “${title}”` : ''}`
737
+ return place.end ? `Add an animation at the end of ${at}: ` : place.after === undefined ? `Add an animation at the start of ${at}: `
738
+ : place.after ? `Add an animation on ${at}, after the paragraph “${excerpt(place.after, 40)}”: ` : `Add an animation at this point on ${at}: `
739
+ },
723
740
  commentsRequest: (comments: (AgentPlace & { text: string })[]) => [
724
741
  comments.length === 1 ? 'I left a comment on the document:' : `I left ${comments.length} comments on the document:`,
725
742
  ...comments.map((comment, i) => [
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useId } from 'react'
2
- import { PmEmpty, PmIconButton } from '../components.tsx'
2
+ import { PmEmpty, PmIconButton, PmPanelHeader } from '../components.tsx'
3
3
  import { useMessages, useWorkbench, useWorkbenchState } from '../context.tsx'
4
4
  import { DocumentStepNarration } from '../document-editor/DocumentStepNarration.tsx'
5
5
 
@@ -18,7 +18,7 @@ export function DocumentNarrationPanel({ onClose }: { onClose(): void }) {
18
18
  }
19
19
  useEffect(() => { pause() }, [workbench, source?.identity])
20
20
  return <section className="pmw-pane" aria-labelledby={panelId}>
21
- <header className="pmw-pane__header"><h2 id={panelId} className="pmw-pane__title">{t.documentNarration}</h2><PmIconButton small icon="close" label={t.close} onClick={onClose} /></header>
21
+ <PmPanelHeader className="pmw-pane__header" titleId={panelId} title={t.documentNarration} actions={<PmIconButton small icon="close" label={t.close} onClick={onClose} />} />
22
22
  {section && sectionId && stepId ? <>
23
23
  <p className="pmw-pane__footer">{section.title}</p>
24
24
  <DocumentStepNarration sectionId={sectionId} stepId={stepId} expanded showLabel={false} panelId={`${panelId}-fields`} onPause={pause} />