RFC(plugin): Host API 1.1 enablers validated by an SSH/SFTP plugin - #5794
Draft
Ezreal-byte wants to merge 3 commits into
Draft
RFC(plugin): Host API 1.1 enablers validated by an SSH/SFTP plugin#5794Ezreal-byte wants to merge 3 commits into
Ezreal-byte wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
定位
本 PR 基于
dev/plugin-framework-current,用一个真实的 SSH/SFTP 插件验证 Host API 1.1 所需的安全边界、生命周期、长连接和大文件传输能力。重点是把“插件适配遇到的问题”映射为可运行、可审查的代码方案,供维护者决定 API 形态、拆分方式和最终实现。Ezreal-byte/dbx-ssh-sftp-plugin:codex/plugin-pocio.dbx.ssh-sftp-0.2.2-windows-x64.dbxpt8y2/dbx:dev/plugin-framework-current(4853bcbe)真实插件遇到的问题与本 PR 的方案
visible_when、required_when、path,仅校验当前可见字段manifest.rs、manifest.schema.json、PluginConnectionFields.vuemultiple-workbenches,普通打开复用,显式“新建连接”创建独立workbenchIdSidebarTreeRuntimeHost.vue、queryStore.ts、database.tsworkbenchId、restored、最多 64 KiB 的workbenchState;提供 set/get 和acknowledgeRestore()openTabsPersistence.ts、PluginWorkbenchTab.vue、pluginHostBridge.tsuseFileDrop(),通过活动工作台 Bridge 注册表只投递给唯一活动标签useFileDrop.ts、pluginWorkbenchBridgeRegistry.ts、ContentArea.vueplugin_file_transfer.rs、pluginHostBridge.tspick/read/beginSave/write/finish/cancel,新增release();256 KiB 分块,桌面 16 GiB,OPFS 16 GiB,无 OPFS 内存回退 1 GiBpluginHostBridge.ts、plugin_file_transfer.rsconfirm()无法形成可信边界pluginId + operationId + challengeId绑定并单次消费host.rs、pluginConnectionChallenge.ts、PluginConnectionChallengeDialog.vuehost.rs、runtime.rs、pluginHostBridge.tshost.clipboard;首次读取按插件进行进程内授权,写入仍做权限检查pluginClipboardPermission.ts、pluginHostBridge.tsfrontendPlugin.ts、PluginWorkbenchHost.vue、pluginHostBridge.tsknown_hosts和安全临时文件需要跨版本、按插件隔离的数据目录DBX_PLUGIN_DATA_DIR,目录与插件 ID 绑定runtime.rs、plugins.rsworkbench/close生命周期;缓存淘汰只卸载 iframe,真正关标签才释放会话/传输PluginWorkbenchHost.vue、PluginWorkbenchTab.vue、host.rs方案结构
1. Rust Host:文件句柄与可信生命周期
PluginFileTransferState维护handleId → pluginId/workbenchId/kind/path/offset/expectedSize/lastAccess/status。2. 前端 Host:单一入口路由与沙箱桥
restored不再永久写入持久数据;DBX 启动恢复标签时重新置 true,新会话成功后由插件显式 acknowledge。3. Manifest/SDK/文档:把试验接口写成可讨论契约
1.1.0。修改文件明细
Cargo.lockapps/desktop/src/components/connection/ConnectionDialog.vueapps/desktop/src/components/layout/AppDialogs.vueapps/desktop/src/components/layout/ContentArea.vueapps/desktop/src/components/plugins/PluginConnectionChallengeDialog.vueapps/desktop/src/components/plugins/PluginConnectionFields.vuevisible_when/required_when/path,并按可见性执行表单校验。apps/desktop/src/components/plugins/PluginWorkbenchHost.vueapps/desktop/src/components/plugins/PluginWorkbenchTab.vueapps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vueapps/desktop/src/composables/useFileDrop.tsapps/desktop/src/i18n/locales/en.tsapps/desktop/src/i18n/locales/es.tsapps/desktop/src/i18n/locales/it.tsapps/desktop/src/i18n/locales/ja.tsapps/desktop/src/i18n/locales/ko.tsapps/desktop/src/i18n/locales/pt-BR.tsapps/desktop/src/i18n/locales/zh-CN.tsapps/desktop/src/i18n/locales/zh-TW.tsapps/desktop/src/lib/__tests__/app/openTabsPersistence.spec.tsapps/desktop/src/lib/app/openTabsPersistence.tsapps/desktop/src/lib/plugins/frontendPlugin.spec.tsapps/desktop/src/lib/plugins/frontendPlugin.tsapps/desktop/src/lib/plugins/pluginClipboardPermission.spec.tsapps/desktop/src/lib/plugins/pluginClipboardPermission.tsapps/desktop/src/lib/plugins/pluginConnectionChallenge.spec.tsapps/desktop/src/lib/plugins/pluginConnectionChallenge.tsapps/desktop/src/lib/plugins/pluginHostBridge.spec.tsapps/desktop/src/lib/plugins/pluginHostBridge.tsapps/desktop/src/lib/plugins/pluginWorkbenchBridgeRegistry.spec.tsapps/desktop/src/lib/plugins/pluginWorkbenchBridgeRegistry.tsapps/desktop/src/stores/queryStore.tsapps/desktop/src/types/database.tscrates/dbx-core/examples/ssh_plugin_package_smoke.rscrates/dbx-core/src/plugins.rscrates/dbx-core/src/plugins/host.rscrates/dbx-core/src/plugins/manifest.rscrates/dbx-core/src/plugins/runtime.rsplugins/GETTING_STARTED.zh-CN.mdplugins/README.mdplugins/manifest.schema.jsonsrc-tauri/Cargo.tomlsrc-tauri/src/commands/mod.rssrc-tauri/src/commands/plugin_file_transfer.rssrc-tauri/src/lib.rs总计:44 个文件,约
+3004/-79。未包含 SSH/SFTP 插件业务代码,也已移除与 SQL Server 无关的格式差异和不再需要的宽泛 Tauri fs 权限。建议审查顺序
本分支特意整理成三个可独立阅读的提交:
119b99a73 feat(plugin): harden Host API 1.1 security boundaries85b2251ab feat(plugin): centralize workbench routing and lifecycle6931bd2e4 test(plugin): document and verify Host API 1.1已完成验证
target开始执行完整pnpm tauri dev,Windows Debug 客户端成功编译并启动。dbx-corecheck 通过。.dbxp候选包,SHA-256:1ABB446DF830556CD3187E04B5C096C317D9FD5F165049C2F672B90AFC3B2744。已知限制 / 希望维护者重点评估
这些问题是本 RFC 不应直接按“可合并完成态”处理的原因:
connectionId时允许 operation 进入兼容路径。最终协议可考虑强制 connectionId 严格匹配,并校验 challengeId 的格式/来源。confirm完成进程内授权,正式实现宜替换为可国际化的 DBX 全局模态框。ssh_plugin_package_smoke.rs对框架验证很有用,但较偏具体插件;请确认应长期保留在 core、迁到插件仓库,还是改造成通用 fixture。tempfiledev dependency,但测试二进制链接在本机 5 分钟窗口内未完成;Web 无 OPFS 的 1 GiB 边界和多插件拖放仍需浏览器自动化覆盖。希望得到的反馈
workbenchId/restored/workbenchState/acknowledgeRestore的生命周期是否符合 DBX 标签模型。multiple-workbenches、条件表单和 path 字段的 Manifest 形态是否适合作为通用能力。兼容性与边界
1.1.0;未使用新能力的 Host API 1.0 插件行为不变。