dsh-wake-relay 0.1.0 → 0.1.2
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.en.md +3 -1
- package/README.md +3 -1
- package/index.js +12 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -55,7 +55,9 @@ dsh plugin --profile desktop add dsh-wake-relay # from npm
|
|
|
55
55
|
dsh plugin --profile <your-profile> add ./dsh-wake-relay # from a local clone
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
Installing from npm usually takes effect **immediately** (`plugin_manager` applies it live; no restart needed). The only reliable check is whether `wake-bridge.log` gained a new `listening` line — if not, restart DSH once.
|
|
59
|
+
|
|
60
|
+
> **Do not install a second wake plugin alongside this one.** They all publish to the same `$DSH_HOME/wake-endpoint.json`. Two of them fight over the port (the loser falls back to an ephemeral one), and the one that stops can erase the other's discovery file. Since 0.1.2 this plugin only clears that file when it still points at itself, but the port contention remains.
|
|
59
61
|
|
|
60
62
|
### Two traps you only hit while installing
|
|
61
63
|
|
package/README.md
CHANGED
|
@@ -55,7 +55,9 @@ git clone <repo> dsh-wake-relay
|
|
|
55
55
|
dsh plugin --profile <你的 profile> add ./dsh-wake-relay
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
从 npm 装通常**即时生效**(`plugin_manager` 会动态 apply,不用重启)。判断标准只有一条:`wake-bridge.log` 里有没有新的 `listening` 行。没有就重启一次 DSH。
|
|
59
|
+
|
|
60
|
+
> **不要同时装第二个唤醒插件。** 所有实现都写同一个 `$DSH_HOME/wake-endpoint.json`。两个同时跑会抢端口(后启动的那个退到随机端口),而停止时写的 `port: null` 会让另一个的发现文件失效——0.1.2 起本插件只在文件仍指向自己时才清空,但端口之争依然存在。
|
|
59
61
|
|
|
60
62
|
### 两个装的时候才会遇到的陷阱
|
|
61
63
|
|
package/index.js
CHANGED
|
@@ -533,6 +533,18 @@ export function apply(ctx, config) {
|
|
|
533
533
|
} catch {
|
|
534
534
|
/* ignore */
|
|
535
535
|
}
|
|
536
|
+
// Two wake plugins can share one $DSH_HOME, and they all publish to the
|
|
537
|
+
// same endpoint path. Only erase the discovery file if it still describes
|
|
538
|
+
// this instance — otherwise the one that stops last blinds the other.
|
|
539
|
+
try {
|
|
540
|
+
const current = JSON.parse(readFileSync(ENDPOINT_PATH, "utf8"));
|
|
541
|
+
if (Number(current.port) !== Number(listenPort)) {
|
|
542
|
+
log(`stopped; left the endpoint file alone (it belongs to port ${current.port})`);
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
} catch {
|
|
546
|
+
/* no endpoint file: nothing to guard */
|
|
547
|
+
}
|
|
536
548
|
try {
|
|
537
549
|
writeFileSync(ENDPOINT_PATH, JSON.stringify({ port: null, stoppedAt: new Date().toISOString() }), "utf8");
|
|
538
550
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-wake-relay",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Let any external process wake a DeepSeek Harness session — with synchronous delivery semantics, so the caller can own the retry loop and fire events that happened while the host was down.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|