dsh-ws-recency 0.33.0 → 0.33.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.
Files changed (3) hide show
  1. package/client.js +33 -51
  2. package/index.js +7 -2
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -365,7 +365,7 @@
365
365
  ".wsr-hit-actions{display:flex;gap:6px;justify-content:flex-end;margin-top:2px}",
366
366
  ".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}",
367
367
  ".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))}",
368
- ".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}",
368
+ ".wsr-hit-context{max-height:42vh;overflow:auto;margin-top:4px;padding:8px 10px;border-radius:6px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.75;white-space:pre-wrap;word-break:break-word;tab-size:2}",
369
369
  /* A column flex box with a fixed height shrinks its children once the
370
370
  content is taller than the box, and the shortest row goes first - that
371
371
  is how the recent-searches row vanished only after a search returned
@@ -538,9 +538,7 @@
538
538
  "diagnose.report": "近 60 秒:扫描 {passes} 次 / 共 {total}ms / 最慢 {worst}ms · 页面节点 {nodes} · 已挂载轮次 {turns}",
539
539
  "search.contextShow": "看上下文",
540
540
  "search.contextHide": "收起",
541
- "search.coldJump": "这一轮在最新一轮之前 {behind} 轮,跳过去要加载大量历史,可能十几秒。",
542
- "search.coldContext": "只看上下文",
543
- "search.coldJumpAnyway": "仍然跳过去",
541
+ "search.coldExpanded": "第 {turn} 轮在最新一轮之前 {behind} 轮,已展开上下文;要跳转请点这一行的「打开会话」。",
544
542
  "search.settings.coldTitle": "跳转前确认",
545
543
  "search.settings.coldDesc": "命中离最新一轮超过这么多轮时先问一句;0 表示每次都直接跳。",
546
544
  "search.openSession": "打开会话",
@@ -759,9 +757,7 @@
759
757
  "diagnose.report": "Last 60s: {passes} passes / {total}ms total / {worst}ms worst · {nodes} nodes · {turns} turns mounted",
760
758
  "search.contextShow": "Show context",
761
759
  "search.contextHide": "Hide",
762
- "search.coldJump": "This turn is {behind} turns behind the newest one; jumping there loads a lot of history and can take a while.",
763
- "search.coldContext": "Show context",
764
- "search.coldJumpAnyway": "Jump anyway",
760
+ "search.coldExpanded": "Turn {turn} is {behind} turns behind the newest one, so its context is shown here; press Open session on this row to jump.",
765
761
  "search.settings.coldTitle": "Ask before a long jump",
766
762
  "search.settings.coldDesc": "Ask when a hit is this many turns behind the newest one; 0 jumps every time.",
767
763
  "search.openSession": "Open session",
@@ -4912,10 +4908,12 @@
4912
4908
  for ten seconds without warning. */
4913
4909
  var cold = props.coldAfter > 0
4914
4910
  && Number(props.hit.turns) - Number(props.hit.turn) > props.coldAfter;
4915
- var openContext = function () { opened[1](true); };
4916
4911
  var go = function () {
4917
4912
  if (cold) {
4918
- askColdJump(props.hit, props.onJump, openContext);
4913
+ /* Showing the context here is cheaper and more readable than a
4914
+ modal, and the row's own button is the explicit "jump anyway". */
4915
+ opened[1](true);
4916
+ announceColdHint(props.hit);
4919
4917
  return;
4920
4918
  }
4921
4919
  if (typeof props.onJump === "function") props.onJump();
@@ -4941,7 +4939,9 @@
4941
4939
  },
4942
4940
  }, t("search.openSession")),
4943
4941
  ),
4944
- opened[0] === true ? h("div", { className: "wsr-hit-context" }, context) : null,
4942
+ opened[0] === true
4943
+ ? h("div", { className: "wsr-hit-context" }, highlightSnippet(context, props.terms))
4944
+ : null,
4945
4945
  ];
4946
4946
  return searchHitRow(props.hit, props.terms, go, extra);
4947
4947
  }
@@ -4983,51 +4983,33 @@
4983
4983
  );
4984
4984
  }
4985
4985
 
4986
- /** Ask whether a jump that means loading a lot of history should go ahead. */
4987
- function askColdJump(hit, onJump, onContext) {
4986
+
4987
+ /** Say why a cold hit opened its context instead of jumping. */
4988
+ function announceColdHint(hit) {
4988
4989
  if (typeof document === "undefined") return;
4989
- closeConfirm();
4990
- confirmPrevious = typeof document.activeElement !== "undefined" ? document.activeElement : null;
4991
- var backdrop = statsDiv("wsr-modal-backdrop");
4992
- backdrop.setAttribute("data-wsr-confirm", "cold");
4993
- var panel = statsDiv("wsr-confirm");
4994
- panel.setAttribute("role", "dialog");
4995
- panel.setAttribute("aria-modal", "true");
4996
- panel.setAttribute("tabindex", "-1");
4997
- panel.appendChild(statsDiv("wsr-confirm-text", t("search.coldJump", {
4998
- turn: String(hit.turn),
4999
- behind: String(Math.max(0, Number(hit.turns) - Number(hit.turn))),
5000
- })));
5001
- var actions = statsDiv("wsr-confirm-actions");
5002
- var context = document.createElement("button");
5003
- context.type = "button";
5004
- context.className = "wsr-qcancel";
5005
- context.setAttribute("data-wsr-cold-context", "true");
5006
- context.textContent = t("search.coldContext");
5007
- context.addEventListener("click", function (event) {
5008
- if (event !== undefined && typeof event.stopPropagation === "function") event.stopPropagation();
5009
- closeConfirm(null);
5010
- if (typeof onContext === "function") onContext();
5011
- });
5012
- var accept = document.createElement("button");
5013
- accept.type = "button";
5014
- accept.className = "wsr-qsubmit";
5015
- accept.setAttribute("data-wsr-cold-jump", "true");
5016
- accept.textContent = t("search.coldJumpAnyway");
5017
- accept.addEventListener("click", function (event) {
5018
- if (event !== undefined && typeof event.stopPropagation === "function") event.stopPropagation();
5019
- closeConfirm(null);
5020
- if (typeof onJump === "function") onJump();
5021
- });
5022
- actions.appendChild(context);
5023
- actions.appendChild(accept);
5024
- panel.appendChild(actions);
5025
- backdrop.appendChild(panel);
5026
- document.body.appendChild(backdrop);
5027
- try { if (typeof panel.focus === "function") panel.focus(); } catch (error) { /* focus is a nicety */ }
4990
+ try {
4991
+ var note = statsDiv("wsr-jump-toast");
4992
+ note.textContent = t("search.coldExpanded", {
4993
+ turn: String(hit.turn),
4994
+ behind: String(Math.max(0, Number(hit.turns) - Number(hit.turn))),
4995
+ });
4996
+ document.body.appendChild(note);
4997
+ window.setTimeout(function () {
4998
+ if (note.parentElement !== null) note.remove();
4999
+ }, 6000);
5000
+ } catch (error) {
5001
+ /* a toast is a nicety */
5002
+ }
5028
5003
  }
5029
5004
 
5030
5005
  function SearchPanelPage(props) {
5006
+ /* A previous build could leave its own backdrop behind; clear it. */
5007
+ try {
5008
+ var strays = document.querySelectorAll('[data-wsr-confirm="cold"]');
5009
+ for (var stray = 0; stray < strays.length; stray += 1) strays[stray].remove();
5010
+ } catch (error) {
5011
+ /* nothing to clean */
5012
+ }
5031
5013
  var state = react.useState(searchLast === null
5032
5014
  ? { loaded: false, query: "", hits: [], sessions: [], terms: [], scanned: 0, total: 0, pending: 0, took: 0, busy: false, error: "" }
5033
5015
  : searchLast);
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.33.0";
35
+ export const HOST_VERSION = "0.33.1";
36
36
 
37
37
  /**
38
38
  * Exact routes the client half calls. Registered on the bare web server, so they
@@ -910,7 +910,12 @@ function searchSeeks(text, needle) {
910
910
  */
911
911
  function searchContext(text, needle, radius) {
912
912
  const span = Number.isFinite(radius) ? radius : 420;
913
- const flat = text.replace(/\s+/g, " ");
913
+ /* Only spaces and tabs collapse: the line breaks carry the structure, and a
914
+ collapsed paragraph is much harder to read than a long one. */
915
+ const flat = text
916
+ .replace(/\r/g, "")
917
+ .replace(/[ \t]+/g, " ")
918
+ .replace(/\n{3,}/g, "\n\n");
914
919
  const index = needle === "" ? -1 : flat.toLowerCase().indexOf(needle);
915
920
  if (index < 0) return flat.slice(0, span * 2).trim();
916
921
  const from = Math.max(0, index - span);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ws-recency",
3
- "version": "0.33.0",
3
+ "version": "0.33.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",