@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
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, ref, defineAsyncComponent, onMounted, onBeforeUnmount } from 'vue';
2
+ import { computed, inject, ref, defineAsyncComponent, onMounted, onBeforeUnmount } from 'vue';
3
3
  import {
4
4
  Settings,
5
5
  MoreHorizontal,
@@ -19,6 +19,7 @@ import { bundledPluginCatalog } from '../plugin-catalog';
19
19
  import { retiredSystemPlugin } from '../workspace-plugins';
20
20
  import { matchesPlugin, usePluginActions } from '../use-plugin-actions';
21
21
  import PluginIcon from './PluginIcon.vue';
22
+ import { workbenchPrefsKey } from '../../shell/workbench-context';
22
23
  import { useWindowContext } from '../../windows/context';
23
24
  const { window } = useWindowContext();
24
25
  const root = ref<HTMLElement>();
@@ -45,9 +46,11 @@ onBeforeUnmount(() => {
45
46
  window.removeEventListener('keydown', dismissMenus);
46
47
  });
47
48
  const PluginImportDialog = defineAsyncComponent(() => import('./PluginImportDialog.vue'));
49
+ const props = defineProps<{ developerMode?: boolean }>();
50
+ const workbench = inject(workbenchPrefsKey, null);
51
+ const isDeveloperMode = computed(() => props.developerMode ?? Boolean(workbench?.developerMode));
48
52
  const store = useWorkspaceStore();
49
53
  const query = ref(''),
50
- menu = ref(''),
51
54
  importing = ref(false);
52
55
  const installedOpen = ref(true),
53
56
  recommendedOpen = ref(!store.installedPlugins.length);
@@ -68,7 +71,6 @@ function closeMenu(event: Event) {
68
71
  }
69
72
  function openImport() {
70
73
  importing.value = true;
71
- menu.value = '';
72
74
  }
73
75
  </script>
74
76
  <template>
@@ -86,7 +88,7 @@ function openImport() {
86
88
  <MoreHorizontal :size="16" />
87
89
  </summary>
88
90
  <div class="dropdown compact-action-menu actions-menu" @click="closeMenu">
89
- <button @click="openImport"><Upload :size="14" />{{ t('导入插件…') }}</button
91
+ <button v-if="isDeveloperMode" @click="openImport"><Upload :size="14" />{{ t('导入插件…') }}</button
90
92
  ><button @click="store.openPluginsTab()">
91
93
  <Puzzle :size="14" />{{ t('插件中心…') }}
92
94
  </button>
@@ -104,7 +104,7 @@ async function importFile(event: Event) {
104
104
  const lowerName = typeof file.name === 'string' ? file.name.toLowerCase() : '';
105
105
  const isZip = lowerName.endsWith('.zip') || lowerName.endsWith('.tano-plugin');
106
106
  if (file.size > (isZip ? PLUGIN_ARCHIVE_V2_LIMIT : pluginPackageLimit)) {
107
- throw new Error(t('插件包不能超过 4 MiB'));
107
+ throw new Error(isZip ? t('插件归档包不能超过 16 MiB') : t('插件包不能超过 4 MiB'));
108
108
  }
109
109
  let content: string;
110
110
  let unpackedBinaryAssets: Record<string, Uint8Array> | undefined;
@@ -1,51 +1,72 @@
1
1
  <script setup lang="ts">
2
+ import './plugin-center.css';
2
3
  import { recordHelpCompleted } from '../../help/help-checklist';
3
4
  import { usePluginActions, matchesPlugin } from '../use-plugin-actions';
4
5
  import LoadingSkeleton from '../../shell/components/LoadingSkeleton.vue';
5
6
  import { retiredSystemPlugin } from '../workspace-plugins';
6
7
  import { t } from '../../i18n/i18n';
7
- import { computed, nextTick, ref, watch } from 'vue';
8
+ import { computed, inject, nextTick, ref, useSlots, watch } from 'vue';
8
9
  import {
9
10
  Check,
10
11
  ChevronDown,
11
- Download,
12
- LoaderCircle,
12
+ Code2,
13
13
  Package,
14
14
  Plus,
15
15
  Search,
16
- ShieldCheck,
17
- Upload,
18
16
  X,
19
17
  } from 'lucide-vue-next';
20
- import type { PluginManifest } from '@tano/protocol';
18
+ import type { PluginManifest, WorkspacePersonalPluginPolicy } from '@tano/protocol';
19
+ import { useWorkbenchRuntime } from '../../runtime';
20
+ import { workbenchPrefsKey } from '../../shell/workbench-context';
21
21
  import PluginRuntimePanel from './PluginRuntimePanel.vue';
22
-
23
- import PluginRepositoryStorage from './PluginRepositoryStorage.vue';
24
22
  import PluginCatalogBrowser from './PluginCatalogBrowser.vue';
25
23
  import PluginConnections from './PluginConnections.vue';
26
24
  import PluginAutomations from './PluginAutomations.vue';
27
25
  import PluginImportDialog from './PluginImportDialog.vue';
26
+ import PluginDeveloperArea from './PluginDeveloperArea.vue';
28
27
 
29
28
  import { useWorkspaceStore } from '../../stores/workspace';
30
29
 
31
30
  import PluginListItem from './PluginListItem.vue';
32
31
  import { bundledPluginCatalog, type PluginCatalogEntry } from '../plugin-catalog';
33
32
 
34
- const props = withDefaults(defineProps<{ catalog?: readonly PluginCatalogEntry[] }>(), {
35
- catalog: () => bundledPluginCatalog,
36
- });
33
+ const props = withDefaults(
34
+ defineProps<{
35
+ catalog?: readonly PluginCatalogEntry[];
36
+ developerMode?: boolean;
37
+ }>(),
38
+ {
39
+ catalog: () => bundledPluginCatalog,
40
+ developerMode: undefined,
41
+ },
42
+ );
43
+ const slots = useSlots();
44
+ const workbench = inject(workbenchPrefsKey, null);
45
+ const runtime = useWorkbenchRuntime();
37
46
  const store = useWorkspaceStore();
38
47
  const { error, status, pending, busy, change, installFromCatalog } = usePluginActions(undefined, () => props.catalog);
39
- defineExpose({ openImport });
40
- const emit = defineEmits<{ createObject: [type: string]; feedback: [status: string, error: string] }>();
48
+ const emit = defineEmits<{
49
+ createObject: [type: string];
50
+ feedback: [status: string, error: string];
51
+ enableDeveloperMode: [];
52
+ }>();
53
+
54
+ const localDeveloperMode = ref(false);
55
+ const isDeveloperMode = computed(
56
+ () => props.developerMode ?? (workbench ? Boolean(workbench.developerMode) : localDeveloperMode.value),
57
+ );
58
+ const communityAvailable = computed(() => Boolean(store.pluginCatalogSource));
59
+ const automationsAvailable = computed(() => Boolean(runtime.plugins?.automations));
41
60
  const pluginObjectTypes = computed(() =>
42
61
  store.objectDefinitions.filter((type) => type.category === 'plugin' && type.storage === 'record'),
43
62
  );
44
63
  watch([status, error], ([message, failure]) => emit('feedback', message, failure));
64
+
45
65
  const search = ref<HTMLInputElement>();
46
- type View = 'discover' | 'installed' | 'community' | 'forge' | 'publishing';
66
+ type View = 'discover' | 'installed' | 'community' | 'customize' | 'developer';
47
67
  const view = ref<View>('discover');
48
- const publishingOpened = ref(false);
68
+ const developerOpened = ref(false);
69
+ const developerSection = ref<'tools' | 'forge' | 'publishing'>('tools');
49
70
  const query = ref('');
50
71
  const category = ref('all');
51
72
  const installedFilter = ref('all');
@@ -104,14 +125,46 @@ const resultsTitle = computed(() =>
104
125
  watch([view, query, category, installedFilter, () => props.catalog], () => {
105
126
  visibleLimit.value = pageSize;
106
127
  });
128
+ watch(isDeveloperMode, (enabled) => {
129
+ if (!enabled) {
130
+ developerOpened.value = false;
131
+ if (view.value === 'developer') view.value = 'discover';
132
+ }
133
+ });
134
+ watch(communityAvailable, (available) => {
135
+ if (!available && view.value === 'community') {
136
+ view.value = 'discover';
137
+ }
138
+ });
107
139
 
108
140
  function chooseView(value: View) {
109
- if (value === 'publishing') publishingOpened.value = true;
141
+ if (value === 'community' && !communityAvailable.value) return;
142
+ if (value === 'customize' && !slots.customize) return;
143
+ if (value === 'developer' && !isDeveloperMode.value) return;
144
+ if (value === 'developer') developerOpened.value = true;
110
145
  view.value = value;
111
146
  query.value = '';
112
147
  category.value = 'all';
113
148
  installedFilter.value = 'all';
114
149
  }
150
+ function enableDeveloperArea() {
151
+ if (workbench) {
152
+ workbench.developerMode = true;
153
+ } else {
154
+ localDeveloperMode.value = true;
155
+ }
156
+ emit('enableDeveloperMode');
157
+ nextTick(() => {
158
+ if (isDeveloperMode.value) {
159
+ developerSection.value = 'tools';
160
+ chooseView('developer');
161
+ }
162
+ });
163
+ }
164
+ function updatePersonalPolicy(value: WorkspacePersonalPluginPolicy) {
165
+ if (!store.workspace) return;
166
+ void change({ personalCodePlugins: value });
167
+ }
115
168
  function clearFilters() {
116
169
  query.value = '';
117
170
  category.value = 'all';
@@ -122,16 +175,21 @@ function browse() {
122
175
  chooseView('discover');
123
176
  nextTick(() => search.value?.focus());
124
177
  }
125
- function showDetails(plugin: PluginManifest) { recordHelpCompleted('plugins', 'plugin-details'); void store.openPluginDetail(plugin.id); }
178
+ function showDetails(plugin: PluginManifest) {
179
+ recordHelpCompleted('plugins', 'plugin-details');
180
+ void store.openPluginDetail(plugin.id);
181
+ }
126
182
  function openImport() {
127
183
  error.value = '';
128
184
  status.value = '';
129
185
  importing.value = true;
130
186
  }
187
+ defineExpose({ openImport });
131
188
  watch(
132
189
  () => store.workspace?.id,
133
190
  () => {
134
191
  importing.value = false;
192
+ developerOpened.value = false;
135
193
  error.value = '';
136
194
  status.value = '';
137
195
  chooseView('discover');
@@ -143,176 +201,209 @@ watch(
143
201
  <div class="plugin-center">
144
202
  <LoadingSkeleton v-if="store.workspaceLoading?.plugins" :rows="6" />
145
203
  <div v-show="!store.workspaceLoading?.plugins" class="component-loading-content">
146
- <div class="catalog-controls">
147
- <header class="center-heading">
148
- <div class="center-title">
149
- <h1>{{ t('插件') }}</h1>
150
- <p>{{ t('发现、安装和管理你的同页扩展。') }}</p>
151
- </div>
152
- <div class="heading-actions">
153
- <label v-if="view === 'discover' || view === 'installed'" class="plugin-search"
154
- ><Search :size="15" aria-hidden="true" />
155
- <input
156
- ref="search"
157
- v-model="query"
158
- type="search"
159
- :aria-label="t('查找插件')"
160
- :placeholder="view === 'discover' ? t('搜索插件') : t('搜索已安装插件')"
161
- />
204
+ <div class="catalog-controls">
205
+ <header class="center-heading">
206
+ <div class="center-title">
207
+ <h1>{{ t('插件') }}</h1>
208
+ <p>{{ t('发现、安装和管理你的同页扩展。') }}</p>
209
+ </div>
210
+ <div class="heading-actions">
211
+ <label v-if="view === 'discover' || view === 'installed'" class="plugin-search"
212
+ ><Search :size="15" aria-hidden="true" />
213
+ <input
214
+ ref="search"
215
+ v-model="query"
216
+ type="search"
217
+ :aria-label="t('查找插件')"
218
+ :placeholder="view === 'discover' ? t('搜索插件') : t('搜索已安装插件')"
219
+ />
220
+ <button
221
+ v-if="query"
222
+ :aria-label="t('清空搜索')"
223
+ @click="
224
+ query = '';
225
+ search?.focus();
226
+ "
227
+ >
228
+ <X :size="14" />
229
+ </button>
230
+ </label>
231
+ </div>
232
+ </header>
233
+ <div class="catalog-navigation">
234
+ <nav class="center-nav" :aria-label="t('插件中心导航')">
235
+ <button
236
+ :class="{ active: view === 'discover' }"
237
+ :aria-pressed="view === 'discover'"
238
+ @click="chooseView('discover')"
239
+ >
240
+ {{ t('发现') }}
241
+ </button>
242
+ <button
243
+ v-if="communityAvailable"
244
+ :class="{ active: view === 'community' }"
245
+ :aria-pressed="view === 'community'"
246
+ @click="chooseView('community')"
247
+ >
248
+ {{ t('社区目录') }}
249
+ </button>
162
250
  <button
163
- v-if="query"
164
- :aria-label="t('清空搜索')"
165
- @click="
166
- query = '';
167
- search?.focus();
168
- "
251
+ :class="{ active: view === 'installed' }"
252
+ :aria-pressed="view === 'installed'"
253
+ @click="chooseView('installed')"
169
254
  >
170
- <X :size="14" />
255
+ {{ t('已安装') }} <span class="nav-count">{{ store.installedPlugins.length }}</span>
171
256
  </button>
257
+ <button
258
+ v-if="$slots.customize"
259
+ :class="{ active: view === 'customize' }"
260
+ :aria-pressed="view === 'customize'"
261
+ @click="chooseView('customize')"
262
+ >
263
+ {{ t('工作台微调') }}
264
+ </button>
265
+ <button
266
+ v-if="isDeveloperMode"
267
+ :class="{ active: view === 'developer' }"
268
+ :aria-pressed="view === 'developer'"
269
+ @click="chooseView('developer')"
270
+ >
271
+ <Code2 :size="14" aria-hidden="true" />{{ t('开发者') }}
272
+ </button>
273
+ </nav>
274
+ <label v-if="view === 'discover' || view === 'installed'" class="catalog-filter">
275
+ <select v-if="view === 'discover'" v-model="category" :aria-label="t('插件分类')">
276
+ <option value="all">{{ t('全部分类') }}</option>
277
+ <option v-for="group in categories" :key="group.id" :value="group.id">
278
+ {{ group.label }} · {{ group.count }}
279
+ </option>
280
+ </select>
281
+ <select v-else v-model="installedFilter" :aria-label="t('安装状态')">
282
+ <option value="all">{{ t('全部状态') }}</option>
283
+ <option value="enabled">{{ t('已启用') }}</option>
284
+ <option value="disabled">{{ t('已停用') }}</option>
285
+ </select>
286
+ <ChevronDown :size="13" aria-hidden="true" />
172
287
  </label>
173
- <button v-if="view === 'community' && $slots.publishing" class="pc-button pc-primary" @click="chooseView('publishing')">
174
- <Upload :size="15" />{{ t('发布插件') }}
175
- </button>
176
- <button v-if="view !== 'publishing'" class="pc-button pc-add" :aria-label="t('导入插件')" @click="openImport">
177
- <Upload :size="15" />{{ t('导入') }}
178
- </button>
179
288
  </div>
180
- </header>
181
- <div class="catalog-navigation">
182
- <nav class="center-nav" :aria-label="t('插件中心导航')">
183
- <button :class="{ active: view === 'community' }" :aria-pressed="view === 'community'" @click="chooseView('community')">{{ t('社区目录') }}</button>
184
- <button
185
- :class="{ active: view === 'discover' }"
186
- :aria-pressed="view === 'discover'"
187
- @click="chooseView('discover')"
188
- >
189
- {{ t('发现') }}
190
- </button>
191
- <button
192
- :class="{ active: view === 'installed' }"
193
- :aria-pressed="view === 'installed'"
194
- @click="chooseView('installed')"
195
- >
196
- {{ t('已安装') }} <span class="nav-count">{{ store.installedPlugins.length }}</span>
197
- </button>
198
- <button
199
- v-if="$slots.forge"
200
- :class="{ active: view === 'forge' }"
201
- :aria-pressed="view === 'forge'"
202
- @click="chooseView('forge')"
203
- >
204
- {{ t('工坊与微调') }}
205
- </button>
206
- <button v-if="$slots.publishing" :class="{ active: view === 'publishing' }" :aria-pressed="view === 'publishing'" @click="chooseView('publishing')">{{ t('我的投稿') }}</button>
207
- </nav>
208
- <label v-if="view === 'discover' || view === 'installed'" class="catalog-filter">
209
- <select v-if="view === 'discover'" v-model="category" :aria-label="t('插件分类')">
210
- <option value="all">{{ t('全部分类') }}</option>
211
- <option v-for="group in categories" :key="group.id" :value="group.id">
212
- {{ group.label }} · {{ group.count }}
213
- </option>
214
- </select>
215
- <select v-else v-model="installedFilter" :aria-label="t('安装状态')">
216
- <option value="all">{{ t('全部状态') }}</option>
217
- <option value="enabled">{{ t('已启用') }}</option>
218
- <option value="disabled">{{ t('已停用') }}</option>
219
- </select>
220
- <ChevronDown :size="13" aria-hidden="true" />
221
- </label>
222
289
  </div>
223
- </div>
224
-
225
- <template v-if="!importing && view !== 'publishing'">
226
- <p v-if="feedbackError" class="pc-feedback error" role="alert">{{ feedbackError }}</p>
227
- <p v-if="status" class="pc-feedback success" role="status">
228
- <Check :size="15" />{{ status }}
229
- </p>
230
- </template>
231
290
 
232
- <PluginCatalogBrowser v-if="view === 'community'" />
233
- <slot
234
- v-else-if="view === 'forge' && $slots.forge"
235
- name="forge"
236
- :can-publish="!!$slots.publishing"
237
- :open-publishing="() => chooseView('publishing')"
238
- />
239
- <section v-else-if="view !== 'publishing'"
240
- class="catalog-results"
241
- :aria-label="view === 'discover' ? t('可安装插件') : t('已安装插件')"
242
- >
243
- <div class="catalog-heading">
244
- <h2>{{ resultsTitle }}</h2>
245
- <span class="result-count" role="status" :aria-label="t('{0} 款插件', [resultCount])">{{
246
- resultCount
247
- }}</span>
248
- </div>
249
- <div v-if="visiblePlugins.length" class="plugin-list">
250
- <PluginListItem
251
- v-for="plugin in visiblePlugins"
252
- :key="plugin.id"
253
- :plugin="plugin"
254
- :installed="installedById.has(plugin.id)"
255
- :enabled="installedById.get(plugin.id)?.enabled"
256
- :scope="installedById.get(plugin.id)?.scope"
257
- :show-state="view === 'installed'"
258
- :busy="busy || !store.canManagePlugins"
259
- :pending="pending === plugin.id"
260
- @details="showDetails(plugin)"
261
- @install="installFromCatalog(plugin)"
262
- />
263
- </div>
264
- <div v-else-if="view === 'installed' && !store.installedPlugins.length" class="pc-empty">
265
- <Package :size="28" :stroke-width="1.4" />
266
- <h3>{{ t('还没有安装插件') }}</h3>
267
- <p>{{ t('去发现适合你的插件,或导入自己的插件。') }}</p>
268
- <button class="pc-button pc-secondary" @click="browse">{{ t('浏览插件') }}</button>
269
- </div>
270
- <div v-else class="pc-empty">
271
- <Search :size="28" :stroke-width="1.4" />
272
- <h3>{{ t('没有找到匹配的插件') }}</h3>
273
- <p>{{ t('试试其他关键词,或调整筛选条件。') }}</p>
274
- <button class="pc-button pc-secondary" @click="clearFilters">{{ t('重置筛选') }}</button>
275
- </div>
276
- <div v-if="remaining" class="catalog-more">
277
- <button class="pc-button pc-secondary" @click="visibleLimit += pageSize">
278
- {{ t('显示更多') }} <ChevronDown :size="14" /></button
279
- ><span>{{ t('已显示') }} {{ visiblePlugins.length }} / {{ resultCount }}</span>
280
- </div>
281
- <p v-if="view === 'installed' && visiblePlugins.length" class="installed-note">
282
- {{ t('工作区插件与共享设置跟随工作区;全局插件、个人启用和代码授权保存在此设备,跨工作区生效。卸载后保留已有内容。') }}
283
- </p>
284
- </section>
291
+ <template v-if="!importing && view !== 'developer'">
292
+ <p v-if="feedbackError" class="pc-feedback error" role="alert">{{ feedbackError }}</p>
293
+ <p v-if="status" class="pc-feedback success" role="status">
294
+ <Check :size="15" />{{ status }}
295
+ </p>
296
+ </template>
285
297
 
286
- <div v-if="publishingOpened && $slots.publishing" v-show="view === 'publishing'">
287
- <slot name="publishing" />
288
- </div>
289
- <template v-if="view !== 'publishing'">
290
- <PluginRuntimePanel />
291
- <PluginConnections />
292
- <PluginAutomations />
293
- <PluginRepositoryStorage />
294
- </template>
295
- <footer v-if="view !== 'publishing'" class="center-footer">
296
- <span>{{ store.pluginCatalogSource ? t('社区目录已接入 · 版本由工作区管理员选择') : t('当前提供内置插件与文件导入 · 社区目录尚未配置') }}</span>
297
- <button
298
- v-if="pluginObjectTypes.length"
299
- :disabled="!store.workspace || store.workspace.readOnly || !store.capabilities.features.objectReferences"
300
- @click="emit('createObject', pluginObjectTypes[0]!.type)"
298
+ <PluginDeveloperArea
299
+ v-if="developerOpened && isDeveloperMode"
300
+ v-show="view === 'developer'"
301
+ :can-publish="!!$slots.publishing"
302
+ :initial-section="developerSection"
303
+ @open-import="openImport"
304
+ >
305
+ <template v-if="$slots.forge" #forge="slotProps">
306
+ <slot name="forge" v-bind="slotProps" />
307
+ </template>
308
+ <template v-if="$slots.publishing" #publishing="slotProps">
309
+ <slot name="publishing" v-bind="slotProps" />
310
+ </template>
311
+ </PluginDeveloperArea>
312
+ <PluginCatalogBrowser v-if="view === 'community' && communityAvailable" />
313
+ <slot v-else-if="view === 'customize' && $slots.customize" name="customize" :developer-mode="isDeveloperMode" />
314
+ <section
315
+ v-else-if="view === 'discover' || view === 'installed'"
316
+ class="catalog-results"
317
+ :aria-label="view === 'discover' ? t('可安装插件') : t('已安装插件')"
301
318
  >
302
- <Plus :size="13" />{{ t('新建插件对象') }}
303
- </button>
304
- </footer>
305
- <PluginImportDialog
306
- v-if="importing"
307
- @close="importing = false"
308
- @installed="chooseView('installed')"
309
- @feedback="(message, failure) => { status = message; error = failure; }"
310
- />
319
+ <div class="catalog-heading">
320
+ <h2>{{ resultsTitle }}</h2>
321
+ <span class="result-count" role="status" :aria-label="t('{0} 款插件', [resultCount])">{{
322
+ resultCount
323
+ }}</span>
324
+ </div>
325
+ <div v-if="visiblePlugins.length" class="plugin-list">
326
+ <PluginListItem
327
+ v-for="plugin in visiblePlugins"
328
+ :key="plugin.id"
329
+ :plugin="plugin"
330
+ :installed="installedById.has(plugin.id)"
331
+ :enabled="installedById.get(plugin.id)?.enabled"
332
+ :scope="installedById.get(plugin.id)?.scope"
333
+ :show-state="view === 'installed'"
334
+ :busy="busy || !store.canManagePlugins"
335
+ :pending="pending === plugin.id"
336
+ @details="showDetails(plugin)"
337
+ @install="installFromCatalog(plugin)"
338
+ />
339
+ </div>
340
+ <div v-else-if="view === 'installed' && !store.installedPlugins.length" class="pc-empty">
341
+ <Package :size="28" :stroke-width="1.4" />
342
+ <h3>{{ t('还没有安装插件') }}</h3>
343
+ <p>{{ t('去发现适合你的插件,扩展你的工作台能力。') }}</p>
344
+ <button class="pc-button pc-secondary" @click="browse">{{ t('浏览插件') }}</button>
345
+ </div>
346
+ <div v-else class="pc-empty">
347
+ <Search :size="28" :stroke-width="1.4" />
348
+ <h3>{{ t('没有找到匹配的插件') }}</h3>
349
+ <p>{{ t('试试其他关键词,或调整筛选条件。') }}</p>
350
+ <button class="pc-button pc-secondary" @click="clearFilters">{{ t('重置筛选') }}</button>
351
+ </div>
352
+ <div v-if="remaining" class="catalog-more">
353
+ <button class="pc-button pc-secondary" @click="visibleLimit += pageSize">
354
+ {{ t('显示更多') }} <ChevronDown :size="14" /></button
355
+ ><span>{{ t('已显示') }} {{ visiblePlugins.length }} / {{ resultCount }}</span>
356
+ </div>
357
+
358
+ <template v-if="view === 'installed'">
359
+ <p v-if="visiblePlugins.length" class="installed-note">
360
+ {{ t('工作区插件与共享设置跟随工作区;全局插件、个人启用和代码授权保存在此设备,跨工作区生效。卸载后保留已有内容。') }}
361
+ </p>
362
+ <div v-if="store.canManagePlugins && store.workspace" class="workspace-plugin-policy">
363
+ <label>
364
+ <span>{{ t('本工作区对个人代码插件的策略') }}</span>
365
+ <select
366
+ :value="store.personalCodePluginPolicy"
367
+ :disabled="busy"
368
+ :aria-label="t('本工作区对个人代码插件的策略')"
369
+ @change="updatePersonalPolicy(($event.target as HTMLSelectElement).value as WorkspacePersonalPluginPolicy)"
370
+ >
371
+ <option value="allow">{{ t('允许运行(遵循个人授权)') }}</option>
372
+ <option value="read-only">{{ t('仅允许只读访问(禁止写入)') }}</option>
373
+ <option value="block">{{ t('禁止个人代码插件访问本工作区') }}</option>
374
+ </select>
375
+ </label>
376
+ </div>
377
+ <PluginRuntimePanel v-if="store.pluginRuntime.length" />
378
+ <PluginConnections v-if="store.pluginConnectionStorageLabel" />
379
+ <PluginAutomations v-if="automationsAvailable" />
380
+ </template>
381
+ </section>
382
+
383
+ <footer v-if="view !== 'developer' && view !== 'customize'" class="center-footer">
384
+ <span v-if="communityAvailable">{{ t('社区目录已接入 · 版本由工作区管理员选择') }}</span>
385
+ <button
386
+ v-if="!isDeveloperMode"
387
+ type="button"
388
+ class="dev-optin-link"
389
+ @click="enableDeveloperArea"
390
+ >
391
+ <Code2 :size="13" aria-hidden="true" />{{ t('开启开发者模式以导入或开发插件') }}
392
+ </button>
393
+ <button
394
+ v-if="pluginObjectTypes.length"
395
+ :disabled="!store.workspace || store.workspace.readOnly || !store.capabilities.features.objectReferences"
396
+ @click="emit('createObject', pluginObjectTypes[0]!.type)"
397
+ >
398
+ <Plus :size="13" />{{ t('新建插件对象') }}
399
+ </button>
400
+ </footer>
401
+ <PluginImportDialog
402
+ v-if="importing"
403
+ @close="importing = false"
404
+ @installed="chooseView('installed')"
405
+ @feedback="(message, failure) => { status = message; error = failure; }"
406
+ />
311
407
  </div>
312
408
  </div>
313
409
  </template>
314
-
315
- <style scoped src="./plugin-center.css"></style>
316
-
317
- <style scoped>
318
- </style>