@tomowang/dsh-data-agent
DeepSeek Harness 的数据库连接与 SQL 插件:注册数据源,浏览并注释表结构,通过 AST 校验执行 SQL(每个数据源可单独切换只读),并渲染柱状图、折线图和饼图,可在对话或设置页中使用。
安装
dsh plugin --profile web add @tomowang/dsh-data-agent
沙箱测试结果
| 阶段 | 结果 |
|---|---|
| 1 安装 | ✗ |
| 2 列装 | — |
| 3 挂载 | — |
| 4 启动 | — |
TIMEOUT四阶段在隔离沙箱里跑:安装(有网)→ 列装 → 挂载 → 启动(后三步断网)。
README
dsh-data-agent




A DeepSeek Harness (dsh) plugin for managing database connections and running SQL, both conversationally and from the Web UI's Settings page.
Features
- Data-source management — register MySQL, PostgreSQL, SQLite, or ClickHouse connections (
da_add_data_source/da_edit_data_source/da_remove_data_source/da_list_data_sources), or manage them from Settings → Data Sources. - Connection checks & schema browsing —
da_test_connectionandda_get_schema(database overview or full column detail for one table), rendered as a Markdown table in chat and as a rich, expandable browser in both the chat card and the Settings schema viewer. - Table/column comments —
da_set_commentfrom chat, or click-to-edit inline in the Settings schema viewer; both write to the same store. - SQL execution with a read-only toggle —
da_run_sql, AST-verified (not string-matched) to reject write statements on a read-only source and to always reject statement-stacking. Chat can make a source read-only (da_set_read_only), but only the checkbox in Settings can make it read-write again, so a prompt-injected model can't lift the flag and then write. - Charts —
da_render_chartrenders achart.jsbar/stacked-bar/line/pie chart from eitherdata(inline rows) orresultId(a priorda_run_sqlcall's result, referenced by id instead of resent — cached in memory per conversation for 30 minutes). Alongside the interactive Web UI chart, it also rasterizes a static PNG server-side (viaskia-canvas) and returns a URL to it, so the chart can be embedded as a Markdown image in the model's own reply.
Secrets are never stored directly: connections reference a passwordEnv (an environment variable name), resolved at connect time via the harness's ctx.credentials seam when mounted, else process.env.
The variable name must start with DSH_DA_ (e.g. DSH_DA_PROD_DB_PASSWORD), so a source can never read an unrelated secret such as an API key from the host environment. Credentials are attached only from Settings → Data Sources, never from chat: the chat tools can't set passwordEnv, and on a source that has one they can't change host, port, user, ssl, sslmode, or sslrootcert. That way a prompt-injected model can't redirect a saved password to another host.
SQLite file paths get the same treatment. From chat, a SQLite source's path must be inside a directory listed in the plugin's sqliteChatDirs config, checked after resolving symlinks and ..; file: URIs are refused. da_run_sql also refuses SQLite ATTACH and VACUUM INTO on every source, read-write included, since both open or create a database file at any path. The list is empty by default, so SQLite sources are added from Settings unless you opt a directory in:
config:
sqliteChatDirs:
- /home/me/data
Read-only mode isn't a permission system. On a read-only source, da_run_sql rejects writes and runs each query under the database's own read-only mode, and it refuses functions known to get around that: reading server files (pg_read_file, LOAD_FILE, ClickHouse file()), writing through a second connection (dblink_exec), and taking session locks that outlive the query (pg_advisory_lock, GET_LOCK). That list can't cover every function or extension installed on your server, so connect each source as a database user with only the privileges you want chat to have — e.g. SELECT on the tables it should see, and no superuser, FILE, or pg_read_server_files.
Demo
https://github.com/user-attachments/assets/fa149214-cdd0-4820-9711-8e7451bb462f
Connections, schema, and read-only toggling are also manageable straight from Settings → Data Agent:
Install
Requires dsh 0.2.1-rc.2 or later, and a web profile already booted at least once (dsh --profile web). The package declares this as a peerDependencies range on @deepseek-ai/dsh: dsh 0.1.7-rc.1 and later refuse to load the plugin on an older runtime, while releases before that don't check the range at all.
# 1. Install the dsh launcher npm install -g @deepseek-ai/dsh # 2. Install this bundle into the web profile dsh plugin --profile web add @tomowang/dsh-data-agent # 3. Approve skia-canvas's native build script (needed for da_render_chart's PNG output) dsh plugin --profile web approve-builds
dsh reconciles the profile manifest's dsh.profile.bundles list automatically (this package declares dsh.bundle.patch), fetching the published npm package — no local checkout or build step needed. Restart the web profile process to pick it up.
Installing from the dsh-market
Alternatively, you can install @tomowang/dsh-data-agent from the dsh-market in the Web UI.
Search tomowang/dsh-data-agent, and click Install on the result.
Upgrading from 0.4 to 0.5
0.5 requires dsh 0.2.1-rc.2 or later; older dsh refuses to load it. Upgrade dsh first (npm install -g @deepseek-ai/dsh@0.2.1-rc.2), then the plugin.
dsh 0.2.1 no longer binds the web listener to 0.0.0.0: it listens on one concrete address, optionally over HTTPS. da_render_chart image links now use that listener's own origin (`http(s)://<bind addr
…(truncated)
以上内容来自 npm 上的 README,我们只做格式化,不改内容。
版本
npm 上共发布:8,最后更新 2026-10-17