dsh-session-find 0.0.0-stage → 1.4.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/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ ## 1.4.0 — 2026-10-18
4
+
5
+ - **Copy / export Markdown**: header buttons copy the current result set, or save it as `.md`; the document has an H1, a metadata block (scope, options, timestamp, match count) and `### 第 N 轮` sections with `- **source** — snippet` rows.
6
+ - **Search options row**: regex (`.*`), case-sensitive (`Aa`), whole word (`ab`); invalid patterns are reported inline instead of failing silently. Options persist in localStorage.
7
+ - Regex mode wraps the pattern in lookbehind/lookahead for whole-word matching and skips zero-length matches so `*` style patterns cannot loop.
8
+
9
+ ## 1.3.0
10
+
11
+ - **Turn derivation and grouping**: each row carries the turn it belongs to (count of `user` nodes up to that point), and the list is grouped under turn headers.
12
+ - **Query history**: last 12 queries, `↑`/`↓` in the input; last query is restored when the panel reopens.
13
+ - **Navigation**: `Ctrl+G` / `F3` (Shift to reverse), `↑`/`↓` row selection when the input is not focused.
14
+ - **Highlight all matches** in the conversation, not just the active one.
15
+ - **Prose mode payload toggle** no longer resets on every keystroke and gets its own wording; "excluded N" is now clickable and switches to full-content search.
16
+
17
+ ## 1.2.0
18
+
19
+ - **Prose-only scope** (default): search your messages and assistant replies only, with a one-click switch to everything and an "excluded N matches" counter.
20
+
21
+ ## 1.1.0
22
+
23
+ - **Wider panel** (up to 820px) and a 3-line snippet per row.
24
+ - **Source classification**: you / assistant / reasoning / tool call / tool result / system, with a filter bar and per-source counts.
25
+ - **Friendly rows**: source chip, turn chip, `同文 ×N`, hit count per row.
26
+
27
+ ## 1.0.0
28
+
29
+ - `Ctrl+F` panel over the loaded conversation: results list, click to jump, CSS Custom Highlight API highlighting, same-text merging, collapsed-step expansion.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fomalhaut
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.en.md ADDED
@@ -0,0 +1,72 @@
1
+ # dsh-session-find
2
+
3
+ **Find in session** for DeepSeek Harness: press `Ctrl+F` to search the current conversation, click a hit to jump to that message, with every match highlighted.
4
+
5
+ Client-only, zero dependencies, no network — all searching happens in the browser, nothing leaves your machine.
6
+
7
+ [中文](README.md) · [Changelog](CHANGELOG.md)
8
+
9
+ ![Find panel](assets/overview.png)
10
+
11
+ ## Why
12
+
13
+ Harness conversations run for dozens of turns and interleave prose with tool calls and long JSON. The browser's built-in find only sees *rendered, visible* text: it misses collapsed steps, tool arguments and reasoning, and it cannot tell you who said what, or in which turn.
14
+
15
+ This plugin makes search conversation-native:
16
+
17
+ | Capability | What it does |
18
+ |---|---|
19
+ | Source labels | Every hit is tagged **you / assistant / reasoning / tool call / tool result / system**, and can be filtered by source |
20
+ | Turn grouping | Results are grouped under 「第 N 轮」 (turn N) headers, with a per-row turn chip |
21
+ | Same-text merging | Identical snippets (e.g. repeated tool output) collapse into one row marked `同文 ×N` |
22
+ | Prose vs everything | Defaults to **prose only** (your messages + assistant replies); one click searches reasoning, tool payloads and system prompts too, showing how many hits were excluded |
23
+ | Regex / case / whole word | For tokens like `m0\d{3}`, `session-`, `D:\\DSH`; whole-word applies to ASCII words only |
24
+ | Highlight everything | All matches are highlighted in the conversation; the active hit gets an outline |
25
+ | Copy / export | Copy results as Markdown (turn + source + snippet) or save a `.md` file |
26
+ | Persisted state | Query, scope, regex flags and the last 12 queries live in localStorage (`↑`/`↓` in the input recalls history) |
27
+
28
+ ## Install
29
+
30
+ ```sh
31
+ # npm (`--profile` defaults to the current profile)
32
+ dsh plugin add dsh-session-find
33
+ dsh plugin --profile desktop add dsh-session-find
34
+
35
+ # or track main
36
+ dsh plugin add github:fomalhaut1998/dsh-session-find
37
+ ```
38
+
39
+ Fully quit and restart DSH once: client bundles are assembled at host startup and are not hot-loaded. After that, editing `client.js` only needs a page reload.
40
+
41
+ Remove: `dsh plugin remove dsh-session-find` (also accepts `--profile`).
42
+
43
+ ## Shortcuts
44
+
45
+ | Key | Action |
46
+ |---|---|
47
+ | `Ctrl+F` | Open / close the panel |
48
+ | `Enter` / `Shift+Enter` | Next / previous hit |
49
+ | `Ctrl+G` / `F3` (with `Shift` to reverse) | Same, for editor habits |
50
+ | `↑` / `↓` | In the input: recall query history. In the list (input not focused): move the selection |
51
+ | `Esc` | Close the panel (highlights stay until the next search) |
52
+
53
+ ## How it works
54
+
55
+ - Reads the conversation store's canonical `order` node by node (`nodeStore.get(key)`) instead of walking the DOM, so collapsed steps and unrendered tool payloads are searchable.
56
+ - Projects each node into source-tagged fragments; prose mode concatenates only `user` + `assistant` text, and "excluded N" is the difference to the full hit count.
57
+ - Jumping expands the target turn/step first, then converges with a turn-level binary search plus a single-direction `scrollTop`, falling back to content matching when keys disagree.
58
+ - Highlighting uses the CSS Custom Highlight API, so the DOM is never mutated and React rendering is untouched.
59
+ - `index.js` `apply()` is empty: no IPC, no background index, no requests.
60
+
61
+ ## Limitations
62
+
63
+ | Limit | Why |
64
+ |---|---|
65
+ | Only **loaded** history | The session is paged in on demand; unloaded messages are not in the store |
66
+ | Result list capped at 300 rows | A scrolling panel beyond that is not usable; the match count itself is uncapped |
67
+ | Whole-word is ASCII-only | Chinese has no word boundaries, so the option only applies to pure ASCII queries |
68
+ | No cross-session search | That needs a host-side index; out of scope for v1 |
69
+
70
+ ## License
71
+
72
+ MIT
package/README.md CHANGED
@@ -1,3 +1,103 @@
1
- # Temporary Holding Version
1
+ # dsh-session-find
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
+ DeepSeek Harness 的**会话内查找**:按 `Ctrl+F` 在当前对话里全文搜索,点结果跳到那条消息并高亮。
4
+
5
+ 纯客户端插件、零依赖、不联网——所有搜索都在浏览器里完成,会话内容不出本机。
6
+
7
+ [English](README.en.md) · [更新日志](CHANGELOG.md)
8
+
9
+ ![会话内查找面板](assets/overview.png)
10
+
11
+ ## 它解决什么问题
12
+
13
+ Harness 的对话动辄几十轮、正文里混着工具调用与长 JSON,原生页内查找(Ctrl+F 开浏览器搜索框)只能命中**渲染出来的可见文字**,找不到折叠的步骤、工具参数、思考内容,也不会告诉你「这条是谁说的、第几轮」。
14
+
15
+ 这个插件把查找做成对话原生的:
16
+
17
+ | 能力 | 说明 |
18
+ |---|---|
19
+ | 来源分类 | 每条命中标出来源:**你 / 助手 / 思考 / 工具调用 / 工具输出 / 系统**,可按来源过滤 |
20
+ | 轮次分组 | 结果按「第 N 轮」分组,行内也带 `第 N 轮` 标签,一眼看出上下文位置 |
21
+ | 同文合并 | 同一段文字在多处出现(比如重复的工具返回)合并成一条 `同文 ×N` |
22
+ | 正文 / 全量 | 默认只搜**正文**(你发的 + 助手回复),一键切到搜全部内容(含思考、工具参数、系统提示),并显示「已排除 N 处」 |
23
+ | 正则 · Aa · 全词 | 查 `m0\d{3}`、`session-`、`D:\\DSH` 这类 token 时用;全词只对英文/数字词生效 |
24
+ | 全量高亮 | 命中的每一处都在对话里高亮,当前选中的那条额外描边 |
25
+ | 复制 / 导出 | 一键把结果复制成 Markdown(轮次 + 来源 + 片段),或导出 `.md` 文件 |
26
+ | 记住状态 | 查询词、搜索范围、正则开关、历史记录(最近 12 条,输入框里 ↑↓ 调取)都记在 localStorage |
27
+
28
+ ## 安装
29
+
30
+ ```sh
31
+ # 从 npm 装(--profile 省略时改默认 profile)
32
+ dsh plugin add dsh-session-find
33
+ dsh plugin --profile desktop add dsh-session-find
34
+
35
+ # 或从 GitHub 装(跟踪 main)
36
+ dsh plugin add github:fomalhaut1998/dsh-session-find
37
+
38
+ # 本地开发:profile 的 package.json 里
39
+ # dependencies["dsh-session-find"] = "link:/path/to/dsh-session-find"
40
+ # 再把 "dsh-session-find" 加进 dsh.profile.bundles(走 CLI remove → add 会自动写)
41
+ ```
42
+
43
+ 装完**完全退出 DSH 再启动**:客户端 bundle 在宿主启动时组装,新插件不会在运行中热加载。之后改 `client.js` 只需刷新页面(桌面端 Ctrl+R)。
44
+
45
+ 卸载:`dsh plugin remove dsh-session-find`(同样支持 `--profile`)。
46
+
47
+ ## 快捷键
48
+
49
+ | 按键 | 动作 |
50
+ |---|---|
51
+ | `Ctrl+F` | 打开 / 关闭查找面板(焦点在输入框时再次按下也关闭) |
52
+ | `Enter` / `Shift+Enter` | 下一个 / 上一个命中 |
53
+ | `Ctrl+G` / `F3`(`Shift` 反向) | 同上,来自编辑器习惯 |
54
+ | `↑` / `↓` | 输入框里:调取历史查询;列表里(焦点不在输入框):逐条选结果 |
55
+ | `Esc` | 关闭面板(保留对话里的高亮,直到再次搜索) |
56
+ | `Tab` / 点击 | 在「只在正文里搜」「正则 / Aa / 全词」「来源筛选」之间移动 |
57
+
58
+ ## 一个例子
59
+
60
+ ```
61
+ Ctrl+F → 输入 dsh → 面板顶部:198 处匹配 · 已合并 3 条同文 · 已排除 6347 处
62
+ 点「Aa」→ 156 处匹配(只剩大小写完全一致的)
63
+ 点「只在正文里搜」→ 只保留你和助手说过的话,工具 JSON 里的命中被排除
64
+ ```
65
+
66
+ 数字都是实测口径:**匹配数**是全部命中(含同文重复),**列出的条数**是合并去重后能点开的行。
67
+
68
+ ## 复制 / 导出的格式
69
+
70
+ ```markdown
71
+ # 检索:工具
72
+
73
+ > 只在正文里搜 · 2026/10/18 14:56:48
74
+ > 45 处匹配 · 列出 1 条
75
+
76
+ ### 第 4 轮
77
+
78
+ - **你** — …g 我自己的这个插件,有以下地方可以优化一下: 1、横向的长度可以长一点…
79
+ ```
80
+
81
+ 直接粘进笔记 / issue / 文档就能用。
82
+
83
+ ## 实现要点
84
+
85
+ - **数据来源**:从对话 store 的 canonical `order` 逐条读节点(`nodeStore.get(key)`),而不是抓 DOM——所以折叠的步骤、未渲染的工具参数都能搜到。
86
+ - **命中投影**:每个节点把内容拆成带来源标记的片段(`role`),正文模式只拼 `user` + `assistant` 的文本;「已排除 N 处」= 全量命中数 − 正文命中数。
87
+ - **定位**:点结果时先把所在轮次/步骤展开,再按轮次二分 + 单向 `scrollTop` 收敛到目标行;key 对不上时按内容兜底,因此长会话里也是稳定的一两步滚动。
88
+ - **高亮**:CSS Custom Highlight API(`::highlight(dsh-session-find)` 与 `::highlight(dsh-session-find-all)`),不改 DOM、不打断 React 渲染。
89
+ - **零宿主依赖**:`index.js` 的 `apply()` 是空的,没有 IPC、没有后台索引、不发网络请求。
90
+
91
+ ## 已知限制
92
+
93
+ | 限制 | 原因 |
94
+ |---|---|
95
+ | 只搜**已加载**的历史 | 会话是按需分页加载的;未加载的旧消息不在 store 里 |
96
+ | 结果列表上限 300 条 | 面板是滚动列表,再多也没人点;匹配总数不受限 |
97
+ | 全词只对 ASCII 生效 | 中文没有词边界,"全词"对中文无意义,所以只在查询是纯英文/数字时启用 |
98
+ | 不跨会话搜索 | 需要宿主索引,属于另一个量级的功能,未做 |
99
+ | 折叠步骤里的命中 | 会跳到所在回合并提示「已跳到所在回合」 |
100
+
101
+ ## License
102
+
103
+ MIT
Binary file
Binary file