dsh-session-superagent 0.10.9 → 0.10.10
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/AGENTS.md +1 -1
- package/CHANGELOG.md +36 -0
- package/README.md +2 -2
- package/client.js +124 -18
- package/lib/index.js +1 -1
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -129,7 +129,7 @@ node scripts/render-preview.mjs preview.html
|
|
|
129
129
|
|
|
130
130
|
## 十、当前基线
|
|
131
131
|
|
|
132
|
-
0.10.
|
|
132
|
+
0.10.10;全量 **934/934**、preflight **42 项**、UI **11/11**、真实 Chromium **47/47**。
|
|
133
133
|
未验:真实 DSH WebView 重载后的读屏 / 触摸 / IME、真实 GitHub/Gitee 写操作。没有实测不得写成通过。
|
|
134
134
|
|
|
135
135
|
## 十一、Issue/PR 回复边界
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,42 @@
|
|
|
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.10.10] - 2026-11-08 —— 门禁 v4(并发一致性与异步竞态收尾)
|
|
6
|
+
|
|
7
|
+
- 门禁子包 `@mycf711/dsh-gate` `0.1.2` → **`0.1.3`**:新增跨进程写锁与 Windows rename 重试
|
|
8
|
+
(`lib/config-lock.js`,公开子路径 `./lib/config-lock.js`)。同一配置路径的「读旧文件 → 校验 → 备份 →
|
|
9
|
+
临时写入 → rename」整体在 `<gates.json>.lock` 的 `O_EXCL` 锁内串行,跨进程也不会拿旧快照互相覆盖;
|
|
10
|
+
拿不到锁显式失败(`code: 'gate_lock_timeout'`,带持有者 `pid/host/startedAt` 与锁年龄),**不**退回无锁写;
|
|
11
|
+
stale 锁只在超龄或同机所有者已死时接管,年龄与所有者证据进返回值 `lock.broken`。
|
|
12
|
+
`writeGateConfig` 新增 `lockTimeoutMs` / `lockPollMs` / `lockStaleMs` / `lockGuardStaleMs` /
|
|
13
|
+
`renameAttempts` / `renameBackoffMs` 选项。
|
|
14
|
+
- 守护锁与释放安全:创建 / 接管串行在 `<lock>.guard`(阈值独立 10s);搬走 stale 锁到唯一名字后**再核对**
|
|
15
|
+
token(内容不可解析时比对原文),搬错就用 `link` / `COPYFILE_EXCL` 原子放回,绝不误删;`release()` 只在
|
|
16
|
+
守护区内核对 token 后才从原位 `unlink`,不匹配一个字节都不碰(拿不到守护锁 2s 上限同样不碰 `lockPath`);
|
|
17
|
+
写盘前 `assertOwner()`,锁被接管过就抛 `gate_lock_lost`。新导出 `gateLockPath` / `gateGuardPath` /
|
|
18
|
+
`GATE_LOCK_SUFFIX` / `GATE_GUARD_SUFFIX` / `DEFAULT_GATE_*` / `acquireGateConfigLock` / `renameWithRetry`,
|
|
19
|
+
锁句柄新增 `isOwner()` / `assertOwner()`。
|
|
20
|
+
- Windows `rename` 遇 `EPERM` / `EBUSY`:线性有界退避重试,耗尽后保留原文件、清理临时文件与锁,
|
|
21
|
+
错误带 `code` / `attempts`;`extends` 的 fail-closed、`false` / `'none'`、`.bak` 行为不回归。
|
|
22
|
+
- 设置页门禁面板:每次 `load` 有单调序号、卸载取消与仓库一致性校验,只有最新且仍匹配当前 repo 的响应可提交;
|
|
23
|
+
草稿显式记录**来源仓库**,在途响应不得清掉 dirty 草稿(确认条保留),保存 / 预览 / 优化与确认条统一认草稿
|
|
24
|
+
来源仓库;取消换仓库会作废在途 `/gates/models` 并重读面板仓库模型列表;React StrictMode 双挂载在 effect
|
|
25
|
+
体复位 `aliveRef`。`GateSettings` 状态仍在组件内,主面板 hook 队列(23 槽)与官方 `SegmentedControl` 未动。
|
|
26
|
+
- 发布检查:`sync-profile` 的 `TARGETS` 条目必须真实存在于仓库 —— 以前缺源被静默跳过、`--check` 照样
|
|
27
|
+
`exit 0`(假绿);现在缺一条就点名并按 **`exit 2`** 红(`--repair` 修不了),总览行只在缺源时追加
|
|
28
|
+
「TARGETS 缺源 N」。`preflight` 的 profile 行解析抽成纯函数 `summarizeProfileCheck`(单一事实来源),
|
|
29
|
+
判定要求 `sync-profile` 退出码 0 **且**解析 clean,并解析新增的**第五段「TARGETS 缺源」**;老格式
|
|
30
|
+
(只有三段)按不干净处理。
|
|
31
|
+
- 验证(合并 `main` 后最终树实测):根 `npm test` **934/934**、gate 包 **166/166**、
|
|
32
|
+
`test/client.test.mjs` **162/162**、`test/update-ui.test.mjs` **53/53**、
|
|
33
|
+
`test/sync-profile-drift.test.mjs` **11/11**、`PANEL_STRICT=1` 门禁用例 **40/40**、
|
|
34
|
+
UI 审计 **11/11(100 分)**、面板文案快照 PASS、真实 Chromium **47/47**、
|
|
35
|
+
门禁专项 Chromium **54/54**、`preflight` 全量 **42 项 = 41 PASS / 1 SKIP**
|
|
36
|
+
(`smoke:observe` 需真机宿主)、`check-maintenance` 6/6。
|
|
37
|
+
- 边界:跨主机共享盘(NFS/SMB)上的锁语义未验;真实长期文件句柄占用下的 `rename` `EPERM` 只用替身验证;
|
|
38
|
+
不经过本锁的外部写者并发只靠 `assertOwner()` 兜底;`sync-profile --repair` 只保证 profile **磁盘副本**
|
|
39
|
+
与仓库一致,宿主运行时是否生效要重载后另验(本轮不重启 DSH)。
|
|
40
|
+
|
|
5
41
|
## [0.10.9] - 2026-11-08 —— 门禁 v3(配置边界收尾 + 发布口径)
|
|
6
42
|
|
|
7
43
|
- 门禁子包 `@mycf711/dsh-gate` `0.1.1` → `0.1.2`:`writeGateConfig` 整层重写对 `extends` **fail closed** ——
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
|
-
<a href="https://github.com/MYCF711/dsh-session-superagent/releases"><img src="https://img.shields.io/badge/version-0.10.
|
|
13
|
+
<a href="https://github.com/MYCF711/dsh-session-superagent/releases"><img src="https://img.shields.io/badge/version-0.10.10-green.svg" alt="version"></a>
|
|
14
14
|
<a href="https://www.npmjs.com/package/dsh-session-superagent"><img src="https://img.shields.io/npm/v/dsh-session-superagent?color=4D6BFE" alt="npm"></a>
|
|
15
15
|
<img src="https://img.shields.io/badge/license-MIT-4D6BFE" alt="license">
|
|
16
16
|
</p>
|
|
@@ -144,7 +144,7 @@ Gitee 没有 ETag,每轮会真读一次列表;私有仓库需要在面板里
|
|
|
144
144
|
|
|
145
145
|
## 验证
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
934 项单测、42 项 preflight、11 项 UI、47 项 Chromium 全绿(0.10.10)。
|
|
148
148
|
|
|
149
149
|
## 数据来源
|
|
150
150
|
|
package/client.js
CHANGED
|
@@ -422,7 +422,7 @@ window.__ModuleLoader__.load({
|
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
// 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
|
|
425
|
-
const CLIENT_VERSION = '0.10.
|
|
425
|
+
const CLIENT_VERSION = '0.10.10'
|
|
426
426
|
// SEMVER_COMPARATOR_SOURCE_START
|
|
427
427
|
// This block is duplicated verbatim in client.js because the browser UMD cannot import ESM.
|
|
428
428
|
// test/update-semver.test.mjs audits both copies and exercises their behavior.
|
|
@@ -2288,6 +2288,16 @@ window.__ModuleLoader__.load({
|
|
|
2288
2288
|
}
|
|
2289
2289
|
}
|
|
2290
2290
|
|
|
2291
|
+
/** GET /gates 回显的仓库(服务端没回显时返回 '')。 */
|
|
2292
|
+
const gateDataRepo = (data) => (data && typeof data.repo === 'string' && data.repo) || ''
|
|
2293
|
+
|
|
2294
|
+
/**
|
|
2295
|
+
* 草稿显式记着它来自哪个仓库(U2)。
|
|
2296
|
+
* data.repo 之后可能被新仓库的响应改写;保存/预览/优化和确认条都只认草稿自己的来源,
|
|
2297
|
+
* 否则「切仓库在途时改的草稿」会被写进新仓库(项目层 / 全局 user 层都复现过)。
|
|
2298
|
+
*/
|
|
2299
|
+
const gateDraftRepo = (draft) => (draft && typeof draft.repo === 'string' && draft.repo) || ''
|
|
2300
|
+
|
|
2291
2301
|
/**
|
|
2292
2302
|
* 落盘形状:完整规则 + 布尔 `enabled`。
|
|
2293
2303
|
* 复启也必须写完整规则 —— 只写 `{ id, enabled:true }` 缺 type,validateConfig 会判非法。
|
|
@@ -2367,6 +2377,13 @@ window.__ModuleLoader__.load({
|
|
|
2367
2377
|
return config
|
|
2368
2378
|
}
|
|
2369
2379
|
|
|
2380
|
+
/** 草稿相对「它自己那个仓库的数据」是不是真有未保存改动(只比落盘形状,来源字段不参与)。 */
|
|
2381
|
+
const gateDraftDirty = (candidate, source, layerScope) => {
|
|
2382
|
+
const derived = gateDraftOf(source, layerScope)
|
|
2383
|
+
return JSON.stringify(gateConfigOf(layerScope, candidate, source))
|
|
2384
|
+
!== JSON.stringify(gateConfigOf(layerScope, derived, source))
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2370
2387
|
/** 模型下拉:当前值一定在列表里,取不到列表时也要有个能显示的项。 */
|
|
2371
2388
|
const gateModelOptions = (value, models) => {
|
|
2372
2389
|
const list = (models && Array.isArray(models.list) ? models.list : [])
|
|
@@ -2405,29 +2422,95 @@ window.__ModuleLoader__.load({
|
|
|
2405
2422
|
// 形状:{ type: 'scope', next }(作用域确认,可带 repoHeld)或 { repoHeld: true }(换仓库已选择保留草稿)。
|
|
2406
2423
|
// 只能在末尾追加(位置化队列),同步 test/client.test.mjs 的 gateQueue。
|
|
2407
2424
|
const [pendingSwitch, setPendingSwitch] = useState(null)
|
|
2408
|
-
const
|
|
2425
|
+
const repoQuery = (value) => (value ? '?repo=' + encodeURIComponent(String(value)) : '')
|
|
2426
|
+
const scopeQuery = repoQuery(repo)
|
|
2427
|
+
// U1:load 的代际与取消。切仓库 / 保存后重读 / 点「重新读取」都可能并发:
|
|
2428
|
+
// 没有序号时后到的旧响应会覆盖新仓库的数据;没有取消时卸载后还会继续 setState。
|
|
2429
|
+
const loadSeqRef = useRef(0)
|
|
2430
|
+
const aliveRef = useRef(true)
|
|
2431
|
+
// 响应回来时用它判断「仓库还是发起这次请求的那个」:/state 后到时仓库已经换了,
|
|
2432
|
+
// 旧仓库的响应不能再提交(否则面板显示旧配置,保存却按新仓库写)。
|
|
2433
|
+
const repoRef = useRef(repo)
|
|
2434
|
+
repoRef.current = repo
|
|
2435
|
+
// 草稿脏不脏要按「提交那一刻的作用域」算 —— 请求在途时用户可能已经切过作用域。
|
|
2436
|
+
const scopeRef = useRef(scope)
|
|
2437
|
+
scopeRef.current = scope
|
|
2438
|
+
// load 的闭包停在请求发起那一刻;提交时要拿「现在」的草稿和数据判断能不能落地。
|
|
2439
|
+
const draftRef = useRef(draft)
|
|
2440
|
+
draftRef.current = draft
|
|
2441
|
+
const dataRef = useRef(data)
|
|
2442
|
+
dataRef.current = data
|
|
2443
|
+
const modelsSeqRef = useRef(0)
|
|
2444
|
+
useEffect(() => {
|
|
2445
|
+
// StrictMode(开发态)会 mount → cleanup → 再 mount:effect 体里必须复位 alive,
|
|
2446
|
+
// 否则第一次 cleanup 把它置 false 之后就永远拦掉响应(门禁页停在「正在读取…」,Q2 F3)。
|
|
2447
|
+
aliveRef.current = true
|
|
2448
|
+
return () => { aliveRef.current = false }
|
|
2449
|
+
}, [])
|
|
2409
2450
|
|
|
2410
2451
|
async function load() {
|
|
2452
|
+
const seq = ++loadSeqRef.current
|
|
2453
|
+
const requestedRepo = repo
|
|
2411
2454
|
setLoadError('')
|
|
2412
2455
|
try {
|
|
2413
2456
|
const value = await call('/gates' + scopeQuery)
|
|
2457
|
+
// 卸载了,或者已经有更新的一次 load:这份响应作废(不许再 setState)。
|
|
2458
|
+
if (!aliveRef.current || seq !== loadSeqRef.current) return
|
|
2459
|
+
// 仓库已经换过:旧仓库的响应不能提交(新仓库的读取由 effect 或确认流程负责)。
|
|
2460
|
+
if (repoRef.current !== requestedRepo) return
|
|
2414
2461
|
if (!value || value.ok === false) throw new Error((value && value.error) || '服务端没有返回门禁配置')
|
|
2462
|
+
// 草稿来自旧仓库、这次响应的却是新仓库:先不动 data(Q2 F1)。
|
|
2463
|
+
// 提交会让 repoMismatch 变 false、确认条消失,保存/预览/优化随后就会把旧仓库的
|
|
2464
|
+
// 规则状态和提示词写进新仓库(项目层和全局 user 层都复现过)。
|
|
2465
|
+
// 只有草稿其实「和它自己那份配置一致」(改回原样)才放行新数据 —— 它没有要保留的内容。
|
|
2466
|
+
const replyRepo = gateDataRepo(value) || requestedRepo
|
|
2467
|
+
const pendingDraft = draftRef.current
|
|
2468
|
+
const pendingSource = gateDraftRepo(pendingDraft)
|
|
2469
|
+
if (pendingSource && pendingSource !== replyRepo) {
|
|
2470
|
+
const sourceData = gateDataRepo(dataRef.current) === pendingSource ? dataRef.current : null
|
|
2471
|
+
const stillDirty = sourceData ? gateDraftDirty(pendingDraft, sourceData, scopeRef.current) : true
|
|
2472
|
+
if (stillDirty) return
|
|
2473
|
+
setGateDraft(null)
|
|
2474
|
+
}
|
|
2415
2475
|
setData(value)
|
|
2416
|
-
|
|
2476
|
+
// 请求在途时用户可能已经改出草稿:只放下「和新数据一致」的草稿,
|
|
2477
|
+
// dirty 的一律留着 —— 旧实现无条件 setGateDraft(null),切仓库在途的草稿会被静默清掉。
|
|
2478
|
+
setGateDraft((prev) => {
|
|
2479
|
+
if (!prev) return null
|
|
2480
|
+
try {
|
|
2481
|
+
return gateDraftDirty(prev, value, scopeRef.current) ? prev : null
|
|
2482
|
+
} catch {
|
|
2483
|
+
// 算不清就保留:宁可多留一份草稿,也不能替用户丢掉改动。
|
|
2484
|
+
return prev
|
|
2485
|
+
}
|
|
2486
|
+
})
|
|
2417
2487
|
} catch (error) {
|
|
2488
|
+
if (!aliveRef.current || seq !== loadSeqRef.current) return
|
|
2489
|
+
if (repoRef.current !== requestedRepo) return
|
|
2418
2490
|
setLoadError(String((error && error.message) || error))
|
|
2419
2491
|
}
|
|
2420
2492
|
}
|
|
2421
2493
|
|
|
2422
|
-
async function loadModels() {
|
|
2494
|
+
async function loadModels(forRepo = repo) {
|
|
2495
|
+
// 模型列表同样是「按仓库读」的请求:乱序/卸载时旧响应不能盖新列表。
|
|
2496
|
+
const seq = ++modelsSeqRef.current
|
|
2497
|
+
const requestedRepo = forRepo
|
|
2423
2498
|
setModels((prev) => ({ ...prev, loading: true, error: '' }))
|
|
2424
2499
|
try {
|
|
2425
|
-
const value = await call('/gates/models' +
|
|
2500
|
+
const value = await call('/gates/models' + repoQuery(forRepo))
|
|
2501
|
+
if (!aliveRef.current || seq !== modelsSeqRef.current) return
|
|
2502
|
+
// 只认「面板当前那份配置的仓库」:当前 repo prop,或者面板数据回显的仓库。
|
|
2503
|
+
// 取消换仓库后面板数据还在旧仓库,旧仓库的模型列表要能重新读回来(Q2 F2)。
|
|
2504
|
+
const currentData = dataRef.current
|
|
2505
|
+
if (requestedRepo !== repoRef.current && requestedRepo !== gateDataRepo(currentData)) return
|
|
2426
2506
|
const list = value && Array.isArray(value.models)
|
|
2427
2507
|
? value.models.map((item) => ({ id: String((item && item.id) || ''), label: String((item && (item.label || item.id)) || '') })).filter((item) => item.id)
|
|
2428
2508
|
: []
|
|
2429
2509
|
setModels({ list, loading: false, error: value && value.ok === false ? String(value.error || '') : '' })
|
|
2430
2510
|
} catch (error) {
|
|
2511
|
+
if (!aliveRef.current || seq !== modelsSeqRef.current) return
|
|
2512
|
+
const currentData = dataRef.current
|
|
2513
|
+
if (requestedRepo !== repoRef.current && requestedRepo !== gateDataRepo(currentData)) return
|
|
2431
2514
|
setModels({ list: [], loading: false, error: String((error && error.message) || error) })
|
|
2432
2515
|
}
|
|
2433
2516
|
}
|
|
@@ -2437,7 +2520,7 @@ window.__ModuleLoader__.load({
|
|
|
2437
2520
|
const readOnly = scope === 'default'
|
|
2438
2521
|
// 项目层只允许「关闭语义复审」,模型与提示词在项目层不可编辑。
|
|
2439
2522
|
const semanticLocked = readOnly || scope === 'project'
|
|
2440
|
-
const dirty = !readOnly &&
|
|
2523
|
+
const dirty = !readOnly && gateDraftDirty(current, data, scope)
|
|
2441
2524
|
const scopePath = data && data.scopes && data.scopes[scope] ? data.scopes[scope].path : ''
|
|
2442
2525
|
// 本层的 `extends` 分两种(v3 冻结行为):
|
|
2443
2526
|
// - 共享规则(字符串 / 对象 / true):面板整层重写会把共享规则冲掉 → 明确拒绝保存,让人去改文件;
|
|
@@ -2448,24 +2531,34 @@ window.__ModuleLoader__.load({
|
|
|
2448
2531
|
const layerExtends = rawExtends !== undefined && !extendsDetached
|
|
2449
2532
|
// 面板里这份配置属于哪个仓库(GET /gates 会回显 repo):写盘与预览都认它,
|
|
2450
2533
|
// 否则「/state 换了 workdir 但用户还没确认」时会把旧配置写到新仓库去。
|
|
2451
|
-
const dataRepo = (data
|
|
2452
|
-
|
|
2453
|
-
|
|
2534
|
+
const dataRepo = gateDataRepo(data)
|
|
2535
|
+
// dirty 草稿认**自己的来源仓库**:data.repo 可能已经(或即将)换成新仓库,
|
|
2536
|
+
// 保存/预览/优化和确认条都必须跟草稿走 —— 跟 data.repo 走就会把旧仓库的草稿写进新仓库(Q2 F1)。
|
|
2537
|
+
const draftRepo = gateDraftRepo(draft)
|
|
2538
|
+
const panelRepo = dirty && draftRepo ? draftRepo : dataRepo
|
|
2539
|
+
const targetRepo = panelRepo || repo
|
|
2540
|
+
const repoMismatch = Boolean(panelRepo && repo && panelRepo !== repo)
|
|
2541
|
+
// 创建/修改草稿时记下来源仓库;之后 data 怎么变,这份草稿都只写回它自己的仓库。
|
|
2542
|
+
const draftSourceRepo = () => draftRepo || dataRepo || repo
|
|
2543
|
+
const setDraftConfig = (next) => setGateDraft({ ...next, repo: draftSourceRepo() })
|
|
2454
2544
|
// 切仓库遇到草稿:确认(取消 → 保留草稿并显示提示;确认 → 放弃后才去读新仓库)。
|
|
2455
2545
|
const repoHeld = Boolean(pendingSwitch && pendingSwitch.repoHeld === true && repoMismatch && dirty)
|
|
2456
2546
|
const repoConfirm = repoMismatch && dirty && !repoHeld
|
|
2457
2547
|
const scopeConfirm = Boolean(pendingSwitch && pendingSwitch.type === 'scope' && pendingSwitch.next)
|
|
2458
2548
|
|
|
2459
2549
|
// 依赖 repo:面板先挂载、/state 后到的顺序下,仓库路径变了要重读一次(否则项目层会写到服务端 cwd)。
|
|
2460
|
-
//
|
|
2461
|
-
//
|
|
2550
|
+
// 有草稿时**不发新请求**:换仓库这件事交给页面上的确认条(确认 / 保存 / 放弃 都会各自 load);
|
|
2551
|
+
// 已经在途的响应由 load() 里的「草稿来源仓库」闸门挡住,不会把面板数据翻到新仓库去。
|
|
2462
2552
|
useEffect(() => {
|
|
2463
2553
|
if (dirty) return
|
|
2464
2554
|
load()
|
|
2465
2555
|
}, [repo])
|
|
2466
2556
|
// 草稿变干净之后(保存 / 放弃 / 手工改回)如果仓库已经换过,补一次重读,别一直停在旧仓库上。
|
|
2557
|
+
// 模型列表跟着面板仓库走:取消换仓库后可能在途响应被作废,这里要把它补回来。
|
|
2467
2558
|
useEffect(() => {
|
|
2468
|
-
if (
|
|
2559
|
+
if (dirty || !repoMismatch) return
|
|
2560
|
+
load()
|
|
2561
|
+
loadModels()
|
|
2469
2562
|
}, [dirty])
|
|
2470
2563
|
useEffect(() => { loadModels() }, [repo])
|
|
2471
2564
|
|
|
@@ -2533,7 +2626,7 @@ window.__ModuleLoader__.load({
|
|
|
2533
2626
|
if (!value || value.ok === false) throw new Error((value && value.error) || '服务端没有返回提示词')
|
|
2534
2627
|
const text = String(value.text || '').trim()
|
|
2535
2628
|
if (!text) throw new Error('模型返回空内容')
|
|
2536
|
-
|
|
2629
|
+
setDraftConfig({ ...current, semantic: { ...current.semantic, prompt: text } })
|
|
2537
2630
|
setStatus({ tone: 'ok', text: '提示词已更新,确认后点保存' })
|
|
2538
2631
|
} catch (error) {
|
|
2539
2632
|
setStatus({ tone: 'error', text: '优化提示词失败:' + String((error && error.message) || error) })
|
|
@@ -2542,8 +2635,9 @@ window.__ModuleLoader__.load({
|
|
|
2542
2635
|
}
|
|
2543
2636
|
}
|
|
2544
2637
|
|
|
2545
|
-
|
|
2546
|
-
const
|
|
2638
|
+
// 改草稿一律走 setDraftConfig:顺手记下来源仓库,后面 data.repo 怎么变都不影响保存目标。
|
|
2639
|
+
const setSemantic = (next) => setDraftConfig({ ...current, semantic: { ...current.semantic, ...next } })
|
|
2640
|
+
const toggleRule = (id, next) => setDraftConfig({
|
|
2547
2641
|
...current,
|
|
2548
2642
|
rules: current.rules.map((rule) => (rule.id === id ? { ...rule, enabled: next } : rule)),
|
|
2549
2643
|
})
|
|
@@ -2571,6 +2665,18 @@ window.__ModuleLoader__.load({
|
|
|
2571
2665
|
setPendingSwitch(null)
|
|
2572
2666
|
if (next) applyScope(next)
|
|
2573
2667
|
}
|
|
2668
|
+
// 取消换仓库:把已经发出去的新仓库读取一并作废。否则它晚到时代码会把数据切到新仓库,
|
|
2669
|
+
// 和「已保留草稿:面板仍是旧仓库」的承诺相反(草稿还在,数据却换了仓库)。
|
|
2670
|
+
const cancelRepoSwitch = () => {
|
|
2671
|
+
loadSeqRef.current += 1
|
|
2672
|
+
// 模型列表也属于面板这份配置(baseURL 来自它):新仓库的 /gates/models 不能落地,
|
|
2673
|
+
// 再把面板仓库(草稿来源)的模型列表重新读一次,别让下拉里留着新仓库的模型(Q2 F2)。
|
|
2674
|
+
modelsSeqRef.current += 1
|
|
2675
|
+
setModels((prev) => (prev.loading ? { ...prev, loading: false } : prev))
|
|
2676
|
+
const panelRepoNow = gateDraftRepo(draftRef.current) || gateDataRepo(dataRef.current)
|
|
2677
|
+
if (panelRepoNow) loadModels(panelRepoNow)
|
|
2678
|
+
setPendingSwitch({ repoHeld: true })
|
|
2679
|
+
}
|
|
2574
2680
|
// 切仓库由父面板的 workdir 驱动,没法拦在「点击」上:草稿还在时不去读新仓库,
|
|
2575
2681
|
// 只有这里(明确放弃)才 reset + load,且 load 用的是新的 repo prop。
|
|
2576
2682
|
const confirmRepoSwitch = () => {
|
|
@@ -2611,14 +2717,14 @@ window.__ModuleLoader__.load({
|
|
|
2611
2717
|
: null,
|
|
2612
2718
|
repoConfirm
|
|
2613
2719
|
? h('div', { className: 'dt-banner', role: 'group', 'aria-label': '切换仓库确认' },
|
|
2614
|
-
h('p', null, '仓库已切换到 ' + repo + ':当前面板还是 ' +
|
|
2720
|
+
h('p', null, '仓库已切换到 ' + repo + ':当前面板还是 ' + panelRepo + ' 的配置,这份草稿还没保存。'),
|
|
2615
2721
|
h('div', { className: 'dt-actions dt-banner-actions' },
|
|
2616
|
-
h(Btn, { size: 'sm', variant: 'ghost', onClick:
|
|
2722
|
+
h(Btn, { size: 'sm', variant: 'ghost', onClick: cancelRepoSwitch }, '取消'),
|
|
2617
2723
|
h(Btn, { size: 'sm', variant: 'primary', onClick: confirmRepoSwitch }, '放弃草稿并切换')))
|
|
2618
2724
|
: null,
|
|
2619
2725
|
repoHeld
|
|
2620
2726
|
? h('div', { className: 'dt-banner' },
|
|
2621
|
-
h('p', null, '已保留草稿:面板仍是 ' +
|
|
2727
|
+
h('p', null, '已保留草稿:面板仍是 ' + panelRepo + ',保存或放弃这份草稿后才会切到 ' + repo + '。'),
|
|
2622
2728
|
h('div', { className: 'dt-actions dt-banner-actions' },
|
|
2623
2729
|
h(Btn, { size: 'sm', variant: 'primary', onClick: confirmRepoSwitch }, '放弃草稿并切换')))
|
|
2624
2730
|
: null,
|
package/lib/index.js
CHANGED
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
|
|
56
56
|
export const name = 'dsh-session-superagent'
|
|
57
57
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
58
|
-
export const SERVER_VERSION = '0.10.
|
|
58
|
+
export const SERVER_VERSION = '0.10.10'
|
|
59
59
|
export const inject = ['tools', 'agents', 'webServer']
|
|
60
60
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
61
61
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.10",
|
|
4
4
|
"workspaces": ["packages/*"],
|
|
5
5
|
"description": "Session-level superagent for DeepSeek Harness: watch a GitHub repository and wake a session when something needs doing. Credentials never reach the model.",
|
|
6
6
|
"type": "module",
|
|
@@ -108,6 +108,6 @@
|
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
110
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
111
|
-
"@mycf711/dsh-gate": "0.1.
|
|
111
|
+
"@mycf711/dsh-gate": "0.1.3"
|
|
112
112
|
}
|
|
113
113
|
}
|