my-dsh-message-search 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 myhylijp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,60 @@
1
- # Temporary Holding Version
1
+ # my-dsh-message-search
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
4
+
5
+ 全屏消息检索面板,`Ctrl+F` 打开:按「当前会话 / 工作区 / 全部会话」检索消息正文,
6
+ 命中按时间倒序列出(会话标题、工作区、角色、时间、高亮片段),`Enter` 打开所在会话。
7
+
8
+ ## 为什么不用 sessionQuery
9
+
10
+ DSH 自带的内容检索基于 `session-query-sqlite` 索引。它建索引时会把历史会话日志迁移到 v4,
11
+ 遇到「`step/end` 带未闭合工具调用」的旧日志会整体失败:
12
+
13
+ ```
14
+ SessionQueryError: session-search persistence observation failed:
15
+ Session migration from v0 to v4 refuses the transformed artifact:
16
+ step/end leaves unresolved tool call call_00_...
17
+ ```
18
+
19
+ 一条坏日志就让整次检索报错。本插件改成 **Host 自己扫日志**:
20
+
21
+ - 读 `<dshHome>/sessions/<工作区分组>/<session-*>/session.*.jsonl.zstd`;
22
+ - DSH 按追加帧写 zstd,所以按帧魔数切片逐帧解压,再逐行解析 JSONL;
23
+ - 只索引 `user/message` 与 `assistant/message` 的 `text` 部分(忽略 reasoning 与 tool-call);
24
+ - 单个会话解析失败 → 跳过并计数(页脚显示"跳过 N 个"),**不会让检索失败**;
25
+ - 解析结果按 (mtime, size) 缓存,重复检索不重读磁盘。
26
+
27
+ ## 范围与数据
28
+
29
+ | 范围 | 依据 |
30
+ |---|---|
31
+ | 当前会话 | 由 `conversation.input.dock` 的探针发布当前 session id |
32
+ | 工作区 | `storages/workspace.json` 里该工作区的 `sessionIds` |
33
+ | 全部会话 | 磁盘上所有会话目录 |
34
+
35
+ 命中里的标题取 `session/title` 事件(没有就退回首条用户消息),工作区名取 `workspace.json`。
36
+
37
+ ## 页面
38
+
39
+ - 顶部:标题 + 用时;搜索框 + 范围分段控件 + 工作区菜单,三者同一行、同一个框线内。
40
+ - **边输边搜**:输入停顿 250ms 自动检索,不用回车;切范围、切工作区同样立即重搜。
41
+ 回车的作用变成"打开当前选中的一条"(结果还没出来时会立刻搜一次)。
42
+ - 列表:角色徽标(我 / 助手)、会话标题、工作区、时间、单条多处命中计数、两行片段 + 关键词高亮。
43
+ - 页脚:键盘提示 + 本次范围(会话数 / 消息数 / 跳过数)。
44
+ - `↑↓` 选择、`Enter` 打开、`Esc` 关闭、点击遮罩关闭。
45
+ - 点击结果会打开所在会话并**滚动定位到该段落**(文本归一化比对 + 高亮 2.6s;目标未加载时先顶上触发「加载更早」再重试)。
46
+
47
+ ## 配置
48
+
49
+ ```yaml
50
+ - id: message-search
51
+ name: 'my-dsh-message-search'
52
+ config:
53
+ maxHits: 200 # 一次检索最多返回多少条命中
54
+ ```
55
+
56
+ ## 边界
57
+
58
+ - 只检索消息正文,不搜工具调用参数与工具输出;需要更细的检索维度再加字段。
59
+ - 全部会话范围会解压所有日志(当前约十几 MB,可接受);会话量很大时应改为增量索引文件。
60
+ - Host 侧代码不热替换:升级 `host.js` 后需要重启应用。