@tano.page/workbench 0.15.0 → 0.16.0

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 (118) hide show
  1. package/package.json +35 -14
  2. package/src/App.vue +68 -797
  3. package/src/assistant/agent-identities.ts +1 -97
  4. package/src/assistant/agent-task-context.ts +1 -54
  5. package/src/assistant/attachments.ts +1 -1
  6. package/src/assistant/completion.ts +1 -61
  7. package/src/assistant/components/AssistantPanel.vue +1 -1
  8. package/src/assistant/connection-actions.ts +237 -0
  9. package/src/assistant/document-mentions.ts +1 -33
  10. package/src/assistant/engine.ts +1 -585
  11. package/src/assistant/execution.ts +6 -33
  12. package/src/assistant/hash.ts +1 -4
  13. package/src/assistant/language.ts +10 -37
  14. package/src/assistant/plugin-bridge-builder.ts +146 -0
  15. package/src/assistant/prompts.ts +1 -65
  16. package/src/assistant/proposal-actions.ts +336 -0
  17. package/src/assistant/store.ts +87 -554
  18. package/src/assistant/structures.ts +1 -157
  19. package/src/assistant/tasks.ts +8 -94
  20. package/src/assistant/tool-rules.ts +1 -7
  21. package/src/composables/use-workbench-help.ts +177 -0
  22. package/src/composables/use-workbench-lifecycle.ts +249 -0
  23. package/src/composables/use-workbench-settings.ts +185 -0
  24. package/src/composables/use-workbench-shortcuts.ts +37 -1022
  25. package/src/composables/use-workbench-views.ts +325 -0
  26. package/src/documents/components/DocumentActionMenu.vue +279 -0
  27. package/src/documents/components/DocumentInspector.vue +168 -0
  28. package/src/documents/components/DocumentPane.vue +482 -0
  29. package/src/documents/description-merge.ts +1 -9
  30. package/src/files/components/FileMetadataPanel.vue +49 -15
  31. package/src/i18n/locale-catalogs.ts +7 -6
  32. package/src/i18n/locale-registry.ts +8 -6
  33. package/src/i18n/locales/de-DE.json +23 -1
  34. package/src/i18n/locales/en-US.json +23 -1
  35. package/src/i18n/locales/es-ES.json +23 -1
  36. package/src/i18n/locales/ja-JP.json +23 -1
  37. package/src/i18n/locales/zh-TW.json +23 -1
  38. package/src/mail/components/MailAccountDialog.vue +1 -0
  39. package/src/mail/components/MailComposerDialog.vue +1 -0
  40. package/src/mail/components/MailWorkspaceView.vue +1 -0
  41. package/src/mail/components/SidebarMail.vue +1 -0
  42. package/src/objects/content-references.ts +6 -56
  43. package/src/objects/wiki-links.ts +1 -48
  44. package/src/objects/workspace-objects.ts +2 -3
  45. package/src/plans/calendar.ts +2 -2
  46. package/src/plans/components/CalendarAgendaView.vue +165 -0
  47. package/src/plans/components/CalendarFilterBar.vue +128 -0
  48. package/src/plans/components/CalendarMonthView.vue +224 -0
  49. package/src/plans/components/CalendarQuickCreateDialog.vue +269 -0
  50. package/src/plans/components/CalendarTimelineView.vue +517 -0
  51. package/src/plans/components/CalendarTopbarControls.vue +101 -0
  52. package/src/plans/components/CalendarView.vue +162 -2106
  53. package/src/plans/components/CalendarYearView.vue +138 -0
  54. package/src/plans/components/PlanConnectionsDialog.vue +1 -1
  55. package/src/plans/components/calendar-shared.css +192 -0
  56. package/src/plans/composables/use-calendar-interactions.ts +396 -0
  57. package/src/plans/composables/use-calendar-scroll.ts +420 -0
  58. package/src/plugins/components/PluginDetailPage.vue +10 -6
  59. package/src/plugins/components/PluginDeveloperArea.vue +192 -0
  60. package/src/plugins/components/PluginExplorer.vue +6 -4
  61. package/src/plugins/components/PluginImportDialog.vue +1 -1
  62. package/src/plugins/components/PluginInstaller.vue +269 -178
  63. package/src/plugins/components/PluginMaintenance.vue +37 -49
  64. package/src/plugins/components/PluginRepositoryStorage.vue +4 -2
  65. package/src/plugins/components/PluginSettingsForm.vue +2 -1
  66. package/src/plugins/components/PluginsTabPage.vue +61 -0
  67. package/src/plugins/components/plugin-center.css +5 -0
  68. package/src/plugins/data.ts +9 -86
  69. package/src/plugins/editor-plugin-adapters.ts +169 -0
  70. package/src/plugins/plugin-data.ts +2 -3
  71. package/src/plugins/plugin-rpc-router.ts +558 -0
  72. package/src/plugins/plugin-sdk.ts +1 -260
  73. package/src/plugins/plugin-ui-dialogs.ts +167 -0
  74. package/src/plugins/queries.ts +1 -75
  75. package/src/plugins/view-header.ts +2 -7
  76. package/src/runtime.ts +3 -2
  77. package/src/settings/components/SettingsPanel.vue +8 -3
  78. package/src/settings/components/WorkbenchSettings.vue +20 -7
  79. package/src/settings/components/settings-context.ts +1 -1
  80. package/src/settings/settings-tab.ts +1 -0
  81. package/src/shell/command-palette.ts +3 -3
  82. package/src/shell/components/EditorToolbar.vue +8 -9
  83. package/src/shell/components/EditorTools.vue +1 -5
  84. package/src/shell/components/PaneTopbar.vue +393 -0
  85. package/src/shell/components/SelectionToolbar.vue +0 -2
  86. package/src/shell/components/WorkbenchContextMenus.vue +37 -26
  87. package/src/shell/components/WorkbenchModals.vue +22 -18
  88. package/src/shell/components/WorkbenchPanes.vue +358 -1512
  89. package/src/shell/components/WorkbenchSidebar.vue +486 -0
  90. package/src/shell/pane-registry.ts +69 -0
  91. package/src/shell/use-surface-dismissal.ts +219 -0
  92. package/src/shell/use-workbench-commands.ts +599 -0
  93. package/src/shell/use-workbench-keybindings.ts +337 -0
  94. package/src/shell/use-workbench.ts +488 -1081
  95. package/src/shell/workbench-context.ts +30 -3
  96. package/src/stores/workspace-document-io.ts +807 -0
  97. package/src/stores/workspace-file-ops.ts +1 -1
  98. package/src/stores/workspace-knowledge.ts +1 -1
  99. package/src/stores/workspace-lifecycle.ts +459 -0
  100. package/src/stores/workspace-plugins-state.ts +71 -599
  101. package/src/stores/workspace-session.ts +287 -0
  102. package/src/stores/workspace-tabs-layout.ts +1 -1
  103. package/src/stores/workspace-types.ts +50 -0
  104. package/src/stores/workspace.ts +163 -1345
  105. package/src/styles.css +0 -1
  106. package/src/tabs/components/DesktopTabs.vue +19 -11
  107. package/src/windows/AuxiliaryWindows.vue +2 -2
  108. package/src/windows/use-window-event-bridge.ts +152 -0
  109. package/src/workspace/components/TemplateLibrary.vue +1 -1
  110. package/src/workspace/components/WorkspaceIconPicker.vue +5 -4
  111. package/src/workspace/components/WorkspacePickerMenu.vue +317 -0
  112. package/src/assistant/locales/de-DE.json +0 -129
  113. package/src/assistant/locales/en-US.json +0 -129
  114. package/src/assistant/locales/es-ES.json +0 -129
  115. package/src/assistant/locales/ja-JP.json +0 -129
  116. package/src/assistant/locales/zh-CN.json +0 -129
  117. package/src/assistant/locales/zh-TW.json +0 -129
  118. package/src/assistant/task-prompts.json +0 -39
@@ -0,0 +1,599 @@
1
+ import { computed, type Ref } from 'vue';
2
+ import { storeToRefs } from 'pinia';
3
+ import { defaultSelectionContext, type EditorSelectionContext } from '@tano/editor/selection-context';
4
+ import type { FileEntry } from '@tano/protocol';
5
+ import type { useAssistantStore } from '../assistant/store';
6
+ import type { DocumentExportFormat } from '../documents/document-export';
7
+ import { t } from '../i18n/i18n';
8
+ import { mobile } from '../platform/platform';
9
+ import type { WorkbenchExtensions } from '../runtime';
10
+ import type { SettingsPageId } from '../settings/settings-window';
11
+ import type { useUpdatesStore } from '../stores/updates';
12
+ import type { useWorkspaceStore } from '../stores/workspace';
13
+ import { native } from '../workspace/adapter';
14
+ import { editorPaletteCommands, type WorkbenchCommand } from './command-palette';
15
+ import type { ShortcutBindings } from './shortcuts';
16
+ import type { MarkdownEditor } from './workbench-async-components';
17
+
18
+ export interface WorkbenchCommandsDeps {
19
+ store: ReturnType<typeof useWorkspaceStore>;
20
+ assistant: ReturnType<typeof useAssistantStore>;
21
+ updates: ReturnType<typeof useUpdatesStore>;
22
+ extensions: WorkbenchExtensions;
23
+ editing: WorkbenchExtensions['editing'];
24
+ isAuxiliaryWindow: boolean;
25
+ sidebar: Ref<boolean>;
26
+ sidebarView: Ref<string>;
27
+ navigationContext: Ref<'home' | 'workspace'>;
28
+ shortcuts: Ref<ShortcutBindings>;
29
+ updateLock: Ref<boolean>;
30
+ editorReadonly: Ref<boolean>;
31
+ source: Ref<boolean>;
32
+ revealMarkdown: Ref<boolean>;
33
+ pageLocked: Ref<boolean>;
34
+ workspaceLocked: Ref<boolean>;
35
+ limitPageWidth: Ref<boolean>;
36
+ pageWidthWritable: Ref<boolean>;
37
+ showOutline: Ref<boolean>;
38
+ showDocumentProperties: Ref<boolean>;
39
+ editor: Ref<InstanceType<typeof MarkdownEditor> | undefined>;
40
+ paneSelections: Record<string, EditorSelectionContext>;
41
+ documentUndoAvailable: Ref<boolean>;
42
+ documentRedoAvailable: Ref<boolean>;
43
+ exportBusy: Ref<boolean>;
44
+ printBusy: Ref<boolean>;
45
+ historyPanel: Ref<boolean>;
46
+ historyPage: Ref<'versions' | 'updates'>;
47
+ showModal: (kind: 'newTab' | 'search' | 'delete' | 'saveAs', target?: FileEntry) => void;
48
+ createNewDocument: () => Promise<void>;
49
+ createNewEntry: (kind: 'document' | 'folder' | 'table', parent?: string) => Promise<void>;
50
+ detachTab: (id: string) => Promise<void>;
51
+ openImport: () => void;
52
+ openTemplateLibrary: () => void;
53
+ exportDocument: (format: DocumentExportFormat) => Promise<void>;
54
+ printActiveDocument: () => Promise<void>;
55
+ openPaneSearch: (id?: string, replace?: boolean) => void;
56
+ undoDocument: () => void;
57
+ redoDocument: () => void;
58
+ toggleAssistant: () => void;
59
+ togglePageLock: () => void;
60
+ setLimitPageWidth: (value: boolean) => void;
61
+ openDocumentDiscussion: () => unknown;
62
+ toggleSidebar: () => void;
63
+ selectContext: (context: 'home' | 'workspace') => void;
64
+ toggleWorkspaceMenu: () => void;
65
+ selectModule: (id: string) => void;
66
+ openCalendar: (date?: Date) => void;
67
+ openSettings: (page?: SettingsPageId) => void;
68
+ }
69
+
70
+ /**
71
+ * Unified command runner shared by the status bar pinned-commands rail and
72
+ * command palette: resolves built-in workbench commands first, then falls back
73
+ * to registered workspace plugin commands.
74
+ */
75
+ export function runWorkbenchCommandOrPlugin(
76
+ commandId: string,
77
+ commands: readonly WorkbenchCommand[],
78
+ store: ReturnType<typeof useWorkspaceStore>,
79
+ ) {
80
+ const builtin = commands.find((item) => item.id === commandId);
81
+ if (builtin) {
82
+ void builtin.run();
83
+ return;
84
+ }
85
+ const ws = store.workspace;
86
+ if (!ws) return;
87
+ const cmd = store.pluginCommands.find(
88
+ (item) => `${item.pluginId}:${item.id}` === commandId || item.id === commandId,
89
+ );
90
+ if (!cmd) return;
91
+ void store
92
+ .interactWithPlugin({
93
+ workspaceId: ws.id,
94
+ pluginId: cmd.pluginId,
95
+ instanceId: cmd.instanceId,
96
+ kind: 'command',
97
+ name: cmd.id,
98
+ payload: {
99
+ workspaceId: ws.id,
100
+ ...(store.active?.id ? { fileId: store.active.id } : {}),
101
+ },
102
+ })
103
+ .catch(() => {});
104
+ }
105
+
106
+ export function useWorkbenchCommands(deps: WorkbenchCommandsDeps) {
107
+ const {
108
+ store,
109
+ assistant,
110
+ updates,
111
+ extensions,
112
+ editing,
113
+ isAuxiliaryWindow,
114
+ sidebar,
115
+ sidebarView,
116
+ navigationContext,
117
+ shortcuts,
118
+ updateLock,
119
+ editorReadonly,
120
+ source,
121
+ revealMarkdown,
122
+ pageLocked,
123
+ workspaceLocked,
124
+ limitPageWidth,
125
+ pageWidthWritable,
126
+ showOutline,
127
+ showDocumentProperties,
128
+ editor,
129
+ paneSelections,
130
+ documentUndoAvailable,
131
+ documentRedoAvailable,
132
+ exportBusy,
133
+ printBusy,
134
+ historyPanel,
135
+ historyPage,
136
+ showModal,
137
+ createNewDocument,
138
+ createNewEntry,
139
+ detachTab,
140
+ openImport,
141
+ openTemplateLibrary,
142
+ exportDocument,
143
+ printActiveDocument,
144
+ openPaneSearch,
145
+ undoDocument,
146
+ redoDocument,
147
+ toggleAssistant,
148
+ togglePageLock,
149
+ setLimitPageWidth,
150
+ openDocumentDiscussion,
151
+ toggleSidebar,
152
+ selectContext,
153
+ toggleWorkspaceMenu,
154
+ selectModule,
155
+ openCalendar,
156
+ openSettings,
157
+ } = deps;
158
+ const { workspace, active, busy } = storeToRefs(store);
159
+
160
+ const workbenchCommands = computed<WorkbenchCommand[]>(() => {
161
+ const hasDocument = !!active.value;
162
+ const writableWorkspace =
163
+ !!workspace.value && !workspace.value.readOnly && !busy.value && !updateLock.value;
164
+ const standardEditor = hasDocument && !editing.active && !editing.activeBusy;
165
+ const editable = standardEditor && !editorReadonly.value && !active.value?.missing;
166
+ return [
167
+ {
168
+ id: 'workbench.search',
169
+ category: t('文档'),
170
+ get label() {
171
+ return t('查找文档');
172
+ },
173
+ shortcut: shortcuts.value.findDocument,
174
+ available: !busy.value,
175
+ run: () => showModal('search'),
176
+ },
177
+ {
178
+ id: 'workbench.open',
179
+ category: t('文档'),
180
+ get label() {
181
+ return t('打开文档');
182
+ },
183
+ shortcut: shortcuts.value.openDocument,
184
+ available: !busy.value,
185
+ run: () => showModal('newTab'),
186
+ },
187
+ {
188
+ id: 'workbench.new',
189
+ category: t('文档'),
190
+ get label() {
191
+ return t('新建文档');
192
+ },
193
+ shortcut: shortcuts.value.newDocument,
194
+ available: writableWorkspace,
195
+ run: createNewDocument,
196
+ },
197
+ {
198
+ id: 'workbench.new-window',
199
+ category: t('文档'),
200
+ get label() {
201
+ return t('新建窗口');
202
+ },
203
+ available:
204
+ native &&
205
+ !mobile &&
206
+ !isAuxiliaryWindow &&
207
+ !!workspace.value &&
208
+ !busy.value &&
209
+ !updateLock.value,
210
+ run: () => {
211
+ const id = store.createBlankTab();
212
+ if (id) return detachTab(id);
213
+ },
214
+ },
215
+ {
216
+ id: 'workbench.reveal',
217
+ category: t('文档'),
218
+ get label() {
219
+ return t('在资源管理器中显示');
220
+ },
221
+ available: native && !mobile && !isAuxiliaryWindow && !!workspace.value && !store.isWeb,
222
+ run: () => store.reveal(),
223
+ },
224
+ {
225
+ id: 'workbench.open-folder',
226
+ category: t('文档'),
227
+ get label() {
228
+ return t('打开文件夹');
229
+ },
230
+ available: !isAuxiliaryWindow && !busy.value && !updateLock.value,
231
+ run: () => store.openWorkspace(),
232
+ },
233
+ {
234
+ id: 'workbench.save',
235
+ category: t('文档'),
236
+ get label() {
237
+ return t('立即保存');
238
+ },
239
+ shortcut: shortcuts.value.save,
240
+ available: hasDocument && !busy.value && !updateLock.value,
241
+ run: () => store.flush(),
242
+ },
243
+ {
244
+ id: 'workbench.saveAs',
245
+ category: t('文档'),
246
+ get label() {
247
+ return t('另存副本');
248
+ },
249
+ available: standardEditor && writableWorkspace,
250
+ run: () => showModal('saveAs'),
251
+ },
252
+ {
253
+ id: 'workbench.folder',
254
+ category: t('文档'),
255
+ get label() {
256
+ return t('新建文件夹');
257
+ },
258
+ available: writableWorkspace,
259
+ run: () => createNewEntry('folder'),
260
+ },
261
+ {
262
+ id: 'workbench.table',
263
+ category: t('文档'),
264
+ get label() {
265
+ return t('新建数据表');
266
+ },
267
+ available: writableWorkspace,
268
+ run: () => createNewEntry('table'),
269
+ },
270
+ {
271
+ id: 'workbench.import',
272
+ category: t('文档'),
273
+ get label() {
274
+ return t('导入文档');
275
+ },
276
+ available: writableWorkspace,
277
+ run: openImport,
278
+ },
279
+ {
280
+ id: 'workbench.templates',
281
+ category: t('文档'),
282
+ get label() {
283
+ return t('文档模板');
284
+ },
285
+ available: writableWorkspace,
286
+ run: openTemplateLibrary,
287
+ },
288
+ ...(['markdown', 'docx', 'pdf', 'html', 'png'] as const).map((format) => ({
289
+ id: `workbench.export.${format}`,
290
+ category: t('导出'),
291
+ label: { markdown: 'Markdown', docx: 'Word', pdf: 'PDF', html: 'HTML', png: t('图片') }[
292
+ format
293
+ ],
294
+ keywords: format,
295
+ available: hasDocument && !exportBusy.value,
296
+ run: () => exportDocument(format),
297
+ })),
298
+ {
299
+ id: 'workbench.print',
300
+ category: t('文档'),
301
+ get label() {
302
+ return t('打印文档');
303
+ },
304
+ shortcut: shortcuts.value.print,
305
+ available: hasDocument && !printBusy.value,
306
+ run: printActiveDocument,
307
+ },
308
+ {
309
+ id: 'workbench.find',
310
+ category: t('编辑'),
311
+ get label() {
312
+ return t('页内搜索');
313
+ },
314
+ shortcut: shortcuts.value.pageSearch,
315
+ available: standardEditor,
316
+ run: () => openPaneSearch(),
317
+ },
318
+ {
319
+ id: 'workbench.replace',
320
+ category: t('编辑'),
321
+ get label() {
322
+ return t('查找与替换');
323
+ },
324
+ shortcut: shortcuts.value.pageReplace,
325
+ available: editable,
326
+ run: () => openPaneSearch(store.activePaneId, true),
327
+ },
328
+ {
329
+ id: 'workbench.undo',
330
+ category: t('编辑'),
331
+ get label() {
332
+ return t('撤销');
333
+ },
334
+ available: editable && documentUndoAvailable.value,
335
+ run: undoDocument,
336
+ },
337
+ {
338
+ id: 'workbench.redo',
339
+ category: t('编辑'),
340
+ get label() {
341
+ return t('重做');
342
+ },
343
+ available: editable && documentRedoAvailable.value,
344
+ run: redoDocument,
345
+ },
346
+ ...editorPaletteCommands({
347
+ editable: editable && !!editor.value,
348
+ source: source.value,
349
+ context: paneSelections[store.activePaneId] ?? defaultSelectionContext,
350
+ features: store.capabilities.features,
351
+ run: (name, value) => editor.value?.command(name, value),
352
+ }),
353
+ {
354
+ id: 'workbench.source',
355
+ category: t('视图'),
356
+ label: source.value ? t('返回可视化编辑') : t('切换源码模式'),
357
+ shortcut: shortcuts.value.toggleSource,
358
+ available: standardEditor,
359
+ keywords: 'Markdown source',
360
+ run: () => {
361
+ source.value = !source.value;
362
+ },
363
+ },
364
+ {
365
+ id: 'workbench.markdown-reveal',
366
+ category: t('视图'),
367
+ get label() {
368
+ return t('光标展开源码');
369
+ },
370
+ shortcut: shortcuts.value.toggleMarkdownReveal,
371
+ available: standardEditor && !source.value,
372
+ keywords: 'Markdown source cursor',
373
+ run: () => {
374
+ revealMarkdown.value = !revealMarkdown.value;
375
+ },
376
+ },
377
+ {
378
+ id: 'workbench.assistant',
379
+ category: t('视图'),
380
+ get label() {
381
+ return t('打开或关闭同页助手');
382
+ },
383
+ shortcut: shortcuts.value.toggleAssistant,
384
+ available: !!workspace.value && assistant.available,
385
+ run: toggleAssistant,
386
+ },
387
+ {
388
+ id: 'workbench.reading',
389
+ category: t('视图'),
390
+ label: pageLocked.value ? t('退出阅读模式') : t('进入阅读模式'),
391
+ available: hasDocument && !workspaceLocked.value,
392
+ keywords: t('锁定页面 解锁'),
393
+ run: togglePageLock,
394
+ },
395
+ {
396
+ id: 'workbench.width',
397
+ category: t('视图'),
398
+ label: limitPageWidth.value ? t('展开页面全宽') : t('限制页面宽度'),
399
+ available: hasDocument && pageWidthWritable.value,
400
+ run: () => setLimitPageWidth(!limitPageWidth.value),
401
+ },
402
+ {
403
+ id: 'workbench.outline',
404
+ category: t('视图'),
405
+ label: showOutline.value ? t('隐藏文档目录') : t('显示文档目录'),
406
+ available: hasDocument,
407
+ keywords: t('大纲'),
408
+ run: () => {
409
+ showOutline.value = !showOutline.value;
410
+ },
411
+ },
412
+ {
413
+ id: 'workbench.properties',
414
+ category: t('视图'),
415
+ label: showDocumentProperties.value ? t('隐藏文档属性') : t('显示文档属性'),
416
+ available: hasDocument,
417
+ run: () => {
418
+ showDocumentProperties.value = !showDocumentProperties.value;
419
+ },
420
+ },
421
+ {
422
+ id: 'workbench.discussion',
423
+ category: t('文档'),
424
+ get label() {
425
+ return t('发起讨论');
426
+ },
427
+ keywords: t('文档讨论 评论'),
428
+ available: editable,
429
+ run: openDocumentDiscussion,
430
+ },
431
+ {
432
+ id: 'workbench.sidebar',
433
+ category: t('视图'),
434
+ label: sidebar.value ? t('收起侧栏') : t('展开侧栏'),
435
+ shortcut: shortcuts.value.toggleSidebar,
436
+ available: !isAuxiliaryWindow,
437
+ run: toggleSidebar,
438
+ },
439
+ {
440
+ id: 'workbench.home',
441
+ category: t('导航'),
442
+ get label() {
443
+ return t('切换到主页');
444
+ },
445
+ available: !isAuxiliaryWindow,
446
+ run: () => {
447
+ selectContext('home');
448
+ sidebar.value = true;
449
+ },
450
+ },
451
+ {
452
+ id: 'workbench.switch-workspace',
453
+ category: t('导航'),
454
+ get label() {
455
+ return t('切换工作区');
456
+ },
457
+ available: !isAuxiliaryWindow,
458
+ run: () => {
459
+ sidebar.value = true;
460
+ toggleWorkspaceMenu();
461
+ },
462
+ },
463
+ ...(extensions.commands ?? []),
464
+ {
465
+ id: 'workbench.repository',
466
+ category: t('工作区'),
467
+ get label() {
468
+ return t('打开仓库');
469
+ },
470
+ available: !isAuxiliaryWindow,
471
+ run: () => {
472
+ sidebar.value = true;
473
+ sidebarView.value = 'repository';
474
+ },
475
+ },
476
+ {
477
+ id: 'workbench.plan',
478
+ category: t('工作区'),
479
+ get label() {
480
+ return t('打开计划');
481
+ },
482
+ available: !isAuxiliaryWindow && store.workspaceSettings.showPlan,
483
+ run: () => {
484
+ sidebar.value = true;
485
+ selectModule('plan');
486
+ },
487
+ },
488
+ {
489
+ id: 'workbench.calendar',
490
+ category: t('工作区'),
491
+ get label() {
492
+ return t('打开日历');
493
+ },
494
+ available: store.workspaceSettings.showPlan,
495
+ run: () => openCalendar(),
496
+ },
497
+ {
498
+ id: 'workbench.graph',
499
+ category: t('工作区'),
500
+ get label() {
501
+ return t('打开关系图谱');
502
+ },
503
+ available: store.workspaceSettings.showGraph,
504
+ run: () => store.openGraphTab(),
505
+ },
506
+ {
507
+ id: 'workbench.plugins',
508
+ category: t('工作区'),
509
+ get label() {
510
+ return t('打开插件中心');
511
+ },
512
+ available: store.workspaceSettings.showPlugins,
513
+ run: () => store.openPluginsTab(),
514
+ },
515
+ {
516
+ id: 'workbench.updates',
517
+ category: t('历史'),
518
+ get label() {
519
+ return t('文档更新历史');
520
+ },
521
+ available: hasDocument,
522
+ run: () => {
523
+ historyPage.value = 'updates';
524
+ historyPanel.value = true;
525
+ },
526
+ },
527
+ {
528
+ id: 'workbench.versions',
529
+ category: t('历史'),
530
+ get label() {
531
+ return t('文档版本历史');
532
+ },
533
+ available: hasDocument && !!extensions.historyEnabled && !!extensions.historyView,
534
+ run: () => {
535
+ historyPage.value = 'versions';
536
+ historyPanel.value = true;
537
+ },
538
+ },
539
+ {
540
+ id: 'workbench.settings',
541
+ category: t('设置'),
542
+ get label() {
543
+ return t('外观设置');
544
+ },
545
+ keywords: t('打开设置'),
546
+ run: () => openSettings('appearance'),
547
+ },
548
+ {
549
+ id: 'workbench.settings.editing',
550
+ category: t('设置'),
551
+ get label() {
552
+ return t('编辑设置');
553
+ },
554
+ run: () => openSettings('editing'),
555
+ },
556
+ {
557
+ id: 'workbench.settings.shortcuts',
558
+ category: t('设置'),
559
+ get label() {
560
+ return t('快捷键');
561
+ },
562
+ run: () => openSettings('shortcuts'),
563
+ },
564
+ {
565
+ id: 'workbench.settings.workspace',
566
+ category: t('设置'),
567
+ get label() {
568
+ return t('工作区设置');
569
+ },
570
+ available: navigationContext.value === 'workspace' && !!workspace.value,
571
+ run: () => openSettings('workspace'),
572
+ },
573
+ {
574
+ id: 'workbench.settings.about',
575
+ category: t('设置'),
576
+ get label() {
577
+ return t('关于同页');
578
+ },
579
+ run: () => openSettings('about'),
580
+ },
581
+ {
582
+ id: 'workbench.check-updates',
583
+ category: t('设置'),
584
+ get label() {
585
+ return t('检查更新');
586
+ },
587
+ available: native && !mobile && !updateLock.value && !updates.state.busy,
588
+ run: () => {
589
+ openSettings('about');
590
+ return updates.check();
591
+ },
592
+ },
593
+ ];
594
+ });
595
+
596
+ return {
597
+ workbenchCommands,
598
+ };
599
+ }