dsh-session-superagent 0.9.159 → 0.9.161

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/CHANGELOG.md CHANGED
@@ -2,6 +2,49 @@
2
2
 
3
3
  格式参照 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [0.9.161] - 2026-11-03 —— 弹层每次打开都重钉一遍样式表
6
+
7
+ ### 为什么
8
+ 0.9.159/0.9.160 把注入提到了 `apply()`,但那是**挂载时一次**。如果宿主热重载、
9
+ 路由切换或任何机制把 `<head>` 里的 `<style id="dsh-zhuli-ported-css">` 清掉,
10
+ 之后打开弹层仍然是无样式裸文字 —— 而且没有任何报错。
11
+
12
+ ### 改法
13
+ - `ensurePortedCss(force)`:`force=true` 时**移除旧标签并重建**,默认仍是幂等;
14
+ - 弹层 `open` 变 true 时调一次 `ensurePortedCss(true)` —— 弹层是"一开就要好看"的东西,
15
+ 不能等下次渲染才发现没样式;
16
+ - 面板与圆环的挂载调用保持幂等(正常路径零开销)。
17
+
18
+ ### 为什么不是每次都强制
19
+ 重建会让样式表在两个 `<style>` 之间存在极短的空窗(旧已移除、新未插入),
20
+ 所以只在"即将显示"和"首次挂载"这两种时机做。
21
+
22
+ ### 测试
23
+ 静态断言再补一条:`StatusOrbit` 源码里必须出现 `ensurePortedCss(true)`。合计 **264 例**。
24
+
25
+ ## [0.9.160] - 2026-11-03 —— 样式表在 apply() 里注入一次,从结构上消灭"某个入口没样式"
26
+
27
+ ### 为什么
28
+ 0.9.159 发现圆环弹层没样式,根因是 `ensurePortedCss()` 只挂在面板组件里。
29
+ 当时补的那次调用是**第二个注入点** —— 但下次再加一个槽位(比如状态栏右侧的角标),
30
+ 同样的坑会再来一次。
31
+
32
+ ### 改法
33
+ 把注入提到模块入口,一次搞定所有槽位:
34
+
35
+ ```js
36
+ apply(ctx) {
37
+ …
38
+ // 任何槽位(面板 / 圆环 / 将来的入口)都用得上
39
+ try { ensurePortedCss() } catch {}
40
+ ```
41
+
42
+ 组件里的两次调用保留(幂等),作为"宿主早期渲染顺序异常"时的兜底。
43
+
44
+ ### 测试
45
+ 在 0.9.159 那条静态断言里再加一条:**`apply()` 源码里也必须出现 `ensurePortedCss`**。
46
+ 现在两道:入口一次 + StatusOrbit 一次,缺哪个都会红。
47
+
5
48
  ## [0.9.159] - 2026-11-03 —— 真机:圆环弹层变成无样式裸文字(样式表没注入)
6
49
 
7
50
  ### 现场(用户截图)
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <img src="assets/icon-180.png" width="88" height="88" alt="">
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
- [![Version](https://img.shields.io/badge/version-0.9.159-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.161-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
7
7
  [![npm](https://img.shields.io/npm/v/dsh-session-superagent.svg)](https://www.npmjs.com/package/dsh-session-superagent)
8
8
  [![dsh](https://img.shields.io/badge/DeepSeek%20Harness-plugin-orange.svg)](https://github.com/topics/dsh-plugin)
9
9
 
package/client.js CHANGED
@@ -14,7 +14,7 @@ window.__ModuleLoader__.load({
14
14
  const { useCallback, useEffect, useRef, useState } = React
15
15
 
16
16
  // 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
17
- const CLIENT_VERSION = '0.9.159'
17
+ const CLIENT_VERSION = '0.9.161'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
@@ -154,9 +154,23 @@ window.__ModuleLoader__.load({
154
154
  .sa-dock-foot { padding: 8px 14px 10px; border-top: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-label-caption); }
155
155
  `
156
156
 
157
- function ensurePortedCss() {
157
+ /**
158
+ * 注入设计系统样式表。
159
+ *
160
+ * `force = true` 时**无条件重建**:弹层每次打开都调一次,用来兜住
161
+ * 「宿主热重载 / 路由切换把 <head> 清掉」这种情况 —— 那时标签不在了,
162
+ * 弹层就会变成一堆无样式裸文字(2026-11-03 真机复现过)。
163
+ * 正常渲染路径用默认的幂等模式,只有"就快显示了"时才付出重建代价。
164
+ */
165
+ function ensurePortedCss(force) {
158
166
  try {
159
- if (document.getElementById('dsh-zhuli-ported-css')) return
167
+ if (!force) {
168
+ const existing = document.getElementById('dsh-zhuli-ported-css')
169
+ if (existing) return
170
+ } else {
171
+ const stale = document.getElementById('dsh-zhuli-ported-css')
172
+ if (stale && stale.parentNode) stale.parentNode.removeChild(stale)
173
+ }
160
174
  const style = document.createElement('style')
161
175
  style.id = 'dsh-zhuli-ported-css'
162
176
  style.textContent = PORTED_CSS + DOCK_CSS
@@ -697,6 +711,10 @@ window.__ModuleLoader__.load({
697
711
  return () => { alive = false; clearInterval(timer) }
698
712
  }, [])
699
713
 
714
+ // 弹层每次打开都把样式表钉一遍:宿主热重载可能把 <style> 清掉,
715
+ // 而弹层是"一开就要好看"的东西,不能等到下次渲染才发现没样式
716
+ useEffect(() => { if (open) ensurePortedCss(true) }, [open])
717
+
700
718
  useEffect(() => {
701
719
  if (!open) return undefined
702
720
  const onDown = (event) => {
@@ -2015,6 +2033,9 @@ window.__ModuleLoader__.load({
2015
2033
  apply(ctx) {
2016
2034
  try { noteOnce('client-version', CLIENT_VERSION) } catch {}
2017
2035
  try { note('apply', 'start') } catch {}
2036
+ // 样式表在这里注入一次就够了:任何槽位(面板 / 圆环 / 将来的入口)都用得上。
2037
+ // 之前只在面板组件挂载时注入,没打开过面板就直接点圆环 → 弹层没有样式(0.9.159 才补上那次调用)。
2038
+ try { ensurePortedCss() } catch {}
2018
2039
 
2019
2040
  // ① the 主理鱼 tab in the centre-column view ring
2020
2041
  ctx.effect(() => {
package/lib/index.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
 
41
41
  export const name = 'dsh-session-superagent'
42
42
  /** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
43
- export const SERVER_VERSION = '0.9.159'
43
+ export const SERVER_VERSION = '0.9.161'
44
44
  export const inject = ['tools', 'agents', 'webServer']
45
45
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
46
46
  // 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.159",
3
+ "version": "0.9.161",
4
4
  "description": "Session-level superagent for DeepSeek Harness: watch a GitHub repository and wake a session when something needs doing. Credentials never reach the model.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",