dsh-session-superagent 0.9.269 → 0.9.270
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 +31 -0
- package/README.md +3 -3
- package/client.js +28 -6
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/ui-host-primitives.js +3 -0
- package/ui-orbit-popover.js +29 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
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.270] - 2026-11-05 —— 真实 Chromium 验收 27/27,Orbit 焦点链修复
|
|
6
|
+
|
|
7
|
+
独立 `ui-host-primitives.js` 的 Tooltip 需要 `React.cloneElement` 合并 trigger ref。
|
|
8
|
+
老宿主缺少该能力时,现在直接给出可读错误:
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
Tooltip 需要宿主 React.cloneElement 以合并 trigger ref
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
不再在渲染深处抛「React.cloneElement is not a function」。
|
|
15
|
+
主面板已有独立 forwardRef 回退,不受这次模块防线影响。
|
|
16
|
+
|
|
17
|
+
### Orbit 真实焦点链
|
|
18
|
+
|
|
19
|
+
真实 Chromium 首先发现并复验修复了三个测试桩未覆盖的问题:
|
|
20
|
+
首帧 hidden 聚焦失败、Orbit cleanup 覆盖 Modal autofocus、外点被强制回圆环。
|
|
21
|
+
现在 visible 后每次 open 只聚焦一次;outside/confirm 不抢焦点;Escape 回圆环;
|
|
22
|
+
确认关闭后才显式回圆环。独立适配器与 UMD 实现同步,confirm reason 可跨父组件关闭路径传递。
|
|
23
|
+
|
|
24
|
+
### 证据
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
test/host-primitives-adapter.test.mjs → 12/12(新增缺 cloneElement 用例)
|
|
28
|
+
Orbit 独立适配器 → 13/13;UMD 集成 → 8/8
|
|
29
|
+
适配器同源审计 → 84 项结构化断言 + 4 条测试,含 holdMs/openOnClick 变异反例
|
|
30
|
+
真实 Chromium 156.0.8078.74 → 27/27,含 Tooltip/Orbit/Modal 焦点与事件
|
|
31
|
+
npm test → 544/544
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
T61/T62/T64 均已完成;真实 DSH WebView 的宿主 slot、读屏与 watcher 请求仍列入走查。
|
|
35
|
+
|
|
5
36
|
## [0.9.269] - 2026-11-05 —— Tooltip 不再丢焦点,Orbit 触发按钮去 inline 化
|
|
6
37
|
|
|
7
38
|
### Tooltip scroll-close 保留焦点
|
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)
|
|
6
|
-
[](https://github.com/MYCF711/dsh-session-superagent/releases)
|
|
7
7
|
[](https://www.npmjs.com/package/dsh-session-superagent)
|
|
8
8
|
[](https://github.com/topics/dsh-plugin)
|
|
9
9
|
[](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
|
|
@@ -148,7 +148,7 @@ Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不
|
|
|
148
148
|
## 开发
|
|
149
149
|
|
|
150
150
|
```sh
|
|
151
|
-
npm test #
|
|
151
|
+
npm test # 544 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
### 工具输出:文本给人和 agent,JSON 给程序
|
|
@@ -208,7 +208,7 @@ dsh plugin --profile <profile> add dsh-session-superagent@latest
|
|
|
208
208
|
|
|
209
209
|
|
|
210
210
|
```bash
|
|
211
|
-
npm test #
|
|
211
|
+
npm test # 544 项单测(带离线开关,约 1.6 秒)
|
|
212
212
|
node scripts/ui-audit.mjs # 11 项 UI 指标(写死颜色 / 自造 token / 官方结构采用 …)
|
|
213
213
|
node scripts/preflight.mjs # 41 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
|
|
214
214
|
node scripts/render-preview.mjs preview.html # 双主题静态预览,直接浏览器打开
|
package/client.js
CHANGED
|
@@ -135,6 +135,8 @@ window.__ModuleLoader__.load({
|
|
|
135
135
|
// createOrbitPopover({React, primitives}) 的参数、OrbitPopover/useOrbitConfirm 调用面与来源模块一致;
|
|
136
136
|
// React.createPortal 由调用方用宿主 require('react-dom').createPortal 注入,不伪造 primitives.createPortal。
|
|
137
137
|
const DEFAULT_ORBIT_Z_INDEX = 1100
|
|
138
|
+
// confirm 由父组件的 useOrbitConfirm 直接关闭 orbit,不经过 OrbitPopover.close;按 ref 关联原因,避免新增公开参数。
|
|
139
|
+
const orbitCloseReasons = new WeakMap()
|
|
138
140
|
|
|
139
141
|
function focusIfConnected(node) {
|
|
140
142
|
if (!node || typeof node.focus !== 'function') return false
|
|
@@ -168,6 +170,10 @@ window.__ModuleLoader__.load({
|
|
|
168
170
|
|
|
169
171
|
const requestConfirm = HostReact.useCallback((detail = {}) => {
|
|
170
172
|
restoreFocusRef.current = 'orbit'
|
|
173
|
+
const ref = orbitRefRef.current
|
|
174
|
+
if (ref && (typeof ref === 'object' || typeof ref === 'function')) {
|
|
175
|
+
orbitCloseReasons.set(ref, 'confirm')
|
|
176
|
+
}
|
|
171
177
|
if (typeof onCloseOrbitRef.current === 'function') {
|
|
172
178
|
onCloseOrbitRef.current({ reason: 'confirm' })
|
|
173
179
|
}
|
|
@@ -244,10 +250,14 @@ window.__ModuleLoader__.load({
|
|
|
244
250
|
const returnFocusRef = orbitRef || anchorRef
|
|
245
251
|
const onCloseRef = HostReact.useRef(onClose)
|
|
246
252
|
onCloseRef.current = onClose
|
|
253
|
+
const didFocusRef = HostReact.useRef(false)
|
|
254
|
+
const closeReasonRef = HostReact.useRef(null)
|
|
247
255
|
|
|
248
256
|
const close = HostReact.useCallback((detail) => {
|
|
257
|
+
const reason = closeReason(detail)
|
|
258
|
+
closeReasonRef.current = reason.reason
|
|
249
259
|
const callback = onCloseRef.current
|
|
250
|
-
if (typeof callback === 'function') callback(
|
|
260
|
+
if (typeof callback === 'function') callback(reason)
|
|
251
261
|
}, [])
|
|
252
262
|
|
|
253
263
|
// 与来源适配器一致:宿主 hooks 和本地 effect 都在 open 分支前无条件调用。
|
|
@@ -270,8 +280,18 @@ window.__ModuleLoader__.load({
|
|
|
270
280
|
: (typeof document !== 'undefined' ? document : null)
|
|
271
281
|
|
|
272
282
|
HostReact.useEffect(() => {
|
|
273
|
-
if (!open
|
|
274
|
-
|
|
283
|
+
if (!open) {
|
|
284
|
+
didFocusRef.current = false
|
|
285
|
+
closeReasonRef.current = null
|
|
286
|
+
orbitCloseReasons.delete(returnFocusRef)
|
|
287
|
+
return undefined
|
|
288
|
+
}
|
|
289
|
+
// 首帧 position=null 时 surface 是 hidden,focus() 会被浏览器拒绝;等可见后只尝试一次。
|
|
290
|
+
if (position && !didFocusRef.current) {
|
|
291
|
+
didFocusRef.current = true
|
|
292
|
+
focusIfConnected(panelRef.current)
|
|
293
|
+
}
|
|
294
|
+
if (!ownerDocument || typeof ownerDocument.addEventListener !== 'function') return undefined
|
|
275
295
|
const onKeyDown = (event) => {
|
|
276
296
|
if (!event || event.key !== 'Escape' || event.repeat) return
|
|
277
297
|
if (typeof event.preventDefault === 'function') event.preventDefault()
|
|
@@ -281,9 +301,11 @@ window.__ModuleLoader__.load({
|
|
|
281
301
|
ownerDocument.addEventListener('keydown', onKeyDown, true)
|
|
282
302
|
return () => {
|
|
283
303
|
ownerDocument.removeEventListener('keydown', onKeyDown, true)
|
|
284
|
-
|
|
304
|
+
closeReasonRef.current = closeReasonRef.current || orbitCloseReasons.get(returnFocusRef) || null
|
|
305
|
+
if (closeReasonRef.current === 'escape') focusIfConnected(returnFocusRef && returnFocusRef.current)
|
|
306
|
+
closeReasonRef.current = null
|
|
285
307
|
}
|
|
286
|
-
}, [open, close, ownerDocument, panelRef, returnFocusRef])
|
|
308
|
+
}, [open, position, close, ownerDocument, panelRef, returnFocusRef])
|
|
287
309
|
|
|
288
310
|
if (!open) return null
|
|
289
311
|
if (!anchorRef || typeof anchorRef !== 'object') {
|
|
@@ -350,7 +372,7 @@ window.__ModuleLoader__.load({
|
|
|
350
372
|
}
|
|
351
373
|
|
|
352
374
|
// 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
|
|
353
|
-
const CLIENT_VERSION = '0.9.
|
|
375
|
+
const CLIENT_VERSION = '0.9.270'
|
|
354
376
|
let BASE = '/session-superagent'
|
|
355
377
|
/**
|
|
356
378
|
* 挑「最新的那个服务端实例」。
|
package/lib/index.js
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
|
|
48
48
|
export const name = 'dsh-session-superagent'
|
|
49
49
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
50
|
-
export const SERVER_VERSION = '0.9.
|
|
50
|
+
export const SERVER_VERSION = '0.9.270'
|
|
51
51
|
export const inject = ['tools', 'agents', 'webServer']
|
|
52
52
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
53
53
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.270",
|
|
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",
|
package/ui-host-primitives.js
CHANGED
|
@@ -71,6 +71,9 @@ export function createHostUi({ React, primitives } = {}) {
|
|
|
71
71
|
|
|
72
72
|
function Tooltip({ text, icon = 'question', warn = false, children } = {}) {
|
|
73
73
|
const HostTooltip = primitive('Tooltip')
|
|
74
|
+
if (typeof React.cloneElement !== 'function') {
|
|
75
|
+
throw new TypeError('Tooltip 需要宿主 React.cloneElement 以合并 trigger ref')
|
|
76
|
+
}
|
|
74
77
|
const [remountKey, setRemountKey] = React.useState(0)
|
|
75
78
|
const triggerNodeRef = React.useRef(null)
|
|
76
79
|
const restoreFocusRef = React.useRef(false)
|
package/ui-orbit-popover.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// 这里不包含 watcher 轮询、行数据、删除请求、确认 Modal 或另一套定位实现。
|
|
4
4
|
|
|
5
5
|
const DEFAULT_ORBIT_Z_INDEX = 1100
|
|
6
|
+
// confirm 由父组件的 useOrbitConfirm 直接关闭 orbit,不经过 OrbitPopover.close;按 ref 关联原因,避免新增公开参数。
|
|
7
|
+
const orbitCloseReasons = new WeakMap()
|
|
6
8
|
|
|
7
9
|
function focusIfConnected(node) {
|
|
8
10
|
if (!node || typeof node.focus !== 'function') return false
|
|
@@ -81,11 +83,15 @@ export function createOrbitPopover({ React, primitives } = {}) {
|
|
|
81
83
|
const returnFocusRef = orbitRef || anchorRef
|
|
82
84
|
const onCloseRef = React.useRef(onClose)
|
|
83
85
|
onCloseRef.current = onClose
|
|
86
|
+
const didFocusRef = React.useRef(false)
|
|
87
|
+
const closeReasonRef = React.useRef(null)
|
|
84
88
|
|
|
85
89
|
// stable close:父级轮询重渲染只更新 ref,不重建外点 effect 或焦点 effect。
|
|
86
90
|
const close = React.useCallback((detail) => {
|
|
91
|
+
const reason = closeReason(detail)
|
|
92
|
+
closeReasonRef.current = reason.reason
|
|
87
93
|
const callback = onCloseRef.current
|
|
88
|
-
if (typeof callback === 'function') callback(
|
|
94
|
+
if (typeof callback === 'function') callback(reason)
|
|
89
95
|
}, [])
|
|
90
96
|
|
|
91
97
|
// 两个宿主 hooks 与本地 effect 都在 if (!open) return 之前无条件调用。
|
|
@@ -107,11 +113,20 @@ export function createOrbitPopover({ React, primitives } = {}) {
|
|
|
107
113
|
? portalTarget.ownerDocument
|
|
108
114
|
: (typeof document !== 'undefined' ? document : null)
|
|
109
115
|
|
|
116
|
+
// effect 在 portal mount 后运行;非 Modal dialog 自身接收初始焦点,不做焦点陷阱。
|
|
110
117
|
React.useEffect(() => {
|
|
111
|
-
if (!open
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
if (!open) {
|
|
119
|
+
didFocusRef.current = false
|
|
120
|
+
closeReasonRef.current = null
|
|
121
|
+
orbitCloseReasons.delete(returnFocusRef)
|
|
122
|
+
return undefined
|
|
123
|
+
}
|
|
124
|
+
// 首帧 position=null 时 surface 是 hidden,focus() 会被浏览器拒绝;等可见后只尝试一次。
|
|
125
|
+
if (position && !didFocusRef.current) {
|
|
126
|
+
didFocusRef.current = true
|
|
127
|
+
focusIfConnected(panelRef.current)
|
|
128
|
+
}
|
|
129
|
+
if (!ownerDocument || typeof ownerDocument.addEventListener !== 'function') return undefined
|
|
115
130
|
const onKeyDown = (event) => {
|
|
116
131
|
if (!event || event.key !== 'Escape' || event.repeat) return
|
|
117
132
|
if (typeof event.preventDefault === 'function') event.preventDefault()
|
|
@@ -121,10 +136,12 @@ export function createOrbitPopover({ React, primitives } = {}) {
|
|
|
121
136
|
ownerDocument.addEventListener('keydown', onKeyDown, true)
|
|
122
137
|
return () => {
|
|
123
138
|
ownerDocument.removeEventListener('keydown', onKeyDown, true)
|
|
124
|
-
|
|
125
|
-
|
|
139
|
+
closeReasonRef.current = closeReasonRef.current || orbitCloseReasons.get(returnFocusRef) || null
|
|
140
|
+
// 外点要把焦点留给用户点击的目标;确认要让 Modal 持有焦点。只有 Escape 显式回圆环。
|
|
141
|
+
if (closeReasonRef.current === 'escape') focusIfConnected(returnFocusRef && returnFocusRef.current)
|
|
142
|
+
closeReasonRef.current = null
|
|
126
143
|
}
|
|
127
|
-
}, [open, close, ownerDocument, panelRef, returnFocusRef])
|
|
144
|
+
}, [open, position, close, ownerDocument, panelRef, returnFocusRef])
|
|
128
145
|
|
|
129
146
|
if (!open) return null
|
|
130
147
|
if (!anchorRef || typeof anchorRef !== 'object') {
|
|
@@ -172,6 +189,10 @@ export function createOrbitPopover({ React, primitives } = {}) {
|
|
|
172
189
|
|
|
173
190
|
const requestConfirm = React.useCallback((detail = {}) => {
|
|
174
191
|
restoreFocusRef.current = 'orbit'
|
|
192
|
+
const ref = orbitRefRef.current
|
|
193
|
+
if (ref && (typeof ref === 'object' || typeof ref === 'function')) {
|
|
194
|
+
orbitCloseReasons.set(ref, 'confirm')
|
|
195
|
+
}
|
|
175
196
|
if (typeof onCloseOrbitRef.current === 'function') {
|
|
176
197
|
onCloseOrbitRef.current({ reason: 'confirm' })
|
|
177
198
|
}
|