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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
revert: restore typed Agent RPC response path
luo jiyin540677b3827f
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex ae3e1bba2c..50a0c0a1e8 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -695,46 +695,6 @@ jobs:if-no-files-found: errorretention-days: 7- - name: Measure Agent RPC monomorphization- if: github.head_ref == 'perf/win7-agent-rpc-monomorphization'- shell: pwsh- run: |- $outputDir = Join-Path $env:RUNNER_TEMP "dbx-agent-rpc-mono"- New-Item -ItemType Directory -Force -Path $outputDir | Out-Null- $env:TAURI_CONFIG = Get-Content src-tauri/tauri.webview2-win7-fixed.conf.json -Raw- $env:RUSTC_WRAPPER = ""- $timer = [System.Diagnostics.Stopwatch]::StartNew()- cargo -Z host-config -Z target-applies-to-host -Z build-std=std,panic_abort `- --config .github/fixtures/win7-host-repro-config.toml `- rustc --locked --package dbx --lib --release --features custom-protocol `- --target x86_64-win7-windows-msvc -- `- "-Zdump-mono-stats=$outputDir" "-Zdump-mono-stats-format=json"- if ($LASTEXITCODE -ne 0) {- exit $LASTEXITCODE- }- $timer.Stop()- $monoFile = Get-ChildItem $outputDir -File -Filter "*.mono_items.json" | Select-Object -First 1- if (!$monoFile) {- throw "dbx_lib monomorphization data is missing."- }- $items = Get-Content $monoFile.FullName -Raw | ConvertFrom-Json- "dbx_lib profile: $([math]::Round($timer.Elapsed.TotalSeconds, 2)) seconds" >> $env:GITHUB_STEP_SUMMARY- foreach ($symbol in @("AgentDriverClient::call_typed_with_timeout_and_cancel::{closure#0}", "AgentDriverClient::call_value_with_timeout_and_cancel::{closure#0}", "AgentRuntimeClient::call_typed::{closure#0}")) {- $item = $items | Where-Object { $_.name.EndsWith($symbol) } | Select-Object -First 1- if ($item) {- "$symbol`: $($item.instantiation_count) instances, estimate $($item.total_estimate)" >> $env:GITHUB_STEP_SUMMARY- }- }-- - name: Upload Agent RPC monomorphization data- if: github.head_ref == 'perf/win7-agent-rpc-monomorphization'- uses: actions/upload-artifact@v6- with:- name: DBX-win7-agent-rpc-mono- path: ${{ runner.temp }}/dbx-agent-rpc-mono/*.mono_items.json- if-no-files-found: error- retention-days: 7-- name: Measure dbx library command registry expansionif: vars.WIN7_REGISTRY_AB == 'true'shell: pwshdiff --git a/crates/dbx-driver-agent/src/agent_driver.rs b/crates/dbx-driver-agent/src/agent_driver.rsindex 4bc023ea47..b2a56f6096 100644--- a/crates/dbx-driver-agent/src/agent_driver.rs+++ b/crates/dbx-driver-agent/src/agent_driver.rs@@ -1,4 +1,3 @@-use std::any::Any;use std::collections::{HashMap, VecDeque};use std::fmt;use std::io::{BufRead, BufReader, BufWriter, Write};@@ -18,14 +17,6 @@ use crate::agent_recovery::{RecoveryDecision, RecoveryPolicy, RecoveryScope};use crate::models::connection::DatabaseConnectionInfo;type PendingAgentResponse = tokio::sync::oneshot::Sender<Result<Value, String>>;-type AgentDecodedResult = Box<dyn Any + Send>;-type AgentResultDecoder = fn(Value) -> Result<AgentDecodedResult, String>;--fn deserialize_agent_result<T: DeserializeOwned + Send + 'static>(value: Value) -> Result<AgentDecodedResult, String> {- serde_json::from_value::<T>(value)- .map(|result| Box::new(result) as AgentDecodedResult)- .map_err(|error| format!("Failed to deserialize agent result: {error}"))-}#[derive(Clone)]struct CachedAgentQuery {@@ -1818,26 +1809,6 @@ impl AgentDriverClient {timeout_duration: Option<Duration>,cancel_token: Option<CancellationToken>,) -> Result<T, AgentCallError> {- let result = self- .call_decoded_with_timeout_and_cancel(- method,- params,- timeout_duration,- cancel_token,- deserialize_agent_result::<T>,- )- .await?;- Ok(*result.downcast::<T>().expect("Agent result decoder returned a different type"))- }-- async fn call_decoded_with_timeout_and_cancel(- &mut self,- method: &str,- params: Value,- timeout_duration: Option<Duration>,- cancel_token: Option<CancellationToken>,- decode: AgentResultDecoder,- ) -> Result<AgentDecodedResult, AgentCallError> {if let Some(runtime) = &self.shared_runtime {let agent_session_id = self.agent_session_id.clone();let mut params = params;@@ -1851,15 +1822,10 @@ impl AgentDriverClient {.ok_or_else(|| "Agent RPC parameters must be an object".to_string())?.insert("agentSessionId".to_string(), Value::String(session_id.clone()));}- let result: Value = runtime+ return runtime.call_typed(method, params, timeout_duration, cancel_token).await- .map_err(|error| error.with_legacy_session_id(agent_session_id.as_deref()))?;- return decode(result).map_err(|message| AgentCallError::ContractViolation {- rpc_code: None,- message,- reason: ContractViolationReason::InvalidResult,- });+ .map_err(|error| error.with_legacy_session_id(agent_session_id.as_deref()));}self.next_id += 1;let id = self.next_id;@@ -1958,7 +1924,8 @@ impl AgentDriverClient {let result = if let Some(err) = resp.get("error") {Err(format_agent_rpc_error(err))} else if let Some(result_val) = resp.get("result") {- decode(result_val.clone())+ serde_json::from_value::<T>(result_val.clone())+ .map_err(|e| format!("Failed to deserialize agent result: {e}"))} else {Err(format!("Agent response missing both 'result' and 'error': {line}"))};