dsh-chat-groups 0.1.0 → 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 CHANGED
@@ -1,32 +1,23 @@
1
1
  # dsh-chat-groups
2
2
 
3
- 在 DeepSeek Harness(DSH)工作区内按任务整理会话。分组由 Host 保存。会话标题、归档和对话内容仍由 DSH 管理。
3
+ 在 DeepSeek Harness(DSH)的侧栏中按任务整理会话:可创建分组、把会话加入/移动分组、在分组内新建会话。分组数据由 Host 保存,停用插件后恢复原生侧栏且数据保留。
4
4
 
5
- ## 安装与停用
5
+ ## 安装
6
6
 
7
- 已在 macOS 的 DSH Web `0.2.2-rc.5` 验证。可在仓库根目录或插件目录运行以下命令,将 Bundle 安装到 `web` profile。
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
- 启动后,展开左侧栏,点工作区工具栏「添加工作区」右侧的「切换到会话分组视图」图标。点「返回默认视图」可回到原生工作区列表。要停用整个 Bundle,在 DSH 的「插件」页面关闭 `dsh-chat-groups`。停用会恢复原生侧栏并保留分组数据。启用了配置热重载的 profile 会立即应用停用,其他 profile 在重启后应用。
15
-
16
- ## 使用
17
-
18
- 将鼠标移到工作区、会话或分组行上,即可显示该行的操作图标。
19
-
20
- - 点工作区行末的「新增分组」图标。可以折叠、重命名或删除分组。确认删除后,成员会回到工作区直属列表,会话仍可打开。
21
- - 点会话行末的「调整分组」图标加入分组、移到同一工作区的其他组,或移回直属列表。工作区和会话各自保留原生操作。点击会话会打开 DSH 原生对话。
22
- - 点组旁的「新建会话」图标创建原生会话。工作区挂接或分组归属保存失败时,可点「重试保存」图标。刷新页面后重新进入分组视图,仍可继续处理同一条会话。
23
-
24
- 第一版的分组功能向 DSH Host 所有者开放。归档会话可以在默认视图里管理。
25
-
26
- ## 验收
16
+ ### Desktop
27
17
 
28
- 运行 `npm --prefix dsh-chat-groups test` 执行 10 项数据规则测试。
18
+ 在 DSH 的「插件」页面点「添加插件」:
29
19
 
30
- 在隔离的 DSH Web `0.2.2-rc.5` profile 安装真实 Bundle 后,验证了侧栏往返、会话加入/移动/移出、组内新建、取消和确认删除非空组、跨工作区拒绝、归档与失效会话过滤、Host 重启后保留分组,以及停用后恢复原生列表和搜索快捷键并保留当前会话。另模拟一次原生工作区挂接失败,确认刷新后仍能用原会话 ID 完成重试。分组归属写入失败由单元测试覆盖。Desktop 图形界面尚未单独验收。
20
+ - 输入插件包名 `dsh-chat-groups` 或 GitHub 仓库地址 `https://github.com/jiangliuhong/dsh-plugins` 进行安装;
21
+ - 或选择本地 `dsh-chat-groups` 目录进行安装。
31
22
 
32
- [初版离线交互原型](docs/prototype.html)可直接在浏览器中打开,用于查看分组操作。
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]),
@@ -454,7 +464,10 @@ window.__ModuleLoader__.load({
454
464
  for (const sessionId of workspace.sessionIds) {
455
465
  if (shown.has(sessionId) || archived.has(sessionId) || !listed.has(sessionId)) continue
456
466
  const session = catalog.byId[sessionId]
457
- if (!session || session.parentId || session.origin === 'subagent') continue
467
+ if (!session || session.origin === 'subagent') continue
468
+ // Match the native list: only the current blank is a visible
469
+ // placeholder. Ordinary forks can carry parentId and still belong here.
470
+ if (session.blank && sessionId !== active) continue
458
471
  shown.add(sessionId)
459
472
  const assigned = groupBySession[sessionId]
460
473
  const groupId = workspaceGroupIds.has(assigned) ? assigned : undefined
@@ -477,9 +490,8 @@ window.__ModuleLoader__.load({
477
490
  ),
478
491
  ),
479
492
  expanded && h('div', { className: 'dsh-chat-groups-branch' },
480
- members.get(undefined)?.map(session => sessionRow(id, session, undefined, groups)),
481
- groups.map(([groupId, group]) => {
482
- const rows = members.get(groupId) ?? []
493
+ orderedWorkspaceRows(groups, members).map(({ session, groupId, group, rows }) => {
494
+ if (session) return sessionRow(id, session, undefined, groups)
483
495
  const open = !collapsedGroups.has(groupId)
484
496
  const retrySessionId = data.pendingSessions[groupId]
485
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]: { workspaceId, name: request.name } },
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
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-chat-groups",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "在 DSH 工作区内按任务整理会话",
6
6
  "main": "./host.js",