@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.
- package/package.json +21 -8
- package/src/App.vue +76 -17
- package/src/appearance/appearance.ts +14 -4
- package/src/appearance/components/ThemePresetPreview.vue +52 -8
- package/src/appearance/interface-font.ts +99 -0
- package/src/appearance/theme.ts +26 -10
- package/src/appearance/use-interface-font.ts +30 -0
- package/src/assets/mail-provider-icons/NOTICE.txt +27 -0
- package/src/assets/mail-provider-icons/aliyun-mail.svg +3 -0
- package/src/assets/mail-provider-icons/gmail.svg +1 -0
- package/src/assets/mail-provider-icons/icloud.svg +12 -0
- package/src/assets/mail-provider-icons/netease-126.svg +5 -0
- package/src/assets/mail-provider-icons/netease-163.svg +5 -0
- package/src/assets/mail-provider-icons/qq.svg +9 -0
- package/src/assets/mail-provider-icons/tencent-exmail.svg +4 -0
- package/src/assistant/components/AssistantChangeList.vue +98 -21
- package/src/assistant/components/AssistantPanel.vue +424 -7
- package/src/assistant/components/PluginToolProposalCard.vue +235 -0
- package/src/assistant/engine.ts +56 -3
- package/src/assistant/files.ts +5 -13
- package/src/assistant/inbox.ts +1 -148
- package/src/assistant/locales/de-DE.json +4 -1
- package/src/assistant/locales/en-US.json +4 -1
- package/src/assistant/locales/es-ES.json +4 -1
- package/src/assistant/locales/ja-JP.json +4 -1
- package/src/assistant/locales/zh-CN.json +4 -1
- package/src/assistant/locales/zh-TW.json +4 -1
- package/src/assistant/mention-autocomplete.ts +69 -0
- package/src/assistant/prompts.ts +7 -0
- package/src/assistant/results.ts +20 -86
- package/src/assistant/store.ts +319 -12
- package/src/assistant/structures.ts +7 -5
- package/src/assistant/tasks.ts +3 -5
- package/src/assistant/workspace-bridge.ts +1 -1
- package/src/composables/use-document-actions.ts +38 -20
- package/src/composables/use-file-tree-controller.ts +7 -12
- package/src/composables/use-workbench-history.ts +2 -4
- package/src/composables/use-workbench-modals.ts +6 -1
- package/src/composables/use-workbench-outline.ts +0 -5
- package/src/composables/use-workbench-shortcuts.ts +26 -22
- package/src/data-tables/data-tables.ts +1 -2
- package/src/documents/components/DocumentHistoryPanel.vue +3 -1
- package/src/features.ts +1 -0
- package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
- package/src/fonts/Inter-Latin.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
- package/src/help/help-milestones.ts +3 -5
- package/src/i18n/locales/de-DE.json +349 -3
- package/src/i18n/locales/en-US.json +349 -2
- package/src/i18n/locales/es-ES.json +349 -3
- package/src/i18n/locales/ja-JP.json +348 -2
- package/src/i18n/locales/zh-TW.json +348 -2
- package/src/mail/components/MailAccountDialog.vue +449 -0
- package/src/mail/components/MailComposerDialog.vue +325 -0
- package/src/mail/components/MailProviderIcon.vue +30 -0
- package/src/mail/components/MailWorkspaceView.vue +820 -0
- package/src/mail/components/SidebarMail.vue +133 -0
- package/src/mail/mail-avatar.ts +17 -0
- package/src/mail/mail-bridge.ts +68 -0
- package/src/mail/mail-calendar.ts +208 -0
- package/src/mail/mail-markdown.ts +195 -0
- package/src/mail/types.ts +226 -0
- package/src/objects/components/ObjectDetailModal.vue +1001 -0
- package/src/objects/workspace-objects.ts +1 -1
- package/src/plan-sync/types.ts +6 -3
- package/src/plans/calendar-interaction.ts +194 -0
- package/src/plans/calendar.ts +63 -7
- package/src/plans/components/CalendarDayPopover.vue +172 -39
- package/src/plans/components/CalendarView.vue +1736 -276
- package/src/plans/components/PlanArchiveDialog.vue +295 -0
- package/src/plans/components/PlanDateField.vue +6 -4
- package/src/plans/components/PlanDetailPanel.vue +227 -32
- package/src/plans/components/PlanEventList.vue +16 -4
- package/src/plans/components/SidebarPlan.vue +22 -15
- package/src/plans/components/TaskRepeatControls.vue +169 -30
- package/src/plans/local-reminders.ts +149 -0
- package/src/plans/personal-plans.ts +10 -1
- package/src/plans/plan-date.ts +8 -1
- package/src/plans/plan-migration.ts +95 -0
- package/src/plans/recurrence.ts +95 -0
- package/src/plans/task-repeat.ts +8 -8
- package/src/plans/timeline-layout.ts +92 -0
- package/src/plugins/assistant-bridge.ts +520 -0
- package/src/plugins/attachment-reader.ts +3 -1
- package/src/plugins/cache-storage.ts +42 -2
- package/src/plugins/components/PluginAutomations.vue +3 -3
- package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
- package/src/plugins/components/PluginChangeSummary.vue +16 -3
- package/src/plugins/components/PluginConnections.vue +1 -1
- package/src/plugins/components/PluginCustomView.vue +2 -2
- package/src/plugins/components/PluginDetailPage.vue +129 -54
- package/src/plugins/components/PluginDocumentSlot.vue +63 -0
- package/src/plugins/components/PluginExplorer.vue +15 -21
- package/src/plugins/components/PluginImportDialog.vue +410 -0
- package/src/plugins/components/PluginInstaller.vue +39 -145
- package/src/plugins/components/PluginListItem.vue +3 -0
- package/src/plugins/components/PluginMaintenance.vue +21 -6
- package/src/plugins/components/PluginRuntimePanel.vue +3 -3
- package/src/plugins/components/PluginSettingsForm.vue +111 -0
- package/src/plugins/components/PluginStatusBar.vue +161 -0
- package/src/plugins/components/PluginSurface.vue +18 -6
- package/src/plugins/components/PluginUiDialog.vue +452 -0
- package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
- package/src/plugins/excalidraw/manifest.json +12 -1
- package/src/plugins/host.ts +662 -43
- package/src/plugins/native.ts +2 -10
- package/src/plugins/overlay-mapping.ts +125 -0
- package/src/plugins/packages.ts +73 -1
- package/src/plugins/plugin-permissions.ts +57 -0
- package/src/plugins/plugin-sdk.ts +174 -8
- package/src/plugins/policy.ts +53 -3
- package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/presentation-preview/manifest.json +2 -1
- package/src/plugins/queries.ts +3 -1
- package/src/plugins/sandbox.ts +15 -1
- package/src/plugins/use-plugin-actions.ts +67 -20
- package/src/plugins/user-plugins.ts +254 -0
- package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/word-preview/manifest.json +13 -1
- package/src/plugins/workbench.ts +175 -2
- package/src/plugins/worker.js +105 -8
- package/src/plugins/workspace-plugin-runtime.ts +23 -7
- package/src/plugins/workspace-plugins.ts +212 -21
- package/src/runtime.ts +101 -3
- package/src/settings/components/SettingsAppearancePage.vue +46 -0
- package/src/settings/components/SettingsDocumentsPage.vue +0 -1
- package/src/settings/components/settings-search.ts +2 -3
- package/src/shell/components/SidebarNavigation.vue +22 -2
- package/src/shell/components/WorkbenchContextMenus.vue +21 -8
- package/src/shell/components/WorkbenchModals.vue +27 -46
- package/src/shell/components/WorkbenchPanes.vue +267 -84
- package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
- package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
- package/src/shell/use-workbench.ts +116 -145
- package/src/shell/workbench-async-components.ts +14 -5
- package/src/stores/mail.ts +414 -0
- package/src/stores/plan-sync.ts +2 -1
- package/src/stores/plans.ts +2 -9
- package/src/stores/workspace-knowledge.ts +1 -113
- package/src/stores/workspace-plugins-state.ts +537 -14
- package/src/stores/workspace-tabs-layout.ts +5 -43
- package/src/stores/workspace.ts +69 -66
- package/src/styles/agent-diff-modals.css +0 -7
- package/src/styles/dark-theme.css +3 -3
- package/src/styles/inspector.css +0 -59
- package/src/styles/layout-themes.css +346 -0
- package/src/styles/mail.css +1568 -0
- package/src/styles/mobile.css +2 -2
- package/src/styles/recent-and-media.css +0 -17
- package/src/styles/theme-contract.css +3 -3
- package/src/styles/workbench-shell.css +110 -17
- package/src/styles/workspace-states.css +9 -33
- package/src/styles.css +1 -1
- package/src/tabs/components/DesktopTabs.vue +0 -3
- package/src/tabs/components/NewTabPicker.vue +10 -4
- package/src/tabs/tab-label.ts +0 -1
- package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
- package/src/workspace/components/WorkspaceIconPicker.vue +28 -6
- package/src/workspace/workspace-comments.ts +11 -151
- package/src/workspace/workspace-welcome.ts +1 -1
- package/src/documents/components/FormulaMenu.vue +0 -50
- package/src/files/components/FileDatabasePage.vue +0 -152
- package/src/files/components/FolderHomeIcon.vue +0 -12
- package/src/objects/components/ObjectDatabasePage.vue +0 -100
- package/src/objects/components/ObjectPanel.vue +0 -554
- package/src/plans/components/PersonalPlanDialog.vue +0 -105
- package/src/shell/components/WorkspaceViewPage.vue +0 -127
- package/src/shell/components/WorkspaceViewTab.vue +0 -24
- package/src/styles/object-panel.css +0 -163
- package/src/workspace/components/GitInspectionPanel.vue +0 -35
- package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
- package/src/workspace/welcome-slogans.ts +0 -11
- package/src/workspace/workspace-git.ts +0 -35
- package/src/workspace/workspace-sync.ts +0 -46
- package/src/workspace/workspace-views.ts +0 -48
package/src/plugins/native.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { openWorkspaceSync } from '../workspace/workspace-sync';
|
|
2
1
|
import { nativeInvoke as invoke } from '../platform/native-bridge';
|
|
3
2
|
import { parsePluginConnectionInput, parsePluginConnectionRequest, pluginConnectionOrigin, type PluginConnectionProvider, type PluginConnection, type PluginOAuthFlow, type PluginOAuthProvider, type PluginOAuthStatus } from '@tano/protocol';
|
|
4
3
|
import type { PluginNativeContext, PluginRuntimeServices } from './host';
|
|
@@ -19,15 +18,8 @@ export function createNativePluginServices(): NonNullable<PluginRuntimeServices[
|
|
|
19
18
|
return result;
|
|
20
19
|
} finally { context.signal.removeEventListener('abort', cancel); }
|
|
21
20
|
}
|
|
22
|
-
return
|
|
23
|
-
(args: unknown, context: PluginNativeContext) => request(command, args, context)]))
|
|
24
|
-
'sync.open': async (args: unknown, context: PluginNativeContext) => {
|
|
25
|
-
context.signal.throwIfAborted();
|
|
26
|
-
if (args !== undefined && JSON.stringify(args) !== '{}') throw new Error('同步入口不接受操作参数');
|
|
27
|
-
openWorkspaceSync(context.workspaceId);
|
|
28
|
-
return { opened: true };
|
|
29
|
-
},
|
|
30
|
-
};
|
|
21
|
+
return Object.fromEntries(['git.status', 'git.diff', 'git.log'].map(command => [command,
|
|
22
|
+
(args: unknown, context: PluginNativeContext) => request(command, args, context)]));
|
|
31
23
|
}
|
|
32
24
|
|
|
33
25
|
/** OS-user credentials for a local desktop workspace, separate from cloud accounts. */
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { PluginWorkbenchView } from './workbench';
|
|
2
|
+
|
|
3
|
+
const WORKSPACE_VIEW_OVERLAY_MAP: Record<string, readonly string[]> = {
|
|
4
|
+
repository: ['files'],
|
|
5
|
+
events: ['tasks', 'calendar'],
|
|
6
|
+
'plugin-views': ['plugins'],
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const SIDEBAR_NAV_OVERLAY_MAP: Record<string, readonly string[]> = {
|
|
10
|
+
plan: ['calendar', 'tasks'],
|
|
11
|
+
mail: ['mail'],
|
|
12
|
+
'view:mail': ['mail'],
|
|
13
|
+
search: ['search'],
|
|
14
|
+
graph: ['graph'],
|
|
15
|
+
files: ['files'],
|
|
16
|
+
objects: ['objects'],
|
|
17
|
+
relations: ['relations'],
|
|
18
|
+
plugins: ['plugins'],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function mappedOverlayIds(
|
|
22
|
+
itemId: string,
|
|
23
|
+
table: Record<string, readonly string[]>,
|
|
24
|
+
): readonly string[] {
|
|
25
|
+
if (itemId in table) return table[itemId];
|
|
26
|
+
const stripped = itemId.startsWith('view:') ? itemId.slice(5) : itemId;
|
|
27
|
+
if (stripped in table) return table[stripped];
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Checks whether a home sidebar navigation item or sidebar header button is hidden
|
|
33
|
+
* by an optional host-provided WorkbenchOverlayExtension.
|
|
34
|
+
*/
|
|
35
|
+
export function isOverlaySidebarNavHidden(
|
|
36
|
+
itemId: string,
|
|
37
|
+
hidden?: readonly string[],
|
|
38
|
+
): boolean {
|
|
39
|
+
if (!hidden?.length) return false;
|
|
40
|
+
const mapped = mappedOverlayIds(itemId, SIDEBAR_NAV_OVERLAY_MAP);
|
|
41
|
+
if (!mapped.length) return false;
|
|
42
|
+
if (itemId === 'plan') {
|
|
43
|
+
return hidden.includes('calendar') || hidden.includes('tasks');
|
|
44
|
+
}
|
|
45
|
+
return mapped.some((id) => hidden.includes(id));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Computes CSS flex `order` style for a home sidebar navigation button when
|
|
50
|
+
* sidebar ordering is provided by an optional host WorkbenchOverlayExtension.
|
|
51
|
+
*/
|
|
52
|
+
export function overlaySidebarNavOrderStyle(
|
|
53
|
+
itemId: string,
|
|
54
|
+
order?: readonly string[],
|
|
55
|
+
): { order: number } | undefined {
|
|
56
|
+
if (!order?.length) return undefined;
|
|
57
|
+
const mapped = mappedOverlayIds(itemId, SIDEBAR_NAV_OVERLAY_MAP);
|
|
58
|
+
if (!mapped.length) return undefined;
|
|
59
|
+
let best = Number.POSITIVE_INFINITY;
|
|
60
|
+
for (const key of mapped) {
|
|
61
|
+
const idx = order.indexOf(key);
|
|
62
|
+
if (idx >= 0 && idx < best) best = idx;
|
|
63
|
+
}
|
|
64
|
+
return Number.isFinite(best) ? { order: best } : undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Applies optional overlay `hiddenSidebarItems` and `sidebarOrder` to the workspace sidebar
|
|
69
|
+
* view tabs (`repository`, `events`, `assistant`, `plugin-views`, `plugin-sidebar:*`).
|
|
70
|
+
* Always keeps at least one tab visible so the workspace sidebar can never become empty.
|
|
71
|
+
*/
|
|
72
|
+
export function applyOverlayToWorkspaceViews<T extends { id: string }>(
|
|
73
|
+
views: readonly T[],
|
|
74
|
+
hidden?: readonly string[],
|
|
75
|
+
order?: readonly string[],
|
|
76
|
+
): T[] {
|
|
77
|
+
const hiddenSet = new Set(hidden ?? []);
|
|
78
|
+
let filtered = views.filter((view) => {
|
|
79
|
+
const mapped = WORKSPACE_VIEW_OVERLAY_MAP[view.id];
|
|
80
|
+
if (!mapped?.length) return true;
|
|
81
|
+
return !mapped.some((key) => hiddenSet.has(key));
|
|
82
|
+
});
|
|
83
|
+
if (!filtered.length && views.length) {
|
|
84
|
+
filtered = [views[0]];
|
|
85
|
+
}
|
|
86
|
+
if (!order?.length || filtered.length <= 1) return filtered;
|
|
87
|
+
|
|
88
|
+
const rankOf = (viewId: string): number => {
|
|
89
|
+
const mapped = WORKSPACE_VIEW_OVERLAY_MAP[viewId];
|
|
90
|
+
if (!mapped?.length) return Number.POSITIVE_INFINITY;
|
|
91
|
+
let best = Number.POSITIVE_INFINITY;
|
|
92
|
+
for (const key of mapped) {
|
|
93
|
+
const idx = order.indexOf(key);
|
|
94
|
+
if (idx >= 0 && idx < best) best = idx;
|
|
95
|
+
}
|
|
96
|
+
return best;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return filtered
|
|
100
|
+
.map((view, index) => ({ view, index, rank: rankOf(view.id) }))
|
|
101
|
+
.sort((a, b) => (a.rank !== b.rank ? a.rank - b.rank : a.index - b.index))
|
|
102
|
+
.map((entry) => entry.view);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Resolves which Tier 2 custom plugin view (if any) replaces `<EmptyEditor>` inside
|
|
107
|
+
* `.workspace-no-tabs` for the current pane.
|
|
108
|
+
* - Blank new tab (`blank:*`) -> `newTabView`
|
|
109
|
+
* - Empty workspace (no active tab) -> `homeTabView`
|
|
110
|
+
* - Safe Mode always disables custom tab replacement and returns `null`.
|
|
111
|
+
*/
|
|
112
|
+
export function resolveOverlayTabView(
|
|
113
|
+
activeTabId: string,
|
|
114
|
+
options: {
|
|
115
|
+
safeMode?: boolean;
|
|
116
|
+
homeTabView?: PluginWorkbenchView | null;
|
|
117
|
+
newTabView?: PluginWorkbenchView | null;
|
|
118
|
+
},
|
|
119
|
+
): PluginWorkbenchView | null {
|
|
120
|
+
if (options.safeMode) return null;
|
|
121
|
+
if (activeTabId.startsWith('blank:')) {
|
|
122
|
+
return options.newTabView ?? null;
|
|
123
|
+
}
|
|
124
|
+
return options.homeTabView ?? null;
|
|
125
|
+
}
|
package/src/plugins/packages.ts
CHANGED
|
@@ -16,17 +16,89 @@ export function pluginApplicationStorage(): Pick<Storage, 'getItem' | 'setItem'>
|
|
|
16
16
|
return { getItem: key => memory.get(key) ?? null, setItem: (key, value) => { memory.set(key, value); } };
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export const PLUGIN_BINARY_ASSET_LIMIT = 1024 * 1024;
|
|
20
|
+
export const PLUGIN_BINARY_ASSETS_TOTAL_LIMIT = 4 * 1024 * 1024;
|
|
21
|
+
|
|
22
|
+
export interface PluginBinaryAssetReadResult {
|
|
23
|
+
path: string;
|
|
24
|
+
bytes: number;
|
|
25
|
+
base64: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function normalizeBinaryAssetPath(raw: string): string {
|
|
29
|
+
if (typeof raw !== 'string') throw new Error('插件资产路径无效');
|
|
30
|
+
const normalized = raw.trim().replaceAll('\\', '/').replace(/^assets\/bin\//, '');
|
|
31
|
+
if (
|
|
32
|
+
!normalized ||
|
|
33
|
+
normalized.length > 240 ||
|
|
34
|
+
normalized.startsWith('/') ||
|
|
35
|
+
normalized.endsWith('/') ||
|
|
36
|
+
normalized.includes('//') ||
|
|
37
|
+
/[\u0000-\u001f]/.test(normalized) ||
|
|
38
|
+
normalized.split('/').some((seg) => !seg || seg === '.' || seg === '..')
|
|
39
|
+
) {
|
|
40
|
+
throw new Error(`插件资产路径无效:${raw}`);
|
|
41
|
+
}
|
|
42
|
+
return normalized;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function bytesToBase64(bytes: Uint8Array): string {
|
|
46
|
+
let binary = '';
|
|
47
|
+
const chunkSize = 0x8000;
|
|
48
|
+
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
49
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize));
|
|
50
|
+
}
|
|
51
|
+
return btoa(binary);
|
|
52
|
+
}
|
|
53
|
+
|
|
19
54
|
/** Content-addressed application cache; no executable code is written to the workspace. */
|
|
20
55
|
export class PluginPackageCache {
|
|
21
56
|
private cache: PluginCacheStorage;
|
|
22
57
|
constructor(storage: Pick<Storage, 'getItem' | 'setItem'> = pluginApplicationStorage()) { this.cache = new PluginCacheStorage(storage); }
|
|
23
|
-
async put(pkg: PluginPackage) {
|
|
58
|
+
async put(pkg: PluginPackage, binaryAssets?: Record<string, Uint8Array>) {
|
|
24
59
|
const parsed = parsePluginPackage(JSON.stringify(pkg));
|
|
25
60
|
const integrity = await pluginIntegrity(parsed);
|
|
26
61
|
const content = canonicalPluginJson(parsed);
|
|
27
62
|
await this.cache.put({ integrity, pluginId: parsed.manifest.id, version: parsed.manifest.version, bytes: new TextEncoder().encode(content).length, savedAt: new Date().toISOString() }, content);
|
|
63
|
+
if (binaryAssets && Object.keys(binaryAssets).length) {
|
|
64
|
+
await this.putBinaryAssets(integrity, binaryAssets);
|
|
65
|
+
}
|
|
28
66
|
return integrity;
|
|
29
67
|
}
|
|
68
|
+
async putBinaryAssets(integrity: string, binaryAssets: Record<string, Uint8Array>) {
|
|
69
|
+
const encoded: Record<string, { bytes: number; base64: string }> = {};
|
|
70
|
+
let total = 0;
|
|
71
|
+
for (const [rawPath, bytes] of Object.entries(binaryAssets)) {
|
|
72
|
+
const path = normalizeBinaryAssetPath(rawPath);
|
|
73
|
+
if (!(bytes instanceof Uint8Array)) throw new Error(`插件资产 ${path} 必须为二进制字节`);
|
|
74
|
+
if (bytes.byteLength > PLUGIN_BINARY_ASSET_LIMIT) {
|
|
75
|
+
throw new Error(`单个插件二进制资产不能超过 1 MiB:${path}`);
|
|
76
|
+
}
|
|
77
|
+
total += bytes.byteLength;
|
|
78
|
+
if (total > PLUGIN_BINARY_ASSETS_TOTAL_LIMIT) {
|
|
79
|
+
throw new Error('插件二进制资产总大小不能超过 4 MiB');
|
|
80
|
+
}
|
|
81
|
+
encoded[path] = { bytes: bytes.byteLength, base64: bytesToBase64(bytes) };
|
|
82
|
+
}
|
|
83
|
+
await this.cache.putAssets(integrity, JSON.stringify({ version: 1, assets: encoded }));
|
|
84
|
+
}
|
|
85
|
+
async listBinaryAssets(integrity: string): Promise<string[]> {
|
|
86
|
+
const raw = await this.cache.getAssets(integrity);
|
|
87
|
+
if (!raw) return [];
|
|
88
|
+
const parsed = JSON.parse(raw) as { version?: number; assets?: Record<string, { bytes: number; base64: string }> };
|
|
89
|
+
if (parsed.version !== 1 || !parsed.assets || typeof parsed.assets !== 'object') return [];
|
|
90
|
+
return Object.keys(parsed.assets).sort();
|
|
91
|
+
}
|
|
92
|
+
async getBinaryAsset(integrity: string, rawPath: string): Promise<PluginBinaryAssetReadResult | null> {
|
|
93
|
+
const path = normalizeBinaryAssetPath(rawPath);
|
|
94
|
+
const raw = await this.cache.getAssets(integrity);
|
|
95
|
+
if (!raw) return null;
|
|
96
|
+
const parsed = JSON.parse(raw) as { version?: number; assets?: Record<string, { bytes: number; base64: string }> };
|
|
97
|
+
if (parsed.version !== 1 || !parsed.assets || !Object.hasOwn(parsed.assets, path)) return null;
|
|
98
|
+
const entry = parsed.assets[path];
|
|
99
|
+
if (!entry || typeof entry.base64 !== 'string' || typeof entry.bytes !== 'number') return null;
|
|
100
|
+
return { path, bytes: entry.bytes, base64: entry.base64 };
|
|
101
|
+
}
|
|
30
102
|
async get(integrity: string) {
|
|
31
103
|
const content = await this.cache.get(integrity);
|
|
32
104
|
if (!content) return null;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { PluginPermission } from '@tano/protocol';
|
|
2
|
+
import { t } from '../i18n/i18n';
|
|
3
|
+
|
|
4
|
+
export const pluginPermissionLabels: Record<PluginPermission, string> = {
|
|
5
|
+
get 'attachments.read'() {
|
|
6
|
+
return t('只读访问工作区附件');
|
|
7
|
+
},
|
|
8
|
+
get 'attachments.write'() {
|
|
9
|
+
return t('受限写入工作区附件');
|
|
10
|
+
},
|
|
11
|
+
get 'documents.read'() {
|
|
12
|
+
return t('读取与打开文档');
|
|
13
|
+
},
|
|
14
|
+
get 'documents.write'() {
|
|
15
|
+
return t('创建与修改文档');
|
|
16
|
+
},
|
|
17
|
+
get 'documents.move'() {
|
|
18
|
+
return t('移动与重命名文档');
|
|
19
|
+
},
|
|
20
|
+
get 'documents.trash'() {
|
|
21
|
+
return t('将文档移入回收站');
|
|
22
|
+
},
|
|
23
|
+
get 'objects.read'() {
|
|
24
|
+
return t('读取对象');
|
|
25
|
+
},
|
|
26
|
+
get 'objects.write'() {
|
|
27
|
+
return t('创建与修改对象');
|
|
28
|
+
},
|
|
29
|
+
get 'relations.read'() {
|
|
30
|
+
return t('读取关系');
|
|
31
|
+
},
|
|
32
|
+
get 'relations.write'() {
|
|
33
|
+
return t('修改关系');
|
|
34
|
+
},
|
|
35
|
+
get storage() {
|
|
36
|
+
return t('保存插件本机状态');
|
|
37
|
+
},
|
|
38
|
+
get network() {
|
|
39
|
+
return t('访问指定网络来源');
|
|
40
|
+
},
|
|
41
|
+
get connections() {
|
|
42
|
+
return t('使用单独授权的服务凭据');
|
|
43
|
+
},
|
|
44
|
+
get native() {
|
|
45
|
+
return t('调用指定本机能力');
|
|
46
|
+
},
|
|
47
|
+
get ui() {
|
|
48
|
+
return t('运行隔离的自定义界面');
|
|
49
|
+
},
|
|
50
|
+
get 'ai.invoke'() {
|
|
51
|
+
return t('调用同页助手模型推理(不接触密钥)');
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export function pluginPermissionLabel(permission: string): string {
|
|
56
|
+
return (pluginPermissionLabels as Record<string, string>)[permission] ?? permission;
|
|
57
|
+
}
|
|
@@ -1,6 +1,104 @@
|
|
|
1
1
|
/** Public, browser-first SDK. Import types only; the runtime supplies `tano` to activate(). */
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type {
|
|
3
|
+
PluginViewNode,
|
|
4
|
+
PluginJson,
|
|
5
|
+
WorkspaceObject,
|
|
6
|
+
WorkspaceRelation,
|
|
7
|
+
PluginConnectionRequest,
|
|
8
|
+
PluginConnectionResponse,
|
|
9
|
+
PluginPlatform,
|
|
10
|
+
PluginEngines,
|
|
11
|
+
PluginErrorCode,
|
|
12
|
+
PluginStatusBarItem,
|
|
13
|
+
PluginUiPickOptions,
|
|
14
|
+
PluginUiPromptOptions,
|
|
15
|
+
PluginUiConfirmOptions,
|
|
16
|
+
PluginUiTone,
|
|
17
|
+
PluginSlashCommandDefinition,
|
|
18
|
+
PluginActiveEditorSnapshot,
|
|
19
|
+
PluginFrontmatterPatch,
|
|
20
|
+
PluginCodeBlockRendererDefinition,
|
|
21
|
+
PluginEditorDecorationTone,
|
|
22
|
+
PluginEditorDecoration,
|
|
23
|
+
PluginAttachmentWriteRequest,
|
|
24
|
+
WorkspacePersonalPluginPolicy,
|
|
25
|
+
PluginAssistantToolEffect,
|
|
26
|
+
PluginAssistantToolDefinition,
|
|
27
|
+
PluginAssistantContextProviderDefinition,
|
|
28
|
+
PluginAiCompleteRequest,
|
|
29
|
+
PluginAiStructuredRequest,
|
|
30
|
+
PluginAiCompleteResult,
|
|
31
|
+
PluginAiStructuredResult,
|
|
32
|
+
PluginServiceDefinition,
|
|
33
|
+
PluginServiceDependency,
|
|
34
|
+
} from '@tano/protocol';
|
|
35
|
+
export type {
|
|
36
|
+
PluginManifest,
|
|
37
|
+
ExecutablePluginManifest,
|
|
38
|
+
PluginPackage,
|
|
39
|
+
PluginPackageAssets,
|
|
40
|
+
PluginArchiveV2,
|
|
41
|
+
PluginServiceDefinition,
|
|
42
|
+
PluginServiceDependency,
|
|
43
|
+
PluginPermission,
|
|
44
|
+
PluginViewDefinition,
|
|
45
|
+
PluginViewLocation,
|
|
46
|
+
PluginViewLayout,
|
|
47
|
+
PluginStatusBarAlign,
|
|
48
|
+
PluginStatusBarTone,
|
|
49
|
+
PluginStatusBarItem,
|
|
50
|
+
PluginUiTone,
|
|
51
|
+
PluginUiPickItem,
|
|
52
|
+
PluginUiPickOptions,
|
|
53
|
+
PluginUiPromptOptions,
|
|
54
|
+
PluginUiConfirmOptions,
|
|
55
|
+
PluginUiToastOptions,
|
|
56
|
+
PluginSlashCommandDefinition,
|
|
57
|
+
PluginActiveEditorSnapshot,
|
|
58
|
+
PluginFrontmatterPatch,
|
|
59
|
+
PluginCodeBlockRendererDefinition,
|
|
60
|
+
PluginEditorDecorationTone,
|
|
61
|
+
PluginEditorDecoration,
|
|
62
|
+
PluginAttachmentWriteRequest,
|
|
63
|
+
WorkspacePersonalPluginPolicy,
|
|
64
|
+
PluginAssistantToolEffect,
|
|
65
|
+
PluginAssistantToolDefinition,
|
|
66
|
+
PluginAssistantContextProviderDefinition,
|
|
67
|
+
PluginAiCompleteRequest,
|
|
68
|
+
PluginAiStructuredRequest,
|
|
69
|
+
PluginAiCompleteResult,
|
|
70
|
+
PluginAiStructuredResult,
|
|
71
|
+
PluginFileHandlerMode,
|
|
72
|
+
PluginFileHandlerDefinition,
|
|
73
|
+
PluginSettingFieldType,
|
|
74
|
+
PluginSettingField,
|
|
75
|
+
PluginActivationEvent,
|
|
76
|
+
PluginPlatform,
|
|
77
|
+
PluginEngines,
|
|
78
|
+
PluginErrorCode,
|
|
79
|
+
PluginViewNode,
|
|
80
|
+
PluginJson,
|
|
81
|
+
PluginUiBundle,
|
|
82
|
+
} from '@tano/protocol';
|
|
83
|
+
export interface PluginAssistantCallContext {
|
|
84
|
+
workspaceId: string;
|
|
85
|
+
activeFileId?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface PluginAssistantContextResult {
|
|
88
|
+
title?: string;
|
|
89
|
+
content: string;
|
|
90
|
+
metadata?: PluginJson;
|
|
91
|
+
}
|
|
92
|
+
export interface PluginHostInfo {
|
|
93
|
+
coreVersion: string;
|
|
94
|
+
apiVersion: string;
|
|
95
|
+
platform: PluginPlatform;
|
|
96
|
+
capabilities: string[];
|
|
97
|
+
}
|
|
98
|
+
export interface TanoPluginError extends Error {
|
|
99
|
+
readonly code: PluginErrorCode;
|
|
100
|
+
readonly retryable: boolean;
|
|
101
|
+
}
|
|
4
102
|
/** Runs inside the custom UI frame; workspace access stays in the plugin's Worker. */
|
|
5
103
|
export interface TanoPluginViewApi {
|
|
6
104
|
/** Read-only host appearance, also applied as CSS variables inside the isolated UI. */
|
|
@@ -34,8 +132,11 @@ export interface PluginAutomationExecution {
|
|
|
34
132
|
export type TanoAutomationApi = Pick<TanoPluginApi, 'context' | 'objects' | 'relations' | 'network' | 'connections'> & {
|
|
35
133
|
documents: Omit<TanoPluginApi['documents'], 'open'>;
|
|
36
134
|
};
|
|
37
|
-
export
|
|
38
|
-
|
|
135
|
+
export interface PluginGitEntry { path: string; index: string; worktree: string; originalPath: string | null }
|
|
136
|
+
export interface PluginGitStatus { branch: string | null; detached: boolean; entries: PluginGitEntry[] }
|
|
137
|
+
export interface PluginGitDiff { path: string; staged: boolean; patch: string }
|
|
138
|
+
export interface PluginGitCommit { id: string; shortId: string; author: string; date: string; subject: string }
|
|
139
|
+
export interface PluginGitLog { path: string | null; commits: PluginGitCommit[] }
|
|
39
140
|
export type PluginChangeKind = 'created' | 'updated' | 'deleted';
|
|
40
141
|
export type PluginEvent = { type: 'workspace.changed'; fileId?: string } | {
|
|
41
142
|
type: 'documents.changed' | 'objects.changed' | 'relations.changed';
|
|
@@ -44,9 +145,21 @@ export type PluginEvent = { type: 'workspace.changed'; fileId?: string } | {
|
|
|
44
145
|
reset?: boolean;
|
|
45
146
|
};
|
|
46
147
|
export interface TanoPluginApi {
|
|
47
|
-
/** Read-only binary snapshot in bounded base64 chunks
|
|
48
|
-
attachments: {
|
|
148
|
+
/** Read-only binary snapshot in bounded base64 chunks, plus optional bounded attachment write. */
|
|
149
|
+
attachments: {
|
|
150
|
+
read(fileId: string, offset?: number, revision?: string): Promise<{ path: string; revision: string; offset: number; total: number; chunk: string }>;
|
|
151
|
+
write(request: PluginAttachmentWriteRequest): Promise<{ path: string; name: string; image: boolean; url: string }>;
|
|
152
|
+
};
|
|
49
153
|
context(): Promise<{ workspaceId: string; pluginId: string; settings: Record<string, unknown> }>;
|
|
154
|
+
/** Host runtime version, platform mode, and supported capabilities for graceful feature detection. */
|
|
155
|
+
hostInfo(): Promise<PluginHostInfo>;
|
|
156
|
+
/** Register a graceful cleanup handler invoked before the host terminates this plugin instance. */
|
|
157
|
+
lifecycle: { onDeactivate(handler: () => void | Promise<void>): () => void };
|
|
158
|
+
/** Read-only access to binary assets bundled inside this plugin's own v2 ZIP package (`assets/bin/*`). */
|
|
159
|
+
assets: {
|
|
160
|
+
list(): Promise<string[]>;
|
|
161
|
+
read(path: string): Promise<{ path: string; bytes: number; base64: string }>;
|
|
162
|
+
};
|
|
50
163
|
documents: {
|
|
51
164
|
list(): Promise<PluginDocumentEntry[]>;
|
|
52
165
|
query(options?: PluginDocumentQuery): Promise<PluginPage<PluginDocumentEntry>>;
|
|
@@ -56,7 +169,25 @@ export interface TanoPluginApi {
|
|
|
56
169
|
write(fileId: string, content: string, baseHash: string): Promise<{ id: string; hash: string; status: 'applied' | 'saved' }>;
|
|
57
170
|
edit(fileId: string, edits: PluginTextEdit[], baseHash: string): Promise<{ id: string; hash: string; status: 'applied' | 'saved' }>;
|
|
58
171
|
create(path: string, content: string): Promise<{ id: string; path: string }>;
|
|
172
|
+
move(fileId: string, destination: string, baseHash: string): Promise<{ id: string; path: string }>;
|
|
173
|
+
trash(fileId: string, baseHash: string): Promise<{ id: string; path: string; trashed: true }>;
|
|
59
174
|
open(fileId: string): Promise<void>;
|
|
175
|
+
frontmatter: {
|
|
176
|
+
read(fileId: string): Promise<{ id: string; hasFrontmatter: boolean; data: Record<string, PluginJson>; hash: string }>;
|
|
177
|
+
update(
|
|
178
|
+
fileId: string,
|
|
179
|
+
patch: PluginFrontmatterPatch,
|
|
180
|
+
baseHash: string,
|
|
181
|
+
): Promise<{ id: string; hash: string; data: Record<string, PluginJson>; status: 'applied' | 'saved' }>;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
/** Active editor selection, single-step undoable cursor transactions, and declarative decorations. */
|
|
185
|
+
editor: {
|
|
186
|
+
active(): Promise<PluginActiveEditorSnapshot | null>;
|
|
187
|
+
insert(text: string): Promise<{ fileId: string; hash: string; status: 'applied' }>;
|
|
188
|
+
replaceSelection(text: string): Promise<{ fileId: string; hash: string; status: 'applied' }>;
|
|
189
|
+
setDecorations(fileId: string, decorations: PluginEditorDecoration[]): Promise<void>;
|
|
190
|
+
clearDecorations(fileId?: string): Promise<void>;
|
|
60
191
|
};
|
|
61
192
|
objects: {
|
|
62
193
|
list(): Promise<PluginObjectSnapshot[]>;
|
|
@@ -72,8 +203,6 @@ export interface TanoPluginApi {
|
|
|
72
203
|
/** Host injects the current user's separately granted credential; keys never enter the SDK. */
|
|
73
204
|
connections: { request(origin: string, request: PluginConnectionRequest): Promise<PluginConnectionResponse> };
|
|
74
205
|
native: {
|
|
75
|
-
/** Opens the system UI; does not grant commit or network authority. */
|
|
76
|
-
invoke(command: 'sync.open', args?: Record<string, never>): Promise<{ opened: boolean }>;
|
|
77
206
|
invoke(command: 'git.status', args?: Record<string, never>): Promise<PluginGitStatus>;
|
|
78
207
|
invoke(command: 'git.diff', args: { path: string; staged?: boolean }): Promise<PluginGitDiff>;
|
|
79
208
|
invoke(command: 'git.log', args?: { path?: string; limit?: number }): Promise<PluginGitLog>;
|
|
@@ -89,6 +218,43 @@ export interface TanoPluginApi {
|
|
|
89
218
|
onAction(id: string, handler: (event: { action: string; values: Record<string, string> }) => void | Promise<void>): () => void;
|
|
90
219
|
onMessage(id: string, handler: (message: PluginJson) => void | Promise<void>): () => void;
|
|
91
220
|
};
|
|
221
|
+
/** Host-managed lightweight UI primitives and status bar items; no iframe frontend required. */
|
|
222
|
+
ui: {
|
|
223
|
+
pick(options: PluginUiPickOptions): Promise<string | null>;
|
|
224
|
+
prompt(options: PluginUiPromptOptions): Promise<string | null>;
|
|
225
|
+
confirm(options: PluginUiConfirmOptions): Promise<boolean>;
|
|
226
|
+
toast(message: string, tone?: PluginUiTone): Promise<void>;
|
|
227
|
+
setStatusBar(item: PluginStatusBarItem): Promise<void>;
|
|
228
|
+
removeStatusBar(id: string): Promise<void>;
|
|
229
|
+
};
|
|
230
|
+
/** Host-managed model completion using the user's configured connection; API keys never enter the sandbox. */
|
|
231
|
+
ai: {
|
|
232
|
+
complete(request: PluginAiCompleteRequest): Promise<PluginAiCompleteResult>;
|
|
233
|
+
structured<T = PluginJson>(request: PluginAiStructuredRequest): Promise<PluginAiStructuredResult<T>>;
|
|
234
|
+
};
|
|
235
|
+
/** Register handlers for manifest-declared assistantTools and assistantContextProviders. */
|
|
236
|
+
assistant: {
|
|
237
|
+
registerTool(
|
|
238
|
+
name: string,
|
|
239
|
+
handler: (args: Record<string, unknown>, context: PluginAssistantCallContext) => PluginJson | Promise<PluginJson>,
|
|
240
|
+
): Promise<void>;
|
|
241
|
+
registerContextProvider(
|
|
242
|
+
id: string,
|
|
243
|
+
handler: (
|
|
244
|
+
query: string,
|
|
245
|
+
context: PluginAssistantCallContext,
|
|
246
|
+
) => PluginAssistantContextResult | string | Promise<PluginAssistantContextResult | string>,
|
|
247
|
+
): Promise<void>;
|
|
248
|
+
};
|
|
249
|
+
/** Stateless cross-plugin RPC message bus (zero shared memory). */
|
|
250
|
+
services: {
|
|
251
|
+
register(
|
|
252
|
+
name: string,
|
|
253
|
+
handler: (payload: PluginJson, caller: { pluginId: string }) => PluginJson | Promise<PluginJson>,
|
|
254
|
+
): Promise<void>;
|
|
255
|
+
call<T = PluginJson>(pluginId: string, service: string, payload?: PluginJson): Promise<T>;
|
|
256
|
+
available(pluginId: string, service: string): Promise<boolean>;
|
|
257
|
+
};
|
|
92
258
|
events: { subscribe(handler: (event: PluginEvent) => void | Promise<void>, options?: { types?: PluginEvent['type'][]; ids?: string[] }): () => void };
|
|
93
259
|
notify(message: string): Promise<void>;
|
|
94
260
|
}
|
package/src/plugins/policy.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { canonicalPluginJson, parsePluginPolicy, workspacePluginPath } from '@tano/protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
FileSnapshot,
|
|
4
|
+
Workspace,
|
|
5
|
+
WorkspaceAdapter,
|
|
6
|
+
WorkspacePersonalPluginPolicy,
|
|
7
|
+
WorkspacePluginPolicy,
|
|
8
|
+
WorkspacePluginRule,
|
|
9
|
+
} from '@tano/protocol';
|
|
3
10
|
|
|
4
11
|
export interface PluginPolicySnapshot { snapshot: FileSnapshot | null; policy: WorkspacePluginPolicy }
|
|
5
12
|
export function canManageWorkspacePlugins(adapter: WorkspaceAdapter, workspace: Workspace) {
|
|
@@ -25,7 +32,7 @@ export async function savePluginRule(adapter: WorkspaceAdapter, base: PluginPoli
|
|
|
25
32
|
if (!original || !latest || !desired) conflict = !equal(original, latest) && !equal(latest, desired);
|
|
26
33
|
else {
|
|
27
34
|
merged = structuredClone(latest);
|
|
28
|
-
for (const field of ['manifest', 'mode', 'integrity', 'sourceUrl', 'settings', 'history'] as const) {
|
|
35
|
+
for (const field of ['manifest', 'mode', 'integrity', 'sourceUrl', 'settings', 'pathScopes', 'history'] as const) {
|
|
29
36
|
if (equal(original[field], desired[field])) continue;
|
|
30
37
|
if (!equal(original[field], latest[field]) && !equal(desired[field], latest[field])) { conflict = true; break; }
|
|
31
38
|
Object.assign(merged, { [field]: desired[field] });
|
|
@@ -38,7 +45,11 @@ export async function savePluginRule(adapter: WorkspaceAdapter, base: PluginPoli
|
|
|
38
45
|
await adapter.create(path, JSON.stringify(proposed, null, 2) + '\n');
|
|
39
46
|
throw new Error(`插件规则已被其他人修改;你的版本已保存在 ${path},请刷新后比较。`);
|
|
40
47
|
}
|
|
41
|
-
const policy = parsePluginPolicy(JSON.stringify({
|
|
48
|
+
const policy = parsePluginPolicy(JSON.stringify({
|
|
49
|
+
version: 1,
|
|
50
|
+
...(current.policy.personalCodePlugins ? { personalCodePlugins: current.policy.personalCodePlugins } : {}),
|
|
51
|
+
plugins: [...current.policy.plugins.filter(row => row.manifest.id !== id), ...(merged ? [merged] : [])],
|
|
52
|
+
}));
|
|
42
53
|
const content = JSON.stringify(policy, null, 2) + '\n';
|
|
43
54
|
assertCurrent();
|
|
44
55
|
if (current.snapshot) {
|
|
@@ -61,3 +72,42 @@ export async function savePluginRule(adapter: WorkspaceAdapter, base: PluginPoli
|
|
|
61
72
|
}
|
|
62
73
|
throw new Error('插件规则正在持续变化,请刷新后重试');
|
|
63
74
|
}
|
|
75
|
+
|
|
76
|
+
export async function saveWorkspacePersonalPluginPolicy(
|
|
77
|
+
adapter: WorkspaceAdapter,
|
|
78
|
+
base: PluginPolicySnapshot,
|
|
79
|
+
personalCodePlugins: WorkspacePersonalPluginPolicy,
|
|
80
|
+
assertCurrent: () => void,
|
|
81
|
+
): Promise<PluginPolicySnapshot> {
|
|
82
|
+
let current = base;
|
|
83
|
+
for (let attempt = 0; attempt < 4; attempt++) {
|
|
84
|
+
assertCurrent();
|
|
85
|
+
const policy = parsePluginPolicy(
|
|
86
|
+
JSON.stringify({
|
|
87
|
+
version: 1,
|
|
88
|
+
...(personalCodePlugins !== 'allow' ? { personalCodePlugins } : {}),
|
|
89
|
+
plugins: current.policy.plugins,
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
92
|
+
const content = JSON.stringify(policy, null, 2) + '\n';
|
|
93
|
+
if (current.snapshot) {
|
|
94
|
+
const result = await adapter.write(workspacePluginPath, content, current.snapshot.hash);
|
|
95
|
+
if (result.status === 'saved') return { policy, snapshot: result.snapshot };
|
|
96
|
+
if (result.status === 'missing') throw new Error('工作区插件规则已被移除,请刷新后重试');
|
|
97
|
+
current = { snapshot: result.snapshot, policy: parsePluginPolicy(result.snapshot.content) };
|
|
98
|
+
} else {
|
|
99
|
+
try {
|
|
100
|
+
await adapter.create(workspacePluginPath, content);
|
|
101
|
+
} catch (error) {
|
|
102
|
+
assertCurrent();
|
|
103
|
+
let snapshot: FileSnapshot;
|
|
104
|
+
try { snapshot = await adapter.read(workspacePluginPath); } catch { throw error; }
|
|
105
|
+
current = { snapshot, policy: parsePluginPolicy(snapshot.content) };
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const snapshot = await adapter.read(workspacePluginPath);
|
|
109
|
+
return { snapshot, policy: parsePluginPolicy(snapshot.content) };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
throw new Error('插件规则正在持续变化,请刷新后重试');
|
|
113
|
+
}
|