Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
13428e6
docs(notes): 提议把数据库拆成双端共用的独立插件
1lck Oct 24, 2026
829c729
fix(windows): 数据库后端未接入时如实标记并按普通文件打开
1lck Oct 24, 2026
4a339fa
fix(database): 生产保护按词法判定危险 SQL,执行前先由后端确认
1lck Oct 24, 2026
46fcda5
docs(notes): 记录数据库插件化的签名、远程开发与 Windows 决策
1lck Oct 24, 2026
8471b99
feat(plugins): 插件后端能力与函数协议 v2 宿主凭据服务
1lck Oct 24, 2026
749cf9d
docs(notes): 记录插件后端、协议 v2 凭据与 Agent 工具走 lithe MCP 的决策
1lck Oct 24, 2026
173c791
feat(macos): 宿主运行插件后端并通过 Keychain 提供凭据服务
1lck Oct 24, 2026
f8ae616
test(macos): wait for backend host responses with a continuation inst…
1lck Oct 24, 2026
ce175e0
docs(plugins): list the Rust SDK for plugin backends in the contract
1lck Oct 24, 2026
1017b6d
fix(database): read the proxy URL the macOS client sends
1lck Oct 24, 2026
d1d29d5
fix(database): end the SSH tunnel client with the request on every path
1lck Oct 24, 2026
de36083
feat(plugins): 插件网页桥接第 2 版加入文件对话框
1lck Oct 24, 2026
68f2433
feat(plugins): list the database plugin and move the built-in module'…
1lck Oct 24, 2026
9227753
refactor: remove the built-in database module; the database is a plug…
1lck Oct 24, 2026
533423e
Merge remote-tracking branch 'origin/preview' into feat/database-plugin
1lck Oct 24, 2026
14c909f
feat(plugins): ship Database as a Lithe Store community plugin
1lck Oct 24, 2026
191c272
docs(database): record the macOS acceptance of the plugin migration
1lck Oct 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Agent 笔记:MySQL 连接下的多数据库树

状态:已实现
归档日期:2026-10-24

## 归档原因

macOS 内置数据库模块已删除,数据库改由官方插件 `dev.lithe.plugin.database` 提供,多数据库树和“显示哪些库”的选择在插件网页里重新实现。本 Note 描述的 SwiftUI 侧栏、`DatabaseFeatureModel` 和对应测试都已不存在。当前决策见[数据库拆成双端共用的独立插件](../../implemented/architecture/2026-10-24-database-provider-plugin.md)。

## 先说结论

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Swift 源码,也不得依赖 macOS 类型。
| `Plugins/win/` | Windows 所有的插件包 |
| `frontend/editor/` | 两端共同依赖的 Monaco 表现层、分词与编辑器模型;不调用平台 API |
| `shared/` | 跨平台契约和夹具,不放编译实现 |
| `infra/` | 仓库级开发和验证基础设施 |
| `third_party/` | 固定版本的上游清单和必要的局部源码补丁 |

应用层依赖方向如下:
Expand Down Expand Up @@ -272,5 +271,4 @@ Core 操作会随协议演进持续增加,逐个新增 Tauri command 会在
- `shared/`
- `frontend/editor/`
- `scripts/`
- `infra/`
- `third_party/`
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@

### 桥接对象

宿主在页面脚本执行前注入 `window.lithe`(第 1 版):`context`、`request(method, params)` 和 `on(event, listener)`。方法和事件的全集写在 `shared/contracts/plugins/v1/README.md` 的 “Web content (`ui` 2)” 一节,这里只记录边界:
宿主在页面脚本执行前注入 `window.lithe`(当前第 2 版,`lithe.version` 给出版本号):`context`、`request(method, params)` 和 `on(event, listener)`。方法和事件的全集写在 `shared/contracts/plugins/v1/README.md` 的 “Web content (`ui` 2)” 一节,这里只记录边界:

- 页面只能操作本插件声明的构建系统和当前工作区,越界返回 `plugin.web.forbidden`。
- 凡是会启动进程的请求(刷新模型、跑任务、跑测试),都要经过与宿主自身按钮相同的信任和同意流程,输出进入宿主的 Build Output。页面不能提交或修改进程 argv,也不能自己拼命令;模型保留 Core 返回的声明运行项 `run` 和任务 `category` 供展示,执行入口仍只有宿主校验过的任务与测试。
- 选项写入沿用 `build.resolveOptions` 和宿主的选项存储,因此构建选项转交给 JDT 的方式与宿主自己的选项列表一致。
- 第 2 版只多了文件对话框 `dialog.openFile` / `dialog.saveFile`,供数据库这类带后端的插件导入导出文件。对话框由宿主弹出,说明里写明是哪个插件在请求;同一页面同时只能开一个;页面只拿到用户选中的绝对路径,真正的读写交给插件后端,页面本身仍然碰不到文件。页面在对话框打开期间被关闭,就拿不到选择结果。旧宿主没有这两个方法(返回 `plugin.web.unknownMethod`),所以页面先看 `lithe.version` 再决定是否提供导入导出。之所以加桥接方法而不是让后端自己弹窗,是因为后端是无界面的子进程,弹窗必须由宿主窗口负责,也只有宿主能把插件身份写进对话框,防止页面冒充 Lithe。

### 正确做法

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ macOS runner(GitHub 托管的 Mac 构建机)按组织共享,Free 计划同
5 个 macOS job,超出的 job 只能排队。排队不是配额耗尽,也不是滥用信号,
但会拖慢所有 PR 的反馈。因此:

- 主 Swift 测试和数据库 Swift 测试共用 macOS CI 的 **Swift tests** job,只执行
- 主 Swift 测试和 Rust Core 桥接检查共用 macOS CI 的 **Swift tests** job,只执行
一次 `./scripts/test-macos.sh list` 编译,再按分类结果运行各自的过滤测试。
过去数据库 job 单独编译约 10 分钟,只为运行十几秒测试。Database CI 只保留
Linux 上的 Rust 数据库测试和 gate。
过去独立的数据库 job 单独编译约 10 分钟,只为运行十几秒测试;数据库改为插件
后,这条 lane 和 Database CI 已一起删除。
- 远程工作区的三个 crate(`lithe-remote-*`)走独立的 Remote Workspace CI,只在
Linux 上运行。Linux runner 能执行服务的 Linux 适配器,同时交叉检查 macOS 目标,
所以不需要为它申请 macOS runner;这些 crate 暂未被产品链接,改动它们也不会触发
Expand Down Expand Up @@ -356,11 +356,11 @@ macOS CI 失败来修复。
插件过滤测试和官方插件打包验证串进主 Swift job,延长包含插件改动的 PR 的
主反馈路径,因此插件 CI 保持独立并依赖分类器跳过。

### 用 workflow 的 `paths` 过滤跳过插件或数据库 CI
### 用 workflow 的 `paths` 过滤跳过插件 CI

`Plugin CI gate` 和 `Database CI gate` 是 `preview` ruleset 的必需检查。
workflow 被 `paths` 过滤掉后不会上报状态,PR 会一直等待这个检查,因此继续
使用“Linux 分类 job + gate”的方式:未选中时 gate 在 Linux 上几秒内通过。
gate 检查一旦被设为 `preview` ruleset 的必需检查,workflow 被 `paths` 过滤掉后
就不会上报状态,PR 会一直等待这个检查,因此继续使用“Linux 分类 job + gate”的
方式:未选中时 gate 在 Linux 上几秒内通过。

### 为所有 CI 任务强制上传完整安装包

Expand Down Expand Up @@ -403,7 +403,7 @@ Swift 测试已经编译完整 Lithe 目标。再生成两个 DMG 会在普通

## 验证

- `actionlint .github/workflows/ci-macos.yml .github/workflows/ci-windows.yml .github/workflows/ci-database.yml .github/workflows/ci-plugins.yml .github/workflows/ci-remote.yml`
- `actionlint .github/workflows/ci-macos.yml .github/workflows/ci-windows.yml .github/workflows/ci-plugins.yml .github/workflows/ci-remote.yml`
- `./scripts/test-classify-ci-changes.sh`:包含 Draft PR 关闭 runner lane、保留 Linux lane,以及 macOS Java 不触发 real-JDT、共享引擎和 Windows Java 仍触发的正反例。
- `node --test scripts/ci-workflow-gates.test.mjs scripts/plan-ci-lane-reuse.test.mjs scripts/verify-reused-ci-jobs.test.mjs`:从实际工作流执行 gate shell,验证取消条件、分类/测试失败、lane 覆盖及复用来源的失败传播。
- `node --test scripts/cancel-closed-pr-runs.test.mjs`:用离线 GitHub CLI 替身执行关闭清理,验证分页历史运行、来源隔离、关闭时间、取消竞争和 API 失败传播。
Expand All @@ -429,7 +429,6 @@ Swift 测试已经编译完整 Lithe 目标。再生成两个 DMG 会在普通
- `docs/ci-builds.md`
- `.github/workflows/ci-macos.yml`
- `.github/workflows/ci-windows.yml`
- `.github/workflows/ci-database.yml`
- `.github/workflows/ci-remote.yml`
- `.github/workflows/ci-plugins.yml`
- `scripts/classify-ci-changes.sh`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1930,9 +1930,6 @@ JDT Run marker 的测试元数据,不根据文件名包含 Test 推断。深

数据库范围列表复用共享树样式,不使用普通菜单行。Git 原有的 IDEA 三态复选框提升为 `LitheTreeCheckbox`,仍消费原 `commit/checkBox*.svg` 的完整深浅/焦点/禁用状态,Git 调用显式传入提交语义,Run 浏览器沿用批量选择语义;数据库通过可选标题组成完整可点击树行。`LitheSettingsCheckbox` 保持设置页原行为,不增加菜单专用变体。范围列表使用 `litheTreeRow` 与共享树边距,底部说明复用弹层背景;整个选择面板局部禁用小手,入口徽标保留小手且没有悬停提示。数据库宿主回归在库名右侧空白发送真实鼠标事件,Git 原资源检查继续覆盖全部状态。

### 2026-10-23 结果气泡保留宿主、独立绘制表面

数据库测试结果并非菜单。`LitheDropdownPopover.contentProvidesSurface` 默认为 false,仅该结果气泡显式启用,跳过 `litheContextMenuSurface` 的背景/圆角/字体包装;仍复用现有 presenter 的定位、父子窗口、键盘/外部点击关闭与销毁。不改普通菜单背景或全局圆角,不复制窗口生命周期。气泡的 Community 来源、locale 字体分支与截图适配边界见[数据库多库树 Note](../feature/2026-10-22-database-multi-schema-tree.md)。用 ContextMenuCoverageTests 验证默认调用者,数据库深浅主题像素检查验证背景、边框、指针和透明底带。
### 公共树的展开入口补齐(2026-10-21)

项目树与声明式插件树共用 `LitheTreeDisclosureIcon`,由它持有原始 chevron SVG、
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Services 接入容器、Spring Boot、数据库和本地服务。后续统一设
- `macos/Sources/LitheApplicationKernel/`
- `macos/Sources/Lithe/Platform/MacOS/MacServiceContainer.swift`
- `macos/Sources/Lithe/Views/Workbench/`
- `macos/Sources/Lithe/Views/Database/`
- `windows/`

## 跟踪任务
Expand Down
4 changes: 2 additions & 2 deletions .agents/skills/develop-lithe/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ the existing stack can reasonably avoid.
- Keep selection distinct from checkbox inclusion, chosen settings values,
status badges, activity-rail buttons, menu highlight, tool-window tabs and
editor text selection. Those retain their owning styles; tool-window tabs
use `LitheToolWindowTabStyle`, tables use `DatabaseGrid` tokens. Do not add
use `LitheToolWindowTabStyle`. Do not add
persistent selection to a view that does not already have it. Verify dark/light
focused/inactive rows, focus moving to a neighboring list or editor, whole
window deactivation and reactivation, keyboard navigation, and shared field
Expand Down Expand Up @@ -396,7 +396,7 @@ The decision and owning components are recorded in
#### Rust Core comments

Apply the following comment standard to first-party code under
`rust/lithe-core/`. It does not require comment coverage in the database helpers,
`rust/lithe-core/`. It does not require comment coverage in other helper crates,
Windows/Tauri Rust crates, generated code, or third-party sources.

- Write comments in English and keep them accurate when behavior changes.
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/prepare-macos-dependency-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ runs:
env:
KEY_PREFIX: macos-cargo-build-v1-${{ runner.arch }}-${{ steps.cargo_build_identity.outputs.identity }}
BUILD_ARCHITECTURE: ${{ inputs.cargo-build-architecture }}
SOURCE_HASH: ${{ hashFiles('rust/Cargo.lock', 'rust/**/Cargo.toml', 'rust/.cargo/**', 'scripts/build-rust-core.sh', 'scripts/build-database-*.sh') }}
SOURCE_HASH: ${{ hashFiles('rust/Cargo.lock', 'rust/**/Cargo.toml', 'rust/.cargo/**', 'scripts/build-rust-core.sh', 'scripts/build-ide-mcp.sh') }}
run: |
echo "prefix=$KEY_PREFIX" >> "$GITHUB_OUTPUT"
echo "key=$KEY_PREFIX-$BUILD_ARCHITECTURE-$SOURCE_HASH" >> "$GITHUB_OUTPUT"
Expand All @@ -243,7 +243,7 @@ runs:
continue-on-error: true
uses: actions/cache/restore@v6
with:
# Core uses target/macos; database helpers use target directly. Include
# Core uses target/macos; the MCP helper uses target directly. Include
# both layouts, while leaving final executables for Cargo to regenerate.
path: |
rust/target/**/.fingerprint
Expand Down
145 changes: 0 additions & 145 deletions .github/workflows/ci-database.yml

This file was deleted.

Loading
Loading