dsh-data-agent: Managing Data Sources and Executing SQL in DSH Conversations and Settings

Introduction

When performing data analysis or troubleshooting issues in DeepSeek Harness (dsh), the model often needs to connect to databases, inspect table structures, and execute queries. Manually writing connection strings or including passwords in chat records every time is difficult to reuse and insecure. The community plugin dsh-data-agent (npm package @tomowang/dsh-data-agent) consolidates data source registration, connectivity checks, Schema browsing and annotation, read-only SQL execution, and chart rendering into a single set of capabilities: it can be invoked via chat tools or maintained in the Web UI Settings. The following section introduces its positioning, capabilities, and installation methods.

What is this

dsh-data-agent is a dsh client plugin published by the maintainer tomowang (GitHub: tomowang/dsh-data-agent). The official description is: Manage database connections, browse/annotate Schemas, and execute SQL within conversations or the Settings UI.

Supported database types include MySQL, PostgreSQL, SQLite, and ClickHouse. Passwords are not written into the plugin configuration: connection entries reference the environment variable name passwordEnv, which is resolved via the harness’s ctx.credentials (if mounted) or process.env upon connection; the variable name must start with DSH_DA_ (e.g., DSH_DA_PROD_DB_PASSWORD) to avoid accidentally reading unrelated keys on the host.

Plugin catalog page: https://www.skillhub.cn/plugins/tomowang/dsh-data-agent.

Core Features

Data Source Management

  • Register, edit, delete, and list data sources: via chat tools da_add_data_source / da_edit_data_source / da_remove_data_source / da_list_data_sources, or via Settings → Data Sources.
  • Credentials (including passwordEnv) can only be bound in Settings; chat tools cannot set passwordEnv, nor can they modify host, port, user, ssl, etc., for data sources with bound passwords from chat, reducing the risk of prompt injection redirecting passwords to other hosts.

Connectivity and Schema

  • da_test_connection checks the connection.
  • da_get_schema returns a database-level overview or single-table column-level details; displayed as Markdown tables in chat, and as expandable rich UI in chat cards and the Settings Schema viewer.

Table/Column Annotation

  • Chat: da_set_comment.
  • Settings Schema viewer: inline editing via click.
  • Both write to the same storage.

SQL Execution and Read-Only

  • da_run_sql executes SQL; for data sources marked as read-only, write statements are rejected via AST validation (not simple string matching), and statement-stacking is always rejected.
  • Chat tool da_set_read_only can set a data source as read-only; unchecking read-only is only possible in Settings, preventing an injected model from first disabling read-only and then writing.
  • In read-only mode, operations are also run in read-only on the database side, and a batch of known functions that can bypass read-only (such as pg_read_file, LOAD_FILE, ClickHouse file(), dblink_exec, pg_advisory_lock, GET_LOCK, etc.) are rejected; the documentation still recommends connecting with a database user with minimal privileges.
  • SQLite: da_run_sql rejects ATTACH and VACUUM INTO on all data sources. When adding SQLite from chat, the file path must be within the sqliteChatDirs directory configured in the plugin (validated after resolving symbolic links and ..); the default list is empty, usually requiring addition in Settings or explicit directory allowance in configuration:
config:
  sqliteChatDirs:
    - /home/me/data

Charts

  • da_render_chart renders bar/stacked bar/line/pie charts using chart.js; data can come from inline data or a resultId referencing a previous da_run_sql result (cached in session memory for ~30 minutes).
  • In addition to interactive charts in the Web UI, the server uses skia-canvas to rasterize PNGs and return URLs, facilitating embedding in Markdown images within model responses.

Installation and Activation

Requires dsh 0.2.1-rc.2 or higher, and the web profile must have been started at least once (dsh --profile web). The current plugin version on npm is 0.5.1 (subject to the package release); peerDependencies require @deepseek-ai/dsh >= 0.2.1-rc.2.

Command-line installation (excerpt from README, do not manually concatenate github:owner/repo):

# 1. Install dsh launcher
npm install -g @deepseek-ai/dsh

# 2. Add plugin to web profile
dsh plugin --profile web add @tomowang/dsh-data-agent

# 3. Approve skia-canvas native build scripts (required for da_render_chart PNG output)
dsh plugin --profile web approve-builds

Restart the web profile process after installation to load the plugin. Alternatively, search for tomowang/dsh-data-agent in the dsh-market in the Web UI and click Install.

Node engine requirement (package.json): ^22.19.0 || >=24.0.0. License: MIT.

Typical Usage (Chat Tools)

Assuming data sources and password environment variables are configured, the common workflow is:

  1. da_list_data_sources to view registered connections.
  2. da_test_connection to confirm reachability.
  3. da_get_schema to browse database or single-table structures; supplement annotations with da_set_comment or Settings if needed.
  4. Read-only exploration: da_set_read_only (if not already read-only) followed by da_run_sql queries; use da_render_chart with resultId or inline data for visualization.
  5. Write operations are executed via da_run_sql only on non-read-only data sources where the database user has corresponding privileges; sensitive changes still recommend controlling read-only and credentials in Settings.

The README provides demo videos and screenshots of the Settings → Data Agent panel for UI operation reference.

Use Cases and Notes

Suitable for: Teams or individuals already running agents in the dsh web environment, needing repeatable data source configurations, querying data/viewing charts in conversations, and wanting password/host binding and read-only policies isolated from chat.

Notes:

  • The plugin runs with current dsh process privileges; read the source code and MIT license before installation and assess risks yourself.
  • Read-only mode is not a complete permission system; use database accounts with minimal privileges for each data source.
  • Settings → Data Sources uses dsh authenticated APIs, requiring the browser to be logged into dsh; if prompted as not logged in, please reopen using the URL printed at startup.
  • Upgrading from 0.4 to 0.5 requires upgrading dsh to 0.2.1-rc.2 first; migration notes from 0.3 to 0.4 involve the DSH_DA_ prefix, sqliteChatDirs, read-only removal only in Settings, etc., refer to the Upgrading section in the GitHub README.

The DeepSeek Harness ecosystem emphasizes “everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-data-agent unifies multi-engine connectivity, Schema browsing and annotation, AST-constrained SQL with read-only policies, and chart.js charts with PNG export into dsh’s chat tools and Settings. If you are doing data Q&A or ops data querying in the harness, you can install it via the commands above and configure DSH_DA_* environment variables and data sources in Settings first.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye