dsh-config-sync-plugin 0.3.80 → 0.3.82
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/README.en.md +17 -2
- package/README.md +17 -2
- package/client.js +34 -11
- package/index.js +27 -3
- package/package.json +2 -2
- package/runtime/apply.ps1 +1 -0
- package/runtime/tools/workspace-view.mjs +171 -15
- package/tools/selftest.mjs +50 -1
package/README.en.md
CHANGED
|
@@ -19,7 +19,7 @@ The package name is **`dsh-config-sync-plugin`** (the `dsh-config-sync` name on
|
|
|
19
19
|
|
|
20
20
|
| Way | Command / entry | Notes |
|
|
21
21
|
|---|---|---|
|
|
22
|
-
| npm | `npm i dsh-config-sync-plugin` | Use it as a dependency, or add `"dsh-config-sync-plugin": "^0.3.
|
|
22
|
+
| npm | `npm i dsh-config-sync-plugin` | Use it as a dependency, or add `"dsh-config-sync-plugin": "^0.3.82"` to the profile's `package.json` and run `pnpm i`. The name matches the `cordis.patch.yml` insert name and the install folder `dsh-config-sync-plugin-<ver>` |
|
|
23
23
|
| Marketplace | client → Plugins → Discover → “Config Sync” | Installs from the git commit registered in `market-index.json` |
|
|
24
24
|
| Offline tgz | `releases\dsh-config-sync-plugin-<ver>.tgz` | GitHub Release asset for air-gapped machines; the panel's Update button downloads the same file |
|
|
25
25
|
|
|
@@ -232,7 +232,7 @@ A new **Workspace visibility** section brings both native DSH hiding mechanisms
|
|
|
232
232
|
| Hide sessions | Workspace stays in the list, its sessions go to Archived | Sessions written to `global.archivedSessionIds` in `<DshHome>\storages\workspace.json` |
|
|
233
233
|
| Archive workspace | Workspace disappears from the list, sessions kept | `<DshHome>\dsh-session-manager\workspace-archives.v1.json` gets `archived:true` and its sessions hidden too |
|
|
234
234
|
|
|
235
|
-
Each workspace switches between the three states independently; expanding it lets you hide/show a single session without touching others (a session toggle changes only that one `archivedSessionIds` entry, never the workspace archive record). Changes
|
|
235
|
+
Each workspace switches between the three states independently; expanding it lets you hide/show a single session without touching others (a session toggle changes only that one `archivedSessionIds` entry, never the workspace archive record). Changes do not call the session-manager Web API (it needs a DSH connection-owner credential the plugin route does not have) — they go through the host `workspaceRegistry`, which persists and pushes the session-list update, so toggles apply immediately (see 0.3.82). Since 0.3.75 the archive file is synced, so these states travel with push/pull too.
|
|
236
236
|
|
|
237
237
|
### Panel: session names, Edit button, click-to-expand and quick jump (0.3.77)
|
|
238
238
|
|
|
@@ -253,6 +253,20 @@ Two display fixes on top of 0.3.77:
|
|
|
253
253
|
1. **Jump order matches section order**: the quick-jump tabs now follow the exact render order of the sections (Overview / Sync conflicts [when present] / Local paths [when expanded] / Targets / Automation & updates / Scripts / Restore / Content / Plugin data / Workspace visibility / Feedback). The two conditional sections (conflicts, local paths) appear in the tabs only when their cards are shown.
|
|
254
254
|
2. **Scroll lands below the title**: the sticky title bar now uses an opaque background (same fill as panel cards), so content no longer shows through it; jumping to a tab sets the scroll offset from the title bar's actual height, so the target section lands fully below the title instead of being covered.
|
|
255
255
|
|
|
256
|
+
### Workspace visibility card: agent sessions collapsed by default + instant hide/show (0.3.82)
|
|
257
|
+
|
|
258
|
+
Two changes to the "Workspace visibility" card:
|
|
259
|
+
|
|
260
|
+
1. **Agent (subagent) sessions are collapsed by default**: the card lists only your own sessions. A "Show agents" checkbox in the header row reveals agent child sessions and reports how many were folded away. 80 of the 99 registered sessions on this machine were agent sessions (mnemon reviews and delegated tasks each leave one behind), flooding the list so you could not find your own.
|
|
261
|
+
2. **Hide/show takes effect immediately**: toggling the workspace tri-state or a single session used to only rewrite the on-disk state file, leaving the host's in-memory `archivedSessionIds` stale — a client restart or session-list refresh was required. It now goes through the host `workspaceRegistry` (`archiveSession` / `unarchiveSession`), which persists and pushes the session-list update, so toggles apply the moment you click. If the host service is unavailable it falls back to the previous file-based write and the card hint says which path was used.
|
|
262
|
+
|
|
263
|
+
Reading the owning workspace and the session title stays self-contained; the session-manager Web API is not used.
|
|
264
|
+
|
|
265
|
+
### Workspace visibility card session names now match the DSH panel (0.3.81)
|
|
266
|
+
|
|
267
|
+
Fixes session names in the "Workspace visibility" card differing from the DSH session panel.
|
|
268
|
+
|
|
269
|
+
DSH session titles evolve: a fallback title (truncated first message) is created first, then a provider title is generated by the model. The card previously stopped at the first fallback; it now picks the latest title by priority — provider > fallback > untagged title > first user message — matching the DSH panel exactly.
|
|
256
270
|
### Fix cross-machine sync downgrading the installed plugin and rolling back pulls (0.3.80)
|
|
257
271
|
|
|
258
272
|
Fixes an issue where pulling on another machine replaced a newer locally installed plugin with an older archive from the config repo, turning the link into 0.0.0, failing bundle resolution, and rolling the pull back.
|
|
@@ -638,6 +652,7 @@ The log shows which path ran: `文件比较(快筛):比对 N 个,深哈
|
|
|
638
652
|
|
|
639
653
|
| Date | Version | Summary |
|
|
640
654
|
|---|---|---|
|
|
655
|
+
| 2026-11-23 | 0.3.82 | Workspace visibility card collapses agent sessions by default; hide/show goes through workspaceRegistry and applies instantly (no restart) |
|
|
641
656
|
| 2026-11-21 | 0.3.75 | Sync hidden/archived workspaces across machines (workspace-archives.v1.json into settings); hidden workspaces and sessions stay hidden on B after pull |
|
|
642
657
|
| 2026-11-19 | 0.3.69 | Carry billion-context compaction state across machines (bili-state.mjs); two new notice kinds (plugin-missing / context-state) |
|
|
643
658
|
| 2026-11-19 | 0.3.68 | Session projection-cache guard (fixes agent-busy session creation) |
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ DSH 插件:左侧栏多一行「配置同步」,点开是整页体检面板
|
|
|
15
15
|
|
|
16
16
|
| 方式 | 命令 / 入口 | 说明 |
|
|
17
17
|
|---|---|---|
|
|
18
|
-
| npm | `npm i dsh-config-sync-plugin` | 适合把它当依赖管理,或在 profile 的 `package.json` 里写 `"dsh-config-sync-plugin": "^0.3.
|
|
18
|
+
| npm | `npm i dsh-config-sync-plugin` | 适合把它当依赖管理,或在 profile 的 `package.json` 里写 `"dsh-config-sync-plugin": "^0.3.82"` 后 `pnpm i`;包名与 `cordis.patch.yml` 里注册的名字、插件目录 `dsh-config-sync-plugin-<ver>` 一致 |
|
|
19
19
|
| 插件市场 | 客户端「插件市场 → 发现」搜「配置同步」 | 走 `market-index.json` 登记的 git 提交,版本与 README 对齐 |
|
|
20
20
|
| 离线 tgz | `releases\dsh-config-sync-plugin-<ver>.tgz` | GitHub Release 附件,适合内网机器;面板「更新」按钮下载的也是它 |
|
|
21
21
|
|
|
@@ -252,7 +252,7 @@ pwsh -File runtime\sync.ps1 pull `
|
|
|
252
252
|
| 隐藏会话 | 工作区留在列表,名下会话进「已归档」 | 会话写进 `<DshHome>\storages\workspace.json` 的 `global.archivedSessionIds` |
|
|
253
253
|
| 归档工作区 | 整个工作区从列表消失,会话保留 | `<DshHome>\dsh-session-manager\workspace-archives.v1.json` 写 `archived:true` + 会话一并按隐藏处理 |
|
|
254
254
|
|
|
255
|
-
每个工作区可独立切三态;展开后还能对单个会话单独「隐藏 / 显示」,两者互不影响(会话操作只动那一条 `archivedSessionIds
|
|
255
|
+
每个工作区可独立切三态;展开后还能对单个会话单独「隐藏 / 显示」,两者互不影响(会话操作只动那一条 `archivedSessionIds`,不改工作区归档记录)。改动不调 session-manager 的 Web API(那套 API 需要 DSH connection owner 凭证,插件路由拿不到),而是经宿主 `workspaceRegistry` 落盘并推送会话列表更新,切换后立刻生效(详见 0.3.82)。0.3.75 已把归档文件纳入同步,所以这里改的隐藏 / 归档状态也会跟着 push/pull 到另一台机。
|
|
256
256
|
|
|
257
257
|
### 配置同步面板:会话名称、修改按钮、点行展开与快速跳转(0.3.77)
|
|
258
258
|
|
|
@@ -273,6 +273,20 @@ pwsh -File runtime\sync.ps1 pull `
|
|
|
273
273
|
1. **跳转顺序对齐卡片**:快捷标签顺序改为与分区实际渲染顺序完全一致(概览 / 同步冲突[有冲突时] / 本机路径[展开时] / 同步目标 / 自动化与插件更新 / 生成脚本 / 还原备份 / 同步内容 / 插件数据 / 工作区显示 / 问题反馈)。同步冲突、本机路径两个条件分区只在卡片存在时才出现在标签里。
|
|
274
274
|
2. **滚动落点在标题下方**:标题栏改为不透明背景(面板卡片同色),滚动时内容不再从标题背后透出;点标签跳转时按标题栏实际高度设置滚动落点,目标分区完整显示在标题下方,不再被遮住。
|
|
275
275
|
|
|
276
|
+
### 工作区显示卡片:默认折叠智能体会话 + 隐藏/显示即时生效(0.3.82)
|
|
277
|
+
|
|
278
|
+
「工作区显示」卡片两处改动:
|
|
279
|
+
|
|
280
|
+
1. **默认折叠智能体(subagent)子会话**:卡片只列你自己的会话,标题行新增「显示智能体」勾选项,需要时勾上才把智能体子会话一并列出,并显示被折叠的条数。本机 99 条登记会话里有 80 条是智能体子会话(mnemon 审查 / 派生任务都会留一条),一屏全是它们,自己的会话反而找不到。
|
|
281
|
+
2. **隐藏/显示即时生效**:之前切三态或单条会话只改磁盘上的状态文件,宿主内存里的 `archivedSessionIds` 不更新,必须重启客户端或刷新会话列表才看到变化。现在改走宿主的 `workspaceRegistry`(`archiveSession` / `unarchiveSession`),落盘的同时触发会话列表推送,面板上切完立刻生效。宿主服务取不到时自动退回原来的文件写法,并在卡片提示里说明走的是哪条路。
|
|
282
|
+
|
|
283
|
+
会话所属工作区与会话标题的读取仍然自包含,不依赖 session-manager 的 Web API。
|
|
284
|
+
|
|
285
|
+
### 工作区显示卡片的会话名称与 DSH 面板保持一致(0.3.81)
|
|
286
|
+
|
|
287
|
+
修复「工作区显示」卡片里会话名称与 DSH 会话面板显示不一致的问题。
|
|
288
|
+
|
|
289
|
+
DSH 的会话标题会演进:先产生 fallback 临时标题(首条消息截断),随后由大模型生成 provider 正式标题。之前卡片只读到第一条 fallback 就停止;现在改为按 provider 正式标题 > fallback > 无来源 title > 首条用户消息 的优先级取最新标题,与 DSH 面板完全一致。
|
|
276
290
|
### 修复跨机同步把新插件降级覆盖、拉取后被回滚(0.3.80)
|
|
277
291
|
|
|
278
292
|
修复跨机拉取时本地已安装的新版插件被配置仓库里的旧归档反向覆盖,进而导致 link 变成 0.0.0、插件 bundle 自检失败、拉取自动回滚的问题。
|
|
@@ -620,6 +634,7 @@ pwsh -File sync.ps1 push -ScanHistory
|
|
|
620
634
|
|
|
621
635
|
| 日期 | 版本 | 要点 |
|
|
622
636
|
|---|---|---|
|
|
637
|
+
| 2026-11-23 | 0.3.82 | 工作区显示卡片默认折叠智能体会话;隐藏/显示改走 workspaceRegistry,切完即时生效(不再需要重启) |
|
|
623
638
|
| 2026-11-21 | 0.3.75 | 隐藏/归档的工作区跨机同步(workspace-archives.v1.json 纳入 settings),B 机拉取后不再显示已隐藏的工作区与会话 |
|
|
624
639
|
| 2026-11-19 | 0.3.69 | 跨机搬运 billion-context 压缩状态(bili-state.mjs);同步清单新增 plugin-missing / context-state 两类提示 |
|
|
625
640
|
| 2026-11-19 | 0.3.68 | 会话投影缓存守卫,治 agent-busy 建会话失败 |
|
package/client.js
CHANGED
|
@@ -503,8 +503,9 @@ window.__ModuleLoader__.load({
|
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
/** 工作区显示状态:三态(显示 / 隐藏会话 / 归档工作区)+ 会话级独立隐藏。 */
|
|
506
|
-
async function callWorkspaceView(payload) {
|
|
507
|
-
const
|
|
506
|
+
async function callWorkspaceView(payload, opts) {
|
|
507
|
+
const query = opts && opts.includeAgents ? '?agents=1' : ''
|
|
508
|
+
const res = await fetch('/config-sync/workspace-view' + query, payload
|
|
508
509
|
? {
|
|
509
510
|
method: 'POST',
|
|
510
511
|
cache: 'no-store',
|
|
@@ -1604,33 +1605,40 @@ window.__ModuleLoader__.load({
|
|
|
1604
1605
|
const [msg, setMsg] = react.useState('')
|
|
1605
1606
|
const [expanded, setExpanded] = react.useState({})
|
|
1606
1607
|
const [editing, setEditing] = react.useState({})
|
|
1608
|
+
// 默认折叠智能体(subagent)会话:一屏全是子会话时根本找不到自己的会话。
|
|
1609
|
+
const [showAgents, setShowAgents] = react.useState(false)
|
|
1607
1610
|
|
|
1608
1611
|
const load = react.useCallback(async () => {
|
|
1609
1612
|
setBusy(true); setErr('')
|
|
1610
|
-
try { setData(await callWorkspaceView()) }
|
|
1613
|
+
try { setData(await callWorkspaceView(null, { includeAgents: showAgents })) }
|
|
1611
1614
|
catch (e) { setErr(String((e && e.message) || e)) }
|
|
1612
1615
|
finally { setBusy(false) }
|
|
1613
|
-
}, [])
|
|
1616
|
+
}, [showAgents])
|
|
1614
1617
|
react.useEffect(() => { load() }, [load])
|
|
1615
1618
|
|
|
1616
1619
|
const changeWorkspace = react.useCallback(async (wsId, state) => {
|
|
1617
1620
|
setBusy(true); setErr(''); setMsg('')
|
|
1618
1621
|
try {
|
|
1619
|
-
const d = await callWorkspaceView({ action: 'workspace', workspaceId: wsId, state })
|
|
1622
|
+
const d = await callWorkspaceView({ action: 'workspace', workspaceId: wsId, state, includeAgents: showAgents }, { includeAgents: showAgents })
|
|
1620
1623
|
setData(d)
|
|
1621
|
-
setMsg(
|
|
1624
|
+
setMsg(d.live === true
|
|
1625
|
+
? M('已更新,会话列表已同步', 'Updated — the session list is in sync')
|
|
1626
|
+
: M('已更新;宿主服务暂不可用,已直接写入状态文件', 'Updated; host service unavailable, wrote the state file directly'))
|
|
1622
1627
|
} catch (e) { setErr(String((e && e.message) || e)) }
|
|
1623
1628
|
finally { setBusy(false) }
|
|
1624
|
-
}, [])
|
|
1629
|
+
}, [showAgents])
|
|
1625
1630
|
|
|
1626
1631
|
const changeSession = react.useCallback(async (sid, hidden) => {
|
|
1627
1632
|
setBusy(true); setErr(''); setMsg('')
|
|
1628
1633
|
try {
|
|
1629
|
-
const d = await callWorkspaceView({ action: 'session', sessionId: sid, hidden })
|
|
1634
|
+
const d = await callWorkspaceView({ action: 'session', sessionId: sid, hidden, includeAgents: showAgents }, { includeAgents: showAgents })
|
|
1630
1635
|
setData(d)
|
|
1636
|
+
setMsg(d.live === true
|
|
1637
|
+
? M('已更新,会话列表已同步', 'Updated — the session list is in sync')
|
|
1638
|
+
: M('已更新;宿主服务暂不可用,已直接写入状态文件', 'Updated; host service unavailable, wrote the state file directly'))
|
|
1631
1639
|
} catch (e) { setErr(String((e && e.message) || e)) }
|
|
1632
1640
|
finally { setBusy(false) }
|
|
1633
|
-
}, [])
|
|
1641
|
+
}, [showAgents])
|
|
1634
1642
|
|
|
1635
1643
|
const stateLabel = (st) => st === 'archive' ? M('归档', 'Archived')
|
|
1636
1644
|
: st === 'hide-sessions' ? M('隐藏会话', 'Sessions hidden')
|
|
@@ -1652,16 +1660,31 @@ window.__ModuleLoader__.load({
|
|
|
1652
1660
|
|
|
1653
1661
|
const wss = data.workspaces || []
|
|
1654
1662
|
const archived = wss.filter(w => w.state === 'archive').length
|
|
1663
|
+
const agentHidden = Number(data.agentHidden || 0)
|
|
1655
1664
|
return h('div', { style: S.card },
|
|
1656
1665
|
h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'wrap' } },
|
|
1657
1666
|
h('div', { style: S.cardTitle }, M('工作区显示状态', 'Workspace visibility')),
|
|
1658
1667
|
h('div', { style: { ...S.hint, flex: 1, minWidth: '160px' } },
|
|
1659
|
-
M('
|
|
1668
|
+
M('点工作区展开会话;点「修改」后才可切换状态。改动即时生效,会话列表会跟着变。', 'Click a workspace to expand sessions; click Edit to change states. Changes apply immediately and the session list follows.')),
|
|
1669
|
+
h('label', {
|
|
1670
|
+
style: { display: 'inline-flex', alignItems: 'center', gap: '4px', fontSize: '12px', color: 'var(--dsw-alias-label-secondary)', cursor: 'pointer' },
|
|
1671
|
+
title: M('默认隐藏智能体(subagent)会话,勾选后一并列出', 'Agent (subagent) sessions are hidden by default; tick to list them too'),
|
|
1672
|
+
},
|
|
1673
|
+
h('input', {
|
|
1674
|
+
type: 'checkbox',
|
|
1675
|
+
checked: showAgents,
|
|
1676
|
+
disabled: busy,
|
|
1677
|
+
onChange: (e) => setShowAgents(e.target.checked === true),
|
|
1678
|
+
}),
|
|
1679
|
+
h('span', null, M('显示智能体', 'Show agents')),
|
|
1680
|
+
),
|
|
1660
1681
|
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
|
|
1661
1682
|
),
|
|
1662
1683
|
msg ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-success-primary, #1a7f37)' } }, msg) : null,
|
|
1663
1684
|
err ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-error-primary)' } }, err) : null,
|
|
1664
|
-
h('div', { style: S.footnote },
|
|
1685
|
+
h('div', { style: S.footnote },
|
|
1686
|
+
M('共 ' + wss.length + ' 个工作区,' + archived + ' 个已归档;归档的工作区会从列表消失,会话仍保留。', wss.length + ' workspaces, ' + archived + ' archived; archived ones disappear from the list, sessions are kept.')
|
|
1687
|
+
+ (agentHidden > 0 && !showAgents ? M('已隐藏 ' + agentHidden + ' 条智能体会话。', ' ' + agentHidden + ' agent sessions hidden.') : '')),
|
|
1665
1688
|
wss.length === 0
|
|
1666
1689
|
? h('div', { style: S.footnote }, M('没有工作区。', 'No workspaces.'))
|
|
1667
1690
|
: h('div', { style: { display: 'flex', flexDirection: 'column', gap: '6px', marginTop: '2px' } },
|
package/index.js
CHANGED
|
@@ -28,6 +28,8 @@ import { fileURLToPath } from 'node:url'
|
|
|
28
28
|
import { runGuard, clearSessionCaches, appendGuardLog } from './runtime/tools/session-cache-guard.mjs'
|
|
29
29
|
// 0.3.76:工作区显示状态(三态 + 会话独立隐藏),自包含读写 DSH 两个权威文件
|
|
30
30
|
import { readView, setWorkspaceState, setSessionState } from './runtime/tools/workspace-view.mjs'
|
|
31
|
+
// 0.3.82:实时通道。拿不到 workspaceRegistry 时,这两个函数内部自动退回上面的文件写法。
|
|
32
|
+
import { setWorkspaceStateLive, setSessionStateLive } from './runtime/tools/workspace-view.mjs'
|
|
31
33
|
|
|
32
34
|
const pluginRequire = createRequire(import.meta.url)
|
|
33
35
|
|
|
@@ -4036,6 +4038,22 @@ function ctxLoggerInfo(text) {
|
|
|
4036
4038
|
try { loggerRef?.info?.(text) } catch { /* 没有 logger 就算了 */ }
|
|
4037
4039
|
}
|
|
4038
4040
|
|
|
4041
|
+
/**
|
|
4042
|
+
* 0.3.82:拿宿主的 workspaceRegistry 服务(工作区账本的唯一权威)。
|
|
4043
|
+
* apply 执行时 registry 可能还没 start,热重载又会换实例,所以每次请求都惰性取一遍。
|
|
4044
|
+
*/
|
|
4045
|
+
let ctxRef = null
|
|
4046
|
+
function workspaceRegistryOf() {
|
|
4047
|
+
try {
|
|
4048
|
+
const ctx = ctxRef
|
|
4049
|
+
if (!ctx) return null
|
|
4050
|
+
const reg = typeof ctx.get === 'function' ? ctx.get('workspaceRegistry') : (ctx.workspaceRegistry || null)
|
|
4051
|
+
return reg && typeof reg.archiveSession === 'function' ? reg : null
|
|
4052
|
+
} catch {
|
|
4053
|
+
return null
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
|
|
4039
4057
|
const cacheGuardState = {
|
|
4040
4058
|
timer: null,
|
|
4041
4059
|
interval: null,
|
|
@@ -4214,10 +4232,14 @@ async function handleCacheGuard(req, res, config) {
|
|
|
4214
4232
|
}
|
|
4215
4233
|
|
|
4216
4234
|
// 0.3.76:工作区显示状态。自包含读写,不依赖 session-manager API(那个要 owner 凭证)。
|
|
4235
|
+
// 0.3.82:改成优先走 workspaceRegistry(宿主服务)→ 落盘同时触发 session-list feed,
|
|
4236
|
+
// 面板上切隐藏/显示即时生效;拿不到 registry 时函数内部退回纯文件写法(live:false)。
|
|
4217
4237
|
async function handleWorkspaceView(req, res, config) {
|
|
4218
4238
|
const dshHome = dshHomeOf(config)
|
|
4239
|
+
const registry = workspaceRegistryOf()
|
|
4240
|
+
const includeAgents = Boolean(req.url && /[?&]agents=1\b/.test(req.url))
|
|
4219
4241
|
if (req.method === 'GET') {
|
|
4220
|
-
try { sendJson(res, 200, { ok: true, ...readView(dshHome) }) }
|
|
4242
|
+
try { sendJson(res, 200, { ok: true, ...readView(dshHome, { includeAgents }) }) }
|
|
4221
4243
|
catch (error) { sendJson(res, 400, { ok: false, error: String((error && error.message) || error) }) }
|
|
4222
4244
|
return
|
|
4223
4245
|
}
|
|
@@ -4227,13 +4249,14 @@ async function handleWorkspaceView(req, res, config) {
|
|
|
4227
4249
|
const raw = await readBody(req)
|
|
4228
4250
|
const body = raw.trim() ? JSON.parse(raw) : {}
|
|
4229
4251
|
const action = String(body.action || '')
|
|
4252
|
+
const withAgents = body.includeAgents === true
|
|
4230
4253
|
if (action === 'workspace') {
|
|
4231
|
-
const view =
|
|
4254
|
+
const view = await setWorkspaceStateLive(dshHome, String(body.workspaceId || ''), String(body.state || ''), { registry, includeAgents: withAgents })
|
|
4232
4255
|
sendJson(res, 200, { ok: true, ...view })
|
|
4233
4256
|
return
|
|
4234
4257
|
}
|
|
4235
4258
|
if (action === 'session') {
|
|
4236
|
-
const view =
|
|
4259
|
+
const view = await setSessionStateLive(dshHome, String(body.sessionId || ''), body.hidden === true, { registry, includeAgents: withAgents })
|
|
4237
4260
|
sendJson(res, 200, { ok: true, ...view })
|
|
4238
4261
|
return
|
|
4239
4262
|
}
|
|
@@ -4410,6 +4433,7 @@ async function handleFeedback(req, res, config) {
|
|
|
4410
4433
|
export function apply(ctx, config) {
|
|
4411
4434
|
try {
|
|
4412
4435
|
try { loggerRef = ctx?.logger || null } catch { }
|
|
4436
|
+
try { ctxRef = ctx || null } catch { }
|
|
4413
4437
|
ctx.inject(['webServer'], (scoped) => {
|
|
4414
4438
|
// 每个请求按 accept-language 决定返回中文还是英文:AsyncLocalStorage 让 t() 在
|
|
4415
4439
|
// 任何异步后续里都能读到本次请求的语言,不用把语言参数一层层往下传。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-config-sync-plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.82",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -57,4 +57,4 @@
|
|
|
57
57
|
"check": "node --check index.js && node --check client.js",
|
|
58
58
|
"verify": "node tools/selftest.mjs && node tools/clientcheck.mjs"
|
|
59
59
|
}
|
|
60
|
-
}
|
|
60
|
+
}
|
package/runtime/apply.ps1
CHANGED
|
@@ -900,6 +900,7 @@ $localPluginMap = [ordered]@{
|
|
|
900
900
|
'dsh-our-free-model-2.8.0' = 'dsh-our-free-model'
|
|
901
901
|
'dsh-purge-1.4.0' = 'dsh-purge'
|
|
902
902
|
'dsh-config-sync-plugin-0.3.69' = 'dsh-config-sync-plugin'
|
|
903
|
+
'dsh-config-sync-plugin-0.3.81' = 'dsh-config-sync-plugin'
|
|
903
904
|
'dsh-config-sync-plugin-0.3.80' = 'dsh-config-sync-plugin'
|
|
904
905
|
'dsh-config-sync-plugin-0.3.79' = 'dsh-config-sync-plugin'
|
|
905
906
|
'dsh-config-sync-plugin-0.3.78' = 'dsh-config-sync-plugin'
|
|
@@ -116,14 +116,18 @@ function cleanTitle(text) {
|
|
|
116
116
|
return s
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* 从单个会话日志文件提取标题与来源。返回 {title, origin} 并写入缓存。
|
|
121
|
+
* origin 取自日志首个 `session` 头事件:`subagent` 表示智能体(子)会话,
|
|
122
|
+
* 面板「工作区显示」卡片默认把它们折叠掉,只留用户自己的会话。
|
|
123
|
+
*/
|
|
120
124
|
function titleFromFile(file) {
|
|
121
125
|
let mtime = 0
|
|
122
|
-
try { mtime = fs.statSync(file).mtimeMs } catch { return { title: '' } }
|
|
126
|
+
try { mtime = fs.statSync(file).mtimeMs } catch { return { title: '', origin: '' } }
|
|
123
127
|
const key = `${file}:${mtime}`
|
|
124
128
|
const hit = TITLE_CACHE.get(key)
|
|
125
129
|
if (hit) return hit
|
|
126
|
-
let result = { title: '' }
|
|
130
|
+
let result = { title: '', origin: '' }
|
|
127
131
|
try {
|
|
128
132
|
const buf = fs.readFileSync(file)
|
|
129
133
|
let text = ''
|
|
@@ -134,14 +138,26 @@ function titleFromFile(file) {
|
|
|
134
138
|
} else {
|
|
135
139
|
text = buf.toString('utf8', 0, 256 * 1024)
|
|
136
140
|
}
|
|
137
|
-
|
|
141
|
+
// 会话标题会演进:先产生 fallback(首条消息截断),随后 AI 生成 provider 正式标题覆盖。
|
|
142
|
+
// DSH 面板显示的是最新/provider 标题;这里必须一致,不能像以前那样找到第一条就 break。
|
|
143
|
+
let providerTitle = '' // source.kind === 'provider' 的 AI 标题(取最后一条)
|
|
144
|
+
let fallbackTitle = '' // fallback 标题(取最后一条)
|
|
145
|
+
let anyTitle = '' // 无 source 信息的兜底标题(取最后一条)
|
|
138
146
|
let firstUserText = ''
|
|
147
|
+
let origin = '' // 会话来源:subagent = 智能体子会话
|
|
139
148
|
for (const line of text.split('\n')) {
|
|
140
149
|
if (!line) continue
|
|
141
150
|
let ev
|
|
142
151
|
try { ev = JSON.parse(line) } catch { continue }
|
|
152
|
+
if (!origin && ev.type === 'session') {
|
|
153
|
+
if (typeof ev.origin === 'string') origin = ev.origin
|
|
154
|
+
else if (ev.data && typeof ev.data.origin === 'string') origin = ev.data.origin
|
|
155
|
+
}
|
|
143
156
|
if (ev.type === 'session/title' && ev.data && typeof ev.data.title === 'string') {
|
|
144
|
-
|
|
157
|
+
const kind = ev.data.source && ev.data.source.kind
|
|
158
|
+
if (kind === 'provider') providerTitle = ev.data.title
|
|
159
|
+
else if (kind === 'fallback') fallbackTitle = ev.data.title
|
|
160
|
+
else anyTitle = ev.data.title
|
|
145
161
|
}
|
|
146
162
|
if (!firstUserText && ev.type === 'user/message' && ev.data && Array.isArray(ev.data.content)) {
|
|
147
163
|
for (const part of ev.data.content) {
|
|
@@ -151,11 +167,14 @@ function titleFromFile(file) {
|
|
|
151
167
|
}
|
|
152
168
|
}
|
|
153
169
|
}
|
|
154
|
-
if (lastTitle) break
|
|
155
170
|
}
|
|
156
|
-
|
|
171
|
+
// 优先级与 DSH 面板一致:provider 正式标题 > fallback > 无来源 title > 首条用户消息
|
|
172
|
+
result = {
|
|
173
|
+
title: cleanTitle(providerTitle) || cleanTitle(fallbackTitle) || cleanTitle(anyTitle) || cleanTitle(firstUserText),
|
|
174
|
+
origin,
|
|
175
|
+
}
|
|
157
176
|
} catch {
|
|
158
|
-
result = { title: '' }
|
|
177
|
+
result = { title: '', origin: '' }
|
|
159
178
|
}
|
|
160
179
|
if (TITLE_CACHE.size > 400) TITLE_CACHE.clear()
|
|
161
180
|
TITLE_CACHE.set(key, result)
|
|
@@ -185,27 +204,36 @@ function buildSessionLogIndex(dshHome) {
|
|
|
185
204
|
return byId
|
|
186
205
|
}
|
|
187
206
|
|
|
188
|
-
/**
|
|
189
|
-
|
|
207
|
+
/**
|
|
208
|
+
* 读视图:列出所有工作区 + 每个工作区下会话的隐藏状态 + 三态归一化 + 会话名称。
|
|
209
|
+
* options.includeAgents=true 时才把智能体(origin === 'subagent')会话算进来;
|
|
210
|
+
* 默认折叠,三态与计数都只按用户自己的会话计算(否则一屏全是智能体会话)。
|
|
211
|
+
*/
|
|
212
|
+
export function readView(dshHome, options = {}) {
|
|
213
|
+
const includeAgents = options.includeAgents === true
|
|
190
214
|
const ws = readJson(workspacePath(dshHome))
|
|
191
215
|
const arch = readJson(archivePath(dshHome))
|
|
192
216
|
if (!ws || !ws.tables || !ws.tables.workspaces) {
|
|
193
|
-
return { ok: true, available: false, workspaces: [] }
|
|
217
|
+
return { ok: true, available: false, workspaces: [], includeAgents, agentHidden: 0 }
|
|
194
218
|
}
|
|
195
219
|
const globalArchived = new Set(Array.isArray(ws.global?.archivedSessionIds) ? ws.global.archivedSessionIds : [])
|
|
196
220
|
const archMap = (arch && arch.workspaces && typeof arch.workspaces === 'object') ? arch.workspaces : {}
|
|
197
221
|
const logIndex = buildSessionLogIndex(dshHome)
|
|
198
222
|
const workspaces = []
|
|
223
|
+
let totalAgents = 0
|
|
199
224
|
for (const [wsId, rec] of Object.entries(ws.tables.workspaces)) {
|
|
200
225
|
if (!rec || typeof rec !== 'object') continue
|
|
201
226
|
const sessionIds = Array.isArray(rec.sessionIds) ? rec.sessionIds.slice() : []
|
|
202
227
|
const archRec = archMap[wsId]
|
|
203
228
|
const workspaceArchived = Boolean(archRec && archRec.archived === true)
|
|
204
|
-
const
|
|
229
|
+
const all = sessionIds.map((sid) => {
|
|
205
230
|
const log = logIndex.get(sid)
|
|
206
|
-
const
|
|
207
|
-
return { id: sid, title, hidden: globalArchived.has(sid) }
|
|
231
|
+
const meta = log ? titleFromFile(log) : { title: '', origin: '' }
|
|
232
|
+
return { id: sid, title: meta.title, hidden: globalArchived.has(sid), agent: meta.origin === 'subagent' }
|
|
208
233
|
})
|
|
234
|
+
const agentCount = all.filter((s) => s.agent).length
|
|
235
|
+
totalAgents += agentCount
|
|
236
|
+
const sessions = includeAgents ? all : all.filter((s) => !s.agent)
|
|
209
237
|
const hiddenCount = sessions.filter((s) => s.hidden).length
|
|
210
238
|
let state = 'normal'
|
|
211
239
|
if (workspaceArchived) state = 'archive'
|
|
@@ -217,13 +245,14 @@ export function readView(dshHome) {
|
|
|
217
245
|
path: typeof rec.path === 'string' ? rec.path : '',
|
|
218
246
|
sessionCount: sessions.length,
|
|
219
247
|
hiddenCount,
|
|
248
|
+
agentCount,
|
|
220
249
|
state,
|
|
221
250
|
archived: workspaceArchived,
|
|
222
251
|
archivedAt: workspaceArchived && typeof archRec.archivedAt === 'number' ? archRec.archivedAt : 0,
|
|
223
252
|
sessions,
|
|
224
253
|
})
|
|
225
254
|
}
|
|
226
|
-
return { ok: true, available: true, workspaces }
|
|
255
|
+
return { ok: true, available: true, workspaces, includeAgents, agentHidden: totalAgents }
|
|
227
256
|
}
|
|
228
257
|
|
|
229
258
|
/** 切换一个工作区的三态。state ∈ normal | hide-sessions | archive。 */
|
|
@@ -283,3 +312,130 @@ export function setSessionState(dshHome, sessionId, hidden) {
|
|
|
283
312
|
writeJsonAtomic(wsPath, ws)
|
|
284
313
|
return readView(dshHome)
|
|
285
314
|
}
|
|
315
|
+
|
|
316
|
+
/* ===================== 实时通道(0.3.82) =====================
|
|
317
|
+
* 直接改 JSON 文件只能改磁盘,宿主内存里的 workspaceRegistry.archivedSessionIds
|
|
318
|
+
* 与 session-list feed 都不会更新 —— 这就是以前「必须重启 DSH 才生效」的原因。
|
|
319
|
+
*
|
|
320
|
+
* 正路是走 workspaceRegistry 的三个公开方法:
|
|
321
|
+
* registry.archiveSession(id, {stopActivity}) → enqueueOperation → setState
|
|
322
|
+
* → global.set(state) 落盘 + storage domain changed
|
|
323
|
+
* → api-workspace-controller 的 feed.changed 发布 {type:'archived', archivedSessionIds}
|
|
324
|
+
* → 会话列表实时更新,无需重启。
|
|
325
|
+
* registry.unarchiveSession(id) 同理。
|
|
326
|
+
*
|
|
327
|
+
* registry 拿不到(插件先于 registry 启动、或宿主版本变更)时,自动退回上面的
|
|
328
|
+
* 纯文件写法并标记 live:false,保证功能不丢,只是需要刷新才生效。
|
|
329
|
+
*/
|
|
330
|
+
|
|
331
|
+
/** 用 registry 改单个会话的隐藏状态;registry 不可用时返回 {via:'file'}。 */
|
|
332
|
+
async function applySessionState(registry, sessionId, hidden) {
|
|
333
|
+
if (!registry || typeof registry.archiveSession !== 'function') return { via: 'file', stopped: false }
|
|
334
|
+
if (hidden) {
|
|
335
|
+
const already = Array.isArray(registry.archivedSessionIds) && registry.archivedSessionIds.includes(sessionId)
|
|
336
|
+
if (already) return { via: 'live', stopped: false }
|
|
337
|
+
try {
|
|
338
|
+
await registry.archiveSession(sessionId, { stopActivity: false })
|
|
339
|
+
return { via: 'live', stopped: false }
|
|
340
|
+
} catch (error) {
|
|
341
|
+
const text = String((error && (error.code || error.name || error.message)) || '')
|
|
342
|
+
// 会话正在跑(有活动)时宿主会拒绝;带上 stopActivity 再试一次,先停掉活动再归档。
|
|
343
|
+
if (/active/i.test(text)) {
|
|
344
|
+
await registry.archiveSession(sessionId, { stopActivity: true })
|
|
345
|
+
return { via: 'live', stopped: true }
|
|
346
|
+
}
|
|
347
|
+
throw error
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (typeof registry.unarchiveSession !== 'function') return { via: 'file', stopped: false }
|
|
351
|
+
await registry.unarchiveSession(sessionId)
|
|
352
|
+
return { via: 'live', stopped: false }
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** 用 registry 内存里的 archivedSessionIds 修正视图的 hidden 标记(文件可能还没落盘)。 */
|
|
356
|
+
function withRegistryHidden(view, registry) {
|
|
357
|
+
if (!registry || !Array.isArray(registry.archivedSessionIds)) return view
|
|
358
|
+
const set = new Set(registry.archivedSessionIds)
|
|
359
|
+
const workspaces = (view.workspaces || []).map((w) => {
|
|
360
|
+
const sessions = (w.sessions || []).map((s) => ({ ...s, hidden: set.has(s.id) }))
|
|
361
|
+
const hiddenCount = sessions.filter((s) => s.hidden).length
|
|
362
|
+
let state = 'normal'
|
|
363
|
+
if (w.archived) state = 'archive'
|
|
364
|
+
else if (hiddenCount > 0 && hiddenCount === sessions.length && sessions.length > 0) state = 'hide-sessions'
|
|
365
|
+
else if (hiddenCount > 0) state = 'partial'
|
|
366
|
+
return { ...w, sessions, hiddenCount, state }
|
|
367
|
+
})
|
|
368
|
+
return { ...view, workspaces }
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* 实时切换工作区三态。成功后返回的状态是重新 readView 出来的快照。
|
|
373
|
+
* options.registry 传宿主 workspaceRegistry;传 null/undefined 时退回文件写法。
|
|
374
|
+
*/
|
|
375
|
+
export async function setWorkspaceStateLive(dshHome, workspaceId, state, options = {}) {
|
|
376
|
+
const { registry = null, includeAgents = false } = options
|
|
377
|
+
if (!['normal', 'hide-sessions', 'archive'].includes(state)) {
|
|
378
|
+
throw new Error(`不支持的工作区状态:${state}`)
|
|
379
|
+
}
|
|
380
|
+
const wsPath = workspacePath(dshHome)
|
|
381
|
+
const archPath = archivePath(dshHome)
|
|
382
|
+
const ws = readJson(wsPath)
|
|
383
|
+
if (!ws || !ws.tables || !ws.tables.workspaces || !ws.tables.workspaces[workspaceId]) {
|
|
384
|
+
throw new Error(`工作区不存在:${workspaceId}`)
|
|
385
|
+
}
|
|
386
|
+
const rec = ws.tables.workspaces[workspaceId]
|
|
387
|
+
const sids = Array.isArray(rec.sessionIds) ? rec.sessionIds.slice() : []
|
|
388
|
+
|
|
389
|
+
// 工作区归档记录(session-manager 侧)先按旧写法写好:registry 只管会话级 archivedSessionIds。
|
|
390
|
+
const arch = readJson(archPath) || { version: 1, workspaces: {} }
|
|
391
|
+
if (!arch.workspaces || typeof arch.workspaces !== 'object') arch.workspaces = {}
|
|
392
|
+
if (state === 'archive') {
|
|
393
|
+
arch.workspaces[workspaceId] = {
|
|
394
|
+
workspaceId,
|
|
395
|
+
archived: true,
|
|
396
|
+
archivedAt: Date.now(),
|
|
397
|
+
sessionIds: sids,
|
|
398
|
+
pending: [],
|
|
399
|
+
}
|
|
400
|
+
} else {
|
|
401
|
+
delete arch.workspaces[workspaceId]
|
|
402
|
+
}
|
|
403
|
+
writeJsonAtomic(archPath, arch)
|
|
404
|
+
|
|
405
|
+
const live = Boolean(registry && typeof registry.archiveSession === 'function')
|
|
406
|
+
if (!live) {
|
|
407
|
+
// 没 registry:完全按旧的文件写法(含 global.archivedSessionIds),行为不变。
|
|
408
|
+
return { ...setWorkspaceState(dshHome, workspaceId, state), live: false }
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const errors = []
|
|
412
|
+
let stopped = 0
|
|
413
|
+
const results = await Promise.all(sids.map(async (sid) => {
|
|
414
|
+
try {
|
|
415
|
+
const r = await applySessionState(registry, sid, state !== 'normal')
|
|
416
|
+
if (r.stopped) stopped += 1
|
|
417
|
+
return r
|
|
418
|
+
} catch (error) {
|
|
419
|
+
errors.push(`${sid}: ${String((error && error.message) || error)}`)
|
|
420
|
+
return { via: 'error' }
|
|
421
|
+
}
|
|
422
|
+
}))
|
|
423
|
+
if (errors.length > 0) {
|
|
424
|
+
// 实时通道部分失败:退回文件写法把状态对齐,避免「写了一半」。
|
|
425
|
+
const fallback = setWorkspaceState(dshHome, workspaceId, state)
|
|
426
|
+
return { ...fallback, live: false, fallbackFrom: 'registry', stopped, errors }
|
|
427
|
+
}
|
|
428
|
+
void results
|
|
429
|
+
return { ...withRegistryHidden(readView(dshHome, { includeAgents }), registry), live: true, stopped }
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/** 实时隐藏/显示单个会话。 */
|
|
433
|
+
export async function setSessionStateLive(dshHome, sessionId, hidden, options = {}) {
|
|
434
|
+
const { registry = null, includeAgents = false } = options
|
|
435
|
+
const live = Boolean(registry && typeof registry.archiveSession === 'function')
|
|
436
|
+
if (!live) {
|
|
437
|
+
return { ...setSessionState(dshHome, sessionId, hidden), live: false }
|
|
438
|
+
}
|
|
439
|
+
const r = await applySessionState(registry, sessionId, hidden)
|
|
440
|
+
return { ...withRegistryHidden(readView(dshHome, { includeAgents }), registry), live: true, stopped: r.stopped ? 1 : 0 }
|
|
441
|
+
}
|
package/tools/selftest.mjs
CHANGED
|
@@ -1617,6 +1617,51 @@ console.log('== 工作区显示状态卡片 ==')
|
|
|
1617
1617
|
check('面板新增「工作区显示」分区', cliSrc.includes("Section(M('工作区显示', 'Workspace visibility')"), '分区装配')
|
|
1618
1618
|
}
|
|
1619
1619
|
|
|
1620
|
+
console.log('')
|
|
1621
|
+
console.log('== 0.3.82:工作区显示卡片折叠智能体 + 隐藏/显示即时生效 ==')
|
|
1622
|
+
{
|
|
1623
|
+
const wvSrc = existsSync(join(pluginRootSelf, 'runtime', 'tools', 'workspace-view.mjs')) ? readFileSync(join(pluginRootSelf, 'runtime', 'tools', 'workspace-view.mjs'), 'utf8') : ''
|
|
1624
|
+
const idxSrc = existsSync(join(pluginRootSelf, 'index.js')) ? readFileSync(join(pluginRootSelf, 'index.js'), 'utf8') : ''
|
|
1625
|
+
const cliSrc = existsSync(join(pluginRootSelf, 'client.js')) ? readFileSync(join(pluginRootSelf, 'client.js'), 'utf8') : ''
|
|
1626
|
+
|
|
1627
|
+
// 1) 智能体折叠:标题提取同时给出 origin,readView 支持 includeAgents 过滤
|
|
1628
|
+
check('智能体折叠:titleFromFile 同时返回 origin',
|
|
1629
|
+
wvSrc.includes("let result = { title: '', origin: '' }")
|
|
1630
|
+
&& wvSrc.includes('if (!origin && ev.type === \'session\')')
|
|
1631
|
+
&& wvSrc.includes('origin,'), 'workspace-view.mjs 的头事件解析')
|
|
1632
|
+
check('智能体折叠:readView 默认过滤 origin=subagent 并回报 agentHidden',
|
|
1633
|
+
wvSrc.includes('const includeAgents = options.includeAgents === true')
|
|
1634
|
+
&& wvSrc.includes("agent: meta.origin === 'subagent'")
|
|
1635
|
+
&& wvSrc.includes('const sessions = includeAgents ? all : all.filter((s) => !s.agent)')
|
|
1636
|
+
&& wvSrc.includes('agentHidden: totalAgents'), 'workspace-view.mjs 的 readView')
|
|
1637
|
+
check('智能体折叠:卡片默认不显示、可勾选「显示智能体」',
|
|
1638
|
+
cliSrc.includes('const [showAgents, setShowAgents] = react.useState(false)')
|
|
1639
|
+
&& cliSrc.includes("M('显示智能体', 'Show agents')")
|
|
1640
|
+
&& cliSrc.includes('opts.includeAgents ? \'?agents=1\' : \'\''), 'client.js 的勾选框')
|
|
1641
|
+
|
|
1642
|
+
// 2) 即时生效:走 workspaceRegistry 而不是直接改文件
|
|
1643
|
+
check('即时生效:workspace-view 导出实时通道两函数',
|
|
1644
|
+
wvSrc.includes('export async function setWorkspaceStateLive')
|
|
1645
|
+
&& wvSrc.includes('export async function setSessionStateLive')
|
|
1646
|
+
&& wvSrc.includes('registry.archiveSession(sessionId, { stopActivity: false })')
|
|
1647
|
+
&& wvSrc.includes('registry.unarchiveSession(sessionId)'), 'workspace-view.mjs 的实时通道')
|
|
1648
|
+
check('即时生效:宿主惰性取 workspaceRegistry',
|
|
1649
|
+
idxSrc.includes('let ctxRef = null')
|
|
1650
|
+
&& idxSrc.includes('function workspaceRegistryOf()')
|
|
1651
|
+
&& idxSrc.includes("ctx.get('workspaceRegistry')")
|
|
1652
|
+
&& idxSrc.includes('ctxRef = ctx || null'), 'index.js 的 registry 取用')
|
|
1653
|
+
check('即时生效:路由改用 Live 版本并透传 registry',
|
|
1654
|
+
idxSrc.includes("import { setWorkspaceStateLive, setSessionStateLive } from './runtime/tools/workspace-view.mjs'")
|
|
1655
|
+
&& idxSrc.includes('await setWorkspaceStateLive(') && idxSrc.includes('await setSessionStateLive(')
|
|
1656
|
+
&& idxSrc.includes('{ registry, includeAgents: withAgents }'), 'index.js 的 handleWorkspaceView')
|
|
1657
|
+
check('即时生效:registry 拿不到时退回文件写法并标记 live:false',
|
|
1658
|
+
wvSrc.includes('return { ...setWorkspaceState(dshHome, workspaceId, state), live: false }')
|
|
1659
|
+
&& wvSrc.includes("live: false, fallbackFrom: 'registry'"), 'workspace-view.mjs 的降级')
|
|
1660
|
+
check('即时生效:卡片按 live 给不同提示(不再说「重启后生效」)',
|
|
1661
|
+
cliSrc.includes("d.live === true") && cliSrc.includes("M('已更新,会话列表已同步', 'Updated — the session list is in sync')")
|
|
1662
|
+
&& !cliSrc.includes('重启或刷新会话列表后生效'), 'client.js 的提示措辞')
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1620
1665
|
console.log('')
|
|
1621
1666
|
console.log('== 配置同步页面 5 点调整 ==')
|
|
1622
1667
|
{
|
|
@@ -1626,7 +1671,11 @@ console.log('== 配置同步页面 5 点调整 ==')
|
|
|
1626
1671
|
check('会话名称:工具从 session 日志提取 title 并随 readView 返回',
|
|
1627
1672
|
wvSrc.includes('zstdDecompressSync') && wvSrc.includes('buildSessionLogIndex')
|
|
1628
1673
|
&& wvSrc.includes("'session/title'") && wvSrc.includes('title: rec.title || wsId')
|
|
1629
|
-
&& wvSrc.includes(
|
|
1674
|
+
&& wvSrc.includes("const meta = log ? titleFromFile(log) : { title: '', origin: '' }"), 'workspace-view.mjs 的标题提取')
|
|
1675
|
+
check('会话名称:与 DSH 面板一致——优先 provider 正式标题,不再取第一条 fallback',
|
|
1676
|
+
wvSrc.includes('providerTitle') && wvSrc.includes("kind === 'provider'")
|
|
1677
|
+
&& wvSrc.includes('cleanTitle(providerTitle) || cleanTitle(fallbackTitle)')
|
|
1678
|
+
&& !wvSrc.includes('if (lastTitle) break'), '标题演进:provider > fallback > 无来源 > 首条消息')
|
|
1630
1679
|
check('会话名称:卡片显示 s.title || s.id', cliSrc.includes('s.title || s.id'), 'client.js 卡片')
|
|
1631
1680
|
// 2) 修改按钮:点「修改」才出现三态 select 与会话隐藏按钮
|
|
1632
1681
|
check('修改按钮:编辑态才显示三态 select 与会话隐藏按钮',
|