dsh-session-flow 0.1.0 → 1.0.0

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 CHANGED
@@ -1,125 +1,72 @@
1
- # dsh-session-flow
1
+ # dsh-session-flow — session review & archive plugin for DSH
2
2
 
3
3
  > **English** | [中文](README.md)
4
4
 
5
- > A DSH plugin that redesigns the session information flow: turning raw session message streams into a **foldable information flow with session-level summaries** a cross-session archive cabinet.
5
+ Restructures DSH session message streams into a **foldable information flow with session-level summaries**: every session becomes an archive card for cross-workspace review, search, and export. The built-in session views (Trajectory / Chat) excel at the microscopic inspection of what is happening right now; this plugin fills the missing layer of **post-hoc review / archival / insight**.
6
6
 
7
- **In one sentence**: Too many sessions, too slow to review? This plugin turns every DSH session into an "archive card" — understand in seconds what a session did, where it got to, which tools it used, which files it touched — and track running sessions in real time.
7
+ ## Interface tour
8
8
 
9
- [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/dsh) is an AI agent workbench. Its built-in session views (Trajectory / Chat) excel at the microscopic inspection of *what is happening right now*; this plugin fills the missing layer of **post-hoc review / archival / insight**: a cross-session, cross-workspace historical perspective.
10
-
11
- ---
12
-
13
- ## What it does
14
-
15
- | Feature | Description |
9
+ | Overview workbench | Session Flow tab |
16
10
  |---|---|
17
- | 🗂️ **Session overview workbench** | All sessions as cards: title, workspace, status (running / ended / empty / subagent), error count, duration, created time; sortable and filterable — find the target session at a glance |
18
- | 🔍 **Structured search** | `tool:pwsh` finds sessions that used a tool, `file:src/` finds sessions that touched a path, `err:` finds sessions with errors, or just free-text search (title / tool name / file path) |
19
- | 📜 **Folded detail view** | Turns are collapsed by default into a two-line "user message + conclusion" summary; expand to view in **true chronological order**: thinking → tool calls → replies, exactly as they happened — never re-stacked by type |
20
- | 🧭 **Four-tab navigation** | Right panel: user message outline / tool call list / error list / in-session full-text search — click any entry to auto-expand the turn, scroll to it, and flash-highlight it |
21
- | 🌳 **Subagent lineage tree** | Tree view of parent-session → subagent relationships; subagent details reuse the folded rendering; one-click "view subagent" from tool rows |
22
- | 📝 **Dual-mode summary** | Auto summary card per session: **rule mode** (zero cost, assembled live: task count / first task / latest conclusion / top tools) + **LLM mode** (one-click, uses the DSH model, summarizes task by task; cached on disk, prompts regeneration when new conversation arrives) |
23
- | ⚡ **Live tracking** | Click "Live" on a running session: auto-refresh every 3 seconds, the active turn gets a breathing highlight + a "generating…" indicator — no page refresh needed |
24
- | 📦 **ZIP chunked export** | One-click export of the full session as a readable Markdown report (`00-overview.md` + timeline chunks, ≤700KB each), packed as a ZIP — great for archival, sharing, or handoff |
25
- | 🧹 **Cache management** | Visual view and scoped cleanup of index/timeline caches (only this plugin's caches; never touches DSH data) |
11
+ | ![Overview workbench](assets/screenshots/overview.png) | ![Session Flow tab](assets/screenshots/session-flow-tab.png) |
12
+ | Session cards with status, conclusion line, first task; hover to rename inline | "Session Flow" tab embedded in the native conversation page |
26
13
 
27
- ## Installation
14
+ | Turn rail | Cross-session full-text search |
15
+ |---|---|
16
+ | ![Turn rail](assets/screenshots/turn-rail.png) | ![Cross-session full-text search](assets/screenshots/fulltext-search.png) |
17
+ | Turn navigation on the left of the Chat tab: collapsed dashes ⇄ expanded cards, one-click jump | Free text in the overview triggers full-text mode: recall across workspaces, hits jump & locate |
28
18
 
29
- ### Option 1: Install from the plugin market (recommended)
19
+ | Dock details right | Folded detail view |
20
+ |---|---|
21
+ | ![Dock details right](assets/screenshots/dock-right.png) | ![Folded detail view](assets/screenshots/folded-detail.png) |
22
+ | Dock the detail into the official right panel: conversation + flow side by side, drag to resize | Turns folded by default; expand in true chronological order; four-tab navigation |
30
23
 
31
- Open "Plugin Market" in the DSH Web GUI sidebar, search for `dsh-session-flow`, and click install.
24
+ ## Features
32
25
 
33
- ### Option 2: Install via npm
26
+ | Capability | Description |
27
+ |---|---|
28
+ | Overview workbench | Session cards (status / errors / duration) + conclusion line; sort, filter, workspace tabs |
29
+ | Structured search | `tool:` `file:` `err:` prefixes + free text |
30
+ | Folded detail view | Turns collapse to "user message + conclusion"; expand in true chronological order; on-demand loading |
31
+ | Four-tab navigation | User messages / tools / errors / search, click to locate & highlight |
32
+ | Lineage tree | Subagent derivation tree (offline archive + live runtime channels) |
33
+ | Dual-mode summary | Rule summary (zero cost, assembled live) + LLM summary (cached, prompts regeneration) |
34
+ | Live tracking | 3s polling for running sessions, breathing highlight + generating indicator |
35
+ | ZIP export | Overview + chunked timeline as a Markdown report |
36
+ | Session rename | Custom titles as a display-layer overlay, restore anytime |
37
+ | Session Flow tab | Embedded tab on the native conversation page, cross-navigates with the workbench |
38
+ | Turn rail | Turn jumps on the left of the Chat tab (Chat tab only) |
39
+ | Cross-session full-text search | Content-level recall, hits jump into the Session Flow tab and locate |
40
+ | Dock details right | Side-by-side with the main conversation |
41
+ | Cache management | View & clean index/timeline caches (never touches DSH data) |
42
+
43
+ ## Install
34
44
 
35
45
  ```sh
46
+ # From the plugin market (search dsh-session-flow), or:
36
47
  dsh plugin add dsh-session-flow
37
- ```
38
-
39
- ### Option 3: Install from GitHub
40
-
41
- ```sh
42
48
  dsh plugin add github:YeqingTang/dsh-session-flow
43
49
  ```
44
50
 
45
- ### Option 4: Install from source (development)
46
-
47
- ```sh
48
- git clone https://github.com/YeqingTang/dsh-session-flow.git
49
- dsh plugin add link:/path/to/dsh-session-flow
50
- ```
51
-
52
- ### After installing
53
-
54
- Whatever method you chose: **restart the DSH Web service**, then **hard-refresh the browser** (Ctrl+Shift+R / Ctrl+F5).
55
- Installation succeeds when the "**Session Flow**" entry appears in the sidebar.
56
-
57
- ### Requirements
58
-
59
- - DSH Web GUI (latest stable)
60
- - Node.js ≥ 22.19 (uses built-in zstd decoding, zero third-party dependencies)
61
-
62
- ## Usage guide
51
+ After installing: **restart the DSH Web service** and **hard-refresh the browser** (Ctrl+Shift+R). Success shows the "Session Flow" entry in the sidebar.
63
52
 
64
- ### 1. Open the overview
53
+ Requirements: DSH Web GUI (latest stable); Node.js 22.19 (built-in zstd decoding, zero third-party dependencies).
65
54
 
66
- Click "**Session Flow**" in the sidebar → all sessions are shown as cards. Supports:
55
+ ## Usage
67
56
 
68
- - **Search**: the top search box mixes structured prefixes and free text:
69
-
70
- | Syntax | What it does | Example |
71
- |---|---|---|
72
- | `tool:xxx` | Sessions that used a tool | `tool:pwsh` |
73
- | `file:xxx` | Sessions that touched a path | `file:src/` |
74
- | `err:` | Sessions with errors | `err:` |
75
- | free text | Title / workspace / tool name / file path | `session flow` |
76
-
77
- - **Workspace tabs**: filter by workspace; **sort**: recently run (default) / recently created / oldest first / most tools / longest
78
- - **Stats bar**: tool usage Top 6 + one-click filter for problem sessions (with errors)
79
-
80
- ### 2. View a session
81
-
82
- Click any session card:
83
-
84
- - **Turns collapsed by default**: only "👤 user message + ✅ conclusion" summaries are shown; click a turn header to expand
85
- - **Expanded**: view in true chronological order — thinking (🧠), tool calls (🛠️, with args / result / duration / error marks), assistant replies
86
- - **Right navigation**: four tabs — user messages / tools / errors / search; click to locate in the content area (selected turn gets a blue highlight)
87
- - **Summary card**: rule summary at top; click "Generate LLM summary" for an intelligent summary (model quota consumed on demand)
88
-
89
- ### 3. Track a live session
90
-
91
- When a session is **running** (a "running" badge in the header):
92
-
93
- 1. Click the "**Live**" button in the top-right
94
- 2. The timeline auto-refreshes (every 3 s); the active turn gets a **green breathing highlight** + a "generating…" indicator at the bottom
95
- 3. Click "Exit live" to return to the archived view
96
-
97
- ### 4. Export a report
98
-
99
- In the detail view, click "**Export report (ZIP)**" → download `session-report-<title>.zip`, unzip to get:
100
-
101
- ```
102
- 00-overview.md # session metadata + summary + tool stats + artifact list + chunk guide
103
- 01-timeline-turn1-25.md # per-turn timeline (chunked, ≤700KB each)
104
- 02-timeline-turn26-50.md # …
105
- ```
106
-
107
- The Markdown report opens in any editor / VSCode / Typora.
108
-
109
- ### 5. Cache management
110
-
111
- Overview → "Cache management": view cache sizes and clean selectively (timeline cache / all). Caches rebuild automatically on next access; session data is never affected.
57
+ - **Overview**: sidebar "Session Flow" all session cards. Search supports `tool:` / `file:` / `err:` prefixes; free text of ≥2 characters additionally triggers cross-session full-text search.
58
+ - **Detail**: click a card. Turns are folded by default — click a turn header to expand; the four-tab navigation locates entries; the header offers LLM summary, ZIP export, dock right, and lineage.
59
+ - **Native conversation page**: the "Session Flow" tab reviews the current session in place; the turn rail on the Chat tab jumps to any turn; hover the title for ✎ rename.
60
+ - **Live**: click "Live" on a running session, auto-refresh every 3 seconds.
112
61
 
113
62
  ## Acknowledgements
114
63
 
115
- This plugin stands on the shoulders of the DSH community. Thanks to:
116
-
117
- - **[DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness)** — the DSH agent workbench and plugin ecosystem this plugin runs on.
118
- - **[@deepseek-ai/dsh-session-persistence-jsonl](https://github.com/deepseek-ai/deepseek-harness)** — the zstd multi-frame scanning algorithm for session archives (`scanZstdFrames` in `lib/archive.js` is adapted from this project, MIT licensed).
119
- - **[dsh-web-ui (@linxin666 family)](https://github.com/zhu1090093659/dsh-web-ui)** — reference for the sidebar-entry and center-panel mounting pattern (DOM-level injection + panel mutual exclusion); no code copied; includes dsh-task-board / dsh-ssh etc.
120
- - **[dsh-webui-market-plugin](https://www.npmjs.com/package/@sanqi-normal/dsh-webui-market-plugin)** — the plugin-market mechanism and a distribution channel for this plugin.
64
+ - **[DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness)** the runtime this plugin builds on.
65
+ - **[@deepseek-ai/dsh-session-persistence-jsonl](https://github.com/deepseek-ai/deepseek-harness)** — the zstd multi-frame scanning algorithm (`lib/archive.js` adapted, MIT licensed).
66
+ - **[dsh-web-ui (@linxin666 family)](https://github.com/zhu1090093659/dsh-web-ui)** — reference for the sidebar-entry / panel mounting pattern; no code copied.
67
+ - **[dsh-webui-market-plugin](https://www.npmjs.com/package/@sanqi-normal/dsh-webui-market-plugin)** — plugin-market mechanism and distribution channel.
121
68
 
122
- > Copyrights belong to their respective authors; this plugin is Apache-2.0 licensed and retains original license notices for third-party code (see comments in `lib/archive.js`).
69
+ Apache-2.0 licensed; original license notices for third-party code are retained.
123
70
 
124
71
  ## License
125
72
 
package/README.md CHANGED
@@ -1,125 +1,72 @@
1
- # dsh-session-flow
1
+ # dsh-session-flow — DSH 会话回顾与归档插件
2
2
 
3
3
  > **中文** | [English](README.en.md)
4
4
 
5
- > DSH 会话信息流重设计插件:把 DSH 会话的原始消息流重构成「可折叠的信息流 + 会话级汇总」——跨会话档案柜。
5
+ DSH 会话的原始消息流重构成「可折叠的信息流 + 会话级汇总」:每个会话变成一张档案卡,跨工作区回顾、检索、导出。官方会话视图(Trajectory / Chat)长于正在发生的微观检查,本插件补足**事后回顾 / 归档 / 洞察**这一层。
6
6
 
7
- **一句话**:会话太多了,回看太慢?这个插件把 DSH 的每个会话变成一张「档案卡」——几秒看懂一次会话做了什么、干到哪一步、用过哪些工具、动过哪些文件,还能实时跟踪正在进行的会话。
7
+ ## 界面一览
8
8
 
9
- DSH([DeepSeek Harness](https://github.com/deepseek-ai/dsh))是 AI 智能体工作台。它的官方会话视图(Trajectory / Chat)长于「正在发生时」的微观检查;本插件补足**事后回顾 / 归档 / 洞察**这一层:跨会话、跨工作区的历史视角。
9
+ | 总览工作台 | 会话流标签页 |
10
+ |---|---|
11
+ | ![总览工作台](assets/screenshots/overview.png) | ![会话流标签页](assets/screenshots/session-flow-tab.png) |
12
+ | 会话卡片墙:标题、状态、结论摘要行、首个任务;hover ✎ 行内重命名 | 原生会话页内嵌「会话流」标签:当前会话直接回顾 |
10
13
 
11
- ---
14
+ | 轮次悬浮条 | 跨会话全文检索 |
15
+ |---|---|
16
+ | ![轮次悬浮条](assets/screenshots/turn-rail.png) | ![跨会话全文检索](assets/screenshots/fulltext-search.png) |
17
+ | 对话页左侧轮次导航:收拢短横条 ⇄ 展开条目卡,一键跳转任意轮次 | 总览自由文本搜索触发全文模式:跨工作区召回,命中直达定位 |
12
18
 
13
- ## 它能做什么
19
+ | 详情并入右栏 | 折叠详情页 |
20
+ |---|---|
21
+ | ![详情并入右栏](assets/screenshots/dock-right.png) | ![折叠详情页](assets/screenshots/folded-detail.png) |
22
+ | 详情并入官方右侧面板:主对话与会话流并行,拖拽调宽 | 回合默认折叠,展开按真实时间序;右侧四标签导航 |
23
+
24
+ ## 功能
14
25
 
15
26
  | 能力 | 说明 |
16
27
  |---|---|
17
- | 🗂️ **会话总览工作台** | 所有会话卡片化展示:标题、工作区、状态(进行中/已结束/空会话/子代理)、错误数、耗时、创建时间;支持排序与筛选,一眼找到目标会话 |
18
- | 🔍 **结构化搜索** | `tool:pwsh` 找用过某工具的会话、`file:src/` 找动过某路径的会话、`err:` 找有错误的会话,或直接搜自由文本(标题/工具名/文件路径) |
19
- | 📜 **折叠详情页** | 回合默认折叠成「用户发言 + 结论」两行摘要;展开后按**真实时间序**查看:思考 → 工具调用 → 回复,与发生顺序完全一致,不再被堆叠打乱 |
20
- | 🧭 **四标签导航** | 右侧面板:用户发言大纲 / 工具调用清单 / 错误列表 / 会话内全文检索——点击任意条目,正文区自动展开回合并滚动定位、高亮闪烁 |
21
- | 🌳 **子代理血缘树** | 主会话与子代理的派生关系树状展示;子代理详情复用折叠渲染;工具行「查看子代理」一键直达 |
22
- | 📝 **双模式摘要** | 每个会话自动生成摘要卡:**规则模式**(零开销,实时组装:任务数/首个任务/最近结论/工具 Top)+ **LLM 模式**(一键触发,调用 DSH 模型,按任务逐项概括;生成后落盘复用,有新对话自动提示重新生成) |
23
- | **实时跟踪** | 进行中的会话点「实时」:3 秒自动刷新最新进展,运行中的回合呼吸高亮 + 「正在生成…」动态标志,无需刷新页面 |
24
- | 📦 **ZIP 分卷导出** | 一键把完整会话导出为可读 Markdown 报告(`00-概览.md` + 时间线分卷,单卷 ≤700KB),打包成 ZIP 下载——归档、分享、转给同事都方便 |
25
- | 🧹 **缓存管理** | 索引与时间线缓存可视化查看、分类清理(仅清理本插件缓存,不影响 DSH 数据) |
28
+ | 总览工作台 | 会话卡片(状态/错误/耗时)+ 结论摘要行;排序、筛选、工作区 tabs |
29
+ | 结构化搜索 | `tool:` `file:` `err:` 前缀 + 自由文本 |
30
+ | 折叠详情页 | 回合折叠成「用户发言+结论」,展开按真实时间序;按需加载 |
31
+ | 四标签导航 | 用户发言 / 工具 / 错误 / 检索,点击定位高亮 |
32
+ | 血缘树 | 子代理派生关系树(离线档案 + 运行时实时双通道) |
33
+ | 双模式摘要 | 规则摘要(零开销实时组装)+ LLM 摘要(落盘复用、新对话提示重生成) |
34
+ | 实时跟踪 | 运行中会话 3 秒轮询,呼吸高亮 + 生成标志 |
35
+ | ZIP 导出 | 概览 + 时间线分卷 Markdown 报告 |
36
+ | 会话重命名 | 自定义标题显示层覆盖,随时恢复原名 |
37
+ | 会话流标签页 | 原生会话页内嵌标签,与工作台互跳 |
38
+ | 轮次悬浮条 | 对话页左侧轮次跳转(仅对话页显示) |
39
+ | 跨会话全文检索 | 内容级召回,命中直达会话流标签页定位 |
40
+ | 详情并入右栏 | 与主对话双视角并行 |
41
+ | 缓存管理 | 索引/时间线缓存查看与清理(不影响 DSH 数据) |
26
42
 
27
43
  ## 安装
28
44
 
29
- ### 方式一:从插件市场安装(推荐)
30
-
31
- 打开 DSH Web GUI 侧边栏的「插件市场」,搜索 `dsh-session-flow`,点击安装即可。
32
-
33
- ### 方式二:通过 npm 安装
34
-
35
45
  ```sh
46
+ # 插件市场搜索 dsh-session-flow,或:
36
47
  dsh plugin add dsh-session-flow
37
- ```
38
-
39
- ### 方式三:从 GitHub 安装
40
-
41
- ```sh
42
48
  dsh plugin add github:YeqingTang/dsh-session-flow
43
49
  ```
44
50
 
45
- ### 方式四:本地源码安装(开发/调试)
46
-
47
- ```sh
48
- git clone https://github.com/YeqingTang/dsh-session-flow.git
49
- dsh plugin add link:/path/to/dsh-session-flow
50
- ```
51
-
52
- ### 安装后的生效步骤
53
-
54
- 任何安装方式完成后:**重启 DSH Web 服务**,然后浏览器**硬刷新**(Ctrl+Shift+R / Ctrl+F5)。
55
- 侧边栏出现「**会话流**」入口即安装成功。
56
-
57
- ### 环境要求
58
-
59
- - DSH Web GUI(最新稳定版)
60
- - Node.js ≥ 22.19(使用内置 zstd 解码,零第三方依赖)
51
+ 安装后**重启 DSH Web 服务**并**硬刷新浏览器**(Ctrl+Shift+R),侧边栏出现「会话流」入口即成功。
61
52
 
62
- ## 使用指南
53
+ 环境要求:DSH Web GUI(最新稳定版);Node.js ≥ 22.19(内置 zstd 解码,零第三方依赖)。
63
54
 
64
- ### 1. 进入总览
55
+ ## 使用
65
56
 
66
- 点击侧边栏「**会话流**」→ 所有会话卡片化展示。支持:
67
-
68
- - **搜索**:顶部搜索框,支持结构化前缀与自由文本混用:
69
-
70
- | 语法 | 作用 | 示例 |
71
- |---|---|---|
72
- | `tool:xxx` | 用过该工具的会话 | `tool:pwsh` |
73
- | `file:xxx` | 动过该路径的会话 | `file:src/` |
74
- | `err:` | 有错误记录的会话 | `err:` |
75
- | 自由文本 | 标题/工作区/工具名/文件路径 | `会话流插件` |
76
-
77
- - **工作区 tabs**:按工作区筛选;**排序**:最近运行(默认)/最近创建/最早创建/工具最多/耗时最长
78
- - **统计条**:工具使用 Top 6 + 问题会话(有错误)一键筛选
79
-
80
- ### 2. 查看会话详情
81
-
82
- 点击任意会话卡片:
83
-
84
- - **回合默认折叠**:只显示「👤 用户发言 + ✅ 结论」摘要;点击回合头展开
85
- - **展开后**:按真实时间序查看思考(🧠)、工具调用(🛠️,含参数/结果/耗时/错误标记)、助手回复
86
- - **右侧导航**:用户发言 / 工具 / 错误 / 检索 四个标签,点击定位到正文对应位置(选中回合蓝色高亮)
87
- - **会话摘要卡**:顶部显示规则摘要;点「生成 LLM 摘要」获得智能摘要(按需消耗模型额度)
88
-
89
- ### 3. 跟踪实时会话
90
-
91
- 会话**进行中**时(头部显示「进行中」徽标):
92
-
93
- 1. 点右上角「**实时**」按钮
94
- 2. 时间线自动刷新(3 秒一次),运行中回合**绿色呼吸高亮** + 底部「正在生成…」动态标志
95
- 3. 点「退出实时」回到归档视图
96
-
97
- ### 4. 导出报告
98
-
99
- 详情页点「**导出报告 (ZIP)**」→ 下载 `会话报告-<标题>.zip`,解压即得:
100
-
101
- ```
102
- 00-概览.md # 会话元信息 + 摘要 + 工具统计 + 产物清单 + 分卷指引
103
- 01-时间线-回合1-25.md # 逐回合时间线(分卷,单卷 ≤700KB)
104
- 02-时间线-回合26-50.md # …
105
- ```
106
-
107
- Markdown 报告可直接用任意编辑器/VSCode/Typora 打开。
108
-
109
- ### 5. 缓存管理
110
-
111
- 总览页 →「缓存管理」:查看缓存体积、按需清理(时间线缓存 / 全部)。清理后首次访问自动重建,不影响会话数据。
57
+ - **总览**:侧边栏「会话流」→ 全部会话卡片。搜索支持 `tool:` / `file:` / `err:` 前缀;自由文本 ≥2 字符自动追加跨会话全文检索结果。
58
+ - **详情**:点卡片进入。回合默认折叠,点回合头展开;右侧四标签导航定位;顶部可生成 LLM 摘要、导出 ZIP、并入右栏、查看血缘。
59
+ - **原生会话页**:会话顶部「会话流」标签直接回顾当前会话;对话页左侧轮次悬浮条跳转任意轮次;标题 hover ✎ 重命名。
60
+ - **实时**:运行中会话点「实时」,3 秒自动刷新。
112
61
 
113
62
  ## 致谢
114
63
 
115
- 本插件站在 DSH 社区的肩膀上,感谢以下项目:
116
-
117
- - **[DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness)** —— DSH 智能体工作台与插件体系,本插件的运行基础。
118
- - **[@deepseek-ai/dsh-session-persistence-jsonl](https://github.com/deepseek-ai/deepseek-harness)** —— 会话存档的 zstd 多帧扫描算法(`lib/archive.js` 中 `scanZstdFrames` 借鉴自该项目,MIT 许可)。
119
- - **[dsh-web-ui(@linxin666 全家桶)](https://github.com/zhu1090093659/dsh-web-ui)** —— 侧边栏入口与中栏面板的挂载模式参照(DOM 级注入 + 面板互斥协作),未复制代码;含 dsh-task-board / dsh-ssh 等。
120
- - **[dsh-webui-market-plugin](https://www.npmjs.com/package/@sanqi-normal/dsh-webui-market-plugin)** —— 插件市场机制与本插件的分发渠道。
64
+ - **[DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness)** —— 运行基础。
65
+ - **[@deepseek-ai/dsh-session-persistence-jsonl](https://github.com/deepseek-ai/deepseek-harness)** —— zstd 多帧扫描算法(`lib/archive.js` 借鉴,MIT 许可)。
66
+ - **[dsh-web-ui(@linxin666 全家桶)](https://github.com/zhu1090093659/dsh-web-ui)** —— 侧边栏入口与面板挂载模式参照,未复制代码。
67
+ - **[dsh-webui-market-plugin](https://www.npmjs.com/package/@sanqi-normal/dsh-webui-market-plugin)** —— 插件市场机制与分发渠道。
121
68
 
122
- > 版权归各自作者所有;本插件遵循 Apache-2.0 许可,使用第三方代码时保留其原始许可声明(见 `lib/archive.js` 注释)。
69
+ 本插件遵循 Apache-2.0 许可,使用第三方代码时保留其原始许可声明。
123
70
 
124
71
  ## 许可
125
72
 
Binary file
Binary file
package/lib/archive.js CHANGED
@@ -129,6 +129,22 @@ export function parseSession(plaintext) {
129
129
  const isErrorBlock = (block) =>
130
130
  block !== null && typeof block === 'object' && block.type === 'tool-result' && block.isError === true
131
131
 
132
+ /** 候选 B:消息 content 的 text 块拼接(与 timeline.js textTextOf 同口径,内联避免循环依赖)。 */
133
+ const textOf = (content) => {
134
+ if (!Array.isArray(content)) return ''
135
+ return content
136
+ .filter((b) => b && b.type === 'text' && typeof b.text === 'string')
137
+ .map((b) => b.text)
138
+ .join('\n')
139
+ .trim()
140
+ }
141
+
142
+ /** 候选 B:截断预览(与 timeline.js preview 同口径)。 */
143
+ const previewText = (text, max) => {
144
+ const t = String(text || '')
145
+ return t.length > max ? t.slice(0, max) + '…' : t
146
+ }
147
+
132
148
  /** 从解析结果派生会话摘要(索引用,纯规则统计)。 */
133
149
  export function summarizeParsed({ header, title, events }) {
134
150
  const counts = {}
@@ -143,6 +159,9 @@ export function summarizeParsed({ header, title, events }) {
143
159
  let steps = 0
144
160
  let todos = 0
145
161
  let lastError = null
162
+ // 候选 B:最近结论(最后一条有正文的 assistant 消息)+ 首个任务(第一个真实用户发言)。
163
+ let lastConclusion = null
164
+ let firstTask = null
146
165
  const toolNames = new Set()
147
166
  const artifactPaths = new Set()
148
167
  for (const ev of events) {
@@ -168,8 +187,24 @@ export function summarizeParsed({ header, title, events }) {
168
187
  lastError = { seq: ev.seq, time: ev.time }
169
188
  }
170
189
  break
171
- case 'user/message': userMessages++; break
172
- case 'assistant/message': assistantMessages++; break
190
+ case 'user/message':
191
+ userMessages++
192
+ // 候选 B:首个任务 = 第一个真实用户发言(source.kind 为空或 user,排除 plugin/goal 注入)。
193
+ if (firstTask === null) {
194
+ const kind = ev.data && ev.data.source ? String(ev.data.source.kind || '') : ''
195
+ if (kind === '' || kind === 'user') {
196
+ firstTask = previewText(textOf(ev.data && ev.data.content), 200) || null
197
+ }
198
+ }
199
+ break
200
+ case 'assistant/message':
201
+ assistantMessages++
202
+ // 候选 B:最近结论 = 最后一条有正文的 assistant 消息(每次覆盖 → 最终为最后一条)。
203
+ {
204
+ const text = textOf(ev.data && ev.data.message && ev.data.message.content)
205
+ if (text) lastConclusion = previewText(text, 500)
206
+ }
207
+ break
173
208
  case 'turn/start': turns++; break
174
209
  case 'step/start': steps++; break
175
210
  case 'todo/write': todos++; break
@@ -203,6 +238,9 @@ export function summarizeParsed({ header, title, events }) {
203
238
  toolNames: [...toolNames].sort(),
204
239
  // 去重路径列表(M5c 文件检索索引,上限 60 条)。
205
240
  artifactPaths: [...artifactPaths],
241
+ // 候选 B:最近结论 / 首个任务(null = 无正文结论 / 无真实用户发言)。
242
+ lastConclusion,
243
+ firstTask,
206
244
  // 空会话:新建后未发生任何实质对话(无用户消息、无工具调用、无回合)。
207
245
  empty: userMessages === 0 && toolCalls === 0 && turns === 0,
208
246
  }