dsh-ws-recency 0.31.0 → 0.31.1
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 +3 -1
- package/client.js +112 -3
- package/index.js +14 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -167,7 +167,9 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
|
|
|
167
167
|
|
|
168
168
|
- 搜的是**对话正文**:你的提问 + 助手的回复;不搜思维链、不搜工具参数和工具结果(那些会让命中被日志噪声淹没);
|
|
169
169
|
- 多个词用空格分隔,**要求同时出现在同一条消息里**(AND);大小写不敏感,纯字面匹配,不支持正则;
|
|
170
|
-
-
|
|
170
|
+
- 范围用**控件**选,不用记语法:搜索框下面有「工作区」下拉、「会话标题」输入框、「角色」三个按钮(全部 / 我 / 助手)。改控件会用当前关键词自动重搜;
|
|
171
|
+
- 搜索框里仍然可以写匹配方式:`"一个词组"`(整句匹配)、`a|b` 或 `a or b`(任一即可)、`-词`(排除);
|
|
172
|
+
- 想用键盘也行:`ws:工作区`、`in:会话标题`、`role:user|assistant`,中文别名 `工作区:` / `会话:` / `角色:` 同样可用。控件与语法同时给出时,**以控件为准**(那是屏幕上看得见的选择);
|
|
171
173
|
- 结果按新到旧排列,每条给出角色、会话标题、所属工作区、第几轮/第几步,以及带高亮的片段;
|
|
172
174
|
- 每条结果有两个动作:`看上下文` 在行内展开命中处前后各约 400 字(不碰聊天区,长会话也不卡),`打开会话` 才真的跳转;
|
|
173
175
|
- 搜索过的词会记进「最近搜索」,点一下重搜、点 × 删一条、右侧「清空」全清,重启后还在。
|
package/client.js
CHANGED
|
@@ -362,6 +362,13 @@
|
|
|
362
362
|
".wsr-hit-context-toggle,.wsr-hit-context-jump{border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.14));background:0 0;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:11px;line-height:18px;padding:0 8px;border-radius:9px;cursor:pointer}",
|
|
363
363
|
".wsr-hit-context-toggle:hover,.wsr-hit-context-jump:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l3,rgba(255,255,255,.24))}",
|
|
364
364
|
".wsr-hit-context{max-height:38vh;overflow:auto;margin-top:4px;padding:6px 8px;border-radius:6px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));color:var(--dsw-alias-label-secondary);font-size:11px;line-height:1.65;white-space:pre-wrap;word-break:break-word}",
|
|
365
|
+
".wsr-search-filters{display:flex;flex-wrap:wrap;align-items:center;gap:10px;font-size:11px;color:var(--dsw-alias-label-tertiary)}",
|
|
366
|
+
".wsr-filter{display:inline-flex;align-items:center;gap:5px}",
|
|
367
|
+
".wsr-filter-label{flex:none}",
|
|
368
|
+
".wsr-filter-select,.wsr-filter-input{height:22px;border-radius:6px;border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.16));background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.05));color:var(--dsw-alias-label-primary);font:inherit;font-size:11px;padding:0 6px;max-width:180px}",
|
|
369
|
+
".wsr-filter-input{width:130px}",
|
|
370
|
+
".wsr-filter-chip{height:22px;padding:0 9px;border-radius:999px;border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.16));background:0 0;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:11px;cursor:pointer}",
|
|
371
|
+
".wsr-filter-chip-on{color:var(--dsw-alias-label-primary);border-color:color-mix(in srgb,var(--dsw-alias-brand-primary,#4f9df7) 55%,transparent);background:color-mix(in srgb,var(--dsw-alias-brand-primary,#4f9df7) 14%,transparent)}",
|
|
365
372
|
".wsr-search-hint{font-size:11px;line-height:1.5;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}",
|
|
366
373
|
".wsr-search-history{display:flex;align-items:center;flex-wrap:wrap;gap:6px;font-size:11px;color:var(--dsw-alias-label-tertiary)}",
|
|
367
374
|
".wsr-search-history-label{flex:none}",
|
|
@@ -512,7 +519,12 @@
|
|
|
512
519
|
"search.contextShow": "看上下文",
|
|
513
520
|
"search.contextHide": "收起",
|
|
514
521
|
"search.openSession": "打开会话",
|
|
515
|
-
"search.hint": "空格=都要有 · \"词组\" · a|b 或 · -排除
|
|
522
|
+
"search.hint": "空格=都要有 · \"词组\" · a|b 或 · -排除",
|
|
523
|
+
"search.filterWorkspace": "工作区",
|
|
524
|
+
"search.filterSession": "会话标题",
|
|
525
|
+
"search.filterSessionPlaceholder": "包含…(回车)",
|
|
526
|
+
"search.filterRole": "角色",
|
|
527
|
+
"search.filterAll": "全部",
|
|
516
528
|
"search.history": "最近搜索",
|
|
517
529
|
"search.historyRun": "再搜一次:{query}",
|
|
518
530
|
"search.historyDrop": "从历史里删除",
|
|
@@ -718,7 +730,12 @@
|
|
|
718
730
|
"search.contextShow": "Show context",
|
|
719
731
|
"search.contextHide": "Hide",
|
|
720
732
|
"search.openSession": "Open session",
|
|
721
|
-
"search.hint": "space = all of them · \"phrase\" · a|b either · -exclude
|
|
733
|
+
"search.hint": "space = all of them · \"phrase\" · a|b either · -exclude",
|
|
734
|
+
"search.filterWorkspace": "Workspace",
|
|
735
|
+
"search.filterSession": "Session",
|
|
736
|
+
"search.filterSessionPlaceholder": "title contains… (Enter)",
|
|
737
|
+
"search.filterRole": "Role",
|
|
738
|
+
"search.filterAll": "All",
|
|
722
739
|
"search.history": "Recent",
|
|
723
740
|
"search.historyRun": "Search again: {query}",
|
|
724
741
|
"search.historyDrop": "Remove from history",
|
|
@@ -3903,6 +3920,14 @@
|
|
|
3903
3920
|
|
|
3904
3921
|
/* ---------- session content search -------------------------------- */
|
|
3905
3922
|
|
|
3923
|
+
/**
|
|
3924
|
+
* Narrowing chosen through controls rather than typed syntax.
|
|
3925
|
+
*
|
|
3926
|
+
* Typing `ws:` is a sentence to learn; a select is not. The typed forms
|
|
3927
|
+
* still work, and both are merged on the host.
|
|
3928
|
+
*/
|
|
3929
|
+
var searchFilters = { workspace: "", session: "", role: "" };
|
|
3930
|
+
|
|
3906
3931
|
/** How many recent queries the panel remembers. */
|
|
3907
3932
|
var SEARCH_HISTORY_MAX = 12;
|
|
3908
3933
|
|
|
@@ -4666,6 +4691,12 @@
|
|
|
4666
4691
|
setView(next);
|
|
4667
4692
|
};
|
|
4668
4693
|
|
|
4694
|
+
/* Changing a filter with a query on screen should show the effect at
|
|
4695
|
+
once instead of waiting for another Enter. */
|
|
4696
|
+
var rerun = function () {
|
|
4697
|
+
if (view.query !== "") run(view.query, false);
|
|
4698
|
+
};
|
|
4699
|
+
|
|
4669
4700
|
var run = function (text, refresh) {
|
|
4670
4701
|
var query = typeof text === "string" ? text.trim() : "";
|
|
4671
4702
|
searchGeneration += 1;
|
|
@@ -4677,7 +4708,13 @@
|
|
|
4677
4708
|
if (typeof actions.pushSearch === "function") actions.pushSearch(query);
|
|
4678
4709
|
commit({ loaded: true, query: query, hits: view.hits, terms: view.terms, scanned: view.scanned, total: view.total, pending: view.pending, took: view.took, busy: true, error: "" });
|
|
4679
4710
|
var ask = function (needRefresh) {
|
|
4680
|
-
searchPost({
|
|
4711
|
+
searchPost({
|
|
4712
|
+
query: query,
|
|
4713
|
+
refresh: needRefresh === true,
|
|
4714
|
+
workspace: searchFilters.workspace,
|
|
4715
|
+
session: searchFilters.session,
|
|
4716
|
+
role: searchFilters.role,
|
|
4717
|
+
}).then(function (answer) {
|
|
4681
4718
|
if (generation !== searchGeneration) return;
|
|
4682
4719
|
var json = answer.json;
|
|
4683
4720
|
if (json === null || json.ok !== true) {
|
|
@@ -4774,6 +4811,78 @@
|
|
|
4774
4811
|
},
|
|
4775
4812
|
}, t("search.historyClear")),
|
|
4776
4813
|
),
|
|
4814
|
+
h("div", { className: "wsr-search-filters" },
|
|
4815
|
+
h("label", { className: "wsr-filter" },
|
|
4816
|
+
h("span", { className: "wsr-filter-label" }, t("search.filterWorkspace")),
|
|
4817
|
+
h("select", {
|
|
4818
|
+
className: "wsr-filter-select",
|
|
4819
|
+
value: searchFilters.workspace,
|
|
4820
|
+
onChange: function (event) {
|
|
4821
|
+
searchFilters.workspace = event.target.value || "";
|
|
4822
|
+
rerun();
|
|
4823
|
+
},
|
|
4824
|
+
},
|
|
4825
|
+
h("option", { value: "" }, t("search.filterAll")),
|
|
4826
|
+
(function () {
|
|
4827
|
+
var items = data.workspaces !== null && data.workspaces !== undefined
|
|
4828
|
+
&& Array.isArray(data.workspaces.items) ? data.workspaces.items : [];
|
|
4829
|
+
var options = [];
|
|
4830
|
+
for (var wi = 0; wi < items.length; wi += 1) {
|
|
4831
|
+
var name = typeof items[wi].name === "string" && items[wi].name !== ""
|
|
4832
|
+
? items[wi].name
|
|
4833
|
+
: String(items[wi].title || "");
|
|
4834
|
+
if (name === "") continue;
|
|
4835
|
+
options.push(h("option", { value: name, key: "ws:" + name }, name));
|
|
4836
|
+
}
|
|
4837
|
+
return options;
|
|
4838
|
+
})(),
|
|
4839
|
+
),
|
|
4840
|
+
),
|
|
4841
|
+
h("label", { className: "wsr-filter" },
|
|
4842
|
+
h("span", { className: "wsr-filter-label" }, t("search.filterSession")),
|
|
4843
|
+
h("input", {
|
|
4844
|
+
type: "text",
|
|
4845
|
+
className: "wsr-filter-input",
|
|
4846
|
+
defaultValue: searchFilters.session,
|
|
4847
|
+
placeholder: t("search.filterSessionPlaceholder"),
|
|
4848
|
+
onChange: function (event) {
|
|
4849
|
+
searchFilters.session = String(event.target.value || "").trim();
|
|
4850
|
+
},
|
|
4851
|
+
onKeyDown: function (event) {
|
|
4852
|
+
if (event !== undefined && event.key === "Enter") {
|
|
4853
|
+
event.preventDefault();
|
|
4854
|
+
rerun();
|
|
4855
|
+
}
|
|
4856
|
+
},
|
|
4857
|
+
}),
|
|
4858
|
+
),
|
|
4859
|
+
h("span", { className: "wsr-filter" },
|
|
4860
|
+
h("span", { className: "wsr-filter-label" }, t("search.filterRole")),
|
|
4861
|
+
(function () {
|
|
4862
|
+
var roles = [
|
|
4863
|
+
["", "search.filterAll"],
|
|
4864
|
+
["user", "search.you"],
|
|
4865
|
+
["assistant", "search.assistant"],
|
|
4866
|
+
];
|
|
4867
|
+
var buttons = [];
|
|
4868
|
+
for (var ri = 0; ri < roles.length; ri += 1) {
|
|
4869
|
+
(function (value, label) {
|
|
4870
|
+
var active = searchFilters.role === value;
|
|
4871
|
+
buttons.push(h("button", {
|
|
4872
|
+
type: "button",
|
|
4873
|
+
key: "role:" + value,
|
|
4874
|
+
className: "wsr-filter-chip" + (active ? " wsr-filter-chip-on" : ""),
|
|
4875
|
+
onClick: function () {
|
|
4876
|
+
searchFilters.role = value;
|
|
4877
|
+
rerun();
|
|
4878
|
+
},
|
|
4879
|
+
}, t(label)));
|
|
4880
|
+
})(roles[ri][0], roles[ri][1]);
|
|
4881
|
+
}
|
|
4882
|
+
return buttons;
|
|
4883
|
+
})(),
|
|
4884
|
+
),
|
|
4885
|
+
),
|
|
4777
4886
|
h("div", { className: "wsr-search-hint" }, t("search.hint")),
|
|
4778
4887
|
h("div", { className: "wsr-search-bar" },
|
|
4779
4888
|
input,
|
package/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import { dirname, join } from "node:path";
|
|
|
32
32
|
export const name = "ws-recency";
|
|
33
33
|
|
|
34
34
|
/** Version marker reported by the health route. */
|
|
35
|
-
export const HOST_VERSION = "0.31.
|
|
35
|
+
export const HOST_VERSION = "0.31.1";
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Exact routes the client half calls. Registered on the bare web server, so they
|
|
@@ -966,6 +966,11 @@ function matchesQuery(parsed, haystack) {
|
|
|
966
966
|
export async function searchSessions(ctx, query, options = {}) {
|
|
967
967
|
const started = Date.now();
|
|
968
968
|
const parsed = parseSearchQuery(query);
|
|
969
|
+
/* A control and a typed filter can both say something; the control wins because
|
|
970
|
+
it is the one on screen. */
|
|
971
|
+
if (typeof options.workspace === "string" && options.workspace.trim() !== "") parsed.filters.workspace = options.workspace.trim().toLowerCase();
|
|
972
|
+
if (typeof options.session === "string" && options.session.trim() !== "") parsed.filters.session = options.session.trim().toLowerCase();
|
|
973
|
+
if (typeof options.role === "string" && options.role.trim() !== "") parsed.filters.role = options.role.trim().toLowerCase();
|
|
969
974
|
const terms = parsed.terms;
|
|
970
975
|
const hasFilter = parsed.filters.workspace !== "" || parsed.filters.session !== ""
|
|
971
976
|
|| parsed.filters.role !== "";
|
|
@@ -2387,7 +2392,14 @@ export async function handleSearchRequest(ctx, req, res) {
|
|
|
2387
2392
|
try {
|
|
2388
2393
|
const body = await readJsonBody(req);
|
|
2389
2394
|
const query = body !== null && typeof body.query === "string" ? body.query : "";
|
|
2390
|
-
|
|
2395
|
+
/* The panel's controls arrive as fields; typed `ws:` / `in:` / `role:` still
|
|
2396
|
+
work and the two are merged. */
|
|
2397
|
+
const result = await searchSessions(ctx, query, {
|
|
2398
|
+
refresh: body !== null && body.refresh === true,
|
|
2399
|
+
workspace: body !== null && typeof body.workspace === "string" ? body.workspace : "",
|
|
2400
|
+
session: body !== null && typeof body.session === "string" ? body.session : "",
|
|
2401
|
+
role: body !== null && typeof body.role === "string" ? body.role : "",
|
|
2402
|
+
});
|
|
2391
2403
|
sendJson(res, 200, result);
|
|
2392
2404
|
} catch (error) {
|
|
2393
2405
|
sendJson(res, 500, { ok: false, error: error instanceof Error ? error.message : String(error) });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ws-recency",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"description": "Sidebar session management for DeepSeek Harness: workspace groups sorted by latest activity, stale history folded, a global pinned section, follow-up marks, session delete into a recoverable trash, archived sessions managed from that same trash panel, per-session token statistics with an argument/result split and an option to count tool arguments as the agent's writing, moving a session to another workspace, and a literal content search that jumps to the turn a word was said in.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "chyxhtc",
|