@tomowang/dsh-data-agent

toolsinstall failsnpmMIT

Database connections and SQL for DeepSeek Harness: register data sources, browse and comment schemas, run AST-checked SQL with a per-source read-only toggle, and render bar, line and pie charts, from chat or the Settings page.

下载量 / Downloads
1,567
依赖体积 / node_modules
108.98 MB
测试时间 / Tested
2026-11-06
DSH 版本 / Version
0.2.2-rc.1

Install

dsh plugin --profile web add @tomowang/dsh-data-agent

Sandbox test results

StageResult
1 install✗
2 list—
3 mount—
4 boot—
First error
TIMEOUT

Four stages run in an isolated sandbox: install (network on) → list → mount → boot (last three with no network).

README

dsh-data-agent

![npm version](https://www.npmjs.com/package/@tomowang/dsh-data-agent)

![CI status](https://github.com/tomowang/dsh-data-agent/actions/workflows/ci.yml)

![release status](https://github.com/tomowang/dsh-data-agent/actions/workflows/release.yml)

![license](LICENSE)

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_connection and da_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_comment from 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_chart renders a chart.js bar/stacked-bar/line/pie chart from either data (inline rows) or resultId (a prior da_run_sql call'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 (via skia-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)

Rendered from the README published on npm. Formatted only, not edited.

Versions

Published on npm::8,最后更新 2026-10-17

Links

GitHub · Homepage · npm

Same category