Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

feat(driver-store): make JRE runtime optional in offline driver export

弈秋3bfd9599488e
diff --git a/apps/desktop/src/components/config/AgentOfflineExportDialog.vue b/apps/desktop/src/components/config/AgentOfflineExportDialog.vue
index c0a1c098e7..9eb1311f02 100644
--- a/apps/desktop/src/components/config/AgentOfflineExportDialog.vue
+++ b/apps/desktop/src/components/config/AgentOfflineExportDialog.vue
@@ -6,6 +6,9 @@ import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { ScrollArea } from "@/components/ui/scroll-area";
+import { Label } from "@/components/ui/label";
+import { Switch } from "@/components/ui/switch";
+import { HelpTooltip } from "@/components/ui/tooltip";
import DatabaseIcon from "@/components/icons/DatabaseIcon.vue";
import type { AgentOfflineExportCandidate, AgentOfflineExportPreview, AgentOfflineExportUnavailableReason } from "@/lib/backend/api";
@@ -19,7 +22,7 @@ const props = defineProps<{
const emit = defineEmits<{
"update:open": [value: boolean];
- confirm: [driverKeys: string[]];
+ confirm: [driverKeys: string[], includeJres: boolean];
}>();
const { t } = useI18n();
@@ -37,6 +40,7 @@ const candidates = computed(() => props.preview?.candidates ?? []);
const eligibleCandidates = computed(() => candidates.value.filter((candidate) => candidate.eligible));
const selectedCandidates = computed(() => eligibleCandidates.value.filter((candidate) => selectedDriverKeys.value.includes(candidate.dbType)));
const selectedJres = computed(() => new Set(selectedCandidates.value.map((candidate) => candidate.requiredJre).filter((jre): jre is string => Boolean(jre))));
+const includeJres = ref(true);
const selectedCount = computed(() => selectedDriverKeys.value.length);
const canConfirm = computed(() => selectedCount.value > 0 && !props.loading && !props.exporting && !props.error);
@@ -74,7 +78,7 @@ function clearSelection() {
function confirm() {
if (!canConfirm.value) return;
- emit("confirm", [...selectedDriverKeys.value]);
+ emit("confirm", [...selectedDriverKeys.value], includeJres.value);
}
function formatSize(bytes: number) {
@@ -165,8 +169,17 @@ function unavailableReason(reason: AgentOfflineExportUnavailableReason | null) {
</label>
</ScrollArea>
+ <div class="settings-item flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
+ <div class="flex items-center gap-2">
+ <Label for="offline-export-include-jres">{{ t("driverStore.offlineExportIncludeJres") }}</Label>
+ <HelpTooltip :label="t('driverStore.offlineExportIncludeJres')">
+ {{ t("driverStore.offlineExportIncludeJresDescription") }}
+ </HelpTooltip>
+ </div>
+ <Switch id="offline-export-include-jres" v-model="includeJres" />
+ </div>
<div class="rounded-md border bg-muted/20 px-3 py-2 text-xs text-muted-foreground">
- {{ t("driverStore.offlineExportJreSummary", { count: selectedJres.size }) }}
+ {{ includeJres ? t("driverStore.offlineExportJreSummary", { count: selectedJres.size }) : t("driverStore.offlineExportJreSkippedSummary") }}
</div>
<div class="flex items-start gap-2 rounded-md border border-green-500/20 bg-green-500/5 px-3 py-2 text-xs text-muted-foreground">
diff --git a/apps/desktop/src/components/config/DriverStoreDialog.vue b/apps/desktop/src/components/config/DriverStoreDialog.vue
index c9e0c9b7ec..3684888655 100644
--- a/apps/desktop/src/components/config/DriverStoreDialog.vue
+++ b/apps/desktop/src/components/config/DriverStoreDialog.vue
@@ -657,7 +657,7 @@ async function openOfflineExportDialog() {
}
}
-async function exportOfflinePackage(driverKeys: string[]) {
+async function exportOfflinePackage(driverKeys: string[], includeJres = true) {
if (isWeb || agentExportImportBlocked.value || driverKeys.length === 0) return;
const platform = offlineExportPreview.value?.platform ?? "current-platform";
await runAgentOfflineExportAction({
@@ -673,6 +673,7 @@ async function exportOfflinePackage(driverKeys: string[]) {
filters: [{ name: "ZIP", extensions: ["zip"] }],
});
},
+ includeJres,
exportPackage: api.exportAgentsOffline,
onSuccess: ({ destination, result }) => {
offlineExportDialogOpen.value = false;
diff --git a/apps/desktop/src/components/config/__tests__/AgentOfflineExportDialog.spec.ts b/apps/desktop/src/components/config/__tests__/AgentOfflineExportDialog.spec.ts
index b72aaa0338..a521363af5 100644
--- a/apps/desktop/src/components/config/__tests__/AgentOfflineExportDialog.spec.ts
+++ b/apps/desktop/src/components/config/__tests__/AgentOfflineExportDialog.spec.ts
@@ -143,7 +143,7 @@ describe("AgentOfflineExportDialog", () => {
expect(document.getElementById("offline-export-reason-kafka")?.textContent).toContain("Locally imported");
buttonContaining("Export 2 driver(s)")?.click();
- expect(onConfirm).toHaveBeenCalledWith(["duckdb", "redis"]);
+ expect(onConfirm).toHaveBeenCalledWith(["duckdb", "redis"], true);
});
it("disables export after clearing the selection", async () => {
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts
index c56a597311..006bc3f88b 100644
--- a/apps/desktop/src/i18n/locales/az.ts
+++ b/apps/desktop/src/i18n/locales/az.ts
@@ -8976,6 +8976,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "Naməlum",
offlineExportPreparing: "İxrac önbaxışı hazırlanır...",
offlineExportJreSummary: "{count} idarə olunan JRE avtomatik daxil ediləcək.",
+ offlineExportIncludeJres: "JRE runtime daxil et",
+ offlineExportIncludeJresDescription: "İdarə olunan JRE runtime-u sürücülərlə birlikdə paketləyir. Bağlasanız paket xeyli kiçilir; hədəf maşın öz JRE-ni quraşdırır.",
+ offlineExportJreSkippedSummary: "JRE runtime daxil edilməyəcək; JAR sürücülərini işə salmazdan əvvəl hədəf maşında idarə olunan JRE quraşdırın.",
offlineExportSecurityHint: "Yalnız DBX tərəfindən idarə olunan artefaktlar və tələb olunan idarə olunan JRE-lər daxil edilir. Yerli yollar, parametrlər və xarici drayverlər daxil edilmir.",
offlineExportStart: "{count} drayveri ixrac et",
offlineExporting: "İxrac edilir...",
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 9e110a112b..39192248d3 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -11249,6 +11249,9 @@ export default {
offlineExportArtifactUnknown: "Unknown",
offlineExportPreparing: "Preparing export preview...",
offlineExportJreSummary: "{count} managed JRE(s) will be included automatically.",
+ offlineExportIncludeJres: "Include JRE runtime",
+ offlineExportIncludeJresDescription: "Package the managed JRE runtime with the drivers. Turn off to skip it for a much smaller package; the target machine installs its own JRE.",
+ offlineExportJreSkippedSummary: "The JRE runtime will not be included; install a managed JRE on the target machine before running JAR drivers.",
offlineExportSecurityHint: "Only DBX-managed artifacts and required managed JREs are included. Local paths, settings, and external drivers are excluded.",
offlineExportStart: "Export {count} driver(s)",
offlineExporting: "Exporting...",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index f16666498a..f476092fb2 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -10110,6 +10110,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "Desconocido",
offlineExportPreparing: "Preparando la vista previa...",
offlineExportJreSummary: "Se incluirán automáticamente {count} JRE administrados.",
+ offlineExportIncludeJres: "Incluir runtime JRE",
+ offlineExportIncludeJresDescription: "Empaqueta el runtime JRE gestionado con los controladores. Desactívelo para reducir mucho el paquete; la máquina de destino instala su propio JRE.",
+ offlineExportJreSkippedSummary: "El runtime JRE no se incluirá; instale un JRE gestionado en la máquina de destino antes de ejecutar controladores JAR.",
offlineExportSecurityHint: "Solo se incluyen artefactos administrados por DBX y los JRE necesarios. Se excluyen rutas locales, configuraciones y drivers externos.",
offlineExportStart: "Exportar {count} driver(s)",
offlineExporting: "Exportando...",
diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.ts
index 41b3188340..2db65916e2 100644
--- a/apps/desktop/src/i18n/locales/id.ts
+++ b/apps/desktop/src/i18n/locales/id.ts
@@ -9800,6 +9800,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "Tidak diketahui",
offlineExportPreparing: "Menyiapkan pratinjau ekspor...",
offlineExportJreSummary: "{count} JRE terkelola akan disertakan secara otomatis.",
+ offlineExportIncludeJres: "Sertakan runtime JRE",
+ offlineExportIncludeJresDescription: "Mengemas runtime JRE terkelola bersama driver. Matikan untuk memperkecil paket; mesin tujuan memasang JRE sendiri.",
+ offlineExportJreSkippedSummary: "Runtime JRE tidak akan disertakan; pasang JRE terkelola di mesin tujuan sebelum menjalankan driver JAR.",
offlineExportSecurityHint: "Hanya artefak yang dikelola DBX dan JRE terkelola yang diperlukan yang disertakan. Path lokal, pengaturan, dan driver eksternal tidak disertakan.",
offlineExportStart: "Ekspor {count} driver",
offlineExporting: "Mengekspor...",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index 9769ee772f..ee4b8b9458 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -9859,6 +9859,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "Sconosciuto",
offlineExportPreparing: "Preparazione dell'anteprima...",
offlineExportJreSummary: "Verranno inclusi automaticamente {count} JRE gestiti.",
+ offlineExportIncludeJres: "Includi runtime JRE",
+ offlineExportIncludeJresDescription: "Include il runtime JRE gestito con i driver. Disattivalo per ridurre notevolmente il pacchetto; la macchina di destinazione installa il proprio JRE.",
+ offlineExportJreSkippedSummary: "Il runtime JRE non sarà incluso; installa un JRE gestito sulla macchina di destinazione prima di eseguire driver JAR.",
offlineExportSecurityHint: "Sono inclusi solo gli artefatti gestiti da DBX e i JRE necessari. Percorsi locali, impostazioni e driver esterni sono esclusi.",
offlineExportStart: "Esporta {count} driver",
offlineExporting: "Esportazione in corso...",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 0a203e09d6..0fdbab6af8 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -9888,6 +9888,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "不明",
offlineExportPreparing: "エクスポート内容を準備中...",
offlineExportJreSummary: "必要な管理対象JREを{count}件、自動的に含めます。",
+ offlineExportIncludeJres: "JRE ランタイムを含める",
+ offlineExportIncludeJresDescription: "管理対象 JRE ランタイムをドライバーと共にパッケージします。オフにするとサイズを大幅に減らせます。接続先マシンでは JRE を別途インストールしてください。",
+ offlineExportJreSkippedSummary: "JRE ランタイムは含まれません。JAR ドライバーの実行前に接続先マシンへ管理対象 JRE をインストールしてください。",
offlineExportSecurityHint: "DBX管理の成果物と必要なJREのみを含めます。ローカルパス、設定、外部ドライバーは除外されます。",
offlineExportStart: "{count}件のドライバーをエクスポート",
offlineExporting: "エクスポート中...",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index c3be6fc737..2ead1a5b30 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -9955,6 +9955,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "알 수 없음",
offlineExportPreparing: "내보내기 미리보기를 준비하는 중...",
offlineExportJreSummary: "필요한 관리 JRE {count}개가 자동으로 포함됩니다.",
+ offlineExportIncludeJres: "JRE 런타임 포함",
+ offlineExportIncludeJresDescription: "관리형 JRE 런타임을 드라이버와 함께 패키지합니다. 끄면 패키지 크기가 크게 줄어들며, 대상 머신에 JRE를 직접 설치해야 합니다.",
+ offlineExportJreSkippedSummary: "JRE 런타임이 포함되지 않습니다. JAR 드라이버 실행 전 대상 머신에 관리형 JRE를 설치하세요.",
offlineExportSecurityHint: "DBX 관리 아티팩트와 필요한 JRE만 포함됩니다. 로컬 경로, 설정 및 외부 드라이버는 제외됩니다.",
offlineExportStart: "드라이버 {count}개 내보내기",
offlineExporting: "내보내는 중...",
diff --git a/apps/desktop/src/i18n/locales/pl.ts b/apps/desktop/src/i18n/locales/pl.ts
index f9d60463aa..284d4024cb 100644
--- a/apps/desktop/src/i18n/locales/pl.ts
+++ b/apps/desktop/src/i18n/locales/pl.ts
@@ -9827,6 +9827,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "Nieznane",
offlineExportPreparing: "Przygotowywanie podglądu eksportu...",
offlineExportJreSummary: "{count} zarządzanych środowisk JRE zostanie dołączonych automatycznie.",
+ offlineExportIncludeJres: "Dołącz środowisko JRE",
+ offlineExportIncludeJresDescription: "Pakuje zarządzane środowisko JRE razem ze sterownikami. Wyłączenie znacznie zmniejsza pakiet; maszyna docelowa instaluje własne JRE.",
+ offlineExportJreSkippedSummary: "Środowisko JRE nie zostanie dołączone; zainstaluj zarządzane JRE na maszynie docelowej przed uruchomieniem sterowników JAR.",
offlineExportSecurityHint: "Dołączane są wyłącznie artefakty zarządzane przez DBX oraz wymagane JRE. Lokalne ścieżki, ustawienia i sterowniki zewnętrzne są wykluczone.",
offlineExportStart: "Eksportuj sterowniki ({count})",
offlineExporting: "Eksportowanie…",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 96258e2b69..732b2911e5 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -9856,6 +9856,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "Desconhecido",
offlineExportPreparing: "Preparando a visualização...",
offlineExportJreSummary: "{count} JRE gerenciada(s) serão incluídas automaticamente.",
+ offlineExportIncludeJres: "Incluir runtime JRE",
+ offlineExportIncludeJresDescription: "Empacota o runtime JRE gerenciado junto com os drivers. Desative para reduzir bastante o pacote; a máquina de destino instala o próprio JRE.",
+ offlineExportJreSkippedSummary: "O runtime JRE não será incluído; instale um JRE gerenciado na máquina de destino antes de executar drivers JAR.",
offlineExportSecurityHint: "Somente artefatos gerenciados pelo DBX e as JRE necessárias são incluídos. Caminhos locais, configurações e drivers externos são excluídos.",
offlineExportStart: "Exportar {count} driver(s)",
offlineExporting: "Exportando...",
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index 2bb31568b3..3a5f1ce609 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -11451,6 +11451,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "Неизвестно",
offlineExportPreparing: "Подготовка предпросмотра экспорта...",
offlineExportJreSummary: "Управляемые JRE будут включены автоматически: {count}.",
+ offlineExportIncludeJres: "Включать среду JRE",
+ offlineExportIncludeJresDescription: "Упаковывает управляемую среду JRE вместе с драйверами. Отключите, чтобы значительно уменьшить пакет; на целевой машине JRE устанавливается отдельно.",
+ offlineExportJreSkippedSummary: "Среда JRE не будет включена; установите управляемую JRE на целевой машине перед запуском JAR-драйверов.",
offlineExportSecurityHint: "Включаются только управляемые DBX артефакты и необходимые управляемые JRE. Локальные пути, настройки и внешние драйверы исключаются.",
offlineExportStart: "Экспортировать драйверов: {count}",
offlineExporting: "Экспорт...",
diff --git a/apps/desktop/src/i18n/locales/th.ts b/apps/desktop/src/i18n/locales/th.ts
index cd8f27bf54..fe31101bbc 100644
--- a/apps/desktop/src/i18n/locales/th.ts
+++ b/apps/desktop/src/i18n/locales/th.ts
@@ -11823,6 +11823,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "ไม่ทราบ",
offlineExportPreparing: "กำลังเตรียมตัวอย่างการส่งออก...",
offlineExportJreSummary: "จะรวม JRE ที่จัดการแล้ว {count} รายการโดยอัตโนมัติ",
+ offlineExportIncludeJres: "รวมรันไทม์ JRE",
+ offlineExportIncludeJresDescription: "แพ็กรันไทม์ JRE ที่จัดการไว้พร้อมไดรเวอร์ ปิดเพื่อลดขนาดแพ็กเกจอย่างมาก เครื่องปลายทางต้องติดตั้ง JRE เอง",
+ offlineExportJreSkippedSummary: "จะไม่รวมรันไทม์ JRE ติดตั้ง JRE ที่จัดการไว้ที่เครื่องปลายทางก่อนรันไดรเวอร์ JAR",
offlineExportSecurityHint: "รวมเฉพาะอาร์ติแฟกต์และ JRE ที่ DBX จัดการและจำเป็น ไม่รวม Path ในเครื่อง การตั้งค่า และ Driver ภายนอก",
offlineExportStart: "ส่งออก Driver {count} รายการ",
offlineExporting: "กำลังส่งออก...",
diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts
index c1987a3dec..e7dacaf5f7 100644
--- a/apps/desktop/src/i18n/locales/tr.ts
+++ b/apps/desktop/src/i18n/locales/tr.ts
@@ -8859,6 +8859,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "Bilinmiyor",
offlineExportPreparing: "Dışa aktarma önizlemesi hazırlanıyor...",
offlineExportJreSummary: "{count} yönetilen JRE otomatik olarak dâhil edilecek.",
+ offlineExportIncludeJres: "JRE çalışma zamanını dahil et",
+ offlineExportIncludeJresDescription: "Yönetilen JRE çalışma zamanını sürücülerle paketler. Kapatmak paketi büyük ölçüde küçültür; hedef makine kendi JRE kurulumunu yapar.",
+ offlineExportJreSkippedSummary: "JRE çalışma zamanı dahil edilmeyecek; JAR sürücülerini çalıştırmadan önce hedef makineye yönetilen bir JRE kurun.",
offlineExportSecurityHint: "Yalnızca DBX tarafından yönetilen dosyalar ve gerekli yönetilen JRE'ler dâhil edilir. Yerel yollar, ayarlar ve dış sürücüler hariç tutulur.",
offlineExportStart: "{count} sürücüyü dışa aktar",
offlineExporting: "Dışa aktarılıyor...",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 756f19a429..f72b9f0bef 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -11211,6 +11211,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "未知",
offlineExportPreparing: "正在准备导出预览...",
offlineExportJreSummary: "将自动包含 {count} 个所需的托管 JRE。",
+ offlineExportIncludeJres: "包含 JRE 运行时",
+ offlineExportIncludeJresDescription: "将托管 JRE 运行时与驱动一起打包。关闭可显著减小导出包体积;目标机器需自行安装 JRE。",
+ offlineExportJreSkippedSummary: "将不包含 JRE 运行时;目标机器运行 JAR 驱动前需先安装托管 JRE。",
offlineExportSecurityHint: "仅包含 DBX 托管的驱动产物及所需 JRE;本地路径、配置和外部驱动不会被导出。",
offlineExportStart: "导出 {count} 个驱动",
offlineExporting: "导出中...",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index a572ba323f..5aa6df8d30 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -8979,6 +8979,9 @@ export default withEnglishFallback({
offlineExportArtifactUnknown: "未知",
offlineExportPreparing: "正在準備匯出預覽……",
offlineExportJreSummary: "將自動包含 {count} 個所需的託管 JRE。",
+ offlineExportIncludeJres: "包含 JRE 執行環境",
+ offlineExportIncludeJresDescription: "將託管 JRE 執行環境與驅動一起打包。關閉可顯著減小匯出包體積;目標機器需自行安裝 JRE。",
+ offlineExportJreSkippedSummary: "將不包含 JRE 執行環境;目標機器執行 JAR 驅動前需先安裝託管 JRE。",
offlineExportSecurityHint: "僅包含 DBX 託管的驅動程式產物及所需 JRE;本機路徑、設定和外部驅動程式不會被匯出。",
offlineExportStart: "匯出 {count} 個驅動程式",
offlineExporting: "匯出中……",
diff --git a/apps/desktop/src/lib/backend/__tests__/agentOfflineExportContract.spec.ts b/apps/desktop/src/lib/backend/__tests__/agentOfflineExportContract.spec.ts
index 8e053ac44d..09eccdce06 100644
--- a/apps/desktop/src/lib/backend/__tests__/agentOfflineExportContract.spec.ts
+++ b/apps/desktop/src/lib/backend/__tests__/agentOfflineExportContract.spec.ts
@@ -56,7 +56,7 @@ function buttonTagsForClick(handler: string): string[] {
describe("offline Agent export transport contract", () => {
it("routes preview and export through the Tauri desktop backend", () => {
expect(functionBody(tauri, "previewAgentOfflineExport")).toContain('invoke("preview_agent_offline_export")');
- expect(functionBody(tauri, "exportAgentsOffline")).toContain('invoke("export_agents_offline", { path, driverKeys })');
+ expect(functionBody(tauri, "exportAgentsOffline")).toContain('invoke("export_agents_offline", { path, driverKeys, includeJres })');
expect(tauriRegistry).toContain("commands::agents::preview_agent_offline_export,");
expect(tauriRegistry).toContain("commands::agents::export_agents_offline,");
expect(api).toContain('previewAgentOfflineExport = forward("previewAgentOfflineExport")');
diff --git a/apps/desktop/src/lib/backend/http.ts b/apps/desktop/src/lib/backend/http.ts
index 609afcd6a4..fdd70173cd 100644
--- a/apps/desktop/src/lib/backend/http.ts
+++ b/apps/desktop/src/lib/backend/http.ts
@@ -1051,7 +1051,7 @@ export async function previewAgentOfflineExport(): Promise<AgentOfflineExportPre
throw new Error("Offline Agent package export is only available in the desktop app.");
}
-export async function exportAgentsOffline(_path: string, _driverKeys: string[]): Promise<AgentOfflineExportResult> {
+export async function exportAgentsOffline(_path: string, _driverKeys: string[], _includeJres = true): Promise<AgentOfflineExportResult> {
throw new Error("Offline Agent package export is only available in the desktop app.");
}
diff --git a/apps/desktop/src/lib/backend/tauri.ts b/apps/desktop/src/lib/backend/tauri.ts
index abb384d366..e4f58912c7 100644
--- a/apps/desktop/src/lib/backend/tauri.ts
+++ b/apps/desktop/src/lib/backend/tauri.ts
@@ -3423,8 +3423,8 @@ export async function previewAgentOfflineExport(): Promise<AgentOfflineExportPre
return invoke("preview_agent_offline_export");
}
-export async function exportAgentsOffline(path: string, driverKeys: string[]): Promise<AgentOfflineExportResult> {
- return invoke("export_agents_offline", { path, driverKeys });
+export async function exportAgentsOffline(path: string, driverKeys: string[], includeJres = true): Promise<AgentOfflineExportResult> {
+ return invoke("export_agents_offline", { path, driverKeys, includeJres });
}
export async function importAgentDriver(dbType: string, path: string | File): Promise<void> {
diff --git a/apps/desktop/src/lib/driverStore/__tests__/agentOfflineExportFlow.spec.ts b/apps/desktop/src/lib/driverStore/__tests__/agentOfflineExportFlow.spec.ts
index 65a1a498df..84bf4e07a9 100644
--- a/apps/desktop/src/lib/driverStore/__tests__/agentOfflineExportFlow.spec.ts
+++ b/apps/desktop/src/lib/driverStore/__tests__/agentOfflineExportFlow.spec.ts
@@ -29,10 +29,18 @@ describe("runAgentOfflineExportFlow", () => {
destination: "/tmp/dbx-agents.zip",
result: { driverCount: 2 },
});
- expect(exportPackage).toHaveBeenCalledWith("/tmp/dbx-agents.zip", ["duckdb", "redis"]);
+ expect(exportPackage).toHaveBeenCalledWith("/tmp/dbx-agents.zip", ["duckdb", "redis"], true);
+ expect(exportPackage.mock.calls[0]?.[1]).toEqual(["duckdb", "redis"]);
+ // The JRE can be skipped for a smaller package (#13175).
driverKeys.push("kafka");
- expect(exportPackage.mock.calls[0]?.[1]).toEqual(["duckdb", "redis"]);
+ await runAgentOfflineExportFlow({
+ driverKeys,
+ includeJres: false,
+ chooseDestination: vi.fn().mockResolvedValue("/tmp/dbx-agents.zip"),
+ exportPackage,
+ });
+ expect(exportPackage).toHaveBeenLastCalledWith("/tmp/dbx-agents.zip", ["duckdb", "redis", "kafka"], false);
});
it("does not open the save dialog for an empty selection", async () => {
diff --git a/apps/desktop/src/lib/driverStore/agentOfflineExportFlow.ts b/apps/desktop/src/lib/driverStore/agentOfflineExportFlow.ts
index 72accf78bd..25a41e92d4 100644
--- a/apps/desktop/src/lib/driverStore/agentOfflineExportFlow.ts
+++ b/apps/desktop/src/lib/driverStore/agentOfflineExportFlow.ts
@@ -1,7 +1,8 @@
export interface AgentOfflineExportFlowOptions<TResult> {
+ includeJres?: boolean;
driverKeys: string[];
chooseDestination: () => Promise<string | null>;
- exportPackage: (destination: string, driverKeys: string[]) => Promise<TResult>;
+ exportPackage: (destination: string, driverKeys: string[], includeJres?: boolean) => Promise<TResult>;
}
export interface AgentOfflineExportFlowResult<TResult> {
@@ -21,7 +22,7 @@ export type AgentOfflineExportActionResult = "empty" | "cancelled" | "exported"
* Keep destination selection and package creation in one testable workflow.
* The caller owns the busy state so it can cover the native save dialog too.
*/
-export async function runAgentOfflineExportFlow<TResult>({ driverKeys, chooseDestination, exportPackage }: AgentOfflineExportFlowOptions<TResult>): Promise<AgentOfflineExportFlowResult<TResult> | null> {
+export async function runAgentOfflineExportFlow<TResult>({ driverKeys, includeJres = true, chooseDestination, exportPackage }: AgentOfflineExportFlowOptions<TResult>): Promise<AgentOfflineExportFlowResult<TResult> | null> {
if (driverKeys.length === 0) return null;
const destination = await chooseDestination();
@@ -29,7 +30,7 @@ export async function runAgentOfflineExportFlow<TResult>({ driverKeys, chooseDes
return {
destination,
- result: await exportPackage(destination, [...driverKeys]),
+ result: await exportPackage(destination, [...driverKeys], includeJres),
};
}
@@ -38,12 +39,12 @@ export async function runAgentOfflineExportFlow<TResult>({ driverKeys, chooseDes
* This keeps busy-state release and success/error side effects testable as one
* contract instead of splitting them between the component and export helper.
*/
-export async function runAgentOfflineExportAction<TResult>({ driverKeys, chooseDestination, exportPackage, setBusy, onSuccess, onError }: AgentOfflineExportActionOptions<TResult>): Promise<AgentOfflineExportActionResult> {
+export async function runAgentOfflineExportAction<TResult>({ driverKeys, includeJres = true, chooseDestination, exportPackage, setBusy, onSuccess, onError }: AgentOfflineExportActionOptions<TResult>): Promise<AgentOfflineExportActionResult> {
if (driverKeys.length === 0) return "empty";
setBusy(true);
try {
- const exported = await runAgentOfflineExportFlow({ driverKeys, chooseDestination, exportPackage });
+ const exported = await runAgentOfflineExportFlow({ driverKeys, includeJres, chooseDestination, exportPackage });
if (!exported) return "cancelled";
await onSuccess(exported);
diff --git a/crates/dbx-driver-agent/src/agent_offline_export.rs b/crates/dbx-driver-agent/src/agent_offline_export.rs
index 4e4d7a0b08..fd96396674 100644
--- a/crates/dbx-driver-agent/src/agent_offline_export.rs
+++ b/crates/dbx-driver-agent/src/agent_offline_export.rs
@@ -108,13 +108,14 @@ pub fn export_agents_offline(
am: &AgentManager,
destination: &Path,
selected_driver_keys: &[String],
+ include_jres: bool,
) -> Result<AgentOfflineExportResult, String> {
// Driver install/uninstall operations intentionally share the read side of
// this lock so different drivers can be managed concurrently. Export must
// take the write side because it reads an arbitrary set of drivers and JREs
// as one consistent snapshot.
let _installation_guard = am.installation_operation_lock.blocking_write();
- export_agents_offline_unlocked(am, destination, selected_driver_keys)
+ export_agents_offline_unlocked(am, destination, selected_driver_keys, include_jres)
}
fn preview_agent_offline_export_unlocked(am: &AgentManager) -> AgentOfflineExportPreview {
@@ -313,6 +314,7 @@ fn export_agents_offline_unlocked(
am: &AgentManager,
destination: &Path,
selected_driver_keys: &[String],
+ include_jres: bool,
) -> Result<AgentOfflineExportResult, String> {
let selected = selected_driver_keys.iter().map(String::as_str).collect::<BTreeSet<_>>();
if selected.is_empty() {
@@ -350,7 +352,7 @@ fn export_agents_offline_unlocked(
format!("dbx-agent-{db_type}-{}{suffix}", AgentManager::current_platform())
}
};
- if kind == AgentOfflineArtifactKind::Jar {
+ if kind == AgentOfflineArtifactKind::Jar && include_jres {
required_jres.insert(installed.jre.clone());
}
drivers.push(PreparedDriver {
@@ -1414,7 +1416,8 @@ mod tests {
let package = temp.path().join("agents.zip");
let result =
- export_agents_offline_unlocked(&source, &package, &["kafka".to_string(), "duckdb".to_string()]).unwrap();
+ export_agents_offline_unlocked(&source, &package, &["kafka".to_string(), "duckdb".to_string()], true)
+ .unwrap();
assert_eq!(result.driver_count, 2);
assert_eq!(result.jre_count, 1);
let plan = inspect_offline_package(&package).unwrap();
@@ -1475,6 +1478,28 @@ mod tests {
assert!(!names.iter().any(|name| name.contains("state.json") || name.contains("agent-launch.json")));
}
+ #[tokio::test]
+ async fn jar_export_can_skip_the_jre_runtime_on_request() {
+ let temp = tempfile::tempdir().unwrap();
+ let source = manager(&temp.path().join("source"));
+ install_managed_jar(&source, "duckdb", "1.2.3", "temurin-21", false);
+ // Eligibility requires the *source* machine to have the JRE installed;
+ // the flag only controls whether the runtime ships in the package.
+ install_managed_jre(&source, "temurin-21", "21.0.5");
+ let package = temp.path().join("jar-no-jre.zip");
+
+ let result = export_agents_offline_unlocked(&source, &package, &["duckdb".to_string()], false).unwrap();
+ assert_eq!(result.driver_count, 1);
+ assert_eq!(result.jre_count, 0);
+ let plan = inspect_offline_package(&package).unwrap();
+ assert_eq!(plan.driver_keys, vec!["duckdb"]);
+ assert!(!plan.includes_jre);
+
+ let target = manager(&temp.path().join("target"));
+ let imported = import_agents_from_package(&target, &package, |_| {}).await.unwrap();
+ assert_eq!(imported.drivers_installed, vec!["duckdb"]);
+ }
+
#[tokio::test]
async fn exported_native_package_round_trips_without_a_jre() {
let temp = tempfile::tempdir().unwrap();
@@ -1482,7 +1507,7 @@ mod tests {
let native_bytes = install_managed_native(&source, "duckdb", "1.2.3");
let package = temp.path().join("native-agents.zip");
- let result = export_agents_offline_unlocked(&source, &package, &["duckdb".to_string()]).unwrap();
+ let result = export_agents_offline_unlocked(&source, &package, &["duckdb".to_string()], true).unwrap();
assert_eq!(result.driver_count, 1);
assert_eq!(result.jre_count, 0);
let plan = inspect_offline_package(&package).unwrap();
@@ -1533,7 +1558,7 @@ mod tests {
assert!(candidate(&preview_agent_offline_export_unlocked(&source), "h2").eligible);
let package = temp.path().join("agents.zip");
- let result = export_agents_offline_unlocked(&source, &package, &["h2".to_string()]).unwrap();
+ let result = export_agents_offline_unlocked(&source, &package, &["h2".to_string()], true).unwrap();
assert_eq!(result.driver_count, 1);
assert_eq!(result.jre_count, 1);
@@ -1630,7 +1655,7 @@ mod tests {
);
let destination = temp.path().join("stale.zip");
- let error = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()]).unwrap_err();
+ let error = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()], true).unwrap_err();
assert!(error.contains("cannot be exported"), "unexpected error: {error}");
assert!(!destination.exists());
assert!(!fs::read_dir(temp.path())
@@ -1648,7 +1673,7 @@ mod tests {
let export_manager = std::sync::Arc::clone(&am);
let destination = temp.path().join("waited.zip");
let mut export = tokio::task::spawn_blocking(move || {
- export_agents_offline(&export_manager, &destination, &["duckdb".to_string()])
+ export_agents_offline(&export_manager, &destination, &["duckdb".to_string()], true)
});
assert!(
@@ -1672,7 +1697,7 @@ mod tests {
let destination = temp.path().join("existing.zip");
fs::write(&destination, b"keep-me").unwrap();
- let error = export_agents_offline_unlocked(&am, &destination, &["missing".to_string()]).unwrap_err();
+ let error = export_agents_offline_unlocked(&am, &destination, &["missing".to_string()], true).unwrap_err();
assert!(error.contains("not installed"));
assert_eq!(fs::read(destination).unwrap(), b"keep-me");
}
@@ -1702,7 +1727,7 @@ mod tests {
let destination = temp.path().join("existing.zip");
fs::write(&destination, b"replace-me").unwrap();
- let result = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()]).unwrap();
+ let result = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()], true).unwrap();
assert_eq!(result.driver_count, 1);
assert_ne!(fs::read(&destination).unwrap(), b"replace-me");
assert_eq!(inspect_offline_package(&destination).unwrap().driver_keys, vec!["duckdb"]);
@@ -1716,7 +1741,7 @@ mod tests {
let parent = temp.path().join("new-directory");
let destination = parent.join("agents.tar.zst");
- let error = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()]).unwrap_err();
+ let error = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()], true).unwrap_err();
assert!(error.contains(".zip extension"), "unexpected error: {error}");
assert!(!parent.exists());
}
@@ -1730,7 +1755,7 @@ mod tests {
fs::create_dir(&destination).unwrap();
fs::write(destination.join("sentinel"), b"keep-me").unwrap();
- let error = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()]).unwrap_err();
+ let error = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()], true).unwrap_err();
assert!(error.contains("regular non-symbolic-link file"), "unexpected error: {error}");
assert_eq!(fs::read(destination.join("sentinel")).unwrap(), b"keep-me");
}
@@ -1748,7 +1773,7 @@ mod tests {
let destination = temp.path().join("existing.zip");
symlink(&target, &destination).unwrap();
- let error = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()]).unwrap_err();
+ let error = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()], true).unwrap_err();
assert!(error.contains("regular non-symbolic-link file"), "unexpected error: {error}");
assert_eq!(fs::read(&target).unwrap(), b"keep-me");
assert!(fs::symlink_metadata(&destination).unwrap().file_type().is_symlink());
@@ -1760,7 +1785,7 @@ mod tests {
let am = manager(&temp.path().join("agents"));
let destination = temp.path().join("empty.zip");
- let error = export_agents_offline_unlocked(&am, &destination, &[]).unwrap_err();
+ let error = export_agents_offline_unlocked(&am, &destination, &[], true).unwrap_err();
assert!(error.contains("Select at least one"));
assert!(!destination.exists());
}
@@ -1772,7 +1797,7 @@ mod tests {
install_managed_native(&am, "duckdb", "1.2.3");
let destination = am.base_dir().join("must-not-overwrite.zip");
- let error = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()]).unwrap_err();
+ let error = export_agents_offline_unlocked(&am, &destination, &["duckdb".to_string()], true).unwrap_err();
assert!(error.contains("managed Agent store"), "unexpected error: {error}");
assert!(!destination.exists());
}
diff --git a/src-tauri/src/commands/agents.rs b/src-tauri/src/commands/agents.rs
index c541da3e62..b988afe9dc 100644
--- a/src-tauri/src/commands/agents.rs
+++ b/src-tauri/src/commands/agents.rs
@@ -263,10 +263,16 @@ pub async fn export_agents_offline(
state: State<'_, Arc<AppState>>,
path: String,
driver_keys: Vec<String>,
+ include_jres: Option<bool>,
) -> Result<AgentOfflineExportResult, String> {
let state = Arc::clone(state.inner());
run_blocking_agent_task("Failed to run the offline Agent export task", move || {
- export_agents_offline_core(&state.agent_manager, std::path::Path::new(&path), &driver_keys)
+ export_agents_offline_core(
+ &state.agent_manager,
+ std::path::Path::new(&path),
+ &driver_keys,
+ include_jres.unwrap_or(true),
+ )
})
.await
}