lingshu-skill 0.0.0-stage → 3.82.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 +2605 -0
- package/LICENSE +21 -0
- package/README.md +698 -3
- package/SKILL-lite.md +45 -0
- package/SKILL-tiny.md +37 -0
- package/SKILL.md +379 -0
- package/assets/panel.html +5616 -0
- package/cordis-plugin/lingshu-cron/cordis.patch.yml +3 -0
- package/cordis-plugin/lingshu-cron/index.js +4 -0
- package/cordis-plugin/lingshu-cron/package.json +34 -0
- package/cordis-plugin/lingshu-cron/plugin.js +1040 -0
- package/cordis-plugin/lingshu-guard/plugin.js +473 -0
- package/cordis-plugin/lingshu-im/plugin.js +635 -0
- package/cordis-plugin/lingshu-startup/README.md +123 -0
- package/cordis-plugin/lingshu-startup/cordis.patch.yml +3 -0
- package/cordis-plugin/lingshu-startup/index.js +4 -0
- package/cordis-plugin/lingshu-startup/package.json +25 -0
- package/cordis-plugin/lingshu-startup/plugin.js +352 -0
- package/cordis.patch.yml +3 -0
- package/docs/commands.md +243 -0
- package/docs/mechanics.md +610 -0
- package/docs/models.md +52 -0
- package/docs/npm-/345/217/221/345/270/203/350/257/264/346/230/216.md +49 -0
- package/docs/panel-api.md +198 -0
- package/docs/recovery.md +90 -0
- package/docs/tgz-/345/256/211/350/243/205/350/257/264/346/230/216.md +53 -0
- package/docs//350/277/233/345/261/225/344/270/216/345/276/205/345/212/236.md +804 -0
- package/index.js +102 -0
- package/package.json +52 -6
- package/scripts/_panel_smoke_v299.py +27 -0
- package/scripts/_smoke_v299.py +31 -0
- package/scripts/_sync_trae_cn.py +34 -0
- package/scripts/assembler.py +197 -0
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +53 -0
- package/scripts/astrbot_plugin_lingshu/PATCH_NOTES.md +28 -0
- package/scripts/astrbot_plugin_lingshu/README.md +58 -0
- package/scripts/astrbot_plugin_lingshu/_conf_schema.json +92 -0
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +2605 -0
- package/scripts/astrbot_plugin_lingshu/engine/README.md +698 -0
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +45 -0
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +37 -0
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +379 -0
- package/scripts/astrbot_plugin_lingshu/engine/assets/panel.html +5616 -0
- package/scripts/astrbot_plugin_lingshu/engine/docs/commands.md +243 -0
- package/scripts/astrbot_plugin_lingshu/engine/docs/mechanics.md +610 -0
- package/scripts/astrbot_plugin_lingshu/engine/docs/models.md +52 -0
- package/scripts/astrbot_plugin_lingshu/engine/docs/panel-api.md +198 -0
- package/scripts/astrbot_plugin_lingshu/engine/docs/recovery.md +90 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_panel_smoke_v299.py +27 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_smoke_v299.py +31 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_sync_trae_cn.py +34 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/assembler.py +197 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/behavior_baseline.py +280 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/bench.py +192 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/brain.py +46 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/check_pressure_sync.py +55 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/check_tag.py +215 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/checkpoint.py +165 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/cli.py +4867 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/context_ab.py +260 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/core.py +2028 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/dream.py +1137 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/emotion.py +1180 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/failures.py +107 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/fallback_embed.py +114 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +4745 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/growth_parts.py +263 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/insights.py +131 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/make_dsh_tgz.py +92 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_dialogue.py +242 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_embed.py +159 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_lesson.py +160 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_score.py +210 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_topic.py +177 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/memory.py +4417 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/npm_prepack.py +31 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_build.py +115 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_cloud.py +609 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +2703 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panels.py +591 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/persona.py +2309 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/retriever.py +195 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/safety.py +368 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/session_import.py +736 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/session_rag.py +228 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/session_summary.py +123 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/summarizer.py +252 -0
- package/scripts/astrbot_plugin_lingshu/main.py +703 -0
- package/scripts/astrbot_plugin_lingshu/make_checksums.py +87 -0
- package/scripts/astrbot_plugin_lingshu/metadata.yaml +7 -0
- package/scripts/behavior_baseline.py +280 -0
- package/scripts/bench.py +192 -0
- package/scripts/brain.py +46 -0
- package/scripts/check_pressure_sync.py +55 -0
- package/scripts/check_tag.py +215 -0
- package/scripts/check_version.py +265 -0
- package/scripts/checkpoint.py +165 -0
- package/scripts/cli.py +4867 -0
- package/scripts/context_ab.py +260 -0
- package/scripts/core.py +2028 -0
- package/scripts/dream.py +1137 -0
- package/scripts/emotion.py +1180 -0
- package/scripts/failures.py +107 -0
- package/scripts/fallback_embed.py +114 -0
- package/scripts/growth.py +4745 -0
- package/scripts/growth_parts.py +263 -0
- package/scripts/hooks/pre-commit +18 -0
- package/scripts/hooks/pre-push +20 -0
- package/scripts/insights.py +131 -0
- package/scripts/make_dsh_tgz.py +92 -0
- package/scripts/make_manifest.py +254 -0
- package/scripts/make_plugin_zip.py +88 -0
- package/scripts/mem_dialogue.py +242 -0
- package/scripts/mem_embed.py +159 -0
- package/scripts/mem_lesson.py +160 -0
- package/scripts/mem_score.py +210 -0
- package/scripts/mem_topic.py +177 -0
- package/scripts/memory.py +4417 -0
- package/scripts/npm_prepack.py +31 -0
- package/scripts/panel_build.py +115 -0
- package/scripts/panel_cloud.py +609 -0
- package/scripts/panel_server.py +2703 -0
- package/scripts/panels.py +591 -0
- package/scripts/persona.py +2309 -0
- package/scripts/recreate_push.ps1 +117 -0
- package/scripts/retriever.py +195 -0
- package/scripts/run_tests.py +91 -0
- package/scripts/safety.py +368 -0
- package/scripts/session_import.py +736 -0
- package/scripts/session_rag.py +228 -0
- package/scripts/session_summary.py +123 -0
- package/scripts/summarizer.py +252 -0
- package/scripts/sync_engine.py +139 -0
- package/scripts/update_dsh_copy.ps1 +107 -0
- package/start-panel.bat +60 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""npm publish 前的准备:生成 engine 副本 + 清掉 pycache,保证包里没有垃圾。
|
|
4
|
+
|
|
5
|
+
npm 的 files 白名单里的目录无法被 .npmignore 排除,所以 pycache 必须在
|
|
6
|
+
打包前从磁盘上清掉,而不是靠 ignore 规则。
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import shutil
|
|
11
|
+
import sys
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
15
|
+
sys.path.insert(0, str(ROOT / "scripts"))
|
|
16
|
+
|
|
17
|
+
import sync_engine # noqa: E402
|
|
18
|
+
|
|
19
|
+
if sync_engine.sync() != 0:
|
|
20
|
+
raise SystemExit("[prepack] engine 副本同步失败,拒绝发布空壳包")
|
|
21
|
+
|
|
22
|
+
removed = 0
|
|
23
|
+
for d in ROOT.rglob("__pycache__"):
|
|
24
|
+
# 只清仓库内的(数据目录不在仓库下,不受影响)
|
|
25
|
+
if d.is_dir():
|
|
26
|
+
shutil.rmtree(d, ignore_errors=True)
|
|
27
|
+
removed += 1
|
|
28
|
+
for p in ROOT.rglob("*.pyc"):
|
|
29
|
+
p.unlink(missing_ok=True)
|
|
30
|
+
removed += 1
|
|
31
|
+
print(f"[prepack] engine 已同步,清理 {removed} 个 pyc 缓存")
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""面板构建:把 panel_src/ 拼成 assets/panel.html(无依赖、字节级可复现)。
|
|
4
|
+
|
|
5
|
+
为什么不直接手改 271KB 单文件:4900 行里 4 段 script / 3 段 style,改一处要全文搜,
|
|
6
|
+
review 也没法看。拆成源码后:
|
|
7
|
+
panel_src/index.html 外壳(样式/脚本位置留 <!--@@BLOCK:n@@--> 占位)
|
|
8
|
+
panel_src/styles/*.css 样式块(按出现顺序)
|
|
9
|
+
panel_src/js/*.js 脚本块(按出现顺序)
|
|
10
|
+
panel_src/blocks.json 每个占位的标签属性 + 文件名(保证重建字节一致)
|
|
11
|
+
|
|
12
|
+
用法:
|
|
13
|
+
python scripts/panel_build.py --split # 一次性:把现有 assets/panel.html 拆成源码
|
|
14
|
+
python scripts/panel_build.py # 从源码重建
|
|
15
|
+
python scripts/panel_build.py --check # 只比对:源码重建结果 == 现成文件
|
|
16
|
+
"""
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import json
|
|
20
|
+
import re
|
|
21
|
+
import sys
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
|
|
24
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
25
|
+
SRC = ROOT / "panel_src"
|
|
26
|
+
OUT = ROOT / "assets" / "panel.html"
|
|
27
|
+
|
|
28
|
+
BLOCK_RE = re.compile(rb"(<(style|script)\b[^>]*>)(.*?)(</\2>)", re.S)
|
|
29
|
+
NAMES = {
|
|
30
|
+
"style": ["base.css", "views.css", "enhance.css"],
|
|
31
|
+
"script": ["app.js", "core.js", "panels.js", "enhance.js"],
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def split(out: Path = OUT, src: Path = SRC) -> int:
|
|
36
|
+
raw = out.read_bytes()
|
|
37
|
+
blocks = list(BLOCK_RE.finditer(raw))
|
|
38
|
+
if not blocks:
|
|
39
|
+
print("[panel] 没找到 <style>/<script> 块", file=sys.stderr)
|
|
40
|
+
return 1
|
|
41
|
+
src.mkdir(parents=True, exist_ok=True)
|
|
42
|
+
(src / "styles").mkdir(exist_ok=True)
|
|
43
|
+
(src / "js").mkdir(exist_ok=True)
|
|
44
|
+
meta = []
|
|
45
|
+
pos = 0
|
|
46
|
+
shell = []
|
|
47
|
+
counters = {"style": 0, "script": 0}
|
|
48
|
+
for m in blocks:
|
|
49
|
+
shell.append(raw[pos:m.start()])
|
|
50
|
+
kind = m.group(2).decode()
|
|
51
|
+
idx = counters[kind]
|
|
52
|
+
counters[kind] += 1
|
|
53
|
+
names = NAMES[kind]
|
|
54
|
+
name = names[idx] if idx < len(names) else f"{kind}{idx}.{'css' if kind == 'style' else 'js'}"
|
|
55
|
+
sub = "styles" if kind == "style" else "js"
|
|
56
|
+
(src / sub / name).write_bytes(m.group(3))
|
|
57
|
+
token = f"<!--@@BLOCK:{len(meta)}@@-->".encode()
|
|
58
|
+
shell.append(token)
|
|
59
|
+
meta.append({"kind": kind, "open": m.group(1).decode(), "file": f"{sub}/{name}"})
|
|
60
|
+
pos = m.end()
|
|
61
|
+
shell.append(raw[pos:])
|
|
62
|
+
(src / "index.html").write_bytes(b"".join(shell))
|
|
63
|
+
(src / "blocks.json").write_text(
|
|
64
|
+
json.dumps(meta, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
|
65
|
+
print(f"[panel] 拆出 {len(meta)} 块 → panel_src/({counters['style']} 样式 / {counters['script']} 脚本)")
|
|
66
|
+
return 0
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _norm_bytes(data: bytes) -> bytes:
|
|
70
|
+
"""比较用规范形态:去 BOM + CRLF→LF。
|
|
71
|
+
|
|
72
|
+
和 manifest / sync_engine / make_checksums 保持同一口径。否则在 Windows 上
|
|
73
|
+
只要 git 按 core.autocrlf 把源码写成 CRLF、产物是 LF,`--check` 就会假红
|
|
74
|
+
(实测踩过:git checkout 之后一次次报"不同步",其实内容一模一样)。
|
|
75
|
+
"""
|
|
76
|
+
if data.startswith(b"\xef\xbb\xbf"):
|
|
77
|
+
data = data[3:]
|
|
78
|
+
return data.replace(b"\r\n", b"\n")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def build(src: Path = SRC, out: Path | None = OUT) -> bytes:
|
|
82
|
+
"""拼装产物;out=None 时只返回字节、不落盘(--check 用,检查不该改文件)。"""
|
|
83
|
+
shell = (src / "index.html").read_bytes()
|
|
84
|
+
meta = json.loads((src / "blocks.json").read_text(encoding="utf-8"))
|
|
85
|
+
for i, blk in enumerate(meta):
|
|
86
|
+
token = f"<!--@@BLOCK:{i}@@-->".encode()
|
|
87
|
+
body = (src / blk["file"]).read_bytes()
|
|
88
|
+
close = b"</style>" if blk["kind"] == "style" else b"</script>"
|
|
89
|
+
shell = shell.replace(token, blk["open"].encode() + body + close, 1)
|
|
90
|
+
if out is not None:
|
|
91
|
+
out.parent.mkdir(parents=True, exist_ok=True)
|
|
92
|
+
out.write_bytes(shell)
|
|
93
|
+
return shell
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def main(argv=None) -> int:
|
|
97
|
+
argv = argv if argv is not None else sys.argv[1:]
|
|
98
|
+
if "--split" in argv:
|
|
99
|
+
return split()
|
|
100
|
+
if "--check" in argv:
|
|
101
|
+
old = OUT.read_bytes() if OUT.exists() else b""
|
|
102
|
+
new = build(out=None) # 只读:检查不能顺手把产物重写掉
|
|
103
|
+
if _norm_bytes(old) != _norm_bytes(new):
|
|
104
|
+
print("[panel] 不同步:assets/panel.html != panel_src 重建结果"
|
|
105
|
+
"(改了源码就跑 python scripts/panel_build.py)", file=sys.stderr)
|
|
106
|
+
return 1
|
|
107
|
+
print(f"[panel] OK:{len(new)} 字节,源码与产物一致")
|
|
108
|
+
return 0
|
|
109
|
+
data = build()
|
|
110
|
+
print(f"[panel] 已生成 assets/panel.html:{len(data)} 字节")
|
|
111
|
+
return 0
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
if __name__ == "__main__":
|
|
115
|
+
sys.exit(main())
|