dsh-session-superagent 0.9.285 → 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 +19 -0
- package/README.md +3 -3
- package/client.js +79 -34
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
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
|
+
|
|
5
24
|
## [0.9.285] - 2026-11-06 —— /state 会话上下文修复
|
|
6
25
|
|
|
7
26
|
### 主面板带 sessionId
|
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)
|
|
@@ -2125,6 +2127,65 @@ window.__ModuleLoader__.load({
|
|
|
2125
2127
|
// 默认值提示从后端读:写死 12/3/6 会在常量变化后变成谎话(JSON Schema 的 default 也是这个用法)
|
|
2126
2128
|
const DEFAULTS = body.defaults || {}
|
|
2127
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
|
+
}
|
|
2128
2189
|
const sessionGoal = body.sessionGoal || null
|
|
2129
2190
|
const credentials = body.credentials || { token: 'none', sshKeyPath: 'none' }
|
|
2130
2191
|
|
|
@@ -2400,38 +2461,7 @@ window.__ModuleLoader__.load({
|
|
|
2400
2461
|
h('div', { className: 'dt-row-title' },
|
|
2401
2462
|
h('button', {
|
|
2402
2463
|
type: 'button', className: 'dt-open', title: '展开或收起这条主理鱼的设置',
|
|
2403
|
-
'aria-expanded':
|
|
2404
|
-
setEditing(editing === key ? null : key)
|
|
2405
|
-
touchedRef.current = new Set()
|
|
2406
|
-
editSnapshotRef.current = editing === key ? null : { key, values: watcherValuesFrom(watcher) }
|
|
2407
|
-
setDraft({
|
|
2408
|
-
intervalSec: watcherNumberText(watcher.intervalSec ?? 60),
|
|
2409
|
-
labels: (watcher.filters && watcher.filters.labels ? watcher.filters.labels : []).join(','),
|
|
2410
|
-
ignoreLabels: (watcher.filters && watcher.filters.ignoreLabels ? watcher.filters.ignoreLabels : []).join(','),
|
|
2411
|
-
assignee: (watcher.filters && watcher.filters.assignee) || '',
|
|
2412
|
-
activeHours: watcher.activeHours || '',
|
|
2413
|
-
// 审核 T26 M2:`watcher.goal` 是**对象**(goalView),当字符串塞进输入框会显示
|
|
2414
|
-
// [object Object];保存时后端只收 string,于是静默无效而 Toast 说「已保存」。
|
|
2415
|
-
goal: watcher.note || (typeof watcher.goal === 'string' ? watcher.goal : (watcher.goal && watcher.goal.objective) || ''),
|
|
2416
|
-
ackLabel: watcher.ackLabel || (watcher.provider === 'gitee' ? '主理鱼-已处理' : '主理鱼:已处理'),
|
|
2417
|
-
onlyAssigned: !!(watcher.filters && watcher.filters.onlyAssigned),
|
|
2418
|
-
allowAuthors: (watcher.filters && watcher.filters.allowAuthors ? watcher.filters.allowAuthors : []).join(', '),
|
|
2419
|
-
// 下面这些以前没填 —— 打开一条隔离执行的守再直接保存,会把 isolated 写回 false
|
|
2420
|
-
observe: !!watcher.observe,
|
|
2421
|
-
isolated: !!watcher.isolated,
|
|
2422
|
-
workdir: watcher.workdir || '',
|
|
2423
|
-
batchLimit: watcherNumberText(watcher.batchLimit),
|
|
2424
|
-
maxWakesPerHour: watcherNumberText(watcher.maxWakesPerHour),
|
|
2425
|
-
sessionMaxWakes: watcherNumberText(watcher.sessionMaxWakes),
|
|
2426
|
-
isolateKeepDays: watcherNumberText(watcher.isolateKeepDays),
|
|
2427
|
-
maxIsolated: watcherNumberText(watcher.maxIsolated),
|
|
2428
|
-
priorityReopened: (watcher.priority && watcher.priority.reopened) !== false,
|
|
2429
|
-
priorityComments: (watcher.priority && watcher.priority.comments) !== false,
|
|
2430
|
-
priorityLabels: (watcher.priority && watcher.priority.labels) !== false,
|
|
2431
|
-
priorityUnassigned: Boolean(watcher.priority && watcher.priority.unassigned) === true,
|
|
2432
|
-
priorityStale: Boolean(watcher.priority && watcher.priority.stale) === true,
|
|
2433
|
-
})
|
|
2434
|
-
},
|
|
2464
|
+
'aria-expanded': displayedEditing === key, onClick: () => toggleWatcherEditor(watcher),
|
|
2435
2465
|
}, watcher.repo)),
|
|
2436
2466
|
pauseNote(watcher),
|
|
2437
2467
|
h('div', { className: 'dt-row-meta dt-ticket-meta' },
|
|
@@ -2522,7 +2552,7 @@ window.__ModuleLoader__.load({
|
|
|
2522
2552
|
? editSnapshotRef.current.values
|
|
2523
2553
|
: watcherValuesFrom(watcher)
|
|
2524
2554
|
const editorValue = { ...opening, ...draft }
|
|
2525
|
-
const editor =
|
|
2555
|
+
const editor = displayedEditing === key
|
|
2526
2556
|
? h(WatcherForm, {
|
|
2527
2557
|
mode: 'edit', idPrefix: 'watcher-edit-' + encodeURIComponent(key),
|
|
2528
2558
|
value: editorValue, snapshot: opening, defaults: DEFAULTS, sessionId,
|
|
@@ -3394,6 +3424,21 @@ window.__ModuleLoader__.load({
|
|
|
3394
3424
|
snap.body && tab === 'settings' ? h('div', {
|
|
3395
3425
|
id: 'sa-main-panel-settings', role: 'tabpanel', 'aria-labelledby': 'sa-main-tab-settings', className: 'dt-tabpanel',
|
|
3396
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,
|
|
3397
3442
|
typeof glossary === 'string' ? h(PanelModal, {
|
|
3398
3443
|
open: true,
|
|
3399
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",
|