treg
superdesigndev
OpenRouter for agent tools. Join community here: https://discord.gg/6mQYYfFMAn
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:monster-30cl/dsh-db-workspace
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A database connection manager for DSH's right sidebar. Configure connections, edit multiple connections in the list, and test availability without leaving the app.
Supports Kingbase, PostgreSQL, MySQL, Oracle, and OceanBase (MySQL or Oracle tenant mode). The plugin also provides read-only SQL queries and schema inspection. It inspects SQL words instead of keyword substrings in field names. Reads use read-only transactions; writes, DDL and maintenance require one-time user approval through db_execute.
Requires a compatible DeepSeek Harness host with sidebar, locale, remote command, and tool services, plus Node.js and npm. This is an application plugin, not a standalone website. The built client.js is included.
git clone https://github.com/monster-30cl/dsh-db-workspace.git
cd dsh-db-workspace
node install.mjs --profile-dir "<profile-directory>" --dry-run
node install.mjs --profile-dir "<profile-directory>"
Replace <profile-directory> with the app's active profile. Restart DSH and open Database connections from the right sidebar or Start page guide.
If the environment supplies DSH_PROFILE_DIR, node install.mjs uses it automatically. Otherwise the script resolves <DSH_HOME>/profiles/<DSH_PROFILE or desktop>, with ~/.dsh as the fallback home. The desktop app may use a different home; prefer its actual profile path. The installer adds a local link: dependency, a bundle entry, and a directory junction. Keep the checkout in place afterwards.
Connection aliases may contain Chinese characters, ASCII letters, digits, hyphens and underscores. Start with a Chinese character, letter or digit; the maximum length is 64 characters. Spaces and other punctuation are not supported. Renaming retains stored credentials and updates the default alias when applicable.
The public cordis.patch.yml uses the host defaults below. Keep personal configuration overrides out of public commits.
| Field | Purpose | Default |
|---|---|---|
configPath |
Connection JSON file | DSH_DB_CONFIG_PATH, then current profile/home (see below) |
driverDirectory |
Directory containing driver node_modules |
database-drivers under the current DSH profile/home |
connectTimeoutMs |
Driver connection timeout, ms | 10000 |
testTimeoutMs |
Connection probe deadline, ms | 15000 |
Install the packages needed for your connections in driverDirectory:
| Connection type | Packages |
|---|---|
| Kingbase / PostgreSQL | pg, pg-connection-string |
| MySQL | mysql2 |
| Oracle | oracledb |
| OceanBase | oceanbase |
For example: npm install --prefix "<driver-directory>" pg pg-connection-string.
This is a fictional example, not a working configuration. Replace the values privately, or create connections through the UI.
{
"default": "demo-postgres",
"databases": {
"demo-postgres": {
"driver": "postgres",
"dsn": "postgresql://demo_user:REPLACE_ME@db.example.invalid:5432/demo"
},
"demo-oceanbase": {
"driver": "oceanbase",
"host": "db.example.invalid",
"port": 2883,
"user": "demo_user",
"password": "REPLACE_ME",
"tenant": "demo_tenant",
"cluster": "demo_cluster",
"database": "demo",
"mode": "mysql"
}
}
}
For an existing connection with an unchanged driver, blank connection-string and password inputs retain stored values. To replace a password, enter a new one and save. Saves back up the previous file as <file>.bak, write <file>.tmp, and rename it into place.
Enabling the plugin registers its own system-prompt section: use db_connections first to resolve aliases, then db_test_connection, db_query, db_schema or the approval-gated db_execute. Tool errors and blocked queries must be reported without automatically falling back to terminal scripts. This is model guidance, not a sandbox restriction on other tools.
A driver directory saved from the panel takes precedence over deployment settings. Without a saved selection, explicit plugin configuration takes precedence; other settings keep their existing precedence. Otherwise configPath uses DSH_DB_CONFIG_PATH, then DSH_PROFILE_DIR/db-config.json, DSH_HOME/db-config.json, and finally ~/.dsh/db-config.json. Drivers use explicit driverDirectory, then DSH_DB_DRIVER_DIRECTORY, then database-drivers under the current DSH profile/home. Existing explicit paths are preserved; nothing is migrated or uploaded. On another device install the plugin in the active profile, install drivers there, add local connections in the panel, and select a default alias. Restart the app to load the tools and policy.
queryTimeoutMs defaults to 30000 (1000–480000). db_query accepts env, sql and limit (default 100, maximum 1000). db_schema accepts env, optional table/schema and limit; omit table to list tables, provide it to list columns (not a complete DDL/index export). Schema filters use driver-specific bound parameters. Returned row limits only bound output, not server work: add an appropriate SQL row limit. Operations run in dedicated database processes. Completion, cancellation or timeout terminates the process before the tool returns, closing its sockets. Read-only credentials are recommended because database functions and external effects are not a SQL sandbox. UPDATE_TIME and CREATE_USER are valid field names. Multiple statements, executable comments and unsupported procedural calls are rejected; never bypass a rejection.
SQL policy is implemented in sql-policy.js; guardQuery in query.js is the read-only entry. Word boundaries, comments and quoted values are inspected without changing SQL text. db_query cannot execute DML, DDL or analysis. Use db_execute to request host approval for the exact connection and single SQL statement. Missing approval UI, rejection or cancellation terminates before connection creation. AI-supplied approval flags are not accepted. No write approval is persisted or reused.
EXPLAIN (including ANALYZE), ANALYZE, VACUUM, OPTIMIZE and REINDEX also require approval and warn about CPU/IO, scans, locks and possible impact on other users. EXPLAIN ANALYZE actually executes its statement. DDL can implicitly commit; it is not generally rollback-safe. After timeout or disconnection, write outcomes may be uncertain: verify before any retry.
Connections are opened per operation and closed immediately after use; they are not retained for 8 minutes. connectionMaxLifetimeMs defaults to 480000 ms and can only be reduced (minimum 1000). The effective deadline is the smaller of the operation timeout and this lifetime. A dedicated child process is terminated on deadline or cancellation, including when driver close hangs. Approval waits do not hold database connections. Local explicit connection settings remain unchanged.
Click the eye button beside a stored password. A native Windows Security dialog requests the current local Windows account password. The plugin checks that the authenticated account matches the running process.
The helper sets RemoteSigned only for its own PowerShell process, without changing system execution policy. Organization policy can still prevent it from running. To check loading without requesting credentials:
powershell.exe -NoProfile -NonInteractive -STA -ExecutionPolicy RemoteSigned -File .\reveal-password.ps1 -Check
ready confirms compilation/loading only, not successful interactive authentication. Failures distinguish credential parsing errors, account mismatch, and Windows logon errors, with numeric codes where available.
| Entry | Purpose |
|---|---|
db_connections |
List metadata without stored passwords or connection strings |
db_test_connection |
Open and close one saved connection to test availability |
db_query |
Read-only SQL with env, sql and optional limit |
db_execute |
One-time user approval for writes, DDL, analysis or maintenance |
db_schema |
List tables or inspect columns with env, table, schema and limit |
/db-config list |
Refresh the listing |
/db-config test <alias> |
Test a saved connection |
/db-config test-draft <json> |
Test an unsaved draft |
/db-config save <json> |
Save a connection |
/db-config default <alias> |
Set the default connection |
/db-config delete <alias> |
Delete a connection |
Password viewing uses an internal /db-config reveal <json> request with an ephemeral public key and challenge; it is not a plaintext-password command. Connection-panel actions use a separate authenticated RPC channel. Listing, testing, choosing the default, deleting and password viewing do not add conversation command rows; errors stay in the panel. Only a successful add or edit emits a short completion notice via a single-use, session-bound receipt. Submitted command input is not recorded (recordInput: false); notices contain no connection settings or credentials. Manually entered slash commands still use the ordinary command history.
npm install
npm run build
npm test
npm run verify
build regenerates client.js; test runs the offline suite with stub drivers; verify checks plugin registration and bundle loading against an empty connection configuration. These checks do not verify live database access or the full Windows credential dialog flow.
| Files | Role |
|---|---|
client/, client.js |
React UI source and built client bundle |
index.js, config.js, store.js |
Host registration, metadata and persistence |
drivers.js, probe.js |
Driver loading, connection tests and error redaction |
credentials.js, reveal*.js, reveal-password.ps1 |
Credential extraction, encrypted transport and native verification |
cordis.patch.yml, install.mjs |
Plugin configuration and profile installation |
test/, verify.mjs |
Offline tests and artifact checks |
The public distribution contains source code and fictional examples only. Never commit real connection files, credentials, backups, or local deployment paths. .gitignore excludes common connection-file names, environment files, backups, temporary files, and archives; it cannot detect sensitive values pasted into source or documentation. Review changes before publishing. The package remains private: true for npm; GitHub visibility is public.
The driver section starts collapsed; click its title to expand or collapse. Click the driver path to open the system folder picker, choose a folder, and select Save and check to change detection, downloads and subsequent connections immediately. Existing packages are not moved or removed. The selection is persisted beside the connection file in device-local db-workspace.settings.json, taking precedence over deployment configuration and environment variables after restart. Do not distribute this settings file.
The installer checks drivers without downloading. The panel shows the directory and missing packages. Confirm download installs the selected driver and dependencies from npm without sending database credentials. Node.js with npm and network access are required. Installation has a three-minute deadline and disables lifecycle scripts. Special modes requiring native clients still need separate configuration. Recheck and retry after failure.
Drivers default to database-drivers under the active DSH profile/home independently of the connection file. Explicit configPath and driverDirectory remain authoritative; remove or update old device paths on a new device. Connections are never automatically migrated or overwritten.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 库。