dsh-ws-recency 0.32.0 → 0.32.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/client.js +301 -122
- package/index.js +1 -1
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -362,15 +362,30 @@
|
|
|
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
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
".wsr-
|
|
370
|
-
".wsr-
|
|
371
|
-
".wsr-
|
|
372
|
-
".wsr-
|
|
373
|
-
".wsr-
|
|
365
|
+
/* A column flex box with a fixed height shrinks its children once the
|
|
366
|
+
content is taller than the box, and the shortest row goes first - that
|
|
367
|
+
is how the recent-searches row vanished only after a search returned
|
|
368
|
+
many results. Chrome keeps its size; the lists scroll. */
|
|
369
|
+
".wsr-search-page > *{flex:0 0 auto}",
|
|
370
|
+
".wsr-search-page > .wsr-page-list{flex:1 1 auto;min-height:0;overflow-y:auto}",
|
|
371
|
+
".wsr-search-toolbar{display:flex;align-items:center;gap:8px;min-width:0}",
|
|
372
|
+
".wsr-filters{display:flex;flex-wrap:wrap;align-items:center;gap:8px;flex:1;min-width:0;font-size:11px;color:var(--dsw-alias-label-tertiary)}",
|
|
373
|
+
".wsr-filter{display:inline-flex;align-items:center;gap:4px;min-width:0}",
|
|
374
|
+
".wsr-filter-label{flex:none;color:var(--dsw-alias-label-tertiary)}",
|
|
375
|
+
".wsr-filter-select,.wsr-filter-input{height:24px;box-sizing:border-box;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:170px}",
|
|
376
|
+
".wsr-filter-input{width:120px}",
|
|
377
|
+
".wsr-seg{display:inline-flex;height:24px;border-radius:6px;border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.16));overflow:hidden}",
|
|
378
|
+
".wsr-seg-item{height:100%;padding:0 8px;border:none;border-left:.5px solid rgba(255,255,255,.12);background:0 0;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:11px;cursor:pointer}",
|
|
379
|
+
".wsr-seg-item:first-child{border-left:none}",
|
|
380
|
+
".wsr-seg-item:hover{color:var(--dsw-alias-label-primary)}",
|
|
381
|
+
".wsr-seg-item-on{color:var(--dsw-alias-label-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary,#4f9df7) 16%,transparent)}",
|
|
382
|
+
".wsr-help{flex:none;width:24px;height:24px;border-radius:50%;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}",
|
|
383
|
+
".wsr-help:hover,.wsr-help-on{color:var(--dsw-alias-label-primary);border-color:rgba(255,255,255,.3)}",
|
|
384
|
+
".wsr-search-hint{font-size:11px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}",
|
|
385
|
+
".wsr-search-status{display:flex;flex-wrap:wrap;gap:4px 10px;font-size:11px;line-height:1.5;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;padding-top:3px;border-top:.5px solid rgba(255,255,255,.06)}",
|
|
386
|
+
".wsr-search-group{font-size:11px;color:var(--dsw-alias-label-tertiary);padding:2px 0}",
|
|
387
|
+
".wsr-btn-primary{border-color:color-mix(in srgb,var(--dsw-alias-brand-primary,#4f9df7) 55%,transparent);color:var(--dsw-alias-label-primary)}",
|
|
388
|
+
".wsr-search-history{display:flex;align-items:center;flex-wrap:nowrap;overflow-x:auto;gap:6px;font-size:11px;color:var(--dsw-alias-label-tertiary);scrollbar-width:none}",
|
|
374
389
|
".wsr-search-history-label{flex:none}",
|
|
375
390
|
".wsr-search-chip{display:inline-flex;align-items:center;border-radius:9px;background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.07));overflow:hidden}",
|
|
376
391
|
".wsr-search-chip-run{border:none;background:0 0;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:18px;padding:0 4px 0 8px;cursor:pointer;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
@@ -530,6 +545,8 @@
|
|
|
530
545
|
"search.historyRun": "再搜一次:{query}",
|
|
531
546
|
"search.historyDrop": "从历史里删除",
|
|
532
547
|
"search.historyClear": "清空",
|
|
548
|
+
|
|
549
|
+
"search.historyEmpty": "还没有记录",
|
|
533
550
|
"search.step": "第 {n} 步",
|
|
534
551
|
"search.jumpTurn": "已定位:第 {turn} 轮 · 按轮次",
|
|
535
552
|
"search.jumpText": "已定位:第 {turn} 轮 · 按文字",
|
|
@@ -742,6 +759,8 @@
|
|
|
742
759
|
"search.historyRun": "Search again: {query}",
|
|
743
760
|
"search.historyDrop": "Remove from history",
|
|
744
761
|
"search.historyClear": "Clear",
|
|
762
|
+
|
|
763
|
+
"search.historyEmpty": "nothing yet",
|
|
745
764
|
"search.step": "step {n}",
|
|
746
765
|
"search.jumpTurn": "Landed on turn {turn} (by turn)",
|
|
747
766
|
"search.jumpText": "Landed on turn {turn} (by text)",
|
|
@@ -3930,6 +3949,98 @@
|
|
|
3930
3949
|
*/
|
|
3931
3950
|
var searchFilters = { workspace: "", session: "", role: "" };
|
|
3932
3951
|
|
|
3952
|
+
/**
|
|
3953
|
+
* Recent searches recorded since the plugin loaded.
|
|
3954
|
+
*
|
|
3955
|
+
* Shown merged with the store's own list. Freezing one copy of the store was
|
|
3956
|
+
* wrong: when the panel rendered before the store hydrated, that copy stayed
|
|
3957
|
+
* empty and every search looked like it wiped the history.
|
|
3958
|
+
*/
|
|
3959
|
+
var searchHistoryMirror = [];
|
|
3960
|
+
|
|
3961
|
+
/** Keys removed here; hidden until the store drops them as well. */
|
|
3962
|
+
var historyDropped = {};
|
|
3963
|
+
|
|
3964
|
+
/** Set by "clear", so a store that has not caught up cannot restore them. */
|
|
3965
|
+
var historyCleared = false;
|
|
3966
|
+
|
|
3967
|
+
function mergedHistory(stored) {
|
|
3968
|
+
var storedList = Array.isArray(stored) ? stored : [];
|
|
3969
|
+
var out = [];
|
|
3970
|
+
var seen = {};
|
|
3971
|
+
var push = function (item) {
|
|
3972
|
+
var key = historyKey(item);
|
|
3973
|
+
if (seen[key] === true || historyDropped[key] === true) return;
|
|
3974
|
+
seen[key] = true;
|
|
3975
|
+
out.push(item);
|
|
3976
|
+
};
|
|
3977
|
+
for (var i = 0; i < searchHistoryMirror.length; i += 1) push(searchHistoryMirror[i]);
|
|
3978
|
+
if (!historyCleared) {
|
|
3979
|
+
for (var j = 0; j < storedList.length; j += 1) push(storedList[j]);
|
|
3980
|
+
} else if (storedList.length === 0) {
|
|
3981
|
+
historyCleared = false;
|
|
3982
|
+
}
|
|
3983
|
+
return out.slice(0, SEARCH_HISTORY_MAX);
|
|
3984
|
+
}
|
|
3985
|
+
|
|
3986
|
+
/** Bumped when a stored query restores the controls, so the title box remounts. */
|
|
3987
|
+
var filterEpoch = 0;
|
|
3988
|
+
|
|
3989
|
+
/**
|
|
3990
|
+
* One stored search: the words plus the scope they were run with.
|
|
3991
|
+
*
|
|
3992
|
+
* A query without its scope is an incomplete memory - "CDP" under one
|
|
3993
|
+
* workspace is not the same search as "CDP" everywhere - so both travel
|
|
3994
|
+
* together. Entries written by older versions were plain strings.
|
|
3995
|
+
*/
|
|
3996
|
+
/** Separator for the stored form; a control character cannot appear in a query. */
|
|
3997
|
+
var HISTORY_SEP = "\u0001";
|
|
3998
|
+
|
|
3999
|
+
function historyEntry(item) {
|
|
4000
|
+
if (typeof item === "string") {
|
|
4001
|
+
var parts = item.split(HISTORY_SEP);
|
|
4002
|
+
return {
|
|
4003
|
+
query: parts[0] === undefined ? "" : parts[0],
|
|
4004
|
+
workspace: parts[1] === undefined ? "" : parts[1],
|
|
4005
|
+
session: parts[2] === undefined ? "" : parts[2],
|
|
4006
|
+
role: parts[3] === undefined ? "" : parts[3],
|
|
4007
|
+
};
|
|
4008
|
+
}
|
|
4009
|
+
if (item === null || typeof item !== "object") {
|
|
4010
|
+
return { query: "", workspace: "", session: "", role: "" };
|
|
4011
|
+
}
|
|
4012
|
+
return {
|
|
4013
|
+
query: typeof item.query === "string" ? item.query : "",
|
|
4014
|
+
workspace: typeof item.workspace === "string" ? item.workspace : "",
|
|
4015
|
+
session: typeof item.session === "string" ? item.session : "",
|
|
4016
|
+
role: typeof item.role === "string" ? item.role : "",
|
|
4017
|
+
};
|
|
4018
|
+
}
|
|
4019
|
+
|
|
4020
|
+
/** The stored form: one string, so the store keeps handling it like it always did. */
|
|
4021
|
+
function historyEncode(item) {
|
|
4022
|
+
var entry = historyEntry(item);
|
|
4023
|
+
return [entry.query, entry.workspace, entry.session, entry.role]
|
|
4024
|
+
.map(function (part) { return String(part).split(HISTORY_SEP).join(" "); })
|
|
4025
|
+
.join(HISTORY_SEP);
|
|
4026
|
+
}
|
|
4027
|
+
|
|
4028
|
+
function historyKey(item) {
|
|
4029
|
+
var entry = historyEntry(item);
|
|
4030
|
+
return entry.query + "\u0000" + entry.workspace + "\u0000" + entry.session + "\u0000" + entry.role;
|
|
4031
|
+
}
|
|
4032
|
+
|
|
4033
|
+
/** What a chip says: the words, plus whichever scope parts it carries. */
|
|
4034
|
+
function historyLabel(item) {
|
|
4035
|
+
var entry = historyEntry(item);
|
|
4036
|
+
var parts = [];
|
|
4037
|
+
if (entry.workspace !== "") parts.push(entry.workspace);
|
|
4038
|
+
if (entry.session !== "") parts.push("in:" + entry.session);
|
|
4039
|
+
if (entry.role !== "") parts.push(entry.role === "user" ? "me" : "assistant");
|
|
4040
|
+
var scope = parts.length > 0 ? " (" + parts.join(" · ") + ")" : "";
|
|
4041
|
+
return (entry.query === "" ? "(scope only)" : entry.query) + scope;
|
|
4042
|
+
}
|
|
4043
|
+
|
|
3933
4044
|
/** How many recent queries the panel remembers. */
|
|
3934
4045
|
var SEARCH_HISTORY_MAX = 12;
|
|
3935
4046
|
|
|
@@ -3976,6 +4087,9 @@
|
|
|
3976
4087
|
* a synthetic scroll event is what lets the next page load.
|
|
3977
4088
|
*/
|
|
3978
4089
|
function scrollTo(scroller, top) {
|
|
4090
|
+
/* Only used on the turn rail. No synthetic scroll event: the rail
|
|
4091
|
+
virtualises on scrollTop alone, and a fabricated event is one more
|
|
4092
|
+
thing the host can read as the reader moving. */
|
|
3979
4093
|
if (scroller === null || scroller === undefined) return;
|
|
3980
4094
|
var target = Math.max(0, Number(top) || 0);
|
|
3981
4095
|
try {
|
|
@@ -3992,13 +4106,7 @@
|
|
|
3992
4106
|
/* an engine without createEvent still got the assignment */
|
|
3993
4107
|
}
|
|
3994
4108
|
};
|
|
3995
|
-
fire
|
|
3996
|
-
try {
|
|
3997
|
-
if (typeof requestAnimationFrame === "function") requestAnimationFrame(fire);
|
|
3998
|
-
else window.setTimeout(fire, 16);
|
|
3999
|
-
} catch (error) {
|
|
4000
|
-
/* the first dispatch is usually enough */
|
|
4001
|
-
}
|
|
4109
|
+
void fire;
|
|
4002
4110
|
}
|
|
4003
4111
|
function conversationScroller() {
|
|
4004
4112
|
if (typeof document === "undefined") return null;
|
|
@@ -4203,13 +4311,25 @@
|
|
|
4203
4311
|
}
|
|
4204
4312
|
|
|
4205
4313
|
|
|
4206
|
-
/**
|
|
4314
|
+
/**
|
|
4315
|
+
* The rail mark for one turn, if that mark is actually on screen.
|
|
4316
|
+
*
|
|
4317
|
+
* The rail is part of the chat shell, and during a session switch two of
|
|
4318
|
+
* them can be in the document at once. Matching by turn number alone could
|
|
4319
|
+
* therefore click the departing session's rail and start a history load
|
|
4320
|
+
* nobody asked for, so the mark has to be visible to qualify.
|
|
4321
|
+
*/
|
|
4207
4322
|
function railMarkFor(turn) {
|
|
4208
4323
|
var wanted = Number(turn);
|
|
4209
4324
|
if (!isFinite(wanted)) return null;
|
|
4210
4325
|
var marks = railMarks();
|
|
4211
4326
|
for (var i = 0; i < marks.length; i += 1) {
|
|
4212
|
-
if (turnOfRailMark(marks[i])
|
|
4327
|
+
if (turnOfRailMark(marks[i]) !== wanted) continue;
|
|
4328
|
+
var rect = typeof marks[i].getBoundingClientRect === "function"
|
|
4329
|
+
? marks[i].getBoundingClientRect()
|
|
4330
|
+
: null;
|
|
4331
|
+
if (rect === null || !(rect.height > 0) || !(rect.width > 0)) continue;
|
|
4332
|
+
return marks[i];
|
|
4213
4333
|
}
|
|
4214
4334
|
return null;
|
|
4215
4335
|
}
|
|
@@ -4714,15 +4834,17 @@
|
|
|
4714
4834
|
: searchLast);
|
|
4715
4835
|
var view = state[0];
|
|
4716
4836
|
var setView = state[1];
|
|
4837
|
+
/* The syntax hint is reference material, not a permanent line. */
|
|
4838
|
+
var help = react.useState(false);
|
|
4717
4839
|
/* The recent-query list lives in the shared store, so it survives a
|
|
4718
4840
|
restart and is the same list on every panel. */
|
|
4719
4841
|
var preferences = props !== undefined && props !== null && typeof props.useStore === "function"
|
|
4720
4842
|
? props.useStore(function (snapshot) { return snapshot; })
|
|
4721
4843
|
: (data.settings || {});
|
|
4722
4844
|
var actions = props !== undefined && props !== null && props.actions !== undefined ? props.actions : {};
|
|
4723
|
-
var
|
|
4724
|
-
? preferences.searchHistory
|
|
4725
|
-
|
|
4845
|
+
var storedHistory = preferences !== null && preferences !== undefined
|
|
4846
|
+
&& Array.isArray(preferences.searchHistory) ? preferences.searchHistory : [];
|
|
4847
|
+
var historyList = mergedHistory(storedHistory);
|
|
4726
4848
|
/* Every update also parks the answer outside the component, so coming
|
|
4727
4849
|
back from a hit restores the list instead of asking for a new search. */
|
|
4728
4850
|
var commit = function (next) {
|
|
@@ -4747,7 +4869,22 @@
|
|
|
4747
4869
|
commit({ loaded: true, query: "", hits: [], terms: [], scanned: 0, total: 0, pending: 0, took: 0, busy: false, error: "" });
|
|
4748
4870
|
return;
|
|
4749
4871
|
}
|
|
4750
|
-
|
|
4872
|
+
var entry = {
|
|
4873
|
+
query: query,
|
|
4874
|
+
workspace: searchFilters.workspace,
|
|
4875
|
+
session: searchFilters.session,
|
|
4876
|
+
role: searchFilters.role,
|
|
4877
|
+
};
|
|
4878
|
+
if (typeof actions.pushSearch === "function") actions.pushSearch(entry);
|
|
4879
|
+
var entryKey = historyKey(entry);
|
|
4880
|
+
if (historyDropped[entryKey] === true) delete historyDropped[entryKey];
|
|
4881
|
+
var nextMirror = [historyEncode(entry)];
|
|
4882
|
+
for (var hi = 0; hi < searchHistoryMirror.length && nextMirror.length < SEARCH_HISTORY_MAX; hi += 1) {
|
|
4883
|
+
if (historyKey(searchHistoryMirror[hi]) === entryKey) continue;
|
|
4884
|
+
nextMirror.push(searchHistoryMirror[hi]);
|
|
4885
|
+
}
|
|
4886
|
+
searchHistoryMirror = nextMirror;
|
|
4887
|
+
historyCleared = false;
|
|
4751
4888
|
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: "" });
|
|
4752
4889
|
var ask = function (needRefresh) {
|
|
4753
4890
|
searchPost({
|
|
@@ -4830,97 +4967,115 @@
|
|
|
4830
4967
|
h("div", { className: "wsr-page-head" },
|
|
4831
4968
|
h("div", { className: "wsr-page-heading" }, t("search.title")),
|
|
4832
4969
|
),
|
|
4833
|
-
h("div", { className: "wsr-search-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
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();
|
|
4970
|
+
h("div", { className: "wsr-search-toolbar" },
|
|
4971
|
+
h("div", { className: "wsr-filters" },
|
|
4972
|
+
h("label", { className: "wsr-filter" },
|
|
4973
|
+
h("span", { className: "wsr-filter-label" }, t("search.filterWorkspace")),
|
|
4974
|
+
h("select", {
|
|
4975
|
+
className: "wsr-filter-select",
|
|
4976
|
+
value: searchFilters.workspace,
|
|
4977
|
+
onChange: function (event) {
|
|
4978
|
+
searchFilters.workspace = event.target.value || "";
|
|
4878
4979
|
rerun();
|
|
4879
|
-
}
|
|
4980
|
+
},
|
|
4880
4981
|
},
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4982
|
+
h("option", { value: "" }, t("search.filterAll")),
|
|
4983
|
+
(function () {
|
|
4984
|
+
var items = data.workspaces !== null && data.workspaces !== undefined
|
|
4985
|
+
&& Array.isArray(data.workspaces.items) ? data.workspaces.items : [];
|
|
4986
|
+
var options = [];
|
|
4987
|
+
for (var wi = 0; wi < items.length; wi += 1) {
|
|
4988
|
+
var name = typeof items[wi].name === "string" && items[wi].name !== ""
|
|
4989
|
+
? items[wi].name
|
|
4990
|
+
: String(items[wi].title || "");
|
|
4991
|
+
if (name === "") continue;
|
|
4992
|
+
options.push(h("option", { value: name, key: "ws:" + name }, name));
|
|
4993
|
+
}
|
|
4994
|
+
return options;
|
|
4995
|
+
})(),
|
|
4996
|
+
),
|
|
4997
|
+
),
|
|
4998
|
+
h("label", { className: "wsr-filter" },
|
|
4999
|
+
h("span", { className: "wsr-filter-label" }, t("search.filterSession")),
|
|
5000
|
+
h("input", {
|
|
5001
|
+
type: "text",
|
|
5002
|
+
key: "wsr-filter-session:" + String(filterEpoch),
|
|
5003
|
+
className: "wsr-filter-input",
|
|
5004
|
+
defaultValue: searchFilters.session,
|
|
5005
|
+
placeholder: t("search.filterSessionPlaceholder"),
|
|
5006
|
+
onChange: function (event) {
|
|
5007
|
+
searchFilters.session = String(event.target.value || "").trim();
|
|
5008
|
+
},
|
|
5009
|
+
onKeyDown: function (event) {
|
|
5010
|
+
if (event !== undefined && event.key === "Enter") {
|
|
5011
|
+
event.preventDefault();
|
|
5012
|
+
rerun();
|
|
5013
|
+
}
|
|
5014
|
+
},
|
|
5015
|
+
}),
|
|
5016
|
+
),
|
|
5017
|
+
h("span", { className: "wsr-filter" },
|
|
5018
|
+
h("span", { className: "wsr-filter-label" }, t("search.filterRole")),
|
|
5019
|
+
h("span", { className: "wsr-seg" },
|
|
5020
|
+
(function () {
|
|
5021
|
+
var roles = [
|
|
5022
|
+
["", "search.filterAll"],
|
|
5023
|
+
["user", "search.you"],
|
|
5024
|
+
["assistant", "search.assistant"],
|
|
5025
|
+
];
|
|
5026
|
+
var buttons = [];
|
|
5027
|
+
for (var ri = 0; ri < roles.length; ri += 1) {
|
|
5028
|
+
(function (value, label) {
|
|
5029
|
+
buttons.push(h("button", {
|
|
5030
|
+
type: "button",
|
|
5031
|
+
key: "role:" + value,
|
|
5032
|
+
className: "wsr-seg-item" + (searchFilters.role === value ? " wsr-seg-item-on" : ""),
|
|
5033
|
+
onClick: function () {
|
|
5034
|
+
searchFilters.role = value;
|
|
5035
|
+
rerun();
|
|
5036
|
+
},
|
|
5037
|
+
}, t(label)));
|
|
5038
|
+
})(roles[ri][0], roles[ri][1]);
|
|
5039
|
+
}
|
|
5040
|
+
return buttons;
|
|
5041
|
+
})(),
|
|
5042
|
+
),
|
|
5043
|
+
),
|
|
4908
5044
|
),
|
|
5045
|
+
h("button", {
|
|
5046
|
+
type: "button",
|
|
5047
|
+
className: "wsr-help" + (help[0] === true ? " wsr-help-on" : ""),
|
|
5048
|
+
title: t("search.hint"),
|
|
5049
|
+
"aria-label": t("search.hint"),
|
|
5050
|
+
onClick: function () { help[1](help[0] !== true); },
|
|
5051
|
+
}, "?"),
|
|
5052
|
+
),
|
|
5053
|
+
help[0] === true ? h("div", { className: "wsr-search-hint" }, t("search.hint")) : null,
|
|
5054
|
+
h("div", { className: "wsr-search-bar" },
|
|
5055
|
+
input,
|
|
5056
|
+
h("button", { type: "button", className: "wsr-btn wsr-btn-primary", onClick: function () { run(searchDraft, false); } }, t("search.run")),
|
|
4909
5057
|
),
|
|
4910
|
-
|
|
5058
|
+
h("div", { className: "wsr-search-history" },
|
|
4911
5059
|
h("span", { className: "wsr-search-history-label" }, t("search.history")),
|
|
4912
5060
|
historyList.map(function (item, index) {
|
|
4913
|
-
var
|
|
4914
|
-
|
|
5061
|
+
var entry = historyEntry(item);
|
|
5062
|
+
var label = historyLabel(entry);
|
|
5063
|
+
return h("span", { className: "wsr-search-chip", key: historyKey(entry) + ":" + String(index) },
|
|
4915
5064
|
h("button", {
|
|
4916
5065
|
type: "button",
|
|
4917
5066
|
className: "wsr-search-chip-run",
|
|
4918
|
-
title: t("search.historyRun", { query:
|
|
5067
|
+
title: t("search.historyRun", { query: label }),
|
|
4919
5068
|
onClick: function () {
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
5069
|
+
/* Restore the scope too: the words alone would answer a
|
|
5070
|
+
different question than the one that was asked. */
|
|
5071
|
+
searchFilters.workspace = entry.workspace;
|
|
5072
|
+
searchFilters.session = entry.session;
|
|
5073
|
+
searchFilters.role = entry.role;
|
|
5074
|
+
filterEpoch += 1;
|
|
5075
|
+
searchDraft = entry.query;
|
|
5076
|
+
run(entry.query, false);
|
|
5077
|
+
},
|
|
5078
|
+
}, label),
|
|
4924
5079
|
h("button", {
|
|
4925
5080
|
type: "button",
|
|
4926
5081
|
className: "wsr-search-chip-drop",
|
|
@@ -4928,27 +5083,46 @@
|
|
|
4928
5083
|
"aria-label": t("search.historyDrop"),
|
|
4929
5084
|
onClick: function (event) {
|
|
4930
5085
|
if (event !== undefined && typeof event.stopPropagation === "function") event.stopPropagation();
|
|
4931
|
-
if (typeof actions.dropSearch === "function") actions.dropSearch(
|
|
5086
|
+
if (typeof actions.dropSearch === "function") actions.dropSearch(entry);
|
|
5087
|
+
var dropKey = historyKey(entry);
|
|
5088
|
+
historyDropped[dropKey] = true;
|
|
5089
|
+
searchHistoryMirror = searchHistoryMirror.filter(function (item) {
|
|
5090
|
+
return historyKey(item) !== dropKey;
|
|
5091
|
+
});
|
|
5092
|
+
commit(Object.assign({}, view));
|
|
4932
5093
|
},
|
|
4933
5094
|
}, "\u00d7"),
|
|
4934
5095
|
);
|
|
4935
5096
|
}),
|
|
5097
|
+
historyList.length === 0
|
|
5098
|
+
? h("span", { className: "wsr-search-history-empty" }, t("search.historyEmpty"))
|
|
5099
|
+
: null,
|
|
4936
5100
|
h("button", {
|
|
4937
5101
|
type: "button",
|
|
4938
5102
|
className: "wsr-search-history-clear",
|
|
4939
5103
|
onClick: function () {
|
|
4940
5104
|
if (typeof actions.clearSearches === "function") actions.clearSearches();
|
|
5105
|
+
searchHistoryMirror = [];
|
|
5106
|
+
historyDropped = {};
|
|
5107
|
+
historyCleared = true;
|
|
5108
|
+
commit(Object.assign({}, view));
|
|
4941
5109
|
},
|
|
4942
5110
|
}, t("search.historyClear")),
|
|
4943
5111
|
),
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
5112
|
+
h("div", { className: "wsr-search-status" },
|
|
5113
|
+
view.busy ? t("search.searching") : null,
|
|
5114
|
+
view.error !== "" ? view.error : null,
|
|
5115
|
+
view.pending > 0 ? t("search.indexing", { n: String(view.pending) }) : null,
|
|
5116
|
+
view.loaded && !view.busy && view.error === ""
|
|
5117
|
+
? t("search.summary", { hits: String(view.hits.length), sessions: String(view.total), ms: String(view.took) })
|
|
5118
|
+
: null,
|
|
5119
|
+
),
|
|
5120
|
+
view.loaded && !view.busy && view.hits.length === 0 && sessionRows.length === 0
|
|
5121
|
+
? h("div", { className: "wsr-page-note" }, t("search.empty"))
|
|
5122
|
+
: null,
|
|
4949
5123
|
sessionRows.length > 0
|
|
4950
5124
|
? h("div", { className: "wsr-page-list" },
|
|
4951
|
-
h("div", { className: "wsr-search-
|
|
5125
|
+
h("div", { className: "wsr-search-group" }, t("search.sessionResults", { n: String(sessionRows.length) })),
|
|
4952
5126
|
sessionRows,
|
|
4953
5127
|
)
|
|
4954
5128
|
: null,
|
|
@@ -5410,25 +5584,25 @@
|
|
|
5410
5584
|
if (draft.followUps === null || typeof draft.followUps !== "object") return;
|
|
5411
5585
|
if (draft.followUps[sessionId] !== undefined) delete draft.followUps[sessionId];
|
|
5412
5586
|
},
|
|
5413
|
-
/*
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5587
|
+
/* One entry per distinct search, newest first; identical searches
|
|
5588
|
+
move to the front instead of appearing twice. */
|
|
5589
|
+
pushSearch: function (draft, entry) {
|
|
5590
|
+
var item = historyEntry(entry);
|
|
5591
|
+
if (item.query === "" && item.workspace === "" && item.session === "" && item.role === "") return;
|
|
5417
5592
|
var list = Array.isArray(draft.searchHistory) ? draft.searchHistory : [];
|
|
5418
|
-
var
|
|
5419
|
-
var next = [
|
|
5593
|
+
var key = historyKey(item);
|
|
5594
|
+
var next = [historyEncode(item)];
|
|
5420
5595
|
for (var i = 0; i < list.length && next.length < SEARCH_HISTORY_MAX; i += 1) {
|
|
5421
|
-
if (
|
|
5422
|
-
next.push(list[i]);
|
|
5596
|
+
if (historyKey(list[i]) === key) continue;
|
|
5597
|
+
next.push(historyEncode(list[i]));
|
|
5423
5598
|
}
|
|
5424
5599
|
draft.searchHistory = next;
|
|
5425
5600
|
},
|
|
5426
|
-
dropSearch: function (draft,
|
|
5427
|
-
var
|
|
5428
|
-
if (text === "") return;
|
|
5601
|
+
dropSearch: function (draft, entry) {
|
|
5602
|
+
var key = historyKey(entry);
|
|
5429
5603
|
var list = Array.isArray(draft.searchHistory) ? draft.searchHistory : [];
|
|
5430
5604
|
draft.searchHistory = list.filter(function (item) {
|
|
5431
|
-
return
|
|
5605
|
+
return historyKey(item) !== key;
|
|
5432
5606
|
});
|
|
5433
5607
|
},
|
|
5434
5608
|
clearSearches: function (draft) {
|
|
@@ -5678,6 +5852,11 @@
|
|
|
5678
5852
|
hitRow: searchHitRow,
|
|
5679
5853
|
shortId: shortSessionId,
|
|
5680
5854
|
resumePasses: function () { suppressedUntil = 0; },
|
|
5855
|
+
filters: function () { return searchFilters; },
|
|
5856
|
+
resetHistoryMirror: function () { searchHistoryMirror = []; historyDropped = {}; historyCleared = false; },
|
|
5857
|
+
encodeSearch: historyEncode,
|
|
5858
|
+
decodeSearch: historyEntry,
|
|
5859
|
+
searchLabel: historyLabel,
|
|
5681
5860
|
};
|
|
5682
5861
|
|
|
5683
5862
|
/* The search feature ships disabled while its cost is being isolated;
|
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.32.
|
|
35
|
+
export const HOST_VERSION = "0.32.1";
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Exact routes the client half calls. Registered on the bare web server, so they
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ws-recency",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.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",
|