diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 91024cc56..cfb2e7324 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -87,6 +87,19 @@ jobs:
- name: Test
run: pnpm run test:all
+ # The container image builds the server without Tauri.
+ - name: Check the server-only build
+ working-directory: src-tauri
+ run: cargo check --locked --no-default-features --bin tabularis
+
+ - name: Keep Tauri inside the desktop transport
+ run: |
+ if grep -rnE '(^|[^_[:alnum:]])tauri(::|_plugin)' src-tauri/src --include='*.rs' \
+ --exclude-dir=desktop | grep -v 'tauri::mobile_entry_point\|async_runtime\|tauri::test::'; then
+ echo "::error::Tauri code belongs in src-tauri/src/transport/desktop/ (see .rules/rust.md)"
+ exit 1
+ fi
+
web-e2e:
runs-on: ubuntu-24.04
diff --git a/.rules/rust.md b/.rules/rust.md
index f7a3ae356..b2245bbf1 100644
--- a/.rules/rust.md
+++ b/.rules/rust.md
@@ -6,3 +6,4 @@
4. **Separate Rust tests from implementation:** When a module has non-trivial tests, place them in a sibling `tests.rs` file (or `tests/*.rs` when the module grows further) and load them with `#[cfg(test)] mod tests;`.
5. **Test extracted helpers directly:** Every extracted pure helper or parser should have unit tests covering nominal cases, edge cases, and unsupported inputs when relevant.
6. **Avoid behavioural refactors mixed with structural refactors:** When reorganizing Rust files, keep function signatures and runtime behaviour stable unless the task explicitly asks for behaviour changes.
+7. **Keep Tauri in the desktop transport:** Tauri commands, plugins and anything that takes an `AppHandle`, `Window` or `State` live in `src-tauri/src/transport/desktop/`, which is the only module behind the `desktop` feature. Put the logic in `application/` (or a plain module) so the web RPC and the desktop command share it; the command stays a thin wrapper.
diff --git a/AGENTS.md b/AGENTS.md
index 8b29320be..d2136407b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,5 +1,8 @@
# AGENTS.md
+> [!IMPORTANT]
+> **The backend layout changed (October 2026).** All Tauri code now lives in `src-tauri/src/transport/desktop/`, and desktop commands are thin wrappers over `src-tauri/src/application/`. Read [Backend layout](#backend-layout-desktop-and-web-transports) before you start, rebase, or review a PR that touches `src-tauri/`.
+
## Directives
Adhere to the rules defined in the [rules directory](./.rules/):
- [General Rules](./.rules/general.md) (Logging & Language)
@@ -14,6 +17,27 @@ Adhere to the rules defined in the [rules directory](./.rules/):
When reviewing pull requests, follow [REVIEW.md](./REVIEW.md).
+## Backend layout: desktop and web transports
+
+The Rust backend serves two transports over the same React frontend:
+
+- **Tauri desktop app:** `src-tauri/src/transport/desktop/`
+- **`tabularis web` server:** `src-tauri/src/transport/web/`
+
+Shared logic lives in `src-tauri/src/application/` (and plain modules), so the app and the web behave the same.
+
+- **Tauri code goes in `transport/desktop/` only.** That covers `#[tauri::command]`, `tauri_plugin_*`, and anything taking an `AppHandle`, `Window` or Tauri `State`. It is the only module behind the `desktop` cargo feature; `cargo build --no-default-features` builds the server without Tauri.
+- **A desktop command is a thin wrapper over `application/`.** Implement the behaviour there, call it from the desktop command, and give the web RPC (`transport/web/rpc.rs`) a route to the same function.
+- **The desktop command registry is in `transport/desktop/mod.rs`** (`run()` and `generate_handler!`), not in `lib.rs`.
+- **CI enforces the boundary:** `cargo check --no-default-features` must pass, and a grep fails the build when `tauri::` or `tauri_plugin` appears outside `transport/desktop/`. See rule 7 in [Rust Rules](./.rules/rust.md).
+
+**Branches and PRs started before this layout:**
+- Rebase onto it.
+- Move new or changed Tauri commands from `commands.rs`, `config.rs` and the like into the mirrored file under `transport/desktop/`.
+- Drop `#[cfg(feature = "desktop")]` and `#[cfg_attr(feature = "desktop", tauri::command)]` from shared modules.
+- Register commands in `transport/desktop/mod.rs`.
+- Check for these commands, which had no frontend caller and were removed: `list_all_preferences`, `get_theme`, `save_blob_to_file`, `preview_tabularis_import`, `apply_tabularis_import`, `export_connections_payload`, `import_connections_payload`, `encrypt_export_payload`, `decrypt_export_payload`, `open_visual_explain_window`, `open_json_viewer_window`, `get_json_viewer_session`, `complete_json_viewer_session`, `open_results_window` and `close_results_window`.
+
# GitNexus — Code Intelligence
diff --git a/docker/Dockerfile b/docker/Dockerfile
index c92a2251f..7ee39cdae 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -3,8 +3,9 @@
# Tabularis Web as a container image:
# docker build -f docker/Dockerfile -t tabularis .
#
-# The binary still links WebKitGTK (Tauri is not optional), so the runtime
-# carries those shared libraries even though `tabularis web` never opens a window.
+# The server is built without the desktop app, so the image carries no GUI
+# libraries. Debian rather than Alpine: registry driver plugins are glibc
+# binaries and do not run on musl, not even through gcompat.
ARG NODE_VERSION=24.18.0
ARG DEBIAN_VERSION=trixie
@@ -24,55 +25,36 @@ RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
&& pnpm build
# ── Server ───────────────────────────────────────────────────────────────────
+# Built without the `desktop` feature: no Tauri, GTK or WebKitGTK, only the
+# `tabularis web` and `--mcp` entry points.
FROM rust:1-${DEBIAN_VERSION} AS server
+ARG TABULARIS_BUILD_COMMIT=
RUN apt-get update \
- && apt-get install -y --no-install-recommends \
- libwebkit2gtk-4.1-dev libgtk-3-dev libsoup-3.0-dev libdbus-1-dev \
- pkg-config perl make \
+ && apt-get install -y --no-install-recommends libdbus-1-dev pkg-config perl make \
&& rm -rf /var/lib/apt/lists/*
-
-# Reported by the server contract (`option_env!`); empty for local builds.
-ARG TABULARIS_BUILD_COMMIT=
WORKDIR /src
-# The crate embeds the built frontend (`tauri::generate_context!`) and a few
-# JSON schemas from outside src-tauri.
+# JSON schemas and themes the crate embeds from outside src-tauri.
COPY plugins/manifest.schema.json ./plugins/manifest.schema.json
COPY packages/web-ui/src/schemas ./packages/web-ui/src/schemas
COPY packages/web-ui/src/themes ./packages/web-ui/src/themes
-COPY --from=web-ui /src/packages/web-ui/dist ./packages/web-ui/dist
COPY src-tauri ./src-tauri
RUN --mount=type=cache,id=cargo-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=cargo-target,target=/src/src-tauri/target \
cd src-tauri \
- && cargo build --release --locked --bin tabularis \
+ && cargo build --release --locked --no-default-features --bin tabularis \
&& install -Dm755 target/release/tabularis /out/tabularis
-# ── Shared libraries ─────────────────────────────────────────────────────────
-# Installing WebKitGTK drags in Mesa/LLVM, GStreamer, speech synthesis and more
-# (~700 MB) that `tabularis web` never loads: GTK is never initialised. Only
-# the libraries the binary links (its `ldd` closure) go into the runtime,
-# under their canonical directory so merged-/usr symlinks such as /lib stay.
-FROM debian:${DEBIAN_VERSION}-slim AS libs
-RUN apt-get update \
- && apt-get install -y --no-install-recommends libwebkit2gtk-4.1-0 libdbus-1-3
-COPY --from=server /out/tabularis /usr/bin/tabularis
-RUN mkdir /libs \
- && ldd /usr/bin/tabularis | awk '/=> \// { print $3 }' | while read -r lib; do \
- dir="$(readlink -f "$(dirname "$lib")")"; \
- mkdir -p "/libs$dir" && cp -L "$lib" "/libs$dir/"; \
- done
# ── Runtime ──────────────────────────────────────────────────────────────────
FROM debian:${DEBIAN_VERSION}-slim
RUN apt-get update \
- && apt-get install -y --no-install-recommends ca-certificates curl tini openssh-client \
+ && apt-get install -y --no-install-recommends \
+ ca-certificates curl tini openssh-client libdbus-1-3 \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --system --uid 10001 --user-group --home-dir /data --no-create-home tabularis \
&& install -d -o 10001 -g 10001 -m 0750 /data
-COPY --from=libs /libs/ /
COPY --from=server /out/tabularis /usr/bin/tabularis
-# Fails the build if a linked library is missing.
-RUN ldconfig && tabularis --help >/dev/null
+RUN tabularis --help >/dev/null
COPY --from=web-ui /src/packages/web-ui/dist /usr/lib/tabularis/web-ui
COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
ENV HOME=/data \
diff --git a/packages/web-ui/src/api/contract.ts b/packages/web-ui/src/api/contract.ts
index 3a5db3008..d59bf2f53 100644
--- a/packages/web-ui/src/api/contract.ts
+++ b/packages/web-ui/src/api/contract.ts
@@ -806,7 +806,7 @@ export interface CommandMap {
>;
run_connections_backup: CommandDefinition<
undefined,
- string | BackupRunResult,
+ BackupRunResult,
"sensitive"
>;
diff --git a/packages/web-ui/src/components/modals/NewConnectionModal.tsx b/packages/web-ui/src/components/modals/NewConnectionModal.tsx
index 1ee447eda..8654e3e24 100644
--- a/packages/web-ui/src/components/modals/NewConnectionModal.tsx
+++ b/packages/web-ui/src/components/modals/NewConnectionModal.tsx
@@ -673,7 +673,13 @@ export const NewConnectionModal = ({
activeDriver?.capabilities?.no_connection_required === true;
// A raw URI is self-contained: it carries the database (or deliberately omits
// it, as Atlas URIs do) and the credentials, so it replaces those form fields.
- const hasConnectionUri = !!formData.connection_uri?.trim();
+ // The browser never receives a stored URI. The backend keeps it on save as
+ // long as the driver is unchanged, so it still counts as present.
+ const hasStoredConnectionUri =
+ formData.connection_uri_in_keychain === true &&
+ initialConnection?.params.driver === driver;
+ const hasConnectionUri =
+ !!formData.connection_uri?.trim() || hasStoredConnectionUri;
// Drivers with the `connection_uri` capability consume the raw URI verbatim:
// host/port/username/database all derive from it, so the form only asks for
// the connection string and an optional token (password) field.
@@ -2902,7 +2908,11 @@ export const NewConnectionModal = ({
"flex-1 px-3 py-2 bg-base border rounded-md text-sm text-primary placeholder:text-muted placeholder:italic focus:border-focus focus:outline-none transition-colors",
connectionStringError ? "border-accent-error" : "border-strong",
)}
- placeholder={connectionStringPlaceholder}
+ placeholder={
+ hasStoredConnectionUri && !formData.connection_uri
+ ? t("newConnection.connectionUriStored")
+ : connectionStringPlaceholder
+ }
/>
{connectionString && !connectionStringError && (
diff --git a/packages/web-ui/src/components/settings/BackupTab.tsx b/packages/web-ui/src/components/settings/BackupTab.tsx
index 997550e53..85eb7c8bc 100644
--- a/packages/web-ui/src/components/settings/BackupTab.tsx
+++ b/packages/web-ui/src/components/settings/BackupTab.tsx
@@ -119,16 +119,12 @@ export function BackupTab() {
try {
const result = await client.call("run_connections_backup", undefined);
await refreshStatus();
- if (typeof result === "string") {
- showAlert(t("settings.backup.backupDone", { path: result }));
- } else {
- if (result.download) {
- await saveGeneratedFile(client, platform, result.download);
- }
- showAlert(
- t("settings.backup.backupDone", { path: result.serverLocation }),
- );
+ if (result.download) {
+ await saveGeneratedFile(client, platform, result.download);
}
+ showAlert(
+ t("settings.backup.backupDone", { path: result.serverLocation }),
+ );
} catch (e) {
showAlert(toErrorMessage(e));
} finally {
diff --git a/packages/web-ui/src/i18n/locales/de.json b/packages/web-ui/src/i18n/locales/de.json
index 3967e2185..39b74271c 100644
--- a/packages/web-ui/src/i18n/locales/de.json
+++ b/packages/web-ui/src/i18n/locales/de.json
@@ -1153,6 +1153,7 @@
"dbNameRequired": "Datenbankname ist erforderlich",
"connectionUriRequiresKeychain": "Verbindungs-URIs müssen im Keychain des Betriebssystems gespeichert werden. Aktiviere „Passwörter im Keychain speichern“, um fortzufahren.",
"connectionUriRequired": "Verbindungs-URI ist erforderlich",
+ "connectionUriStored": "Im Schlüsselbund des Systems gespeichert. Füge einen neuen Verbindungs-String ein, um ihn zu ersetzen.",
"connectionString": "Verbindungszeichenfolge",
"connectionStringPlaceholder": "z. B. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Beispiel f?r eine Verbindungszeichenfolge",
diff --git a/packages/web-ui/src/i18n/locales/en.json b/packages/web-ui/src/i18n/locales/en.json
index 1052ffcd0..47a965518 100644
--- a/packages/web-ui/src/i18n/locales/en.json
+++ b/packages/web-ui/src/i18n/locales/en.json
@@ -1220,6 +1220,7 @@
"dbNameRequired": "Database name is required",
"connectionUriRequiresKeychain": "Connection URIs must be saved in the OS keychain. Enable “Save passwords in Keychain” to continue.",
"connectionUriRequired": "Connection URI is required",
+ "connectionUriStored": "Stored in the OS keychain. Paste a new connection string to replace it.",
"connectionString": "Connection String",
"connectionStringPlaceholder": "e.g. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Connection string example",
diff --git a/packages/web-ui/src/i18n/locales/es.json b/packages/web-ui/src/i18n/locales/es.json
index db7c68ecb..77b2f8003 100644
--- a/packages/web-ui/src/i18n/locales/es.json
+++ b/packages/web-ui/src/i18n/locales/es.json
@@ -1181,6 +1181,7 @@
"dbNameRequired": "El nombre de la base de datos es requerido",
"connectionUriRequiresKeychain": "Las URI de conexión deben guardarse en el Llavero del sistema. Activa “Guardar contraseñas en el Llavero” para continuar.",
"connectionUriRequired": "El URI de conexión es requerido",
+ "connectionUriStored": "Guardada en el llavero del sistema. Pega una nueva cadena de conexión para reemplazarla.",
"connectionString": "Cadena de conexi?n",
"connectionStringPlaceholder": "p. ej. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Ejemplo de cadena de conexi?n",
diff --git a/packages/web-ui/src/i18n/locales/fr.json b/packages/web-ui/src/i18n/locales/fr.json
index 3fdf5726e..c2bfe990a 100644
--- a/packages/web-ui/src/i18n/locales/fr.json
+++ b/packages/web-ui/src/i18n/locales/fr.json
@@ -1190,6 +1190,7 @@
"dbNameRequired": "Le nom de la base de données est requis",
"connectionUriRequiresKeychain": "Les URI de connexion doivent être enregistrées dans le trousseau du système. Activez « Enregistrer les mots de passe dans le trousseau » pour continuer.",
"connectionUriRequired": "L'URI de connexion est requise",
+ "connectionUriStored": "Enregistrée dans le trousseau du système. Collez une nouvelle chaîne de connexion pour la remplacer.",
"connectionString": "Cha?ne de connexion",
"connectionStringPlaceholder": "p. ex. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Exemple de cha?ne de connexion",
diff --git a/packages/web-ui/src/i18n/locales/it.json b/packages/web-ui/src/i18n/locales/it.json
index 303573b7b..958d5dffc 100644
--- a/packages/web-ui/src/i18n/locales/it.json
+++ b/packages/web-ui/src/i18n/locales/it.json
@@ -1216,6 +1216,7 @@
"dbNameRequired": "Il nome del database è richiesto",
"connectionUriRequiresKeychain": "Gli URI di connessione devono essere salvati nel Portachiavi di sistema. Attiva “Salva password nel Portachiavi” per continuare.",
"connectionUriRequired": "L'URI di connessione è richiesto",
+ "connectionUriStored": "Salvata nel portachiavi di sistema. Incolla una nuova stringa di connessione per sostituirla.",
"connectionString": "Stringa di connessione",
"connectionStringPlaceholder": "es. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Esempio di stringa di connessione",
diff --git a/packages/web-ui/src/i18n/locales/ja.json b/packages/web-ui/src/i18n/locales/ja.json
index 2a43a8ae4..576941b43 100644
--- a/packages/web-ui/src/i18n/locales/ja.json
+++ b/packages/web-ui/src/i18n/locales/ja.json
@@ -1167,6 +1167,7 @@
"dbNameRequired": "データベース名は必須です",
"connectionUriRequiresKeychain": "接続 URI は OS のキーチェーンに保存する必要があります。「パスワードをキーチェーンに保存」を有効にしてください。",
"connectionUriRequired": "接続 URI は必須です",
+ "connectionUriStored": "OS のキーチェーンに保存されています。置き換えるには新しい接続文字列を貼り付けてください。",
"connectionString": "?????",
"connectionStringPlaceholder": "?: mysql://user:pass@localhost:3306/db",
"connectionStringExample": "???????",
diff --git a/packages/web-ui/src/i18n/locales/ko.json b/packages/web-ui/src/i18n/locales/ko.json
index a37902ed4..38211a8e3 100644
--- a/packages/web-ui/src/i18n/locales/ko.json
+++ b/packages/web-ui/src/i18n/locales/ko.json
@@ -1128,6 +1128,7 @@
"dbNameRequired": "데이터베이스 이름은 필수입니다",
"connectionUriRequiresKeychain": "연결 URI는 OS 키체인에 저장해야 합니다. “키체인에 비밀번호 저장”을 활성화하세요.",
"connectionUriRequired": "연결 URI는 필수입니다",
+ "connectionUriStored": "OS 키체인에 저장되어 있습니다. 바꾸려면 새 연결 문자열을 붙여 넣으세요.",
"connectionString": "?? ???",
"connectionStringPlaceholder": "?: mysql://user:pass@localhost:3306/db",
"connectionStringExample": "?? ??? ??",
diff --git a/packages/web-ui/src/i18n/locales/pt-BR.json b/packages/web-ui/src/i18n/locales/pt-BR.json
index 68c2ad576..7e1ae84a7 100644
--- a/packages/web-ui/src/i18n/locales/pt-BR.json
+++ b/packages/web-ui/src/i18n/locales/pt-BR.json
@@ -1170,6 +1170,7 @@
"nameRequired": "O nome da conexão é obrigatório",
"dbNameRequired": "O nome do banco de dados é obrigatório",
"connectionUriRequired": "O URI da conexão é obrigatório",
+ "connectionUriStored": "Armazenada no chaveiro do sistema. Cole uma nova string de conexão para substituí-la.",
"connectionString": "String de conex?o",
"connectionStringPlaceholder": "ex.: mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Exemplo de string de conex?o",
diff --git a/packages/web-ui/src/i18n/locales/ru.json b/packages/web-ui/src/i18n/locales/ru.json
index 5e86a28bf..849667b71 100644
--- a/packages/web-ui/src/i18n/locales/ru.json
+++ b/packages/web-ui/src/i18n/locales/ru.json
@@ -1152,6 +1152,7 @@
"dbNameRequired": "Название базы данных обязательно",
"connectionUriRequiresKeychain": "URI подключения должны храниться в системном хранилище ключей. Включите «Сохранять пароли в Keychain», чтобы продолжить.",
"connectionUriRequired": "Требуется URI подключения",
+ "connectionUriStored": "Сохранено в системной связке ключей. Вставьте новую строку подключения, чтобы заменить её.",
"connectionString": "?????? ???????????",
"connectionStringPlaceholder": "????????, mysql://user:pass@localhost:3306/db",
"connectionStringExample": "?????? ?????? ???????????",
diff --git a/packages/web-ui/src/i18n/locales/tl.json b/packages/web-ui/src/i18n/locales/tl.json
index 182b73c4d..0ca3707cb 100644
--- a/packages/web-ui/src/i18n/locales/tl.json
+++ b/packages/web-ui/src/i18n/locales/tl.json
@@ -1183,6 +1183,7 @@
"dbNameRequired": "Kailangan ang pangalan ng database",
"connectionUriRequiresKeychain": "Dapat i-save ang mga connection URI sa OS keychain. I-enable ang “I-save ang mga password sa Keychain” para magpatuloy.",
"connectionUriRequired": "Kailangan ang connection URI",
+ "connectionUriStored": "Naka-save sa keychain ng OS. Mag-paste ng bagong connection string para palitan ito.",
"connectionString": "Connection string",
"connectionStringPlaceholder": "hal. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Halimbawa ng connection string",
diff --git a/packages/web-ui/src/i18n/locales/zh.json b/packages/web-ui/src/i18n/locales/zh.json
index 22f62452a..a2fc58e78 100644
--- a/packages/web-ui/src/i18n/locales/zh.json
+++ b/packages/web-ui/src/i18n/locales/zh.json
@@ -1129,6 +1129,7 @@
"dbNameRequired": "数据库名称是必需的",
"connectionUriRequiresKeychain": "连接 URI 必须保存在操作系统密钥链中。请启用“在密钥链中保存密码”后继续。",
"connectionUriRequired": "连接 URI 是必需的",
+ "connectionUriStored": "已保存在系统钥匙串中。粘贴新的连接字符串即可替换。",
"connectionString": "?????",
"connectionStringPlaceholder": "?? mysql://user:pass@localhost:3306/db",
"connectionStringExample": "???????",
diff --git a/packages/web-ui/tests/components/modals/NewConnectionModal.test.tsx b/packages/web-ui/tests/components/modals/NewConnectionModal.test.tsx
index 47ca21554..2ece08680 100644
--- a/packages/web-ui/tests/components/modals/NewConnectionModal.test.tsx
+++ b/packages/web-ui/tests/components/modals/NewConnectionModal.test.tsx
@@ -34,6 +34,7 @@ interface MockSelectProps {
const driverState = vi.hoisted(() => ({
defaultPort: 15432 as number | null,
multiDatabase: false,
+ uriPassthrough: false,
catalogueDriver: "mysql" as "mysql" | "sqlite",
connectionFields: undefined as
| Record
@@ -136,6 +137,7 @@ vi.mock("../../../src/hooks/useDrivers", () => ({
file_based: false,
folder_based: false,
connection_string: true,
+ connection_uri: driverState.uriPassthrough,
connection_string_examples: [
{
label: "Local MySQL",
@@ -194,6 +196,7 @@ vi.mock("../../../src/hooks/usePluginSlotRegistry", () => ({
afterEach(() => {
driverState.connectionFields = undefined;
+ driverState.uriPassthrough = false;
});
vi.mock("../../../src/hooks/useSettings", () => ({
@@ -525,6 +528,30 @@ describe("NewConnectionModal layout", () => {
});
});
+ it("saves a passthrough connection whose URI only lives in the keychain", async () => {
+ // The browser receives a redacted connection: the URI stays on the server.
+ driverState.uriPassthrough = true;
+ const stored = createInitialConnection({
+ database: "",
+ save_in_keychain: true,
+ connection_uri_in_keychain: true,
+ });
+ vi.mocked(invoke).mockImplementation(async (command) =>
+ command === "get_connection_by_id" ? stored : "ok",
+ );
+ renderModal(stored);
+ expect(
+ await screen.findByPlaceholderText("newConnection.connectionUriStored"),
+ ).toBeInTheDocument();
+ fireEvent.click(screen.getByText("newConnection.save"));
+ await waitFor(() => expect(invoke).toHaveBeenCalledWith(
+ "update_connection", expect.objectContaining({
+ params: expect.objectContaining({ connection_uri_in_keychain: true }),
+ }),
+ ));
+ expect(screen.queryByText("newConnection.connectionUriRequired")).toBeNull();
+ });
+
it("fills and parses a selected connection string example", async () => {
vi.mocked(invoke).mockImplementation(async (command) =>
command === "list_databases" ? [] : "ok",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 9e0662f32..5d0b812b2 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -16,7 +16,24 @@ crate-type = ["staticlib", "cdylib", "rlib"]
# Off by default — normal and CI builds exclude it. Only the e2e-macos workflow
# builds with `--features e2e-testing` so tauri-wd can drive the real WKWebView.
[features]
-e2e-testing = ["dep:tauri-plugin-webdriver-automation"]
+default = ["desktop"]
+# The Tauri desktop app. Without it the binary only serves `tabularis web` and
+# `--mcp`, and links neither GTK nor WebKitGTK (the container image build).
+desktop = [
+ "dep:tauri",
+ "dep:tauri-build",
+ "dep:tauri-plugin-log",
+ "dep:tauri-plugin-dialog",
+ "dep:tauri-plugin-fs",
+ "dep:tauri-plugin-notification",
+ "dep:tauri-plugin-opener",
+ "dep:tauri-plugin-clipboard-manager",
+ "dep:tauri-plugin-deep-link",
+ "dep:tauri-plugin-single-instance",
+ "dep:tauri-plugin-updater",
+ "dep:gtk",
+]
+e2e-testing = ["desktop", "dep:tauri-plugin-webdriver-automation"]
[profile.release]
codegen-units = 1
@@ -26,7 +43,7 @@ panic = "abort"
strip = true
[build-dependencies]
-tauri-build = { version = "2.5.3", features = [] }
+tauri-build = { version = "2.5.3", features = [], optional = true }
[dependencies]
serde_json = { version = "1.0", features = ["raw_value"] }
@@ -36,9 +53,9 @@ fs2 = "0.4"
serde = { version = "1.0", features = ["derive"] }
bytes = "1"
toon-format = { version = "0.5.0", default-features = false }
-log = "0.4"
-tauri = { version = "2.10.2", features = ["protocol-asset", "devtools"] }
-tauri-plugin-log = "2"
+log = { version = "0.4", features = ["std"] }
+tauri = { version = "2.10.2", features = ["protocol-asset", "devtools"], optional = true }
+tauri-plugin-log = { version = "2", optional = true }
sqlx = { version = "0.8.6", features = ["runtime-tokio", "sqlite", "mysql", "postgres", "tls-rustls-ring-native-roots", "chrono", "uuid", "rust_decimal", "json"] }
tokio = { version = "1.49.0", features = ["full"] }
tokio-util = { version = "0.7", features = ["io"] }
@@ -50,9 +67,9 @@ uuid = { version = "1.20.0", features = ["v4", "serde"] }
rust_decimal = { version = "1.36", features = ["db-tokio-postgres", "serde"] }
chrono = { version = "0.4.43", features = ["serde"] }
chrono-tz = "0.10"
-tauri-plugin-dialog = "2.6.0"
-tauri-plugin-fs = "2.4.5"
-tauri-plugin-notification = "2"
+tauri-plugin-dialog = { version = "2.6.0", optional = true }
+tauri-plugin-fs = { version = "2.4.5", optional = true }
+tauri-plugin-notification = { version = "2", optional = true }
russh = "0.43"
russh-keys = "0.43"
async-trait = "0.1"
@@ -65,7 +82,7 @@ sha2 = "0.10"
ed25519-dalek = "2"
futures = "0.3.31"
keyring = { version = "3.6.3", features = ["apple-native", "windows-native", "linux-native-sync-persistent", "crypto-rust"] }
-tauri-plugin-opener = "2"
+tauri-plugin-opener = { version = "2", optional = true }
once_cell = "1.20"
csv = "1.4.0"
reqwest = { version = "0.13.1", features = ["json", "socks"] }
@@ -90,9 +107,9 @@ zip = "4.2.0"
tabularium-sdk = "0.2"
url = "2"
semver = "1"
-tauri-plugin-clipboard-manager = "2"
-tauri-plugin-deep-link = "2"
-tauri-plugin-single-instance = { version = "2", features = ["deep-link"] }
+tauri-plugin-clipboard-manager = { version = "2", optional = true }
+tauri-plugin-deep-link = { version = "2", optional = true }
+tauri-plugin-single-instance = { version = "2", features = ["deep-link"], optional = true }
tokio-postgres = { version = "0.7.13", features = ["with-chrono-0_4", "with-uuid-1", "with-serde_json-1", "array-impls"] }
deadpool-postgres = "0.14.1"
# sqlx uses `tls-rustls-ring-native-roots` for both the MySQL pool and the
@@ -132,7 +149,7 @@ libc = "0.2"
# GTK dependencies for Wayland window title workaround (Linux only)
[target.'cfg(target_os = "linux")'.dependencies]
-gtk = "0.18"
+gtk = { version = "0.18", optional = true }
# Keep zbus on the async-io backend. The `tokio` feature makes
# `zbus::utils::block_on` drive a Tokio runtime, which panics when invoked from
# inside a Tokio task and, in a `panic = "abort"` release build, aborts the
@@ -142,7 +159,7 @@ gtk = "0.18"
zbus = { version = "5.14", default-features = false, features = ["async-io"] }
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
-tauri-plugin-updater = "2"
+tauri-plugin-updater = { version = "2", optional = true }
[dev-dependencies]
tauri = { version = "2.10.2", features = ["test"] }
diff --git a/src-tauri/build.rs b/src-tauri/build.rs
index d860e1e6a..7f77d51e3 100644
--- a/src-tauri/build.rs
+++ b/src-tauri/build.rs
@@ -1,3 +1,6 @@
fn main() {
+ // Set by tauri-build in the desktop build; declared for the server-only one.
+ println!("cargo::rustc-check-cfg=cfg(mobile)");
+ #[cfg(feature = "desktop")]
tauri_build::build()
}
diff --git a/src-tauri/src/ai.rs b/src-tauri/src/ai.rs
index fd4ef0941..029935f0c 100644
--- a/src-tauri/src/ai.rs
+++ b/src-tauri/src/ai.rs
@@ -8,7 +8,6 @@ use std::collections::{HashMap, HashSet};
use std::fs;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::{SystemTime, UNIX_EPOCH};
-use tauri::{AppHandle, Manager};
// --- Data Structures ---
@@ -384,11 +383,6 @@ async fn fetch_custom_openai_models(base_url: &str, api_key: &str) -> Vec Result<(), String> {
- clear_models_cache(&app.state::())
-}
-
pub fn clear_models_cache(runtime: &RuntimeContext) -> Result<(), String> {
let path = get_cache_path(runtime);
if path.exists() {
@@ -397,19 +391,6 @@ pub fn clear_models_cache(runtime: &RuntimeContext) -> Result<(), String> {
Ok(())
}
-#[tauri::command]
-pub async fn get_ai_models(
- app: AppHandle,
- force_refresh: bool,
-) -> Result>, String> {
- get_models(
- &app.state::(),
- &app.state::>(),
- force_refresh,
- )
- .await
-}
-
pub async fn get_models(
runtime: &RuntimeContext,
cache: &CredentialCache,
@@ -580,49 +561,6 @@ pub async fn get_models(
Ok(models)
}
-#[tauri::command]
-pub async fn generate_ai_query(app: AppHandle, req: AiGenerateRequest) -> Result {
- generate_query(
- &app.state::(),
- &app.state::>(),
- req,
- )
- .await
-}
-
-#[tauri::command]
-pub async fn explain_ai_query(app: AppHandle, req: AiExplainRequest) -> Result {
- explain_query(
- &app.state::(),
- &app.state::>(),
- req,
- )
- .await
-}
-
-#[tauri::command]
-pub async fn analyze_ai_explain_plan(
- app: AppHandle,
- req: AiExplainRequest,
-) -> Result {
- analyze_explain_plan(
- &app.state::(),
- &app.state::>(),
- req,
- )
- .await
-}
-
-#[tauri::command]
-pub async fn generate_cell_name(app: AppHandle, req: AiCellNameRequest) -> Result {
- generate_cellname(
- &app.state::(),
- &app.state::>(),
- req,
- )
- .await
-}
-
// --- Shared helpers ---
async fn resolve_model(
@@ -893,19 +831,6 @@ pub async fn generate_cellname(
.await
}
-#[tauri::command]
-pub async fn suggest_table_name(
- app: AppHandle,
- req: AiSuggestTableNameRequest,
-) -> Result {
- suggest_table_name_with_runtime(
- &app.state::(),
- &app.state::>(),
- req,
- )
- .await
-}
-
pub async fn suggest_table_name_with_runtime(
runtime: &RuntimeContext,
cache: &CredentialCache,
@@ -969,19 +894,6 @@ pub async fn suggest_table_name_with_runtime(
}
}
-#[tauri::command]
-pub async fn generate_tab_rename(
- app: AppHandle,
- req: AiTabRenameRequest,
-) -> Result {
- generate_tab_name(
- &app.state::(),
- &app.state::>(),
- req,
- )
- .await
-}
-
pub async fn generate_tab_name(
runtime: &RuntimeContext,
cache: &CredentialCache,
diff --git a/src-tauri/src/ai_approval_watcher.rs b/src-tauri/src/ai_approval_watcher.rs
index a96df60ba..4ecd75aec 100644
--- a/src-tauri/src/ai_approval_watcher.rs
+++ b/src-tauri/src/ai_approval_watcher.rs
@@ -4,20 +4,18 @@
//! Also runs a periodic cleanup that removes stale pending/decision files
//! left behind by crashed MCP processes.
-use notify::{Event, EventKind, RecommendedWatcher, RecursiveMode, Watcher};
use std::collections::{HashMap, HashSet};
-use std::sync::{mpsc, Arc};
+use std::sync::Arc;
use std::time::Duration;
-use tauri::{AppHandle, Emitter, Runtime};
use crate::ai_approval;
-const PENDING_APPROVAL_EVENT: &str = "ai://pending_approval";
+pub(crate) const PENDING_APPROVAL_EVENT: &str = "ai://pending_approval";
/// Stale pending+decision files older than this are deleted by the periodic
/// cleanup task. 1 hour is comfortably longer than the maximum approval
/// timeout (`mcp_approval_timeout_seconds` default: 120).
-const CLEANUP_MAX_AGE_SECS: u64 = 3_600;
-const CLEANUP_INTERVAL_SECS: u64 = 60;
+pub(crate) const CLEANUP_MAX_AGE_SECS: u64 = 3_600;
+pub(crate) const CLEANUP_INTERVAL_SECS: u64 = 60;
const HEADLESS_POLL_INTERVAL_MS: u64 = 250;
/// Poll the approval queue for headless Web mode and deliver each prompt to
@@ -109,85 +107,3 @@ pub fn spawn_headless(
})
}
-/// Spawn the watcher + cleanup tasks. The watcher returns immediately if it
-/// fails to initialise (e.g. unsupported filesystem); cleanup keeps running.
-pub fn spawn(app: AppHandle) {
- let app_for_watcher = app.clone();
- tauri::async_runtime::spawn_blocking(move || {
- if let Err(e) = run_watcher(app_for_watcher) {
- log::warn!("AI approval watcher disabled: {}", e);
- }
- });
-
- let app_for_cleanup = app.clone();
- tauri::async_runtime::spawn(async move {
- run_cleanup_loop(app_for_cleanup).await;
- });
-}
-
-fn run_watcher(app: AppHandle) -> Result<(), String> {
- let dir = ai_approval::approvals_dir_path();
- std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;
-
- let (tx, rx) = mpsc::channel::>();
- let mut watcher: RecommendedWatcher =
- notify::recommended_watcher(tx).map_err(|e| e.to_string())?;
- watcher
- .watch(&dir, RecursiveMode::NonRecursive)
- .map_err(|e| e.to_string())?;
-
- log::info!("AI approval watcher started on {}", dir.display());
-
- // The watcher is dropped when this function returns; keep it alive for the
- // process lifetime by looping forever.
- for evt in rx {
- match evt {
- Ok(event) => handle_event(&app, &event),
- Err(e) => log::warn!("approval watcher error: {}", e),
- }
- }
- Ok(())
-}
-
-fn handle_event(app: &AppHandle, event: &Event) {
- if !matches!(event.kind, EventKind::Create(_) | EventKind::Modify(_)) {
- return;
- }
- for path in &event.paths {
- let name = match path.file_name().and_then(|s| s.to_str()) {
- Some(n) => n,
- None => continue,
- };
- if !name.ends_with(".pending.json") {
- continue;
- }
- let id = name.trim_end_matches(".pending.json").to_string();
- // The file may not yet be fully flushed when notify fires Create —
- // try to read; if it fails this iteration we'll catch it on the
- // next Modify event.
- if let Ok(Some(pending)) = ai_approval::read_pending(&id) {
- if let Err(e) = app.emit(PENDING_APPROVAL_EVENT, &pending) {
- log::warn!("Failed to emit {}: {}", PENDING_APPROVAL_EVENT, e);
- }
- }
- }
-}
-
-async fn run_cleanup_loop(_app: AppHandle) {
- let mut ticker = tokio::time::interval(Duration::from_secs(CLEANUP_INTERVAL_SECS));
- // Skip the immediate first tick.
- ticker.tick().await;
- loop {
- ticker.tick().await;
- let cleaned = tokio::task::spawn_blocking(|| {
- ai_approval::cleanup_expired(CLEANUP_MAX_AGE_SECS)
- })
- .await
- .ok()
- .and_then(|r| r.ok())
- .unwrap_or(0);
- if cleaned > 0 {
- log::info!("Cleaned {} stale approval file(s)", cleaned);
- }
- }
-}
diff --git a/src-tauri/src/ai_commands.rs b/src-tauri/src/ai_commands.rs
deleted file mode 100644
index b73a0131c..000000000
--- a/src-tauri/src/ai_commands.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-//! Tauri commands exposed to the frontend for AI activity, approval gates,
-//! and notebook export. The MCP subprocess writes the underlying files; the
-//! main app only reads and decides on them through these endpoints.
-
-use crate::ai_activity::{self, AiActivityEvent, EventFilter, SessionSummary};
-use crate::ai_approval::{self, ApprovalDecision, PendingApproval};
-use crate::ai_notebook_export::NotebookExport;
-
-#[tauri::command]
-pub async fn get_ai_activity(filter: Option) -> Result, String> {
- let f = filter.unwrap_or_default();
- tokio::task::spawn_blocking(move || ai_activity::read_events(&f))
- .await
- .map_err(|e| e.to_string())?
-}
-
-#[tauri::command]
-pub async fn get_ai_sessions() -> Result, String> {
- tokio::task::spawn_blocking(ai_activity::read_sessions)
- .await
- .map_err(|e| e.to_string())?
-}
-
-#[tauri::command]
-pub async fn get_ai_session_events(session_id: String) -> Result, String> {
- tokio::task::spawn_blocking(move || ai_activity::read_session_events(&session_id))
- .await
- .map_err(|e| e.to_string())?
-}
-
-#[tauri::command]
-pub async fn clear_ai_activity() -> Result<(), String> {
- tokio::task::spawn_blocking(ai_activity::clear)
- .await
- .map_err(|e| e.to_string())?
-}
-
-#[tauri::command]
-pub async fn export_ai_activity_json() -> Result {
- crate::application::generic_exports::generate_ai_activity_json().await
-}
-
-#[tauri::command]
-pub async fn export_ai_activity_csv() -> Result {
- crate::application::generic_exports::generate_ai_activity_csv().await
-}
-
-#[tauri::command]
-pub async fn export_ai_session_as_notebook(session_id: String) -> Result {
- crate::application::generic_exports::generate_ai_session_notebook(session_id).await
-}
-
-#[tauri::command]
-pub async fn list_pending_approvals() -> Result, String> {
- tokio::task::spawn_blocking(ai_approval::list_pending)
- .await
- .map_err(|e| e.to_string())?
-}
-
-#[tauri::command]
-pub async fn decide_pending_approval(
- approval_id: String,
- decision: String,
- reason: Option,
- edited_query: Option,
-) -> Result<(), String> {
- if decision != "approve" && decision != "deny" {
- return Err(format!(
- "Invalid decision '{}': expected 'approve' or 'deny'",
- decision
- ));
- }
- let payload = ApprovalDecision {
- approval_id,
- decided_at: ai_activity::now_iso8601(),
- decision,
- reason,
- edited_query,
- };
- tokio::task::spawn_blocking(move || ai_approval::write_decision(&payload))
- .await
- .map_err(|e| e.to_string())?
-}
diff --git a/src-tauri/src/application/connections.rs b/src-tauri/src/application/connections.rs
index d6cf3ab68..0cad710a8 100644
--- a/src-tauri/src/application/connections.rs
+++ b/src-tauri/src/application/connections.rs
@@ -131,6 +131,12 @@ pub enum ConnectionCommand {
TestConnection {
request: TestConnectionRequest,
},
+ ListDatabases {
+ request: TestConnectionRequest,
+ },
+ CreateSqliteDatabase {
+ path: String,
+ },
}
pub async fn execute(
@@ -342,6 +348,12 @@ pub async fn execute_for_session(
ConnectionCommand::TestConnection { request } => {
json(test_connection(runtime, session_id, request).await?)
}
+ ConnectionCommand::ListDatabases { request } => {
+ json(list_databases(runtime, session_id, request).await?)
+ }
+ ConnectionCommand::CreateSqliteDatabase { path } => {
+ json(create_sqlite_database(runtime, state, path).await?)
+ }
}
}
@@ -372,7 +384,7 @@ pub(crate) fn resolve_saved_connection_params(
let driver_id = saved.params.driver.clone();
let plugin_secrets = load_plugin_secrets(runtime, &saved);
let mut params = saved.params;
- restore_secrets(runtime, connection_id, &mut params)?;
+ restore_secrets_for_connect(runtime, connection_id, &mut params)?;
params.extra.extend(plugin_secrets);
params.connection_id = Some(connection_id.to_string());
let params =
@@ -483,6 +495,19 @@ fn validate_environment(environment: Option) -> Result