dsh-ws-recency 0.25.0 → 0.25.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 CHANGED
@@ -45,6 +45,7 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
45
45
  - 用的是**宿主原生置顶集合**,不是第二套置顶:会话「…」菜单里的置顶/取消置顶照旧;
46
46
  - 置顶区每行显示标题 + 所属工作区名,点行直接打开;hover 出现「取消置顶」;
47
47
  - 置顶期间它在原工作区分组里的那一行**隐藏**(不重复出现),取消置顶后原行回到原位;
48
+ - 置顶行沿用同一套状态色(运行中蓝 / 完成未读绿 / 需要跟进琥珀),运行状态变化即时更新(0.25.1 修);
48
49
  - 工作区分组、组内顺序、折叠、颜色全部照旧;
49
50
  - 只在按工作区分组时出现;搜索、扁平视图、侧栏收起时自动隐藏。
50
51
 
@@ -181,7 +182,7 @@ dsh plugin --profile <profile> add github:chyxhtc/dsh-ws-recency
181
182
  或固定版本的预构建包:
182
183
 
183
184
  ```powershell
184
- dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.25.0/dsh-ws-recency-0.25.0.tgz
185
+ dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.25.1/dsh-ws-recency-0.25.1.tgz
185
186
  ```
186
187
 
187
188
  装完把 `dsh-ws-recency` 加进 `~/.hypers-work/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,重启应用。
package/client.js CHANGED
@@ -107,6 +107,9 @@
107
107
  ".wsr-pin-ws{flex:none;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--dsw-alias-label-tertiary)}",
108
108
  ".wsr-pin-unpin{flex:none;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:11px;padding:2px 4px;border-radius:4px;visibility:hidden}",
109
109
  ".wsr-pin-row:hover .wsr-pin-unpin{visibility:visible}",
110
+ ".wsr-pin-row[" + STATE_ATTR + '="running"] .wsr-pin-title{color:#4f8ef7}',
111
+ ".wsr-pin-row[" + STATE_ATTR + '="unread"] .wsr-pin-title{color:#3fae6b}',
112
+ ".wsr-pin-row[" + STATE_ATTR + '="followup"] .wsr-pin-title{color:#d99a2b}',
110
113
  ".wsr-pin-unpin:hover{color:var(--dsw-alias-label-primary)}",
111
114
  ".wsr-pill{box-sizing:border-box;border:none;background:0 0;color:var(--dsw-alias-label-tertiary);font:inherit;font-variant-numeric:tabular-nums;line-height:inherit;white-space:nowrap;border-radius:var(--dsw-radius-sm,6px);display:inline-flex;align-items:center;gap:6px;padding:1px 8px;cursor:pointer}",
112
115
  ".wsr-pill:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08));color:var(--dsw-alias-label-secondary,#cfd3d8)}",
@@ -1090,10 +1093,11 @@
1090
1093
  return false;
1091
1094
  }
1092
1095
 
1093
- function pinnedRowElement(item) {
1096
+ function pinnedRowElement(item, state) {
1094
1097
  var row = document.createElement("div");
1095
1098
  row.className = "wsr-pin-row";
1096
1099
  row.setAttribute("data-row-key", "pin:" + item.id);
1100
+ setRowState(row, state === undefined ? null : state);
1097
1101
  var title = document.createElement("span");
1098
1102
  title.className = "wsr-pin-title";
1099
1103
  title.textContent = item.title;
@@ -1122,8 +1126,7 @@
1122
1126
  }
1123
1127
 
1124
1128
  /** Hide the copies inside their own groups so nothing is listed twice. */
1125
- function hideOriginalRows(entries, pinnedIds) {
1126
- for (var i = 0; i < entries.length; i += 1) {
1129
+ function hideOriginalRows(entries, pinnedIds) { for (var i = 0; i < entries.length; i += 1) {
1127
1130
  var rows = rowElements(entries[i].section);
1128
1131
  for (var j = 0; j < rows.length; j += 1) {
1129
1132
  var id = sessionIdOf(rows[j]);
@@ -1138,6 +1141,30 @@
1138
1141
  }
1139
1142
  }
1140
1143
 
1144
+ /** One session's running / unread / follow-up state, or null. */
1145
+ function statesOfId(states, id) {
1146
+ if (states === null || states === undefined || id === null || id === undefined || id === "") return null;
1147
+ var state = states[id];
1148
+ return state === undefined ? null : state;
1149
+ }
1150
+
1151
+ /**
1152
+ * Push the current state onto the pin rows already in the DOM.
1153
+ *
1154
+ * The section is rebuilt only when the pinned set or its labels change, so
1155
+ * a session that starts running has to be recoloured in place - otherwise
1156
+ * its row would keep the state it had when the section was last built.
1157
+ */
1158
+ function applyPinStates(host, states) {
1159
+ if (host === null || typeof host.querySelectorAll !== "function") return;
1160
+ var rows = host.querySelectorAll('[data-row-key^="pin:"]');
1161
+ for (var i = 0; i < rows.length; i += 1) {
1162
+ var key = rows[i].getAttribute("data-row-key");
1163
+ var id = key === null ? "" : key.slice("pin:".length);
1164
+ setRowState(rows[i], statesOfId(states, id));
1165
+ }
1166
+ }
1167
+
1141
1168
  /**
1142
1169
  * Render the "pinned" section above every workspace group.
1143
1170
  *
@@ -1145,7 +1172,7 @@
1145
1172
  * (flex order -1), rebuilt only when the pinned set or its labels change. The
1146
1173
  * host keeps owning the list; the workspace grouping below is untouched.
1147
1174
  */
1148
- function renderPinned(entries, sessions, workspaces, settings) {
1175
+ function renderPinned(entries, sessions, workspaces, settings, states) {
1149
1176
  if (typeof document === "undefined") return;
1150
1177
  var items = pinnedItemsOf(sessions, workspaces, settings);
1151
1178
 
@@ -1184,8 +1211,10 @@
1184
1211
  head.className = "wsr-pin-head";
1185
1212
  head.textContent = t("pin.head");
1186
1213
  pinHost.appendChild(head);
1187
- for (var i = 0; i < items.length; i += 1) pinHost.appendChild(pinnedRowElement(items[i]));
1214
+ for (var i = 0; i < items.length; i += 1) pinHost.appendChild(pinnedRowElement(items[i], statesOfId(states, items[i].id)));
1188
1215
  }
1216
+ /* The state can change while the pinned set stays the same. */
1217
+ applyPinStates(pinHost, states);
1189
1218
  var pinnedIds = new Set(items.map(function (item) { return item.id; }));
1190
1219
  hideOriginalRows(entries, pinnedIds);
1191
1220
  }
@@ -1217,7 +1246,13 @@
1217
1246
  * is never inferred, and only an explicit clear removes it. Running and
1218
1247
  * unread outrank it on screen; once they pass, amber comes back.
1219
1248
  */
1220
- function decorateRows(entries, sessions, statuses, settings) {
1249
+ /**
1250
+ * running / unread / follow-up per session id.
1251
+ *
1252
+ * Both the host's rows and the plugin's own pinned rows read this, so a
1253
+ * pinned session keeps the same colour it had inside its group.
1254
+ */
1255
+ function statesOf(sessions, statuses, settings) {
1221
1256
  var flags = settings.followUps;
1222
1257
  var byId = sessions.byId || {};
1223
1258
  var states = {};
@@ -1238,7 +1273,10 @@
1238
1273
  var flagged = flags[id] !== undefined;
1239
1274
  states[id] = running ? "running" : unread ? "unread" : flagged ? "followup" : null;
1240
1275
  }
1276
+ return states;
1277
+ }
1241
1278
 
1279
+ function decorateRows(entries, states) {
1242
1280
  for (var i = 0; i < entries.length; i += 1) {
1243
1281
  var rows = rowElements(entries[i].section);
1244
1282
  for (var j = 0; j < rows.length; j += 1) {
@@ -1425,8 +1463,9 @@
1425
1463
 
1426
1464
  orderGroups(entries, latestByWorkspace(sessions, workspaces));
1427
1465
  foldRows(entries, settings, sessions, Date.now());
1428
- renderPinned(entries, sessions, workspaces, settings);
1429
- if (settings.colors) decorateRows(entries, sessions, data.statuses, settings);
1466
+ var states = settings.colors ? statesOf(sessions, data.statuses, settings) : null;
1467
+ renderPinned(entries, sessions, workspaces, settings, states);
1468
+ if (states !== null) decorateRows(entries, states);
1430
1469
  decorateComposerStats();
1431
1470
  }
1432
1471
 
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.25.0";
35
+ export const HOST_VERSION = "0.25.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.25.0",
3
+ "version": "0.25.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, and moving a session to another workspace.",
5
5
  "license": "MIT",
6
6
  "author": "chyxhtc",