Introduction

Managing a dozen databases or APIs across multiple machines often means repeated configuration. DSH handles connections but lacks management of what can be fetched, which key is used, and what was fetched. The dsh-stash plugin centralizes external resource registration, access control, and retrieval ledgers, addressing cross-machine synchronization and access control.

Core Positioning

dsh-stash is a keyring that links DSH to external resource repositories. It provides 11 tools for models to query resource catalogs, perform retrieval, check connectivity, and manage credentials. The maintainer is danieldu168, and the license is MIT.

It mainly answers three questions:

  1. Can it fetch? Hard constraints declared via access are denied directly and do not fail silently.
  2. Which key to use? The key ledger works with the host credential service; values do not enter the model.
  3. What was fetched this time? The retrieval ledger records only fingerprints.

Installation and Enablement

Install the plugin using pnpm:

pnpm dsh plugin --profile web add "github:danieldu168/dsh-stash#v0.11.2"

After installation, restart the Profile and refresh the browser. The removal command:

pnpm dsh plugin --profile web remove dsh-stash

Plugin upgrades must be performed by reinstalling with a new tag. The DSH manager does not support update, and an unchanged specification string triggers a restore.

Resource Registration

The registry is located at ${DSH_HOME}/stash/sources.mjs and exports an array by default. Changes do not require a restart; it is reread on invocation.

Declarative configuration example:

export default [
  {
    id: 'myapi',
    name: '我的接口',
    kind: 'remote',
    handler: 'http',
    access: 'public-api',
    request: {
      url: 'https://api.example.com/search',
      query: { q: '{query}' },
      pick: 'data.items',
      limit: 50,
      required: ['query'],
    },
  },
]

Key points:
* {param_name} passes a parameter; {?param_name} marks an optional parameter. If the parameter is missing, the key is dropped.
* When using a key, provide the reference name in credentials: ['MY_API_KEY'], not the value.
* Local files and built-in handlers are supported.

Local file registration:

{ id: 'mydocs', kind: 'files', paths: ['D:/papers'] }

Built-in handler:

{ handler: 'trade_stats' }

Access Control and Credentials

The access field defines permissions and can be set to public-api (public), official-api (official), export-import (denied), or unsupported (denied). If undeclared, access is allowed but a notice is shown.

Credential values are stored only as references. They are not stored in stash and not returned to the model. Values are provided through the “Settings → stash” panel or /stash import, ultimately stored in $DSH_HOME/.env or the panel.

Ledger and Tools

It provides 11 model tools: catalog, fetch, doctor, lesson, source, credential, and so on.

The retrieval ledger records ledgerId and contentHash but not the response body. When records exceed 2,000 entries, older records are trimmed.

Migration

Use command-line operations for data migration:

# 导出(不带值,或带值/语料)
/stash export --out "D:\stash-export"
# 导入(值覆盖,条目并集)
/stash import "D:\stash-export"
# 清空(需校验码)
/stash wipe --confirm <校验码>

Limitations and Non-Goals

  • Does not perform general web scraping; long-term page tracking should use corpus.
  • Does not automate SSO for database logins.
  • Does not store or read back values.
  • Lessons are not written automatically and require manual decision.

Ecosystem Context

The DSH philosophy is “everything is a plugin.” Through declarative configuration and centralized management, this plugin provides a stable external data access layer for agent development.