npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@amaster.ai/dsh-storage

v0.1.16

Published

Session storage mirror for DeepSeek Harness: projects the session event stream into MySQL/PostgreSQL/SQLite/SQL Server (ai_messages / ai_chat_histories) without replacing dsh's local persistence.

Readme

@amaster.ai/dsh-storage

dsh-storage preview

Session storage mirror for DeepSeek Harness (dsh): projects the session/event stream into MySQL/PostgreSQL/SQLite/SQL Server (ai_messages / ai_chat_histories, same tables as the source project) without replacing dsh's local persistence — local files stay authoritative, this is a mirror.

Use it when a dsh profile needs durable, queryable session data in an existing relational database while preserving the runtime's local session store as the source of truth.

Install

dsh plugin --profile my-agent add @amaster.ai/dsh-storage

Runtime peers: @prisma/client (Prisma 7) plus the driver adapter for your database:

| Provider | Adapter peer | | --- | --- | | mysql | @prisma/adapter-mariadb | | postgresql | @prisma/adapter-pg | | sqlite | @prisma/adapter-libsql | | sqlserver | @prisma/adapter-mssql |

The PrismaClient is pre-generated per provider and shipped in the package — no prisma generate step for consumers.

Configuration

Disabled by default. Configure via the profile's cordis.patch.yml:

- insert:
    - id: storage-mirror
      name: '@amaster.ai/dsh-storage'
      config:
        enabled: true
        database:
          enabled: true
          provider: mysql   # mysql | postgresql | sqlite | sqlserver
          url: mysql://user:pass@host:3306/agent

Create or upgrade the tables with the shipped schema variant:

npx prisma db push --schema node_modules/@amaster.ai/dsh-storage/prisma/schema.mysql.prisma --url "mysql://user:pass@host:3306/agent"
# schema.postgresql.prisma / schema.sqlite.prisma / schema.sqlserver.prisma work the same way

Data model

  • ai_messages — user and model rows, with thoughts, tokens, tool_calls, agent_id, metadata JSON columns and soft-delete. A tool/result updates the matching model row's tool_calls entry by call ID; it does not create a type=tool row.
  • ai_chat_histories — per-session rollup (message count, total tokens, first/last message timestamps).

The logical message id rides in metadata.id; message rows use a deterministic hash of (session_id, message id) as their primary key, so re-projected events upsert in place rather than duplicate — on every connector. Session rows are matched by session_id and keep their cuid primary keys. One deviation from the source project: no user_id column — tenancy rides on session_id.

For user/message rows, content remains the text projection, while metadata.message retains the original user message as received, including source and ordered content blocks. Image/file blocks keep whatever attachment reference, path, URL, or inline data the incoming message actually contains; this mirror does not fetch or rewrite attachments. Re-projection writes the same raw message into the existing row.

The tool_calls array retains dsh's tool-call blocks (id, name, arguments); the matching entry gains the structured result block and, on failure, an error identity. The plugin reads persisted model rows to match results across process restarts and upserts the same row ID, so duplicate results do not add rows or increment the session's message count. Existing historical type=tool rows are left intact.

When an assistant message contains dsh reasoning blocks, thoughts is an array of { content } entries in block order. If the adapter supplies a matching signature in the message's source.replayState.blocks, that entry also carries thoughtSignature. The full model source, including opaque replayState, is preserved in row metadata for lossless provider replay. The backend's readMessages() also accepts older { description } entries and JSON string thoughts, returning them as { content }. subject and a per-thought timestamp are not invented when the upstream message does not supply them.

SQL Server note: Prisma's sqlserver connector has no Json type, so its variant maps the JSON columns to text — the backend serializes them on write automatically (SQL Server's ISJSON / JSON_VALUE still query the text as JSON).

Mirroring is a no-throw seam: backend errors are logged with a [dsh-storage] prefix and never escape into the agent loop.

Archive a session

When handling a session-clear request, call await ctx.get('dshStorage').archiveSession(sessionId) after stopping the live turn. It waits for queued mirror writes, then transactionally assigns all current, non-deleted ai_messages rows (history_id IS NULL) to a non-deleted ai_chat_histories row. The returned history ID can be used to query those rows directly from the database; a second call with no active messages returns null. A database failure rejects this explicit operation instead of reporting a successful clear.

Archived rollups stay queryable. The plugin recognizes an active rollup as a history row with no associated messages, so the next projected event creates a fresh rollup instead of overwriting the archived one. The caller owns stopping/replacing the dsh session surface and any A2A task state; this operation only archives the database mirror.

Compatibility

Pinned dsh/cordis versions live in the root compat matrix. Event payloads ride pre-release dsh APIs — check the TODO(verify) markers in src/ before upgrading dsh.

License

MIT