hanamesh-usage
Consent-gated, device-signed HanaMesh usage events for DSH 适合需要记录、缓冲并安全上报HanaMesh使用摘要的用户。
インストール
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:yzsnstotz/hanamesh-usageドキュメント
README 全文を読む ↗hanamesh-usage · 0.2.0-rc.4
版本
0.2.0-rc.4;交付上限为 🧪 DELIVERED,只有用户可签 ACCEPTED。固定宿主 DSH0.1.5-alpha.1。本版提供改名后的用量声明、7 字段设备签名事件、上报/撤回和 Loader 库存发现;本包是 DSH bundle,dsh plugin add即激活。P1/O1 未登记时真实门分别使用 STANDIN/STUB;inventory 结论为loader。收录不代表审核或推荐。
hanamesh-usage 保留本机 Declaration 三态使用摘要,并提供同意门、设备签名、事件缓冲与服务器上报。生产路径只保存结构化最小信息,不保存 prompt、对话、文件、完整结果、私有路径或凭据。
安装
hanamesh-usage 是一个 DSH bundle(package.json 声明 dsh.bundle.patch):
dsh plugin --profile
add hanamesh-usage
装完即激活,不需要手写 cordis.patch.yml。它是 HanaMesh 套件的一员:装 hanamesh-core 会一次带上本包与 @hanamesh/dsh-app-host,由 core 的 patch 统一激活。
套件与单包互斥(双向):
- 已单独装过本包,再装
hanamesh-core→ DSH 启动失败:duplicate loader entry id: hanamesh-usage。先dsh plugin --profile remove hanamesh-usage,再装 core;本机记录(storage-domainhanamesh_usage)不会丢,同一 profile 里重新激活后仍在。 - 已装套件(core),再显式
add hanamesh-usage→ 同样duplicate loader entry id: hanamesh-usage。撤销这次add(remove hanamesh-usage)即恢复;套件里的 usage 不受影响。 - 这是 DSH 的既定行为(重复 loader id 让整个 profile 起不来),本插件不做静默去重;失败是响亮的,不会出现两份采集。
依赖: 设备身份与同意开关来自 hanamesh-core(可选)。core 缺席时本插件只在本机记录、不上报,/api/hanamesh/usage/health 显示 core: 'absent'。
从 rc.3(@hanamesh/dsh-activity)升级: storage-domain 由 hanamesh_activity 改为 hanamesh_usage,旧记录不迁入、不删除;需要保留请先在 rc.3 上 POST /api/hanamesh/activity/export 导出。
首次 Loader 扫描会把当前已装插件记为 install,occurredAt 使用扫描时刻;这是 Adoption 弱证据。宿主没有更强的实时 install/uninstall 事件,本版只做跨启动快照比较。
本地接口
GET /api/hanamesh/usageGET /api/hanamesh/usage/viewPOST /api/hanamesh/usage/exportGET /api/hanamesh/usage/healthGET /api/hanamesh/usage/events
ctx.hanameshUsage 提供 query、export、health、drain、reconcile 与 record。record 只接受其它 HanaMesh 插件投递的 open / use,安装与卸载由 Loader 观测产生。
隐私与上报边界
- 未同意时不创建 UsageEvent,也不向 Server 上报;本机 Declaration 摘要仍可保留。
- 上线事件恰含
deviceId、hanaRef、action、occurredAt、eventId、nonce、signature七个键。 - 撤回先清本地事件缓冲,再调用 Server 删除接口;离线时只完成本地删除并保留可重试状态。
Declaration只留本机;它不会作为 summary 上传。
开发与验证
目标工具链:Node 24.13.1、pnpm 10.33.0、TypeScript 5.9.3。仓内使用 npm lockfile;依赖安装前用独立 npm_config_cache。
npm run build:offline
npm test
npm run test:mutations
npm run check
npm run test:detached
真实门必须使用全新隔离的 DSH_HOME 与随机端口;不得触碰 ~/.dsh 或 3080。STUB/STANDIN 证据不能替代 REAL_SERVER/REAL_CORE。