dsh-ws-recency 0.31.0 → 0.32.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.md +4 -1
- package/client.js +182 -14
- package/index.js +51 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -167,7 +167,10 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
|
|
|
167
167
|
|
|
168
168
|
- 搜的是**对话正文**:你的提问 + 助手的回复;不搜思维链、不搜工具参数和工具结果(那些会让命中被日志噪声淹没);
|
|
169
169
|
- 多个词用空格分隔,**要求同时出现在同一条消息里**(AND);大小写不敏感,纯字面匹配,不支持正则;
|
|
170
|
-
-
|
|
170
|
+
- 范围用**控件**选,不用记语法:搜索框下面有「工作区」下拉、「会话标题」输入框、「角色」三个按钮(全部 / 我 / 助手)。改控件会用当前关键词自动重搜;
|
|
171
|
+
- **只选范围、不输关键词也可以搜**:这时答案是「符合范围的会话列表」(标题、工作区、路径、时间),点一下就打开——用来找「那件事是哪个会话」。会话模式按会话标题匹配,不读正文,所以很快;
|
|
172
|
+
- 搜索框里仍然可以写匹配方式:`"一个词组"`(整句匹配)、`a|b` 或 `a or b`(任一即可)、`-词`(排除);
|
|
173
|
+
- 想用键盘也行:`ws:工作区`、`in:会话标题`、`role:user|assistant`,中文别名 `工作区:` / `会话:` / `角色:` 同样可用。控件与语法同时给出时,**以控件为准**(那是屏幕上看得见的选择);
|
|
171
174
|
- 结果按新到旧排列,每条给出角色、会话标题、所属工作区、第几轮/第几步,以及带高亮的片段;
|
|
172
175
|
- 每条结果有两个动作:`看上下文` 在行内展开命中处前后各约 400 字(不碰聊天区,长会话也不卡),`打开会话` 才真的跳转;
|
|
173
176
|
- 搜索过的词会记进「最近搜索」,点一下重搜、点 × 删一条、右侧「清空」全清,重启后还在。
|
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,13 @@
|
|
|
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": "全部",
|
|
528
|
+
"search.sessionResults": "会话({n})",
|
|
516
529
|
"search.history": "最近搜索",
|
|
517
530
|
"search.historyRun": "再搜一次:{query}",
|
|
518
531
|
"search.historyDrop": "从历史里删除",
|
|
@@ -718,7 +731,13 @@
|
|
|
718
731
|
"search.contextShow": "Show context",
|
|
719
732
|
"search.contextHide": "Hide",
|
|
720
733
|
"search.openSession": "Open session",
|
|
721
|
-
"search.hint": "space = all of them · \"phrase\" · a|b either · -exclude
|
|
734
|
+
"search.hint": "space = all of them · \"phrase\" · a|b either · -exclude",
|
|
735
|
+
"search.filterWorkspace": "Workspace",
|
|
736
|
+
"search.filterSession": "Session",
|
|
737
|
+
"search.filterSessionPlaceholder": "title contains… (Enter)",
|
|
738
|
+
"search.filterRole": "Role",
|
|
739
|
+
"search.filterAll": "All",
|
|
740
|
+
"search.sessionResults": "Sessions ({n})",
|
|
722
741
|
"search.history": "Recent",
|
|
723
742
|
"search.historyRun": "Search again: {query}",
|
|
724
743
|
"search.historyDrop": "Remove from history",
|
|
@@ -3903,6 +3922,14 @@
|
|
|
3903
3922
|
|
|
3904
3923
|
/* ---------- session content search -------------------------------- */
|
|
3905
3924
|
|
|
3925
|
+
/**
|
|
3926
|
+
* Narrowing chosen through controls rather than typed syntax.
|
|
3927
|
+
*
|
|
3928
|
+
* Typing `ws:` is a sentence to learn; a select is not. The typed forms
|
|
3929
|
+
* still work, and both are merged on the host.
|
|
3930
|
+
*/
|
|
3931
|
+
var searchFilters = { workspace: "", session: "", role: "" };
|
|
3932
|
+
|
|
3906
3933
|
/** How many recent queries the panel remembers. */
|
|
3907
3934
|
var SEARCH_HISTORY_MAX = 12;
|
|
3908
3935
|
|
|
@@ -4644,9 +4671,46 @@
|
|
|
4644
4671
|
return searchHitRow(props.hit, props.terms, props.onJump, extra);
|
|
4645
4672
|
}
|
|
4646
4673
|
|
|
4674
|
+
/**
|
|
4675
|
+
* One session, for a search that narrowed by title or workspace only.
|
|
4676
|
+
*
|
|
4677
|
+
* Without words there is nothing to point at inside a transcript, so the
|
|
4678
|
+
* useful answer is the session itself: its title, where it lives, and when.
|
|
4679
|
+
*/
|
|
4680
|
+
function SearchSessionRow(props) {
|
|
4681
|
+
var item = props.item;
|
|
4682
|
+
var when = formatWhen(Number(item.at) || 0);
|
|
4683
|
+
return h("div", {
|
|
4684
|
+
className: "wsr-hit wsr-session-hit",
|
|
4685
|
+
title: item.title || "",
|
|
4686
|
+
onClick: function () {
|
|
4687
|
+
if (typeof props.onOpen === "function") props.onOpen();
|
|
4688
|
+
},
|
|
4689
|
+
},
|
|
4690
|
+
h("div", { className: "wsr-hit-head" },
|
|
4691
|
+
h("span", { className: "wsr-hit-title", title: item.title || "" }, item.title || props.shortId),
|
|
4692
|
+
typeof item.workspace === "string" && item.workspace !== "" ? h("span", { className: "wsr-hit-ws" }, item.workspace) : null,
|
|
4693
|
+
),
|
|
4694
|
+
h("div", { className: "wsr-hit-meta" },
|
|
4695
|
+
when !== "" ? h("span", { className: "wsr-hit-time" }, when) : null,
|
|
4696
|
+
typeof item.cwd === "string" && item.cwd !== "" ? h("span", { className: "wsr-hit-cwd" }, item.cwd) : null,
|
|
4697
|
+
),
|
|
4698
|
+
h("div", { className: "wsr-hit-actions" },
|
|
4699
|
+
h("button", {
|
|
4700
|
+
type: "button",
|
|
4701
|
+
className: "wsr-hit-context-jump",
|
|
4702
|
+
onClick: function (event) {
|
|
4703
|
+
if (event !== undefined && typeof event.stopPropagation === "function") event.stopPropagation();
|
|
4704
|
+
if (typeof props.onOpen === "function") props.onOpen();
|
|
4705
|
+
},
|
|
4706
|
+
}, t("search.openSession")),
|
|
4707
|
+
),
|
|
4708
|
+
);
|
|
4709
|
+
}
|
|
4710
|
+
|
|
4647
4711
|
function SearchPanelPage(props) {
|
|
4648
4712
|
var state = react.useState(searchLast === null
|
|
4649
|
-
? { loaded: false, query: "", hits: [], terms: [], scanned: 0, total: 0, pending: 0, took: 0, busy: false, error: "" }
|
|
4713
|
+
? { loaded: false, query: "", hits: [], sessions: [], terms: [], scanned: 0, total: 0, pending: 0, took: 0, busy: false, error: "" }
|
|
4650
4714
|
: searchLast);
|
|
4651
4715
|
var view = state[0];
|
|
4652
4716
|
var setView = state[1];
|
|
@@ -4666,18 +4730,33 @@
|
|
|
4666
4730
|
setView(next);
|
|
4667
4731
|
};
|
|
4668
4732
|
|
|
4733
|
+
/* Changing a filter with a query on screen should show the effect at
|
|
4734
|
+
once instead of waiting for another Enter. */
|
|
4735
|
+
var rerun = function () {
|
|
4736
|
+
if (view.query !== "") run(view.query, false);
|
|
4737
|
+
};
|
|
4738
|
+
|
|
4669
4739
|
var run = function (text, refresh) {
|
|
4670
4740
|
var query = typeof text === "string" ? text.trim() : "";
|
|
4671
4741
|
searchGeneration += 1;
|
|
4672
4742
|
var generation = searchGeneration;
|
|
4673
|
-
|
|
4743
|
+
/* A filter alone is a question too: "which session was that?". */
|
|
4744
|
+
var hasFilters = searchFilters.workspace !== "" || searchFilters.session !== ""
|
|
4745
|
+
|| searchFilters.role !== "";
|
|
4746
|
+
if (query === "" && !hasFilters) {
|
|
4674
4747
|
commit({ loaded: true, query: "", hits: [], terms: [], scanned: 0, total: 0, pending: 0, took: 0, busy: false, error: "" });
|
|
4675
4748
|
return;
|
|
4676
4749
|
}
|
|
4677
|
-
if (typeof actions.pushSearch === "function") actions.pushSearch(query);
|
|
4750
|
+
if (query !== "" && typeof actions.pushSearch === "function") actions.pushSearch(query);
|
|
4678
4751
|
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
4752
|
var ask = function (needRefresh) {
|
|
4680
|
-
searchPost({
|
|
4753
|
+
searchPost({
|
|
4754
|
+
query: query,
|
|
4755
|
+
refresh: needRefresh === true,
|
|
4756
|
+
workspace: searchFilters.workspace,
|
|
4757
|
+
session: searchFilters.session,
|
|
4758
|
+
role: searchFilters.role,
|
|
4759
|
+
}).then(function (answer) {
|
|
4681
4760
|
if (generation !== searchGeneration) return;
|
|
4682
4761
|
var json = answer.json;
|
|
4683
4762
|
if (json === null || json.ok !== true) {
|
|
@@ -4688,6 +4767,7 @@
|
|
|
4688
4767
|
loaded: true,
|
|
4689
4768
|
query: query,
|
|
4690
4769
|
hits: Array.isArray(json.hits) ? json.hits : [],
|
|
4770
|
+
sessions: Array.isArray(json.sessions) ? json.sessions : [],
|
|
4691
4771
|
terms: Array.isArray(json.terms) ? json.terms : [],
|
|
4692
4772
|
scanned: json.scanned || 0,
|
|
4693
4773
|
total: json.total || 0,
|
|
@@ -4726,6 +4806,16 @@
|
|
|
4726
4806
|
},
|
|
4727
4807
|
});
|
|
4728
4808
|
|
|
4809
|
+
var sessionRows = (Array.isArray(view.sessions) ? view.sessions : []).map(function (item, index) {
|
|
4810
|
+
var row = h(SearchSessionRow, {
|
|
4811
|
+
item: item,
|
|
4812
|
+
shortId: shortSessionId(String(item.sessionId || "")),
|
|
4813
|
+
onOpen: function () { openSessionRow(item.sessionId); },
|
|
4814
|
+
});
|
|
4815
|
+
row.key = "session:" + String(item.sessionId || index);
|
|
4816
|
+
return row;
|
|
4817
|
+
});
|
|
4818
|
+
|
|
4729
4819
|
var rows = view.hits.map(function (hit, index) {
|
|
4730
4820
|
var row = h(SearchHitRow, {
|
|
4731
4821
|
hit: hit,
|
|
@@ -4740,6 +4830,83 @@
|
|
|
4740
4830
|
h("div", { className: "wsr-page-head" },
|
|
4741
4831
|
h("div", { className: "wsr-page-heading" }, t("search.title")),
|
|
4742
4832
|
),
|
|
4833
|
+
h("div", { className: "wsr-search-bar" },
|
|
4834
|
+
input,
|
|
4835
|
+
h("button", { type: "button", className: "wsr-btn", onClick: function () { run(searchDraft, false); } }, t("search.run")),
|
|
4836
|
+
),
|
|
4837
|
+
h("div", { className: "wsr-search-hint" }, t("search.hint")),
|
|
4838
|
+
h("div", { className: "wsr-search-filters" },
|
|
4839
|
+
h("label", { className: "wsr-filter" },
|
|
4840
|
+
h("span", { className: "wsr-filter-label" }, t("search.filterWorkspace")),
|
|
4841
|
+
h("select", {
|
|
4842
|
+
className: "wsr-filter-select",
|
|
4843
|
+
value: searchFilters.workspace,
|
|
4844
|
+
onChange: function (event) {
|
|
4845
|
+
searchFilters.workspace = event.target.value || "";
|
|
4846
|
+
rerun();
|
|
4847
|
+
},
|
|
4848
|
+
},
|
|
4849
|
+
h("option", { value: "" }, t("search.filterAll")),
|
|
4850
|
+
(function () {
|
|
4851
|
+
var items = data.workspaces !== null && data.workspaces !== undefined
|
|
4852
|
+
&& Array.isArray(data.workspaces.items) ? data.workspaces.items : [];
|
|
4853
|
+
var options = [];
|
|
4854
|
+
for (var wi = 0; wi < items.length; wi += 1) {
|
|
4855
|
+
var name = typeof items[wi].name === "string" && items[wi].name !== ""
|
|
4856
|
+
? items[wi].name
|
|
4857
|
+
: String(items[wi].title || "");
|
|
4858
|
+
if (name === "") continue;
|
|
4859
|
+
options.push(h("option", { value: name, key: "ws:" + name }, name));
|
|
4860
|
+
}
|
|
4861
|
+
return options;
|
|
4862
|
+
})(),
|
|
4863
|
+
),
|
|
4864
|
+
),
|
|
4865
|
+
h("label", { className: "wsr-filter" },
|
|
4866
|
+
h("span", { className: "wsr-filter-label" }, t("search.filterSession")),
|
|
4867
|
+
h("input", {
|
|
4868
|
+
type: "text",
|
|
4869
|
+
className: "wsr-filter-input",
|
|
4870
|
+
defaultValue: searchFilters.session,
|
|
4871
|
+
placeholder: t("search.filterSessionPlaceholder"),
|
|
4872
|
+
onChange: function (event) {
|
|
4873
|
+
searchFilters.session = String(event.target.value || "").trim();
|
|
4874
|
+
},
|
|
4875
|
+
onKeyDown: function (event) {
|
|
4876
|
+
if (event !== undefined && event.key === "Enter") {
|
|
4877
|
+
event.preventDefault();
|
|
4878
|
+
rerun();
|
|
4879
|
+
}
|
|
4880
|
+
},
|
|
4881
|
+
}),
|
|
4882
|
+
),
|
|
4883
|
+
h("span", { className: "wsr-filter" },
|
|
4884
|
+
h("span", { className: "wsr-filter-label" }, t("search.filterRole")),
|
|
4885
|
+
(function () {
|
|
4886
|
+
var roles = [
|
|
4887
|
+
["", "search.filterAll"],
|
|
4888
|
+
["user", "search.you"],
|
|
4889
|
+
["assistant", "search.assistant"],
|
|
4890
|
+
];
|
|
4891
|
+
var buttons = [];
|
|
4892
|
+
for (var ri = 0; ri < roles.length; ri += 1) {
|
|
4893
|
+
(function (value, label) {
|
|
4894
|
+
var active = searchFilters.role === value;
|
|
4895
|
+
buttons.push(h("button", {
|
|
4896
|
+
type: "button",
|
|
4897
|
+
key: "role:" + value,
|
|
4898
|
+
className: "wsr-filter-chip" + (active ? " wsr-filter-chip-on" : ""),
|
|
4899
|
+
onClick: function () {
|
|
4900
|
+
searchFilters.role = value;
|
|
4901
|
+
rerun();
|
|
4902
|
+
},
|
|
4903
|
+
}, t(label)));
|
|
4904
|
+
})(roles[ri][0], roles[ri][1]);
|
|
4905
|
+
}
|
|
4906
|
+
return buttons;
|
|
4907
|
+
})(),
|
|
4908
|
+
),
|
|
4909
|
+
),
|
|
4743
4910
|
historyList.length === 0 ? null : h("div", { className: "wsr-search-history" },
|
|
4744
4911
|
h("span", { className: "wsr-search-history-label" }, t("search.history")),
|
|
4745
4912
|
historyList.map(function (item, index) {
|
|
@@ -4774,17 +4941,18 @@
|
|
|
4774
4941
|
},
|
|
4775
4942
|
}, t("search.historyClear")),
|
|
4776
4943
|
),
|
|
4777
|
-
|
|
4778
|
-
h("div", { className: "wsr-search-bar" },
|
|
4779
|
-
input,
|
|
4780
|
-
h("button", { type: "button", className: "wsr-btn", onClick: function () { run(searchDraft, false); } }, t("search.run")),
|
|
4781
|
-
),
|
|
4782
|
-
view.busy ? h("div", { className: "wsr-page-note" }, t("search.searching")) : null,
|
|
4944
|
+
view.busy ? h("div", { className: "wsr-page-note" }, t("search.searching")) : null,
|
|
4783
4945
|
view.error !== "" ? h("div", { className: "wsr-page-note wsr-page-error" }, view.error) : null,
|
|
4784
4946
|
view.pending > 0 ? h("div", { className: "wsr-page-note" }, t("search.indexing", { n: String(view.pending) })) : null,
|
|
4785
4947
|
view.loaded && !view.busy ? h("div", { className: "wsr-page-note" }, t("search.summary", { hits: String(view.hits.length), sessions: String(view.total), ms: String(view.took) })) : null,
|
|
4786
|
-
view.loaded && !view.busy && view.hits.length === 0 ? h("div", { className: "wsr-page-note" }, t("search.empty")) : null,
|
|
4787
|
-
|
|
4948
|
+
view.loaded && !view.busy && view.hits.length === 0 && sessionRows.length === 0 ? h("div", { className: "wsr-page-note" }, t("search.empty")) : null,
|
|
4949
|
+
sessionRows.length > 0
|
|
4950
|
+
? h("div", { className: "wsr-page-list" },
|
|
4951
|
+
h("div", { className: "wsr-search-history-label" }, t("search.sessionResults", { n: String(sessionRows.length) })),
|
|
4952
|
+
sessionRows,
|
|
4953
|
+
)
|
|
4954
|
+
: null,
|
|
4955
|
+
sessionRows.length === 0 ? h("div", { className: "wsr-page-list" }, rows) : null,
|
|
4788
4956
|
);
|
|
4789
4957
|
}
|
|
4790
4958
|
|
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.
|
|
35
|
+
export const HOST_VERSION = "0.32.0";
|
|
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 !== "";
|
|
@@ -995,6 +1000,43 @@ export async function searchSessions(ctx, query, options = {}) {
|
|
|
995
1000
|
}
|
|
996
1001
|
sessions.sort((a, b) => b.updatedAt - a.updatedAt);
|
|
997
1002
|
|
|
1003
|
+
/* No words, but a filter: the question is "which session was that?", so the
|
|
1004
|
+
answer is sessions, not messages. Listing them needs no transcript work. */
|
|
1005
|
+
if (parsed.terms.length === 0 && parsed.groups.length === 0) {
|
|
1006
|
+
const matchedSessions = [];
|
|
1007
|
+
for (const session of sessions) {
|
|
1008
|
+
const cwd = normalizedPath(session.header.cwd);
|
|
1009
|
+
if (parsed.filters.workspace !== "") {
|
|
1010
|
+
const name = String(workspaceByPath.get(cwd) ?? "").toLowerCase();
|
|
1011
|
+
if (name.indexOf(parsed.filters.workspace) === -1) continue;
|
|
1012
|
+
}
|
|
1013
|
+
if (parsed.filters.session !== "") {
|
|
1014
|
+
const headerTitle = typeof session.header.title === "string" ? session.header.title.toLowerCase() : "";
|
|
1015
|
+
if (headerTitle.indexOf(parsed.filters.session) === -1) continue;
|
|
1016
|
+
}
|
|
1017
|
+
matchedSessions.push({
|
|
1018
|
+
sessionId: session.id,
|
|
1019
|
+
title: typeof session.header.title === "string" ? session.header.title : "",
|
|
1020
|
+
workspace: workspaceByPath.get(cwd) ?? "",
|
|
1021
|
+
cwd: typeof session.header.cwd === "string" ? session.header.cwd : "",
|
|
1022
|
+
at: session.updatedAt,
|
|
1023
|
+
sizeBytes: session.sizeBytes,
|
|
1024
|
+
});
|
|
1025
|
+
if (matchedSessions.length >= SEARCH_TOTAL_CAP) break;
|
|
1026
|
+
}
|
|
1027
|
+
return {
|
|
1028
|
+
ok: true,
|
|
1029
|
+
query: "",
|
|
1030
|
+
terms: [],
|
|
1031
|
+
hits: [],
|
|
1032
|
+
sessions: matchedSessions,
|
|
1033
|
+
scanned: sessions.length,
|
|
1034
|
+
total: sessions.length,
|
|
1035
|
+
pending: 0,
|
|
1036
|
+
took: Date.now() - started,
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
|
|
998
1040
|
const refresh = options.refresh === true;
|
|
999
1041
|
const hits = [];
|
|
1000
1042
|
let scanned = 0;
|
|
@@ -2387,7 +2429,14 @@ export async function handleSearchRequest(ctx, req, res) {
|
|
|
2387
2429
|
try {
|
|
2388
2430
|
const body = await readJsonBody(req);
|
|
2389
2431
|
const query = body !== null && typeof body.query === "string" ? body.query : "";
|
|
2390
|
-
|
|
2432
|
+
/* The panel's controls arrive as fields; typed `ws:` / `in:` / `role:` still
|
|
2433
|
+
work and the two are merged. */
|
|
2434
|
+
const result = await searchSessions(ctx, query, {
|
|
2435
|
+
refresh: body !== null && body.refresh === true,
|
|
2436
|
+
workspace: body !== null && typeof body.workspace === "string" ? body.workspace : "",
|
|
2437
|
+
session: body !== null && typeof body.session === "string" ? body.session : "",
|
|
2438
|
+
role: body !== null && typeof body.role === "string" ? body.role : "",
|
|
2439
|
+
});
|
|
2391
2440
|
sendJson(res, 200, result);
|
|
2392
2441
|
} catch (error) {
|
|
2393
2442
|
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.
|
|
3
|
+
"version": "0.32.0",
|
|
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",
|