Files
yetone d5a4a0ca52 window-warmup 0.1.6: a host swap no longer leaves 3492 dead (#1227)
shawn8888 found it (#1227): server() probed the port, saw this plugin's
marker and returned {} for good. During a host swap the old host is
still serving, so the new one never started, and once the old one
exited nothing served 3492 and the scheduler stopped until the next
swap. The old host also holds service.lock, so retrying the bind alone
would have come up read-only (lockedBy) with no scheduler.

Now server() returns {} at once and, once per port, checks every second
in the background: while the marker answers it waits; when it stops it
runs the whole start (migrate, lock, bind, scheduler), and an
EADDRINUSE from a port not let go yet is tried again the next second.
The data directory is the one the call resolved. A port held by
something without the marker still throws, as before.

Run (mote, HOME=$(mktemp -d)):
- bun test in packages/window-warmup: 280 pass, 0 fail.
- tsc --noEmit: ok. bun scripts/check.mjs window-warmup: ok.
- dist rebuilt with bun scripts/build.ts; dist.test passes.

Broken by hand: origin/main's src/plugin.ts with the new tests: both
fail (marker stops, real old service holding port and lock stops).

Not tried: a real magpie host swap.
2026-11-16 23:21:33 +08:00

70 lines
2.6 KiB
JSON

{
"name": "@magpie-community/page-window-warmup",
"version": "0.1.6",
"description": "窗口预热 Window Warmup:定时消息插件,定时给指定供应商/账号/模型发一条短消息,在额度窗口重置后、每天定时或每隔几小时自动预热保活,提前开启5小时/每周订阅额度(配额)窗口,适用 Codex、Claude、GLM 智谱、ZCode 等。Scheduled keep-alive message to warm up quota / usage / rate limit windows after reset (cron-like).",
"author": "YangHonghang (https://github.com/YangHonghang)",
"type": "module",
"license": "MIT",
"main": "dist/plugin.js",
"files": [
"dist",
"page",
"README.md",
"LICENSE"
],
"engines": {
"magpie": ">=0.1.1340",
"bun": ">=1.4.2"
},
"scripts": {
"build": "bun scripts/build.ts",
"typecheck": "tsc --noEmit",
"test": "bun test"
},
"magpie": {
"page": {
"title": "Window Warmup",
"titles": {
"zh": "窗口预热",
"zh-TW": "窗口預熱",
"ja": "ウィンドウ予熱"
},
"file": "page/index.html",
"service": {
"port": 3492,
"option": "port"
},
"icon": "page/icon.svg"
},
"options": {
"port": 3492
},
"permissions": [],
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjODU4NThkIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4KICA8cmVjdCB4PSIzIiB5PSIzIiB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHJ4PSI0Ii8+CiAgPHBhdGggZD0iTTMgOGgxOCIvPgogIDxjaXJjbGUgY3g9IjYuMiIgY3k9IjUuNSIgcj0iLjkiIGZpbGw9IiM4NTg1OGQiIHN0cm9rZT0ibm9uZSIvPgogIDxjaXJjbGUgY3g9IjkiIGN5PSI1LjUiIHI9Ii45IiBmaWxsPSIjODU4NThkIiBzdHJva2U9Im5vbmUiLz4KICA8cGF0aCBkPSJNOC4zIDE4LjJjLTEuMi0xIDEuMi0xLjYgMC0yLjZzMS4yLTEuNiAwLTIuNiIvPgogIDxwYXRoIGQ9Ik0xMiAxOC4zYy0xLjMtMS4yIDEuMy0yIDAtMy4yczEuMy0yIDAtMy4yIi8+CiAgPHBhdGggZD0iTTE1LjcgMTguMmMtMS4yLTEgMS4yLTEuNiAwLTIuNnMxLjItMS42IDAtMi42Ii8+Cjwvc3ZnPgo="
},
"devDependencies": {
"typescript": "5.9.3",
"@types/bun": "1.4.4"
},
"repository": {
"type": "git",
"url": "git+https://github.com/magpie-community/plugins.git",
"directory": "packages/window-warmup"
},
"homepage": "https://github.com/magpie-community/plugins/tree/main/packages/window-warmup",
"bugs": "https://github.com/magpie-community/plugins/issues",
"keywords": [
"magpie",
"magpie-page",
"magpie-plugin",
"llm",
"window-warmup",
"cron",
"quota",
"warmup",
"keep-alive",
"schedule",
"rate-limit"
]
}