dsh-web
zhu1090093659
DeepSeek Harness (DSH) Web 插件聚合生态 · 万物皆插件,通过创意工坊分发||DeepSeek Harness (DSH) Web Plugin Aggregation Ecosystem · Everything is a plugin, distributed via the Creative Workshop
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:c-ling/dsh-plugin-pet
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
DeepSeek Harness Web GUI 的桌面电子宠物插件:由实时 agent 状态驱动心情动画,支持内置形象、自定义图片与 Codex 风格多帧精灵图导入。
一个为 DeepSeek Harness Web GUI 打造的桌面电子宠物插件,灵感来自 Codex companion 与 Claude Code Buddy。宠物常驻页面右下角,实时响应 agent 的状态(思考 / 调用工具 / 报错 / 完成 / 等待你操作),并支持改名、缩放、隐藏与完全换肤:
pet.json + spritesheet.webp,V1
1536×1872 与 V2 1536×2288,见 Codex pet package spec),
或配置通用网格(列数 / 行数 / fps / 各心情状态行)所有二进制素材(自定义图片/精灵图)都保存在 $DSH_HOME/storages/dsh-plugin-pet/ 下,重启 dsh web 后仍然保留。
在 DSH 1.0.7 且挂载 settings 服务时,宠物配置会写入 $DSH_HOME/settings.yaml;没有 settings 服务时自动回退到 storages/dsh-plugin-pet/config.json。
| 文件 | 作用 |
|---|---|
lib/index.js |
宿主插件:宠物持久化 + 挂在 harness webServer 服务上的 HTTP 路由 |
lib/client.js |
浏览器 bundle(手写 factory-CJS,无构建步骤):宠物浮层与设置面板 |
test/ |
node --test 测试套件,覆盖宿主路由与零依赖图片嗅探器 |
本包是双面插件:宿主半边是普通 Cordis 插件;客户端半边通过
"dsh": { "client": { "platform": "web", "inject": [], "immediately": true } } 加
"./client" 导出声明,因此 harness 的 client 模块系统会在
/plugins/dsh-plugin-pet/client.js 提供它,并在启动时立即加载。
从 GitHub 安装到 web profile(需要 pnpm 在 PATH 上;没有则用下面的 corepack 方式):
npx @deepseek-ai/dsh plugin --profile web add "github:c-ling/dsh-plugin-pet#v1.4.0"
或使用已有的 dsh 命令:
dsh plugin --profile web add "github:c-ling/dsh-plugin-pet#v1.4.0"
pnpm 不在 PATH 上时:
cd ~/.dsh/profiles/web
corepack pnpm add "github:c-ling/dsh-plugin-pet#v1.4.0"
dsh plugin把参数原样转发给 pnpm,直接从本仓库拉取包(pnpm 9+,本机需装有git)。 安装时若看到declares no dsh.bundle — installed as a plain dependency的提示属正常现象: 本插件不是 profile bundle 层,而是通过下面的 loader 行激活。
然后在 ~/.dsh/profiles/web/cordis.patch.yml 增加一行插入:
- insert:
- id: dsh-plugin-pet
name: 'dsh-plugin-pet'
config:
maxImageBytes: 5242880 # 可选:单张图片上传上限(默认 5 MB)
maxSheetBytes: 10485760 # 可选:精灵图上传上限(默认 10 MB)
interactionCooldownMs: 1500 # 可选:互动冷却毫秒(默认 1500,0 关闭)
maxDailyInteractions: 500 # 可选:每日互动计次上限(默认 500)
重启 dsh web(client-modules 按进程缓存包裁决,新包必须重启宿主),然后硬刷新页面。
宠物会出现在右下角,配置入口在 设置 → 宠物。
在 Harness 1.0.7 且已挂载 settings 服务时,Settings → 宠物 的配置会持久化到 $DSH_HOME/settings.yaml;
客户端通过 settingsScope 响应式读取。如果本地 link: 开发时没有安装 @deepseek-ai/dsh-settings,
设置页会自动降级读写 $DSH_HOME/storages/dsh-plugin-pet/config.json。
curl -s http://127.0.0.1:3080/plugins/dsh-plugin-pet/client.js | head -c 60
应输出 window.__ModuleLoader__.load({ 开头的 factory bundle;页面右下角能看到宠物。
dsh plugin --profile web add "github:c-ling/dsh-plugin-pet#v1.4.0"
# 或:npx @deepseek-ai/dsh plugin --profile web add "github:c-ling/dsh-plugin-pet#v1.4.0"
# 或:cd ~/.dsh/profiles/web && corepack pnpm add "github:c-ling/dsh-plugin-pet#v1.4.0"
用新的 #v1.4.0 重新执行安装命令即可升级依赖;cordis.patch.yml 中的 loader 行保持不变。
重启 dsh web,然后硬刷新页面。
cd ~/.dsh/profiles/web
corepack pnpm remove dsh-plugin-pet # 或 dsh plugin --profile web remove dsh-plugin-pet
同时删除 cordis.patch.yml 中对应的 insert 行,然后重启 dsh web。
已上传的数据仍保留在 $DSH_HOME/storages/dsh-plugin-pet/ 下,直到你手动删除该目录。
宠物不再只是“状态显示器”,而是一个会成长的桌面伙伴:
interactionCooldownMs 配置)与每日上限(maxDailyInteractions,默认 500);多标签页只由主标签发送心跳,后台标签不计在线时长、不采样心情。成长数据保存在 $DSH_HOME/storages/dsh-plugin-pet/stats.json,独立于外观配置,不会写入 settings。
每次成功写入都会同步写一份 stats.json.bak;主文件损坏时自动从备份恢复,不会清零成长记录。
spritesheet.webp/spritesheet.png。图片必须是 1536×1872(V1,9 行) 或
1536×2288(V2,11 行)——8 列网格、每格 192×208。版本会自动检测。pet.json——它会应用 displayName 并校验 spriteVersionNumber 是否与已上传
的精灵图匹配。Codex 状态行与 DSH 心情的映射:idle→0、run_right→1(running-right)、run_left→2(running-left)、 petting→3(waving)、happy→4(jumping)、sad→5(failed)、waiting→6、working→7(running)、 thinking→8(review)、sleeping→0(复用 idle)——V1 的九行动作全部启用。仅 V2 的朝向行(9/10) 不使用。
在 精灵图 → 通用精灵图 下,任何宽高能被网格整除的 PNG/WebP 都可用:设置列数、行数与 fps,上传图片,再为每个心情分配行号与帧数。应用前会有一个实时预览播放动画。
| 方法 | 路径 | 用途 |
|---|---|---|
| GET | /dsh-plugin-pet/config |
当前生效的宠物配置 |
| POST | /dsh-plugin-pet/config |
更新名字 / 大小 / 可见性 / 内置形象 / 精灵图 fps、状态行、帧数 |
| GET/POST/DELETE | /dsh-plugin-pet/image |
读取 / 上传(原始字节)/ 删除自定义图片 |
| GET/POST/DELETE | /dsh-plugin-pet/sheet |
读取 / 上传(原始字节,?source=codex&version=1\|2\|auto 或 ?source=custom&cols=&rows=&fps=)/ 删除精灵图 |
| POST | /dsh-plugin-pet/petjson |
导入 Codex pet.json(要求已有尺寸匹配的精灵图) |
| GET | /dsh-plugin-pet/stats |
读取本地陪伴成长统计(等级 / 经验 / 亲密度 / 心情分布 / 成就) |
| POST | /dsh-plugin-pet/stats/heartbeat |
页面在线心跳:累计陪伴时长、在线时长与心情采样 |
| POST | /dsh-plugin-pet/stats/interaction |
记录喂食 / 玩耍 / 抚摸互动并返回经验与亲密度增益 |
| POST | /dsh-plugin-pet/stats/task |
完成任务成长:增加今日任务数与经验 |
| POST | /dsh-plugin-pet/stats/event |
客户端检测到的成就事件(连续工作 / 修复错误) |
上传统均在服务端校验:魔数嗅探(PNG/JPEG/GIF/WebP)、大小上限、Codex 精确尺寸,以及通用
网格的整格切分。配置与成长统计写入都是原子性的,并保留 .bak 备份供损坏恢复。
错误响应带稳定机器码({ ok: false, error, code, params? },如 bad_json / too_large /
codex_size / grid_uneven),由客户端按当前语言翻译显示。成长类接口
(heartbeat / interaction / task / event)的响应额外携带 unlockedKeys(本次新解锁的成就)
与 levelUp(跨过的等级,未跨级为 null);interaction 超出冷却或每日上限时返回
throttled: true 且不加值。
/dsh-plugin-pet/config在 DSH 1.0.7 有 settings 服务时仍可用作兼容写入入口(host 会同步到 settings);客户端优先通过settingsScope读取,无 settings 服务时该路由作为 fallback。
node --check lib/index.js lib/client.js
node --test test/sniff.test.mjs test/host.test.mjs
客户端 bundle 是 harness 的 factory-CJS 格式纯 JavaScript
(window.__ModuleLoader__.load({ id: "dsh-plugin-pet", factory }));require("react") 解析
到 shell 的静态模块表,所有 UI 贡献都通过 shell.overlay 与 settings.section 插槽注册,
并用 ctx.effect 持有的 disposer 管理生命周期。
localStorage),不跨设备同步。dsh web 宿主进程(web profile 默认关闭了 Cordis HMR 宿主行)。CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: companion、devtools、pet、ui-plugin、web-ui。