@tano.page/workbench 0.14.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 (248) hide show
  1. package/package.json +50 -16
  2. package/src/App.vue +82 -752
  3. package/src/appearance/appearance.ts +14 -4
  4. package/src/appearance/components/ThemePresetPreview.vue +52 -8
  5. package/src/appearance/interface-font.ts +99 -0
  6. package/src/appearance/theme.ts +26 -10
  7. package/src/appearance/use-interface-font.ts +30 -0
  8. package/src/assets/mail-provider-icons/NOTICE.txt +27 -0
  9. package/src/assets/mail-provider-icons/aliyun-mail.svg +3 -0
  10. package/src/assets/mail-provider-icons/gmail.svg +1 -0
  11. package/src/assets/mail-provider-icons/icloud.svg +12 -0
  12. package/src/assets/mail-provider-icons/netease-126.svg +5 -0
  13. package/src/assets/mail-provider-icons/netease-163.svg +5 -0
  14. package/src/assets/mail-provider-icons/qq.svg +9 -0
  15. package/src/assets/mail-provider-icons/tencent-exmail.svg +4 -0
  16. package/src/assistant/agent-identities.ts +1 -97
  17. package/src/assistant/agent-task-context.ts +1 -54
  18. package/src/assistant/attachments.ts +1 -1
  19. package/src/assistant/completion.ts +1 -61
  20. package/src/assistant/components/AssistantChangeList.vue +98 -21
  21. package/src/assistant/components/AssistantPanel.vue +425 -8
  22. package/src/assistant/components/PluginToolProposalCard.vue +235 -0
  23. package/src/assistant/connection-actions.ts +237 -0
  24. package/src/assistant/document-mentions.ts +1 -33
  25. package/src/assistant/engine.ts +1 -532
  26. package/src/assistant/execution.ts +6 -33
  27. package/src/assistant/files.ts +5 -13
  28. package/src/assistant/hash.ts +1 -4
  29. package/src/assistant/inbox.ts +1 -148
  30. package/src/assistant/language.ts +10 -37
  31. package/src/assistant/mention-autocomplete.ts +69 -0
  32. package/src/assistant/plugin-bridge-builder.ts +146 -0
  33. package/src/assistant/prompts.ts +1 -58
  34. package/src/assistant/proposal-actions.ts +336 -0
  35. package/src/assistant/results.ts +20 -86
  36. package/src/assistant/store.ts +167 -327
  37. package/src/assistant/structures.ts +1 -155
  38. package/src/assistant/tasks.ts +8 -96
  39. package/src/assistant/tool-rules.ts +1 -7
  40. package/src/assistant/workspace-bridge.ts +1 -1
  41. package/src/composables/use-document-actions.ts +38 -20
  42. package/src/composables/use-file-tree-controller.ts +7 -12
  43. package/src/composables/use-workbench-help.ts +177 -0
  44. package/src/composables/use-workbench-history.ts +2 -4
  45. package/src/composables/use-workbench-lifecycle.ts +249 -0
  46. package/src/composables/use-workbench-modals.ts +6 -1
  47. package/src/composables/use-workbench-outline.ts +0 -5
  48. package/src/composables/use-workbench-settings.ts +185 -0
  49. package/src/composables/use-workbench-shortcuts.ts +40 -1021
  50. package/src/composables/use-workbench-views.ts +325 -0
  51. package/src/data-tables/data-tables.ts +1 -2
  52. package/src/documents/components/DocumentActionMenu.vue +279 -0
  53. package/src/documents/components/DocumentHistoryPanel.vue +3 -1
  54. package/src/documents/components/DocumentInspector.vue +168 -0
  55. package/src/documents/components/DocumentPane.vue +482 -0
  56. package/src/documents/description-merge.ts +1 -9
  57. package/src/features.ts +1 -0
  58. package/src/files/components/FileMetadataPanel.vue +49 -15
  59. package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
  60. package/src/fonts/Inter-Latin.woff2 +0 -0
  61. package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
  62. package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
  63. package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
  64. package/src/help/help-milestones.ts +3 -5
  65. package/src/i18n/locale-catalogs.ts +7 -6
  66. package/src/i18n/locale-registry.ts +8 -6
  67. package/src/i18n/locales/de-DE.json +371 -3
  68. package/src/i18n/locales/en-US.json +371 -2
  69. package/src/i18n/locales/es-ES.json +371 -3
  70. package/src/i18n/locales/ja-JP.json +370 -2
  71. package/src/i18n/locales/zh-TW.json +370 -2
  72. package/src/mail/components/MailAccountDialog.vue +450 -0
  73. package/src/mail/components/MailComposerDialog.vue +326 -0
  74. package/src/mail/components/MailProviderIcon.vue +30 -0
  75. package/src/mail/components/MailWorkspaceView.vue +821 -0
  76. package/src/mail/components/SidebarMail.vue +134 -0
  77. package/src/mail/mail-avatar.ts +17 -0
  78. package/src/mail/mail-bridge.ts +68 -0
  79. package/src/mail/mail-calendar.ts +208 -0
  80. package/src/mail/mail-markdown.ts +195 -0
  81. package/src/mail/types.ts +226 -0
  82. package/src/objects/components/ObjectDetailModal.vue +1001 -0
  83. package/src/objects/content-references.ts +6 -56
  84. package/src/objects/wiki-links.ts +1 -48
  85. package/src/objects/workspace-objects.ts +3 -4
  86. package/src/plan-sync/types.ts +6 -3
  87. package/src/plans/calendar-interaction.ts +194 -0
  88. package/src/plans/calendar.ts +65 -9
  89. package/src/plans/components/CalendarAgendaView.vue +165 -0
  90. package/src/plans/components/CalendarDayPopover.vue +172 -39
  91. package/src/plans/components/CalendarFilterBar.vue +128 -0
  92. package/src/plans/components/CalendarMonthView.vue +224 -0
  93. package/src/plans/components/CalendarQuickCreateDialog.vue +269 -0
  94. package/src/plans/components/CalendarTimelineView.vue +517 -0
  95. package/src/plans/components/CalendarTopbarControls.vue +101 -0
  96. package/src/plans/components/CalendarView.vue +264 -748
  97. package/src/plans/components/CalendarYearView.vue +138 -0
  98. package/src/plans/components/PlanArchiveDialog.vue +295 -0
  99. package/src/plans/components/PlanConnectionsDialog.vue +1 -1
  100. package/src/plans/components/PlanDateField.vue +6 -4
  101. package/src/plans/components/PlanDetailPanel.vue +227 -32
  102. package/src/plans/components/PlanEventList.vue +16 -4
  103. package/src/plans/components/SidebarPlan.vue +22 -15
  104. package/src/plans/components/TaskRepeatControls.vue +169 -30
  105. package/src/plans/components/calendar-shared.css +192 -0
  106. package/src/plans/composables/use-calendar-interactions.ts +396 -0
  107. package/src/plans/composables/use-calendar-scroll.ts +420 -0
  108. package/src/plans/local-reminders.ts +149 -0
  109. package/src/plans/personal-plans.ts +10 -1
  110. package/src/plans/plan-date.ts +8 -1
  111. package/src/plans/plan-migration.ts +95 -0
  112. package/src/plans/recurrence.ts +95 -0
  113. package/src/plans/task-repeat.ts +8 -8
  114. package/src/plans/timeline-layout.ts +92 -0
  115. package/src/plugins/assistant-bridge.ts +520 -0
  116. package/src/plugins/attachment-reader.ts +3 -1
  117. package/src/plugins/cache-storage.ts +42 -2
  118. package/src/plugins/components/PluginAutomations.vue +3 -3
  119. package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
  120. package/src/plugins/components/PluginChangeSummary.vue +16 -3
  121. package/src/plugins/components/PluginConnections.vue +1 -1
  122. package/src/plugins/components/PluginCustomView.vue +2 -2
  123. package/src/plugins/components/PluginDetailPage.vue +136 -57
  124. package/src/plugins/components/PluginDeveloperArea.vue +192 -0
  125. package/src/plugins/components/PluginDocumentSlot.vue +63 -0
  126. package/src/plugins/components/PluginExplorer.vue +21 -25
  127. package/src/plugins/components/PluginImportDialog.vue +410 -0
  128. package/src/plugins/components/PluginInstaller.vue +273 -288
  129. package/src/plugins/components/PluginListItem.vue +3 -0
  130. package/src/plugins/components/PluginMaintenance.vue +37 -34
  131. package/src/plugins/components/PluginRepositoryStorage.vue +4 -2
  132. package/src/plugins/components/PluginRuntimePanel.vue +3 -3
  133. package/src/plugins/components/PluginSettingsForm.vue +112 -0
  134. package/src/plugins/components/PluginStatusBar.vue +161 -0
  135. package/src/plugins/components/PluginSurface.vue +18 -6
  136. package/src/plugins/components/PluginUiDialog.vue +452 -0
  137. package/src/plugins/components/PluginsTabPage.vue +61 -0
  138. package/src/plugins/components/plugin-center.css +5 -0
  139. package/src/plugins/data.ts +9 -86
  140. package/src/plugins/editor-plugin-adapters.ts +169 -0
  141. package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
  142. package/src/plugins/excalidraw/manifest.json +12 -1
  143. package/src/plugins/host.ts +662 -43
  144. package/src/plugins/native.ts +2 -10
  145. package/src/plugins/overlay-mapping.ts +125 -0
  146. package/src/plugins/packages.ts +73 -1
  147. package/src/plugins/plugin-data.ts +2 -3
  148. package/src/plugins/plugin-permissions.ts +57 -0
  149. package/src/plugins/plugin-rpc-router.ts +558 -0
  150. package/src/plugins/plugin-sdk.ts +1 -94
  151. package/src/plugins/plugin-ui-dialogs.ts +167 -0
  152. package/src/plugins/policy.ts +53 -3
  153. package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
  154. package/src/plugins/presentation-preview/manifest.json +2 -1
  155. package/src/plugins/queries.ts +1 -73
  156. package/src/plugins/sandbox.ts +15 -1
  157. package/src/plugins/use-plugin-actions.ts +67 -20
  158. package/src/plugins/user-plugins.ts +254 -0
  159. package/src/plugins/view-header.ts +2 -7
  160. package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
  161. package/src/plugins/word-preview/manifest.json +13 -1
  162. package/src/plugins/workbench.ts +175 -2
  163. package/src/plugins/worker.js +105 -8
  164. package/src/plugins/workspace-plugin-runtime.ts +23 -7
  165. package/src/plugins/workspace-plugins.ts +212 -21
  166. package/src/runtime.ts +103 -4
  167. package/src/settings/components/SettingsAppearancePage.vue +46 -0
  168. package/src/settings/components/SettingsDocumentsPage.vue +0 -1
  169. package/src/settings/components/SettingsPanel.vue +8 -3
  170. package/src/settings/components/WorkbenchSettings.vue +20 -7
  171. package/src/settings/components/settings-context.ts +1 -1
  172. package/src/settings/components/settings-search.ts +2 -3
  173. package/src/settings/settings-tab.ts +1 -0
  174. package/src/shell/command-palette.ts +3 -3
  175. package/src/shell/components/EditorToolbar.vue +8 -9
  176. package/src/shell/components/EditorTools.vue +1 -5
  177. package/src/shell/components/PaneTopbar.vue +393 -0
  178. package/src/shell/components/SelectionToolbar.vue +0 -2
  179. package/src/shell/components/SidebarNavigation.vue +22 -2
  180. package/src/shell/components/WorkbenchContextMenus.vue +58 -34
  181. package/src/shell/components/WorkbenchModals.vue +47 -62
  182. package/src/shell/components/WorkbenchPanes.vue +371 -1342
  183. package/src/shell/components/WorkbenchSidebar.vue +486 -0
  184. package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
  185. package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
  186. package/src/shell/pane-registry.ts +69 -0
  187. package/src/shell/use-surface-dismissal.ts +219 -0
  188. package/src/shell/use-workbench-commands.ts +599 -0
  189. package/src/shell/use-workbench-keybindings.ts +337 -0
  190. package/src/shell/use-workbench.ts +531 -1153
  191. package/src/shell/workbench-async-components.ts +14 -5
  192. package/src/shell/workbench-context.ts +30 -3
  193. package/src/stores/mail.ts +414 -0
  194. package/src/stores/plan-sync.ts +2 -1
  195. package/src/stores/plans.ts +2 -9
  196. package/src/stores/workspace-document-io.ts +807 -0
  197. package/src/stores/workspace-file-ops.ts +1 -1
  198. package/src/stores/workspace-knowledge.ts +2 -114
  199. package/src/stores/workspace-lifecycle.ts +459 -0
  200. package/src/stores/workspace-plugins-state.ts +254 -259
  201. package/src/stores/workspace-session.ts +287 -0
  202. package/src/stores/workspace-tabs-layout.ts +6 -44
  203. package/src/stores/workspace-types.ts +50 -0
  204. package/src/stores/workspace.ts +184 -1363
  205. package/src/styles/agent-diff-modals.css +0 -7
  206. package/src/styles/dark-theme.css +3 -3
  207. package/src/styles/inspector.css +0 -59
  208. package/src/styles/layout-themes.css +346 -0
  209. package/src/styles/mail.css +1568 -0
  210. package/src/styles/mobile.css +2 -2
  211. package/src/styles/recent-and-media.css +0 -17
  212. package/src/styles/theme-contract.css +3 -3
  213. package/src/styles/workbench-shell.css +110 -17
  214. package/src/styles/workspace-states.css +9 -33
  215. package/src/styles.css +0 -1
  216. package/src/tabs/components/DesktopTabs.vue +19 -14
  217. package/src/tabs/components/NewTabPicker.vue +10 -4
  218. package/src/tabs/tab-label.ts +0 -1
  219. package/src/windows/AuxiliaryWindows.vue +2 -2
  220. package/src/windows/use-window-event-bridge.ts +152 -0
  221. package/src/workspace/components/TemplateLibrary.vue +1 -1
  222. package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
  223. package/src/workspace/components/WorkspaceIconPicker.vue +30 -7
  224. package/src/workspace/components/WorkspacePickerMenu.vue +317 -0
  225. package/src/workspace/workspace-comments.ts +11 -151
  226. package/src/workspace/workspace-welcome.ts +1 -1
  227. package/src/assistant/locales/de-DE.json +0 -126
  228. package/src/assistant/locales/en-US.json +0 -126
  229. package/src/assistant/locales/es-ES.json +0 -126
  230. package/src/assistant/locales/ja-JP.json +0 -126
  231. package/src/assistant/locales/zh-CN.json +0 -126
  232. package/src/assistant/locales/zh-TW.json +0 -126
  233. package/src/assistant/task-prompts.json +0 -39
  234. package/src/documents/components/FormulaMenu.vue +0 -50
  235. package/src/files/components/FileDatabasePage.vue +0 -152
  236. package/src/files/components/FolderHomeIcon.vue +0 -12
  237. package/src/objects/components/ObjectDatabasePage.vue +0 -100
  238. package/src/objects/components/ObjectPanel.vue +0 -554
  239. package/src/plans/components/PersonalPlanDialog.vue +0 -105
  240. package/src/shell/components/WorkspaceViewPage.vue +0 -127
  241. package/src/shell/components/WorkspaceViewTab.vue +0 -24
  242. package/src/styles/object-panel.css +0 -163
  243. package/src/workspace/components/GitInspectionPanel.vue +0 -35
  244. package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
  245. package/src/workspace/welcome-slogans.ts +0 -11
  246. package/src/workspace/workspace-git.ts +0 -35
  247. package/src/workspace/workspace-sync.ts +0 -46
  248. package/src/workspace/workspace-views.ts +0 -48
@@ -2,12 +2,14 @@
2
2
  import { t } from '../../i18n/i18n';
3
3
  import { LoaderCircle, MoreHorizontal, Plus } from 'lucide-vue-next';
4
4
  import type { PluginManifest } from '@tano/protocol';
5
+ import type { PluginInstallScope } from '../workspace-plugins';
5
6
  import PluginIcon from './PluginIcon.vue';
6
7
 
7
8
  defineProps<{
8
9
  plugin: PluginManifest;
9
10
  installed?: boolean;
10
11
  enabled?: boolean;
12
+ scope?: PluginInstallScope;
11
13
  showState?: boolean;
12
14
  busy?: boolean;
13
15
  pending?: boolean;
@@ -24,6 +26,7 @@ const emit = defineEmits<{ details: []; install: [] }>();
24
26
  <span class="entry-description" :title="plugin.description">{{ plugin.description }}</span>
25
27
  </span>
26
28
  </button>
29
+ <span v-if="showState && installed && scope === 'user'" class="entry-state">{{ t('全局') }}</span>
27
30
  <span v-if="showState && installed" class="entry-state" :class="{ enabled }">{{
28
31
  enabled ? t('已启用') : t('已停用')
29
32
  }}</span>
@@ -1,12 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import { uiLocale, t } from '../../i18n/i18n';
3
- import { computed, ref, watch } from 'vue';
3
+ import { computed, inject, ref, watch } from 'vue';
4
4
  import { pluginCacheLimit, pluginPackageLimit } from '@tano/protocol';
5
- import PluginRepositoryStorage from './PluginRepositoryStorage.vue';
5
+ import { workbenchPrefsKey } from '../../shell/workbench-context';
6
6
  import { useWorkspaceStore } from '../../stores/workspace';
7
7
  import { PluginPackageCache } from '../packages';
8
8
  import type { PluginCacheEntry } from '../cache-storage';
9
- const props = defineProps<{ id: string }>();
9
+ const props = defineProps<{ id: string; developerMode?: boolean }>();
10
+ const workbench = inject(workbenchPrefsKey, null);
11
+ const isDeveloperMode = computed(() => props.developerMode ?? Boolean(workbench?.developerMode));
10
12
  const store = useWorkspaceStore(), cache = new PluginPackageCache();
11
13
  const entries = ref<PluginCacheEntry[]>([]), pending = ref(false), error = ref(''), status = ref('');
12
14
  const developmentUrl = ref(''), trustBuilds = ref(false);
@@ -43,27 +45,11 @@ async function run(action: () => Promise<unknown>, message: string) {
43
45
  <template>
44
46
  <section class="plugin-maintenance" :aria-label="t('插件版本与维护')">
45
47
  <h4>{{ t('版本与维护') }}</h4>
46
- <p role="status">{{ t('当前设备:') }}{{ runtime ? { loading: t('加载中'), running: t('运行中'), blocked: t('等待授权或运行环境'), error: t('运行失败') }[runtime.status] : installation?.enabled ? t('尚未启动') : t('已停用') }}</p>
48
+ <p role="status">{{ t('当前设备:') }}{{ runtime ? { idle: t('待唤醒'), loading: t('加载中'), running: t('运行中'), blocked: t('等待授权或运行环境'), error: t('运行失败') }[runtime.status] : installation?.enabled ? t('尚未启动') : t('已停用') }}</p>
47
49
  <p v-if="runtime?.message" :role="runtime.status === 'error' ? 'alert' : 'status'">{{ runtime.message }}</p>
48
50
  <p v-if="error" role="alert">{{ error }}</p><p v-if="status" role="status">{{ status }}</p>
49
51
  <button :disabled="pending || !installation?.enabled" @click="run(() => store.restartPlugin(id, store.workspace!.id), t('已重新加载当前版本'))">{{ t('重新加载当前版本') }}</button>
50
- <p>{{ t('单包上限') }} {{ size(pluginPackageLimit) }} {{ t('· 设备代码缓存') }} {{ size(used) }} / {{ size(pluginCacheLimit) }}</p>
51
- <p>{{ t('此插件本机状态') }} {{ size(state.used) }} / {{ size(state.limit) }}{{ t('。缓存清理不会删除工作区内容。') }}</p>
52
- <PluginRepositoryStorage :plugin-id="id" />
53
- <details>
54
- <summary>{{ t('开发模式') }}</summary>
55
- <p>{{ t('先安装并授权一个初始构建,然后运行:') }}</p>
56
- <pre>npm run plugin -- watch ./my-plugin --origin {{ appOrigin }}</pre>
57
- <p>{{ t('新构建会更新当前工作区的共享插件规则,请使用测试工作区。权限声明变化时停止自动应用。') }}</p>
58
- <label>{{ t('本机开发地址') }}<input v-model="developmentUrl" type="url" :aria-label="t('插件开发地址')" :placeholder="t('http://127.0.0.1:端口/…/package.json')" /></label>
59
- <label><input v-model="trustBuilds" type="checkbox" />{{ t('信任此开发会话中权限不变的新构建') }}</label>
60
- <button :disabled="!trustBuilds || !installation?.authorized || !installation?.enabled || !store.canManagePlugins" @click="startDevelopment">{{ t('开始自动重载') }}</button>
61
- <template v-if="store.pluginDevelopment.pluginId === id">
62
- <p role="status">{{ store.pluginDevelopment.message }}</p>
63
- <button v-if="store.pluginDevelopment.active" @click="store.stopPluginDevelopment()">{{ t('停止自动重载') }}</button>
64
- </template>
65
- </details>
66
- <details>
52
+ <details v-if="installation?.scope !== 'user' && (installation?.rule?.history?.length || isDeveloperMode)">
67
53
  <summary>{{ t('历史版本(') }}{{ installation?.rule?.history?.length ?? 0 }})</summary>
68
54
  <p>{{ t('保留最近 10 个版本引用。移除引用后,该版本不再受云端回收保护,日后恢复需重新导入。回滚沿用当前共享设置,运行前仍需核对并授权版本。') }}</p>
69
55
  <ul>
@@ -76,19 +62,36 @@ async function run(action: () => Promise<unknown>, message: string) {
76
62
  </li>
77
63
  </ul>
78
64
  </details>
79
- <details>
80
- <summary>{{ t('此插件的设备缓存(') }}{{ localEntries.length }})</summary>
81
- <ul><li v-for="entry in localEntries" :key="entry.integrity">{{ entry.version }} · {{ size(entry.bytes) }} · <code>{{ entry.integrity.slice(0, 12) }}</code>
82
- <button :disabled="pending || entry.integrity === installation?.rule?.integrity" @click="run(() => cache.remove(entry.integrity), t('已清理所选代码缓存'))">{{ t('清理缓存') }}</button>
83
- </li></ul>
84
- <p>{{ t('清理旧缓存后,回滚可能需要联网下载或重新导入对应包。') }}</p>
85
- </details>
86
- <details>
87
- <summary>{{ t('运行日志(') }}{{ runtime?.logs?.length ?? 0 }})</summary>
88
- <p>{{ t('仅保留本次工作区会话最近 100 条,重新加载插件后仍可查看。') }}</p>
89
- <button @click="store.clearPluginLogs(id)">{{ t('清空日志') }}</button>
90
- <ol class="plugin-logs"><li v-for="(log, index) in runtime?.logs" :key="index"><time>{{ new Date(log.time).toLocaleTimeString(uiLocale) }}</time> {{ log.level }} <pre>{{ log.message }}</pre></li></ol>
91
- </details>
65
+ <template v-if="isDeveloperMode">
66
+ <p>{{ t('单包上限') }} {{ size(pluginPackageLimit) }} {{ t('· 设备代码缓存') }} {{ size(used) }} / {{ size(pluginCacheLimit) }}</p>
67
+ <p>{{ t('此插件本机状态') }} {{ size(state.used) }} / {{ size(state.limit) }}{{ t('。缓存清理不会删除工作区内容。') }}</p>
68
+ <details v-if="installation?.scope !== 'user'">
69
+ <summary>{{ t('开发模式') }}</summary>
70
+ <p>{{ t('先安装并授权一个初始构建,然后运行:') }}</p>
71
+ <pre>npm run plugin -- watch ./my-plugin --origin {{ appOrigin }}</pre>
72
+ <p>{{ t('新构建会更新当前工作区的共享插件规则,请使用测试工作区。权限声明变化时停止自动应用。') }}</p>
73
+ <label>{{ t('本机开发地址') }}<input v-model="developmentUrl" type="url" :aria-label="t('插件开发地址')" :placeholder="t('http://127.0.0.1:端口/…/package.json')" /></label>
74
+ <label><input v-model="trustBuilds" type="checkbox" />{{ t('信任此开发会话中权限不变的新构建') }}</label>
75
+ <button :disabled="!trustBuilds || !installation?.authorized || !installation?.enabled || !store.canManagePlugins" @click="startDevelopment">{{ t('开始自动重载') }}</button>
76
+ <template v-if="store.pluginDevelopment.pluginId === id">
77
+ <p role="status">{{ store.pluginDevelopment.message }}</p>
78
+ <button v-if="store.pluginDevelopment.active" @click="store.stopPluginDevelopment()">{{ t('停止自动重载') }}</button>
79
+ </template>
80
+ </details>
81
+ <details>
82
+ <summary>{{ t('此插件的设备缓存(') }}{{ localEntries.length }})</summary>
83
+ <ul><li v-for="entry in localEntries" :key="entry.integrity">{{ entry.version }} · {{ size(entry.bytes) }} · <code>{{ entry.integrity.slice(0, 12) }}</code>
84
+ <button :disabled="pending || entry.integrity === installation?.rule?.integrity || store.userPluginIntegrities().has(entry.integrity)" @click="run(() => cache.remove(entry.integrity), t('已清理所选代码缓存'))">{{ t('清理缓存') }}</button>
85
+ </li></ul>
86
+ <p>{{ t('清理旧缓存后,回滚可能需要联网下载或重新导入对应包。') }}</p>
87
+ </details>
88
+ <details>
89
+ <summary>{{ t('运行日志(') }}{{ runtime?.logs?.length ?? 0 }})</summary>
90
+ <p>{{ t('仅保留本次工作区会话最近 100 条,重新加载插件后仍可查看。') }}</p>
91
+ <button @click="store.clearPluginLogs(id)">{{ t('清空日志') }}</button>
92
+ <ol class="plugin-logs"><li v-for="(log, index) in runtime?.logs" :key="index"><time>{{ new Date(log.time).toLocaleTimeString(uiLocale) }}</time> {{ log.level }} <pre>{{ log.message }}</pre></li></ol>
93
+ </details>
94
+ </template>
92
95
  </section>
93
96
  </template>
94
97
  <style scoped>
@@ -5,6 +5,7 @@ import type { PluginPackageUsage } from '@tano/protocol';
5
5
  import { useWorkspaceStore } from '../../stores/workspace';
6
6
  const props = defineProps<{ pluginId?: string }>();
7
7
  const store = useWorkspaceStore(), usage = ref<PluginPackageUsage>(), pending = ref(false), error = ref(''), status = ref('');
8
+ const opened = ref(false);
8
9
  const entries = computed(() => usage.value?.entries.filter(entry => !props.pluginId || entry.pluginId === props.pluginId) ?? []);
9
10
  const size = (bytes: number) => bytes >= 1024 * 1024 ? `${(bytes / 1024 / 1024).toFixed(1)} MiB` : `${(bytes / 1024).toFixed(1)} KiB`;
10
11
  let generation = 0;
@@ -14,9 +15,10 @@ async function load(current: number) {
14
15
  const result = await store.loadPluginPackageUsage(store.workspace.id);
15
16
  if (current === generation) usage.value = result;
16
17
  }
17
- watch([() => props.pluginId, () => store.workspace?.id, () => store.canManagePlugins,
18
+ watch([opened, () => props.pluginId, () => store.workspace?.id, () => store.canManagePlugins,
18
19
  () => JSON.stringify(store.installedPlugins.map(plugin => plugin.rule))], async (_current, _previous, cleanup) => {
19
20
  const current = ++generation; cleanup(() => { generation++; }); usage.value = undefined; error.value = ''; status.value = ''; pending.value = false;
21
+ if (!opened.value) return;
20
22
  try { await load(current); } catch (cause) { if (current === generation) error.value = String(cause); }
21
23
  }, { immediate: true });
22
24
  async function run(integrity?: string) {
@@ -31,7 +33,7 @@ async function run(integrity?: string) {
31
33
  }
32
34
  </script>
33
35
  <template>
34
- <details v-if="store.pluginRepositoryAvailable && store.canManagePlugins" class="plugin-repository-storage">
36
+ <details v-if="store.pluginRepositoryAvailable && store.canManagePlugins" class="plugin-repository-storage" @toggle="opened = ($event.target as HTMLDetailsElement).open">
35
37
  <summary>{{ t('工作区云端包存储') }}</summary>
36
38
  <p v-if="error" role="alert">{{ error }}</p><p v-if="status" role="status">{{ status }}</p>
37
39
  <button :disabled="pending" @click="run()">{{ t('刷新云端容量') }}</button>
@@ -38,12 +38,12 @@ async function invoke(plugin: PluginRuntimeState, kind: 'command' | 'action', na
38
38
  <h2>{{ t('插件工具') }}</h2>
39
39
  <p v-if="error" role="alert">{{ error }}</p>
40
40
  <article v-for="plugin in store.pluginRuntime" :key="plugin.id">
41
- <header><strong>{{ plugin.name }}</strong><span>{{ { loading: t('加载中'), running: t('运行中'), blocked: t('等待授权或运行环境'), error: t('已停止') }[plugin.status] }}</span></header>
41
+ <header><strong>{{ plugin.name }}</strong><span>{{ { idle: t('待唤醒'), loading: t('加载中'), running: t('运行中'), blocked: t('等待授权或运行环境'), error: t('已停止') }[plugin.status] }}</span></header>
42
42
  <p v-if="plugin.message" :role="plugin.status === 'error' ? 'alert' : 'status'">{{ plugin.message }}</p>
43
43
  <button v-if="plugin.status === 'error'" @click="store.restartPlugin(plugin.id, store.workspace!.id).catch(cause => error = String(cause))">{{ t('重新加载') }}</button>
44
- <div class="plugin-commands"><button v-for="command in plugin.commands" :key="command.id" :disabled="!!pending || plugin.status !== 'running'" @click="invoke(plugin, 'command', command.id)">{{ command.label }}</button></div>
44
+ <div class="plugin-commands"><button v-for="command in plugin.commands" :key="command.id" :disabled="!!pending || (plugin.status !== 'running' && plugin.status !== 'idle')" @click="invoke(plugin, 'command', command.id)">{{ command.label }}</button></div>
45
45
  <details v-for="view in plugin.views" :key="view.id" open><summary>{{ view.label }}</summary>
46
- <button v-if="view.location && view.location !== 'panel'" @click="store.openPluginView(plugin.id, view.id)">{{ t('打开') }}{{ { tab: t('标签页'), sidebar: t('侧栏'), settings: t('设置页') }[view.location] }}</button>
46
+ <button v-if="view.location === 'tab' || view.location === 'sidebar' || view.location === 'settings' || view.location === 'documentSidebar'" @click="store.openPluginView(plugin.id, view.id)">{{ t('打开') }}{{ { tab: t('标签页'), sidebar: t('侧栏'), settings: t('设置页'), documentSidebar: t('文档侧栏') }[view.location] }}</button>
47
47
  <PluginCustomView v-if="view.custom && (!view.location || view.location === 'panel') && plugin.status === 'running' && store.workspace" :bundle="view.custom.bundle" :state="view.custom.state" :workspace-id="store.workspace.id" :plugin-id="plugin.id" :instance-id="plugin.instanceId" :view-id="view.id" :execute="store.interactWithPlugin" />
48
48
  <PluginViewNode v-else-if="view.tree && (!view.location || view.location === 'panel')" :node="view.tree" :values="inputs(plugin.id, view.id, view.tree)" :disabled="!!pending || plugin.status !== 'running'"
49
49
  @input="(key, value) => { values[`${plugin.id}:${view.id}`][key] = value; }"
@@ -0,0 +1,112 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+ import { resolvePluginSettingsWithDefaults, type PluginSettingField } from '@tano/protocol';
4
+ import { t } from '../../i18n/i18n';
5
+
6
+ const props = defineProps<{
7
+ schema: readonly PluginSettingField[];
8
+ modelValue: string;
9
+ disabled?: boolean;
10
+ developerMode?: boolean;
11
+ }>();
12
+ const emit = defineEmits<{ 'update:modelValue': [value: string] }>();
13
+
14
+ const parsed = computed<Record<string, unknown>>(() => {
15
+ try {
16
+ const raw = JSON.parse(props.modelValue || '{}');
17
+ if (raw && typeof raw === 'object' && !Array.isArray(raw))
18
+ return resolvePluginSettingsWithDefaults(raw as Record<string, unknown>, props.schema);
19
+ } catch {
20
+ /* Invalid manual JSON stays editable in the advanced textarea. */
21
+ }
22
+ return resolvePluginSettingsWithDefaults({}, props.schema);
23
+ });
24
+
25
+ function updateField(key: string, value: unknown) {
26
+ let base: Record<string, unknown> = {};
27
+ try {
28
+ const raw = JSON.parse(props.modelValue || '{}');
29
+ if (raw && typeof raw === 'object' && !Array.isArray(raw)) base = { ...(raw as Record<string, unknown>) };
30
+ } catch {
31
+ base = {};
32
+ }
33
+ base[key] = value;
34
+ emit('update:modelValue', JSON.stringify(base, null, 2));
35
+ }
36
+
37
+ function updateNumber(field: PluginSettingField, raw: string) {
38
+ if (!raw.trim()) {
39
+ updateField(field.key, field.default ?? undefined);
40
+ return;
41
+ }
42
+ const num = Number(raw);
43
+ if (Number.isFinite(num)) updateField(field.key, num);
44
+ }
45
+ </script>
46
+ <template>
47
+ <div class="plugin-settings-form">
48
+ <div v-for="field in schema" :key="field.key" class="setting-row">
49
+ <label v-if="field.type === 'boolean'" class="setting-checkbox">
50
+ <input
51
+ type="checkbox"
52
+ :checked="Boolean(parsed[field.key])"
53
+ :disabled="disabled"
54
+ @change="updateField(field.key, ($event.target as HTMLInputElement).checked)"
55
+ />
56
+ <span>{{ field.label }}</span>
57
+ </label>
58
+ <label v-else>
59
+ <span>{{ field.label }}<em v-if="field.required"> *</em></span>
60
+ <select
61
+ v-if="field.type === 'select'"
62
+ :value="String(parsed[field.key] ?? field.default ?? '')"
63
+ :disabled="disabled"
64
+ @change="updateField(field.key, ($event.target as HTMLSelectElement).value)"
65
+ >
66
+ <option v-for="opt in field.options" :key="opt.value" :value="opt.value">{{ opt.label }}</option>
67
+ </select>
68
+ <input
69
+ v-else-if="field.type === 'number'"
70
+ type="number"
71
+ :value="parsed[field.key] ?? ''"
72
+ :min="field.min"
73
+ :max="field.max"
74
+ :required="field.required"
75
+ :disabled="disabled"
76
+ @input="updateNumber(field, ($event.target as HTMLInputElement).value)"
77
+ />
78
+ <input
79
+ v-else
80
+ type="text"
81
+ :value="String(parsed[field.key] ?? '')"
82
+ :required="field.required"
83
+ :disabled="disabled"
84
+ @input="updateField(field.key, ($event.target as HTMLInputElement).value)"
85
+ />
86
+ </label>
87
+ <p v-if="field.description" class="setting-description">{{ field.description }}</p>
88
+ </div>
89
+ <details v-if="developerMode" class="setting-raw">
90
+ <summary>{{ t('高级 JSON 视图') }}</summary>
91
+ <textarea
92
+ :value="modelValue"
93
+ :aria-label="t('插件设置 JSON')"
94
+ :disabled="disabled"
95
+ rows="4"
96
+ spellcheck="false"
97
+ @input="emit('update:modelValue', ($event.target as HTMLTextAreaElement).value)"
98
+ />
99
+ </details>
100
+ </div>
101
+ </template>
102
+ <style scoped>
103
+ .plugin-settings-form { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
104
+ .setting-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text); }
105
+ .setting-row .setting-checkbox { flex-direction: row; align-items: center; gap: 8px; }
106
+ .setting-row input[type="text"], .setting-row input[type="number"], .setting-row select {
107
+ padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--text); font: inherit;
108
+ }
109
+ .setting-description { margin: 3px 0 0; font-size: 11px; color: var(--muted); }
110
+ .setting-raw summary { cursor: pointer; font-size: 12px; color: var(--muted); margin: 4px 0; }
111
+ .setting-raw textarea { width: 100%; box-sizing: border-box; font-family: var(--font-mono, monospace); font-size: 12px; }
112
+ </style>
@@ -0,0 +1,161 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+ import { t } from '../../i18n/i18n';
4
+ import type { WorkbenchPinnedCommand } from '../../runtime';
5
+ import type { PluginInteraction, PluginWorkbenchStatusBarItem } from '../workbench';
6
+
7
+ const props = defineProps<{
8
+ items: readonly PluginWorkbenchStatusBarItem[];
9
+ workspaceId: string;
10
+ activeDocumentId?: string;
11
+ execute: (interaction: PluginInteraction) => Promise<void>;
12
+ safeMode?: boolean;
13
+ pinnedCommands?: readonly WorkbenchPinnedCommand[];
14
+ }>();
15
+ const emit = defineEmits<{ exitSafeMode: []; runPinnedCommand: [command: string] }>();
16
+
17
+ const leftItems = computed(() => props.items.filter((item) => item.align === 'left'));
18
+ const rightItems = computed(() => props.items.filter((item) => item.align !== 'left'));
19
+ const visible = computed(() => props.items.length > 0 || !!props.safeMode || (props.pinnedCommands?.length ?? 0) > 0);
20
+
21
+ function trigger(item: PluginWorkbenchStatusBarItem) {
22
+ if (!item.command || !props.workspaceId) return;
23
+ void props
24
+ .execute({
25
+ workspaceId: props.workspaceId,
26
+ pluginId: item.pluginId,
27
+ instanceId: item.instanceId,
28
+ kind: 'command',
29
+ name: item.command,
30
+ payload: {
31
+ workspaceId: props.workspaceId,
32
+ ...(props.activeDocumentId ? { fileId: props.activeDocumentId } : {}),
33
+ },
34
+ })
35
+ .catch(() => {});
36
+ }
37
+ </script>
38
+
39
+ <template>
40
+ <footer v-if="visible" class="plugin-status-bar" :aria-label="t('插件状态栏')">
41
+ <div class="plugin-status-group plugin-status-left">
42
+ <button
43
+ v-if="safeMode"
44
+ type="button"
45
+ class="plugin-status-item clickable tone-warning"
46
+ :title="t('安全模式已开启:点击退出并恢复个人微调与第三方插件')"
47
+ @click="emit('exitSafeMode')"
48
+ >
49
+ {{ t('安全模式 · 点击退出') }}
50
+ </button>
51
+ <button
52
+ v-for="pinned in pinnedCommands ?? []"
53
+ :key="`pinned-${pinned.id}`"
54
+ type="button"
55
+ class="plugin-status-item clickable tone-accent"
56
+ :title="pinned.description || pinned.command"
57
+ @click="emit('runPinnedCommand', pinned.command)"
58
+ >
59
+ {{ pinned.label }}
60
+ </button>
61
+ <template v-for="item in leftItems" :key="item.key">
62
+ <button
63
+ v-if="item.command"
64
+ type="button"
65
+ class="plugin-status-item clickable"
66
+ :class="`tone-${item.tone ?? 'default'}`"
67
+ :data-tooltip="item.tooltip || item.pluginName"
68
+ :title="item.tooltip || item.pluginName"
69
+ @click="trigger(item)"
70
+ >
71
+ {{ item.text }}
72
+ </button>
73
+ <span
74
+ v-else
75
+ class="plugin-status-item"
76
+ :class="`tone-${item.tone ?? 'default'}`"
77
+ :data-tooltip="item.tooltip || item.pluginName"
78
+ :title="item.tooltip || item.pluginName"
79
+ >
80
+ {{ item.text }}
81
+ </span>
82
+ </template>
83
+ </div>
84
+ <div class="plugin-status-group plugin-status-right">
85
+ <template v-for="item in rightItems" :key="item.key">
86
+ <button
87
+ v-if="item.command"
88
+ type="button"
89
+ class="plugin-status-item clickable"
90
+ :class="`tone-${item.tone ?? 'default'}`"
91
+ :data-tooltip="item.tooltip || item.pluginName"
92
+ :title="item.tooltip || item.pluginName"
93
+ @click="trigger(item)"
94
+ >
95
+ {{ item.text }}
96
+ </button>
97
+ <span
98
+ v-else
99
+ class="plugin-status-item"
100
+ :class="`tone-${item.tone ?? 'default'}`"
101
+ :data-tooltip="item.tooltip || item.pluginName"
102
+ :title="item.tooltip || item.pluginName"
103
+ >
104
+ {{ item.text }}
105
+ </span>
106
+ </template>
107
+ </div>
108
+ </footer>
109
+ </template>
110
+
111
+ <style scoped>
112
+ .plugin-status-bar {
113
+ flex: 0 0 auto;
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: space-between;
117
+ gap: 12px;
118
+ min-height: 24px;
119
+ padding: 0 12px;
120
+ border-top: 1px solid var(--line);
121
+ background: var(--workbench-front, var(--paper));
122
+ color: var(--muted);
123
+ font-size: 11px;
124
+ user-select: none;
125
+ }
126
+ .plugin-status-group {
127
+ display: flex;
128
+ align-items: center;
129
+ gap: 6px;
130
+ min-width: 0;
131
+ overflow: hidden;
132
+ }
133
+ .plugin-status-item {
134
+ display: inline-flex;
135
+ align-items: center;
136
+ max-width: 240px;
137
+ overflow: hidden;
138
+ text-overflow: ellipsis;
139
+ white-space: nowrap;
140
+ padding: 2px 6px;
141
+ border-radius: 4px;
142
+ color: var(--muted);
143
+ line-height: 1.4;
144
+ }
145
+ .plugin-status-item.clickable {
146
+ cursor: pointer;
147
+ }
148
+ .plugin-status-item.clickable:hover {
149
+ background: var(--hover);
150
+ color: var(--text);
151
+ }
152
+ .plugin-status-item.tone-accent {
153
+ color: var(--green);
154
+ }
155
+ .plugin-status-item.tone-warning {
156
+ color: #b86b15;
157
+ }
158
+ .plugin-status-item.tone-danger {
159
+ color: var(--danger, #c4483d);
160
+ }
161
+ </style>
@@ -8,7 +8,7 @@ import PluginViewNode from './PluginViewNode.vue';
8
8
  import PluginCustomView from './PluginCustomView.vue';
9
9
 
10
10
  const props = defineProps<{ view: PluginWorkbenchView; workspaceId: string; runtime?: PluginRuntimeState;
11
- execute: (interaction: PluginInteraction) => Promise<void> }>();
11
+ execute: (interaction: PluginInteraction) => Promise<void>; compact?: boolean }>();
12
12
  const tree = computed(() => props.runtime?.views.find(view => view.id === props.view.id)?.tree);
13
13
  const custom = computed(() => props.runtime?.views.find(view => view.id === props.view.id)?.custom);
14
14
  const values = ref<Record<string, string>>({});
@@ -38,11 +38,20 @@ async function action(action: string) {
38
38
  }
39
39
  </script>
40
40
  <template>
41
- <section class="plugin-surface" :data-plugin="view.pluginId" :aria-label="`${view.pluginName} · ${view.label}`">
42
- <header><div><h2>{{ view.label }}</h2><span>{{ view.pluginName }}</span></div><span>{{ runtime ? { loading: t('加载中'), running: t('运行中'), blocked: t('等待授权或运行环境'), error: t('已停止') }[runtime.status] : t('未运行') }}</span></header>
41
+ <section
42
+ class="plugin-surface"
43
+ :class="{
44
+ 'plugin-surface-fill': view.layout === 'fill' && custom && runtime?.status === 'running',
45
+ 'plugin-surface-compact': compact,
46
+ }"
47
+ :data-plugin="view.pluginId"
48
+ :data-layout="view.layout ?? 'contained'"
49
+ :aria-label="`${view.pluginName} · ${view.label}`"
50
+ >
51
+ <header><div><h2>{{ view.label }}</h2><span>{{ view.pluginName }}</span></div><span>{{ runtime ? { idle: t('待唤醒'), loading: t('加载中'), running: t('运行中'), blocked: t('等待授权或运行环境'), error: t('已停止') }[runtime.status] : t('未运行') }}</span></header>
43
52
  <p v-if="error" role="alert">{{ error }}</p>
44
53
  <p v-if="runtime?.message" :role="runtime.status === 'error' ? 'alert' : 'status'">{{ runtime.message }}</p>
45
- <PluginCustomView v-if="custom && runtime?.status === 'running'" :bundle="custom.bundle" :state="custom.state" :workspace-id="workspaceId" :plugin-id="view.pluginId" :instance-id="runtime.instanceId" :view-id="view.id" :execute="execute" />
54
+ <PluginCustomView v-if="custom && runtime?.status === 'running'" :bundle="custom.bundle" :state="custom.state" :workspace-id="workspaceId" :plugin-id="view.pluginId" :instance-id="runtime.instanceId" :view-id="view.id" :fill="view.layout === 'fill'" :execute="execute" />
46
55
  <PluginViewNode v-else-if="tree" :node="tree" :values="values" :disabled="pending || runtime?.status !== 'running'"
47
56
  @input="(key, value) => values[key] = value" @action="action" />
48
57
  <p v-else class="empty">{{ runtime?.status === 'blocked' ? t('请在插件中心检查设备授权与运行环境。') : t('插件尚未提供此视图内容。') }}</p>
@@ -50,8 +59,11 @@ async function action(action: string) {
50
59
  </template>
51
60
  <style scoped>
52
61
  .plugin-surface { flex: 1; min-width: 0; min-height: 0; overflow: auto; padding: 20px; color: var(--text); font-size: 13px; }
53
- .plugin-surface[data-plugin="excalidraw"], .plugin-surface[data-plugin="presentation-preview"], .plugin-surface[data-plugin="word-preview"] { display: flex; flex-direction: column; height: 100%; padding: 0; overflow: hidden; }
54
- .plugin-surface[data-plugin="excalidraw"] > header, .plugin-surface[data-plugin="presentation-preview"] > header, .plugin-surface[data-plugin="word-preview"] > header { display: none; }
62
+ .plugin-surface-compact { flex: 0 0 auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface, var(--paper)); }
63
+ .plugin-surface-compact > header { margin-bottom: 8px; }
64
+ .plugin-surface-compact h2 { font-size: 13px; font-weight: 600; margin: 0 0 2px; }
65
+ .plugin-surface-fill { display: flex; flex-direction: column; height: 100%; padding: 0; overflow: hidden; }
66
+ .plugin-surface-fill > header { display: none; }
55
67
  header { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
56
68
  h2 { font-size: 18px; margin: 0 0 4px; }
57
69
  header span, .empty { color: var(--muted); font-size: 12px; }