Back to home

orangeshinee

dsh-mem0

No description

Stars
1
Language
JavaScript
Created
Aug 16, 2026
Updated
Aug 16, 2026

Introduction

dsh-mem0

中文 | English

自托管 mem0 记忆读写的 dsh(DeepSeek Harness)插件:宿主 Agent 通过 mem0_* 工具直接读写你自己的 mem0 REST 服务(新版 OSS 构建,mem0/mem0-api-server, 带 dashboard,X-API-Key 认证,端点无 /v1 前缀)。

热插拔:通过 dsh plugin add link:<本目录> 挂载,不改 dsh 源码。无侧边栏 UI,但带一个 浏览器端:在设置面板 → 插件 → 插件配置里提供 dsh-mem0 配置卡片(编辑下面的配置项)。

工具

工具端点说明
mem0_addPOST /memories写入记忆(字符串或消息数组;默认按 defaultUserId / defaultAgentId 归类)
mem0_searchPOST /search语义搜索,带相关性分数
mem0_getGET /memories / GET /memories/{id}读取列表(按标识符过滤)或单条
mem0_updatePUT /memories/{id}更新记忆文本 / metadata / 过期时间
mem0_deleteDELETE /memories/{id} / DELETE /memories删除单条;批量删除需 confirm: "DELETE ALL" + admin
mem0_historyGET /memories/{id}/history单条记忆的变更历史
mem0_resetPOST /reset清空全部(需 confirm: "RESET" + admin)
mem0_statusGET /auth/setup-status + GET /configure健康检查 / 认证状态 / 配置(不输出 apiKey)

安装

# 方式一:直接从 GitHub 安装(无需发布,推荐给使用者)
dsh plugin --profile web add github:orangeshinee/dsh-mem0

# 方式一(指定版本):对应 GitHub Releases 的 v* 标签,CI 自动打包
dsh plugin --profile web add github:orangeshinee/dsh-mem0#v0.1.0

# 方式二:npm 发布后安装(维护者先 npm publish 一次)
npm publish   # 维护者操作
dsh plugin --profile web add dsh-mem0

# 方式三:本地开发(link 方式)
dsh plugin --profile web add link:$(pwd)

# 装完重启 dsh web 生效

发布

v* 标签即触发 CI(.github/workflows/release.yml)自动构建并发布 GitHub Release: pnpm build → 四项离线冒烟 → npm pack 产物(dsh-mem0-<version>.tgz)挂到 Release, 并自动生成 changelog。

git tag v0.1.0 && git push origin v0.1.0

标签版本必须与 package.jsonversion 一致(不一致 CI 会失败);若仓库设置了 NPM_TOKEN secret,还会同步 npm publish 到 npm(未设置则跳过,不影响 Release)。

运行时依赖(@deepseek-ai/dsh-settings / @deepseek-ai/dsh-tools / schemastery)已列为 硬依赖,dsh plugin add 会随包安装(profile 默认 autoInstallPeers:false,peerDependencies 不会被装)。

配置

设置面板 → 插件 → 插件配置 → dsh-mem0(或插件构成里的 config 段):

默认说明
baseUrlhttp://127.0.0.1:8888自部署 mem0 地址(无尾斜杠、无 /v1
apiKeydashboard「API Keys」创建的 m0sk_...,或 legacy ADMIN_API_KEY,或 JWT
authTypeapiKeyapiKey / adminKey / jwt / none
defaultUserIdHeTony工具未指定 user_id 时的默认归属
defaultAgentIddsh-agent工具未指定 agent_id 时的默认归属
timeoutMs15000单请求超时
announceToAgenttrue是否向 Agent 宣告插件能力
enabledtrue总开关

配置经 dsh settings provider 持久化;baseUrl / apiKey / 默认标识符的修改即时生效, 无需重启。

插件配置卡片由浏览器端提供(client/client.cjs),通过插件自带的 /api/dsh-mem0/config 路由(src/settings-routes.ts)读写配置——harness 的 settings 线上通道只开放白名单内的命名空间,插件无法自行加入。apiKey 在 schema 上 标记为 role('secret'):路由只下发「已配置/未配置」标记,密钥字面量不会进入浏览器。 修改宿主端代码(src/)后需重新 pnpm build 并重启 dsh web;仅改 client/client.cjs 刷新页面即可。

开发

pnpm typecheck   # tsc --noEmit
pnpm build       # 输出 lib/(ESM,源码在 src/)

构建产物为多文件 ESM(tsc),运行时依赖(@deepseek-ai/dsh-*)从宿主 profile 的 node_modules 解析。

面向 AI agent 的开发说明(代码地图、平台陷阱、安全红线)见 AGENTS.md

License

MIT