dsh-transfer-dock 0.1.1 → 0.1.3
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 +531 -510
- package/README.zh.md +531 -510
- package/client.js +348 -119
- package/docs/architecture.svg +1 -1
- package/docs/dock-preview.png +0 -0
- package/index.js +10 -3
- package/lib/detect.js +4 -1
- package/package.json +75 -74
- package/test/smoke.mjs +230 -155
package/README.md
CHANGED
|
@@ -1,510 +1,531 @@
|
|
|
1
|
-
<p align="right"><b>English</b> · <a href="README.zh.md">中文</a></p>
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<img src="https://raw.githubusercontent.com/imnotRiv3r/dsh-transfer-dock/main/docs/banner.svg" width="100%" alt="dsh-transfer-dock — live download cards in the corner of the DeepSeek Harness UI">
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-c4b5fd?style=flat-square" alt="License: MIT"></a>
|
|
9
|
-
<img src="https://img.shields.io/badge/node-%E2%89%A520-3c873a?style=flat-square&logo=nodedotjs&logoColor=white" alt="Node.js >= 20">
|
|
10
|
-
<img src="https://img.shields.io/badge/dsh-0.2.0--rc.1%2B-7c5cff?style=flat-square" alt="DeepSeek Harness >= 0.2.0-rc.1">
|
|
11
|
-
<img src="https://img.shields.io/badge/tests-smoke%20%C2%B7%20offline-22d3ee?style=flat-square" alt="Tests: offline smoke">
|
|
12
|
-
<img src="https://img.shields.io/badge/version-0.1.
|
|
13
|
-
</p>
|
|
14
|
-
|
|
15
|
-
<p align="center">
|
|
16
|
-
<b>A background download shouldn't be one word: "Running".</b><br>
|
|
17
|
-
<sub>dsh-transfer-dock grows a live card in the bottom-right corner: file, progress, bytes, speed and ETA.</sub>
|
|
18
|
-
</p>
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
<p align="center">
|
|
23
|
-
<img src="https://raw.githubusercontent.com/imnotRiv3r/dsh-transfer-dock/main/docs/card-fill.png" width="46%" alt="A card with a known total: 32% · curl">
|
|
24
|
-
<img src="https://raw.githubusercontent.com/imnotRiv3r/dsh-transfer-dock/main/docs/card-stripes.png" width="46%" alt="An indeterminate card: moving stripes, bytes written">
|
|
25
|
-
</p>
|
|
26
|
-
|
|
27
|
-
<p align="center">
|
|
28
|
-
<sub>Left: the total is known → a real percentage and an ETA. Right: no single total → moving stripes plus bytes written (a deliberate third state, not a failure).</sub>
|
|
29
|
-
</p>
|
|
30
|
-
|
|
31
|
-
> You start a 2 GB model download in Harness and it goes to the background. The corner of the UI says nothing; the job row says "Running".
|
|
32
|
-
> You can't tell whether it's downloading at full speed, stuck on DNS, or already dead.
|
|
33
|
-
>
|
|
34
|
-
> dsh-transfer-dock turns those forty seconds into one card: **file name, 32%, 4.14 MB / 12.9 MB, 148 KB/s, 59s left**.
|
|
35
|
-
> No second window, no wrapped commands, no takeover — it observes and draws the result where you are already looking.
|
|
36
|
-
|
|
37
|
-
## Contents
|
|
38
|
-
|
|
39
|
-
<details>
|
|
40
|
-
<summary>Expand</summary>
|
|
41
|
-
|
|
42
|
-
- [The problem](#the-problem)
|
|
43
|
-
- [Anatomy of a card](#anatomy-of-a-card)
|
|
44
|
-
- [How it works](#how-it-works)
|
|
45
|
-
- [Three data sources](#three-data-sources)
|
|
46
|
-
- [Stripes are not a bug](#stripes-are-not-a-bug)
|
|
47
|
-
- [What it watches](#what-it-watches)
|
|
48
|
-
- [Install](#install)
|
|
49
|
-
- [Config](#config)
|
|
50
|
-
- [The state route](#the-state-route)
|
|
51
|
-
- [Troubleshooting](#troubleshooting)
|
|
52
|
-
- [Limitations](#limitations)
|
|
53
|
-
- [Development](#development)
|
|
54
|
-
- [License](#license)
|
|
55
|
-
|
|
56
|
-
</details>
|
|
57
|
-
|
|
58
|
-
## The problem
|
|
59
|
-
|
|
60
|
-
Harness pushes download commands into background jobs (`run_in_background: true`) so they don't block the turn. The cost: the UI keeps a single status row, and the next real signal is a completion notice a dozen seconds later. Everything in between is invisible.
|
|
61
|
-
|
|
62
|
-
dsh-transfer-dock fills that gap, and it **only observes**:
|
|
63
|
-
|
|
64
|
-
| It does | It doesn't |
|
|
65
|
-
|---|---|
|
|
66
|
-
| Subscribe to job registry events and detect download commands | Consume the model's job cursor |
|
|
67
|
-
| Sample disk bytes, probe totals (Host) and parse job output (browser) | Change job state, send signals or kill processes |
|
|
68
|
-
| Expose a read-only JSON route to the browser half | Read or write the downloaded files |
|
|
69
|
-
| Render a card in the bottom-right corner | Pop dialogs, steal focus or block input |
|
|
70
|
-
|
|
71
|
-
It never asks you to wrap a command. `git clone`, `pip install`, `curl -o`, `npm install` and `winget install` work as they are; progress-friendly flags only make the card more precise (see [What it watches](#what-it-watches)).
|
|
72
|
-
|
|
73
|
-
## Anatomy of a card
|
|
74
|
-
|
|
75
|
-
A card is 366 px wide (clamped to `100vw - 36px` on narrow screens), fixed 18 px from the bottom-right corner, with a blurred glass background that follows Harness' light and dark theme variables. Top to bottom:
|
|
76
|
-
|
|
77
|
-
| Part | Content | Notes |
|
|
78
|
-
|---|---|---|
|
|
79
|
-
|
|
|
80
|
-
| Title | File, repo or package name | e.g. `numpy-2.2.6-cp310-win_amd64.whl`, `dsh-transfer-dock`, `lodash`; falls back to the first 60 characters of the command |
|
|
81
|
-
| Subtitle | Byte progress or status text | `4.14 MB / 12.9 MB`, `12.4 MB written`, `Completed`, `Download failed`, `Cancelled`, `Stopping…` |
|
|
82
|
-
| Bar | Filled bar or moving stripes | Filled when the total is known; stripes otherwise (see [Stripes are not a bug](#stripes-are-not-a-bug)) |
|
|
83
|
-
| Bottom left | Percentage + tool | The tool alone means indeterminate |
|
|
84
|
-
| Bottom right | Speed · ETA · elapsed | Only elapsed once finished |
|
|
85
|
-
| Error line | Failure reason | `failed` only; first line of the job's `detail` |
|
|
86
|
-
|
|
87
|
-
Status maps directly onto the visuals:
|
|
88
|
-
|
|
89
|
-
| Status | Bar | Subtitle | Bottom right |
|
|
90
|
-
|---|---|---|---|
|
|
91
|
-
| `running` | filled or striped | bytes / status text | speed · ETA · elapsed |
|
|
92
|
-
| `stopping` | unchanged | `Stopping…` | speed no longer updates |
|
|
93
|
-
| `completed` | green, 100% | `Completed` | total elapsed |
|
|
94
|
-
| `failed` | red | `Download failed` + error line | total elapsed |
|
|
95
|
-
| `killed` | red | `Cancelled` | total elapsed |
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
|
166
|
-
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
|
183
|
-
|
|
184
|
-
|
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
|
245
|
-
|
|
246
|
-
|
|
|
247
|
-
|
|
|
248
|
-
|
|
|
249
|
-
|
|
|
250
|
-
|
|
|
251
|
-
|
|
|
252
|
-
|
|
|
253
|
-
|
|
|
254
|
-
|
|
|
255
|
-
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
|
428
|
-
|
|
429
|
-
|
|
|
430
|
-
| |
|
|
431
|
-
|
|
|
432
|
-
|
|
|
433
|
-
|
|
|
434
|
-
|
|
|
435
|
-
|
|
|
436
|
-
|
|
|
437
|
-
|
|
|
438
|
-
|
|
|
439
|
-
|
|
|
440
|
-
|
|
|
441
|
-
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
|
499
|
-
|
|
500
|
-
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
1
|
+
<p align="right"><b>English</b> · <a href="README.zh.md">中文</a></p>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/imnotRiv3r/dsh-transfer-dock/main/docs/banner.svg" width="100%" alt="dsh-transfer-dock — live download cards in the corner of the DeepSeek Harness UI">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-c4b5fd?style=flat-square" alt="License: MIT"></a>
|
|
9
|
+
<img src="https://img.shields.io/badge/node-%E2%89%A520-3c873a?style=flat-square&logo=nodedotjs&logoColor=white" alt="Node.js >= 20">
|
|
10
|
+
<img src="https://img.shields.io/badge/dsh-0.2.0--rc.1%2B-7c5cff?style=flat-square" alt="DeepSeek Harness >= 0.2.0-rc.1">
|
|
11
|
+
<img src="https://img.shields.io/badge/tests-smoke%20%C2%B7%20offline-22d3ee?style=flat-square" alt="Tests: offline smoke">
|
|
12
|
+
<img src="https://img.shields.io/badge/version-0.1.3-6d4aff?style=flat-square" alt="Version 0.1.3">
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<b>A background download shouldn't be one word: "Running".</b><br>
|
|
17
|
+
<sub>dsh-transfer-dock grows a live card in the bottom-right corner: file, progress, bytes, speed and ETA.</sub>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<img src="https://raw.githubusercontent.com/imnotRiv3r/dsh-transfer-dock/main/docs/card-fill.png" width="46%" alt="A card with a known total: 32% · curl">
|
|
24
|
+
<img src="https://raw.githubusercontent.com/imnotRiv3r/dsh-transfer-dock/main/docs/card-stripes.png" width="46%" alt="An indeterminate card: moving stripes, bytes written">
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<p align="center">
|
|
28
|
+
<sub>Left: the total is known → a real percentage and an ETA. Right: no single total → moving stripes plus bytes written (a deliberate third state, not a failure).</sub>
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
> You start a 2 GB model download in Harness and it goes to the background. The corner of the UI says nothing; the job row says "Running".
|
|
32
|
+
> You can't tell whether it's downloading at full speed, stuck on DNS, or already dead.
|
|
33
|
+
>
|
|
34
|
+
> dsh-transfer-dock turns those forty seconds into one card: **file name, 32%, 4.14 MB / 12.9 MB, 148 KB/s, 59s left**.
|
|
35
|
+
> No second window, no wrapped commands, no takeover — it observes and draws the result where you are already looking.
|
|
36
|
+
|
|
37
|
+
## Contents
|
|
38
|
+
|
|
39
|
+
<details>
|
|
40
|
+
<summary>Expand</summary>
|
|
41
|
+
|
|
42
|
+
- [The problem](#the-problem)
|
|
43
|
+
- [Anatomy of a card](#anatomy-of-a-card)
|
|
44
|
+
- [How it works](#how-it-works)
|
|
45
|
+
- [Three data sources](#three-data-sources)
|
|
46
|
+
- [Stripes are not a bug](#stripes-are-not-a-bug)
|
|
47
|
+
- [What it watches](#what-it-watches)
|
|
48
|
+
- [Install](#install)
|
|
49
|
+
- [Config](#config)
|
|
50
|
+
- [The state route](#the-state-route)
|
|
51
|
+
- [Troubleshooting](#troubleshooting)
|
|
52
|
+
- [Limitations](#limitations)
|
|
53
|
+
- [Development](#development)
|
|
54
|
+
- [License](#license)
|
|
55
|
+
|
|
56
|
+
</details>
|
|
57
|
+
|
|
58
|
+
## The problem
|
|
59
|
+
|
|
60
|
+
Harness pushes download commands into background jobs (`run_in_background: true`) so they don't block the turn. The cost: the UI keeps a single status row, and the next real signal is a completion notice a dozen seconds later. Everything in between is invisible.
|
|
61
|
+
|
|
62
|
+
dsh-transfer-dock fills that gap, and it **only observes**:
|
|
63
|
+
|
|
64
|
+
| It does | It doesn't |
|
|
65
|
+
|---|---|
|
|
66
|
+
| Subscribe to job registry events and detect download commands | Consume the model's job cursor |
|
|
67
|
+
| Sample disk bytes, probe totals (Host) and parse job output (browser) | Change job state, send signals or kill processes |
|
|
68
|
+
| Expose a read-only JSON route to the browser half | Read or write the downloaded files |
|
|
69
|
+
| Render a card in the bottom-right corner | Pop dialogs, steal focus or block input |
|
|
70
|
+
|
|
71
|
+
It never asks you to wrap a command. `git clone`, `pip install`, `curl -o`, `npm install` and `winget install` work as they are; progress-friendly flags only make the card more precise (see [What it watches](#what-it-watches)).
|
|
72
|
+
|
|
73
|
+
## Anatomy of a card
|
|
74
|
+
|
|
75
|
+
A card is 366 px wide (clamped to `100vw - 36px` on narrow screens), fixed 18 px from the bottom-right corner, with a blurred glass background that follows Harness' light and dark theme variables. Top to bottom:
|
|
76
|
+
|
|
77
|
+
| Part | Content | Notes |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| File badge | The first character of the file name | The floating button uses the same character |
|
|
80
|
+
| Title | File, repo or package name | e.g. `numpy-2.2.6-cp310-win_amd64.whl`, `dsh-transfer-dock`, `lodash`; falls back to the first 60 characters of the command |
|
|
81
|
+
| Subtitle | Byte progress or status text | `4.14 MB / 12.9 MB`, `12.4 MB written`, `Completed`, `Download failed`, `Cancelled`, `Stopping…` |
|
|
82
|
+
| Bar | Filled bar or moving stripes | Filled when the total is known; stripes otherwise (see [Stripes are not a bug](#stripes-are-not-a-bug)) |
|
|
83
|
+
| Bottom left | Percentage + tool | The tool alone means indeterminate |
|
|
84
|
+
| Bottom right | Speed · ETA · elapsed | Only elapsed once finished |
|
|
85
|
+
| Error line | Failure reason | `failed` only; first line of the job's `detail` |
|
|
86
|
+
|
|
87
|
+
Status maps directly onto the visuals:
|
|
88
|
+
|
|
89
|
+
| Status | Bar | Subtitle | Bottom right |
|
|
90
|
+
|---|---|---|---|
|
|
91
|
+
| `running` | filled or striped | bytes / status text | speed · ETA · elapsed |
|
|
92
|
+
| `stopping` | unchanged | `Stopping…` | speed no longer updates |
|
|
93
|
+
| `completed` | green, 100% | `Completed` | total elapsed |
|
|
94
|
+
| `failed` | red | `Download failed` + error line | total elapsed |
|
|
95
|
+
| `killed` | red | `Cancelled` | total elapsed |
|
|
96
|
+
|
|
97
|
+
Click `✕` to collapse the card into a floating button without stopping the job. The ring continues showing progress, or a spinning arc when the percentage is unknown. Click the button to expand the card again. Reloading shows any still-running downloads as cards.
|
|
98
|
+
|
|
99
|
+
### Collapsed button
|
|
100
|
+
|
|
101
|
+
| State | Button appearance |
|
|
102
|
+
|---|---|
|
|
103
|
+
| Running with a known percentage | Ring filled to the percentage; the centre shows the file name's first character |
|
|
104
|
+
| Running without a total | Spinning arc |
|
|
105
|
+
| Completed | Full green ring |
|
|
106
|
+
| Failed / cancelled before any percentage | Dashed red ring, so an error is never drawn as 100% |
|
|
107
|
+
|
|
108
|
+
The centre character is split by grapheme, so CJK and emoji are not cut. Keyboard focus follows the swap; the collapsed state is remembered, so a reload keeps still-running downloads collapsed.
|
|
109
|
+
|
|
110
|
+
<p align="center">
|
|
111
|
+
<img src="https://raw.githubusercontent.com/imnotRiv3r/dsh-transfer-dock/main/docs/dock-preview.png" width="100%" alt="Cards, the four floating-button states, completed and failed cards">
|
|
112
|
+
</p>
|
|
113
|
+
|
|
114
|
+
## How it works
|
|
115
|
+
|
|
116
|
+
The plugin is split into two halves that talk over a single read-only JSON route:
|
|
117
|
+
|
|
118
|
+
<p align="center">
|
|
119
|
+
<img src="https://raw.githubusercontent.com/imnotRiv3r/dsh-transfer-dock/main/docs/architecture.svg" width="100%" alt="dsh-transfer-dock data flow: download tools → Host sampling → JSON state → browser card">
|
|
120
|
+
</p>
|
|
121
|
+
|
|
122
|
+
| Half | Files | Runtime | Responsibility |
|
|
123
|
+
|---|---|---|---|
|
|
124
|
+
| Host | `index.js` + `lib/*` | Harness main process (Node.js) | Subscribe to job events, detect downloads, sample disk, probe totals, expose the state route, inject a prompt section |
|
|
125
|
+
| Browser | `client.js` | Web GUI (React) | Poll state, read job output, parse progress, merge into cards, portal into `document.body` |
|
|
126
|
+
|
|
127
|
+
### Lifecycle of one download
|
|
128
|
+
|
|
129
|
+
```mermaid
|
|
130
|
+
flowchart LR
|
|
131
|
+
A["Background job starts"] --> B{"detectDownload()<br/>is this a download?"}
|
|
132
|
+
B -- no --> X["No card"]
|
|
133
|
+
B -- yes --> C["Record baselines<br/>target dirs + %TEMP%"]
|
|
134
|
+
C --> D["HEAD probe for total<br/>single URL only"]
|
|
135
|
+
C --> E["Sample every 700 ms<br/>disk byte delta"]
|
|
136
|
+
D --> F["present() merge<br/>output first, disk as fallback"]
|
|
137
|
+
E --> F
|
|
138
|
+
F --> G["Browser polls every 600 ms<br/>renders the card"]
|
|
139
|
+
G --> H{"Job finished?"}
|
|
140
|
+
H -- no --> G
|
|
141
|
+
H -- yes --> I["completed / failed / killed<br/>fades out after 2.6 s"]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
1. A command starts with `run_in_background: true` and the job registry emits an event.
|
|
145
|
+
2. `detectDownload(label)` decides whether it is a download and resolves candidate output paths.
|
|
146
|
+
3. The Host records baselines: current bytes of the target directories and of this tool's existing `%TEMP%` entries.
|
|
147
|
+
4. If the command contains exactly one HTTP(S) URL, the Host sends a `HEAD` request and reads `content-length` as the total.
|
|
148
|
+
5. Every 700 ms the Host samples only the **delta**, so pre-existing files never count as part of this download.
|
|
149
|
+
6. After the job ends, the Host keeps returning it for 12 seconds (`settledTtlMs`) so the browser can render the final state.
|
|
150
|
+
7. The browser fetches `/plugin/dsh-transfer-dock/state` every 600 ms and pauses while the page is hidden.
|
|
151
|
+
8. The browser merges disk bytes with the downloader's own progress lines, renders the card, and fades finished cards out after 2.6 seconds.
|
|
152
|
+
|
|
153
|
+
## Three data sources
|
|
154
|
+
|
|
155
|
+
### A. Job output (most accurate)
|
|
156
|
+
|
|
157
|
+
The browser subscribes to the job's output and scans its last 16 KiB (up to 60 lines) for progress frames:
|
|
158
|
+
|
|
159
|
+
| Downloader | Sample output | Parsed fields |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| aria2c | `[#1a2b3c 12MiB/45MiB(26%) CN:1 DL:1.2MiB ETA:30s]` | percent, downloaded, total, speed, ETA |
|
|
162
|
+
| git clone | `Receiving objects: 45% (1234/2740), 1.20 MiB \| 2.30 MiB/s` | percent, downloaded, speed |
|
|
163
|
+
| docker pull | `45%\|████ \| 12.3MB/27MB` | percent, downloaded, total |
|
|
164
|
+
| pip | `12.9/12.9 MB 491.0 kB/s eta 0:00:00` | downloaded, total, speed, ETA |
|
|
165
|
+
| wget | `0K .......... .......... 45% 1.2M 3s` | percent, speed, ETA |
|
|
166
|
+
| yt-dlp | `[download] 45.0% of 12.34MiB at 1.20MiB/s ETA 00:10` | percent, total, speed, ETA |
|
|
167
|
+
| tqdm (hf / modelscope) | `45%\|████▌ \| 12.3M/27.3M [00:10<00:12, 1.20MB/s]` | percent, downloaded, total, speed, ETA |
|
|
168
|
+
| curl `-#` | `################# 45.0%` | percent |
|
|
169
|
+
| generic | any line containing `45%` | percent |
|
|
170
|
+
|
|
171
|
+
A few details that matter:
|
|
172
|
+
|
|
173
|
+
- **pip's total comes from its first line.** `Downloading https://.../p.whl (9.7 MB)` is remembered separately; later progress frames only carry bytes downloaded, and the two together produce a percentage.
|
|
174
|
+
- **git only counts `Receiving objects`.** `Resolving deltas`, `Counting`, `Compressing`, `Writing`, `Updating` and `Enumerating` are local phases; treating their 100% as download progress makes the bar jump backwards.
|
|
175
|
+
- **Speed fallback.** When a line has no `MiB/s`, the parser also looks for a standalone `X MB/s` token in the same line.
|
|
176
|
+
- **Swallowed output is gone.** `curl -# ... | Select-Object` and friends eat stdout/stderr; that data source is unavailable and only disk sampling remains.
|
|
177
|
+
|
|
178
|
+
### B. Disk sampling (covers everything that writes files)
|
|
179
|
+
|
|
180
|
+
The browser cannot read the filesystem, so the Host samples. Targets aren't guessed — they are parsed from the command text:
|
|
181
|
+
|
|
182
|
+
| Clue | Sampled target |
|
|
183
|
+
|---|---|
|
|
184
|
+
| A URL's file name | `<cwd>/<file>`, `<file>.part`, `<file>.tmp` |
|
|
185
|
+
| `-o` / `-O` / `--output` / `-OutFile` / `-Destination` / `--dir` and friends | The resolved real path |
|
|
186
|
+
| `git clone` | The target repo's `.git` (the working tree is never walked) |
|
|
187
|
+
| `npm` / `pnpm` / `yarn` / `uv` | `node_modules` and `.venv` under the working directory |
|
|
188
|
+
| `$dir="D:\dl"` in the command | Expanded before resolution; if a variable cannot be resolved the path is **skipped** rather than guessed |
|
|
189
|
+
| Everything | `%TEMP%` entries matching the downloader's prefix, plus `.part` / `.partial` / `.crdownload` / `.opdownload` staging files |
|
|
190
|
+
|
|
191
|
+
`%TEMP%` matching is scoped by downloader prefix (`pip-`, `uv-`, `npm-`, `pnpm`, `npx-`, `yarn-`, `git-`, `winget-`, `choco-`, `scoop-` …) because a Windows temp directory routinely holds hundreds of unrelated `.tmp` files.
|
|
192
|
+
|
|
193
|
+
Sampling has hard budgets so a huge directory can't stall the main process:
|
|
194
|
+
|
|
195
|
+
| Parameter | Value | Purpose |
|
|
196
|
+
|---|---|---|
|
|
197
|
+
| Per-round budget | `220 ms` (50–2000, configurable) | Stops walking as soon as the budget is spent |
|
|
198
|
+
| Target / temp split | 45% / 55% | Neither path can starve the other |
|
|
199
|
+
| Recursion depth | 3 levels | Avoids descending into nested `node_modules` |
|
|
200
|
+
| Entry cap per round | 4000 | Keeps giant trees from eating the whole budget |
|
|
201
|
+
| Sampling tick | 700 ms | Smooth enough, cheap enough |
|
|
202
|
+
| Speed window | 5 s | Byte delta between the window's first and last sample |
|
|
203
|
+
| Smoothing | 0.55 × old + 0.45 × new | Damps sampling jitter |
|
|
204
|
+
|
|
205
|
+
Every byte count is a **delta**: the Host records the target directory and `%TEMP%` baselines when the task opens, then counts only growth. Files that were already in the directory never count as this download.
|
|
206
|
+
|
|
207
|
+
### C. HEAD probe (supplies the missing total)
|
|
208
|
+
|
|
209
|
+
For a **single-file URL** (exactly one HTTP(S) address in the command), the Host sends one `HEAD` request:
|
|
210
|
+
|
|
211
|
+
- 3 s timeout, at most 3 redirects;
|
|
212
|
+
- only a 2xx response's `content-length` counts (a 404 error page has a length too, and it would be wrong);
|
|
213
|
+
- failures, non-HTTP(S) URLs and servers that refuse HEAD are silently ignored, and the card falls back to stripes or to the output-derived total;
|
|
214
|
+
- multi-URL commands are **not** probed — batch downloads have no single total, so any probe would be wrong.
|
|
215
|
+
|
|
216
|
+
### Merge rules
|
|
217
|
+
|
|
218
|
+
The browser merges the two paths like this:
|
|
219
|
+
|
|
220
|
+
| Field | How it merges |
|
|
221
|
+
|---|---|
|
|
222
|
+
| `downloaded` | `max(job output, disk delta)` — either can lead temporarily, and the max means progress never steps backwards to zero |
|
|
223
|
+
| `total` | job output (including pip's `(9.7 MB)`) → HEAD `content-length`; neither → stripes |
|
|
224
|
+
| `percent` | job output → `downloaded / total × 100`; neither → stripes |
|
|
225
|
+
| `speed` | job output → disk sampling speed; neither → hidden |
|
|
226
|
+
| `eta` | job output → `(total − downloaded) / speed`; neither → hidden |
|
|
227
|
+
|
|
228
|
+
> A real percentage appears only when the job output carries one, or when the output/HEAD supplies a total. Everything else degrades honestly.
|
|
229
|
+
|
|
230
|
+
## Stripes are not a bug
|
|
231
|
+
|
|
232
|
+
Moving stripes mean the plugin is in its indeterminate state: it knows a download is running, how many bytes have landed and how fast, but **not the total**, so it honestly refuses to invent a percentage.
|
|
233
|
+
|
|
234
|
+
There are only three ways to end up without a total:
|
|
235
|
+
|
|
236
|
+
1. The downloader doesn't report one (`curl -s`, `wget --quiet`, or output swallowed by a pipe);
|
|
237
|
+
2. The command isn't a single HTTP(S) URL (many packages, many URLs) — there is nothing to HEAD;
|
|
238
|
+
3. The server refuses HEAD, returns a non-2xx status, times out, or `probeTotals` is disabled.
|
|
239
|
+
|
|
240
|
+
This is not a fallback to failure but a deliberate third state: **don't fake certainty**. The card still shows `12.4 MB written` and a live speed, so the information isn't zero.
|
|
241
|
+
|
|
242
|
+
When you will always see a percentage:
|
|
243
|
+
|
|
244
|
+
| Scenario | Percentage | Total source |
|
|
245
|
+
|---|---|---|
|
|
246
|
+
| `curl -# -L -o file URL` | ✅ | Hash progress line |
|
|
247
|
+
| `curl -s -L -o file URL` | ✅ | HEAD probe |
|
|
248
|
+
| `git clone --progress` | ✅ | `Receiving objects` |
|
|
249
|
+
| `aria2c` | ✅ | Its own progress line |
|
|
250
|
+
| `docker pull` | ✅ | Its own progress line |
|
|
251
|
+
| `wget` | ✅ | Its own progress line |
|
|
252
|
+
| `pip install` / `python -m pip download` | ✅ | pip's `(9.7 MB)` + disk delta (when the output carries a total) |
|
|
253
|
+
| `npm install` / `pnpm add` | ❌ stripes | Dozens of packages, no single total |
|
|
254
|
+
| Multi-URL `curl` / `wget` | ❌ stripes | Same reason |
|
|
255
|
+
| Silent download from a server without HEAD | ❌ stripes | No source at all |
|
|
256
|
+
|
|
257
|
+
## What it watches
|
|
258
|
+
|
|
259
|
+
Detection looks only at the command text (`job.label`) and takes the first matching rule, in a fixed order:
|
|
260
|
+
|
|
261
|
+
| Tool | Matching commands | Progress source | Card label |
|
|
262
|
+
|---|---|---|---|
|
|
263
|
+
| git | `git clone` / `fetch` / `pull` / `submodule update` / `lfs pull` | output lines + `.git` sampling | `git` |
|
|
264
|
+
| pip | `pip install` / `download` / `wheel`, including `python -m pip` | output lines + `%TEMP%` sampling | `py` |
|
|
265
|
+
| uv | `uv pip install` / `add` / `sync` / `lock` / `download` / `export` | disk sampling + `%TEMP%` | `py` |
|
|
266
|
+
| npm family | `npm` / `pnpm` / `yarn` / `bun` with `i`, `install`, `ci`, `add`, `dlx`, `create`, `update`, `fetch`, `rebuild` | disk sampling (`node_modules`) | `npm` |
|
|
267
|
+
| curl | Any `curl` call that has a URL or an output flag | `-#` output + target sampling | `c` |
|
|
268
|
+
| wget | Any `wget` call | output lines + target sampling | `w` |
|
|
269
|
+
| yt-dlp | Any `yt-dlp` call | download frames + target sampling | `yt-dlp` |
|
|
270
|
+
| hf / modelscope | `hf download` / `huggingface-cli download` / `modelscope download` | tqdm progress frames | `hf` / `modelscope` |
|
|
271
|
+
| aria2 | `aria2c` | output lines + target sampling | `a2` |
|
|
272
|
+
| PowerShell | `Start-BitsTransfer`; `Invoke-WebRequest` / `iwr` / `Invoke-RestMethod` / `irm` **with `-OutFile`** | target sampling | `web` |
|
|
273
|
+
| Package managers | `winget install` / `download`, `choco install`, `scoop install` / `update`, `nuget install`, `dotnet tool install` / `add package` | `%TEMP%` sampling | `app` |
|
|
274
|
+
| Rust / Go | `cargo install` / `fetch` / `vendor` / `update`, `go get` / `mod download` | `%TEMP%` sampling | `rs` / `go` |
|
|
275
|
+
| Docker | `docker pull` / `load` / `save` / `build` | output lines | `dk` |
|
|
276
|
+
|
|
277
|
+
**Explicitly ignored** (no card, no sampling):
|
|
278
|
+
|
|
279
|
+
- `git status`, `git log`, `git commit` and other non-fetching commands;
|
|
280
|
+
- `curl --version`, `wget --help`, `aria2c -h` — version/help only, with neither a URL nor an output flag;
|
|
281
|
+
- `pip list`, `pip freeze` — no install/download action;
|
|
282
|
+
- `Invoke-WebRequest` without `-OutFile` (usually an API call read into memory, not a download);
|
|
283
|
+
- `npm run build`, `npm test` — `run` isn't a download verb;
|
|
284
|
+
- commands longer than 8000 characters (keeps pathological labels from slowing the parse).
|
|
285
|
+
|
|
286
|
+
## Install
|
|
287
|
+
|
|
288
|
+
Prerequisites:
|
|
289
|
+
|
|
290
|
+
- DeepSeek Harness `>= 0.2.0-rc.1 < 0.3.0-0` (from `dsh.compatibility` in `package.json`);
|
|
291
|
+
- Node.js `>= 20`;
|
|
292
|
+
- a working Harness profile (examples below use `desktop`; substitute yours).
|
|
293
|
+
|
|
294
|
+
### From the plugin market
|
|
295
|
+
|
|
296
|
+
The plugin is listed in the [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) catalog, so the market inside DeepSeek Harness — [dsh-market](https://github.com/dsh-market/dsh-market), under UI Enhancements — lists it with a one-click **Install**. The market runs exactly the CLI command below, so either entry point ends in the same profile state.
|
|
297
|
+
|
|
298
|
+
### From the CLI
|
|
299
|
+
|
|
300
|
+
```powershell
|
|
301
|
+
dsh plugin --profile desktop add github:imnotRiv3r/dsh-transfer-dock
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
That one command is the whole install: it adds the dependency to the profile's `package.json` and appends `dsh-transfer-dock` to `dsh.profile.bundles`. There is no npm package — the GitHub source is the only release channel. To pin a commit:
|
|
305
|
+
|
|
306
|
+
```powershell
|
|
307
|
+
dsh plugin --profile desktop add github:imnotRiv3r/dsh-transfer-dock#b2404e2
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Uninstall is symmetric — it drops the dependency and the `bundles` row together:
|
|
311
|
+
|
|
312
|
+
```powershell
|
|
313
|
+
dsh plugin --profile desktop remove dsh-transfer-dock
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
The repo has no build step (no `prepare`/`install` script, and `exports` points straight at the source), so the first install does not raise pnpm's `allowBuilds` prompt.
|
|
317
|
+
|
|
318
|
+
### Link a local checkout (development)
|
|
319
|
+
|
|
320
|
+
```powershell
|
|
321
|
+
dsh plugin --profile desktop add 'link:E:\dshWorkspace\dsh-transfer-dock'
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
The profile now points at your checkout, so edits are live: the Host half hot-reloads with the profile, the browser half needs one page refresh. pnpm warns that a `link:` dependency does not resolve `peerDependencies` from the target — the only one this package declares is `@deepseek-ai/schemastery`, which a DSH profile already provides through `@deepseek-ai/dsh-base`.
|
|
325
|
+
|
|
326
|
+
Prefer a frozen copy, where edits require re-running the command? Use `file:E:\dshWorkspace\dsh-transfer-dock` instead of `link:...`.
|
|
327
|
+
|
|
328
|
+
### What reloads when
|
|
329
|
+
|
|
330
|
+
| Change | Takes effect |
|
|
331
|
+
|---|---|
|
|
332
|
+
| Host half (`index.js`, `lib/*`) | Hot reloads with profile changes |
|
|
333
|
+
| Browser half (`client.js`) | **One page refresh** |
|
|
334
|
+
| Config (`cordis.patch.yml`) | Hot reload; the browser half picks it up after a refresh |
|
|
335
|
+
|
|
336
|
+
### Plugin page
|
|
337
|
+
|
|
338
|
+
`locale/en.json` and `locale/zh.json` carry `meta.title` and `meta.description`, and `icon.svg` is the plugin-page icon (through the `icon` field in `package.json` plus `./locale/*.json` and `./icon` in `exports`). After install, rename or update, refresh the page once and the plugin page shows "Download dock" / "下载坞" with its icon. If it still falls back to the package name or default artwork, the host has not re-read the package manifest yet — restart DSH.
|
|
339
|
+
|
|
340
|
+
### Verify
|
|
341
|
+
|
|
342
|
+
```powershell
|
|
343
|
+
# Is the Host half alive? `hits` grows once the browser half attaches (use your DSH Web port).
|
|
344
|
+
Invoke-RestMethod http://127.0.0.1:2482/plugin/dsh-transfer-dock/state
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
A healthy response looks like:
|
|
348
|
+
|
|
349
|
+
```json
|
|
350
|
+
{ "version": 1, "now": 1731427200000, "tasks": [], "poll": { "hits": 412, "lastHitAt": 1731427200000, "build": "0.1.3" } }
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Now trigger a visible download (rate-limited to 300 KB/s so the card has time to appear):
|
|
354
|
+
|
|
355
|
+
```powershell
|
|
356
|
+
curl.exe -L -# --limit-rate 300k -o "$env:TEMP\probe.bin" `
|
|
357
|
+
https://mirrors.aliyun.com/pypi/packages/a3/dd/4b822569d6b96c39d1215dbae0582fd99954dcbcf0c1a13c61783feaca3f/numpy-2.2.6-cp310-cp310-win_amd64.whl
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
> **It must be a background job** (`run_in_background: true`, or a foreground command promoted to background on timeout). Foreground commands have no job row, so there is nothing to observe — that follows from Harness' job model.
|
|
361
|
+
|
|
362
|
+
## Config
|
|
363
|
+
|
|
364
|
+
The row id is `transfer-dock`; edit it in the profile's `cordis.patch.yml`:
|
|
365
|
+
|
|
366
|
+
```yaml
|
|
367
|
+
- id: transfer-dock
|
|
368
|
+
name: dsh-transfer-dock
|
|
369
|
+
config:
|
|
370
|
+
enabled: true
|
|
371
|
+
guidePrompt: true
|
|
372
|
+
settledTtlMs: 12000
|
|
373
|
+
maxTasks: 8
|
|
374
|
+
sampleBudgetMs: 220
|
|
375
|
+
probeTotals: true
|
|
376
|
+
workingDirectory: ''
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
| Field | Type | Default | Range | Meaning |
|
|
380
|
+
|---|---|---:|---|---|
|
|
381
|
+
| `enabled` | boolean | `true` | — | Master switch: off means no detection, no sampling, no route |
|
|
382
|
+
| `guidePrompt` | boolean | `true` | — | Add the download guidance section to the system prompt |
|
|
383
|
+
| `settledTtlMs` | number | `12000` | 1000–120000 | How long the Host keeps returning a finished task |
|
|
384
|
+
| `maxTasks` | number | `8` | 1–32 | Maximum cards rendered at once |
|
|
385
|
+
| `sampleBudgetMs` | number | `220` | 50–2000 | Per-round disk sampling budget; lower it on huge directories |
|
|
386
|
+
| `probeTotals` | boolean | `true` | — | HEAD-probe single file URLs for a total; off means silent downloads stay indeterminate |
|
|
387
|
+
| `workingDirectory` | string | process cwd | — | Base for resolving relative paths; empty uses the Harness process cwd |
|
|
388
|
+
|
|
389
|
+
With `guidePrompt` on, the plugin injects a short system-prompt section: **for download commands prefer `run_in_background: true`, and add progress-friendly flags (`git clone --progress`, `curl -# -L`; wget and aria2c already report progress)**. That section is what determines how often cards actually appear — the model has to put downloads in the background before there is anything to observe.
|
|
390
|
+
|
|
391
|
+
> Config values are normalized on the Host side (numbers clamped to range and rounded, blank strings fall back to the process cwd), so a malformed value can't crash the plugin.
|
|
392
|
+
|
|
393
|
+
## The state route
|
|
394
|
+
|
|
395
|
+
`GET /plugin/dsh-transfer-dock/state` returns a read-only JSON snapshot (`cache-control: no-store`):
|
|
396
|
+
|
|
397
|
+
The route first calls `ctx.connection.requestRejection(request)`: non-DSH pages (cross-site pages or requests without a same-origin authenticated session) get 401 / 403, so only DSH's own browser page can read the snapshot.
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
{
|
|
401
|
+
"version": 1,
|
|
402
|
+
"now": 1731427200000,
|
|
403
|
+
"tasks": [
|
|
404
|
+
{
|
|
405
|
+
"id": "job_7f3a",
|
|
406
|
+
"sessionId": "sess_2b91",
|
|
407
|
+
"tool": "pip",
|
|
408
|
+
"fileName": "numpy-2.2.6-cp310-win_amd64.whl",
|
|
409
|
+
"label": "python -m pip download numpy --no-deps -d E:\\ws",
|
|
410
|
+
"status": "running",
|
|
411
|
+
"startedAt": 1731427188000,
|
|
412
|
+
"finishedAt": null,
|
|
413
|
+
"elapsedMs": 12000,
|
|
414
|
+
"bytes": 4140000,
|
|
415
|
+
"speed": 148000,
|
|
416
|
+
"total": 12900000,
|
|
417
|
+
"detail": null,
|
|
418
|
+
"source": "temp"
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
"poll": { "hits": 412, "lastHitAt": 1731427200000, "build": "0.1.3" }
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
| Field | Meaning |
|
|
426
|
+
|---|---|
|
|
427
|
+
| `version` | Snapshot format version, currently `1` |
|
|
428
|
+
| `now` | When the Host built the snapshot |
|
|
429
|
+
| `tasks[].id` | Harness job id |
|
|
430
|
+
| `tasks[].sessionId` | Owning session; `null` for ownerless jobs, which can only show bytes (their output stream is unavailable) |
|
|
431
|
+
| `tasks[].tool` | Detected tool (`git`, `pip`, `npm`, `curl` …) |
|
|
432
|
+
| `tasks[].fileName` | Card title (file / repo / package name) |
|
|
433
|
+
| `tasks[].label` | Full command text (shown as the card's hover title) |
|
|
434
|
+
| `tasks[].status` | `running` / `stopping` / `completed` / `failed` / `killed` |
|
|
435
|
+
| `tasks[].elapsedMs` | Milliseconds elapsed (total once finished) |
|
|
436
|
+
| `tasks[].bytes` | Monotonic disk delta in bytes |
|
|
437
|
+
| `tasks[].speed` | Smoothed bytes per second |
|
|
438
|
+
| `tasks[].total` | Total size; `null` when unknown |
|
|
439
|
+
| `tasks[].detail` | Failure reason (`null` on success) |
|
|
440
|
+
| `tasks[].source` | Whether bytes mainly came from `target` or `temp` |
|
|
441
|
+
| `poll.hits` | Requests to this route — direct evidence the browser half is mounted |
|
|
442
|
+
| `poll.build` | Build marker of the Host that answered |
|
|
443
|
+
|
|
444
|
+
For debugging, add `?diag=...` to the URL: the value is truncated to 4000 characters and echoed in `poll.diag`, so you can confirm which build the browser actually reached.
|
|
445
|
+
|
|
446
|
+
## Troubleshooting
|
|
447
|
+
|
|
448
|
+
| Symptom | Likely cause | Fix |
|
|
449
|
+
|---|---|---|
|
|
450
|
+
| No card at all | Not a background job | Use `run_in_background: true`; foreground downloads never show a card |
|
|
451
|
+
| | Command doesn't look like a download | Check it against the list above; `npm run build` and `git status` don't count |
|
|
452
|
+
| | Browser half not loaded | Refresh the page; confirm `dsh-transfer-dock` is in `bundles` |
|
|
453
|
+
| | Plugin disabled | Check `enabled`; look for `disabled by config` in the Host log |
|
|
454
|
+
| | `webServer` not ready | The plugin retries every 500 ms, 20 times; after that you'll see `webServer never became available` |
|
|
455
|
+
| Card appears but bytes stay at 0 | Download doesn't hit disk, or lands somewhere unresolved | Use an explicit `-o` / `-OutFile`; make sure `$var` paths expand to real absolute paths |
|
|
456
|
+
| | Directory too deep / too many entries | Raise `sampleBudgetMs`, or download into a shallower directory |
|
|
457
|
+
| Card always shows stripes | No total available | HEAD only runs for a single HTTP(S) URL with `probeTotals: true`; multi-package / multi-URL downloads have no single total |
|
|
458
|
+
| Card flashes and disappears | Task was very short | Cards stay hidden for the first 500 ms of a run; finished cards still show for 2.6 s, so a quick fade-out is normal |
|
|
459
|
+
| Card only appears after a refresh | The browser half doesn't hot reload | Expected — `client.js` changes require a page refresh |
|
|
460
|
+
| Numbers freeze mid-download | The job itself is stuck (DNS, TLS, silent server) | The card truthfully shows the last byte count and a zero speed; it does not guess |
|
|
461
|
+
| Speed curve wobbles on huge directories | Sampling budget too small | Raise `sampleBudgetMs`, or accept the estimate (see [Limitations](#limitations)) |
|
|
462
|
+
| Two `pip` runs bleed into each other | `%TEMP%` is shared | Prefix filtering makes it rare, but concurrent runs of the same tool can still mix; run them serially |
|
|
463
|
+
|
|
464
|
+
Three-state diagnosis with `poll.hits`:
|
|
465
|
+
|
|
466
|
+
| `hits` | Meaning | Next step |
|
|
467
|
+
|---|---|---|
|
|
468
|
+
| Not growing | Browser half isn't loaded | Refresh; check profile `bundles`; check the browser console |
|
|
469
|
+
| Growing, no card | Mounting or data problem | Check whether `/state` returns non-empty `tasks`; verify the page renders outside `shell.overlay` |
|
|
470
|
+
| Growing, card present, numbers frozen | Sampling isn't matching | Inspect `tasks[].source` and `bytes`; check targets and permissions |
|
|
471
|
+
|
|
472
|
+
## Limitations
|
|
473
|
+
|
|
474
|
+
- **Foreground downloads never get a card.** This follows from Harness' job model and cannot be worked around; `run_in_background` is the only entry point.
|
|
475
|
+
- **Stripes are not a bug.** Without a total there is no honest percentage. `npm install` and multi-URL batch downloads have no single total by design.
|
|
476
|
+
- **`pip` / `npm` print no live progress in a non-TTY pipe.** The percentage is `disk delta ÷ total`; pip's total comes from its own opening line, and npm has even less, so it usually stays indeterminate.
|
|
477
|
+
- **`%TEMP%` is shared.** Two concurrent `pip` downloads can bleed into each other's byte counts; prefix filtering only makes it rare, not impossible.
|
|
478
|
+
- **Disk sampling is an estimate, not accounting.** Depth 3, 4000 entries, 220 ms budget: very large trees are partially counted and the curve can wobble.
|
|
479
|
+
- **HEAD probing covers a single URL only.** Non-HTTP(S) addresses, multi-URL commands and servers that refuse HEAD get no total, and probe failures are silent.
|
|
480
|
+
- **Ownerless jobs show bytes only.** A job that doesn't belong to a session has no output stream to observe.
|
|
481
|
+
- **State lives in memory.** Restarting Harness clears everything; there is no history and no persistence. This is not a download manager.
|
|
482
|
+
- **Sampling is single-threaded and serial.** More concurrent downloads means slower rounds and duller speed curves; the ledger keeps at most `maxTasks × 2` tasks and the snapshot exports the first `maxTasks`.
|
|
483
|
+
- **It doesn't verify downloads.** Hashes, signatures, extraction and installation are out of scope; it only looks at bytes.
|
|
484
|
+
- **It doesn't throttle or schedule.** It watches downloads, it doesn't manage them.
|
|
485
|
+
|
|
486
|
+
## Development
|
|
487
|
+
|
|
488
|
+
```powershell
|
|
489
|
+
git clone https://github.com/imnotRiv3r/dsh-transfer-dock.git
|
|
490
|
+
cd dsh-transfer-dock
|
|
491
|
+
|
|
492
|
+
node test/smoke.mjs # detection, parsing, merging, browser-half registration — fully offline
|
|
493
|
+
npm run check # node --check on every source file
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
Project layout:
|
|
497
|
+
|
|
498
|
+
| File | Responsibility |
|
|
499
|
+
|---|---|
|
|
500
|
+
| `index.js` | Host entry: config normalization, job subscription, state route, prompt injection |
|
|
501
|
+
| `lib/detect.js` | Command detection, URL / output-flag / variable expansion, target resolution |
|
|
502
|
+
| `lib/tracker.js` | Task ledger, 700 ms sampling tick, speed smoothing, snapshot export |
|
|
503
|
+
| `lib/sampler.js` | Budgeted directory byte counting, `%TEMP%` prefix filtering, baselines |
|
|
504
|
+
| `lib/probe.js` | HEAD `content-length` probe (timeouts, redirects, status validation) |
|
|
505
|
+
| `client.js` | Browser half: polling, output parsing, merging, card rendering and portal mounting |
|
|
506
|
+
| `test/smoke.mjs` | Offline smoke test built from excerpts of real command output |
|
|
507
|
+
| `docs/*.svg`, `docs/*.png` | README artwork and card renders |
|
|
508
|
+
|
|
509
|
+
The smoke test covers 10 commands that must be detected, 7 that must not, shell variable expansion, pip `-d` exclusion, invalid `probeContentLength` inputs, git / aria2 / wget / curl progress frames, `present()`'s percentage and ETA, and `client.js`'s module and slot registration. Fixtures are excerpts of real output, and nothing touches the network.
|
|
510
|
+
|
|
511
|
+
### Design decisions
|
|
512
|
+
|
|
513
|
+
| Decision | Why |
|
|
514
|
+
|---|---|
|
|
515
|
+
| Mount with `ReactDOM.createPortal` into `document.body` | The `shell.overlay` container carries `transform` / `overflow`, so a `position: fixed` card inside it gets clipped or positioned against that ancestor — the component runs but nothing is visible |
|
|
516
|
+
| 700 ms sampling / 600 ms polling | Fast enough to look continuous, cheap enough to leave the main process and browser alone |
|
|
517
|
+
| `downloaded = max(output, disk)` | Either path can lead temporarily; taking the max avoids progress stepping backwards |
|
|
518
|
+
| Deltas, not absolute sizes | Download folders usually contain old files that must not count toward this download |
|
|
519
|
+
| HEAD for single URLs only | Multi-URL downloads have no single total, so any probe result would be wrong |
|
|
520
|
+
| Observe, never intervene | The plugin must not affect job lifecycle, completion notices or model context |
|
|
521
|
+
| No hot reload for `client.js` | Harness registers browser modules at page load; edits require a refresh |
|
|
522
|
+
|
|
523
|
+
## License
|
|
524
|
+
|
|
525
|
+
[MIT](LICENSE) © imnotRiv3r
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
<p align="center">
|
|
530
|
+
<sub>If this card saves you a few terminal stares, a ⭐ is enough.</sub>
|
|
531
|
+
</p>
|