Skip to content

feat(database): 数据库模块改造为组织仓库中的独立插件 - #1470

Merged
1lck merged 17 commits into
previewfrom
feat/database-plugin
Oct 24, 2026
Merged

1lck merged 17 commits into
previewfrom
feat/database-plugin

Conversation

@1lck

@1lck 1lck commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

目标

把数据库模块整体改造成组织仓库 Lithe-IDEA/lithe-plugin-database 中的独立插件,先作为社区插件 io.github.lithe-idea.database 在 Lithe Store 上架(官方签名路线从未发布过插件、v2 私钥拿不到,见下文“第 5 期 c”):

  • 只安装 Lithe 时没有任何数据库入口;从插件市场安装“数据库”插件后才能使用;
  • 插件界面是包内网页,后端是 Rust(官方 Rust SDK),一份插件代码;
  • 主仓库只保留通用插件能力,删除全部数据库专属代码(含 Windows 数据库前端);
  • macOS 先上线;Windows 这次不做适配,等 Windows 插件宿主和插件市场就绪后再小幅调整插件。

方案、取舍和已定决策见 .agents/notes/implemented/architecture/2026-10-24-database-provider-plugin.md(本 PR 中从 proposed/ 转为已实现)。

本 PR 合并了此前的 #1466(方案 Note)、#1467(Windows 如实标记)、#1469(生产保护 WHERE 误判),后续进度都以提交形式推到这里。

合并前提(均已满足)

合并后 Lithe 不再自带数据库,所以合并前必须:

  1. ✅ 插件仓库 Lithe-IDEA/lithe-plugin-database 已发布第一个正式版本 v0.1.0(database-0.1.0-darwin.zip,SHA-256 295fd702…03c6)。
  2. ✅ Lithe Store 已收录(chore(index): 收录 Database 0.1.0 Lithe-IDEA/Lithe-store#25 已合并),条目仓库地址为 https://github.com/Lithe-IDEA/lithe-plugin-database。
  3. ✅ macOS 迁移验收通过(见“验证”)。

本 PR 合并后,lithe-plugin-docs#2 与插件仓库的 e2e/lithe-core.json 改锁到 preview 上的合并提交。

进度

  • 第 1 期:方案 Note;Windows 如实标记;生产保护 WHERE 误判
  • 第 2 期:契约:backend 能力、credentials.store 权限、函数协议 v2 宿主凭据服务
  • 第 3 期:macOS 宿主实现:插件后端会话、Keychain 凭据、网页桥接调用本插件后端;lithe-plugin-docs 新增 Rust SDK
  • 第 4 期:组织仓库 lithe-plugin-database(本地仓库已完成,待创建远程仓库后推送)
    • 网页桥接第 2 版加入文件对话框(本 PR 中的宿主改动)
    • 内置模块里顺手修掉的两个后端 bug(见下),插件引擎里同样修复
  • 第 5 期:发布与迁移
    • 插件目录登记数据库插件;老用户数据一次性迁入插件;未安装插件时提示去插件市场
    • 从主仓库删除全部数据库代码(macOS、Rust、Windows、CI、脚本、i18n、矩阵、Note、文档)
    • 改为 Lithe Store 社区插件,迁移只信任 Lithe Store 来源

已提交改动说明

第 1 期

方案 Note

  • 新增方案 Note(本 PR 末尾转为已实现)。已定决策:签名在组织仓库 CI 完成(后在第 5 期 c 改为不签名的社区插件);远程开发第一版只在本机运行后端;Windows 暂不适配;全部工作在本 PR 完成。

Windows:数据库后端未接入时如实标记

  • file-utils.ts:getDatabaseTypeFromPath 在 database 后端能力不可用时返回 null,.db/.sqlite/.duckdb 按普通文件打开(第 5 期中这条分支随 Windows 数据库前端一起删除,测试保留为“按二进制/文本打开”)。

生产保护:WHERE 误判

  • 根因:执行前格式化把 WHERE 换到新行,sidecar 用 contains(" WHERE ") 判断,生产保护连接上所有带 WHERE 的 UPDATE/DELETE 都被拒绝。
  • 改为词法分析(跳过注释/字符串/引号标识符/$$ 块,逐条语句、同层括号判断 WHERE,识别数据修改型 CTE,排除 FOR UPDATE、ON DELETE CASCADE 等)。这套判定已带进插件引擎;sidecar 本身在第 5 期删除。

第 2 期:插件契约(Rust Core)

  • 新能力 backend 1:插件自有、应用全局的长驻进程,以 ${stateDir} 为根目录,复用 serverProcess 启动字段与安装审查,需 backend.launch 权限和网页工具窗,拒绝 ${workspaceStateDir}。
  • 新权限 credentials.store(没有 backend 时无效)。
  • launch plan 新增 backend: true 选择器并返回 backend.hostServices;workspaceStateDirectory 改为可选。
  • 函数协议 v2:lithe/host/credentials/{get,set,delete};Core 校验版本、授权、参数后发 hostRequest,宿主用 lsp.hostResponse(字段 hostRequestID)应答;每会话最多 16 个未应答请求。
  • README、rust-core-api.md、schema、样例与 fixtures 同步。

第 3 期:macOS 宿主

  • MacPluginBackendSessions:每插件一个后端进程,网页首次调用时启动;停用停止、包替换/卸载前停止、设置变化重启。
  • MacPluginCredentialStore:每插件独立 Keychain service,不弹密码框;卸载时删除,停用/更新保留。
  • 网页桥接 functions.* 省略 instance 即调用本插件后端;无后端返回 plugin.web.forbidden。
  • 后端会话测试等待宿主应答改用 continuation + 5 秒看门狗,不再轮询 sleep。
  • 契约 README 列出官方 Rust SDK(lithe-plugin-docs#2)。

第 4 期:网页桥接第 2 版与两个后端修复

  • 桥接 v2 文件对话框:lithe.version 升为 2,新增 dialog.openFile / dialog.saveFile。对话框由宿主弹出并写明发起插件,同一页面同时只开一个,页面只拿到绝对路径(取消为 null),读写交给插件后端;旧宿主返回 plugin.web.unknownMethod。契约 README、网页内容 Note、矩阵 plugin-web-tool-windows 同步。
  • proxyURL:macOS 客户端编码为 proxyURL,sidecar 读的是 proxyUrl,连接的代理设置一直被忽略。改为读 proxyURL。
  • SSH 隧道泄漏:SQL Server、MongoDB 请求打开隧道后从不停止 ssh 客户端,其余数据库只在正常路径停止。SshTunnel 在 drop 时 kill 并回收子进程,覆盖提前返回与所有适配器。

第 5 期 a:数据迁移、安装提示(68f243389)

  • (这次提交里给 OfficialPluginCatalog 加的数据库条目和 Entry.language 重构,已在第 5 期 c 中撤回。)
  • MacDatabasePluginMigration:插件后端首次启动前(MacPluginBackendSessions 新增 prepareState 钩子),一次性把内置模块保存的连接、文件夹、SQL 历史(最近 100 条,时间换算为 1970 毫秒)写入插件 ${stateDir},把“永久保存”的密码从旧 Keychain service 写入插件凭据(键 connection:<id>:password)。
    • 旧数据保留不动,旧版 Lithe 仍可读取;插件已有 connections.json 时以插件为准;写入失败不打标记,下次启动重试;无法迁移的密码只记日志(不含密码),该连接下次重新询问。
    • 旧版“分组”转换成顶层文件夹,与旧模块加载行为一致。
  • 工作台通知可以带一个操作按钮,带按钮的通知在点击前不会自动消失。有已保存连接但没装数据库插件的用户会看到一次提示,带“打开插件市场”按钮。
  • i18n:native.databaseIsNowAPluginInstallItFromTheMarketplace、native.openMarketplace。

第 5 期 b:从主仓库删除数据库代码(本次提交)

macOS 源码

  • 删除 LitheDatabaseModule 模块(库、target、测试 target)、Views/Database/、MacDatabaseAdapters、MacDatabaseRecoveryStore、DatabaseModuleCoordinator、MacDatabaseSidecarLocator、DatabaseBrandIcon、Resources/DatabaseIcons、third_party/dbx。
  • 模块目录:删除 .database 清单与贡献、ModuleID.database、ModuleCapabilityID.databaseWorkspace;shared/fixtures/modules/built-in-v1.json 同步。
  • 工作台:ToolWindow.database / .databaseServices 不再出现在 allCases,右侧停靠只剩 Agent;旧布局恢复映射保留,避免旧存档解码失败。
  • 编辑器标签:删除数据库标签类型、isDatabaseTab、database*Selected 状态;EditorAreaView 去掉数据库视图(ScrollViewReader 不再需要,改为普通 ScrollView);MonacoWorkbenchEditor、JavaProblemsView 去掉 isDatabaseWorkspaceSelected。
  • AppModel:删除数据库协调器、激活/休眠、选择分支,以及 Media/Terminal/AgentConversation/WorkbenchClose/WorkbenchState/PluginManagement 扩展里的数据库代码;editorTabItems 直接取 editorTabOrderFeature.items。
  • ModuleSessionCoordinator:去掉 clearBindings(for: .database);只有 module.shutdown 才关闭窗口,空闲休眠保留可见窗口(渲染层显示加载占位并重新激活模块)。
  • 服务装配:删除 databaseSecureStore、sidecar 路径、模块重新启用的特殊处理和 DatabaseModule 注册;保留迁移所需的旧 Keychain 读取。
  • 主题与编辑器:删除 LitheTheme 的 DatabaseGrid / DatabaseConsole / DatabaseConnectionResult,代码编辑器 gutter 的控制台外观与标记,LitheTextViewportLayout 的控制台行高/光标矩形。
  • GitRepositoryColor.swift:收下原来定义在数据库侧栏里的 Color(hex:)(private)。
  • LitheDropdown、LitheContextMenu:删除只给数据库用的 contentProvidesSurface、fadeInDuration、hasShadow 参数。
  • 有意保留:工作台贡献图标 database(插件用 "icon": {"host":"database"})、.database 文件图标、开发版 profile 迁移里的数据库键。

macOS 测试

  • 删除 LitheDatabaseModuleTests、DatabaseGrid{Appearance,Click}Tests、DatabaseToolbarAppearanceTests、DatabaseWorkspaceLifecycleTests,以及 LitheCoreLogicTests 中 50 个数据库测试及其辅助类型。
  • 原本借用数据库做样例的通用测试改用其他模块/工具窗:ModuleRuntimeTests(search)、WorkbenchFeatureModelTests(agent,改名 agentDocksBesideTheEditor)、ModuleSessionCoordinatorTests(search/git)、WorkbenchContributionHostTests(agent 与自定义 org.example.* 贡献)、TerminalPlacementFeatureModelTests(改名 documentFocusRestoresSelectionAfterTerminal)、OutputTimestamperTests(改名 outputTextAndCopyIgnoreLateEventsOverDivider)。
  • 删除只验证数据库行为的 databaseUsesTheRightDock…、databaseTabsKeep…、internalDatabaseModuleIsNotShownAsAPlugin、savedServicesWindow…、servicesCommandActivatesDatabase…。

Rust

  • 删除 rust/lithe-db-sidecar、rust/lithe-db-mcp,workspace 成员与 Cargo.lock 同步(只有删除,共 132 个包)。

Windows(不做适配,只删除)

  • 删除 features/database/(组件、providers、stores、lib 等 59 个文件)、package-database-sidecars.ts、命令面板 database-actions.tsx。
  • 扩展系统去掉 databases / databaseProviders 贡献类型、Databases 分类与校验;backend-capabilities 去掉 database;tauri-core 去掉数据库命令。
  • 窗格、标签、菜单、侧栏、深链接、右键菜单、Git/AI/文件树等处的数据库分支删除。
  • openBuffer 去掉两个只给数据库用的位置参数,20 处调用同步。

CI 与脚本

  • 删除 .github/workflows/ci-database.yml、infra/docker/database-validation(infra/ 已空)、scripts/{database-validation-smoke,database-sidecar-smoke,build-database-sidecar,build-database-mcp}.sh。
  • package-app.sh、preview.sh、verify-macos-package.sh、measure-macos-performance-baseline.sh 去掉数据库辅助程序和图标;ci-macos.yml 的 dmg 检查改为校验 lithe-mcp。
  • prepare-macos-dependency-cache 的缓存键改用 scripts/build-ide-mcp.sh。
  • classify-ci-changes.sh、plan-ci-lane-reuse.mjs 去掉 database 通道,相应测试同步;verify-module-boundaries.sh、verify-shared-contracts.sh 去掉 database。
  • 必需检查(preview ruleset)只有 “macOS CI gate”,删除 Database CI gate 不影响合并门禁。

i18n

  • 删除仅 macOS 数据库界面使用的 75 条、仅 Windows 数据库前端使用的 202 条;远程开发仍在用的 database.connect/host/port/username/password/optional 保留。重新生成 Localizable.strings 与 shared.generated.ts。

功能矩阵

  • database-{connections,crud-export,multi-schema-tree,query-history,schema}:能力标注“由社区插件提供”(第 5 期 c 中由“官方插件”改过来),owner 改为插件仓库,macOS 证据指向插件宿主代码与 Note,Windows 为 missing / not-applicable。
  • 新增 database-plugin-migration。
  • macos-shared-product-dropdowns、macos-shared-tree-list-control 去掉已删除文件的证据。

Agent Note 与文档

  • 方案 Note 移到 implemented/architecture,状态改为已实现,迁移一节按实际实现重写;6 处代码中的 Note 引用同步。
  • 2026-10-22-database-multi-schema-tree.md 归档(代码已移到插件仓库)。
  • 修正 ci-build-cache(不再有 Database CI gate)、repository-ownership(infra/ 已删除)、public-extension-contract 适用范围、下拉框 Note(删除结果气泡一节)。
  • README(中英)第 17 项改为插件提供,删除数据库截图和内存说明里的数据库辅助程序;docs/ci-builds.md 同步;develop-lithe Skill 去掉 DatabaseGrid token 与数据库辅助程序。
  • 有意不改:docs/design/plugin-settings.html(设计稿)、历史发布说明、issue 模板里的“Database / 数据库”选项。

第 5 期 c:改为 Lithe Store 社区插件(14c909f6e)

  • 原因:官方签名路线(lithe-official-plugins-v2 公钥、release-official-plugins.yml、官方索引)从未发布过插件;v2 私钥在原组织主仓库的维护者手里,那个仓库已改名归档。所以插件先当作社区插件,ID 为 io.github.lithe-idea.database,不带签名。

  • OfficialPluginCatalog 撤回数据库条目,并还原只为它做的 Entry.language 重构(LSPControlCenterView、ModuleRuntimeTests、PluginManagerTests 同步还原)。

  • 迁移的信任边界:社区包的 ID 谁都能用,所以 MacDatabasePluginMigration 不再认 ID,改为认来源。安装记录必须同时满足:

    • origin 是 .community;
    • 市场来源是 Lithe Store(PluginMarketplaceSource.communityID);
    • 索引里的仓库地址是 https://github.com/Lithe-IDEA/lithe-plugin-database。

    从磁盘、其他来源或其他仓库地址安装的同 ID 包得不到旧数据和密码,也不写迁移标记,之后从 Lithe Store 安装仍会迁移。安装文件每次加载都按内容摘要复核。

  • MacPluginBackendSessions 的 prepareState 钩子改为传入安装记录(PluginInstallationRecord),不再只传插件 ID。

  • 插件 ID 与仓库地址常量放在 Application 层的 DatabasePluginTransition,Platform 层的迁移代码引用它。

  • 测试:新增 aCopyFromAnywhereElseReceivesNothing,覆盖磁盘安装、其他来源、其他仓库地址三种情况,并确认之后从 Lithe Store 安装仍会迁移。原有迁移测试改为传入 Lithe Store 的安装记录;后端会话测试的钩子改为接收安装记录。

  • 功能矩阵、README、Agent Note 改为社区插件的说法;Note 记录了暂不做官方签名的原因和新的信任边界,备选方案里补上“官方签名插件”。

  • 插件仓库同步:ID、vendor、去掉签名、下载包改名为 database-<version>-darwin.zip、发布流程改为正式 GitHub Release;删除不再需要的 release environment。

验证

在本地 macOS 上,基于删除提交 922775305 与合并 preview 后的 533423eba:

  • swift build --build-tests:合并前后都能编译通过。
  • 全量 Swift 套件第一次跑时有 307 个测试失败,几乎都是有界等待超时(同时在跑 cargo/npm,机器负载很高)。
    • 空闲时重跑这 307 个:剩 107 个失败,仍是等待超时(DeadlineExceeded、waitUntilOpen 等);
    • 这 107 个再用 --no-parallel 串行跑:105 个通过;
    • 剩下 2 个与本 PR 无关,涉及的源码和测试文件都没改过:
      • gitLogQueryMatchesInclusiveAfterAndExclusiveBeforeDates:按本机时区解析日期,本机是 PDT,CI 是 UTC;
      • PluginUIIconTests.renderedTemplateAndBrandIconsAdaptToThemesAndHostSize:颜色采样受本机显示色彩环境影响。
  • 计时 harness test-stability-macos.sh:覆盖改过的 10 个套件(ModuleRuntime、WorkbenchFeatureModel、TerminalPlacement、ModuleSessionCoordinator、OutputTimestamper、WorkbenchContributionHost、PluginWebBridge、MacDatabasePluginMigration、EditorTabOrder、WorkbenchModuleUIRegistry),184 个全部通过。verify-test-stability.sh 通过。
  • cargo check --locked --workspace --all-targets 通过。仅有的几条警告在 git 模块和 agent-host 里,不是本 PR 引入的。
  • Windows:bunx tsc --noEmit 通过;bun test src/i18n src/config src/platform src/features/window,212 个通过。
  • i18n:generate-i18n.mjs --check 通过,test-i18n.mjs 35 个通过。
  • verify-platform-feature-matrix.sh(204 条)、verify-platform-feature-matrix-change.sh origin/preview HEAD、verify-agent-notes.sh(152 条)、verify-module-boundaries.sh、verify-shared-contracts.sh、verify-runtime-bundle-immutability.sh(test-macos.sh 会先跑它)全部通过。
  • CI 分类器测试、ci-workflow-gates.test.mjs、lane reuse 测试都通过。

合并 preview 时的冲突处理

  • i18n 三个 JSON 按 id 做三方合并:以 preview 为准,去掉本分支删除的 277 个 id,加上本分支新增的 2 个;Localizable.strings 与 shared.generated.ts 重新生成。
  • plugin-web-tool-windows.json:Windows 部分采用 preview 新实现的 ui 2 宿主状态和证据,verification 前面保留文件对话框回归的说明。
  • Windows window-menu-bar.tsx:保留 preview 新增的插件菜单命令,去掉数据库菜单项;有插件菜单命令时才加分隔线。

第 5 期 c 的验证

  • swift build --build-tests 通过。
  • 计时 harness:MacDatabasePluginMigrationTests|MacPluginBackendSessionsTests|WorkbenchNotificationTests|PluginManagerTests|ModuleRuntimeTests|LSPControl 共 76 个测试全部通过。verify-test-stability.sh、矩阵校验与变更门禁、verify-agent-notes.sh 通过。
  • 插件仓库:页面类型检查和测试通过;node scripts/e2e.mjs 用新 ID、不带签名的包跑通 Rust Core 端到端。

手工验收(2026-10-24,191c2729a 记录)

  • 环境:本分支构建的预览版,身份改为开发版 app.lithe.desktop.dev,偏好、Keychain 和插件目录都与正式版隔离;开发版之前从未用过。验收后测试数据全部清除。
  • 步骤:
    1. 写入 3 个旧连接:SQLite 在 Local 文件夹下;Postgres 开了生产保护、密码永久保存;MySQL 用旧的 group 字段、密码只保存到重启。另外写入 1 条历史和 2 条旧密码。
    2. 启动应用,出现“数据库已改为插件”通知,经“打开插件市场”从 Lithe Store 安装 Database 0.1.0。
    3. 重启后打开 Database 工具窗口,3 个连接都在。
  • 核对结果:
    • 安装记录:origin community,来源 Lithe Store,仓库地址和 SHA-256 正确;
    • 插件状态:connections.json 和 sql-history.json,旧 group 变成了顶层文件夹 Reports,历史时间换算正确,connections.json 里没有密码;
    • Postgres 的永久密码进入了插件凭据,MySQL 的“只保存到重启”密码没有迁移;
    • 迁移标记已写入。
  • 功能矩阵 database-plugin-migration 的 macOS 状态改为 verified。其他数据库功能(表编辑、导出等)这次没有逐项验收,保持 pending。
  • 最新提交上手动触发的完整 macOS CI(run 40116504218,14c909f6e)全部通过。

插件功能逐项测试(2026-10-24,插件 0.1.0)

  • 在同一开发版身份下,用电脑操控 Agent 按 15 项清单(T1–T15)逐项测试界面功能。
  • 13 项通过。另外 2 项的问题已在插件 v0.1.1 修复,都在插件仓库,本 PR 代码不受影响:
    • SQLite 表达式列(如 1 + 1、字面量)显示 <unsupported>:后端按声明类型解码,这类列没有声明类型。改为按值的存储类型解码,并加了回归测试。
    • 表格双击 / 回车不能编辑:表格把列数组的对象身份当作“新结果”,父组件每次重渲染都会清掉编辑状态。改为按列名判断,并加了测试。
  • 顺带修复:SQL 备份文件头不再写旧的 lithe-db-sidecar。
  • 窗口位置恢复一项因测试工具无法重开应用没测到,与插件无关。
  • 数据库功能的矩阵条目仍保持 pending,没有改成 verified。

尚未做

  • Windows 不做适配(已定决策)。

🤖 Generated with Claude Code

1lck and others added 4 commits October 24, 2026 05:21
记录数据库模块的双端评估(规则三份不一致、Windows 从未接上后端)
和插件化方案:组织仓库独立插件、网页界面、Rust 后端、官方签名,
主仓库只提供插件后端、宿主凭据、MCP 声明等通用能力。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows 的数据库后端从未接入(backend-capabilities 中 database 为 false,
前端调用的数据库命令没有原生实现),但 .db/.sqlite/.duckdb 文件仍被送进
数据库查看器,功能矩阵也标为 implemented。

- getDatabaseTypeFromPath 遵循同一能力开关,后端不可用时这类文件走普通
  二进制/文本路由,打开与会话恢复共用此判断
- 功能矩阵中 Windows 的四项数据库能力改为 missing / not-applicable
- README 注明数据库工作台目前仅支持 macOS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- sidecar 的危险 SQL 判定从字符串前缀/" WHERE " 匹配改为词法分析:去掉注释、
  字符串、引号标识符和 $$ 块;按语句逐条检查;WHERE 必须直接限定该
  UPDATE/DELETE(子查询里的 WHERE 不算);识别 WITH ... DELETE 与数据修改型
  CTE;DROP/TRUNCATE(含 ALTER ... DROP)需要确认;排除 FOR UPDATE、
  ON DELETE CASCADE、GRANT、MySQL TRUNCATE() 等非写入用法;MySQL/MariaDB
  与 PostgreSQL E'' 字符串按反斜杠转义处理,SQL Server 识别 [标识符]。
- 修复根因:执行前格式化会把 WHERE 换到新行,旧判定只认 " WHERE ",导致
  生产保护连接上所有带 WHERE 的 UPDATE/DELETE 都被拒绝。
- sidecar 新增不连库的 checkWriteProtection 方法;macOS 在生产保护连接执行写入
  前先问后端,需要确认时弹出原有确认框,避免批量执行到一半被拒。
- 补充 Rust 金样例测试与 Swift 预检测试。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1lck and others added 5 commits October 24, 2026 05:49
- 新增 level 3 能力 `backend` 1:插件自有的长驻进程,复用 serverProcess
  启动字段与安装审查(packagedBackend 等),需 `backend.launch` 权限和
  web 工具窗,不绑定 workspace(拒绝 ${workspaceStateDir})
- 新增权限 `credentials.store`,无 backend 时声明即无效
- launch plan 支持 `backend: true` 选择器,返回 `backend.hostServices`;
  `workspaceStateDirectory` 改为可选,仅在进程用到时必填
- 插件函数协议 v2:`lithe/host/credentials/{get,set,delete}`,Core 校验
  版本、授权与参数(key 字母表/长度、secret ≤16 KiB、拒绝未知字段),
  通过 `hostRequest` 事件交给宿主,宿主用新命令 `lsp.hostResponse` 应答;
  每会话最多 16 个未应答请求
- `lsp.startServer.hostServices` 传入授予的服务
- 契约 README、rust-core-api、schema、fixture 与黄金用例同步更新

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- 修正“Agent 到 app 里查找 lithe-db-mcp”的描述:它只被打包,从未被启动
- 记录后端每插件一个进程、宿主全局、授权由安装审查覆盖等取舍
- 凭据生命周期:停用/更新保留,卸载删除
- 按平台可执行文件不改契约;Agent 工具后续经现有 lithe MCP 暴露
- 待确认清空

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- 新增 MacPluginBackendSessions:每个插件一个后端进程、应用全局共享,
  由插件网页首次调用 functions.* 时按需启动,以 ${stateDir} 为根目录和
  工作目录;插件停用时停止、重新启用后可再启动,包替换/卸载前停止且本次
  运行不再启动;设置变化时重启
- 后端会话以 hostServices 启动;LanguageServerRuntimeSession 处理
  hostRequest 事件并经新命令 lsp.hostResponse 应答(离开主线程发送)
- 新增 MacPluginCredentialStore:每个插件独立的 Keychain service,
  读取不弹密码框;卸载时随插件状态目录一起删除,停用/更新保留
- 网页桥接:functions.list/invoke 省略 instance 时调用本插件后端,
  不弹同意框(安装审查已覆盖);无后端的插件返回 plugin.web.forbidden
- 安装时校验后端打包可执行文件;hostCapabilities 声明 backend: [1]
- Swift 契约:launch request 的 workspaceStateDirectory 可为空、
  backendLaunchPlan、descriptor.declaresBackend、事件携带 method
- Core 修正:lsp.hostResponse 的字段按契约拼写为 hostRequestID,
  测试改为从线上 JSON 解码以覆盖字段名
- README 更新 macOS 宿主能力说明

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ead of polling

The test-stability gate rejects real-time sleeps. The scripted Core now
resumes waiters as answers arrive, with a five-second watchdog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sdk/rust in lithe-plugin-docs implements plugin-function protocols 1 and 2
with the credentials host service for packaged plugin backends, and its
sample backend runs an end-to-end scenario against Core.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1lck and others added 7 commits October 24, 2026 07:39
The client encodes DatabaseConnection.proxyURL as `proxyURL`, but the
sidecar's serde camelCase name was `proxyUrl`, so a connection's proxy
command was silently dropped and connections went direct. The field now
reads `proxyURL` and still accepts `proxyUrl`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SQL Server and MongoDB requests opened a tunnel and never stopped its ssh
client, so each such request left an orphaned ssh process holding the
local port after the sidecar exited. MySQL, PostgreSQL, SQLite, Redis,
and Nacos stopped it only on their normal path. SshTunnel now kills and
reaps the client when dropped, which covers early returns and every
adapter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
插件后端是无界面的子进程,数据库插件导入导出、备份恢复和 DBX 导入都需要
用户选文件。桥接版本升为 2(lithe.version),新增 dialog.openFile 与
dialog.saveFile:对话框由宿主弹出并写明发起的插件,同一页面同时只开一个,
页面只拿到用户选中的绝对路径(取消为 null),读写交给插件后端;页面在对话框
打开期间关闭则拿不到结果。旧宿主返回 plugin.web.unknownMethod,页面据版本号
决定是否提供导入导出。

同步更新插件契约 README、网页内容 Agent Note 与跨平台功能矩阵。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s data into it

- OfficialPluginCatalog lists dev.lithe.plugin.database as a publisher
  package downloaded from the marketplace; language-only fields move into
  an optional Entry.language, so a non-language plugin needs none.
- MacDatabasePluginMigration moves the former module's connections,
  folders, SQL history, and forever-kept passwords into the plugin's
  ${stateDir} and credentials once, before its backend first starts
  (MacPluginBackendSessions gains a prepareState hook). The old data stays
  for older Lithe versions; the plugin's own state always wins.
- Workbench notifications can carry one action and then stay until used.
  People with saved connections and no database plugin get one prompt
  with an "Open Marketplace" action.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in now

Lithe no longer ships a database module. The official plugin
dev.lithe.plugin.database (Lithe-IDEA/lithe-plugin-database) replaces it,
and the earlier commit moves saved connections into it.

- macOS: delete LitheDatabaseModule, the database views, adapters,
  recovery store, coordinator, sidecar locator, brand icons, dbx fixtures,
  and the database tool windows, editor tabs, theme tokens, console gutter
  and AppModel branches. Generic tests that used the database as a sample
  now use other modules. Dropdown/context-menu parameters only the database
  used are gone. Idle sleep keeps a visible module window open; only
  shutdown closes it.
- Rust: delete lithe-db-sidecar and lithe-db-mcp.
- Windows: delete features/database and its sidecar packaging, the
  databases extension contribution, and every database branch; openBuffer
  loses its two database-only parameters. No plugin adaptation yet.
- CI and scripts: delete the database workflow, validation docker setup
  and sidecar/MCP build and smoke scripts; packaging, preview, verifiers,
  CI change classification and lane reuse drop the database.
- i18n: drop strings only the removed UIs used and regenerate.
- Feature matrix, Agent Notes, README, docs and Skill: the database is an
  official plugin; the plugin note is implemented, the multi-schema tree
  note is archived.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	macos/Resources/en.lproj/Localizable.strings
#	macos/Resources/zh-Hans.lproj/Localizable.strings
#	shared/i18n/locales/en-US.json
#	shared/i18n/locales/zh-CN.json
#	shared/i18n/messages.json
#	shared/platform-feature-matrix/features/plugin-web-tool-windows.json
#	windows/tauri/src/features/window/components/window-menu-bar.tsx
Lithe's official signing path has never released a plugin and its v2
private key is out of reach, so the Database plugin is a community
plugin (io.github.lithe-idea.database, unsigned) listed in Lithe Store
like the other seven.

- OfficialPluginCatalog no longer lists the database plugin; the optional
  Entry.language refactor that only it needed is reverted.
- An unsigned plugin ID proves nothing, so MacDatabasePluginMigration now
  moves the old connections and passwords only into a copy installed from
  Lithe Store whose index entry names Lithe-IDEA/lithe-plugin-database.
  A copy from disk or another source gets nothing and leaves no marker,
  so installing from Lithe Store later still migrates. The backend
  sessions' prepareState hook receives the installation record for this.
- Feature matrix, README and the Agent Note describe the community plugin,
  why official signing is deferred, and the new trust boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The migration from the former built-in module was accepted on a macOS
development-identity build: the one-time notice, installing Database 0.1.0
from Lithe Store, and the connections, folders, history, and passwords
arriving in the plugin as the Agent Note describes. The matrix marks the
migration row verified on macOS; the other database rows stay pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@1lck
1lck marked this pull request as ready for review October 24, 2026 19:36
@lithe-code-review

lithe-code-review Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Lithe Review

结论: ❓ 审查未完成

任务: 336

审查状态:已由服务器取消

可以重新评论 @lithe review 召唤。维护者可通过任务编号查看服务器日志。

@1lck
1lck merged commit d046fd1 into preview Oct 24, 2026
23 of 25 checks passed
1lck added a commit to Lithe-IDEA/lithe-plugin-docs that referenced this pull request Oct 24, 2026
…plugin)

Lithe preview merged 1lck/Lithe-IDEA#1470. The mirror now matches that merge
commit: web bridge 2 file dialogs (dialog.openFile, dialog.saveFile) and the
current Windows WebView2 status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1lck added a commit to Lithe-IDEA/lithe-plugin-database that referenced this pull request Oct 24, 2026
1lck/Lithe-IDEA#1470 is merged; the end-to-end test now runs against that
merge commit instead of a commit of its branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: high ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant