lingshu-skill 5.25.0 → 5.29.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/README.md +1577 -1577
  3. package/SKILL-lite.md +59 -59
  4. package/SKILL-tiny.md +38 -38
  5. package/SKILL.md +405 -405
  6. package/cordis-plugin/lingshu-cron/plugin.js +15 -5
  7. package/docs//345/256/241/346/240/270/346/224/271/350/277/233/345/276/205/345/212/236.md +228 -150
  8. package/package.json +52 -52
  9. package/scripts/_ci_env_probe.py +81 -0
  10. package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +18 -18
  11. package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +189 -0
  12. package/scripts/astrbot_plugin_lingshu/engine/README.md +1577 -1577
  13. package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +59 -59
  14. package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +38 -38
  15. package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +405 -405
  16. package/scripts/astrbot_plugin_lingshu/engine/scripts/_ci_env_probe.py +81 -0
  17. package/scripts/astrbot_plugin_lingshu/engine/scripts/behavior_baseline.py +28 -0
  18. package/scripts/astrbot_plugin_lingshu/engine/scripts/bench.py +218 -190
  19. package/scripts/astrbot_plugin_lingshu/engine/scripts/check_pressure_sync.py +31 -0
  20. package/scripts/astrbot_plugin_lingshu/engine/scripts/check_tag.py +28 -0
  21. package/scripts/astrbot_plugin_lingshu/engine/scripts/cli.py +11 -2
  22. package/scripts/astrbot_plugin_lingshu/engine/scripts/coverage_report.py +28 -0
  23. package/scripts/astrbot_plugin_lingshu/engine/scripts/dream.py +14 -1
  24. package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +28 -0
  25. package/scripts/astrbot_plugin_lingshu/engine/scripts/make_icon.py +24 -0
  26. package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_build.py +31 -0
  27. package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +28 -0
  28. package/scripts/astrbot_plugin_lingshu/engine/scripts/release.py +28 -0
  29. package/scripts/astrbot_plugin_lingshu/engine/scripts/session_import.py +28 -0
  30. package/scripts/astrbot_plugin_lingshu/make_checksums.py +28 -0
  31. package/scripts/behavior_baseline.py +28 -0
  32. package/scripts/bench.py +218 -190
  33. package/scripts/check_pressure_sync.py +31 -0
  34. package/scripts/check_tag.py +28 -0
  35. package/scripts/check_version.py +31 -0
  36. package/scripts/cli.py +11 -2
  37. package/scripts/coverage_report.py +28 -0
  38. package/scripts/dream.py +14 -1
  39. package/scripts/growth.py +28 -0
  40. package/scripts/make_icon.py +24 -0
  41. package/scripts/make_manifest.py +285 -254
  42. package/scripts/make_plugin_zip.py +28 -0
  43. package/scripts/panel_build.py +31 -0
  44. package/scripts/panel_server.py +28 -0
  45. package/scripts/release.py +28 -0
  46. package/scripts/run_tests.py +31 -0
  47. package/scripts/session_import.py +28 -0
  48. package/scripts/sync_engine.py +170 -139
  49. package/docs/npm-/345/217/221/345/270/203/350/257/264/346/230/216.md +0 -49
  50. package/docs/tgz-/345/256/211/350/243/205/350/257/264/346/230/216.md +0 -53
  51. package/docs//345/217/221/345/270/203/350/207/252/345/212/250/345/214/226.md +0 -54
@@ -163,5 +163,33 @@ def main(argv=None) -> int:
163
163
  return 0
164
164
 
165
165
 
166
+ def _ensure_utf8_stdout() -> None:
167
+ """把 stdout/stderr 切到 UTF-8,避免 Windows 控制台(cp1252/cp936)编不了中文就崩。
168
+
169
+ CI 的 windows-latest stdout 是 cp1252:脚本一 print 中文就 UnicodeEncodeError
170
+ 直接退出(实测 sync_engine.py / make_checksums.py 都因此挂过,Ubuntu 同期正常)。
171
+ 这不是业务 bug,是"中文输出 + 非 UTF-8 控制台"的必然结果。
172
+ """
173
+ for name in ("stdout", "stderr"):
174
+ stream = getattr(sys, name, None)
175
+ fn = getattr(stream, "reconfigure", None)
176
+ if callable(fn):
177
+ try:
178
+ fn(encoding="utf-8", errors="replace")
179
+ continue
180
+ except (OSError, ValueError, AttributeError):
181
+ pass
182
+ try:
183
+ import io
184
+ buf = getattr(stream, "buffer", None)
185
+ if buf is not None:
186
+ setattr(sys, name,
187
+ io.TextIOWrapper(buf, encoding="utf-8", errors="replace",
188
+ line_buffering=True))
189
+ except Exception: # noqa: BLE001
190
+ pass
191
+
192
+
166
193
  if __name__ == "__main__":
194
+ _ensure_utf8_stdout()
167
195
  sys.exit(main())
@@ -732,6 +732,7 @@ def dream(trigger: str = "manual", dry_run: bool = False) -> dict:
732
732
  # 新任务也可能被晾着(借鉴 Mnemosyne 幂等键防重复情节、租约验证)。
733
733
  # 未超时 → 沿用旧任务;超时太久(孤儿)→ 归档后接新任务。
734
734
  old = load_dream_pending()
735
+ keep_old = False
735
736
  if old and old.get("task_id"):
736
737
  age = now - _num(old.get("created"), now)
737
738
  if age < _DREAM_ORPHAN_TTL:
@@ -739,6 +740,7 @@ def dream(trigger: str = "manual", dry_run: bool = False) -> dict:
739
740
  task_id = old["task_id"]
740
741
  report["task_id"] = task_id
741
742
  report["pending_kept"] = True
743
+ keep_old = True
742
744
  log_event("dream", f"已有未整理的梦(task_id={old['task_id']},"
743
745
  f"{age / 3600:.1f}h 前触发),本次不重复生成新任务", level="warn")
744
746
  else:
@@ -751,7 +753,18 @@ def dream(trigger: str = "manual", dry_run: bool = False) -> dict:
751
753
  f"悬置 {age / 3600:.1f}h > {_DREAM_ORPHAN_TTL / 3600:.0f}h),"
752
754
  "生成新任务", level="warn")
753
755
  report["orphaned_task_id"] = old["task_id"]
754
- atomic_json(HOME / "dreams" / "pending.json", new_pending)
756
+ # ⚠ 两处必须一起改(原先只改了一半,实测导致自动做梦必然失败):
757
+ # ① 沿用旧任务时**绝不能写盘**——new_pending 装的是本次的新簇,
758
+ # 写下去等于用新簇顶掉旧 task_id 的任务,旧簇静默丢失;
759
+ # ② 真写盘时,pending 里的 task_id 必须是**最终** task_id。
760
+ # new_pending 在 L709 用新 id 构造,若期间 task_id 被改写(孤儿归档
761
+ # 分支不会改,但任何未来的改写都会),两者就会错位——
762
+ # 而 `dream --auto` 拿 report["task_id"] 去 apply,盘上却是另一个 id
763
+ # → 稳定报"任务对不上"。这里显式同步,不依赖构造顺序。
764
+ if not keep_old:
765
+ new_pending["task_id"] = task_id
766
+ new_pending["apply_schema"]["task_id"] = task_id
767
+ atomic_json(HOME / "dreams" / "pending.json", new_pending)
755
768
  # 没有可整理的碎片就不写 pending.json,免得让 AI 对着一份空任务空转
756
769
  write_dream_report(report)
757
770
  st = load_dream_state()
@@ -5379,6 +5379,34 @@ def _run(argv=None) -> int:
5379
5379
  from growth_parts import * # noqa: E402,F401,F403
5380
5380
 
5381
5381
 
5382
+ def _ensure_utf8_stdout() -> None:
5383
+ """把 stdout/stderr 切到 UTF-8,避免 Windows 控制台(cp1252/cp936)编不了中文就崩。
5384
+
5385
+ CI 的 windows-latest stdout 是 cp1252:脚本一 print 中文就 UnicodeEncodeError
5386
+ 直接退出(实测 sync_engine.py / make_checksums.py 都因此挂过,Ubuntu 同期正常)。
5387
+ 这不是业务 bug,是"中文输出 + 非 UTF-8 控制台"的必然结果。
5388
+ """
5389
+ for name in ("stdout", "stderr"):
5390
+ stream = getattr(sys, name, None)
5391
+ fn = getattr(stream, "reconfigure", None)
5392
+ if callable(fn):
5393
+ try:
5394
+ fn(encoding="utf-8", errors="replace")
5395
+ continue
5396
+ except (OSError, ValueError, AttributeError):
5397
+ pass
5398
+ try:
5399
+ import io
5400
+ buf = getattr(stream, "buffer", None)
5401
+ if buf is not None:
5402
+ setattr(sys, name,
5403
+ io.TextIOWrapper(buf, encoding="utf-8", errors="replace",
5404
+ line_buffering=True))
5405
+ except Exception: # noqa: BLE001
5406
+ pass
5407
+
5408
+
5382
5409
  if __name__ == "__main__":
5410
+ _ensure_utf8_stdout()
5383
5411
  sys.exit(run())
5384
5412
 
@@ -10,6 +10,7 @@
10
10
  用法:python scripts/make_icon.py [--out 路径.ico]
11
11
  """
12
12
  from __future__ import annotations
13
+ import sys
13
14
 
14
15
  import argparse
15
16
  import math
@@ -142,5 +143,28 @@ def main() -> int:
142
143
  return 0
143
144
 
144
145
 
146
+ def _ensure_utf8_stdout() -> None:
147
+ """stdout/stderr 切 UTF-8——Windows CI 是 cp1252,print 中文会直接崩。"""
148
+ for _name in ("stdout", "stderr"):
149
+ _s = getattr(sys, _name, None)
150
+ _fn = getattr(_s, "reconfigure", None)
151
+ if callable(_fn):
152
+ try:
153
+ _fn(encoding="utf-8", errors="replace")
154
+ continue
155
+ except (OSError, ValueError, AttributeError):
156
+ pass
157
+ try:
158
+ import io
159
+ _buf = getattr(_s, "buffer", None)
160
+ if _buf is not None:
161
+ setattr(sys, _name,
162
+ io.TextIOWrapper(_buf, encoding="utf-8", errors="replace",
163
+ line_buffering=True))
164
+ except Exception:
165
+ pass
166
+
167
+
145
168
  if __name__ == "__main__":
169
+ _ensure_utf8_stdout()
146
170
  raise SystemExit(main())
@@ -111,5 +111,36 @@ def main(argv=None) -> int:
111
111
  return 0
112
112
 
113
113
 
114
+ def _ensure_utf8_stdout() -> None:
115
+ """把 stdout/stderr 切到 UTF-8,避免 Windows 控制台(cp1252/cp936)编不了中文就崩。
116
+
117
+ 为什么必须有:CI 的 windows-latest stdout 是 cp1252,脚本一 print 中文就
118
+ UnicodeEncodeError 直接退出(实测 sync_engine.py 因此挂掉,Ubuntu 同期正常)。
119
+ 这不是业务 bug,是"中文输出 + 非 UTF-8 控制台"的必然结果。
120
+
121
+ reconfigure 不可用(3.6 及更早 / 被替换过的流)时静默跳过,绝不因此再崩。
122
+ """
123
+ for name in ("stdout", "stderr"):
124
+ stream = getattr(sys, name, None)
125
+ fn = getattr(stream, "reconfigure", None)
126
+ if callable(fn):
127
+ try:
128
+ fn(encoding="utf-8", errors="replace")
129
+ continue
130
+ except (OSError, ValueError, AttributeError):
131
+ pass
132
+ # 退路:包一层 UTF-8 writer(errors=replace,坏字符变 ?,不打断程序)
133
+ try:
134
+ import io
135
+ buf = getattr(stream, "buffer", None)
136
+ if buf is not None:
137
+ setattr(sys, name,
138
+ io.TextIOWrapper(buf, encoding="utf-8", errors="replace",
139
+ line_buffering=True))
140
+ except Exception: # noqa: BLE001
141
+ pass
142
+
143
+
114
144
  if __name__ == "__main__":
145
+ _ensure_utf8_stdout()
115
146
  sys.exit(main())
@@ -3050,7 +3050,35 @@ def serve(port: int = 8765, open_browser: bool = True) -> None:
3050
3050
  httpd.server_close()
3051
3051
 
3052
3052
 
3053
+ def _ensure_utf8_stdout() -> None:
3054
+ """把 stdout/stderr 切到 UTF-8,避免 Windows 控制台(cp1252/cp936)编不了中文就崩。
3055
+
3056
+ CI 的 windows-latest stdout 是 cp1252:脚本一 print 中文就 UnicodeEncodeError
3057
+ 直接退出(实测 sync_engine.py / make_checksums.py 都因此挂过,Ubuntu 同期正常)。
3058
+ 这不是业务 bug,是"中文输出 + 非 UTF-8 控制台"的必然结果。
3059
+ """
3060
+ for name in ("stdout", "stderr"):
3061
+ stream = getattr(sys, name, None)
3062
+ fn = getattr(stream, "reconfigure", None)
3063
+ if callable(fn):
3064
+ try:
3065
+ fn(encoding="utf-8", errors="replace")
3066
+ continue
3067
+ except (OSError, ValueError, AttributeError):
3068
+ pass
3069
+ try:
3070
+ import io
3071
+ buf = getattr(stream, "buffer", None)
3072
+ if buf is not None:
3073
+ setattr(sys, name,
3074
+ io.TextIOWrapper(buf, encoding="utf-8", errors="replace",
3075
+ line_buffering=True))
3076
+ except Exception: # noqa: BLE001
3077
+ pass
3078
+
3079
+
3053
3080
  if __name__ == "__main__":
3081
+ _ensure_utf8_stdout()
3054
3082
  import argparse
3055
3083
  ap = argparse.ArgumentParser()
3056
3084
  # 端口优先取 config.json 的 panel_port(设置页可改),再退回 8765。
@@ -255,5 +255,33 @@ def main() -> int:
255
255
  return do_status()
256
256
 
257
257
 
258
+ def _ensure_utf8_stdout() -> None:
259
+ """把 stdout/stderr 切到 UTF-8,避免 Windows 控制台(cp1252/cp936)编不了中文就崩。
260
+
261
+ CI 的 windows-latest stdout 是 cp1252:脚本一 print 中文就 UnicodeEncodeError
262
+ 直接退出(实测 sync_engine.py / make_checksums.py 都因此挂过,Ubuntu 同期正常)。
263
+ 这不是业务 bug,是"中文输出 + 非 UTF-8 控制台"的必然结果。
264
+ """
265
+ for name in ("stdout", "stderr"):
266
+ stream = getattr(sys, name, None)
267
+ fn = getattr(stream, "reconfigure", None)
268
+ if callable(fn):
269
+ try:
270
+ fn(encoding="utf-8", errors="replace")
271
+ continue
272
+ except (OSError, ValueError, AttributeError):
273
+ pass
274
+ try:
275
+ import io
276
+ buf = getattr(stream, "buffer", None)
277
+ if buf is not None:
278
+ setattr(sys, name,
279
+ io.TextIOWrapper(buf, encoding="utf-8", errors="replace",
280
+ line_buffering=True))
281
+ except Exception: # noqa: BLE001
282
+ pass
283
+
284
+
258
285
  if __name__ == "__main__":
286
+ _ensure_utf8_stdout()
259
287
  sys.exit(main())
@@ -732,5 +732,33 @@ def main(argv=None) -> int:
732
732
  return 0 if report.get("ok") else 1
733
733
 
734
734
 
735
+ def _ensure_utf8_stdout() -> None:
736
+ """把 stdout/stderr 切到 UTF-8,避免 Windows 控制台(cp1252/cp936)编不了中文就崩。
737
+
738
+ CI 的 windows-latest stdout 是 cp1252:脚本一 print 中文就 UnicodeEncodeError
739
+ 直接退出(实测 sync_engine.py / make_checksums.py 都因此挂过,Ubuntu 同期正常)。
740
+ 这不是业务 bug,是"中文输出 + 非 UTF-8 控制台"的必然结果。
741
+ """
742
+ for name in ("stdout", "stderr"):
743
+ stream = getattr(sys, name, None)
744
+ fn = getattr(stream, "reconfigure", None)
745
+ if callable(fn):
746
+ try:
747
+ fn(encoding="utf-8", errors="replace")
748
+ continue
749
+ except (OSError, ValueError, AttributeError):
750
+ pass
751
+ try:
752
+ import io
753
+ buf = getattr(stream, "buffer", None)
754
+ if buf is not None:
755
+ setattr(sys, name,
756
+ io.TextIOWrapper(buf, encoding="utf-8", errors="replace",
757
+ line_buffering=True))
758
+ except Exception: # noqa: BLE001
759
+ pass
760
+
761
+
735
762
  if __name__ == "__main__":
763
+ _ensure_utf8_stdout()
736
764
  sys.exit(main())
@@ -83,5 +83,33 @@ def main(argv: list[str] | None = None) -> int:
83
83
  return 0
84
84
 
85
85
 
86
+ def _ensure_utf8_stdout() -> None:
87
+ """把 stdout/stderr 切到 UTF-8,避免 Windows 控制台(cp1252/cp936)编不了中文就崩。
88
+
89
+ CI 的 windows-latest stdout 是 cp1252:脚本一 print 中文就 UnicodeEncodeError
90
+ 直接退出(实测 sync_engine.py / make_checksums.py 都因此挂过,Ubuntu 同期正常)。
91
+ 这不是业务 bug,是"中文输出 + 非 UTF-8 控制台"的必然结果。
92
+ """
93
+ for name in ("stdout", "stderr"):
94
+ stream = getattr(sys, name, None)
95
+ fn = getattr(stream, "reconfigure", None)
96
+ if callable(fn):
97
+ try:
98
+ fn(encoding="utf-8", errors="replace")
99
+ continue
100
+ except (OSError, ValueError, AttributeError):
101
+ pass
102
+ try:
103
+ import io
104
+ buf = getattr(stream, "buffer", None)
105
+ if buf is not None:
106
+ setattr(sys, name,
107
+ io.TextIOWrapper(buf, encoding="utf-8", errors="replace",
108
+ line_buffering=True))
109
+ except Exception: # noqa: BLE001
110
+ pass
111
+
112
+
86
113
  if __name__ == "__main__":
114
+ _ensure_utf8_stdout()
87
115
  sys.exit(main())
@@ -278,5 +278,33 @@ def main(argv: list[str]) -> int:
278
278
  return check(a.quiet)
279
279
 
280
280
 
281
+ def _ensure_utf8_stdout() -> None:
282
+ """把 stdout/stderr 切到 UTF-8,避免 Windows 控制台(cp1252/cp936)编不了中文就崩。
283
+
284
+ CI 的 windows-latest stdout 是 cp1252:脚本一 print 中文就 UnicodeEncodeError
285
+ 直接退出(实测 sync_engine.py / make_checksums.py 都因此挂过,Ubuntu 同期正常)。
286
+ 这不是业务 bug,是"中文输出 + 非 UTF-8 控制台"的必然结果。
287
+ """
288
+ for name in ("stdout", "stderr"):
289
+ stream = getattr(sys, name, None)
290
+ fn = getattr(stream, "reconfigure", None)
291
+ if callable(fn):
292
+ try:
293
+ fn(encoding="utf-8", errors="replace")
294
+ continue
295
+ except (OSError, ValueError, AttributeError):
296
+ pass
297
+ try:
298
+ import io
299
+ buf = getattr(stream, "buffer", None)
300
+ if buf is not None:
301
+ setattr(sys, name,
302
+ io.TextIOWrapper(buf, encoding="utf-8", errors="replace",
303
+ line_buffering=True))
304
+ except Exception: # noqa: BLE001
305
+ pass
306
+
307
+
281
308
  if __name__ == "__main__":
309
+ _ensure_utf8_stdout()
282
310
  sys.exit(main(sys.argv[1:]))