dsh-chat-groups 0.1.1 → 0.1.2
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.md +10 -19
- package/client.js +12 -3
- package/groups.js +2 -2
- package/host.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
# dsh-chat-groups
|
|
2
2
|
|
|
3
|
-
在 DeepSeek Harness(DSH
|
|
3
|
+
在 DeepSeek Harness(DSH)的侧栏中按任务整理会话:可创建分组、把会话加入/移动分组、在分组内新建会话。分组数据由 Host 保存,停用插件后恢复原生侧栏且数据保留。
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 安装
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Web
|
|
8
|
+
|
|
9
|
+
在仓库根目录或插件目录运行:
|
|
8
10
|
|
|
9
11
|
```sh
|
|
10
12
|
dsh plugin --profile web add "$(git rev-parse --show-toplevel)/dsh-chat-groups"
|
|
11
13
|
dsh web
|
|
12
14
|
```
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## 使用
|
|
17
|
-
|
|
18
|
-
将鼠标移到工作区、会话或分组行上,即可显示该行的操作图标。
|
|
19
|
-
|
|
20
|
-
- 点工作区行末的「新增分组」图标。可以折叠、重命名或删除分组。确认删除后,成员会回到工作区直属列表,会话仍可打开。
|
|
21
|
-
- 点会话行末的「调整分组」图标加入分组、移到同一工作区的其他组,或移回直属列表。工作区和会话各自保留原生操作。点击会话会打开 DSH 原生对话。
|
|
22
|
-
- 点组旁的「新建会话」图标创建原生会话。工作区挂接或分组归属保存失败时,可点「重试保存」图标。刷新页面后重新进入分组视图,仍可继续处理同一条会话。
|
|
23
|
-
|
|
24
|
-
第一版的分组功能向 DSH Host 所有者开放。归档会话可以在默认视图里管理。
|
|
25
|
-
|
|
26
|
-
## 验收
|
|
16
|
+
### Desktop
|
|
27
17
|
|
|
28
|
-
|
|
18
|
+
在 DSH 的「插件」页面点「添加插件」:
|
|
29
19
|
|
|
30
|
-
|
|
20
|
+
- 输入插件包名 `dsh-chat-groups` 或 GitHub 仓库地址 `https://github.com/jiangliuhong/dsh-plugins` 进行安装;
|
|
21
|
+
- 或选择本地 `dsh-chat-groups` 目录进行安装。
|
|
31
22
|
|
|
32
|
-
|
|
23
|
+
启动后在侧栏工作区工具栏点「切换到会话分组视图」即可使用;点「返回默认视图」回到原生列表。要停用,在 DSH「插件」页面关闭 `dsh-chat-groups`。
|
package/client.js
CHANGED
|
@@ -69,6 +69,16 @@ window.__ModuleLoader__.load({
|
|
|
69
69
|
.dsh-chat-groups-danger:not(:disabled) { color: var(--dsw-alias-state-error-primary); }
|
|
70
70
|
`
|
|
71
71
|
|
|
72
|
+
function orderedWorkspaceRows(groups, members) {
|
|
73
|
+
const entries = (members.get(undefined) ?? []).map(session => ({ session, time: session.updatedAt }))
|
|
74
|
+
for (const [groupId, group] of groups) {
|
|
75
|
+
const rows = members.get(groupId) ?? []
|
|
76
|
+
const time = rows.reduce((latest, session) => Math.max(latest, session.updatedAt), group.createdAt ?? 0)
|
|
77
|
+
entries.push({ groupId, group, rows, time })
|
|
78
|
+
}
|
|
79
|
+
return entries.sort((left, right) => right.time - left.time)
|
|
80
|
+
}
|
|
81
|
+
|
|
72
82
|
function useSource(source) {
|
|
73
83
|
return useSyncExternalStore(
|
|
74
84
|
useCallback(listener => source.subscribe(listener), [source]),
|
|
@@ -480,9 +490,8 @@ window.__ModuleLoader__.load({
|
|
|
480
490
|
),
|
|
481
491
|
),
|
|
482
492
|
expanded && h('div', { className: 'dsh-chat-groups-branch' },
|
|
483
|
-
members.
|
|
484
|
-
|
|
485
|
-
const rows = members.get(groupId) ?? []
|
|
493
|
+
orderedWorkspaceRows(groups, members).map(({ session, groupId, group, rows }) => {
|
|
494
|
+
if (session) return sessionRow(id, session, undefined, groups)
|
|
486
495
|
const open = !collapsedGroups.has(groupId)
|
|
487
496
|
const retrySessionId = data.pendingSessions[groupId]
|
|
488
497
|
return h('section', { key: groupId },
|
package/groups.js
CHANGED
|
@@ -24,14 +24,14 @@ function updateGroups(state, request) {
|
|
|
24
24
|
if (action === 'create') {
|
|
25
25
|
return {
|
|
26
26
|
...state,
|
|
27
|
-
groups: { ...state.groups, [randomUUID()]: { workspaceId, name: request.name } },
|
|
27
|
+
groups: { ...state.groups, [randomUUID()]: { workspaceId, name: request.name, createdAt: Date.now() } },
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
if (groupId !== null) requireGroup(state, workspaceId, groupId)
|
|
31
31
|
if (action === 'rename') {
|
|
32
32
|
return {
|
|
33
33
|
...state,
|
|
34
|
-
groups: { ...state.groups, [groupId]: {
|
|
34
|
+
groups: { ...state.groups, [groupId]: { ...state.groups[groupId], name: request.name } },
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
if (action === 'delete') {
|
package/host.js
CHANGED
|
@@ -7,7 +7,7 @@ import { createGroupOperations, emptyGroups, GroupError } from './groups.js'
|
|
|
7
7
|
const id = z.string().min(1).max(256)
|
|
8
8
|
const nameSchema = z.string().trim().min(1).max(80)
|
|
9
9
|
const stateSchema = z.object({
|
|
10
|
-
groups: z.record(z.uuid(), z.object({ workspaceId: id, name: nameSchema })),
|
|
10
|
+
groups: z.record(z.uuid(), z.object({ workspaceId: id, name: nameSchema, createdAt: z.number().int().nonnegative().optional() })),
|
|
11
11
|
membership: z.record(id, z.uuid()),
|
|
12
12
|
pendingSessions: z.record(z.uuid(), id).default({}),
|
|
13
13
|
})
|