25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(plugins): open workbench in tabs from dock surfaces
Jinpy021223142151
diff --git a/apps/desktop/src/components/plugins/PluginBottomDock.vue b/apps/desktop/src/components/plugins/PluginBottomDock.vueindex 476497dd2b..43b1738f98 100644--- a/apps/desktop/src/components/plugins/PluginBottomDock.vue+++ b/apps/desktop/src/components/plugins/PluginBottomDock.vue@@ -297,11 +297,26 @@ function rerunActiveCommand() {// A dock-hosted webview asking for another panel via the bridge openWorkbench: the host rebuilds the authoritative// context (dropping plugin-supplied reserved fields) and adds one generic panel entry.-function onPanelOpenWorkbench(entry: (typeof entries.value)[number], _contributionId: string, childContext?: Record<string, unknown>) {+// `options.target === "tab"` (bridge extension) routes to the main-workbench tab+// path instead — same reuse/session-numbering semantics as tab-surface callers+// (queryStore.openPluginWorkbench). Without the option the dock-entry behavior+// is unchanged, so older plugins keep working.+function onPanelOpenWorkbench(entry: (typeof entries.value)[number], _contributionId: string, childContext?: Record<string, unknown>, options?: { forceNew?: boolean; target?: "tab" }) {const payload = childContext && typeof childContext === "object" && !Array.isArray(childContext) ? { ...childContext } : {};delete payload.workbenchId;delete payload.restored;delete payload.surface;+ if (options?.target === "tab") {+ // Title derivation mirrors the tab-surface caller (PluginWorkbenchTab+ // openWorkbench): per-connection sessions are titled after the connection+ // display name, falling back to the localized workbench label and the+ // dock entry's title — never the raw contribution id.+ const contextConnectionId = typeof payload.connectionId === "string" ? payload.connectionId : "";+ const connectionName = contextConnectionId ? connectionStore.getConfig(contextConnectionId)?.name : undefined;+ const label = createFrontendPluginRegistry(plugins.value, locale.value).findWorkbench(entry.pluginId, entry.workbenchContributionId)?.contribution.label;+ queryStore.openPluginWorkbench(entry.pluginId, entry.workbenchContributionId, { title: connectionName || label || entry.title, context: payload, forceNew: options.forceNew === true });+ return;+ }const id = addPluginDockEntry({pluginId: entry.pluginId,workbenchContributionId: entry.workbenchContributionId,@@ -624,7 +639,7 @@ onScopeDispose(() => window.removeEventListener("blur", onPlusMenuWindowBlur));:contribution="workbenchContributionFor(entry)!":context="entry.context"@close-tab="closeEntry(entry.id)"- @open-workbench="(_pluginId, contributionId, context) => onPanelOpenWorkbench(entry, contributionId, context)"+ @open-workbench="(_pluginId, contributionId, context, options) => onPanelOpenWorkbench(entry, contributionId, context, options)"/></div></div>diff --git a/apps/desktop/src/lib/plugins/pluginBottomDock.ts b/apps/desktop/src/lib/plugins/pluginBottomDock.tsindex cd74c172b5..7d322ff95c 100644--- a/apps/desktop/src/lib/plugins/pluginBottomDock.ts+++ b/apps/desktop/src/lib/plugins/pluginBottomDock.ts@@ -27,7 +27,8 @@ export interface PluginDockEntry {instanceKey?: string;title: string;icon?: string;- /** Host-authored context: workbenchId=id, restored=false, surface="panel". */+ /** Host-authored context: workbenchId=id, restored=false, surface="dock". */+ /** Surface vocabulary (open set, unknown falls back): "tab" (main multi-tab workbench) / "dock" (bottom dock, was "panel" — renamed 2026-09-30) / "sidebar-left" / "sidebar-right" / "window" (reserved). */context: Record<string, unknown>;}@@ -78,7 +79,7 @@ export function addPluginDockEntry(payload: AddPluginDockEntryPayload): string {...(payload.commandContext ?? {}),workbenchId: id,restored: false,- surface: "panel",+ surface: "dock",},});activeEntryId.value = id;diff --git a/apps/desktop/src/lib/plugins/pluginCommandRegistry.spec.ts b/apps/desktop/src/lib/plugins/pluginCommandRegistry.spec.tsindex 9b1ab77fba..da95137ae1 100644--- a/apps/desktop/src/lib/plugins/pluginCommandRegistry.spec.ts+++ b/apps/desktop/src/lib/plugins/pluginCommandRegistry.spec.ts@@ -108,7 +108,7 @@ describe("plugin command registry (PR-A4)", () => {expect(firstEntry.context.workbenchId).toBe(firstEntry.id);expect(firstEntry.context.workbenchId).not.toBe("plugin-forged");expect(firstEntry.context.restored).toBe(false);- expect(firstEntry.context.surface).toBe("panel");+ expect(firstEntry.context.surface).toBe("dock");expect(activeEntryId.value).toBe(firstEntry.id);// §4.1 reuse key = pluginId + commandId + presentation + instance_key.expect(firstEntry.instanceKey).toBe("local-terminal");@@ -270,6 +270,6 @@ describe("plugin command registry (PR-A4)", () => {// §11: reserved identity fields are host-authored — forged values never pass.expect(entry.context.workbenchId).toBe(entry.id);expect(entry.context.restored).toBe(false);- expect(entry.context.surface).toBe("panel");+ expect(entry.context.surface).toBe("dock");});});diff --git a/apps/desktop/src/lib/plugins/pluginCommandRegistry.ts b/apps/desktop/src/lib/plugins/pluginCommandRegistry.tsindex 4f5d3f9b79..457806c14b 100644--- a/apps/desktop/src/lib/plugins/pluginCommandRegistry.ts+++ b/apps/desktop/src/lib/plugins/pluginCommandRegistry.ts@@ -41,7 +41,7 @@ export function executePluginCommand(registry: FrontendPluginRegistry, queryStorif (!workbench) return { error: `Command '${pluginId}.${commandId}' references missing workbench '${action.workbench}'` };// §5.4 re-validate enablement right before execution (against the current context snapshot; the surface key follows// presentation).- const commandContextKeys: PluginConditionContextKeys = { surface: action.presentation === "panel" ? "panel" : "tab", "connection.state": "none", readOnly: false };+ const commandContextKeys: PluginConditionContextKeys = { surface: action.presentation === "panel" ? "dock" : "tab", "connection.state": "none", readOnly: false };if (!evaluatePluginCommandConditions(command.enablement?.all, commandContextKeys)) {return { error: `Command '${pluginId}.${commandId}' is disabled by enablement` };}diff --git a/apps/desktop/src/lib/plugins/pluginHostBridge.ts b/apps/desktop/src/lib/plugins/pluginHostBridge.tsindex 9fa8e703bb..e1354310e4 100644--- a/apps/desktop/src/lib/plugins/pluginHostBridge.ts+++ b/apps/desktop/src/lib/plugins/pluginHostBridge.ts@@ -163,7 +163,7 @@ export interface PluginHostBridgeApi {generateAiText?(pluginName: string, input: PluginAiGenerateRequest): Promise<string>;openAiConversation?(request: AiPluginConversationRequest): Promise<void>;setAiRecommendations?(update: PluginAiRecommendationHostUpdate): void;- openWorkbench?(pluginId: string, contributionId: string, context?: PluginWorkbenchContext, options?: { forceNew?: boolean }): Promise<void> | void;+ openWorkbench?(pluginId: string, contributionId: string, context?: PluginWorkbenchContext, options?: { forceNew?: boolean; target?: "tab" }): Promise<void> | void;/*** §4/§5 command execution asked from a plugin webview: the same registry* path as menu execution — enablement (§5.4), §4.1 singleton reuse,@@ -685,7 +685,11 @@ export class PluginHostBridge {this.requirePermission("host.workbench");if (!this.api.openWorkbench) throw new Error("Host workbench navigation is unavailable");const input = requireRecord(params, "host.openWorkbench params");- await this.api.openWorkbench(this.plugin.manifest.id, requireProtocolName(input.contributionId, "workbench contribution"), isRecord(input.context) ? input.context : undefined, { forceNew: input.forceNew === true });+ // `target: "tab"` lets a dock-hosted webview ask for a main-workbench+ // tab instead of another dock entry (e.g. the SSH dock's "open session+ // in tab" button). Surfaces that ignore it keep the old behavior, so+ // older handlers stay compatible.+ await this.api.openWorkbench(this.plugin.manifest.id, requireProtocolName(input.contributionId, "workbench contribution"), isRecord(input.context) ? input.context : undefined, { forceNew: input.forceNew === true, target: input.target === "tab" ? "tab" : undefined });return null;}if (method === "host.executeCommand") {@@ -1239,7 +1243,7 @@ export function pluginSdkSource(initialTheme?: PluginBridgeTheme): string {const asset = await request('ui.readAsset', { path });return URL.createObjectURL(new Blob([decode(asset.dataBase64)], { type: asset.contentType }));},- openWorkbench: (contributionId, childContext, options) => request('host.openWorkbench', { contributionId, context: childContext, forceNew: !!(options && options.forceNew) }),+ openWorkbench: (contributionId, childContext, options) => request('host.openWorkbench', { contributionId, context: childContext, forceNew: !!(options && options.forceNew), target: options && options.target === "tab" ? "tab" : undefined }),// §4/§5 command execution from a webview — the same registry path a menu// placement takes (enablement, §4.1 reuse, host-authored context),// scoped to the plugin's own declared commands. The optional contextdiff --git a/apps/desktop/src/lib/plugins/pluginShortcuts.ts b/apps/desktop/src/lib/plugins/pluginShortcuts.tsindex ebe816d74f..541c08409f 100644--- a/apps/desktop/src/lib/plugins/pluginShortcuts.ts+++ b/apps/desktop/src/lib/plugins/pluginShortcuts.ts@@ -80,7 +80,7 @@ export function collectPluginShortcuts(registry: FrontendPluginRegistry): PluginrootUri,disabled: command? !evaluatePluginCommandConditions(command.enablement?.all, {- surface: command.action.presentation === "panel" ? "panel" : "tab",+ surface: command.action.presentation === "panel" ? "dock" : "tab","connection.state": "none",readOnly: false,})