dsh-ws-recency 0.32.2 → 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 (4) hide show
  1. package/README.md +2 -0
  2. package/client.js +234 -34
  3. package/index.js +7 -2
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -175,6 +175,8 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
175
175
  - 每条结果有两个动作:`看上下文` 在行内展开命中处前后各约 400 字(不碰聊天区,长会话也不卡),`打开会话` 才真的跳转;
176
176
  - 搜索过的词会记进「最近搜索」,点一下重搜、点 × 删一条、右侧「清空」全清,重启后还在。
177
177
  - 点「打开会话」:打开那个会话 → 点右侧竖条上对应轮次的格子(这是宿主自己的跳转入口,会连带加载那一段历史)→ 关键词在正文里高亮。**跳转本身可能等几秒到十几秒**,那是宿主加载历史的时间;插件自己在浮标里报的那点是几十毫秒级。
178
+ - 命中离最新一轮太远时(默认超过 40 轮)会先问一句:「只看上下文」还是「仍然跳过去」。额度可在设置里改,填 0 就是每次都直接跳。
179
+ - 跳转期间浮标会显示「正在加载第 N 轮… 已等 Xs」,只有真正落到那一轮才换成「已定位」——之前是点击瞬间就报成功,于是界面在转、提示却说好了。
178
180
  - 第一次搜索要为每个会话建一次正文索引(存在 `~/.hypers-work/.wsr/search/<sessionId>.json`,按日志大小 + revision 决定是否失效)。面板顶部会显示「还有 N 个会话正在建立索引」,每轮补一批、结果自动刷新,之后同一份日志不再重复解码。
179
181
 
180
182
  ## 设置
package/client.js CHANGED
@@ -75,6 +75,10 @@
75
75
  var MIN_DAYS = 1;
76
76
  var MAX_DAYS = 90;
77
77
  var DEFAULT_DAYS = 3;
78
+
79
+ /** Turns behind the newest that make a jump ask first; 0 disables asking. */
80
+ var DEFAULT_COLD_JUMP = 40;
81
+ var MAX_COLD_JUMP = 500;
78
82
  /** Safety stop for driving the host's own "show more" (5 rows per click). */
79
83
  var MAX_EXPAND_CLICKS = 40;
80
84
  var TICK_MS = 5 * 60 * 1000;
@@ -361,7 +365,7 @@
361
365
  ".wsr-hit-actions{display:flex;gap:6px;justify-content:flex-end;margin-top:2px}",
362
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}",
363
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))}",
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}",
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}",
365
369
  /* A column flex box with a fixed height shrinks its children once the
366
370
  content is taller than the box, and the shortest row goes first - that
367
371
  is how the recent-searches row vanished only after a search returned
@@ -410,6 +414,7 @@
410
414
  ".wsr-hit-step{flex:none;color:var(--dsw-alias-label-secondary)}",
411
415
  ".wsr-jump-toast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%);z-index:9999;padding:6px 12px;border-radius:8px;font-size:12px;background:var(--dsw-alias-bg-layer-3,rgba(32,34,38,.96));color:var(--dsw-alias-label-primary);border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.14));box-shadow:0 8px 24px rgba(0,0,0,.4);pointer-events:none}",
412
416
  ".wsr-diagnose-toast{max-width:min(680px,90vw);white-space:normal;line-height:1.6;text-align:left;font-variant-numeric:tabular-nums}",
417
+ ".wsr-jump-loading{color:var(--dsw-alias-label-secondary)}",
413
418
  ".wsr-jump-toast-warn{border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary,#d9534f) 45%,transparent);color:var(--dsw-alias-state-error-primary,#d9534f)}",
414
419
  ".wsr-hit-cwd{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:rtl;text-align:left}",
415
420
  ".wsr-mark{background:rgba(79,142,247,.28);color:inherit;border-radius:2px}",
@@ -533,6 +538,9 @@
533
538
  "diagnose.report": "近 60 秒:扫描 {passes} 次 / 共 {total}ms / 最慢 {worst}ms · 页面节点 {nodes} · 已挂载轮次 {turns}",
534
539
  "search.contextShow": "看上下文",
535
540
  "search.contextHide": "收起",
541
+ "search.coldExpanded": "第 {turn} 轮在最新一轮之前 {behind} 轮,已展开上下文;要跳转请点这一行的「打开会话」。",
542
+ "search.settings.coldTitle": "跳转前确认",
543
+ "search.settings.coldDesc": "命中离最新一轮超过这么多轮时先问一句;0 表示每次都直接跳。",
536
544
  "search.openSession": "打开会话",
537
545
  "search.hint": "空格=都要有 · \"词组\" · a|b 或 · -排除",
538
546
  "search.filterWorkspace": "工作区",
@@ -548,6 +556,8 @@
548
556
 
549
557
  "search.historyEmpty": "还没有记录",
550
558
  "search.step": "第 {n} 步",
559
+ "search.jumpLoading": "正在加载第 {turn} 轮… {secs}s",
560
+ "search.jumpLoadingCold": "正在加载第 {turn} 轮(历史较早,可能要十几秒)… {secs}s",
551
561
  "search.jumpTurn": "已定位:第 {turn} 轮 · 按轮次",
552
562
  "search.jumpText": "已定位:第 {turn} 轮 · 按文字",
553
563
  "search.jumpNoSession": "打不开这个会话(可能已归档、或不在当前工作区)",
@@ -747,6 +757,9 @@
747
757
  "diagnose.report": "Last 60s: {passes} passes / {total}ms total / {worst}ms worst · {nodes} nodes · {turns} turns mounted",
748
758
  "search.contextShow": "Show context",
749
759
  "search.contextHide": "Hide",
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.",
761
+ "search.settings.coldTitle": "Ask before a long jump",
762
+ "search.settings.coldDesc": "Ask when a hit is this many turns behind the newest one; 0 jumps every time.",
750
763
  "search.openSession": "Open session",
751
764
  "search.hint": "space = all of them · \"phrase\" · a|b either · -exclude",
752
765
  "search.filterWorkspace": "Workspace",
@@ -762,6 +775,8 @@
762
775
 
763
776
  "search.historyEmpty": "nothing yet",
764
777
  "search.step": "step {n}",
778
+ "search.jumpLoading": "Loading turn {turn}… {secs}s",
779
+ "search.jumpLoadingCold": "Loading turn {turn} (older history, this can take a while)… {secs}s",
765
780
  "search.jumpTurn": "Landed on turn {turn} (by turn)",
766
781
  "search.jumpText": "Landed on turn {turn} (by text)",
767
782
  "search.jumpNoSession": "Could not open that session (archived, or outside the current workspace)",
@@ -3821,6 +3836,43 @@
3821
3836
  }, t("menu.stats"));
3822
3837
  }
3823
3838
 
3839
+ /** Settings -> General row: ask before a jump that loads a lot of history. */
3840
+ function ColdJumpRow(props) {
3841
+ var settings = props.useStore(function (state) { return state; });
3842
+ var value = Number(settings.coldJumpTurns);
3843
+ if (!Number.isFinite(value)) value = DEFAULT_COLD_JUMP;
3844
+ var text = t("search.settings.coldTitle");
3845
+ return h("div", { className: "wsr-setRow" },
3846
+ h("div", { className: "wsr-setText" },
3847
+ h("div", { className: "wsr-setTitle" }, text),
3848
+ h("div", { className: "wsr-setDesc" }, t("search.settings.coldDesc")),
3849
+ ),
3850
+ h("div", { className: "wsr-controls" },
3851
+ h("button", {
3852
+ type: "button",
3853
+ className: "wsr-step",
3854
+ "aria-label": text + " -1",
3855
+ onClick: function () { props.actions.setColdJumpTurns(value - 10); },
3856
+ }, "-"),
3857
+ h("input", {
3858
+ type: "number",
3859
+ className: "wsr-input",
3860
+ min: 0,
3861
+ max: MAX_COLD_JUMP,
3862
+ value: String(value),
3863
+ "aria-label": text,
3864
+ onChange: function (event) { props.actions.setColdJumpTurns(event.target.value); },
3865
+ }),
3866
+ h("button", {
3867
+ type: "button",
3868
+ className: "wsr-step",
3869
+ "aria-label": text + " +1",
3870
+ onClick: function () { props.actions.setColdJumpTurns(value + 10); },
3871
+ }, "+"),
3872
+ ),
3873
+ );
3874
+ }
3875
+
3824
3876
  /** Settings -> General row: how old a session must be before it is folded. */
3825
3877
  function SettingsRow(props) {
3826
3878
  var settings = props.useStore(function (state) { return state; });
@@ -4146,9 +4198,68 @@
4146
4198
  }
4147
4199
  }
4148
4200
 
4201
+ /** The progress line shown while a jump waits for the host. */
4202
+ var jumpNote = null;
4203
+ var jumpNoteTimer = 0;
4204
+ var jumpNoteStarted = 0;
4205
+
4206
+ function clearJumpNote() {
4207
+ try {
4208
+ if (jumpNoteTimer !== 0) {
4209
+ window.clearInterval(jumpNoteTimer);
4210
+ jumpNoteTimer = 0;
4211
+ }
4212
+ if (jumpNote !== null && jumpNote !== undefined) {
4213
+ if (jumpNote.parentElement !== null && jumpNote.parentElement !== undefined) jumpNote.remove();
4214
+ jumpNote = null;
4215
+ }
4216
+ } catch (error) {
4217
+ /* nothing to clean up */
4218
+ }
4219
+ }
4220
+
4221
+ /**
4222
+ * Say that history is being loaded, and for how long.
4223
+ *
4224
+ * Clicking a rail cell starts a real page load in the host; on a long
4225
+ * session that takes seconds. The old code announced "landed" at the moment
4226
+ * of the click, so the window looked frozen with a success note already on
4227
+ * screen.
4228
+ */
4229
+ function announceJumpLoading(hit) {
4230
+ if (typeof document === "undefined") return;
4231
+ clearJumpNote();
4232
+ jumpNoteStarted = Date.now();
4233
+ /* Far behind the newest turn: say so, because the wait is proportional. */
4234
+ var cold = Number(hit.turns) - Number(hit.turn) > 40;
4235
+ var text = function () {
4236
+ var secs = String(Math.max(0, Math.round((Date.now() - jumpNoteStarted) / 1000)));
4237
+ return cold
4238
+ ? t("search.jumpLoadingCold", { turn: String(hit.turn), secs: secs })
4239
+ : t("search.jumpLoading", { turn: String(hit.turn), secs: secs });
4240
+ };
4241
+ try {
4242
+ var note = statsDiv("wsr-jump-toast wsr-jump-loading");
4243
+ note.textContent = text();
4244
+ document.body.appendChild(note);
4245
+ jumpNote = note;
4246
+ jumpNoteTimer = window.setInterval(function () {
4247
+ if (jumpNote === null || jumpNote === undefined) return;
4248
+ try {
4249
+ jumpNote.textContent = text();
4250
+ } catch (error) {
4251
+ clearJumpNote();
4252
+ }
4253
+ }, 500);
4254
+ } catch (error) {
4255
+ /* a toast is a nicety: never break the jump for it */
4256
+ }
4257
+ }
4258
+
4149
4259
  /** A short-lived line that says where the jump landed and how it got there. */
4150
4260
  function announceJump(hit, byText, costMs) {
4151
4261
  if (typeof document === "undefined") return;
4262
+ clearJumpNote();
4152
4263
  try {
4153
4264
  var note = statsDiv("wsr-jump-toast");
4154
4265
  var text = t(byText === true ? "search.jumpText" : "search.jumpTurn", { turn: String(hit.turn) });
@@ -4172,6 +4283,7 @@
4172
4283
  */
4173
4284
  function announceJumpFailure(hit, reason) {
4174
4285
  if (typeof document === "undefined") return;
4286
+ clearJumpNote();
4175
4287
  try {
4176
4288
  var note = statsDiv("wsr-jump-toast wsr-jump-toast-warn");
4177
4289
  note.textContent = t(reason, { turn: String(hit.turn), turns: String(hit.turns) });
@@ -4493,31 +4605,56 @@
4493
4605
  * One last look after a rail click: the host is loading a whole page of
4494
4606
  * history, so nothing here may poll while that runs.
4495
4607
  */
4496
- function finaliseJump(hit, terms) {
4608
+ /**
4609
+ * Look for the landed turn, and keep looking while the host pages in.
4610
+ *
4611
+ * `settle` is what makes the progress note honest: it only turns into
4612
+ * "landed" once the turn is actually in the document.
4613
+ */
4614
+ /**
4615
+ * Watch for the landing and stop counting as soon as it happens.
4616
+ *
4617
+ * The row appearing is the landing: the host moves the viewport and mounts
4618
+ * the turn, and on a session whose turns hold dozens of steps the body can
4619
+ * take many more seconds to render than the move itself. Requiring the
4620
+ * matched text before declaring success reported "not found" for jumps that
4621
+ * had visibly worked, and kept the progress note counting to its deadline.
4622
+ */
4623
+ function settleJump(hit, terms, attempt, spentMs) {
4497
4624
  if (typeof document === "undefined") return;
4498
- var began = Date.now();
4499
4625
  var seeks = Array.isArray(hit.seeks) ? hit.seeks : hit.seek;
4500
- var scroller = conversationScroller();
4501
- if (scroller !== null) {
4502
- var row = findByText(scroller, seeks);
4503
- if (row !== null) flashTurnRow(row);
4626
+ var row = turnRowOf(Number(hit.turn));
4627
+ if (row === null) {
4628
+ /* The row can be missing while the window is still being replaced; the
4629
+ text search is only a fallback for the case the row never appears. */
4630
+ var scroller = conversationScroller();
4631
+ if (scroller !== null) row = findByText(scroller, seeks);
4632
+ }
4633
+ if (row !== null) {
4634
+ clearJumpNote();
4635
+ flashTurnRow(row);
4636
+ announceJump(hit, false, spentMs);
4637
+ markHitTerms(terms);
4638
+ suppressedUntil = 0;
4639
+ schedule();
4640
+ return;
4504
4641
  }
4505
- markHitTerms(terms);
4506
- /* Anything past a frame is ours to answer for, so say so rather than
4507
- letting it pass as the host being slow. */
4508
- var spent = Date.now() - began;
4509
- if (spent > 120 && typeof window !== "undefined") {
4510
- window.__DSH_WSR_LAST_TAIL_MS__ = spent;
4642
+ /* Roughly ten seconds: past that the host is not going to land it, and
4643
+ the note should stop pretending to know. */
4644
+ if (attempt < 14) {
4645
+ window.setTimeout(function () { settleJump(hit, terms, attempt + 1, spentMs); }, 700);
4646
+ return;
4511
4647
  }
4648
+ announceJumpFailure(hit, "search.jumpNoTurn");
4512
4649
  }
4650
+
4513
4651
  /**
4514
4652
  * Bring one search hit into view.
4515
4653
  *
4516
- * Scrolling the transcript does not page older history in: the chat asks the
4517
- * user to load it, while clicking the turn rail's mark loads and aligns that
4518
- * turn. The rail is therefore the primary route. Everything here is kept
4519
- * to a few cheap lookups: the host is rendering history at the same time,
4520
- * and a polling loop on top of that is what made the jump feel frozen.
4654
+ * Scrolling does not page older history in; clicking the rail's cell for the
4655
+ * turn does, so that is the route. Everything else here is a cheap poll that
4656
+ * stops as soon as the click has been made - the landing is decided by
4657
+ * settleJump, not by this loop.
4521
4658
  */
4522
4659
  function revealHit(hit, terms) {
4523
4660
  if (typeof document === "undefined" || hit === null || hit === undefined) return;
@@ -4532,14 +4669,10 @@
4532
4669
  /* Wall time includes the host opening the session and loading its
4533
4670
  history; only the synchronous work in here belongs to this plugin. */
4534
4671
  var spentMs = 0;
4535
- var started = Date.now();
4536
4672
  var tick = function () {
4537
4673
  var beganTick = Date.now();
4538
- var done = function () {
4539
- spentMs += Date.now() - beganTick;
4540
- };
4541
4674
  var result = tickOnce();
4542
- done();
4675
+ spentMs += Date.now() - beganTick;
4543
4676
  return result;
4544
4677
  };
4545
4678
  var tickOnce = function () {
@@ -4573,15 +4706,18 @@
4573
4706
  var mark = railMarkFor(turn);
4574
4707
  if (mark !== null) {
4575
4708
  try {
4709
+ /* The lookup above can straddle a switch, and clicking the wrong
4710
+ session's rail would page history into a conversation nobody
4711
+ asked about. */
4712
+ if (currentConversationId() !== sessionId) {
4713
+ window.setTimeout(tick, 200);
4714
+ return;
4715
+ }
4576
4716
  mark.click();
4577
- announceJump(hit, false, spentMs);
4578
- /* The click starts a real history load: hand the thread back to
4579
- the host and look once when it has had time to render. */
4580
- window.setTimeout(function () {
4581
- finaliseJump(hit, terms);
4582
- suppressedUntil = 0;
4583
- schedule();
4584
- }, 1200);
4717
+ /* The click starts a real history load; until it lands, the only
4718
+ honest thing to say is that it is under way. */
4719
+ announceJumpLoading(hit);
4720
+ window.setTimeout(function () { settleJump(hit, terms, 0, spentMs); }, 900);
4585
4721
  return;
4586
4722
  } catch (error) {
4587
4723
  /* fall through */
@@ -4605,6 +4741,7 @@
4605
4741
  };
4606
4742
  window.setTimeout(tick, 200);
4607
4743
  }
4744
+
4608
4745
  function jumpToSearchHit(hit, terms) {
4609
4746
  suspendPasses(12000);
4610
4747
  openSessionRow(hit.sessionId);
@@ -4766,6 +4903,21 @@
4766
4903
  */
4767
4904
  function SearchHitRow(props) {
4768
4905
  var opened = react.useState(false);
4906
+ /* A hit far behind the newest turn means the host has to mount a lot of
4907
+ history to show it; asking first keeps a search from stalling the app
4908
+ for ten seconds without warning. */
4909
+ var cold = props.coldAfter > 0
4910
+ && Number(props.hit.turns) - Number(props.hit.turn) > props.coldAfter;
4911
+ var go = function () {
4912
+ if (cold) {
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);
4917
+ return;
4918
+ }
4919
+ if (typeof props.onJump === "function") props.onJump();
4920
+ };
4769
4921
  var context = typeof props.hit.context === "string" ? props.hit.context : "";
4770
4922
  var extra = context === "" ? null : [
4771
4923
  h("div", { className: "wsr-hit-actions" },
@@ -4782,13 +4934,16 @@
4782
4934
  className: "wsr-hit-context-jump",
4783
4935
  onClick: function (event) {
4784
4936
  if (event !== undefined && typeof event.stopPropagation === "function") event.stopPropagation();
4937
+ /* Pressing this is the confirmation. */
4785
4938
  if (typeof props.onJump === "function") props.onJump();
4786
4939
  },
4787
4940
  }, t("search.openSession")),
4788
4941
  ),
4789
- 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,
4790
4945
  ];
4791
- return searchHitRow(props.hit, props.terms, props.onJump, extra);
4946
+ return searchHitRow(props.hit, props.terms, go, extra);
4792
4947
  }
4793
4948
 
4794
4949
  /**
@@ -4828,7 +4983,33 @@
4828
4983
  );
4829
4984
  }
4830
4985
 
4986
+
4987
+ /** Say why a cold hit opened its context instead of jumping. */
4988
+ function announceColdHint(hit) {
4989
+ if (typeof document === "undefined") return;
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
+ }
5003
+ }
5004
+
4831
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
+ }
4832
5013
  var state = react.useState(searchLast === null
4833
5014
  ? { loaded: false, query: "", hits: [], sessions: [], terms: [], scanned: 0, total: 0, pending: 0, took: 0, busy: false, error: "" }
4834
5015
  : searchLast);
@@ -4845,6 +5026,9 @@
4845
5026
  var storedHistory = preferences !== null && preferences !== undefined
4846
5027
  && Array.isArray(preferences.searchHistory) ? preferences.searchHistory : [];
4847
5028
  var historyList = mergedHistory(storedHistory);
5029
+ /* 0 turns the question off and jumps straight away, as before. */
5030
+ var coldAfterRaw = Number(preferences !== null && preferences !== undefined ? preferences.coldJumpTurns : 0);
5031
+ var coldJumpTurns = Number.isFinite(coldAfterRaw) ? Math.max(0, Math.round(coldAfterRaw)) : DEFAULT_COLD_JUMP;
4848
5032
  /* Every update also parks the answer outside the component, so coming
4849
5033
  back from a hit restores the list instead of asking for a new search. */
4850
5034
  var commit = function (next) {
@@ -4957,6 +5141,7 @@
4957
5141
  var row = h(SearchHitRow, {
4958
5142
  hit: hit,
4959
5143
  terms: view.terms,
5144
+ coldAfter: coldJumpTurns,
4960
5145
  onJump: function () { jumpToSearchHit(hit, view.terms); },
4961
5146
  });
4962
5147
  row.key = String(hit.sessionId || "") + ":" + String(hit.seq || 0) + ":" + String(index);
@@ -5560,7 +5745,7 @@
5560
5745
  }
5561
5746
  var prefs = clientStore.defineStore({
5562
5747
  init: function () {
5563
- return { enabled: true, foldDays: DEFAULT_DAYS, keepActive: true, colors: true, pinnedSection: true, argMode: "tool", followUps: {}, searchHistory: [] };
5748
+ return { enabled: true, foldDays: DEFAULT_DAYS, keepActive: true, colors: true, pinnedSection: true, argMode: "tool", followUps: {}, searchHistory: [], coldJumpTurns: DEFAULT_COLD_JUMP };
5564
5749
  },
5565
5750
  persist: "dsh.ws-recency.prefs.v1",
5566
5751
  actions: {
@@ -5569,6 +5754,11 @@
5569
5754
  setColors: function (draft, value) { draft.colors = value === true; },
5570
5755
  setPinnedSection: function (draft, value) { draft.pinnedSection = value === true; },
5571
5756
  setArgMode: function (draft, value) { draft.argMode = value === "agent" ? "agent" : "tool"; },
5757
+ setColdJumpTurns: function (draft, value) {
5758
+ var next = Number(value);
5759
+ if (!Number.isFinite(next)) return;
5760
+ draft.coldJumpTurns = Math.min(MAX_COLD_JUMP, Math.max(0, Math.round(next)));
5761
+ },
5572
5762
  setFoldDays: function (draft, value) {
5573
5763
  var next = Number(value);
5574
5764
  if (!Number.isFinite(next)) return;
@@ -5662,6 +5852,16 @@
5662
5852
  }, SettingsRow);
5663
5853
  });
5664
5854
 
5855
+ ctx.slots.inject("settings.general.item", function () {
5856
+ return ctx.slots.register({
5857
+ name: "settings.general.item",
5858
+ id: "ws-recency-cold-jump",
5859
+ order: 45,
5860
+ store: prefs,
5861
+ locale: NS,
5862
+ }, ColdJumpRow);
5863
+ });
5864
+
5665
5865
  ctx.slots.inject("settings.general.item", function () {
5666
5866
  return ctx.slots.register({
5667
5867
  name: "settings.general.item",
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.2";
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.32.2",
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",