dsh-session-superagent 0.9.284 → 0.9.286
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 +37 -0
- package/README.md +3 -3
- package/client.js +82 -36
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,43 @@
|
|
|
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.286] - 2026-11-06 —— 切换中的 dirty 草稿保护
|
|
6
|
+
|
|
7
|
+
### 折叠/切换不再静默丢草稿
|
|
8
|
+
|
|
9
|
+
- dirty 折叠或切换复用 `ConfirmDialog → PanelModal → DSH Modal`。
|
|
10
|
+
- 取消、Escape、遮罩与关闭都保留当前 draft 和 touched;确认放弃才重置。
|
|
11
|
+
- 切换确认后载入目标 watcher 的干净快照,无 dirty 时保持原直达行为。
|
|
12
|
+
- 确认期间原表单仍挂载,连点受 busy 锁保护,不产生意外 POST。
|
|
13
|
+
- Modal 获焦,关闭后返回触发按钮。
|
|
14
|
+
|
|
15
|
+
### 验证
|
|
16
|
+
|
|
17
|
+
- 新增用例先红 1 绿 2 红,修后定向 4/4。
|
|
18
|
+
- 全量 **648/648**,UI 体检 **11/11=100**。
|
|
19
|
+
- 真实 Chromium **54/54**,新增 7 项覆盖取消/Escape/确认/焦点/clean 切回。
|
|
20
|
+
- 功能走查 mutation=0,防写探针 403。
|
|
21
|
+
|
|
22
|
+
未验真实 DSH Web GUI 与真实 watcher 写操作。按 Git 工作流保留本地候选。
|
|
23
|
+
|
|
24
|
+
## [0.9.285] - 2026-11-06 —— /state 会话上下文修复
|
|
25
|
+
|
|
26
|
+
### 主面板带 sessionId
|
|
27
|
+
|
|
28
|
+
- 主面板 `load()` 在 sessionId 存在时请求 `/state?sessionId=<encodeURIComponent>`。
|
|
29
|
+
- 服务端现在能返回正确的 `sessionGoal / sessionTitle / sessionUsage`,不再因为缺参置空。
|
|
30
|
+
- 空 sessionId 保持原请求,不串用其它会话 goal;Orbit 的独立 `/state` 调用不变。
|
|
31
|
+
- 服务端行为不改,只补客户端与 routes 契约。
|
|
32
|
+
|
|
33
|
+
### 验证
|
|
34
|
+
|
|
35
|
+
- 离线联合 client + update-ui + routes:**214/214**。
|
|
36
|
+
- 全量:**645/645**。
|
|
37
|
+
- 真实 Chromium:**47/47**。
|
|
38
|
+
- fixture 精确校验 sessionId query,没有放宽断言。
|
|
39
|
+
|
|
40
|
+
未验真实 DSH Web GUI 与真实 watcher 写操作。按 Git 工作流保留本地候选。
|
|
41
|
+
|
|
5
42
|
## [0.9.284] - 2026-11-06 —— Orbit 并发与删除错误修复
|
|
6
43
|
|
|
7
44
|
### 写操作 busy 锁
|
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 # 648 项单测(带离线开关;裸 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 # 648 项单测(带离线开关,约 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
|
@@ -418,7 +418,7 @@ window.__ModuleLoader__.load({
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
// 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
|
|
421
|
-
const CLIENT_VERSION = '0.9.
|
|
421
|
+
const CLIENT_VERSION = '0.9.286'
|
|
422
422
|
// SEMVER_COMPARATOR_SOURCE_START
|
|
423
423
|
// This block is duplicated verbatim in client.js because the browser UMD cannot import ESM.
|
|
424
424
|
// test/update-semver.test.mjs audits both copies and exercises their behavior.
|
|
@@ -2033,6 +2033,7 @@ window.__ModuleLoader__.load({
|
|
|
2033
2033
|
const createTouchedRef = useRef(new Set())
|
|
2034
2034
|
const createSnapshotRef = useRef({ ...CREATE_WATCHER_VALUES })
|
|
2035
2035
|
const editSnapshotRef = useRef(null)
|
|
2036
|
+
const watcherDraftConfirmedRef = useRef(false)
|
|
2036
2037
|
// 保存期间仍可输入:旧响应只能清理它提交的那份草稿,不能覆盖 pending 后的新输入。
|
|
2037
2038
|
const credentialsDraftVersionRef = useRef(0)
|
|
2038
2039
|
const credentialsSaveSeqRef = useRef(0)
|
|
@@ -2052,6 +2053,7 @@ window.__ModuleLoader__.load({
|
|
|
2052
2053
|
setForm({ ...form, [key]: value })
|
|
2053
2054
|
}
|
|
2054
2055
|
const [search, setSearch] = useState('')
|
|
2056
|
+
// 面板弹层共用既有状态槽:术语/规则使用 boolean/string,dirty 编辑确认使用对象。
|
|
2055
2057
|
const [glossary, setGlossary] = useState(false)
|
|
2056
2058
|
// 版本检查结果(只读):面板里直接告诉客户「有没有新版本、该跑什么命令」
|
|
2057
2059
|
const [update, setUpdate] = useState(null)
|
|
@@ -2096,8 +2098,9 @@ window.__ModuleLoader__.load({
|
|
|
2096
2098
|
const loadSeqRef = useRef(0)
|
|
2097
2099
|
const load = useCallback(async () => {
|
|
2098
2100
|
const seq = ++loadSeqRef.current
|
|
2101
|
+
const statePath = sessionId ? '/state?sessionId=' + encodeURIComponent(String(sessionId)) : '/state'
|
|
2099
2102
|
try {
|
|
2100
|
-
const payload = await call(
|
|
2103
|
+
const payload = await call(statePath, stateEtag ? { headers: { 'if-none-match': stateEtag } } : undefined)
|
|
2101
2104
|
if (seq !== loadSeqRef.current) return null // 已经有更新的一次请求在飞:这次结果作废
|
|
2102
2105
|
// 304:内容没变,别白白重渲染 —— 前提是本地已经有一份能渲染的 body
|
|
2103
2106
|
if (payload && payload.notModified) {
|
|
@@ -2115,7 +2118,7 @@ window.__ModuleLoader__.load({
|
|
|
2115
2118
|
setSnap((prev) => ({ loading: false, error: String((error && error.message) || error), body: prev.body }))
|
|
2116
2119
|
return null
|
|
2117
2120
|
}
|
|
2118
|
-
}, [])
|
|
2121
|
+
}, [sessionId])
|
|
2119
2122
|
|
|
2120
2123
|
useEffect(() => { ensurePortedCss() }, [])
|
|
2121
2124
|
usePoll(load, POLL_MS)
|
|
@@ -2124,6 +2127,65 @@ window.__ModuleLoader__.load({
|
|
|
2124
2127
|
// 默认值提示从后端读:写死 12/3/6 会在常量变化后变成谎话(JSON Schema 的 default 也是这个用法)
|
|
2125
2128
|
const DEFAULTS = body.defaults || {}
|
|
2126
2129
|
const watchers = body.watchers || []
|
|
2130
|
+
// 行内编辑只有这一条入口:clean 维持原直达行为;dirty 先确认,取消绝不重置 draft/touched。
|
|
2131
|
+
const applyWatcherEditor = (watcher, nextKey) => {
|
|
2132
|
+
const values = watcherValuesFrom(watcher)
|
|
2133
|
+
setEditing(nextKey)
|
|
2134
|
+
touchedRef.current = new Set()
|
|
2135
|
+
editSnapshotRef.current = nextKey ? { key: nextKey, values } : null
|
|
2136
|
+
setDraft({
|
|
2137
|
+
intervalSec: watcherNumberText(watcher.intervalSec ?? 60),
|
|
2138
|
+
labels: (watcher.filters && watcher.filters.labels ? watcher.filters.labels : []).join(','),
|
|
2139
|
+
ignoreLabels: (watcher.filters && watcher.filters.ignoreLabels ? watcher.filters.ignoreLabels : []).join(','),
|
|
2140
|
+
assignee: (watcher.filters && watcher.filters.assignee) || '',
|
|
2141
|
+
activeHours: watcher.activeHours || '',
|
|
2142
|
+
// `watcher.goal` 可能是 goalView 对象;输入框只能接收已展开的字符串。
|
|
2143
|
+
goal: watcher.note || (typeof watcher.goal === 'string' ? watcher.goal : (watcher.goal && watcher.goal.objective) || ''),
|
|
2144
|
+
ackLabel: watcher.ackLabel || (watcher.provider === 'gitee' ? '主理鱼-已处理' : '主理鱼:已处理'),
|
|
2145
|
+
onlyAssigned: !!(watcher.filters && watcher.filters.onlyAssigned),
|
|
2146
|
+
allowAuthors: (watcher.filters && watcher.filters.allowAuthors ? watcher.filters.allowAuthors : []).join(', '),
|
|
2147
|
+
observe: !!watcher.observe,
|
|
2148
|
+
isolated: !!watcher.isolated,
|
|
2149
|
+
workdir: watcher.workdir || '',
|
|
2150
|
+
batchLimit: watcherNumberText(watcher.batchLimit),
|
|
2151
|
+
maxWakesPerHour: watcherNumberText(watcher.maxWakesPerHour),
|
|
2152
|
+
sessionMaxWakes: watcherNumberText(watcher.sessionMaxWakes),
|
|
2153
|
+
isolateKeepDays: watcherNumberText(watcher.isolateKeepDays),
|
|
2154
|
+
maxIsolated: watcherNumberText(watcher.maxIsolated),
|
|
2155
|
+
priorityReopened: (watcher.priority && watcher.priority.reopened) !== false,
|
|
2156
|
+
priorityComments: (watcher.priority && watcher.priority.comments) !== false,
|
|
2157
|
+
priorityLabels: (watcher.priority && watcher.priority.labels) !== false,
|
|
2158
|
+
priorityUnassigned: Boolean(watcher.priority && watcher.priority.unassigned) === true,
|
|
2159
|
+
priorityStale: Boolean(watcher.priority && watcher.priority.stale) === true,
|
|
2160
|
+
})
|
|
2161
|
+
}
|
|
2162
|
+
const editingWatcher = watchers.find((watcher) => watcher.repo + '#' + watcher.sessionId === editing)
|
|
2163
|
+
const editingOpening = editSnapshotRef.current && editSnapshotRef.current.key === editing
|
|
2164
|
+
? editSnapshotRef.current.values
|
|
2165
|
+
: editingWatcher ? watcherValuesFrom(editingWatcher) : null
|
|
2166
|
+
const editingDirty = Boolean(editing && editingOpening && (
|
|
2167
|
+
touchedRef.current.size > 0 || watcherDirty({ ...editingOpening, ...draft }, editingOpening)))
|
|
2168
|
+
const pendingCollapseKey = glossary && glossary.type === 'watcher-draft' && !glossary.nextKey
|
|
2169
|
+
? glossary.fromKey : null
|
|
2170
|
+
// dirty 折叠在确认期间挂起 editing id,但原表单仍挂载;取消/确认之前绝不清它的 draft。
|
|
2171
|
+
const displayedEditing = editing || pendingCollapseKey
|
|
2172
|
+
const toggleWatcherEditor = (watcher) => {
|
|
2173
|
+
const key = watcher.repo + '#' + watcher.sessionId
|
|
2174
|
+
const nextKey = editing === key ? null : key
|
|
2175
|
+
if (editing && editingDirty) {
|
|
2176
|
+
watcherDraftConfirmedRef.current = false
|
|
2177
|
+
setGlossary({ type: 'watcher-draft', watcher, nextKey, fromKey: editing })
|
|
2178
|
+
if (!nextKey) setEditing(null)
|
|
2179
|
+
return
|
|
2180
|
+
}
|
|
2181
|
+
applyWatcherEditor(watcher, nextKey)
|
|
2182
|
+
}
|
|
2183
|
+
const dismissWatcherDraft = () => {
|
|
2184
|
+
if (glossary && glossary.type === 'watcher-draft' && !glossary.nextKey
|
|
2185
|
+
&& !watcherDraftConfirmedRef.current) setEditing(glossary.fromKey)
|
|
2186
|
+
watcherDraftConfirmedRef.current = false
|
|
2187
|
+
setGlossary(false)
|
|
2188
|
+
}
|
|
2127
2189
|
const sessionGoal = body.sessionGoal || null
|
|
2128
2190
|
const credentials = body.credentials || { token: 'none', sshKeyPath: 'none' }
|
|
2129
2191
|
|
|
@@ -2399,38 +2461,7 @@ window.__ModuleLoader__.load({
|
|
|
2399
2461
|
h('div', { className: 'dt-row-title' },
|
|
2400
2462
|
h('button', {
|
|
2401
2463
|
type: 'button', className: 'dt-open', title: '展开或收起这条主理鱼的设置',
|
|
2402
|
-
'aria-expanded':
|
|
2403
|
-
setEditing(editing === key ? null : key)
|
|
2404
|
-
touchedRef.current = new Set()
|
|
2405
|
-
editSnapshotRef.current = editing === key ? null : { key, values: watcherValuesFrom(watcher) }
|
|
2406
|
-
setDraft({
|
|
2407
|
-
intervalSec: watcherNumberText(watcher.intervalSec ?? 60),
|
|
2408
|
-
labels: (watcher.filters && watcher.filters.labels ? watcher.filters.labels : []).join(','),
|
|
2409
|
-
ignoreLabels: (watcher.filters && watcher.filters.ignoreLabels ? watcher.filters.ignoreLabels : []).join(','),
|
|
2410
|
-
assignee: (watcher.filters && watcher.filters.assignee) || '',
|
|
2411
|
-
activeHours: watcher.activeHours || '',
|
|
2412
|
-
// 审核 T26 M2:`watcher.goal` 是**对象**(goalView),当字符串塞进输入框会显示
|
|
2413
|
-
// [object Object];保存时后端只收 string,于是静默无效而 Toast 说「已保存」。
|
|
2414
|
-
goal: watcher.note || (typeof watcher.goal === 'string' ? watcher.goal : (watcher.goal && watcher.goal.objective) || ''),
|
|
2415
|
-
ackLabel: watcher.ackLabel || (watcher.provider === 'gitee' ? '主理鱼-已处理' : '主理鱼:已处理'),
|
|
2416
|
-
onlyAssigned: !!(watcher.filters && watcher.filters.onlyAssigned),
|
|
2417
|
-
allowAuthors: (watcher.filters && watcher.filters.allowAuthors ? watcher.filters.allowAuthors : []).join(', '),
|
|
2418
|
-
// 下面这些以前没填 —— 打开一条隔离执行的守再直接保存,会把 isolated 写回 false
|
|
2419
|
-
observe: !!watcher.observe,
|
|
2420
|
-
isolated: !!watcher.isolated,
|
|
2421
|
-
workdir: watcher.workdir || '',
|
|
2422
|
-
batchLimit: watcherNumberText(watcher.batchLimit),
|
|
2423
|
-
maxWakesPerHour: watcherNumberText(watcher.maxWakesPerHour),
|
|
2424
|
-
sessionMaxWakes: watcherNumberText(watcher.sessionMaxWakes),
|
|
2425
|
-
isolateKeepDays: watcherNumberText(watcher.isolateKeepDays),
|
|
2426
|
-
maxIsolated: watcherNumberText(watcher.maxIsolated),
|
|
2427
|
-
priorityReopened: (watcher.priority && watcher.priority.reopened) !== false,
|
|
2428
|
-
priorityComments: (watcher.priority && watcher.priority.comments) !== false,
|
|
2429
|
-
priorityLabels: (watcher.priority && watcher.priority.labels) !== false,
|
|
2430
|
-
priorityUnassigned: Boolean(watcher.priority && watcher.priority.unassigned) === true,
|
|
2431
|
-
priorityStale: Boolean(watcher.priority && watcher.priority.stale) === true,
|
|
2432
|
-
})
|
|
2433
|
-
},
|
|
2464
|
+
'aria-expanded': displayedEditing === key, onClick: () => toggleWatcherEditor(watcher),
|
|
2434
2465
|
}, watcher.repo)),
|
|
2435
2466
|
pauseNote(watcher),
|
|
2436
2467
|
h('div', { className: 'dt-row-meta dt-ticket-meta' },
|
|
@@ -2521,7 +2552,7 @@ window.__ModuleLoader__.load({
|
|
|
2521
2552
|
? editSnapshotRef.current.values
|
|
2522
2553
|
: watcherValuesFrom(watcher)
|
|
2523
2554
|
const editorValue = { ...opening, ...draft }
|
|
2524
|
-
const editor =
|
|
2555
|
+
const editor = displayedEditing === key
|
|
2525
2556
|
? h(WatcherForm, {
|
|
2526
2557
|
mode: 'edit', idPrefix: 'watcher-edit-' + encodeURIComponent(key),
|
|
2527
2558
|
value: editorValue, snapshot: opening, defaults: DEFAULTS, sessionId,
|
|
@@ -3393,6 +3424,21 @@ window.__ModuleLoader__.load({
|
|
|
3393
3424
|
snap.body && tab === 'settings' ? h('div', {
|
|
3394
3425
|
id: 'sa-main-panel-settings', role: 'tabpanel', 'aria-labelledby': 'sa-main-tab-settings', className: 'dt-tabpanel',
|
|
3395
3426
|
}, settings) : null,
|
|
3427
|
+
glossary && glossary.type === 'watcher-draft' ? h(ConfirmDialog, {
|
|
3428
|
+
open: true,
|
|
3429
|
+
label: '放弃未保存的修改',
|
|
3430
|
+
title: '放弃未保存的修改?',
|
|
3431
|
+
confirmLabel: glossary.nextKey ? '放弃并切换' : '放弃并收起',
|
|
3432
|
+
message: glossary.nextKey
|
|
3433
|
+
? '当前 watcher 有未保存的修改。切换到 ' + glossary.watcher.repo + ' 会丢弃这些修改;取消会继续编辑当前草稿。'
|
|
3434
|
+
: '当前 watcher 有未保存的修改。收起会丢弃这些修改;取消会继续编辑当前草稿。',
|
|
3435
|
+
onClose: dismissWatcherDraft,
|
|
3436
|
+
onConfirm: () => {
|
|
3437
|
+
watcherDraftConfirmedRef.current = true
|
|
3438
|
+
applyWatcherEditor(glossary.watcher, glossary.nextKey)
|
|
3439
|
+
return true
|
|
3440
|
+
},
|
|
3441
|
+
}) : null,
|
|
3396
3442
|
typeof glossary === 'string' ? h(PanelModal, {
|
|
3397
3443
|
open: true,
|
|
3398
3444
|
title: '建议追加到 ' + String(glossary).replace('rules:', '') + ' 的 AGENTS.md',
|
package/lib/index.js
CHANGED
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
|
|
50
50
|
export const name = 'dsh-session-superagent'
|
|
51
51
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
52
|
-
export const SERVER_VERSION = '0.9.
|
|
52
|
+
export const SERVER_VERSION = '0.9.286'
|
|
53
53
|
export const inject = ['tools', 'agents', 'webServer']
|
|
54
54
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
55
55
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.286",
|
|
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",
|