dsh-dpharness 0.4.1 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,8 @@
5
5
 
6
6
  ## 两个视图
7
7
 
8
- 面板(浮窗与页签共用同一套组件)顶部可在两个视图间切换:
8
+ 浮窗与页签**共用同一套视图与同一组文案**,顶部都能在两个视图间切换,默认都停在「严选推荐」
9
+ (同一功能在两处换默认值,最容易被当成 bug):
9
10
 
10
11
  | 视图 | 数据来源 | 回答的问题 |
11
12
  |---|---|---|
@@ -20,10 +21,31 @@
20
21
 
21
22
  | 入口 | 位置 | 说明 |
22
23
  |---|---|---|
23
- | 页签「严选插件」 | 会话视图区 | 完整页:搜索 + 排序 + 批量浏览 |
24
- | 左下入口 | 侧边栏底部(`sidebar.footer.action`) | 点击展开全站浮窗 |
24
+ | 页签「严选插件」 | 会话视图区 | 完整页:视图切换 + 搜索 + 排序 + 批量浏览 |
25
+ | 左下入口 | 侧边栏底部(`sidebar.footer.action`) | 点击展开全站浮窗;**浮窗被关闭时,它同时是恢复入口** |
25
26
  | 全站浮窗 | 右下角(`shell.overlay`,跨路由含首页) | 随手查:随时搜、随时装 |
26
27
 
28
+ ## 浮窗可以彻底关掉(v0.4.4)
29
+
30
+ `shell.overlay` 是**跨路由常驻**的:胶囊在首页、会话页、任何页面都在。
31
+ `open` 只表示「展开 / 收起」,此前用户**没有**把这块东西从屏幕上拿掉的手段。现在三条路径:
32
+
33
+ | 关闭 | 位置 |
34
+ |---|---|
35
+ | 胶囊右端的 `×` | 悬浮胶囊上(直接关) |
36
+ | 面板底部的「隐藏浮窗」 | 展开状态下面板页脚 |
37
+ | 「严选插件」页底部取消勾选「显示右下角浮窗」 | 会话端页签页脚 |
38
+
39
+ 关闭 = `hidden` 状态,写进 `localStorage`(`dph-hub-hidden`),**下次进来仍然是关的**。
40
+
41
+ > ⚠️ 关闭必须配恢复入口,否则就变成"关掉找不回来"。两个恢复入口:
42
+ > ① 侧边栏底部「严选插件」按钮(隐藏状态下点击会先取消隐藏再展开面板)
43
+ > ② 「严选插件」页底部的「显示右下角浮窗」开关(只取消隐藏,不强行弹面板)
44
+ > 判定顺序写死在代码里:`state.hidden` 时**整块浮窗(胶囊 + 面板)都不渲染**。
45
+ >
46
+ > 胶囊上的 `×` 是胶囊的**兄弟节点**(绝对定位盖在右端),不是它的子节点 ——
47
+ > `<button>` 里套 `<button>` 是非法 HTML,且 `pointerdown` 会冒泡到胶囊上把点击变成拖动。
48
+
27
49
  ## 卡片显示什么
28
50
 
29
51
  按「汉化优先」组织,缺汉化时明确标注而不是假装有:
@@ -60,23 +82,70 @@
60
82
  - 目标包名过字符白名单校验;子进程环境会剥掉宿主的 safe-delete shim(否则 pnpm 清理临时文件被拦)。
61
83
  - 失败时展示 pnpm 的错误码行(如 `[ERR_PNPM_FETCH_404] …`),而不是一堆进度日志。
62
84
 
85
+ ## 安装漏斗与埋点
86
+
87
+ 一次安装从「看见」到「真的生效」要跨 7 个环节,每步都有独立事件 —— 否则
88
+ 「没成功」只能看到一个总数,看不出卡在哪。全部经本地 host 转发(站点端点不带 CORS 头),
89
+ `value` 形如 `action:k=v:…`,并**统一附加插件版本**(`v=`)。
90
+
91
+ | 事件 | 触发点 | 回答的问题 |
92
+ |---|---|---|
93
+ | `hello` | 插件被加载 | 有哪些版本在用(老版本发不出新事件,空值必须能和「没人做」区分) |
94
+ | `open` / `search` / `best_open` | 打开面板 / 搜索 / 切到分类精选 | 入口有没有用 |
95
+ | `hide` / `show` | 手动关闭浮窗 / 在页签底部重新打开 | 有多少人嫌这个浮窗碍事(`scope` 区分是胶囊、面板还是页签开关触发的) |
96
+ | `install_ask` | 点「安装」(弹出确认框) | 有多少人真的动了安装的念头 |
97
+ | `install_cancel` | 确认框点取消 | 被确认框劝退的人(文案/门槛的优化对象) |
98
+ | `install` | 确认后开始安装 | 真正发起的安装 |
99
+ | `install_failed` | 安装失败(含 `via` 阶段与 `why` 原因) | 失败卡在哪一步 |
100
+ | `installed_market` / `installed_local` | 安装成功(热挂载 / 需重启) | 装成了多少 |
101
+ | `restart_click` | 点「立即重启」 | 需重启的那批里有多少人真的重启了 |
102
+ | `post_install` | **下一次加载时**回查 | 重启发生没发生、装的包进了加载清单没有 |
103
+
104
+ `why` 是**闭集枚举**(`busy` / `market_http` / `local_rejected` / `poll_unreachable` /
105
+ `cli_exit` / `timeout` / `restart_http`),不是错误原文 —— 原文含本地路径与包名,
106
+ 既不可聚合也不该外发。
107
+
108
+ ### 「安装成功之后」怎么验证
109
+
110
+ 安装完成那一刻没有任何东西能证明结果:热挂载路径不重启,本地 CLI 路径要等重启才生效。
111
+ 所以安装成功时只在 `localStorage` 留一张凭据(目标包名 / 阶段 / 时间),
112
+ **下次插件被加载时**由 host 回查两件事:
113
+
114
+ | 字段 | 来源 | 含义 |
115
+ |---|---|---|
116
+ | `restarted` | host 进程启动时间 vs 安装时间 | dsh 在安装之后**确实重启过** |
117
+ | `bundled` | profile `package.json` 的 `dsh.profile.bundles` | 该包**进了 dsh 的加载清单** |
118
+
119
+ 两个字段都刻意做成三态:`1` / `0` / **不写**。不写表示「没查到」,
120
+ 绝不用 `0` 兜底 —— 把「查不到」记成「没装上」会让整条漏斗的结论反过来。
121
+
122
+ > ⚠️ 已知边界:`bundled` 对 `via=market`(dshmarket 热挂载)不作为失败判据 ——
123
+ > 它有自己的挂载机制,是否写 profile 清单本插件未验证。看 `bundled` 请以 `via=local` 为准。
124
+
63
125
  ## HTTP 路由(host 侧)
64
126
 
65
127
  | 路由 | 说明 |
66
128
  |---|---|
67
129
  | `GET /api/dpharness/search?q=&take=&sort=stars` | 目录查询,字段裁剪后返回,按 `q+take+sort` 缓存 5 分钟 |
68
130
  | `GET /api/dpharness/best` | 分类精选榜单(站点 `/api/best` 的代理 + 字段裁剪),缓存 5 分钟 |
131
+ | `GET /api/dpharness/postinstall?pkg=&via=&at=` | 安装后回执(只读:进程启动时间 + profile 加载清单) |
69
132
  | `POST /api/dpharness/event` | 埋点代理 → `dpharness.com/api/track/event` |
70
133
  | `POST /api/dpharness/install` | `{ pkg }`,spawn `dsh plugin add`;返回 202 + 任务启动 |
71
134
  | `GET /api/dpharness/install` | 安装任务进度与结果 |
72
135
  | `GET /api/dpharness/meta` | 版本、profile、路由清单、缓存与安装状态 |
73
136
 
137
+ > ⚠️ 改 host 路由时注意:`parseQuery()` 是 search/best 专用的**白名单**解析器,
138
+ > 只输出 `q/take/sort`。新路由自定义参数请用 `readParams()` ——
139
+ > 复用 `parseQuery()` 会让参数**静默读成空串**(实测踩过)。
140
+
74
141
  ## 隐私
75
142
 
76
143
  - **不采集搜索关键词原文**,只上报动作、关键词长度与命中数。
144
+ - **不上报错误原文**,失败原因只发闭集枚举。
77
145
  - 复制/安装命令的上报口径与站点一致(`copy_install` 的 value 为整条命令),
78
146
  来源靠 `path=/dsh-plugin` 区分。
79
- - 浮窗与页签底部都有**匿名统计开关**,可随时关闭。
147
+ - 回执查询只读本机 profile 的清单文件,结果仅两个布尔量。
148
+ - 浮窗与页签底部都有**匿名统计开关**,可随时关闭;页签底部另有**浮窗显示开关**。
80
149
  - 埋点经本地 host 转发(站点端点不带 CORS 头),失败静默忽略,绝不影响操作。
81
150
 
82
151
  ## 安装本插件
package/lib/client.js CHANGED
@@ -75,14 +75,23 @@ window.__ModuleLoader__.load({
75
75
  ".dph_lbMark{font-size:13px;font-weight:600;color:var(--dsw-alias-state-business-primary)}",
76
76
  "div:has(> [data-slot=\"sidebar.footer.action\"]){flex-direction:column}",
77
77
  ".dph_ovWrap{position:fixed;right:16px;bottom:16px;z-index:2147483000;display:flex;flex-direction:column;align-items:flex-end;gap:8px}",
78
- ".dph_pill{display:flex;align-items:center;gap:8px;height:38px;padding:0 14px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:0 6px 20px rgba(0,0,0,.14);cursor:grab;touch-action:none;user-select:none;font:inherit;font-size:13px;font-weight:600}",
78
+ ".dph_pillWrap{position:relative;display:flex}",
79
+ /* 右侧多留 16px 给关闭按钮(padding-right 由 14 改 30) */
80
+ ".dph_pill{display:flex;align-items:center;gap:8px;height:38px;padding:0 30px 0 14px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:0 6px 20px rgba(0,0,0,.14);cursor:grab;touch-action:none;user-select:none;font:inherit;font-size:13px;font-weight:600}",
79
81
  ".dph_pill:hover{background:var(--dsw-alias-interactive-bg-hover)}",
80
82
  ".dph_pillMark{color:var(--dsw-alias-state-business-primary)}",
83
+ /* 胶囊上的关闭按钮:**必须是胶囊的兄弟节点,不能嵌进去** ——
84
+ <button> 里套 <button> 是非法 HTML,且 pointerdown 会冒泡到胶囊上触发拖动。
85
+ 绝对定位盖在胶囊右端,指针根本落不到胶囊本身,拖动与关闭互不干扰。 */
86
+ ".dph_pillClose{position:absolute;top:50%;right:4px;transform:translateY(-50%);box-sizing:border-box;width:22px;height:22px;border:0;border-radius:50%;background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:14px;line-height:1;padding:0;cursor:pointer}",
87
+ ".dph_pillClose:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}",
81
88
  ".dph_panel{width:400px;max-width:calc(100vw - 32px);max-height:min(72vh,620px);display:flex;flex-direction:column;gap:10px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:14px;box-shadow:0 16px 48px rgba(0,0,0,.22);padding:14px}",
82
89
  ".dph_panelHead{display:flex;align-items:center;gap:8px}",
83
90
  ".dph_panelTitle{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary)}",
84
91
  ".dph_panelBody{display:flex;flex-direction:column;gap:8px;overflow-y:auto;margin-right:-4px;padding-right:4px}",
85
- ".dph_panelFoot{display:flex;align-items:center;gap:8px;justify-content:space-between;border-top:1px solid var(--dsw-alias-border-l2);padding-top:8px;cursor:default}",
92
+ ".dph_panelFoot{display:flex;flex-direction:column;gap:8px;border-top:1px solid var(--dsw-alias-border-l2);padding-top:8px;cursor:default}",
93
+ ".dph_footRow{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}",
94
+ ".dph_footToggles{display:flex;align-items:center;gap:14px;flex-wrap:wrap}",
86
95
  ".dph_close{border:0;background:transparent;color:var(--dsw-alias-label-tertiary);font-size:16px;line-height:1;cursor:pointer;padding:2px 6px;border-radius:6px}",
87
96
  ".dph_close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}",
88
97
  ".dph_cardSm{padding:10px 12px;gap:6px}",
@@ -128,6 +137,9 @@ window.__ModuleLoader__.load({
128
137
  "action.open": "严选插件",
129
138
  "action.close": "收起",
130
139
  "action.drag": "可拖动调整位置",
140
+ "action.hide": "隐藏浮窗",
141
+ "action.hideHint": "隐藏后:侧边栏底部「严选插件」可再次打开,或在「严选插件」页底部重新勾选",
142
+ "action.showFloat": "显示右下角浮窗",
131
143
  "count.summary": "共 {n} 条结果",
132
144
  "state.loading": "正在读取插件目录…",
133
145
  "state.empty": "没有匹配的插件。换个关键词试试。",
@@ -173,6 +185,9 @@ window.__ModuleLoader__.load({
173
185
  "action.open": "Curated",
174
186
  "action.close": "Collapse",
175
187
  "action.drag": "Drag to reposition",
188
+ "action.hide": "Hide widget",
189
+ "action.hideHint": "Reopen it from “Curated” at the bottom of the sidebar, or re-tick the toggle at the bottom of the Curated tab",
190
+ "action.showFloat": "Show the floating widget",
176
191
  "count.summary": "{n} results",
177
192
  "state.loading": "Loading the catalog…",
178
193
  "state.empty": "No matching plugin. Try another keyword.",
@@ -211,6 +226,9 @@ window.__ModuleLoader__.load({
211
226
  隐私口径:不发送搜索关键词原文,只发长度与命中数;可整体关闭。 */
212
227
  const TEL_KEY = "dph-hub-telemetry";
213
228
  const VID_KEY = "dph-hub-vid";
229
+ /* 安装成功但还没验证的凭据(见 reportPostInstall)。
230
+ 只放本地,不上报:重启前没有任何东西可以验证它。 */
231
+ const PENDING_KEY = "dph-hub-pending";
214
232
  let telemetryOn = true;
215
233
  try {
216
234
  telemetryOn = localStorage.getItem(TEL_KEY) !== "0";
@@ -244,6 +262,57 @@ window.__ModuleLoader__.load({
244
262
  }
245
263
  }
246
264
 
265
+ function rememberPending(entry) {
266
+ try {
267
+ localStorage.setItem(PENDING_KEY, JSON.stringify(entry));
268
+ } catch (error) {
269
+ /* 存不下就不存:宁可丢一条回执,也不能影响安装流程 */
270
+ }
271
+ }
272
+
273
+ function takePending() {
274
+ try {
275
+ const raw = localStorage.getItem(PENDING_KEY);
276
+ if (!raw) return null;
277
+ /* 取出来就清掉:上报失败不重试。
278
+ 回执是统计用的,重复灌库的代价比丢一条大。 */
279
+ localStorage.removeItem(PENDING_KEY);
280
+ const parsed = JSON.parse(raw);
281
+ return parsed && typeof parsed.pkg === "string" && parsed.pkg ? parsed : null;
282
+ } catch (error) {
283
+ return null;
284
+ }
285
+ }
286
+
287
+ /**
288
+ * 安装后的回执 —— 只有「插件再次被加载」时才知道结果。
289
+ *
290
+ * 两个判据都必须由 host 给出,客户端自报不成立:
291
+ * · restarted:重启前后是同一段 JS,它无法自证发生过重启;
292
+ * · bundled:profile 的加载清单在磁盘上,浏览器读不到。
293
+ * 查不到时**不传该字段**(host 端 value 里就缺这一项 = 未知),
294
+ * 绝不用 false 兜底 —— 那会把「没查到」记成一个具体的否定结论。
295
+ */
296
+ function reportPostInstall() {
297
+ const pending = takePending();
298
+ if (!pending) return;
299
+ const query =
300
+ "pkg=" + encodeURIComponent(pending.pkg) +
301
+ "&via=" + encodeURIComponent(String(pending.via || "")) +
302
+ "&at=" + encodeURIComponent(String(pending.at || ""));
303
+ fetch("/api/dpharness/postinstall?" + query)
304
+ .then((response) => response.json())
305
+ .then((data) => {
306
+ if (!data || data.ok !== true) return;
307
+ const detail = { action: "post_install", via: String(pending.via || "unknown") };
308
+ if (typeof data.restarted === "boolean") detail.restarted = data.restarted;
309
+ if (typeof data.bundled === "boolean") detail.bundled = data.bundled;
310
+ if (typeof data.dep === "boolean") detail.dep = data.dep;
311
+ track("plugin_hub", detail);
312
+ })
313
+ .catch(() => {});
314
+ }
315
+
247
316
  /* --------------------------------------------------------------- installer */
248
317
  /* 两条路径,安全优先:
249
318
  ① 复用已装的 dshmarket 的同源 HTTP 路由(免重启热挂载、可回滚);
@@ -284,17 +353,19 @@ window.__ModuleLoader__.load({
284
353
  return fallback + "(HTTP " + (result ? result.status : "?") + ")";
285
354
  }
286
355
 
356
+ /* why 是**闭集枚举**,不是错误原文 —— 原文含本地路径与包名,既不可聚合也会
357
+ 把用户环境信息带出去。分类只回答「卡在哪一步」,够用来定位了。 */
287
358
  async function pollMarketInstall(deadline) {
288
359
  while (Date.now() < deadline) {
289
360
  await sleep(INSTALL_POLL_MS);
290
361
  const status = await getJson(MARKET_STATUS);
291
- if (status.status !== 200 || !status.data) return { ok: false, message: messageOf(status, "dshmarket status unavailable") };
362
+ if (status.status !== 200 || !status.data) return { ok: false, via: "market", why: "poll_unreachable", message: messageOf(status, "dshmarket status unavailable") };
292
363
  if (status.data.active === false && status.data.busy === false) {
293
- if (status.data.error) return { ok: false, message: String(status.data.error).slice(0, 200) };
364
+ if (status.data.error) return { ok: false, via: "market", why: "cli_error", message: String(status.data.error).slice(0, 200) };
294
365
  return { ok: true, market: true };
295
366
  }
296
367
  }
297
- return { ok: false, message: "timeout" };
368
+ return { ok: false, via: "market", why: "timeout", message: "timeout" };
298
369
  }
299
370
 
300
371
  async function pollLocalInstall(deadline) {
@@ -302,13 +373,13 @@ window.__ModuleLoader__.load({
302
373
  await sleep(INSTALL_POLL_MS);
303
374
  const status = await getJson(LOCAL_INSTALL);
304
375
  const job = status.data && status.data.job;
305
- if (status.status !== 200 || !job) return { ok: false, message: messageOf(status, "install status unavailable") };
376
+ if (status.status !== 200 || !job) return { ok: false, via: "local", why: "poll_unreachable", message: messageOf(status, "install status unavailable") };
306
377
  if (job.active === false) {
307
378
  if (job.code === 0) return { ok: true, market: false };
308
- return { ok: false, message: String(job.error || job.tail || ("exit code " + job.code)).slice(0, 200) };
379
+ return { ok: false, via: "local", why: job.error === "timeout" ? "timeout" : "cli_exit", message: String(job.error || job.tail || ("exit code " + job.code)).slice(0, 200) };
309
380
  }
310
381
  }
311
- return { ok: false, message: "timeout" };
382
+ return { ok: false, via: "local", why: "timeout", message: "timeout" };
312
383
  }
313
384
 
314
385
  async function runInstall(item, t) {
@@ -324,8 +395,14 @@ window.__ModuleLoader__.load({
324
395
  if (market.status === 200) {
325
396
  done = await pollMarketInstall(deadline);
326
397
  } else if (market.status === 400 || market.status === 404 || market.status === 0) {
398
+ /* 不在 dshmarket 的 curated registry 里 —— 这是预期路径,降级到本地 CLI,
399
+ 不是失败,所以这里不埋点。 */
327
400
  done = null;
328
401
  } else {
402
+ /* 409 = 有 agent 正在跑,dshmarket 拒绝抢插件文件。它和别的 HTTP 错误
403
+ 处理方式相同(都不降级),但原因完全不同,必须分开统计。 */
404
+ const why = market.status === 409 ? "busy" : "market_http";
405
+ track("plugin_hub", { action: "install_failed", via: "market", why });
329
406
  setHub({ install: { active: false, target, phase: "failed", message: messageOf(market, t("install.failed")) } });
330
407
  return;
331
408
  }
@@ -334,6 +411,11 @@ window.__ModuleLoader__.load({
334
411
  setHub({ install: { active: true, target, phase: "local", message: t("install.local") } });
335
412
  const local = await postJson(LOCAL_INSTALL, { pkg: target });
336
413
  if (local.status !== 202) {
414
+ track("plugin_hub", {
415
+ action: "install_failed",
416
+ via: "local",
417
+ why: local.status === 409 ? "busy" : "local_rejected",
418
+ });
337
419
  setHub({ install: { active: false, target, phase: "failed", message: messageOf(local, t("install.failed")) } });
338
420
  return;
339
421
  }
@@ -347,7 +429,20 @@ window.__ModuleLoader__.load({
347
429
  message: done.ok ? t(done.market ? "install.okMarket" : "install.okLocal") : done.message,
348
430
  },
349
431
  });
350
- if (done.ok) track("plugin_hub", { action: done.market ? "installed_market" : "installed_local" });
432
+ if (done.ok) {
433
+ const via = done.market ? "market" : "local";
434
+ track("plugin_hub", { action: done.market ? "installed_market" : "installed_local" });
435
+ /* 留一张凭据给下一次加载。安装成功这一刻没有任何东西能验证结果:
436
+ 热挂载路径没有重启,本地 CLI 路径要等重启才生效 —— 两者都只能在
437
+ 「插件再次被加载」时由 host 回查(见 reportPostInstall)。 */
438
+ rememberPending({ pkg: target, via: via, at: Date.now() });
439
+ } else {
440
+ track("plugin_hub", {
441
+ action: "install_failed",
442
+ via: done.via || "local",
443
+ why: done.why || "unknown",
444
+ });
445
+ }
351
446
  }
352
447
 
353
448
  /** 仅在降级路径(改了 profile)后需要;/api/restart 由 dsh-restart 插件提供(POST)。 */
@@ -357,12 +452,49 @@ window.__ModuleLoader__.load({
357
452
  }
358
453
 
359
454
  /* ------------------------------------------------------------------ store */
455
+ /* 浮窗的「是否显示」—— 与位置一起属于浮窗的本地持久状态。 */
456
+ const HIDE_KEY = "dph-hub-hidden";
457
+ let hubHidden = false;
458
+ try {
459
+ hubHidden = localStorage.getItem(HIDE_KEY) === "1";
460
+ } catch (error) {
461
+ /* localStorage 不可用时按"显示"处理:宁可多一个浮窗,也不要让入口凭空消失 */
462
+ }
463
+ function storeHidden(value) {
464
+ try {
465
+ localStorage.setItem(HIDE_KEY, value ? "1" : "0");
466
+ } catch (error) {
467
+ /* 隐私模式下不持久化,本次会话内仍然可关 */
468
+ }
469
+ }
470
+
360
471
  /* 三个入口共享的轻量 store;不依赖 dsh 内部 store,避免猜测未验证的 API。 */
361
- const hub = { open: false, telemetry: telemetryOn, install: null, listeners: new Set() };
472
+ const hub = { open: false, hidden: hubHidden, telemetry: telemetryOn, install: null, listeners: new Set() };
362
473
  function setHub(patch) {
363
474
  Object.assign(hub, patch);
364
475
  hub.listeners.forEach((listener) => listener());
365
476
  }
477
+ /**
478
+ * 浮窗的「手动关闭」。
479
+ *
480
+ * 为什么要能关:`shell.overlay` 是**跨路由常驻**的,胶囊在所有页面都在,
481
+ * 而 `open` 只表示展开/收起 —— 用户此前没有把这块东西从屏幕上拿掉的手段。
482
+ * 这里把「隐藏」做成第三种状态并写进 localStorage(下次进来仍然是关的)。
483
+ *
484
+ * 恢复入口必须配齐,否则就变成"关掉就找不回来":
485
+ * ① 侧边栏底部「严选插件」按钮(FooterEntry,隐藏时点击会先取消隐藏)
486
+ * ② 「严选插件」页底部的「显示右下角浮窗」开关(floatToggle)
487
+ */
488
+ function hideHub(scope) {
489
+ storeHidden(true);
490
+ setHub({ hidden: true, open: false });
491
+ track("plugin_hub", { action: "hide", scope: scope || "pill" });
492
+ }
493
+ function showHub(scope) {
494
+ storeHidden(false);
495
+ setHub({ hidden: false, open: true });
496
+ track("plugin_hub", { action: "open", scope: scope || "footer" });
497
+ }
366
498
  function useHub() {
367
499
  const [, force] = react.useState(0);
368
500
  react.useEffect(() => {
@@ -665,9 +797,16 @@ window.__ModuleLoader__.load({
665
797
  disabled: restarting,
666
798
  onClick: async () => {
667
799
  setRestarting(true);
800
+ /* 点击即上报。结果不能在这里等 —— 成功的重启会掐断这个
801
+ 请求,"重启成功"只能由下次加载时的 post_install 证明;
802
+ 所以这里只记「谁按了」,不记「按了之后成没成」。 */
803
+ track("plugin_hub", { action: "restart_click", via: "local" });
668
804
  const ok = await restartServer();
669
805
  setRestarting(false);
670
- if (!ok) setRestartFailed(true);
806
+ if (!ok) {
807
+ setRestartFailed(true);
808
+ track("plugin_hub", { action: "restart_failed", via: "local", why: "restart_http" });
809
+ }
671
810
  },
672
811
  }, t("install.restart"))
673
812
  : null,
@@ -695,7 +834,18 @@ window.__ModuleLoader__.load({
695
834
  runInstall(item, t);
696
835
  },
697
836
  }, t("install.confirm")),
698
- h("button", { className: "dph_btn", key: "cancel", type: "button", onClick: () => setConfirming(false) }, t("install.cancel")),
837
+ h("button", {
838
+ className: "dph_btn",
839
+ key: "cancel",
840
+ type: "button",
841
+ onClick: () => {
842
+ setConfirming(false);
843
+ /* 取消单独记一次:只埋 install(确认后)的话,
844
+ 「想装但被确认框劝退」的人会整段消失,
845
+ 而他们恰恰是文案/门槛该优化的对象。 */
846
+ track("plugin_hub", { action: "install_cancel", via: "confirm" });
847
+ },
848
+ }, t("install.cancel")),
699
849
  ]);
700
850
  }
701
851
 
@@ -706,7 +856,10 @@ window.__ModuleLoader__.load({
706
856
  type: "button",
707
857
  disabled: busyElsewhere,
708
858
  title: busyElsewhere ? t("install.busy") : item.pkg,
709
- onClick: () => setConfirming(true),
859
+ onClick: () => {
860
+ setConfirming(true);
861
+ track("plugin_hub", { action: "install_ask", via: "confirm" });
862
+ },
710
863
  }, busyElsewhere ? t("install.busy") : t("install.action")),
711
864
  h("span", { className: "dph_instHint", key: "pkg" }, item.pkg),
712
865
  ]);
@@ -873,25 +1026,95 @@ window.__ModuleLoader__.load({
873
1026
  ]);
874
1027
  }
875
1028
 
876
- /* −−− 入口 1:会话视图页签(完整页) −−− */
1029
+ /**
1030
+ * 浮窗的显示开关。
1031
+ *
1032
+ * 关掉走 hideHub(与胶囊上的 × 同一条路径),打开只取消隐藏、**不强行弹面板** ——
1033
+ * 用户此刻可能就在这个页签里浏览,把面板糊上来是打扰。
1034
+ * 两个入口共用一条路径,才不会出现"关了一半"的中间态。
1035
+ */
1036
+ function floatToggle() {
1037
+ return h("label", { className: "dph_tel", key: "float" }, [
1038
+ h("input", {
1039
+ key: "box",
1040
+ type: "checkbox",
1041
+ checked: !hub.hidden,
1042
+ onChange: (event) => {
1043
+ if (event.target.checked) {
1044
+ storeHidden(false);
1045
+ setHub({ hidden: false });
1046
+ track("plugin_hub", { action: "show", scope: "tab" });
1047
+ } else {
1048
+ hideHub("tab");
1049
+ }
1050
+ },
1051
+ }),
1052
+ h("span", { key: "label" }, t("action.showFloat")),
1053
+ ]);
1054
+ }
1055
+
1056
+ /**
1057
+ * 入口 1:会话视图页签(完整页)。
1058
+ *
1059
+ * 与浮窗同一套视图与同一组文案:顶部的「严选推荐 / 分类精选」切换、
1060
+ * 表头副标题、打开站点链接、刷新按钮都随视图联动。
1061
+ * 默认仍是「严选推荐」—— 与浮窗保持一致(同一功能在两处换默认值最容易被当成 bug)。
1062
+ *
1063
+ * 视图切换用**裸 seg() 放在 dph_bar 里**(宽度自适应、靠左),不复用浮窗那层
1064
+ * `.dph_segWrap`(那是让两个按钮铺满 400px 面板用的)。页签宽 1080px,
1065
+ * 铺满会变成两个 500px 的巨大按钮。
1066
+ */
877
1067
  function CatalogView() {
878
1068
  const cat = useCatalog(t);
1069
+ /* 必须订阅共享 store:页签底部的「显示右下角浮窗」开关读的是同一个
1070
+ hidden 状态,而关闭动作也可能来自胶囊或面板 —— 不订阅就会出现
1071
+ "在别处关了浮窗,这里却还勾着"的错位(实测踩到)。 */
1072
+ useHub();
1073
+ const [mode, setMode] = react.useState("search");
1074
+ const best = useBest(t, mode === "best");
879
1075
  const data = cat.state.data;
1076
+ const bestData = best.state.data;
1077
+ const isBest = mode === "best";
1078
+ const sub = isBest
1079
+ ? (bestData ? format(t("best.month"), { m: bestData.month || "" }) : "")
1080
+ : (data ? format(t("count.summary"), { n: data.count }) + " · " + t("view.sub") : t("view.sub"));
880
1081
  return h("div", { className: "dph_root" }, [
881
1082
  h("div", { className: "dph_header", key: "header" }, [
882
1083
  h("h2", { className: "dph_title", key: "title" }, t("view.title")),
883
- h("span", { className: "dph_sub", key: "sub" }, data ? format(t("count.summary"), { n: data.count }) + " · " + t("view.sub") : t("view.sub")),
1084
+ h("span", { className: "dph_sub", key: "sub" }, sub),
884
1085
  h("span", { className: "dph_spacer", key: "gap" }),
885
- h("a", { className: "dph_btn", key: "site", href: SITE + "/plugins", target: "_blank", rel: "noopener noreferrer" }, t("action.openSite")),
886
- h("button", { className: "dph_btn", key: "refresh", type: "button", onClick: cat.refresh }, t("action.refresh")),
1086
+ h("a", {
1087
+ className: "dph_btn",
1088
+ key: "site",
1089
+ href: isBest ? SITE + "/best" : SITE + "/plugins",
1090
+ target: "_blank",
1091
+ rel: "noopener noreferrer",
1092
+ onClick: () => track("plugin_hub", { action: "site_click", scope: isBest ? "best" : "tab" }),
1093
+ }, t("action.openSite")),
1094
+ h("button", { className: "dph_btn", key: "refresh", type: "button", onClick: isBest ? best.refresh : cat.refresh }, t("action.refresh")),
887
1095
  ]),
888
- controls(cat),
889
- cat.state.error ? h(Notice, { key: "error", kind: "bad", text: t("state.failed") + ":" + cat.state.error }) : null,
890
- cat.state.loading && cat.plugins.length === 0 ? h(Notice, { key: "loading", text: t("state.loading") }) : null,
891
- !cat.state.loading && !cat.state.error && cat.plugins.length === 0 ? h(Notice, { key: "empty", text: t("state.empty") }) : null,
892
- h("div", { className: "dph_list", key: "list" }, cat.plugins.map((item) => renderCard(item, cat.copiedCmd, cat.markCopied, false))),
1096
+ /* 单元素不要写成数组:[seg(...)] 这种"数组里塞一个无 key 元素"会触发
1097
+ React 的 key 警告(实测)。直接作为唯一子节点传入即可。 */
1098
+ h("div", { className: "dph_bar", key: "seg" }, seg([
1099
+ { value: "search", label: t("best.recommend") },
1100
+ { value: "best", label: t("best.picks") },
1101
+ ], mode, setMode)),
1102
+ ...(isBest
1103
+ ? [
1104
+ best.state.error ? h(Notice, { key: "berror", kind: "bad", text: t("state.failed") + ":" + best.state.error }) : null,
1105
+ best.state.loading && !bestData ? h(Notice, { key: "bloading", text: t("best.loading") }) : null,
1106
+ !best.state.loading && bestData && (bestData.total || 0) === 0 ? h(Notice, { key: "bempty", text: t("best.empty") }) : null,
1107
+ h("div", { className: "dph_list", key: "blist" }, renderBest(bestData, best.copiedCmd, best.markCopied)),
1108
+ ]
1109
+ : [
1110
+ controls(cat),
1111
+ cat.state.error ? h(Notice, { key: "error", kind: "bad", text: t("state.failed") + ":" + cat.state.error }) : null,
1112
+ cat.state.loading && cat.plugins.length === 0 ? h(Notice, { key: "loading", text: t("state.loading") }) : null,
1113
+ !cat.state.loading && !cat.state.error && cat.plugins.length === 0 ? h(Notice, { key: "empty", text: t("state.empty") }) : null,
1114
+ h("div", { className: "dph_list", key: "list" }, cat.plugins.map((item) => renderCard(item, cat.copiedCmd, cat.markCopied, false))),
1115
+ ]),
893
1116
  h("div", { className: "dph_footer", key: "hint" }, t("footer.hint")),
894
- h("div", { className: "dph_footer", key: "tel" }, telemetryToggle()),
1117
+ h("div", { className: "dph_footer", key: "tel" }, h("div", { className: "dph_footToggles" }, [telemetryToggle(), floatToggle()])),
895
1118
  ]);
896
1119
  }
897
1120
 
@@ -907,6 +1130,12 @@ window.__ModuleLoader__.load({
907
1130
  title: t("action.open"),
908
1131
  "aria-label": t("action.open"),
909
1132
  onClick: () => {
1133
+ /* 浮窗被手动关掉时,这个按钮同时是**恢复入口** ——
1134
+ 若这里只做 open 的开关,关掉之后就再也叫不回来了。 */
1135
+ if (state.hidden) {
1136
+ showHub("footer");
1137
+ return;
1138
+ }
910
1139
  const next = !state.open;
911
1140
  setHub({ open: next });
912
1141
  if (next) track("plugin_hub", { action: "open", scope: "footer" });
@@ -982,27 +1211,47 @@ window.__ModuleLoader__.load({
982
1211
 
983
1212
  const anchor = { right: pos.right + "px", bottom: pos.bottom + "px" };
984
1213
 
1214
+ /* 用户手动关闭过 ⇒ 整块浮窗(胶囊 + 面板)都不渲染。
1215
+ 放在这里是为了在所有 hook 之后,不破坏 hook 顺序。 */
1216
+ if (state.hidden) return null;
1217
+
985
1218
  if (!state.open) {
986
1219
  return h("div", { className: "dph_ovWrap", style: anchor }, [
987
- h("button", {
988
- className: "dph_pill",
989
- key: "pill",
990
- type: "button",
991
- title: t("action.open") + " · " + t("action.drag"),
992
- "aria-label": t("action.open"),
993
- onPointerDown: onDrag,
994
- onClick: () => {
995
- // 拖动结束会跟一个 click,用标记跳过,避免"拖一下就打开"
996
- if (skipClickRef.current) {
997
- skipClickRef.current = false;
998
- return;
999
- }
1000
- setHub({ open: true });
1001
- track("plugin_hub", { action: "open", scope: "overlay" });
1002
- },
1003
- }, [
1004
- h("span", { className: "dph_pillMark", key: "mark" }, "严"),
1005
- h("span", { key: "label" }, t("action.open")),
1220
+ h("div", { className: "dph_pillWrap", key: "wrap" }, [
1221
+ h("button", {
1222
+ className: "dph_pill",
1223
+ key: "pill",
1224
+ type: "button",
1225
+ title: t("action.open") + " · " + t("action.drag"),
1226
+ "aria-label": t("action.open"),
1227
+ onPointerDown: onDrag,
1228
+ onClick: () => {
1229
+ // 拖动结束会跟一个 click,用标记跳过,避免"拖一下就打开"
1230
+ if (skipClickRef.current) {
1231
+ skipClickRef.current = false;
1232
+ return;
1233
+ }
1234
+ setHub({ open: true });
1235
+ track("plugin_hub", { action: "open", scope: "overlay" });
1236
+ },
1237
+ }, [
1238
+ h("span", { className: "dph_pillMark", key: "mark" }, "严"),
1239
+ h("span", { key: "label" }, t("action.open")),
1240
+ ]),
1241
+ /* 胶囊是跨路由常驻的,用户需要一个"把这块东西从屏幕上拿掉"的出口。
1242
+ 作为兄弟节点绝对定位盖在胶囊右端 —— 嵌进胶囊那个 <button> 里既非法,
1243
+ 也会让 pointerdown 冒泡触发拖动。 */
1244
+ h("button", {
1245
+ className: "dph_pillClose",
1246
+ key: "close",
1247
+ type: "button",
1248
+ title: t("action.hide") + " · " + t("action.hideHint"),
1249
+ "aria-label": t("action.hide"),
1250
+ onClick: (event) => {
1251
+ event.stopPropagation();
1252
+ hideHub("pill");
1253
+ },
1254
+ }, "×"),
1006
1255
  ]),
1007
1256
  ]);
1008
1257
  }
@@ -1042,7 +1291,16 @@ window.__ModuleLoader__.load({
1042
1291
  h("div", { className: "dph_panelBody", key: "bbody" }, renderBest(bestData, best.copiedCmd, best.markCopied)),
1043
1292
  ]),
1044
1293
  h("div", { className: "dph_panelFoot", key: "foot" }, [
1045
- telemetryToggle(),
1294
+ h("div", { className: "dph_footRow", key: "row" }, [
1295
+ telemetryToggle(),
1296
+ h("button", {
1297
+ className: "dph_btn",
1298
+ key: "hide",
1299
+ type: "button",
1300
+ title: t("action.hideHint"),
1301
+ onClick: () => hideHub("panel"),
1302
+ }, t("action.hide")),
1303
+ ]),
1046
1304
  h("span", { key: "hint", className: "dph_footer" }, t("footer.hint")),
1047
1305
  ]),
1048
1306
  ]),
@@ -1059,6 +1317,13 @@ window.__ModuleLoader__.load({
1059
1317
  const t = ctx.locale.bind(NS);
1060
1318
  const ui = makeUi(t);
1061
1319
 
1320
+ /* 插件被加载 = 一次心跳。它同时是「在用哪个版本」的唯一来源:
1321
+ 老版本发不出新事件,看板上的空值必须能和「真没人做」区分开。
1322
+ (版本号由 host 在转发时统一附加。) */
1323
+ track("plugin_hub", { action: "hello" });
1324
+ /* 上一次安装的回执要到这一刻才能取(见 reportPostInstall)。 */
1325
+ reportPostInstall();
1326
+
1062
1327
  ctx.slots.inject(
1063
1328
  "conversation.view",
1064
1329
  () =>
package/lib/index.js CHANGED
@@ -1,16 +1,19 @@
1
1
  /**
2
- * dsh-dpharness — host half (v0.3.0).
2
+ * dsh-dpharness — host half (v0.4.4).
3
3
  *
4
4
  * Catalog routes, a write-only telemetry relay and a one-click installer:
5
5
  *
6
6
  * GET /api/dpharness/search?q=<kw>&take=<n>&sort=stars
7
7
  * GET /api/dpharness/meta
8
+ * GET /api/dpharness/postinstall?pkg=<pkg>&via=<local|market>&at=<epochMs>
8
9
  * POST /api/dpharness/event → relayed to https://dpharness.com/api/track/event
9
10
  * POST /api/dpharness/install → spawns `dsh plugin --profile <p> add <pkg>`
10
11
  * GET /api/dpharness/install → progress of the one in-flight install job
11
12
  *
12
13
  * The telemetry relay exists because the site's tracker sends no CORS headers,
13
14
  * so the browser page served from 127.0.0.1:8787 cannot post to it directly.
15
+ * It also stamps every relayed event with the plugin version, which is the only
16
+ * way to tell "nobody did this" apart from "an old version could not report it".
14
17
  *
15
18
  * Privacy contract: the client never sends search keywords. Only event names,
16
19
  * an opaque per-install visitor id, package names the user explicitly copied,
@@ -27,6 +30,8 @@
27
30
  */
28
31
 
29
32
  import { spawn } from "node:child_process";
33
+ import fs from "node:fs";
34
+ import os from "node:os";
30
35
  import path from "node:path";
31
36
 
32
37
  export const name = "dpharness";
@@ -34,7 +39,16 @@ export const name = "dpharness";
34
39
  /** The dsh web server service used to register HTTP routes. */
35
40
  export const inject = ["webServer"];
36
41
 
37
- export const VERSION = "0.4.1";
42
+ export const VERSION = "0.4.4";
43
+
44
+ /**
45
+ * Wall-clock time this dsh process started.
46
+ *
47
+ * Needed to answer "did dsh restart since this install?" — and it has to come
48
+ * from the host, because the client is the same JS before and after a restart
49
+ * and therefore cannot prove a restart happened on its own.
50
+ */
51
+ const STARTED_AT = Date.now() - Math.round(process.uptime() * 1000);
38
52
 
39
53
  /**
40
54
  * Profile used for installs.
@@ -236,6 +250,44 @@ function jobView() {
236
250
  };
237
251
  }
238
252
 
253
+ /* ------------------------------------------------------- post-install evidence */
254
+ /**
255
+ * Read the profile's own manifest.
256
+ *
257
+ * Verified path (2026-09-21, this machine): `~/.dsh/profiles/<profile>/package.json`
258
+ * holds both `dependencies` (what was resolved) and `dsh.profile.bundles`
259
+ * (what dsh actually loads). The bundle list is the stronger signal — a package
260
+ * can sit in node_modules and still not be loaded.
261
+ *
262
+ * Returns null when the file is unreadable, and callers must propagate that as
263
+ * `null` (unknown) rather than `false` (no) — see buildTrackPayload's note on
264
+ * why "unknown" and "no" must stay distinguishable.
265
+ *
266
+ * No DSH_HOME override here on purpose: that variable is not something this
267
+ * plugin has verified dsh honours, and inventing an env knob would make the
268
+ * probe silently report "unknown" for anyone whose layout differs.
269
+ */
270
+ function profileManifest() {
271
+ const dir = path.join(os.homedir(), ".dsh", "profiles", PROFILE);
272
+ try {
273
+ return JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8"));
274
+ } catch (error) {
275
+ return null;
276
+ }
277
+ }
278
+
279
+ /** { dep, bundled } — each true / false / null(unknown). */
280
+ export function pkgState(pkg, manifest = profileManifest()) {
281
+ if (manifest === null || typeof manifest !== "object") return { dep: null, bundled: null };
282
+ const deps = manifest.dependencies && typeof manifest.dependencies === "object" ? manifest.dependencies : null;
283
+ const profile = manifest.dsh && manifest.dsh.profile ? manifest.dsh.profile : null;
284
+ const bundles = profile && Array.isArray(profile.bundles) ? profile.bundles : null;
285
+ return {
286
+ dep: deps === null ? null : Object.prototype.hasOwnProperty.call(deps, pkg),
287
+ bundled: bundles === null ? null : bundles.includes(pkg),
288
+ };
289
+ }
290
+
239
291
  /** key -> { at: epochMs, value: { count, plugins } } */
240
292
  const cache = new Map();
241
293
  /** /api/best 单键缓存(榜单每月只重算一次,5 分钟缓存足够) */
@@ -414,6 +466,18 @@ function parseQuery(req) {
414
466
  return params;
415
467
  }
416
468
 
469
+ /**
470
+ * Raw query access for routes with their own parameter set.
471
+ *
472
+ * Do NOT reuse parseQuery() outside search/best: it is a **whitelist** and only
473
+ * emits q/take/sort, so any other parameter silently reads as empty
474
+ * (measured 2026-09-21 — the postinstall route got pkg="" from `?pkg=…` until
475
+ * it stopped sharing that helper).
476
+ */
477
+ function readParams(req) {
478
+ return new URL(req.url || "/", "http://127.0.0.1").searchParams;
479
+ }
480
+
417
481
  async function fetchCatalog(params) {
418
482
  const key = params.toString();
419
483
  const now = Date.now();
@@ -542,7 +606,23 @@ function buildTrackPayload(input) {
542
606
  const parts = [action];
543
607
  if (Number.isFinite(detail.length)) parts.push("len=" + Number(detail.length));
544
608
  if (Number.isFinite(detail.results)) parts.push("hits=" + Number(detail.results));
545
- if (detail.scope) parts.push("via=" + clean(detail.scope, 12));
609
+ // `via` 记录动作发生在哪条路径上(footer/overlay/local/market);
610
+ // 旧版 open 事件用的字段名是 `scope`,保留兼容,避免同一含义两个键。
611
+ const via = detail.via || detail.scope;
612
+ if (via) parts.push("via=" + clean(via, 12));
613
+ // `why` 是**闭集枚举**(market_http / busy / timeout / cli_exit …),
614
+ // 不是错误原文:原文可能含本地路径与包名,既超长又不可聚合。
615
+ if (detail.why) parts.push("why=" + clean(detail.why, 24));
616
+ // 布尔量只在**明确知道**时才写入(调用方不传即省略)。
617
+ // 省略 = 未知,与 `=0`(明确为否)必须在数据层可区分 —— 否则「查不到」
618
+ // 会被统计成一个具体的否定结论。
619
+ for (const flag of ["restarted", "bundled", "dep"]) {
620
+ if (typeof detail[flag] === "boolean") parts.push(flag + "=" + (detail[flag] ? 1 : 0));
621
+ }
622
+ // 版本号由 host 统一附加(客户端读不到 package.json)。
623
+ // 这是「新埋点覆盖率」的唯一判据:老版本插件永远发不出新事件,
624
+ // 看板上的空值既可能是"没人做过"也可能是"老版本没上报",只有版本维能切开。
625
+ parts.push("v=" + VERSION);
546
626
  value = parts.join(":").slice(0, 120);
547
627
  }
548
628
 
@@ -690,6 +770,42 @@ export function apply(ctx) {
690
770
  sendJson(res, 202, { ok: true, target, profile: PROFILE, job: jobView() });
691
771
  });
692
772
 
773
+ /**
774
+ * Post-install evidence for telemetry.
775
+ *
776
+ * The client leaves a pending marker when an install succeeds and asks here
777
+ * the next time the plugin is loaded. Both answers are computed host-side
778
+ * because neither can be self-reported: the client is the same JS before and
779
+ * after a restart, and it cannot see the profile's manifest.
780
+ *
781
+ * Read-only: no writes, no side effects, safe to call on every load.
782
+ */
783
+ registerRoute(ctx, "/api/dpharness/postinstall", (req, res) => {
784
+ if (req.method !== "GET") {
785
+ res.writeHead(405, { allow: "GET" });
786
+ res.end();
787
+ return;
788
+ }
789
+ const params = readParams(req);
790
+ const pkg = String(params.get("pkg") || "").trim().slice(0, 214);
791
+ const via = String(params.get("via") || "").trim().slice(0, 12);
792
+ const at = Number(params.get("at"));
793
+ // restarted: true only when this process provably started after the install
794
+ // finished. null (not false) when the client sent no usable timestamp.
795
+ const restarted = Number.isFinite(at) && at > 0 ? STARTED_AT > at : null;
796
+ const state = TARGET_RE.test(pkg) ? pkgState(pkg) : { dep: null, bundled: null };
797
+ sendJson(res, 200, {
798
+ ok: true,
799
+ profile: PROFILE,
800
+ startedAt: STARTED_AT,
801
+ restarted,
802
+ pkg,
803
+ via,
804
+ dep: state.dep,
805
+ bundled: state.bundled,
806
+ });
807
+ });
808
+
693
809
  registerRoute(ctx, "/api/dpharness/meta", (req, res) => {
694
810
  if (req.method !== "GET") {
695
811
  res.writeHead(405, { allow: "GET" });
@@ -704,11 +820,13 @@ export function apply(ctx) {
704
820
  source: SITE,
705
821
  upstream: UPSTREAM,
706
822
  tracker: TRACK,
823
+ startedAt: STARTED_AT,
707
824
  routes: [
708
825
  "/api/dpharness/search",
709
826
  "/api/dpharness/best",
710
827
  "/api/dpharness/event",
711
828
  "/api/dpharness/install",
829
+ "/api/dpharness/postinstall",
712
830
  "/api/dpharness/meta",
713
831
  ],
714
832
  events: Array.from(EVENT_ALLOWLIST),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-dpharness",
3
- "version": "0.4.1",
4
- "description": "Curated dpharness.com plugin catalog inside the DeepSeek Harness Web GUI: a conversation-view tab, a sidebar entry and a site-wide floating panel, with one-click install via dshmarket or the dsh CLI. Read-only catalog plus an opt-out telemetry relay.",
3
+ "version": "0.4.4",
4
+ "description": "Curated dpharness.com plugin catalog inside the DeepSeek Harness Web GUI: a conversation-view tab, a sidebar entry and a dismissible site-wide floating panel, both offering a searchable full catalog and a monthly by-category shortlist, with one-click install via dshmarket or the dsh CLI. Read-only catalog plus an opt-out telemetry relay covering the full install funnel.",
5
5
  "author": "zhanghao3693 <zhanghao3693@qq.com>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -30,6 +30,17 @@
30
30
  },
31
31
  "bundle": {
32
32
  "patch": "./cordis.patch.yml"
33
+ },
34
+ "engines": {
35
+ "dsh": ">=0.1.0-rc.5"
36
+ }
37
+ },
38
+ "peerDependencies": {
39
+ "@deepseek-ai/dsh": ">=0.1.0-rc.5"
40
+ },
41
+ "peerDependenciesMeta": {
42
+ "@deepseek-ai/dsh": {
43
+ "optional": true
33
44
  }
34
45
  },
35
46
  "files": [