dsh-agent-floor 0.2.0 → 0.3.0
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 -1
- package/client.js +78 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,11 +9,12 @@ DSH 自带的「任务管理」页已经能看到 agent 树和后台任务,但
|
|
|
9
9
|
- **收起**:`● 2 在跑 / 5 在岗`(有会话在跑时圆点呼吸)
|
|
10
10
|
- **点开**:每个会话一行 —— 状态点、名字(组长带 `带队 N`)、`第N步·第T轮 · 12.3k tok`、正在跑的 `bash · pnpm run build` 或 `改 client.js · index.js`
|
|
11
11
|
- 点任意一行 → 跳到那个会话
|
|
12
|
+
- **按住标题栏拖动**可以把监控条挪到任意位置(位置存在 localStorage,自动记住)
|
|
12
13
|
|
|
13
14
|
## 装
|
|
14
15
|
|
|
15
16
|
```bash
|
|
16
|
-
dsh plugin install dsh-agent-floor # npm,0.
|
|
17
|
+
dsh plugin install dsh-agent-floor # npm,0.3.0+
|
|
17
18
|
```
|
|
18
19
|
|
|
19
20
|
或加市场索引源:`https://raw.githubusercontent.com/ITxuezhe/dsh-agent-floor/main/market/index.json`
|
|
@@ -28,6 +29,7 @@ Host 半监听会话事件折叠成快照,并按会话 cwd 跑 `git status --p
|
|
|
28
29
|
- 状态:`running` 或 45 秒内有动静 → RUNNING;5 分钟内 → STANDBY;否则 IDLE
|
|
29
30
|
- 子代理靠 `parentSession` 归到组长名下,空闲超过 10 分钟自动淡出
|
|
30
31
|
- 展开/收起状态存在 localStorage `dsh.agent-floor.open`
|
|
32
|
+
- 位置存在 localStorage `dsh.agent-floor.pos`(相对左下角,`{x,y}`)
|
|
31
33
|
|
|
32
34
|
## 自检
|
|
33
35
|
|
package/client.js
CHANGED
|
@@ -8,19 +8,22 @@ window.__ModuleLoader__.load({
|
|
|
8
8
|
const inject = ['slots'];
|
|
9
9
|
const ROUTE = '/dsh-agent-floor/state';
|
|
10
10
|
const OPEN_KEY = 'dsh.agent-floor.open';
|
|
11
|
+
const POS_KEY = 'dsh.agent-floor.pos';
|
|
11
12
|
const CHILD_TTL = 10 * 60 * 1000;
|
|
12
13
|
const MAX_ROWS = 8;
|
|
13
14
|
|
|
14
15
|
const CSS = `
|
|
15
|
-
.fg-root{position:fixed;
|
|
16
|
+
.fg-root{position:fixed;inset:0;z-index:60;pointer-events:none;
|
|
16
17
|
font:12px/1.5 ui-sans-serif,-apple-system,"SF Pro Text","PingFang SC",system-ui,sans-serif;
|
|
17
18
|
color:var(--dsw-alias-label-primary,#1c1c1e);}
|
|
18
|
-
.fg-dock{min-width:196px;max-width:340px;border-radius:12px;overflow:hidden;
|
|
19
|
+
.fg-dock{position:absolute;min-width:196px;max-width:340px;border-radius:12px;overflow:hidden;
|
|
20
|
+
pointer-events:auto;
|
|
19
21
|
background:var(--dsw-alias-bg-overlay,#fff);
|
|
20
22
|
border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.09));
|
|
21
23
|
box-shadow:0 8px 28px rgba(0,0,0,.12);}
|
|
22
|
-
.fg-head{display:flex;align-items:center;gap:7px;padding:7px 10px;cursor:
|
|
23
|
-
user-select:none;-webkit-user-select:none;}
|
|
24
|
+
.fg-head{display:flex;align-items:center;gap:7px;padding:7px 10px;cursor:grab;
|
|
25
|
+
user-select:none;-webkit-user-select:none;touch-action:none;}
|
|
26
|
+
.fg-head.dragging{cursor:grabbing;}
|
|
24
27
|
.fg-head:hover{background:var(--dsw-alias-bg-layer-2,rgba(0,0,0,.03));}
|
|
25
28
|
.fg-pulse{width:7px;height:7px;border-radius:50%;flex:0 0 auto;
|
|
26
29
|
background:var(--dsw-alias-state-idle-primary,#9aa0a6);}
|
|
@@ -167,11 +170,26 @@ window.__ModuleLoader__.load({
|
|
|
167
170
|
]);
|
|
168
171
|
}
|
|
169
172
|
|
|
173
|
+
function readPos() {
|
|
174
|
+
try {
|
|
175
|
+
const raw = localStorage.getItem(POS_KEY);
|
|
176
|
+
if (raw) {
|
|
177
|
+
const v = JSON.parse(raw);
|
|
178
|
+
if (v && Number.isFinite(v.x) && Number.isFinite(v.y)) return { x: v.x, y: v.y };
|
|
179
|
+
}
|
|
180
|
+
} catch {}
|
|
181
|
+
return { x: 14, y: 14 };
|
|
182
|
+
}
|
|
183
|
+
|
|
170
184
|
function MonitorBar(props) {
|
|
171
185
|
const ctx = (props && props.ctx) || null;
|
|
172
186
|
const [open, setOpen] = useState(() => {
|
|
173
187
|
try { return localStorage.getItem(OPEN_KEY) === '1'; } catch { return false; }
|
|
174
188
|
});
|
|
189
|
+
const [pos, setPos] = useState(readPos);
|
|
190
|
+
const [dragging, setDragging] = useState(false);
|
|
191
|
+
const dragRef = useRef(null);
|
|
192
|
+
const movedRef = useRef(false);
|
|
175
193
|
const data = useFloor(open, props && props.initialData);
|
|
176
194
|
const agents = deriveAgents(data);
|
|
177
195
|
const running = agents.filter((a) => a.status === 'RUNNING').length;
|
|
@@ -186,6 +204,51 @@ window.__ModuleLoader__.load({
|
|
|
186
204
|
|
|
187
205
|
useEffect(() => { ensureStyle(); }, []);
|
|
188
206
|
|
|
207
|
+
useEffect(() => {
|
|
208
|
+
if (!dragging) return undefined;
|
|
209
|
+
const move = (e) => {
|
|
210
|
+
const d = dragRef.current;
|
|
211
|
+
if (!d) return;
|
|
212
|
+
const dx = e.clientX - d.x0;
|
|
213
|
+
const dy = e.clientY - d.y0;
|
|
214
|
+
if (Math.abs(dx) + Math.abs(dy) > 3) movedRef.current = true;
|
|
215
|
+
const maxX = Math.max(8, (window.innerWidth || 1200) - 120);
|
|
216
|
+
const maxY = Math.max(8, (window.innerHeight || 800) - 60);
|
|
217
|
+
setPos({
|
|
218
|
+
x: Math.min(maxX, Math.max(8, d.px + dx)),
|
|
219
|
+
y: Math.min(maxY, Math.max(8, d.py - dy)),
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
const up = () => {
|
|
223
|
+
setDragging(false);
|
|
224
|
+
const p = readPos();
|
|
225
|
+
try { localStorage.setItem(POS_KEY, JSON.stringify(snapRef.current || p)); } catch {}
|
|
226
|
+
};
|
|
227
|
+
window.addEventListener('pointermove', move);
|
|
228
|
+
window.addEventListener('pointerup', up);
|
|
229
|
+
window.addEventListener('pointercancel', up);
|
|
230
|
+
return () => {
|
|
231
|
+
window.removeEventListener('pointermove', move);
|
|
232
|
+
window.removeEventListener('pointerup', up);
|
|
233
|
+
window.removeEventListener('pointercancel', up);
|
|
234
|
+
};
|
|
235
|
+
}, [dragging]);
|
|
236
|
+
|
|
237
|
+
const snapRef = useRef(pos);
|
|
238
|
+
snapRef.current = pos;
|
|
239
|
+
|
|
240
|
+
const onHeadDown = (e) => {
|
|
241
|
+
if (e.button !== undefined && e.button !== 0) return;
|
|
242
|
+
dragRef.current = { x0: e.clientX, y0: e.clientY, px: pos.x, py: pos.y };
|
|
243
|
+
movedRef.current = false;
|
|
244
|
+
setDragging(true);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const onHeadClick = () => {
|
|
248
|
+
if (movedRef.current) { movedRef.current = false; return; }
|
|
249
|
+
toggle();
|
|
250
|
+
};
|
|
251
|
+
|
|
189
252
|
const openSession = (a) => {
|
|
190
253
|
const id = a && a.id;
|
|
191
254
|
if (!id) return;
|
|
@@ -197,8 +260,17 @@ window.__ModuleLoader__.load({
|
|
|
197
260
|
} catch {}
|
|
198
261
|
};
|
|
199
262
|
|
|
200
|
-
return h('div', { className: 'fg-root' }, h('div', {
|
|
201
|
-
|
|
263
|
+
return h('div', { className: 'fg-root' }, h('div', {
|
|
264
|
+
className: 'fg-dock',
|
|
265
|
+
style: { left: pos.x + 'px', bottom: pos.y + 'px' },
|
|
266
|
+
}, [
|
|
267
|
+
h('div', {
|
|
268
|
+
className: 'fg-head' + (dragging ? ' dragging' : ''),
|
|
269
|
+
key: 'head',
|
|
270
|
+
onPointerDown: onHeadDown,
|
|
271
|
+
onClick: onHeadClick,
|
|
272
|
+
title: '拖动可移动位置 · 点击' + (open ? '收起' : '展开'),
|
|
273
|
+
}, [
|
|
202
274
|
h('span', { className: 'fg-pulse' + (running ? ' on' : ''), key: 'p' }),
|
|
203
275
|
h('span', { className: 'fg-sum', key: 's' }, [
|
|
204
276
|
running ? running + ' 在跑' : '全部空闲',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agent-floor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Agent Floor — a compact always-on dock for DeepSeek Harness: which session is running, how far along, how many tokens, which files changed.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|