@cooper-zhuang/dsh-workspace-sort 0.2.0 → 0.2.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 +3 -3
- package/lib/client.js +54 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ DSH(DeepSeek Harness)Web 插件:给左侧「工作区」那一层补排序
|
|
|
12
12
|
- **容器目录按子树汇总**:`~/Documents/Code/Mubea` 这类只用来分组的目录自己没有会话,按整个子树的最新活动参与排序,否则这个分组会沉到底部。
|
|
13
13
|
- **置顶**:把几个常驻工作区钉在列表最前,按你钉的顺序排列,不参与活动排序。
|
|
14
14
|
- **运行中的排前面**:可选。某个工作区里有会话正在跑,就排在未置顶区的前面,长任务不会沉出视野。
|
|
15
|
-
-
|
|
15
|
+
- **面板**(插件页里本组合包页面的卡片上点「打开排序面板」;侧栏不放图标):列出全部工作区,显示会话数、运行中会话数、最近活动相对时间;支持按名称筛选、点图钉置顶、开关上面两条规则、点「立即整理」立刻重排一次。
|
|
16
16
|
- **手动拖拽优先**:你用鼠标拖过之后,插件停手,直到下一次提问或你点「立即整理」。
|
|
17
17
|
- **无变化不写盘**:算出来的顺序和当前一致时,一个字节都不写。
|
|
18
18
|
|
|
@@ -21,7 +21,7 @@ DSH(DeepSeek Harness)Web 插件:给左侧「工作区」那一层补排序
|
|
|
21
21
|
- 顺序只通过官方 `workspaces.insertBefore` 写入(与拖拽同一个命令),落在 `$DSH_HOME/storages/workspace.json` 的持久顺序里,刷新、换窗口、重启都保留。
|
|
22
22
|
- 置顶与两个开关存在宿主侧 `$DSH_HOME/workspace-sort/prefs.json`(原子写:tmp 后 rename)。**不用 localStorage**:桌面端 Web 服务绑定的是随机端口(`port: 0`),页面 origin 每次重启都变,localStorage 会跟着丢。
|
|
23
23
|
- 宿主半边只有两条回环路由:`GET /dsh-workspace-sort/api/state`(配置 + 位置 + 最后一次重排决策)和 `POST /dsh-workspace-sort/api/prefs`(保存置顶与开关)。没有文件系统操作、没有子进程、没有会话操作。
|
|
24
|
-
- 面板与入口都用官方 Slot:`
|
|
24
|
+
- 面板与入口都用官方 Slot:`plugins.bundle.config`(插件页本组合包的卡片)和 `shell.overlay`(面板),不查 DOM 类名;侧栏不占任何位置。
|
|
25
25
|
|
|
26
26
|
## 安装
|
|
27
27
|
|
|
@@ -60,7 +60,7 @@ dsh plugin --profile desktop add /path/to/packages/dsh-workspace-sort
|
|
|
60
60
|
| 能力 | 本插件 | 社区 `dsh-workspace-manager` |
|
|
61
61
|
|---|---|---|
|
|
62
62
|
| 按活动排序 / 置顶 / 面板 | 有 | 有(活动规则是「升到第一个非运行工作区之上」) |
|
|
63
|
-
| 入口位置 |
|
|
63
|
+
| 入口位置 | 插件页本组合包卡片(官方 Slot) | 侧栏标题行插 DOM(依赖 CSS Module 类名) |
|
|
64
64
|
| 路径迁移(改登记 / 搬目录 / 迁会话) | **没有** | 有(`rename` / `cp` / `rm` + 会话 fork) |
|
|
65
65
|
| 移除工作区 / 清理空工作区 | **没有** | 有(删注册表项,会话进「未分组」) |
|
|
66
66
|
| 打开工作区目录 | **没有** | 有(宿主起系统命令) |
|
package/lib/client.js
CHANGED
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
* * automatic order by each Workspace's newest human prompt (`updatedAt` on a
|
|
11
11
|
* non-blank Session), optionally with running Workspaces first;
|
|
12
12
|
* * pins that keep chosen Workspaces at the front, in pin order;
|
|
13
|
-
* * a
|
|
14
|
-
* last activity,
|
|
13
|
+
* * a card on this bundle's page in the Plugins view that opens a panel with
|
|
14
|
+
* session/running counts, the last activity, a name filter, the two rule
|
|
15
|
+
* switches and a "tidy now" button (the sidebar itself gets no icon);
|
|
15
16
|
* * every write goes through `ctx.workspaces.insertBefore`, the same durable
|
|
16
17
|
* command a Workspace drag uses.
|
|
17
18
|
*
|
|
@@ -294,6 +295,12 @@ function newestActivity(activity) {
|
|
|
294
295
|
note: '只改侧栏顺序,不动文件与会话',
|
|
295
296
|
disabled: '宿主配置已停用自动排序,只能点「立即整理」',
|
|
296
297
|
ephemeral: '本次会话内的置顶与开关不会保存:宿主是旧版插件,重启一次宿主后即可落盘',
|
|
298
|
+
cardIntro: '侧栏不放入口图标;排序、置顶与规则开关都在这张卡片打开的面板里。',
|
|
299
|
+
openPanel: '打开排序面板',
|
|
300
|
+
autoOn: '自动排序已开',
|
|
301
|
+
autoOff: '自动排序已关',
|
|
302
|
+
runningOn: '运行中优先',
|
|
303
|
+
pinnedCount: '{n} 个置顶',
|
|
297
304
|
},
|
|
298
305
|
en: {
|
|
299
306
|
button: 'Workspace order',
|
|
@@ -317,6 +324,12 @@ function newestActivity(activity) {
|
|
|
317
324
|
note: 'Reorders the sidebar only; it never touches files or sessions',
|
|
318
325
|
disabled: 'Disabled in the Host config; only "Tidy now" works',
|
|
319
326
|
ephemeral: 'Pins and switches are session-only here: the Host runs the previous build, restart it once to persist them',
|
|
327
|
+
cardIntro: 'No sidebar icon: open the panel from this card to sort, pin and switch the rules.',
|
|
328
|
+
openPanel: 'Open the sorting panel',
|
|
329
|
+
autoOn: 'Auto-sort on',
|
|
330
|
+
autoOff: 'Auto-sort off',
|
|
331
|
+
runningOn: 'Running first',
|
|
332
|
+
pinnedCount: '{n} pinned',
|
|
320
333
|
},
|
|
321
334
|
}
|
|
322
335
|
|
|
@@ -345,6 +358,13 @@ function newestActivity(activity) {
|
|
|
345
358
|
.wss-action:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
346
359
|
.wss-note{padding:8px 2px 0;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:16px}
|
|
347
360
|
.wss-warn{color:var(--dsw-alias-state-warn-primary)}
|
|
361
|
+
.wss-card{display:flex;align-items:flex-start;gap:12px;justify-content:space-between;box-sizing:border-box;padding:12px 14px;margin:0 0 12px;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg,10px);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}
|
|
362
|
+
.wss-card-text{min-width:0}
|
|
363
|
+
.wss-card-title{font-size:13.5px;font-weight:600;margin:0 0 4px}
|
|
364
|
+
.wss-card-note{font-size:12px;line-height:1.55;color:var(--dsw-alias-label-secondary)}
|
|
365
|
+
.wss-card-rules{margin-top:6px;font-size:11.5px;color:var(--dsw-alias-label-secondary)}
|
|
366
|
+
.wss-card-btn{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;flex:none;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-primary);font-size:12.5px;cursor:pointer}
|
|
367
|
+
.wss-card-btn:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
348
368
|
`
|
|
349
369
|
|
|
350
370
|
/**
|
|
@@ -938,27 +958,43 @@ function newestActivity(activity) {
|
|
|
938
958
|
)
|
|
939
959
|
}
|
|
940
960
|
|
|
941
|
-
/**
|
|
942
|
-
|
|
943
|
-
|
|
961
|
+
/**
|
|
962
|
+
* The card on this bundle's page in the Plugins view, and the only entry
|
|
963
|
+
* point to the panel — the sidebar deliberately gets no footer icon.
|
|
964
|
+
*
|
|
965
|
+
* `plugins.bundle.config` hands no form in; the card reads the shared
|
|
966
|
+
* client stores directly.
|
|
967
|
+
*/
|
|
968
|
+
function BundleCard() {
|
|
969
|
+
const tr = t()
|
|
970
|
+
const statePrefs = useStore(prefs)
|
|
971
|
+
const rules = []
|
|
972
|
+
rules.push(statePrefs.auto ? tr('autoOn') : tr('autoOff'))
|
|
973
|
+
if (statePrefs.runningFirst) rules.push(tr('runningOn'))
|
|
974
|
+
if (statePrefs.pins.length > 0) rules.push(tr('pinnedCount', { n: statePrefs.pins.length }))
|
|
944
975
|
return h(
|
|
945
|
-
'
|
|
946
|
-
{
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
'
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
h(
|
|
976
|
+
'div',
|
|
977
|
+
{ className: 'wss-card' },
|
|
978
|
+
h(
|
|
979
|
+
'div',
|
|
980
|
+
{ className: 'wss-card-text' },
|
|
981
|
+
h('div', { className: 'wss-card-title' }, tr('title')),
|
|
982
|
+
h('div', { className: 'wss-card-note' }, tr('cardIntro')),
|
|
983
|
+
h('div', { className: 'wss-card-rules' }, rules.join(' · ')),
|
|
984
|
+
),
|
|
985
|
+
h(
|
|
986
|
+
'button',
|
|
987
|
+
{ type: 'button', className: 'wss-card-btn', onClick: () => panel.set({ open: true }) },
|
|
988
|
+
h(SortIcon, null),
|
|
989
|
+
tr('openPanel'),
|
|
990
|
+
),
|
|
955
991
|
)
|
|
956
992
|
}
|
|
957
993
|
|
|
958
|
-
ctx.slots.inject('
|
|
994
|
+
ctx.slots.inject('plugins.bundle.config', () =>
|
|
959
995
|
ctx.slots.register(
|
|
960
|
-
{ name: '
|
|
961
|
-
|
|
996
|
+
{ name: 'plugins.bundle.config', key: '@cooper-zhuang/dsh-workspace-sort', inject: () => ({}) },
|
|
997
|
+
BundleCard,
|
|
962
998
|
),
|
|
963
999
|
)
|
|
964
1000
|
ctx.slots.inject('shell.overlay', () =>
|