@tano.page/workbench 0.14.0 → 0.15.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 (177) hide show
  1. package/package.json +21 -8
  2. package/src/App.vue +76 -17
  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/components/AssistantChangeList.vue +98 -21
  17. package/src/assistant/components/AssistantPanel.vue +424 -7
  18. package/src/assistant/components/PluginToolProposalCard.vue +235 -0
  19. package/src/assistant/engine.ts +56 -3
  20. package/src/assistant/files.ts +5 -13
  21. package/src/assistant/inbox.ts +1 -148
  22. package/src/assistant/locales/de-DE.json +4 -1
  23. package/src/assistant/locales/en-US.json +4 -1
  24. package/src/assistant/locales/es-ES.json +4 -1
  25. package/src/assistant/locales/ja-JP.json +4 -1
  26. package/src/assistant/locales/zh-CN.json +4 -1
  27. package/src/assistant/locales/zh-TW.json +4 -1
  28. package/src/assistant/mention-autocomplete.ts +69 -0
  29. package/src/assistant/prompts.ts +7 -0
  30. package/src/assistant/results.ts +20 -86
  31. package/src/assistant/store.ts +319 -12
  32. package/src/assistant/structures.ts +7 -5
  33. package/src/assistant/tasks.ts +3 -5
  34. package/src/assistant/workspace-bridge.ts +1 -1
  35. package/src/composables/use-document-actions.ts +38 -20
  36. package/src/composables/use-file-tree-controller.ts +7 -12
  37. package/src/composables/use-workbench-history.ts +2 -4
  38. package/src/composables/use-workbench-modals.ts +6 -1
  39. package/src/composables/use-workbench-outline.ts +0 -5
  40. package/src/composables/use-workbench-shortcuts.ts +26 -22
  41. package/src/data-tables/data-tables.ts +1 -2
  42. package/src/documents/components/DocumentHistoryPanel.vue +3 -1
  43. package/src/features.ts +1 -0
  44. package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
  45. package/src/fonts/Inter-Latin.woff2 +0 -0
  46. package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
  47. package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
  48. package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
  49. package/src/help/help-milestones.ts +3 -5
  50. package/src/i18n/locales/de-DE.json +349 -3
  51. package/src/i18n/locales/en-US.json +349 -2
  52. package/src/i18n/locales/es-ES.json +349 -3
  53. package/src/i18n/locales/ja-JP.json +348 -2
  54. package/src/i18n/locales/zh-TW.json +348 -2
  55. package/src/mail/components/MailAccountDialog.vue +449 -0
  56. package/src/mail/components/MailComposerDialog.vue +325 -0
  57. package/src/mail/components/MailProviderIcon.vue +30 -0
  58. package/src/mail/components/MailWorkspaceView.vue +820 -0
  59. package/src/mail/components/SidebarMail.vue +133 -0
  60. package/src/mail/mail-avatar.ts +17 -0
  61. package/src/mail/mail-bridge.ts +68 -0
  62. package/src/mail/mail-calendar.ts +208 -0
  63. package/src/mail/mail-markdown.ts +195 -0
  64. package/src/mail/types.ts +226 -0
  65. package/src/objects/components/ObjectDetailModal.vue +1001 -0
  66. package/src/objects/workspace-objects.ts +1 -1
  67. package/src/plan-sync/types.ts +6 -3
  68. package/src/plans/calendar-interaction.ts +194 -0
  69. package/src/plans/calendar.ts +63 -7
  70. package/src/plans/components/CalendarDayPopover.vue +172 -39
  71. package/src/plans/components/CalendarView.vue +1736 -276
  72. package/src/plans/components/PlanArchiveDialog.vue +295 -0
  73. package/src/plans/components/PlanDateField.vue +6 -4
  74. package/src/plans/components/PlanDetailPanel.vue +227 -32
  75. package/src/plans/components/PlanEventList.vue +16 -4
  76. package/src/plans/components/SidebarPlan.vue +22 -15
  77. package/src/plans/components/TaskRepeatControls.vue +169 -30
  78. package/src/plans/local-reminders.ts +149 -0
  79. package/src/plans/personal-plans.ts +10 -1
  80. package/src/plans/plan-date.ts +8 -1
  81. package/src/plans/plan-migration.ts +95 -0
  82. package/src/plans/recurrence.ts +95 -0
  83. package/src/plans/task-repeat.ts +8 -8
  84. package/src/plans/timeline-layout.ts +92 -0
  85. package/src/plugins/assistant-bridge.ts +520 -0
  86. package/src/plugins/attachment-reader.ts +3 -1
  87. package/src/plugins/cache-storage.ts +42 -2
  88. package/src/plugins/components/PluginAutomations.vue +3 -3
  89. package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
  90. package/src/plugins/components/PluginChangeSummary.vue +16 -3
  91. package/src/plugins/components/PluginConnections.vue +1 -1
  92. package/src/plugins/components/PluginCustomView.vue +2 -2
  93. package/src/plugins/components/PluginDetailPage.vue +129 -54
  94. package/src/plugins/components/PluginDocumentSlot.vue +63 -0
  95. package/src/plugins/components/PluginExplorer.vue +15 -21
  96. package/src/plugins/components/PluginImportDialog.vue +410 -0
  97. package/src/plugins/components/PluginInstaller.vue +39 -145
  98. package/src/plugins/components/PluginListItem.vue +3 -0
  99. package/src/plugins/components/PluginMaintenance.vue +21 -6
  100. package/src/plugins/components/PluginRuntimePanel.vue +3 -3
  101. package/src/plugins/components/PluginSettingsForm.vue +111 -0
  102. package/src/plugins/components/PluginStatusBar.vue +161 -0
  103. package/src/plugins/components/PluginSurface.vue +18 -6
  104. package/src/plugins/components/PluginUiDialog.vue +452 -0
  105. package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
  106. package/src/plugins/excalidraw/manifest.json +12 -1
  107. package/src/plugins/host.ts +662 -43
  108. package/src/plugins/native.ts +2 -10
  109. package/src/plugins/overlay-mapping.ts +125 -0
  110. package/src/plugins/packages.ts +73 -1
  111. package/src/plugins/plugin-permissions.ts +57 -0
  112. package/src/plugins/plugin-sdk.ts +174 -8
  113. package/src/plugins/policy.ts +53 -3
  114. package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
  115. package/src/plugins/presentation-preview/manifest.json +2 -1
  116. package/src/plugins/queries.ts +3 -1
  117. package/src/plugins/sandbox.ts +15 -1
  118. package/src/plugins/use-plugin-actions.ts +67 -20
  119. package/src/plugins/user-plugins.ts +254 -0
  120. package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
  121. package/src/plugins/word-preview/manifest.json +13 -1
  122. package/src/plugins/workbench.ts +175 -2
  123. package/src/plugins/worker.js +105 -8
  124. package/src/plugins/workspace-plugin-runtime.ts +23 -7
  125. package/src/plugins/workspace-plugins.ts +212 -21
  126. package/src/runtime.ts +101 -3
  127. package/src/settings/components/SettingsAppearancePage.vue +46 -0
  128. package/src/settings/components/SettingsDocumentsPage.vue +0 -1
  129. package/src/settings/components/settings-search.ts +2 -3
  130. package/src/shell/components/SidebarNavigation.vue +22 -2
  131. package/src/shell/components/WorkbenchContextMenus.vue +21 -8
  132. package/src/shell/components/WorkbenchModals.vue +27 -46
  133. package/src/shell/components/WorkbenchPanes.vue +267 -84
  134. package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
  135. package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
  136. package/src/shell/use-workbench.ts +116 -145
  137. package/src/shell/workbench-async-components.ts +14 -5
  138. package/src/stores/mail.ts +414 -0
  139. package/src/stores/plan-sync.ts +2 -1
  140. package/src/stores/plans.ts +2 -9
  141. package/src/stores/workspace-knowledge.ts +1 -113
  142. package/src/stores/workspace-plugins-state.ts +537 -14
  143. package/src/stores/workspace-tabs-layout.ts +5 -43
  144. package/src/stores/workspace.ts +69 -66
  145. package/src/styles/agent-diff-modals.css +0 -7
  146. package/src/styles/dark-theme.css +3 -3
  147. package/src/styles/inspector.css +0 -59
  148. package/src/styles/layout-themes.css +346 -0
  149. package/src/styles/mail.css +1568 -0
  150. package/src/styles/mobile.css +2 -2
  151. package/src/styles/recent-and-media.css +0 -17
  152. package/src/styles/theme-contract.css +3 -3
  153. package/src/styles/workbench-shell.css +110 -17
  154. package/src/styles/workspace-states.css +9 -33
  155. package/src/styles.css +1 -1
  156. package/src/tabs/components/DesktopTabs.vue +0 -3
  157. package/src/tabs/components/NewTabPicker.vue +10 -4
  158. package/src/tabs/tab-label.ts +0 -1
  159. package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
  160. package/src/workspace/components/WorkspaceIconPicker.vue +28 -6
  161. package/src/workspace/workspace-comments.ts +11 -151
  162. package/src/workspace/workspace-welcome.ts +1 -1
  163. package/src/documents/components/FormulaMenu.vue +0 -50
  164. package/src/files/components/FileDatabasePage.vue +0 -152
  165. package/src/files/components/FolderHomeIcon.vue +0 -12
  166. package/src/objects/components/ObjectDatabasePage.vue +0 -100
  167. package/src/objects/components/ObjectPanel.vue +0 -554
  168. package/src/plans/components/PersonalPlanDialog.vue +0 -105
  169. package/src/shell/components/WorkspaceViewPage.vue +0 -127
  170. package/src/shell/components/WorkspaceViewTab.vue +0 -24
  171. package/src/styles/object-panel.css +0 -163
  172. package/src/workspace/components/GitInspectionPanel.vue +0 -35
  173. package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
  174. package/src/workspace/welcome-slogans.ts +0 -11
  175. package/src/workspace/workspace-git.ts +0 -35
  176. package/src/workspace/workspace-sync.ts +0 -46
  177. 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,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { uiLocale, t } from '../../i18n/i18n';
3
3
  import { computed, ref, watch } from 'vue';
4
- import { pluginCacheLimit, pluginPackageLimit } from '@tano/protocol';
4
+ import { pluginCacheLimit, pluginPackageLimit, type WorkspacePersonalPluginPolicy } from '@tano/protocol';
5
5
  import PluginRepositoryStorage from './PluginRepositoryStorage.vue';
6
6
  import { useWorkspaceStore } from '../../stores/workspace';
7
7
  import { PluginPackageCache } from '../packages';
@@ -43,14 +43,29 @@ async function run(action: () => Promise<unknown>, message: string) {
43
43
  <template>
44
44
  <section class="plugin-maintenance" :aria-label="t('插件版本与维护')">
45
45
  <h4>{{ t('版本与维护') }}</h4>
46
- <p role="status">{{ t('当前设备:') }}{{ runtime ? { loading: t('加载中'), running: t('运行中'), blocked: t('等待授权或运行环境'), error: t('运行失败') }[runtime.status] : installation?.enabled ? t('尚未启动') : t('已停用') }}</p>
46
+ <p role="status">{{ t('当前设备:') }}{{ runtime ? { idle: t('待唤醒'), loading: t('加载中'), running: t('运行中'), blocked: t('等待授权或运行环境'), error: t('运行失败') }[runtime.status] : installation?.enabled ? t('尚未启动') : t('已停用') }}</p>
47
47
  <p v-if="runtime?.message" :role="runtime.status === 'error' ? 'alert' : 'status'">{{ runtime.message }}</p>
48
48
  <p v-if="error" role="alert">{{ error }}</p><p v-if="status" role="status">{{ status }}</p>
49
49
  <button :disabled="pending || !installation?.enabled" @click="run(() => store.restartPlugin(id, store.workspace!.id), t('已重新加载当前版本'))">{{ t('重新加载当前版本') }}</button>
50
+ <div v-if="store.canManagePlugins && store.workspace" class="personal-policy-control">
51
+ <label
52
+ >{{ t('本工作区对个人代码插件的策略') }}
53
+ <select
54
+ :value="store.personalCodePluginPolicy"
55
+ :disabled="pending"
56
+ :aria-label="t('本工作区对个人代码插件的策略')"
57
+ @change="run(() => store.changePlugin({ personalCodePlugins: ($event.target as HTMLSelectElement).value as WorkspacePersonalPluginPolicy }, store.workspace!.id), t('已更新工作区个人代码插件策略'))"
58
+ >
59
+ <option value="allow">{{ t('允许运行(遵循个人授权)') }}</option>
60
+ <option value="read-only">{{ t('仅允许只读访问(禁止写入)') }}</option>
61
+ <option value="block">{{ t('禁止个人代码插件访问本工作区') }}</option>
62
+ </select>
63
+ </label>
64
+ </div>
50
65
  <p>{{ t('单包上限') }} {{ size(pluginPackageLimit) }} {{ t('· 设备代码缓存') }} {{ size(used) }} / {{ size(pluginCacheLimit) }}</p>
51
66
  <p>{{ t('此插件本机状态') }} {{ size(state.used) }} / {{ size(state.limit) }}{{ t('。缓存清理不会删除工作区内容。') }}</p>
52
- <PluginRepositoryStorage :plugin-id="id" />
53
- <details>
67
+ <PluginRepositoryStorage v-if="installation?.scope !== 'user'" :plugin-id="id" />
68
+ <details v-if="installation?.scope !== 'user'">
54
69
  <summary>{{ t('开发模式') }}</summary>
55
70
  <p>{{ t('先安装并授权一个初始构建,然后运行:') }}</p>
56
71
  <pre>npm run plugin -- watch ./my-plugin --origin {{ appOrigin }}</pre>
@@ -63,7 +78,7 @@ async function run(action: () => Promise<unknown>, message: string) {
63
78
  <button v-if="store.pluginDevelopment.active" @click="store.stopPluginDevelopment()">{{ t('停止自动重载') }}</button>
64
79
  </template>
65
80
  </details>
66
- <details>
81
+ <details v-if="installation?.scope !== 'user'">
67
82
  <summary>{{ t('历史版本(') }}{{ installation?.rule?.history?.length ?? 0 }})</summary>
68
83
  <p>{{ t('保留最近 10 个版本引用。移除引用后,该版本不再受云端回收保护,日后恢复需重新导入。回滚沿用当前共享设置,运行前仍需核对并授权版本。') }}</p>
69
84
  <ul>
@@ -79,7 +94,7 @@ async function run(action: () => Promise<unknown>, message: string) {
79
94
  <details>
80
95
  <summary>{{ t('此插件的设备缓存(') }}{{ localEntries.length }})</summary>
81
96
  <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>
97
+ <button :disabled="pending || entry.integrity === installation?.rule?.integrity || store.userPluginIntegrities().has(entry.integrity)" @click="run(() => cache.remove(entry.integrity), t('已清理所选代码缓存'))">{{ t('清理缓存') }}</button>
83
98
  </li></ul>
84
99
  <p>{{ t('清理旧缓存后,回滚可能需要联网下载或重新导入对应包。') }}</p>
85
100
  </details>
@@ -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,111 @@
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
+ }>();
11
+ const emit = defineEmits<{ 'update:modelValue': [value: string] }>();
12
+
13
+ const parsed = computed<Record<string, unknown>>(() => {
14
+ try {
15
+ const raw = JSON.parse(props.modelValue || '{}');
16
+ if (raw && typeof raw === 'object' && !Array.isArray(raw))
17
+ return resolvePluginSettingsWithDefaults(raw as Record<string, unknown>, props.schema);
18
+ } catch {
19
+ /* Invalid manual JSON stays editable in the advanced textarea. */
20
+ }
21
+ return resolvePluginSettingsWithDefaults({}, props.schema);
22
+ });
23
+
24
+ function updateField(key: string, value: unknown) {
25
+ let base: Record<string, unknown> = {};
26
+ try {
27
+ const raw = JSON.parse(props.modelValue || '{}');
28
+ if (raw && typeof raw === 'object' && !Array.isArray(raw)) base = { ...(raw as Record<string, unknown>) };
29
+ } catch {
30
+ base = {};
31
+ }
32
+ base[key] = value;
33
+ emit('update:modelValue', JSON.stringify(base, null, 2));
34
+ }
35
+
36
+ function updateNumber(field: PluginSettingField, raw: string) {
37
+ if (!raw.trim()) {
38
+ updateField(field.key, field.default ?? undefined);
39
+ return;
40
+ }
41
+ const num = Number(raw);
42
+ if (Number.isFinite(num)) updateField(field.key, num);
43
+ }
44
+ </script>
45
+ <template>
46
+ <div class="plugin-settings-form">
47
+ <div v-for="field in schema" :key="field.key" class="setting-row">
48
+ <label v-if="field.type === 'boolean'" class="setting-checkbox">
49
+ <input
50
+ type="checkbox"
51
+ :checked="Boolean(parsed[field.key])"
52
+ :disabled="disabled"
53
+ @change="updateField(field.key, ($event.target as HTMLInputElement).checked)"
54
+ />
55
+ <span>{{ field.label }}</span>
56
+ </label>
57
+ <label v-else>
58
+ <span>{{ field.label }}<em v-if="field.required"> *</em></span>
59
+ <select
60
+ v-if="field.type === 'select'"
61
+ :value="String(parsed[field.key] ?? field.default ?? '')"
62
+ :disabled="disabled"
63
+ @change="updateField(field.key, ($event.target as HTMLSelectElement).value)"
64
+ >
65
+ <option v-for="opt in field.options" :key="opt.value" :value="opt.value">{{ opt.label }}</option>
66
+ </select>
67
+ <input
68
+ v-else-if="field.type === 'number'"
69
+ type="number"
70
+ :value="parsed[field.key] ?? ''"
71
+ :min="field.min"
72
+ :max="field.max"
73
+ :required="field.required"
74
+ :disabled="disabled"
75
+ @input="updateNumber(field, ($event.target as HTMLInputElement).value)"
76
+ />
77
+ <input
78
+ v-else
79
+ type="text"
80
+ :value="String(parsed[field.key] ?? '')"
81
+ :required="field.required"
82
+ :disabled="disabled"
83
+ @input="updateField(field.key, ($event.target as HTMLInputElement).value)"
84
+ />
85
+ </label>
86
+ <p v-if="field.description" class="setting-description">{{ field.description }}</p>
87
+ </div>
88
+ <details class="setting-raw">
89
+ <summary>{{ t('高级 JSON 视图') }}</summary>
90
+ <textarea
91
+ :value="modelValue"
92
+ :aria-label="t('插件设置 JSON')"
93
+ :disabled="disabled"
94
+ rows="4"
95
+ spellcheck="false"
96
+ @input="emit('update:modelValue', ($event.target as HTMLTextAreaElement).value)"
97
+ />
98
+ </details>
99
+ </div>
100
+ </template>
101
+ <style scoped>
102
+ .plugin-settings-form { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
103
+ .setting-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text); }
104
+ .setting-row .setting-checkbox { flex-direction: row; align-items: center; gap: 8px; }
105
+ .setting-row input[type="text"], .setting-row input[type="number"], .setting-row select {
106
+ padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--text); font: inherit;
107
+ }
108
+ .setting-description { margin: 3px 0 0; font-size: 11px; color: var(--muted); }
109
+ .setting-raw summary { cursor: pointer; font-size: 12px; color: var(--muted); margin: 4px 0; }
110
+ .setting-raw textarea { width: 100%; box-sizing: border-box; font-family: var(--font-mono, monospace); font-size: 12px; }
111
+ </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; }