lingshu-skill 5.68.0 → 5.70.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/CHANGELOG.md +43 -0
- package/README.md +1 -1
- package/SKILL-lite.md +1 -1
- package/SKILL-tiny.md +1 -1
- package/SKILL.md +1 -1
- package/assets/panel.html +11 -3
- package/cordis-plugin/lingshu-cron/plugin.js +32 -6
- package/cordis-plugin/lingshu-guard/plugin.js +34 -10
- package/cordis-plugin/lingshu-im/plugin.js +19 -2
- package/cordis-plugin/lingshu-startup/context-fold.js +5 -1
- package/cordis-plugin/lingshu-startup/plugin.js +9 -1
- package/index.js +26 -21
- package/manifest.json +35 -35
- package/package.json +1 -1
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +10 -10
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +43 -0
- package/scripts/astrbot_plugin_lingshu/engine/README.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/assets/panel.html +11 -3
- package/scripts/astrbot_plugin_lingshu/engine/scripts/desktop_shortcut.py +10 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +5629 -5575
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_data.py +17 -3
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_settings.py +24 -1
- package/scripts/desktop_shortcut.py +10 -1
- package/scripts/growth.py +5629 -5575
- package/scripts/panel_data.py +17 -3
- package/scripts/panel_settings.py +24 -1
- package/scripts/run_tests.py +240 -171
- package/scripts/update_dsh_copy.ps1 +42 -6
|
@@ -98,10 +98,22 @@ def list_backups(limit: int = 30) -> dict:
|
|
|
98
98
|
except OSError:
|
|
99
99
|
continue
|
|
100
100
|
sha_file = p.with_name(p.name + ".sha256")
|
|
101
|
-
|
|
101
|
+
# LS-074(v5.69):隔离损坏备份 manifest 的字段错误!
|
|
102
|
+
# 单条记录的 manifest 读失败 / 字段类型错不再让它 abort 整个列表——
|
|
103
|
+
# 按字段级容错,正常备份照常展示。
|
|
104
|
+
man = None
|
|
105
|
+
man_err = ""
|
|
106
|
+
try:
|
|
107
|
+
man = _manifest_of(p)
|
|
108
|
+
except Exception as _me: # noqa: BLE001
|
|
109
|
+
man_err = str(_me)[:80]
|
|
102
110
|
records = None
|
|
103
|
-
if man:
|
|
104
|
-
|
|
111
|
+
if isinstance(man, dict):
|
|
112
|
+
try:
|
|
113
|
+
records = int(man.get("total_records") or 0)
|
|
114
|
+
except (TypeError, ValueError):
|
|
115
|
+
records = None
|
|
116
|
+
man_err = "total_records 字段类型异常"
|
|
105
117
|
if records is None:
|
|
106
118
|
records = _count_in_zip(p) # 老备份没清单:解包数一遍
|
|
107
119
|
age_h = max(0.0, (time.time() - st.st_mtime) / 3600.0)
|
|
@@ -120,6 +132,8 @@ def list_backups(limit: int = 30) -> dict:
|
|
|
120
132
|
"suspicious_why": ("包体过小" if bad_size
|
|
121
133
|
else (f"记录数 {records} < 阈值 {threshold}" if bad_records else "")),
|
|
122
134
|
"has_sha": sha_file.is_file(),
|
|
135
|
+
"manifest_ok": bool(isinstance(man, dict) and not man_err),
|
|
136
|
+
"manifest_error": man_err,
|
|
123
137
|
})
|
|
124
138
|
return {"dir": str(d), "dir_exists": d.is_dir(), "items": items,
|
|
125
139
|
"count": len(items), "current_records": cur,
|
|
@@ -167,7 +167,13 @@ def all_items() -> list[dict]:
|
|
|
167
167
|
|
|
168
168
|
|
|
169
169
|
def coerce(spec: dict, raw) -> Any:
|
|
170
|
-
"""按 schema 校验并转换一个值;不合法抛 ValueError(消息可直接给用户看)。
|
|
170
|
+
"""按 schema 校验并转换一个值;不合法抛 ValueError(消息可直接给用户看)。
|
|
171
|
+
|
|
172
|
+
LS-075(v5.69):实现 enum 设置的后端转换——kind=enum 按 options 校验并返回字符串。
|
|
173
|
+
LS-077(v5.69):拒绝 float 配置中的非有限数——NaN/Infinity 落盘后
|
|
174
|
+
标准 JSON 输出会变 `NaN` 字面量,前端 JSON.parse 直接失败("已写入但前端解析失败")。
|
|
175
|
+
"""
|
|
176
|
+
import math as _math
|
|
171
177
|
kind = spec["kind"]
|
|
172
178
|
if kind == "bool":
|
|
173
179
|
if isinstance(raw, bool):
|
|
@@ -178,11 +184,28 @@ def coerce(spec: dict, raw) -> Any:
|
|
|
178
184
|
if s in ("false", "0", "no", "off"):
|
|
179
185
|
return False
|
|
180
186
|
raise ValueError(f"{spec['label']} 是开关,只接受 true/false")
|
|
187
|
+
if kind == "enum":
|
|
188
|
+
# LS-075: enum 类型——按 options 白名单校验,返回字符串
|
|
189
|
+
opts = spec.get("options") or []
|
|
190
|
+
s = str(raw).strip()
|
|
191
|
+
# enum 的 options 可能是 ["a","b"] 或 [{"value":"a","label":"A"},...]
|
|
192
|
+
vals = []
|
|
193
|
+
for o in opts:
|
|
194
|
+
if isinstance(o, dict):
|
|
195
|
+
vals.append(str(o.get("value", "")))
|
|
196
|
+
else:
|
|
197
|
+
vals.append(str(o))
|
|
198
|
+
if s not in vals:
|
|
199
|
+
raise ValueError(f"{spec['label']} 只能是 {'/'.join(vals) if vals else '(无可选值)'}")
|
|
200
|
+
return s
|
|
181
201
|
if kind in ("int", "float"):
|
|
182
202
|
try:
|
|
183
203
|
num = float(raw)
|
|
184
204
|
except (TypeError, ValueError):
|
|
185
205
|
raise ValueError(f"{spec['label']} 需要是数字")
|
|
206
|
+
# LS-077: 拒绝非有限数
|
|
207
|
+
if not _math.isfinite(num):
|
|
208
|
+
raise ValueError(f"{spec['label']} 不能是 NaN 或 Infinity")
|
|
186
209
|
if kind == "int":
|
|
187
210
|
if num != int(num):
|
|
188
211
|
raise ValueError(f"{spec['label']} 需要是整数")
|
|
@@ -30,7 +30,16 @@ def _pythonw() -> str:
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
def _desktop_dir() -> Path:
|
|
33
|
-
"""桌面真实路径:先读注册表 Shell Folders,再退回 USERPROFILE\\Desktop。
|
|
33
|
+
"""桌面真实路径:先读注册表 Shell Folders,再退回 USERPROFILE\\Desktop。
|
|
34
|
+
|
|
35
|
+
LS-145(v5.70):测试隔离——设置 LINGSHU_TEST_DESKTOP_DIR 时直接用它,
|
|
36
|
+
绝不在测试中往真实用户桌面写 .lnk。
|
|
37
|
+
"""
|
|
38
|
+
test_override = os.environ.get("LINGSHU_TEST_DESKTOP_DIR", "").strip()
|
|
39
|
+
if test_override:
|
|
40
|
+
p = Path(test_override)
|
|
41
|
+
p.mkdir(parents=True, exist_ok=True)
|
|
42
|
+
return p
|
|
34
43
|
try:
|
|
35
44
|
import winreg
|
|
36
45
|
with winreg.OpenKey(
|